cpp/tests/poppler-dump.cpp | 6 +-- poppler/CachedFile.cc | 8 ++--- poppler/CairoFontEngine.cc | 64 ++++++++++++++++++++--------------------- poppler/CairoOutputDev.cc | 5 +-- poppler/CairoOutputDev.h | 4 +- poppler/Decrypt.cc | 6 +-- poppler/FontInfo.cc | 5 +-- poppler/Gfx.cc | 2 - poppler/GfxFont.cc | 12 +++---- poppler/GfxState.cc | 31 ++++++++----------- poppler/JBIG2Stream.cc | 11 +++---- poppler/PDFDoc.cc | 4 +- poppler/StructElement.cc | 6 +-- poppler/StructTreeRoot.cc | 8 ++--- poppler/TextOutputDev.h | 4 +- poppler/XRef.cc | 4 +- qt5/src/ArthurOutputDev.cc | 4 +- qt5/src/poppler-annotation.cc | 18 +++++------ qt5/src/poppler-media.cc | 4 +- qt5/src/poppler-page.cc | 24 +++++++-------- qt5/tests/test-poppler-qt5.cpp | 10 +++--- splash/SplashFTFontFile.cc | 5 +-- utils/ImageOutputDev.cc | 8 ++--- utils/pdfinfo.cc | 7 +--- utils/pdftocairo.cc | 22 +++++++------- utils/pdftoppm.cc | 20 ++++++------ 26 files changed, 149 insertions(+), 153 deletions(-)
New commits: commit e3cece1bfc00083637f709f7647b4711b5c6a084 Author: Albert Astals Cid <aa...@kde.org> Date: Fri Feb 2 23:17:11 2018 +0100 Fix some -Wshadow warnings More to come, -Wshadow is interesting but if we enable it we still get too many warnings for it to be useful diff --git a/cpp/tests/poppler-dump.cpp b/cpp/tests/poppler-dump.cpp index 5bfd80d4..c147aad7 100644 --- a/cpp/tests/poppler-dump.cpp +++ b/cpp/tests/poppler-dump.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2009-2010, Pino Toscano <p...@kde.org> - * Copyright (C) 2017, Albert Astals Cid <aa...@kde.org> + * Copyright (C) 2017, 2018, Albert Astals Cid <aa...@kde.org> * Copyright (C) 2017, Jason Alan Palmer <jalanpal...@gmail.com> * * This program is free software; you can redistribute it and/or modify @@ -271,7 +271,7 @@ static void print_embedded_files(poppler::document *doc) std::vector<poppler::embedded_file *> ef = doc->embedded_files(); if (!ef.empty()) { std::vector<poppler::embedded_file *>::const_iterator it = ef.begin(), it_end = ef.end(); - const std::ios_base::fmtflags f = std::cout.flags(); + const std::ios_base::fmtflags flags = std::cout.flags(); std::left(std::cout); for (; it != it_end; ++it) { poppler::embedded_file *f = *it; @@ -293,7 +293,7 @@ static void print_embedded_files(poppler::document *doc) << " " << (f->mime_type().empty() ? std::string("<no mime type>") : f->mime_type()) << std::endl; } - std::cout.flags(f); + std::cout.flags(flags); } else { std::cout << "<no embedded files>" << std::endl; } diff --git a/poppler/CachedFile.cc b/poppler/CachedFile.cc index b0ae8388..1e76d913 100644 --- a/poppler/CachedFile.cc +++ b/poppler/CachedFile.cc @@ -6,7 +6,7 @@ // // Copyright 2009 Stefan Thomas <tho...@eload24.com> // Copyright 2010, 2011 Hib Eris <h...@hiberis.nl> -// Copyright 2010 Albert Astals Cid <aa...@kde.org> +// Copyright 2010, 2018 Albert Astals Cid <aa...@kde.org> // Copyright (C) 2013 Julien Nabet <serval2...@yahoo.fr> // //======================================================================== @@ -172,12 +172,12 @@ size_t CachedFile::read(void *ptr, size_t unitsize, size_t count) return bytes; } -int CachedFile::cache(size_t offset, size_t length) +int CachedFile::cache(size_t rangeOffset, size_t rangeLength) { std::vector<ByteRange> r; ByteRange range; - range.offset = offset; - range.length = length; + range.offset = rangeOffset; + range.length = rangeLength; r.push_back(range); return cache(r); } diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc index 2864f2ae..91deac46 100644 --- a/poppler/CairoFontEngine.cc +++ b/poppler/CairoFontEngine.cc @@ -17,7 +17,7 @@ // Copyright (C) 2005-2007 Jeff Muizelaar <j...@infidigm.net> // Copyright (C) 2005, 2006 Kristian Høgsberg <k...@redhat.com> // Copyright (C) 2005 Martin Kretzschmar <mart...@gnome.org> -// Copyright (C) 2005, 2009, 2012, 2013, 2015, 2017 Albert Astals Cid <aa...@kde.org> +// Copyright (C) 2005, 2009, 2012, 2013, 2015, 2017, 2018 Albert Astals Cid <aa...@kde.org> // Copyright (C) 2006, 2007, 2010, 2011 Carlos Garcia Campos <carlo...@gnome.org> // Copyright (C) 2007 Koji Otani <s...@bbr.jp> // Copyright (C) 2008, 2009 Chris Wilson <ch...@chris-wilson.co.uk> @@ -70,17 +70,17 @@ // CairoFont //------------------------------------------------------------------------ -CairoFont::CairoFont(Ref ref, - cairo_font_face_t *cairo_font_face, - int *codeToGID, - Guint codeToGIDLen, - GBool substitute, - GBool printing) : ref(ref), - cairo_font_face(cairo_font_face), - codeToGID(codeToGID), - codeToGIDLen(codeToGIDLen), - substitute(substitute), - printing(printing) { } +CairoFont::CairoFont(Ref refA, + cairo_font_face_t *cairo_font_faceA, + int *codeToGIDA, + Guint codeToGIDLenA, + GBool substituteA, + GBool printingA) : ref(refA), + cairo_font_face(cairo_font_faceA), + codeToGID(codeToGIDA), + codeToGIDLen(codeToGIDLenA), + substitute(substituteA), + printing(printingA) { } CairoFont::~CairoFont() { cairo_font_face_destroy (cairo_font_face); @@ -379,15 +379,15 @@ _ft_new_face (FT_Library lib, #define _ft_new_face _ft_new_face_uncached #endif -CairoFreeTypeFont::CairoFreeTypeFont(Ref ref, - cairo_font_face_t *cairo_font_face, - int *codeToGID, - Guint codeToGIDLen, - GBool substitute) : CairoFont(ref, - cairo_font_face, - codeToGID, - codeToGIDLen, - substitute, +CairoFreeTypeFont::CairoFreeTypeFont(Ref refA, + cairo_font_face_t *cairo_font_faceA, + int *codeToGIDA, + Guint codeToGIDLenA, + GBool substituteA) : CairoFont(refA, + cairo_font_faceA, + codeToGIDA, + codeToGIDLenA, + substituteA, gTrue) { } CairoFreeTypeFont::~CairoFreeTypeFont() { } @@ -777,18 +777,18 @@ CairoType3Font *CairoType3Font::create(GfxFont *gfxFont, PDFDoc *doc, return new CairoType3Font(ref, doc, font_face, codeToGID, codeToGIDLen, printing, xref); } -CairoType3Font::CairoType3Font(Ref ref, - PDFDoc *doc, - cairo_font_face_t *cairo_font_face, - int *codeToGID, - Guint codeToGIDLen, - GBool printing, XRef *xref) : CairoFont(ref, - cairo_font_face, - codeToGID, - codeToGIDLen, +CairoType3Font::CairoType3Font(Ref refA, + PDFDoc *docA, + cairo_font_face_t *cairo_font_faceA, + int *codeToGIDA, + Guint codeToGIDLenA, + GBool printingA, XRef *xref) : CairoFont(refA, + cairo_font_faceA, + codeToGIDA, + codeToGIDLenA, gFalse, - printing), - doc(doc) { } + printingA), + doc(docA) { } CairoType3Font::~CairoType3Font() { } diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc index 330f7b06..bc83b807 100644 --- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -16,7 +16,7 @@ // // Copyright (C) 2005-2008 Jeff Muizelaar <j...@infidigm.net> // Copyright (C) 2005, 2006 Kristian Høgsberg <k...@redhat.com> -// Copyright (C) 2005, 2009, 2012, 2017 Albert Astals Cid <aa...@kde.org> +// Copyright (C) 2005, 2009, 2012, 2017, 2018 Albert Astals Cid <aa...@kde.org> // Copyright (C) 2005 Nickolay V. Shmyrev <nshmy...@yandex.ru> // Copyright (C) 2006-2011, 2013, 2014, 2017 Carlos Garcia Campos <carlo...@gnome.org> // Copyright (C) 2008 Carl Worth <cwo...@cworth.org> @@ -3193,7 +3193,6 @@ public: } void getRow(int row_num, uint32_t *row_data) override { - int i; Guchar *pix; if (row_num <= current_row) @@ -3214,7 +3213,7 @@ public: Guchar *p = pix; GfxRGB rgb; - for (i = 0; i < width; i++) { + for (int i = 0; i < width; i++) { rgb = lookup[*p]; row_data[i] = ((int) colToByte(rgb.r) << 16) | diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h index 260e447e..af720841 100644 --- a/poppler/CairoOutputDev.h +++ b/poppler/CairoOutputDev.h @@ -269,10 +269,10 @@ public: void setCairo (cairo_t *cr); void setTextPage (TextPage *text); - void setPrinting (GBool printing) { this->printing = printing; needFontUpdate = gTrue; } + void setPrinting (GBool printingA) { printing = printingA; needFontUpdate = gTrue; } void setAntialias(cairo_antialias_t antialias); - void setInType3Char(GBool inType3Char) { this->inType3Char = inType3Char; } + void setInType3Char(GBool inType3CharA) { inType3Char = inType3CharA; } void getType3GlyphWidth (double *wx, double *wy) { *wx = t3_glyph_wx; *wy = t3_glyph_wy; } GBool hasType3GlyphBBox () { return t3_glyph_has_bbox; } double *getType3GlyphBBox () { return t3_glyph_bbox; } diff --git a/poppler/Decrypt.cc b/poppler/Decrypt.cc index 423928e7..bf858cec 100644 --- a/poppler/Decrypt.cc +++ b/poppler/Decrypt.cc @@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2008 Julien Rebetez <jul...@fhtagn.net> -// Copyright (C) 2008, 2010, 2016, 2017 Albert Astals Cid <aa...@kde.org> +// Copyright (C) 2008, 2010, 2016-2018 Albert Astals Cid <aa...@kde.org> // Copyright (C) 2009 Matthias Franz <matth...@ktug.or.kr> // Copyright (C) 2009 David Benjamin <david...@mit.edu> // Copyright (C) 2012 Fabio D'Urso <fabiodu...@hotmail.it> @@ -1454,7 +1454,7 @@ static void sha256(Guchar *msg, int msgLen, Guchar *hash) { // SHA-512 hash (see FIPS 180-4) //------------------------------------------------------------------------ // SHA 384 and SHA 512 use the same sequence of eighty constant 64 bit words. -static const uint64_t K[80] = { +static const uint64_t shaK[80] = { 0x428a2f98d728ae22ull, 0x7137449123ef65cdull, 0xb5c0fbcfec4d3b2full, 0xe9b5dba58189dbbcull, 0x3956c25bf348b538ull, 0x59f111f1b605d019ull, 0x923f82a4af194f9bull, 0xab1c5ed5da6d8118ull, 0xd807aa98a3030242ull, 0x12835b0145706fbeull, 0x243185be4ee4b28cull, 0x550c7dc3d5ffb4e2ull, 0x72be5d74f27b896full, 0x80deb1fe3b1696b1ull, 0x9bdc06a725c71235ull, @@ -1531,7 +1531,7 @@ static void sha512HashBlock(Guchar *blk, uint64_t *H) { // 3. for (t = 0; t < 80; ++t) { - T1 = h + sha512Sigma1(e) + sha512Ch(e,f,g) + K[t] + W[t]; + T1 = h + sha512Sigma1(e) + sha512Ch(e,f,g) + shaK[t] + W[t]; T2 = sha512Sigma0(a) + sha512Maj(a,b,c); h = g; g = f; diff --git a/poppler/FontInfo.cc b/poppler/FontInfo.cc index 0bc0020a..15019eba 100644 --- a/poppler/FontInfo.cc +++ b/poppler/FontInfo.cc @@ -3,7 +3,7 @@ // FontInfo.cc // // Copyright (C) 2005, 2006 Kristian Høgsberg <k...@redhat.com> -// Copyright (C) 2005-2008, 2010, 2017 Albert Astals Cid <aa...@kde.org> +// Copyright (C) 2005-2008, 2010, 2017, 2018 Albert Astals Cid <aa...@kde.org> // Copyright (C) 2005 Brad Hards <br...@frogmouth.net> // Copyright (C) 2006 Kouhei Sutou <k...@cozmixng.org> // Copyright (C) 2009 Pino Toscano <p...@kde.org> @@ -92,7 +92,6 @@ GooList *FontInfoScanner::scan(int nPages) { } void FontInfoScanner::scanFonts(XRef *xrefA, Dict *resDict, GooList *fontsList) { - Ref r; GfxFontDict *gfxFontDict; GfxFont *font; @@ -102,7 +101,7 @@ void FontInfoScanner::scanFonts(XRef *xrefA, Dict *resDict, GooList *fontsList) if (obj1.isRef()) { Object obj2 = obj1.fetch(xrefA); if (obj2.isDict()) { - r = obj1.getRef(); + Ref r = obj1.getRef(); gfxFontDict = new GfxFontDict(xrefA, &r, obj2.getDict()); } } else if (obj1.isDict()) { diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc index 60fc98cc..4f6c33f8 100644 --- a/poppler/Gfx.cc +++ b/poppler/Gfx.cc @@ -5108,7 +5108,7 @@ void Gfx::opMarkPoint(Object args[], int numArgs) { //------------------------------------------------------------------------ struct GfxStackStateSaver { - GfxStackStateSaver(Gfx *gfx) : gfx(gfx) { + GfxStackStateSaver(Gfx *gfxA) : gfx(gfxA) { gfx->saveState(); } diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc index 9ef26234..ff070125 100644 --- a/poppler/GfxFont.cc +++ b/poppler/GfxFont.cc @@ -1748,7 +1748,7 @@ GfxCIDFont::GfxCIDFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA, CharCode c; Unicode *uBuf; int c1, c2; - int excepsSize, i, j, k, n; + int excepsSize, j, k, n; refCnt = 1; ascent = 0.95; @@ -1876,7 +1876,7 @@ GfxCIDFont::GfxCIDFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA, obj1 = desFontDict->lookup("CIDToGIDMap"); if (obj1.isStream()) { cidToGIDLen = 0; - i = 64; + int i = 64; cidToGID = (int *)gmallocn(i, sizeof(int)); obj1.streamReset(); while ((c1 = obj1.streamGetChar()) != EOF && @@ -1904,7 +1904,7 @@ GfxCIDFont::GfxCIDFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA, obj1 = desFontDict->lookup("W"); if (obj1.isArray()) { excepsSize = 0; - i = 0; + int i = 0; while (i + 1 < obj1.arrayGetLength()) { obj2 = obj1.arrayGet(i); obj3 = obj1.arrayGet(i + 1); @@ -1973,7 +1973,7 @@ GfxCIDFont::GfxCIDFont(XRef *xref, const char *tagA, Ref idA, GooString *nameA, obj1 = desFontDict->lookup("W2"); if (obj1.isArray()) { excepsSize = 0; - i = 0; + int i = 0; while (i + 1 < obj1.arrayGetLength()) { obj2 = obj1.arrayGet(i); obj3 = obj1.arrayGet(i+ 1); @@ -2055,7 +2055,7 @@ int GfxCIDFont::getNextChar(char *s, int len, CharCode *code, Unicode **u, int *uLen, double *dx, double *dy, double *ox, double *oy) { CID cid; - CharCode c; + CharCode dummy; double w, h, vx, vy; int n, a, b, m; @@ -2066,7 +2066,7 @@ int GfxCIDFont::getNextChar(char *s, int len, CharCode *code, return 1; } - *code = (CharCode)(cid = cMap->getCID(s, len, &c, &n)); + *code = (CharCode)(cid = cMap->getCID(s, len, &dummy, &n)); if (ctu) { if (hasToUnicode) { int i = 0, c = 0; diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc index 329d987a..4cf8d8e3 100644 --- a/poppler/GfxState.cc +++ b/poppler/GfxState.cc @@ -1628,7 +1628,6 @@ void GfxLabColorSpace::getXYZ(GfxColor *color, void GfxLabColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) { double X, Y, Z; - double r, g, b; getXYZ(color, &X, &Y, &Z); #ifdef USE_CMS @@ -1672,9 +1671,9 @@ void GfxLabColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) { Y *= whiteY; Z *= whiteZ; // convert XYZ to RGB, including gamut mapping and gamma correction - r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z; - g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z; - b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z; + const double r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z; + const double g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z; + const double b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z; rgb->r = dblToCol(sqrt(clip01(r * kr))); rgb->g = dblToCol(sqrt(clip01(g * kg))); rgb->b = dblToCol(sqrt(clip01(b * kb))); @@ -3888,7 +3887,6 @@ GfxUnivariateShading::~GfxUnivariateShading() { void GfxUnivariateShading::getColor(double t, GfxColor *color) { double out[gfxColorMaxComps]; - int i; // NB: there can be one function with n outputs or n functions with // one output each (where n = number of color components) @@ -3918,14 +3916,14 @@ void GfxUnivariateShading::getColor(double t, GfxColor *color) { u = cacheValues + lastMatch * nComps; l = u - nComps; - for (i = 0; i < nComps; ++i) { + for (int i = 0; i < nComps; ++i) { out[i] = ix * l[i] + x * u[i]; } } else { - for (i = 0; i < nComps; ++i) { + for (int i = 0; i < nComps; ++i) { out[i] = 0; } - for (i = 0; i < nFuncs; ++i) { + for (int i = 0; i < nFuncs; ++i) { if (funcs[i]->getInputSize() != 1) { error(errSyntaxWarning, -1, "Invalid shading function (input != 1)"); break; @@ -3934,7 +3932,7 @@ void GfxUnivariateShading::getColor(double t, GfxColor *color) { } } - for (i = 0; i < nComps; ++i) { + for (int i = 0; i < nComps; ++i) { color->c[i] = dblToCol(out[i]); } } @@ -6111,14 +6109,13 @@ void GfxImageColorMap::getCMYKLine(Guchar *in, Guchar *out, int length) { } void GfxImageColorMap::getDeviceNLine(Guchar *in, Guchar *out, int length) { - int i, j; Guchar *inp, *tmp_line; if (!useDeviceNLine()) { GfxColor deviceN; inp = in; - for (i = 0; i < length; i++) { + for (int i = 0; i < length; i++) { getDeviceN (inp, &deviceN); for (int j = 0; j < SPOT_NCOMPS+4; j++) *out++ = deviceN.c[j]; @@ -6131,8 +6128,8 @@ void GfxImageColorMap::getDeviceNLine(Guchar *in, Guchar *out, int length) { case csIndexed: case csSeparation: tmp_line = (Guchar *) gmallocn (length, nComps2); - for (i = 0; i < length; i++) { - for (j = 0; j < nComps2; j++) { + for (int i = 0; i < length; i++) { + for (int j = 0; j < nComps2; j++) { tmp_line[i * nComps2 + j] = byte_lookup[in[i] * nComps2 + j]; } } @@ -6142,8 +6139,8 @@ void GfxImageColorMap::getDeviceNLine(Guchar *in, Guchar *out, int length) { default: inp = in; - for (j = 0; j < length; j++) - for (i = 0; i < nComps; i++) { + for (int j = 0; j < length; j++) + for (int i = 0; i < nComps; i++) { *inp = byte_lookup[*inp * nComps + i]; inp++; } @@ -6396,8 +6393,8 @@ void GfxPath::offset(double dx, double dy) { //------------------------------------------------------------------------ // //------------------------------------------------------------------------ -GfxState::ReusablePathIterator::ReusablePathIterator(GfxPath *path) - : path(path), +GfxState::ReusablePathIterator::ReusablePathIterator(GfxPath *pathA) + : path(pathA), subPathOff(0), coordOff(0), numCoords(0), diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc index 10e5bd86..ac7e7382 100644 --- a/poppler/JBIG2Stream.cc +++ b/poppler/JBIG2Stream.cc @@ -1337,7 +1337,6 @@ void JBIG2Stream::readSegments() { Guint *refSegs; Goffset segDataPos; int c1, c2, c3; - Guint i; while (readULong(&segNum)) { @@ -1360,7 +1359,7 @@ void JBIG2Stream::readSegments() { } refFlags = (refFlags << 24) | (c1 << 16) | (c2 << 8) | c3; nRefSegs = refFlags & 0x1fffffff; - for (i = 0; i < (nRefSegs + 9) >> 3; ++i) { + for (Guint i = 0; i < (nRefSegs + 9) >> 3; ++i) { if ((c1 = curStr->getChar()) == EOF) { goto eofError1; } @@ -1370,19 +1369,19 @@ void JBIG2Stream::readSegments() { // referred-to segment numbers refSegs = (Guint *)gmallocn(nRefSegs, sizeof(Guint)); if (segNum <= 256) { - for (i = 0; i < nRefSegs; ++i) { + for (Guint i = 0; i < nRefSegs; ++i) { if (!readUByte(&refSegs[i])) { goto eofError2; } } } else if (segNum <= 65536) { - for (i = 0; i < nRefSegs; ++i) { + for (Guint i = 0; i < nRefSegs; ++i) { if (!readUWord(&refSegs[i])) { goto eofError2; } } } else { - for (i = 0; i < nRefSegs; ++i) { + for (Guint i = 0; i < nRefSegs; ++i) { if (!readULong(&refSegs[i])) { goto eofError2; } @@ -1484,7 +1483,7 @@ void JBIG2Stream::readSegments() { break; default: error(errSyntaxError, curStr->getPos(), "Unknown segment type in JBIG2 stream"); - for (i = 0; i < segLength; ++i) { + for (Guint i = 0; i < segLength; ++i) { if ((c1 = curStr->getChar()) == EOF) { goto eofError2; } diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index 16b4d0f5..6789c39f 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -1697,8 +1697,8 @@ GBool PDFDoc::markAnnotations(Object *annotsObj, XRef *xRef, XRef *countRef, Gui } else { Object page = getXRef()->fetch(obj2.getRef().num, obj2.getRef().gen); if (page.isDict()) { - Dict *dict = page.getDict(); - Object pagetype = dict->lookup("Type"); + Dict *pageDict = page.getDict(); + Object pagetype = pageDict->lookup("Type"); if (!pagetype.isName() || strcmp(pagetype.getName(), "Page") != 0) { continue; } diff --git a/poppler/StructElement.cc b/poppler/StructElement.cc index dae6bb39..41000a43 100644 --- a/poppler/StructElement.cc +++ b/poppler/StructElement.cc @@ -6,7 +6,7 @@ // // Copyright 2013, 2014 Igalia S.L. // Copyright 2014 Luigi Scarso <luigi.sca...@gmail.com> -// Copyright 2014, 2017 Albert Astals Cid <aa...@kde.org> +// Copyright 2014, 2017, 2018 Albert Astals Cid <aa...@kde.org> // Copyright 2015 Dmytro Morgun <lzt...@gmail.com> // //======================================================================== @@ -674,8 +674,8 @@ Attribute::Attribute(const char *nameA, int nameLenA, Object *valueA): value = valueA->copy(); } -Attribute::Attribute(Type type, Object *valueA): - type(type), +Attribute::Attribute(Type typeA, Object *valueA): + type(typeA), owner(UserProperties), // TODO: Determine corresponding owner from Type revision(0), name(), diff --git a/poppler/StructTreeRoot.cc b/poppler/StructTreeRoot.cc index e9123570..4ea967bb 100644 --- a/poppler/StructTreeRoot.cc +++ b/poppler/StructTreeRoot.cc @@ -7,7 +7,7 @@ // Copyright 2013, 2014 Igalia S.L. // Copyright 2014 Fabio D'Urso <fabiodu...@hotmail.it> // Copyright 2017 Jan-Erik S <janerik234...@gmail.com> -// Copyright 2017 Albert Astals Cid <aa...@kde.org> +// Copyright 2017, 2018 Albert Astals Cid <aa...@kde.org> // Copyright 2017 Adrian Johnson <ajohn...@redneon.com> // //======================================================================== @@ -53,9 +53,9 @@ void StructTreeRoot::parse(Dict *root) // corresponsing structure element. Here only the references are // loaded into the array, the pointers to the StructElements will // be filled-in later when parsing them. - Object obj = root->lookup("ParentTree"); - if (obj.isDict()) { - parseNumberTreeNode(obj.getDict()); + const Object parentTreeObj = root->lookup("ParentTree"); + if (parentTreeObj.isDict()) { + parseNumberTreeNode(parentTreeObj.getDict()); } std::set<int> seenElements; diff --git a/poppler/TextOutputDev.h b/poppler/TextOutputDev.h index 5e92dfb7..b5a6088c 100644 --- a/poppler/TextOutputDev.h +++ b/poppler/TextOutputDev.h @@ -524,8 +524,8 @@ private: class TextWordSelection { public: - TextWordSelection(TextWord *word, int begin, int end) - : word(word), begin(begin), end(end) + TextWordSelection(TextWord *wordA, int beginA, int endA) + : word(wordA), begin(beginA), end(endA) { } diff --git a/poppler/XRef.cc b/poppler/XRef.cc index 183c29f0..5d3b98ff 100644 --- a/poppler/XRef.cc +++ b/poppler/XRef.cc @@ -558,7 +558,7 @@ GBool XRef::readXRefTable(Parser *parser, Goffset *pos, std::vector<Goffset> *fo GBool more; Object obj, obj2; Goffset pos2; - int first, n, i; + int first, n; while (1) { obj = parser->getObj(gTrue); @@ -583,7 +583,7 @@ GBool XRef::readXRefTable(Parser *parser, Goffset *pos, std::vector<Goffset> *fo goto err0; } } - for (i = first; i < first + n; ++i) { + for (int i = first; i < first + n; ++i) { obj = parser->getObj(gTrue); if (obj.isInt()) { entry.offset = obj.getInt(); diff --git a/qt5/src/ArthurOutputDev.cc b/qt5/src/ArthurOutputDev.cc index 6007ced7..34fde569 100644 --- a/qt5/src/ArthurOutputDev.cc +++ b/qt5/src/ArthurOutputDev.cc @@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Brad Hards <br...@frogmouth.net> -// Copyright (C) 2005-2009, 2011, 2012, 2014, 2015 Albert Astals Cid <aa...@kde.org> +// Copyright (C) 2005-2009, 2011, 2012, 2014, 2015, 2018 Albert Astals Cid <aa...@kde.org> // Copyright (C) 2008, 2010 Pino Toscano <p...@kde.org> // Copyright (C) 2009, 2011 Carlos Garcia Campos <carlo...@gnome.org> // Copyright (C) 2009 Petr Gajdos <pgaj...@novell.com> @@ -122,7 +122,7 @@ void ArthurOutputDev::startDoc(XRef *xrefA) { #endif } -void ArthurOutputDev::startPage(int pageNum, GfxState *state, XRef *xref) +void ArthurOutputDev::startPage(int pageNum, GfxState *state, XRef *) { // fill page with white background. int w = static_cast<int>(state->getPageWidth()); diff --git a/qt5/src/poppler-annotation.cc b/qt5/src/poppler-annotation.cc index c7345bf6..fffc8b09 100644 --- a/qt5/src/poppler-annotation.cc +++ b/qt5/src/poppler-annotation.cc @@ -306,7 +306,7 @@ QRectF AnnotationPrivate::fromPdfRectangle(const PDFRectangle &r) const // the transformation produced by fillTransformationMTX, but we can't use // fillTransformationMTX here because it relies on the native annotation // object's boundary rect to be already set up. -PDFRectangle AnnotationPrivate::boundaryToPdfRectangle(const QRectF &r, int flags) const +PDFRectangle AnnotationPrivate::boundaryToPdfRectangle(const QRectF &r, int rFlags) const { Q_ASSERT ( pdfPage ); @@ -333,7 +333,7 @@ PDFRectangle AnnotationPrivate::boundaryToPdfRectangle(const QRectF &r, int flag br_y = swp; } - const int rotationFixUp = ( flags & Annotation::FixedRotation ) ? pageRotate : 0; + const int rotationFixUp = ( rFlags & Annotation::FixedRotation ) ? pageRotate : 0; const double width = br_x - tl_x; const double height = br_y - tl_y; @@ -391,13 +391,13 @@ QList<Annotation*> AnnotationPrivate::findAnnotations(::Page *pdfPage, DocumentD // Create Annotation objects and tie to their native Annot QList<Annotation*> res; - for ( uint j = 0; j < numAnnotations; j++ ) + for ( uint k = 0; k < numAnnotations; k++ ) { // get the j-th annotation - Annot * ann = annots->getAnnot( j ); + Annot * ann = annots->getAnnot( k ); if ( !ann ) { - error(errInternal, -1, "Annot {0:ud} is null", j); + error(errInternal, -1, "Annot {0:ud} is null", k); continue; } @@ -3465,7 +3465,7 @@ class InkAnnotationPrivate : public AnnotationPrivate QList< QLinkedList<QPointF> > inkPaths; // helper - AnnotPath **toAnnotPaths(const QList< QLinkedList<QPointF> > &inkPaths); + AnnotPath **toAnnotPaths(const QList< QLinkedList<QPointF> > &paths); }; InkAnnotationPrivate::InkAnnotationPrivate() @@ -3479,12 +3479,12 @@ Annotation * InkAnnotationPrivate::makeAlias() } // Note: Caller is required to delete array elements and the array itself after use -AnnotPath **InkAnnotationPrivate::toAnnotPaths(const QList< QLinkedList<QPointF> > &inkPaths) +AnnotPath **InkAnnotationPrivate::toAnnotPaths(const QList< QLinkedList<QPointF> > &paths) { - const int pathsNumber = inkPaths.size(); + const int pathsNumber = paths.size(); AnnotPath **res = new AnnotPath*[pathsNumber]; for (int i = 0; i < pathsNumber; ++i) - res[i] = toAnnotPath( inkPaths[i] ); + res[i] = toAnnotPath( paths[i] ); return res; } diff --git a/qt5/src/poppler-media.cc b/qt5/src/poppler-media.cc index 020a52ca..8059153d 100644 --- a/qt5/src/poppler-media.cc +++ b/qt5/src/poppler-media.cc @@ -34,8 +34,8 @@ class MediaRenditionPrivate { public: - MediaRenditionPrivate(::MediaRendition *rendition) - : rendition(rendition) + MediaRenditionPrivate(::MediaRendition *renditionA) + : rendition(renditionA) { } diff --git a/qt5/src/poppler-page.cc b/qt5/src/poppler-page.cc index f4c88de3..381a608b 100644 --- a/qt5/src/poppler-page.cc +++ b/qt5/src/poppler-page.cc @@ -1,7 +1,7 @@ /* poppler-page.cc: qt interface to poppler * Copyright (C) 2005, Net Integration Technologies, Inc. * Copyright (C) 2005, Brad Hards <br...@frogmouth.net> - * Copyright (C) 2005-2017, Albert Astals Cid <aa...@kde.org> + * Copyright (C) 2005-2018, Albert Astals Cid <aa...@kde.org> * Copyright (C) 2005, Stefan Kebekus <stefan.kebe...@math.uni-koeln.de> * Copyright (C) 2006-2011, Pino Toscano <p...@kde.org> * Copyright (C) 2008 Carlos Garcia Campos <carlo...@gnome.org> @@ -103,11 +103,11 @@ public: class Qt5SplashOutputDev : public SplashOutputDev, public OutputDevCallbackHelper { public: - Qt5SplashOutputDev(SplashColorMode colorMode, int bitmapRowPad, - GBool reverseVideo, bool ignorePaperColorA, SplashColorPtr paperColor, - GBool bitmapTopDown, SplashThinLineMode thinLineMode, - GBool overprintPreview) - : SplashOutputDev(colorMode, bitmapRowPad, reverseVideo, paperColor, bitmapTopDown, thinLineMode, overprintPreview) + Qt5SplashOutputDev(SplashColorMode colorModeA, int bitmapRowPadA, + GBool reverseVideoA, bool ignorePaperColorA, SplashColorPtr paperColorA, + GBool bitmapTopDownA, SplashThinLineMode thinLineMode, + GBool overprintPreviewA) + : SplashOutputDev(colorModeA, bitmapRowPadA, reverseVideoA, paperColorA, bitmapTopDownA, thinLineMode, overprintPreviewA) , ignorePaperColor(ignorePaperColorA) { } @@ -121,11 +121,11 @@ public: QImage getXBGRImage(bool takeImageData) { - SplashBitmap *bitmap = getBitmap(); + SplashBitmap *b = getBitmap(); - const int bw = bitmap->getWidth(); - const int bh = bitmap->getHeight(); - const int brs = bitmap->getRowSize(); + const int bw = b->getWidth(); + const int bh = b->getHeight(); + const int brs = b->getRowSize(); // If we use DeviceN8, convert to XBGR8. // If requested, also transfer Splash's internal alpha channel. @@ -137,8 +137,8 @@ public: ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32; - if (bitmap->convertToXBGR(mode)) { - SplashColorPtr data = takeImageData ? bitmap->takeData() : bitmap->getDataPtr(); + if (b->convertToXBGR(mode)) { + SplashColorPtr data = takeImageData ? b->takeData() : b->getDataPtr(); if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { // Convert byte order from RGBX to XBGR. diff --git a/qt5/tests/test-poppler-qt5.cpp b/qt5/tests/test-poppler-qt5.cpp index abf50dda..659a3763 100644 --- a/qt5/tests/test-poppler-qt5.cpp +++ b/qt5/tests/test-poppler-qt5.cpp @@ -204,11 +204,13 @@ int main( int argc, char **argv ) return 0; } - Poppler::Page *page = doc->page(0); - if (page) { - qDebug() << "Page 1 size: " << page->pageSize().width()/72 << "inches x " << page->pageSize().height()/72 << "inches"; - delete page; + Poppler::Page *page = doc->page(0); + if (page) + { + qDebug() << "Page 1 size: " << page->pageSize().width()/72 << "inches x " << page->pageSize().height()/72 << "inches"; + delete page; + } } if (argc == 2 || (argc == 3 && strcmp(argv[2], "-arthur") == 0) || (argc == 3 && strcmp(argv[2], "-textRects") == 0)) diff --git a/splash/SplashFTFontFile.cc b/splash/SplashFTFontFile.cc index 971e4e3f..7fb22be9 100644 --- a/splash/SplashFTFontFile.cc +++ b/splash/SplashFTFontFile.cc @@ -14,6 +14,7 @@ // Copyright (C) 2006 Takashi Iwai <ti...@suse.de> // Copyright (C) 2014, 2017 Adrian Johnson <ajohn...@redneon.com> // Copyright (C) 2017 Oliver Sander <oliver.san...@tu-dresden.de> +// Copyright (C) 2018 Albert Astals Cid <aa...@kde.org> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -112,11 +113,11 @@ SplashFontFile *SplashFTFontFile::loadTrueTypeFont(SplashFTFontEngine *engineA, SplashFTFontFile::SplashFTFontFile(SplashFTFontEngine *engineA, SplashFontFileID *idA, - SplashFontSrc *src, + SplashFontSrc *srcA, FT_Face faceA, int *codeToGIDA, int codeToGIDLenA, GBool trueTypeA, GBool type1A): - SplashFontFile(idA, src) + SplashFontFile(idA, srcA) { engine = engineA; face = faceA; diff --git a/utils/ImageOutputDev.cc b/utils/ImageOutputDev.cc index 90e9ced5..75650e5b 100644 --- a/utils/ImageOutputDev.cc +++ b/utils/ImageOutputDev.cc @@ -540,17 +540,17 @@ void ImageOutputDev::writeImage(GfxState *state, Object *ref, Stream *str, if (globals->isStream()) { FILE *f; int c; - Stream *str = globals->getStream(); + Stream *globalsStr = globals->getStream(); setFilename("jb2g"); if (!(f = fopen(fileName, "wb"))) { error(errIO, -1, "Couldn't open image file '{0:s}'", fileName); return; } - str->reset(); - while ((c = str->getChar()) != EOF) + globalsStr->reset(); + while ((c = globalsStr->getChar()) != EOF) fputc(c, f); - str->close(); + globalsStr->close(); fclose(f); } diff --git a/utils/pdfinfo.cc b/utils/pdfinfo.cc index 985761e9..2f229cbe 100644 --- a/utils/pdfinfo.cc +++ b/utils/pdfinfo.cc @@ -407,10 +407,9 @@ static void printDestinations(PDFDoc *doc, UnicodeMap *uMap) { printf(" \""); Unicode *u; char buf[8]; - int n, len; - len = TextStringToUCS4(it.first, &u); - for (int i = 0; i < len; i++) { - n = uMap->mapUnicode(u[i], buf, sizeof(buf)); + const int len = TextStringToUCS4(it.first, &u); + for (int j = 0; j < len; j++) { + const int n = uMap->mapUnicode(u[j], buf, sizeof(buf)); fwrite(buf, 1, n, stdout); } gfree(u); diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc index a15fa13e..72a6e7e1 100644 --- a/utils/pdftocairo.cc +++ b/utils/pdftocairo.cc @@ -303,18 +303,18 @@ static const AntiliasOption antialiasOptions[] = { nullptr, CAIRO_ANTIALIAS_DEFAULT }, }; -static GBool parseAntialiasOption(GooString *antialias, cairo_antialias_t *antialiasEnum) +static GBool parseAntialiasOption() { const AntiliasOption *option = antialiasOptions; while (option->name) { - if (antialias->cmp(option->name) == 0) { - *antialiasEnum = option->value; + if (antialias.cmp(option->name) == 0) { + antialiasEnum = option->value; return gTrue; } option++; } - fprintf(stderr, "Error: Invalid antialias option \"%s\"\n", antialias->getCString()); + fprintf(stderr, "Error: Invalid antialias option \"%s\"\n", antialias.getCString()); fprintf(stderr, "Valid options are:\n"); option = antialiasOptions; while (option->name) { @@ -487,15 +487,15 @@ static void writePageImage(GooString *filename) // convert to gray // The PDF Reference specifies the DeviceRGB to DeviceGray conversion as // gray = 0.3*red + 0.59*green + 0.11*blue - int r = (*pixel & 0x00ff0000) >> 16; - int g = (*pixel & 0x0000ff00) >> 8; - int b = (*pixel & 0x000000ff) >> 0; + const int r = (*pixel & 0x00ff0000) >> 16; + const int g = (*pixel & 0x0000ff00) >> 8; + const int b = (*pixel & 0x000000ff) >> 0; // an arbitrary integer approximation of .3*r + .59*g + .11*b - int y = (r*19661+g*38666+b*7209 + 32829)>>16; + const int grayValue = (r*19661+g*38666+b*7209 + 32829)>>16; if (mono) { if (bit == 7) *rowp = 0; - if (y > 127) + if (grayValue > 127) *rowp |= (1 << bit); bit--; if (bit < 0) { @@ -503,7 +503,7 @@ static void writePageImage(GooString *filename) rowp++; } } else { - *rowp++ = y; + *rowp++ = grayValue; } } else { // copy into RGB format @@ -1013,7 +1013,7 @@ int main(int argc, char *argv[]) { } if (antialias.getLength() > 0) { - if (!parseAntialiasOption(&antialias, &antialiasEnum)) + if (!parseAntialiasOption()) exit(99); } diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc index 2ee198be..80336eb8 100644 --- a/utils/pdftoppm.cc +++ b/utils/pdftoppm.cc @@ -76,10 +76,10 @@ static double y_resolution = 150.0; static int scaleTo = 0; static int x_scaleTo = 0; static int y_scaleTo = 0; -static int x = 0; -static int y = 0; -static int w = 0; -static int h = 0; +static int param_x = 0; +static int param_y = 0; +static int param_w = 0; +static int param_h = 0; static int sz = 0; static GBool useCropBox = gFalse; static GBool mono = gFalse; @@ -136,13 +136,13 @@ static const ArgDesc argDesc[] = { {"-scale-to-y", argInt, &y_scaleTo, 0, "scales each page vertically to fit in scale-to-y pixels"}, - {"-x", argInt, &x, 0, + {"-x", argInt, ¶m_x, 0, "x-coordinate of the crop area top left corner"}, - {"-y", argInt, &y, 0, + {"-y", argInt, ¶m_y, 0, "y-coordinate of the crop area top left corner"}, - {"-W", argInt, &w, 0, + {"-W", argInt, ¶m_w, 0, "width of crop area in pixels (default is 0)"}, - {"-H", argInt, &h, 0, + {"-H", argInt, ¶m_h, 0, "height of crop area in pixels (default is 0)"}, {"-sz", argInt, &sz, 0, "size of crop square in pixels (sets W and H)"}, @@ -548,7 +548,7 @@ int main(int argc, char *argv[]) { #endif // UTILS_USE_PTHREADS - if (sz != 0) w = h = sz; + if (sz != 0) param_w = param_h = sz; pg_num_len = numberOfCharacters(doc->getNumPages()); for (pg = firstPage; pg <= lastPage; ++pg) { if (printOnlyEven && pg % 2 == 0) continue; @@ -597,7 +597,7 @@ int main(int argc, char *argv[]) { } #ifndef UTILS_USE_PTHREADS // process job in main thread - savePageSlice(doc, splashOut, pg, x, y, w, h, pg_w, pg_h, ppmFile); + savePageSlice(doc, splashOut, pg, param_x, param_y, param_w, param_h, pg_w, pg_h, ppmFile); delete[] ppmFile; #else _______________________________________________ poppler mailing list poppler@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/poppler