Commit 42efcb73 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Enable readability-inconsistent-declaration-parameter-name

parent ec2b036e
Pipeline #84073 passed with stages
in 19 minutes and 59 seconds
......@@ -40,7 +40,7 @@ build_clang_libcpp:
script:
- git clone --branch ${CI_COMMIT_REF_NAME} --depth 1 ${TEST_DATA_URL} test-data || git clone --depth 1 ${UPSTREAM_TEST_DATA_URL} test-data
- mkdir -p build && cd build
- CC=clang CXX=clang++ cmake -G Ninja -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DTESTDATADIR=$PWD/../test-data -DCMAKE_CXX_CLANG_TIDY="clang-tidy;-header-filter=.;-checks=-*,performance-*,,bugprone-*,-bugprone-narrowing-conversions,-bugprone-macro-parentheses,-bugprone-suspicious-string-compare,-bugprone-incorrect-roundings,-bugprone-undefined-memory-manipulation;-warnings-as-errors=*" ..
- CC=clang CXX=clang++ cmake -G Ninja -DCMAKE_CXX_FLAGS=-stdlib=libc++ -DTESTDATADIR=$PWD/../test-data -DCMAKE_CXX_CLANG_TIDY="clang-tidy;-header-filter=.;-checks=-*,performance-*,,bugprone-*,readability-inconsistent-declaration-parameter-name,-bugprone-narrowing-conversions,-bugprone-macro-parentheses,-bugprone-suspicious-string-compare,-bugprone-incorrect-roundings,-bugprone-undefined-memory-manipulation;-warnings-as-errors=*" ..
- ninja
- ctest --output-on-failure
......
......@@ -2,6 +2,7 @@
* Copyright (C) 2009-2010, Pino Toscano <pino@kde.org>
* Copyright (C) 2016 Jakub Alba <jakubalba@gmail.com>
* Copyright (C) 2019, Masamichi Hosoda <trueroad@trueroad.jp>
* Copyright (C) 2019, Albert Astals Cid <aacid@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -114,8 +115,8 @@ public:
// So we use std::string instead of ustring.
std::map<std::string, destination> create_destination_map() const;
bool save(const std::string &filename) const;
bool save_a_copy(const std::string &filename) const;
bool save(const std::string &file_name) const;
bool save_a_copy(const std::string &file_name) const;
static document* load_from_file(const std::string &file_name,
const std::string &owner_password = std::string(),
......
......@@ -225,8 +225,8 @@ image::image(char *idata, int iwidth, int iheight, image::format_enum iformat)
/**
Copy constructor.
*/
image::image(const image &pt)
: d(pt.d)
image::image(const image &img)
: d(img.d)
{
if (d) {
++d->ref;
......@@ -496,16 +496,16 @@ std::vector<std::string> image::supported_image_formats()
/**
Assignment operator.
*/
image& image::operator=(const image &pt)
image& image::operator=(const image &img)
{
if (this == &pt)
if (this == &img)
return *this;
if (pt.d) {
++pt.d->ref;
if (img.d) {
++img.d->ref;
}
image_private *old_d = d;
d = pt.d;
d = img.d;
if (old_d && !--old_d->ref) {
delete old_d;
}
......
......@@ -8,6 +8,7 @@
// This file is licensed under the GPLv2 or later
//
// Copyright (C) 2018 Greg Knight <lyngvi@gmail.com>
// Copyright (C) 2019 Albert Astals Cid <aacid@kde.org>
//
//========================================================================
......@@ -17,7 +18,7 @@
#include <string>
#include <vector>
std::string gbase64Encode(const void* input, size_t sz);
std::string gbase64Encode(const void* input, size_t len);
inline std::string gbase64Encode(const std::vector<char>& input)
{ return input.empty() ? std::string() : gbase64Encode(&input[0], input.size()); }
......
......@@ -9,6 +9,7 @@
// This file is licensed under the GPLv2 or later
//
// Copyright (C) 2018 Greg Knight <lyngvi@gmail.com>
// Copyright (C) 2019 Albert Astals Cid <aacid@kde.org>
//
//========================================================================
......@@ -17,6 +18,6 @@
#include <string>
std::string gbasename(const char* input);
std::string gbasename(const char* filename);
#endif // ndef GBASENAME_H
......@@ -985,13 +985,13 @@ void AnnotAppearance::removeStream(Ref refToStream) {
}
// Removes stream if obj is a Ref, or removes pointed streams if obj is a Dict
void AnnotAppearance::removeStateStreams(const Object *obj1) {
if (obj1->isRef()) {
removeStream(obj1->getRef());
} else if (obj1->isDict()) {
const int size = obj1->dictGetLength();
void AnnotAppearance::removeStateStreams(const Object *state) {
if (state->isRef()) {
removeStream(state->getRef());
} else if (state->isDict()) {
const int size = state->dictGetLength();
for (int i = 0; i < size; ++i) {
const Object &obj2 = obj1->dictGetValNF(i);
const Object &obj2 = state->dictGetValNF(i);
if (obj2.isRef()) {
removeStream(obj2.getRef());
}
......
......@@ -445,10 +445,10 @@ public:
void removeAllStreams();
// Test if this AnnotAppearance references the specified stream
bool referencesStream(Ref targetStreamRef);
bool referencesStream(Ref refToStream);
private:
static bool referencesStream(const Object *stateObj, Ref targetStreamRef);
static bool referencesStream(const Object *stateObj, Ref refToStream);
void removeStream(Ref refToStream);
void removeStateStreams(const Object *state);
......@@ -511,7 +511,7 @@ protected:
class AnnotAppearanceBBox
{
public:
AnnotAppearanceBBox(PDFRectangle *init);
AnnotAppearanceBBox(PDFRectangle *rect);
void setBorderWidth(double w) { borderWidth = w; }
......@@ -684,7 +684,7 @@ public:
// new_content should never be NULL
virtual void setContents(GooString *new_content);
void setName(GooString *new_name);
void setModified(GooString *new_date);
void setModified(GooString *new_modified);
void setFlags(unsigned int new_flags);
void setBorder(std::unique_ptr<AnnotBorder> &&new_border);
......@@ -724,7 +724,7 @@ private:
// write vStr[i:j[ in appearBuf
void initialize (PDFDoc *docA, Dict *dict);
void setPage (int new_page, bool updateP); // Called by Page::addAnnot and Annots ctor
void setPage (int pageIndex, bool updateP); // Called by Page::addAnnot and Annots ctor
protected:
......@@ -1401,7 +1401,7 @@ public:
void draw(Gfx *gfx, bool printing) override;
void generateFieldAppearance (bool *addDingbatsResource);
void generateFieldAppearance (bool *addedDingbatsResource);
void updateAppearanceStream ();
AnnotWidgetHighlightMode getMode() { return mode; }
......
......@@ -6,7 +6,7 @@
//
// Copyright 2009 Stefan Thomas <thomas@eload24.com>
// Copyright 2010, 2011 Hib Eris <hib@hiberis.nl>
// Copyright 2010, 2018 Albert Astals Cid <aacid@kde.org>
// Copyright 2010, 2018, 2019 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2013 Julien Nabet <serval2412@yahoo.fr>
//
//========================================================================
......@@ -18,10 +18,10 @@
// CachedFile
//------------------------------------------------------------------------
CachedFile::CachedFile(CachedFileLoader *cachedFileLoaderA, GooString *uriA)
CachedFile::CachedFile(CachedFileLoader *cacheLoader, GooString *uriA)
{
uri = uriA;
loader = cachedFileLoaderA;
loader = cacheLoader;
streamPos = 0;
chunks = new std::vector<Chunk>();
......
......@@ -42,12 +42,12 @@ class CairoFontEngine;
class CairoFont {
public:
CairoFont(Ref ref,
cairo_font_face_t *face,
int *codeToGID,
unsigned int codeToGIDLen,
bool substitute,
bool printing);
CairoFont(Ref refA,
cairo_font_face_t *cairo_font_faceA,
int *codeToGIDA,
unsigned int codeToGIDLenA,
bool substituteA,
bool printingA);
virtual ~CairoFont();
CairoFont(const CairoFont &) = delete;
CairoFont& operator=(const CairoFont &other) = delete;
......
......@@ -30,10 +30,10 @@
bool parseDateString(const char *string, int *year, int *month, int *day, int *hour, int *minute, int *second, char *tz, int *tzHour, int *tzMinute);
/* Converts the time_t into a PDF Date format string.
* If timet is NULL, current time is used.
* If timeA is NULL, current time is used.
* Returns new GooString. Free with delete.
*/
GooString *timeToDateString(const time_t *timet);
GooString *timeToDateString(const time_t *timeA);
/* Convert PDF date string to time.
* Returns -1 if conversion fails.
......
......@@ -185,8 +185,8 @@ bool FormWidget::setAdditionalAction(Annot::FormAdditionalActionsType t, const G
return widget->setFormAdditionalAction(t, js);
}
FormWidgetButton::FormWidgetButton (PDFDoc *docA, Object *aobj, unsigned num, Ref refA, FormField *p) :
FormWidget(docA, aobj, num, refA, p)
FormWidgetButton::FormWidgetButton (PDFDoc *docA, Object *dictObj, unsigned num, Ref refA, FormField *p) :
FormWidget(docA, dictObj, num, refA, p)
{
type = formButton;
onStr = nullptr;
......@@ -264,8 +264,8 @@ FormFieldButton *FormWidgetButton::parent() const
}
FormWidgetText::FormWidgetText (PDFDoc *docA, Object *aobj, unsigned num, Ref refA, FormField *p) :
FormWidget(docA, aobj, num, refA, p)
FormWidgetText::FormWidgetText (PDFDoc *docA, Object *dictObj, unsigned num, Ref refA, FormField *p) :
FormWidget(docA, dictObj, num, refA, p)
{
type = formText;
}
......@@ -346,8 +346,8 @@ FormFieldText *FormWidgetText::parent() const
return static_cast<FormFieldText*>(field);
}
FormWidgetChoice::FormWidgetChoice(PDFDoc *docA, Object *aobj, unsigned num, Ref refA, FormField *p) :
FormWidget(docA, aobj, num, refA, p)
FormWidgetChoice::FormWidgetChoice(PDFDoc *docA, Object *dictObj, unsigned num, Ref refA, FormField *p) :
FormWidget(docA, dictObj, num, refA, p)
{
type = formChoice;
}
......@@ -458,8 +458,8 @@ FormFieldChoice *FormWidgetChoice::parent() const
return static_cast<FormFieldChoice*>(field);
}
FormWidgetSignature::FormWidgetSignature(PDFDoc *docA, Object *aobj, unsigned num, Ref refA, FormField *p) :
FormWidget(docA, aobj, num, refA, p)
FormWidgetSignature::FormWidgetSignature(PDFDoc *docA, Object *dictObj, unsigned num, Ref refA, FormField *p) :
FormWidget(docA, dictObj, num, refA, p)
{
type = formSignature;
}
......@@ -977,8 +977,8 @@ void FormField::setReadOnly (bool value)
//------------------------------------------------------------------------
// FormFieldButton
//------------------------------------------------------------------------
FormFieldButton::FormFieldButton(PDFDoc *docA, Object &&aobj, const Ref refA, FormField *parentA, std::set<int> *usedParents)
: FormField(docA, std::move(aobj), refA, parentA, usedParents, formButton)
FormFieldButton::FormFieldButton(PDFDoc *docA, Object &&dictObj, const Ref refA, FormField *parentA, std::set<int> *usedParents)
: FormField(docA, std::move(dictObj), refA, parentA, usedParents, formButton)
{
Dict* dict = obj.getDict();
active_child = -1;
......@@ -1147,8 +1147,8 @@ FormFieldButton::~FormFieldButton()
//------------------------------------------------------------------------
// FormFieldText
//------------------------------------------------------------------------
FormFieldText::FormFieldText(PDFDoc *docA, Object &&aobj, const Ref refA, FormField *parentA, std::set<int> *usedParents)
: FormField(docA, std::move(aobj), refA, parentA, usedParents, formText)
FormFieldText::FormFieldText(PDFDoc *docA, Object &&dictObj, const Ref refA, FormField *parentA, std::set<int> *usedParents)
: FormField(docA, std::move(dictObj), refA, parentA, usedParents, formText)
{
Dict* dict = obj.getDict();
Object obj1;
......@@ -1938,21 +1938,21 @@ 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 aref, FormField *parent, std::set<int> *usedParents)
{
FormField *field;
const Object obj2 = Form::fieldLookup(obj.getDict (), "FT");
if (obj2.isName("Btn")) {
field = new FormFieldButton(docA, std::move(obj), pref, parent, usedParents);
field = new FormFieldButton(docA, std::move(obj), aref, parent, usedParents);
} else if (obj2.isName("Tx")) {
field = new FormFieldText(docA, std::move(obj), pref, parent, usedParents);
field = new FormFieldText(docA, std::move(obj), aref, parent, usedParents);
} else if (obj2.isName("Ch")) {
field = new FormFieldChoice(docA, std::move(obj), pref, parent, usedParents);
field = new FormFieldChoice(docA, std::move(obj), aref, parent, usedParents);
} else if (obj2.isName("Sig")) {
field = new FormFieldSignature(docA, std::move(obj), pref, parent, usedParents);
field = new FormFieldSignature(docA, std::move(obj), aref, parent, usedParents);
} else { //we don't have an FT entry => non-terminal field
field = new FormField(docA, std::move(obj), pref, parent, usedParents);
field = new FormField(docA, std::move(obj), aref, parent, usedParents);
}
return field;
......
......@@ -165,7 +165,7 @@ protected:
class FormWidgetButton: public FormWidget {
public:
FormWidgetButton(PDFDoc *docA, Object *dict, unsigned num, Ref ref, FormField *p);
FormWidgetButton(PDFDoc *docA, Object *dictObj, unsigned num, Ref ref, FormField *p);
~FormWidgetButton ();
FormButtonType getButtonType() const;
......@@ -188,7 +188,7 @@ protected:
class FormWidgetText: public FormWidget {
public:
FormWidgetText(PDFDoc *docA, Object *dict, unsigned num, Ref ref, FormField *p);
FormWidgetText(PDFDoc *docA, Object *dictObj, unsigned num, Ref ref, FormField *p);
//return the field's content (UTF16BE)
const GooString* getContent() const;
......@@ -222,7 +222,7 @@ protected:
class FormWidgetChoice: public FormWidget {
public:
FormWidgetChoice(PDFDoc *docA, Object *dict, unsigned num, Ref ref, FormField *p);
FormWidgetChoice(PDFDoc *docA, Object *dictObj, unsigned num, Ref ref, FormField *p);
~FormWidgetChoice();
int getNumChoices() const;
......@@ -263,7 +263,7 @@ protected:
class FormWidgetSignature: public FormWidget {
public:
FormWidgetSignature(PDFDoc *docA, Object *dict, unsigned num, Ref ref, FormField *p);
FormWidgetSignature(PDFDoc *docA, Object *dictObj, unsigned num, Ref ref, FormField *p);
void updateWidgetAppearance() override;
FormSignatureType signatureType();
......@@ -300,7 +300,7 @@ public:
Object* getObj() { return &obj; }
Ref getRef() { return ref; }
void setReadOnly (bool b);
void setReadOnly (bool value);
bool isReadOnly () const { return readOnly; }
GooString* getDefaultAppearance() const { return defaultAppearance; }
......@@ -407,7 +407,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 &&dictObj, const Ref ref, FormField *parent, std::set<int> *usedParents);
const GooString* getContent () const { return content; }
const GooString* getAppearanceContent () const { return internalContent ? internalContent : content; }
......
......@@ -2097,7 +2097,7 @@ int GfxCIDFont::mapCodeToGID(FoFiTrueType *ff, int cmapi,
return gid;
}
int *GfxCIDFont::getCodeToGIDMap(FoFiTrueType *ff, int *mapsizep) {
int *GfxCIDFont::getCodeToGIDMap(FoFiTrueType *ff, int *codeToGIDLen) {
#define N_UCS_CANDIDATES 2
/* space characters */
static const unsigned long spaces[] = {
......@@ -2192,7 +2192,7 @@ int *GfxCIDFont::getCodeToGIDMap(FoFiTrueType *ff, int *mapsizep) {
int cmapPlatform, cmapEncoding;
Ref embID;
*mapsizep = 0;
*codeToGIDLen = 0;
if (!ctu || !getCollection()) return nullptr;
if (getCollection()->cmp("Adobe-Identity") == 0) return nullptr;
if (getEmbeddedFontID(&embID)) {
......@@ -2200,7 +2200,7 @@ int *GfxCIDFont::getCodeToGIDMap(FoFiTrueType *ff, int *mapsizep) {
* CIDToGIDMap should be embedded in PDF file
* and already set. So return it.
*/
*mapsizep = getCIDToGIDLen();
*codeToGIDLen = getCIDToGIDLen();
return getCIDToGID();
}
......@@ -2337,7 +2337,7 @@ int *GfxCIDFont::getCodeToGIDMap(FoFiTrueType *ff, int *mapsizep) {
}
codeToGID[code] = gid;
}
*mapsizep = n;
*codeToGIDLen = n;
if (humap != nullptr) delete[] humap;
if (tumap != nullptr) delete[] tumap;
if (vumap != nullptr) delete[] vumap;
......
......@@ -406,7 +406,7 @@ public:
int *getCIDToGID() const { return cidToGID; }
int getCIDToGIDLen() const { return cidToGIDLen; }
int *getCodeToGIDMap(FoFiTrueType *ff, int *length);
int *getCodeToGIDMap(FoFiTrueType *ff, int *codeToGIDLen);
double getWidth(char* s, int len) const;
......
......@@ -919,7 +919,7 @@ public:
double xMin, double yMin,
double xMax, double yMax) = 0;
virtual double getDistance(double tMin, double tMax) const = 0;
virtual double getDistance(double sMin, double sMax) const = 0;
private:
......@@ -993,7 +993,7 @@ public:
double xMin, double yMin,
double xMax, double yMax) override;
double getDistance(double tMin, double tMax) const override;
double getDistance(double sMin, double sMax) const override;
private:
......@@ -1027,7 +1027,7 @@ public:
double xMin, double yMin,
double xMax, double yMax) override;
double getDistance(double tMin, double tMax) const override;
double getDistance(double sMin, double sMax) const override;
private:
......
......@@ -41,7 +41,7 @@ struct JPXStreamPrivate {
int ncomps;
bool inited;
int smaskInData;
void init2(OPJ_CODEC_FORMAT format, unsigned char *data, int length, bool indexed);
void init2(OPJ_CODEC_FORMAT format, unsigned char *buf, int length, bool indexed);
};
static inline unsigned char adjustComp(int r, int adjust, int depth, int sgndcorr, bool indexed) {
......
......@@ -5,7 +5,7 @@
//---------------------------------------------------------------------------------
// Hugo Mercier <hmercier31[at]gmail.com> (c) 2008
// Carlos Garcia Campos <carlosgc@gnome.org> (c) 2010
// Albert Astals Cid <aacid@kde.org> (c) 2017, 2018
// Albert Astals Cid <aacid@kde.org> (c) 2017-2019
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
......@@ -33,7 +33,7 @@ struct MovieActivationParameters {
~MovieActivationParameters();
// parse from a "Movie Activation" dictionary
void parseMovieActivation(const Object* actObj);
void parseMovieActivation(const Object* aDict);
enum MovieRepeatMode {
repeatModeOnce,
......@@ -70,9 +70,9 @@ struct MovieActivationParameters {
class Movie {
public:
Movie(const Object *objMovie, const Object *objAct);
Movie(const Object *objMovie);
Movie(const Movie &movie);
Movie(const Object *movieDict, const Object *aDict);
Movie(const Object *movieDict);
Movie(const Movie &other);
~Movie();
Movie& operator=(const Movie &) = delete;
......
......@@ -333,7 +333,7 @@ public:
void replacePageDict(int pageNo, int rotate, const PDFRectangle *mediaBox, const PDFRectangle *cropBox);
void markPageObjects(Dict *pageDict, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldRefNum, int newRefNum, std::set<Dict*> *alreadyMarkedDicts = nullptr);
bool markAnnotations(Object *annots, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldPageNum, int newPageNum, std::set<Dict*> *alreadyMarkedDicts = nullptr);
void markAcroForm(Object *acrpForm, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldPageNum, int newPageNum);
void markAcroForm(Object *afObj, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldRefNum, int newRefNum);
// write all objects used by pageDict to outStr
unsigned int writePageObjects(OutStream *outStr, XRef *xRef, unsigned int numOffset, bool combine = false);
static void writeObject (Object *obj, OutStream* outStr, XRef *xref, unsigned int numOffset, unsigned char *fileKey,
......
......@@ -7201,8 +7201,8 @@ void PSOutputDev::type3D1(GfxState *state, double wx, double wy,
t3NeedsRestore = true;
}
void PSOutputDev::drawForm(Ref id) {
writePSFmt("f_{0:d}_{1:d}\n", id.num, id.gen);
void PSOutputDev::drawForm(Ref ref) {
writePSFmt("f_{0:d}_{1:d}\n", ref.num, ref.gen);
}
void PSOutputDev::psXObject(Stream *psStream, Stream *level1Stream) {
......
/* Sound.h - an object that holds the sound structure
* Copyright (C) 2006-2007, Pino Toscano <pino@kde.org>
* Copyright (C) 2017, 2018, Albert Astals Cid <aacid@kde.org>
* Copyright (C) 2017-2019, Albert Astals Cid <aacid@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -41,8 +41,8 @@ enum SoundEncoding {
class Sound
{
public:
// Try to parse the Object s
static Sound *parseSound(Object *s);
// Try to parse the Object obj
static Sound *parseSound(Object *obj);
// Destructor
~Sound();
......
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