Commit 1ac74b47 authored by Albert Astals Cid's avatar Albert Astals Cid Committed by Albert Astals Cid

Pass small and trivially-copyable type by value

parent e69cd723
......@@ -142,7 +142,7 @@ struct TrueTypeLoca {
#define vertTag 0x76657274
struct cmpTrueTypeLocaOffsetFunctor {
bool operator()(const TrueTypeLoca &loca1, const TrueTypeLoca &loca2) {
bool operator()(const TrueTypeLoca loca1, const TrueTypeLoca loca2) {
if (loca1.origOffset == loca2.origOffset) {
return loca1.idx < loca2.idx;
}
......@@ -151,7 +151,7 @@ struct cmpTrueTypeLocaOffsetFunctor {
};
struct cmpTrueTypeLocaIdxFunctor {
bool operator()(const TrueTypeLoca &loca1, const TrueTypeLoca &loca2) {
bool operator()(const TrueTypeLoca loca1, const TrueTypeLoca loca2) {
return loca1.idx < loca2.idx;
}
};
......
......@@ -608,7 +608,7 @@ void FormWidgetSignature::updateWidgetAppearance()
// FormField
//========================================================================
FormField::FormField(PDFDoc *docA, Object *aobj, const Ref& aref, FormField *parentA, std::set<int> *usedParents, FormFieldType ty)
FormField::FormField(PDFDoc *docA, Object *aobj, const Ref aref, FormField *parentA, std::set<int> *usedParents, FormFieldType ty)
{
doc = docA;
xref = doc->getXRef();
......@@ -966,7 +966,7 @@ void FormField::setReadOnly (bool value)
//------------------------------------------------------------------------
// FormFieldButton
//------------------------------------------------------------------------
FormFieldButton::FormFieldButton(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent, std::set<int> *usedParents)
FormFieldButton::FormFieldButton(PDFDoc *docA, Object *aobj, const Ref ref, FormField *parent, std::set<int> *usedParents)
: FormField(docA, aobj, ref, parent, usedParents, formButton)
{
Dict* dict = obj.getDict();
......@@ -1133,7 +1133,7 @@ FormFieldButton::~FormFieldButton()
//------------------------------------------------------------------------
// FormFieldText
//------------------------------------------------------------------------
FormFieldText::FormFieldText(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent, std::set<int> *usedParents)
FormFieldText::FormFieldText(PDFDoc *docA, Object *aobj, const Ref ref, FormField *parent, std::set<int> *usedParents)
: FormField(docA, aobj, ref, parent, usedParents, formText)
{
Dict* dict = obj.getDict();
......@@ -1296,7 +1296,7 @@ int FormFieldText::parseDA(GooList* daToks)
//------------------------------------------------------------------------
// FormFieldChoice
//------------------------------------------------------------------------
FormFieldChoice::FormFieldChoice(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent, std::set<int> *usedParents)
FormFieldChoice::FormFieldChoice(PDFDoc *docA, Object *aobj, const Ref ref, FormField *parent, std::set<int> *usedParents)
: FormField(docA, aobj, ref, parent, usedParents, formChoice)
{
numChoices = 0;
......@@ -1588,7 +1588,7 @@ const GooString *FormFieldChoice::getSelectedChoice() const {
//------------------------------------------------------------------------
// FormFieldSignature
//------------------------------------------------------------------------
FormFieldSignature::FormFieldSignature(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set<int> *usedParents)
FormFieldSignature::FormFieldSignature(PDFDoc *docA, Object *dict, const Ref ref, FormField *parent, std::set<int> *usedParents)
: FormField(docA, dict, ref, parent, usedParents, formSignature),
signature_type(adbe_pkcs7_detached),
signature(nullptr), signature_info(nullptr)
......@@ -1898,7 +1898,7 @@ Object Form::fieldLookup(Dict *field, const char *key) {
return ::fieldLookup(field, key, &usedParents);
}
FormField *Form::createFieldFromDict (Object* obj, PDFDoc *docA, const Ref& pref, FormField *parent, std::set<int> *usedParents)
FormField *Form::createFieldFromDict (Object* obj, PDFDoc *docA, const Ref pref, FormField *parent, std::set<int> *usedParents)
{
FormField *field;
......
......@@ -287,7 +287,7 @@ public:
class FormField {
public:
FormField(PDFDoc *docA, Object *aobj, const Ref& aref, FormField *parent, std::set<int> *usedParents, FormFieldType t=formUndef);
FormField(PDFDoc *docA, Object *aobj, const Ref aref, FormField *parent, std::set<int> *usedParents, FormFieldType t=formUndef);
virtual ~FormField();
......@@ -359,7 +359,7 @@ private:
class FormFieldButton: public FormField {
public:
FormFieldButton(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set<int> *usedParents);
FormFieldButton(PDFDoc *docA, Object *dict, const Ref ref, FormField *parent, std::set<int> *usedParents);
FormButtonType getButtonType () const { return btype; }
......@@ -403,7 +403,7 @@ protected:
class FormFieldText: public FormField {
public:
FormFieldText(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set<int> *usedParents);
FormFieldText(PDFDoc *docA, Object *dict, const Ref ref, FormField *parent, std::set<int> *usedParents);
const GooString* getContent () const { return content; }
void setContentCopy (const GooString* new_content);
......@@ -448,7 +448,7 @@ protected:
class FormFieldChoice: public FormField {
public:
FormFieldChoice(PDFDoc *docA, Object *aobj, const Ref& ref, FormField *parent, std::set<int> *usedParents);
FormFieldChoice(PDFDoc *docA, Object *aobj, const Ref ref, FormField *parent, std::set<int> *usedParents);
~FormFieldChoice();
......@@ -516,7 +516,7 @@ protected:
class FormFieldSignature: public FormField {
friend class FormWidgetSignature;
public:
FormFieldSignature(PDFDoc *docA, Object *dict, const Ref& ref, FormField *parent, std::set<int> *usedParents);
FormFieldSignature(PDFDoc *docA, Object *dict, const Ref ref, FormField *parent, std::set<int> *usedParents);
// Use -1 for now as validationTime
SignatureInfo *validateSignature(bool doVerifyCert, bool forceRevalidation, time_t validationTime);
......@@ -557,7 +557,7 @@ public:
/* Creates a new Field of the type specified in obj's dict.
used in Form::Form and FormField::FormField */
static FormField *createFieldFromDict (Object* obj, PDFDoc *docA, const Ref& aref, FormField *parent, std::set<int> *usedParents);
static FormField *createFieldFromDict (Object* obj, PDFDoc *docA, const Ref aref, FormField *parent, std::set<int> *usedParents);
Object *getObj () const { return acroForm; }
bool getNeedAppearances () const { return needAppearances; }
......
......@@ -1699,8 +1699,8 @@ Dict *Gfx8BitFont::getResources() {
//------------------------------------------------------------------------
struct cmpWidthExcepFunctor {
bool operator()(const GfxFontCIDWidthExcep &w1,
const GfxFontCIDWidthExcep &w2) {
bool operator()(const GfxFontCIDWidthExcep w1,
const GfxFontCIDWidthExcep w2) {
return w1.first < w2.first;
}
};
......
......@@ -30,7 +30,7 @@ static inline double clip01(double x) {
return (x < 0) ? 0 : (x > 1) ? 1 : x;
}
static inline void cmykToRGBMatrixMultiplication(const double &c, const double &m, const double &y, const double &k, const double &c1, const double &m1, const double &y1, const double &k1, double &r, double &g, double &b)
static inline void cmykToRGBMatrixMultiplication(const double c, const double m, const double y, const double k, const double c1, const double m1, const double y1, const double k1, double &r, double &g, double &b)
{
double x;
// this is a matrix multiplication, unrolled for performance
......
......@@ -50,7 +50,7 @@ private:
// Note: Takes ownership of strings, increases refcount for font.
TextSpan(GooString *text,
GfxFont *font,
const GfxRGB& color)
const GfxRGB color)
: data(new Data) {
data->text = text;
data->font = font;
......
......@@ -85,11 +85,11 @@ struct Ref {
int gen; // generation number
};
inline bool operator== (const Ref& lhs, const Ref& rhs) noexcept {
inline bool operator== (const Ref lhs, const Ref rhs) noexcept {
return lhs.num == rhs.num && lhs.gen == rhs.gen;
}
inline bool operator< (const Ref& lhs, const Ref& rhs) noexcept {
inline bool operator< (const Ref lhs, const Ref rhs) noexcept {
if (lhs.num != rhs.num)
return lhs.num < rhs.num;
return lhs.gen < rhs.gen;
......@@ -104,7 +104,7 @@ struct hash<Ref>
using argument_type = Ref;
using result_type = size_t;
result_type operator() (const argument_type &ref) const noexcept
result_type operator() (const argument_type ref) const noexcept
{
return std::hash<int>{}(ref.num) ^ (std::hash<int>{}(ref.gen) << 1);
}
......
......@@ -120,7 +120,7 @@ bool OCGs::hasOCGs() const
return !( optionalContentGroups.empty() );
}
OptionalContentGroup* OCGs::findOcgByRef( const Ref &ref )
OptionalContentGroup* OCGs::findOcgByRef( const Ref ref )
{
const auto ocg = optionalContentGroups.find( ref );
return ocg != optionalContentGroups.end() ? ocg->second.get() : nullptr;
......
......@@ -42,7 +42,7 @@ public:
bool hasOCGs() const;
const std::unordered_map< Ref, std::unique_ptr< OptionalContentGroup > > &getOCGs() const { return optionalContentGroups; }
OptionalContentGroup* findOcgByRef( const Ref &ref);
OptionalContentGroup* findOcgByRef( const Ref ref);
// Get the root node of the optional content group display tree
// (which does not necessarily include all of the OCGs).
......
......@@ -860,7 +860,7 @@ StructElement::StructElement(int mcid, StructTreeRoot *treeRootA, StructElement
assert(parent);
}
StructElement::StructElement(const Ref& ref, StructTreeRoot *treeRootA, StructElement *parentA):
StructElement::StructElement(const Ref ref, StructTreeRoot *treeRootA, StructElement *parentA):
type(OBJR),
treeRoot(treeRootA),
parent(parentA),
......
......@@ -280,7 +280,7 @@ private:
};
ContentData(int mcidA): mcid(mcidA) {}
ContentData(const Ref& r) { ref.num = r.num; ref.gen = r.gen; }
ContentData(const Ref r) { ref.num = r.num; ref.gen = r.gen; }
};
// Common data
......@@ -296,7 +296,7 @@ private:
StructElement(Dict *elementDict, StructTreeRoot *treeRootA, StructElement *parentA, std::set<int> &seen);
StructElement(int mcid, StructTreeRoot *treeRootA, StructElement *parentA);
StructElement(const Ref &ref, StructTreeRoot *treeRootA, StructElement *parentA);
StructElement(const Ref ref, StructTreeRoot *treeRootA, StructElement *parentA);
void parse(Dict* elementDict);
StructElement* parseChild(Object *ref, Object* childObj, std::set<int> &seen);
......
......@@ -175,7 +175,7 @@ void StructTreeRoot::parseNumberTreeNode(Dict *node)
}
void StructTreeRoot::parentTreeAdd(const Ref &objectRef, StructElement *element)
void StructTreeRoot::parentTreeAdd(const Ref objectRef, StructElement *element)
{
auto range = refToParentMap.equal_range(objectRef);
for (auto it = range.first; it !=range.second; ++it)
......
......@@ -80,7 +80,7 @@ private:
void parse(Dict *rootDict);
void parseNumberTreeNode(Dict *node);
void parentTreeAdd(const Ref &objectRef, StructElement *element);
void parentTreeAdd(const Ref objectRef, StructElement *element);
friend class StructElement;
};
......
......@@ -50,7 +50,7 @@ class XPDFReader
static inline void lookupDate( Dict *, char *, QDateTime & dest );
// transform from user coords to normalized ones using the matrix M
static inline void transform( double * M, double x, double y, QPointF &res );
static inline void invTransform( double * M, const QPointF &p, double &x, double &y );
static inline void invTransform( double * M, const QPointF p, double &x, double &y );
};
void XPDFReader::lookupName( Dict * dict, char * type, QString & dest )
......@@ -167,7 +167,7 @@ void XPDFReader::transform( double * M, double x, double y, QPointF &res )
res.setY( M[1] * x + M[3] * y + M[5] );
}
void XPDFReader::invTransform( double * M, const QPointF &p, double &x, double &y )
void XPDFReader::invTransform( double * M, const QPointF p, double &x, double &y )
{
const double det = M[0]*M[3] - M[1]*M[2];
Q_ASSERT(det != 0);
......
......@@ -148,7 +148,7 @@ class LinkSoundPrivate : public LinkPrivate
class LinkRenditionPrivate : public LinkPrivate
{
public:
LinkRenditionPrivate( const QRectF &area, ::MediaRendition *rendition, ::LinkRendition::RenditionOperation operation, const QString &script, const Ref &annotationReference );
LinkRenditionPrivate( const QRectF &area, ::MediaRendition *rendition, ::LinkRendition::RenditionOperation operation, const QString &script, const Ref annotationReference );
~LinkRenditionPrivate();
MediaRendition *rendition;
......@@ -157,7 +157,7 @@ class LinkRenditionPrivate : public LinkPrivate
Ref annotationReference;
};
LinkRenditionPrivate::LinkRenditionPrivate( const QRectF &area, ::MediaRendition *r, ::LinkRendition::RenditionOperation operation, const QString &javaScript, const Ref &ref )
LinkRenditionPrivate::LinkRenditionPrivate( const QRectF &area, ::MediaRendition *r, ::LinkRendition::RenditionOperation operation, const QString &javaScript, const Ref ref )
: LinkPrivate( area )
, rendition( r ? new MediaRendition( r ) : nullptr )
, action( LinkRendition::PlayRendition )
......@@ -205,14 +205,14 @@ class LinkJavaScriptPrivate : public LinkPrivate
class LinkMoviePrivate : public LinkPrivate
{
public:
LinkMoviePrivate( const QRectF &area, LinkMovie::Operation operation, const QString &title, const Ref &reference );
LinkMoviePrivate( const QRectF &area, LinkMovie::Operation operation, const QString &title, const Ref reference );
LinkMovie::Operation operation;
QString annotationTitle;
Ref annotationReference;
};
LinkMoviePrivate::LinkMoviePrivate( const QRectF &area, LinkMovie::Operation _operation, const QString &title, const Ref &reference )
LinkMoviePrivate::LinkMoviePrivate( const QRectF &area, LinkMovie::Operation _operation, const QString &title, const Ref reference )
: LinkPrivate( area ), operation( _operation ), annotationTitle( title ), annotationReference( reference )
{
}
......@@ -591,7 +591,7 @@ class LinkMoviePrivate : public LinkPrivate
}
// LinkRendition
LinkRendition::LinkRendition( const QRectF &linkArea, ::MediaRendition *rendition, int operation, const QString &script, const Ref &annotationReference )
LinkRendition::LinkRendition( const QRectF &linkArea, ::MediaRendition *rendition, int operation, const QString &script, const Ref annotationReference )
: Link( *new LinkRenditionPrivate( linkArea, rendition, static_cast<enum ::LinkRendition::RenditionOperation>(operation), script, annotationReference ) )
{
}
......@@ -658,7 +658,7 @@ class LinkMoviePrivate : public LinkPrivate
}
// LinkMovie
LinkMovie::LinkMovie( const QRectF &linkArea, Operation operation, const QString &annotationTitle, const Ref &annotationReference )
LinkMovie::LinkMovie( const QRectF &linkArea, Operation operation, const QString &annotationTitle, const Ref annotationReference )
: Link( *new LinkMoviePrivate( linkArea, operation, annotationTitle, annotationReference ) )
{
}
......
......@@ -495,7 +495,7 @@ class POPPLER_QT5_EXPORT LinkRendition : public Link
* \param annotationReference the object reference of the screen annotation associated with this rendition action
* \since 0.22
*/
LinkRendition( const QRectF &linkArea, ::MediaRendition *rendition, int operation, const QString &script, const Ref &annotationReference );
LinkRendition( const QRectF &linkArea, ::MediaRendition *rendition, int operation, const QString &script, const Ref annotationReference );
/**
* Destructor.
......@@ -594,7 +594,7 @@ class POPPLER_QT5_EXPORT LinkMovie : public Link
*
* Note: This constructor is supposed to be used by Poppler::Page only.
*/
LinkMovie( const QRectF &linkArea, Operation operation, const QString &annotationTitle, const Ref &annotationReference );
LinkMovie( const QRectF &linkArea, Operation operation, const QString &annotationTitle, const Ref annotationReference );
/**
* Destructor.
*/
......
......@@ -48,7 +48,7 @@ struct SplashScreenPoint {
struct cmpDistancesFunctor {
bool operator()(const SplashScreenPoint &p0, const SplashScreenPoint &p1) {
bool operator()(const SplashScreenPoint p0, const SplashScreenPoint p1) {
return p0.dist < p1.dist;
}
};
......
......@@ -319,7 +319,7 @@ void SplashXPathScanner::computeIntersections() {
}
for (auto& line : allIntersections) {
std::sort(line.begin(), line.end(),
[](const SplashIntersect &i0, const SplashIntersect &i1) {
[](const SplashIntersect i0, const SplashIntersect i1) {
return i0.x0 < i1.x0;
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment