[poppler] poppler/Link.cc poppler/Link.h
poppler/Link.cc | 17 - poppler/Link.h |7 --- 2 files changed, 24 deletions(-) New commits: commit 6e60cd8ef9696c12e4f33eb671013315b2b07790 Author: Albert Astals Cid Date: Sat Nov 30 02:04:22 2019 +0100 Links: Remove two unused functions Note: If you're one of the people using the internal API against our wishes, you can still roll out these functions yourself diff --git a/poppler/Link.cc b/poppler/Link.cc index 4db8fe3d..35ddfb92 100644 --- a/poppler/Link.cc +++ b/poppler/Link.cc @@ -969,20 +969,3 @@ Links::~Links() { for (AnnotLink *link : links) link->decRefCnt(); } - -LinkAction *Links::find(double x, double y) const { - for (int i = getNumLinks() - 1; i >= 0; --i) { -if (links[i]->inRect(x, y)) { - return links[i]->getAction(); -} - } - return nullptr; -} - -bool Links::onLink(double x, double y) const { - for (AnnotLink *link : links) { -if (link->inRect(x, y)) - return true; - } - return false; -} diff --git a/poppler/Link.h b/poppler/Link.h index 59c1ae0b..59ecd4e4 100644 --- a/poppler/Link.h +++ b/poppler/Link.h @@ -543,13 +543,6 @@ public: int getNumLinks() const { return links.size(); } AnnotLink *getLink(int i) const { return links[i]; } - // If point , is in a link, return the associated action; - // else return nullptr. - LinkAction *find(double x, double y) const; - - // Return true if , is in a link. - bool onLink(double x, double y) const; - private: std::vector links; ___ poppler mailing list poppler@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/poppler
[poppler] poppler/Link.cc poppler/Link.h
poppler/Link.cc | 33 +++-- poppler/Link.h |5 ++--- 2 files changed, 9 insertions(+), 29 deletions(-) New commits: commit 82dc60155a015e5798db6f78a5f165dc7dd376c9 Author: Albert Astals Cid Date: Fri Nov 29 14:54:27 2019 +0100 Turn Links::links into a std::vector instead of ** diff --git a/poppler/Link.cc b/poppler/Link.cc index 64dc7041..4db8fe3d 100644 --- a/poppler/Link.cc +++ b/poppler/Link.cc @@ -951,44 +951,27 @@ LinkUnknown::~LinkUnknown() { // Links::Links(Annots *annots) { - int size; - int i; - - links = nullptr; - size = 0; - numLinks = 0; - if (!annots) return; - for (i = 0; i < annots->getNumAnnots(); ++i) { + for (int i = 0; i < annots->getNumAnnots(); ++i) { Annot *annot = annots->getAnnot(i); if (annot->getType() != Annot::typeLink) continue; -if (numLinks >= size) { - size += 16; - links = (AnnotLink **)greallocn(links, size, sizeof(AnnotLink *)); -} annot->incRefCnt(); -links[numLinks++] = static_cast(annot); +links.push_back(static_cast(annot)); } } Links::~Links() { - int i; - - for (i = 0; i < numLinks; ++i) -links[i]->decRefCnt(); - - gfree(links); + for (AnnotLink *link : links) +link->decRefCnt(); } LinkAction *Links::find(double x, double y) const { - int i; - - for (i = numLinks - 1; i >= 0; --i) { + for (int i = getNumLinks() - 1; i >= 0; --i) { if (links[i]->inRect(x, y)) { return links[i]->getAction(); } @@ -997,10 +980,8 @@ LinkAction *Links::find(double x, double y) const { } bool Links::onLink(double x, double y) const { - int i; - - for (i = 0; i < numLinks; ++i) { -if (links[i]->inRect(x, y)) + for (AnnotLink *link : links) { +if (link->inRect(x, y)) return true; } return false; diff --git a/poppler/Link.h b/poppler/Link.h index d610fad0..59c1ae0b 100644 --- a/poppler/Link.h +++ b/poppler/Link.h @@ -540,7 +540,7 @@ public: Links& operator=(const Links &) = delete; // Iterate through list of links. - int getNumLinks() const { return numLinks; } + int getNumLinks() const { return links.size(); } AnnotLink *getLink(int i) const { return links[i]; } // If point , is in a link, return the associated action; @@ -552,8 +552,7 @@ public: private: - AnnotLink **links; - int numLinks; + std::vector links; }; #endif ___ poppler mailing list poppler@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/poppler
[poppler] CMakeLists.txt cpp/poppler-private.h fofi/FoFiBase.cc fofi/FoFiEncodings.cc fofi/FoFiIdentifier.cc fofi/FoFiTrueType.cc fofi/FoFiTrueType.h fofi/FoFiType1.cc fofi/FoFiType1C.cc .gitlab-ci.ym
.gitlab-ci.yml|2 +- CMakeLists.txt|2 +- cpp/poppler-private.h |2 +- fofi/FoFiBase.cc |4 ++-- fofi/FoFiEncodings.cc |2 +- fofi/FoFiIdentifier.cc|6 +++--- fofi/FoFiTrueType.cc |6 +++--- fofi/FoFiTrueType.h |2 +- fofi/FoFiType1.cc |6 +++--- fofi/FoFiType1C.cc|8 glib/demo/CMakeLists.txt |1 + glib/poppler-attachment.cc|2 +- glib/poppler-document.cc |2 +- glib/poppler-media.cc |2 +- glib/poppler-page.cc |2 +- glib/poppler-structure-element.cc |2 +- goo/GooTimer.cc |2 +- goo/ImgWriter.h |2 +- goo/PNGWriter.cc |4 ++-- goo/TiffWriter.cc |2 +- goo/gbasename.cc |4 ++-- goo/gfile.cc |6 +++--- goo/gfile.h |8 goo/glibc.h |2 +- goo/glibc_strtok_r.cc |2 +- goo/gstrtod.cc|8 poppler/Annot.cc |8 poppler/BuiltinFont.cc|4 ++-- poppler/BuiltinFontTables.cc |2 +- poppler/CMap.cc |8 poppler/CairoFontEngine.cc|2 +- poppler/CairoOutputDev.cc |6 +++--- poppler/CairoRescaleBox.cc| 10 +- poppler/Catalog.cc|4 ++-- poppler/CertificateInfo.cc|4 ++-- poppler/CertificateInfo.h |2 +- poppler/CharCodeToUnicode.cc |4 ++-- poppler/DCTStream.h | 12 ++-- poppler/DateInfo.cc |4 ++-- poppler/DateInfo.h|2 +- poppler/Decrypt.cc|2 +- poppler/Error.cc |6 +++--- poppler/Error.h |2 +- poppler/FlateEncoder.h| 10 +- poppler/FlateStream.h | 10 +- poppler/FontEncodingTables.cc |2 +- poppler/FontInfo.cc | 10 +- poppler/Form.cc |8 poppler/Form.h|2 +- poppler/Function.cc |8 poppler/Gfx.cc| 10 +- poppler/GfxFont.cc| 12 ++-- poppler/GfxState.cc |6 +++--- poppler/GfxState.h|2 +- poppler/GlobalParams.cc |6 +++--- poppler/GlobalParams.h|4 ++-- poppler/GlobalParamsWin.cc|8 poppler/Hints.cc |2 +- poppler/Hints.h |2 +- poppler/JBIG2Stream.cc|4 ++-- poppler/JPXStream.cc |2 +- poppler/Lexer.cc | 10 +- poppler/Link.cc |4 ++-- poppler/Movie.cc |2 +- poppler/NameToCharCode.cc |2 +- poppler/NameToUnicodeTable.h |2 +- poppler/Object.cc |2 +- poppler/Object.h |6 +++--- poppler/OutputDev.cc |2 +- poppler/PDFDoc.cc | 18 +- poppler/PDFDoc.h |2 +- poppler/PSOutputDev.cc| 12 ++-- poppler/PSOutputDev.h |2 +- poppler/PSTokenizer.cc|4 ++-- poppler/Page.cc |4 ++-- poppler/PageLabelInfo.cc |8 poppler/PageLabelInfo.h | 10 +- poppler/Parser.cc |2 +- poppler/PreScanOutputDev.cc |2 +- poppler/Rendition.cc |2 +- poppler/SecurityHandler.cc|2 +- poppler/SignatureInfo.cc |4 ++-- poppler/SignatureInfo.h |2 +- poppler/SplashOutputDev.cc|2 +- poppler/StdinCachedFile.cc|2 +- poppler/Stream.cc | 12 ++-- poppler/StructElement.cc |2 +- poppler/StructTreeRoot.cc |2 +- poppler/TextOutputDev.cc | 10 +- poppler/TextOutputDev.h |2 +- poppler/UnicodeMap.cc |4 ++-- poppler/UnicodeTypeTable.cc |2 +- poppler/XRef.cc | 14 +++--- poppler/poppler-config.h.cmake|2 +- qt5/src/ArthurOutputDev.cc|4 ++-- qt5/src/CMakeLists.txt|3 +++ qt5/src/poppler-form.cc |
[poppler] .gitlab-ci.yml poppler/GfxState.cc poppler/SplashOutputDev.cc utils/HtmlOutputDev.cc
.gitlab-ci.yml |2 +- poppler/GfxState.cc| 22 +++--- poppler/SplashOutputDev.cc |8 utils/HtmlOutputDev.cc |2 +- 4 files changed, 17 insertions(+), 17 deletions(-) New commits: commit 5713d0da012b734a28234455dcf817d5be20a98f Author: Albert Astals Cid Date: Fri Nov 29 16:19:53 2019 +0100 Enable readability-string-compare diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 406e1bcd..41de1a65 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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-*,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=*" .. +- 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,readability-string-compare,-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 diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc index c2851d32..859889cb 100644 --- a/poppler/GfxState.cc +++ b/poppler/GfxState.cc @@ -2870,18 +2870,18 @@ GfxDeviceNColorSpace::GfxDeviceNColorSpace(int nCompsA, overprintMask = 0; mapping = nullptr; for (int i = 0; i < nComps; ++i) { -if (names[i].compare("None")) { +if (names[i] != "None") { nonMarking = false; } -if (!names[i].compare("Cyan")) { +if (names[i] == "Cyan") { overprintMask |= 0x01; -} else if (!names[i].compare("Magenta")) { +} else if (names[i] == "Magenta") { overprintMask |= 0x02; -} else if (!names[i].compare("Yellow")) { +} else if (names[i] == "Yellow") { overprintMask |= 0x04; -} else if (!names[i].compare("Black")) { +} else if (names[i] == "Black") { overprintMask |= 0x08; -} else if (!names[i].compare("All")) { +} else if (names[i] == "All") { overprintMask = 0x; } else { overprintMask = 0x0f; @@ -3093,18 +3093,18 @@ void GfxDeviceNColorSpace::createMapping(std::vector * mapping = (int *)gmalloc(sizeof(int) * nComps); unsigned int newOverprintMask = 0; for (int i = 0; i < nComps; i++) { -if (!names[i].compare("None")) { +if (names[i] == "None") { mapping[i] = -1; -} else if (!names[i].compare("Cyan")) { +} else if (names[i] == "Cyan") { newOverprintMask |= 0x01; mapping[i] = 0; -} else if (!names[i].compare("Magenta")) { +} else if (names[i] == "Magenta") { newOverprintMask |= 0x02; mapping[i] = 1; -} else if (!names[i].compare("Yellow")) { +} else if (names[i] == "Yellow") { newOverprintMask |= 0x04; mapping[i] = 2; -} else if (!names[i].compare("Black")) { +} else if (names[i] == "Black") { newOverprintMask |= 0x08; mapping[i] = 3; } else { diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index beb0d47c..ed094e68 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -1742,13 +1742,13 @@ void SplashOutputDev::setOverprintMask(GfxColorSpace *colorSpace, GfxDeviceNColorSpace *deviceNCS = (GfxDeviceNColorSpace *)colorSpace; additive = mask == 0x0f && !deviceNCS->isNonMarking(); for (i = 0; i < deviceNCS->getNComps() && additive; i++) { -if (deviceNCS->getColorantName(i).compare("Cyan") == 0) { +if (deviceNCS->getColorantName(i) == "Cyan") { additive = false; -} else if (deviceNCS->getColorantName(i).compare("Magenta") == 0) { +} else if (deviceNCS->getColorantName(i) == "Magenta") { additive = false; -} else if (deviceNCS->getColorantName(i).compare("Yellow") == 0) { +} else if (deviceNCS->getColorantName(i) == "Yellow") { additive = false; -} else if (deviceNCS->getColorantName(i).compare("Black") == 0) { +} else if (deviceNCS->getColorantName(i) == "Black") { additive = false; } } diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc index a3e4967a..52fe1d4d 100644 --- a/utils/HtmlOutputDev.cc +++ b/utils/HtmlOutputDev.cc @@ -1032,7 +1032,7 @@ std::string HtmlOutputDev::mapEncodingToHtml(const std::string ) {
[poppler] cpp/poppler-document.h cpp/poppler-image.cpp .gitlab-ci.yml goo/gbase64.h goo/gbasename.h poppler/Annot.cc poppler/Annot.h poppler/CachedFile.cc poppler/CairoFontEngine.h poppler/DateInfo.h
.gitlab-ci.yml|2 +- cpp/poppler-document.h|5 +++-- cpp/poppler-image.cpp | 14 +++--- goo/gbase64.h |3 ++- goo/gbasename.h |3 ++- poppler/Annot.cc | 12 ++-- poppler/Annot.h | 12 ++-- poppler/CachedFile.cc |6 +++--- poppler/CairoFontEngine.h | 12 ++-- poppler/DateInfo.h|4 ++-- poppler/Form.cc | 36 ++-- poppler/Form.h| 12 ++-- poppler/GfxFont.cc|8 poppler/GfxFont.h |2 +- poppler/GfxState.h|6 +++--- poppler/JPEG2000Stream.cc |2 +- poppler/Movie.h | 10 +- poppler/PDFDoc.h |2 +- poppler/PSOutputDev.cc|4 ++-- poppler/Sound.h |6 +++--- poppler/SplashOutputDev.cc|2 +- poppler/SplashOutputDev.h |6 +++--- poppler/StructElement.h |2 +- poppler/UTF.cc|6 +++--- poppler/UTF.h |2 +- poppler/UnicodeTypeTable.h|5 +++-- qt5/demos/navigationtoolbar.h |5 +++-- qt5/src/poppler-annotation.h | 10 +- qt5/src/poppler-link.cc |2 +- qt5/src/poppler-qt5.h | 20 ++-- splash/Splash.cc |4 ++-- splash/Splash.h |4 ++-- splash/SplashFTFontFile.h |3 ++- 33 files changed, 119 insertions(+), 113 deletions(-) New commits: commit 42efcb738cd5924215249c55dd2d0ff7f517d6b5 Author: Albert Astals Cid Date: Fri Nov 29 15:45:37 2019 +0100 Enable readability-inconsistent-declaration-parameter-name diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2dba0f3c..406e1bcd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/cpp/poppler-document.h b/cpp/poppler-document.h index 07bd6eef..9162d58a 100644 --- a/cpp/poppler-document.h +++ b/cpp/poppler-document.h @@ -2,6 +2,7 @@ * Copyright (C) 2009-2010, Pino Toscano * Copyright (C) 2016 Jakub Alba * Copyright (C) 2019, Masamichi Hosoda + * Copyright (C) 2019, Albert Astals Cid * * 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 create_destination_map() const; -bool save(const std::string ) const; -bool save_a_copy(const std::string ) const; +bool save(const std::string _name) const; +bool save_a_copy(const std::string _name) const; static document* load_from_file(const std::string _name, const std::string _password = std::string(), diff --git a/cpp/poppler-image.cpp b/cpp/poppler-image.cpp index daf10f02..745bf221 100644 --- a/cpp/poppler-image.cpp +++ b/cpp/poppler-image.cpp @@ -225,8 +225,8 @@ image::image(char *idata, int iwidth, int iheight, image::format_enum iformat) /** Copy constructor. */ -image::image(const image ) -: d(pt.d) +image::image(const image ) +: d(img.d) { if (d) { ++d->ref; @@ -496,16 +496,16 @@ std::vector image::supported_image_formats() /** Assignment operator. */ -image& image::operator=(const image ) +image& image::operator=(const image ) { -if (this == ) +if (this == ) 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; } diff --git a/goo/gbase64.h b/goo/gbase64.h index 06e2e8b6..a876f5b8 100644 --- a/goo/gbase64.h +++ b/goo/gbase64.h @@ -8,6 +8,7 @@ // This file is licensed under the GPLv2 or later // //
[poppler] cpp/poppler-image.cpp qt5/src
cpp/poppler-image.cpp |5 - qt5/src/poppler-outline.cc |3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) New commits: commit ec2b036e0029e94183a87471c83577336bbaedda Author: Albert Astals Cid Date: Fri Nov 29 14:42:31 2019 +0100 Return early in operator= if we're assigning to ourselves Makes bugprone-unhandled-self-assignment happy diff --git a/cpp/poppler-image.cpp b/cpp/poppler-image.cpp index 261c5f7b..daf10f02 100644 --- a/cpp/poppler-image.cpp +++ b/cpp/poppler-image.cpp @@ -1,7 +1,7 @@ /* * Copyright (C) 2010-2011, Pino Toscano * Copyright (C) 2013 Adrian Johnson - * Copyright (C) 2017, 2018, Albert Astals Cid + * Copyright (C) 2017-2019, Albert Astals Cid * Copyright (C) 2017, Jeroen Ooms * Copyright (C) 2018, Zsombor Hollay-Horvath * Copyright (C) 2018, Adam Reichold @@ -498,6 +498,9 @@ std::vector image::supported_image_formats() */ image& image::operator=(const image ) { +if (this == ) +return *this; + if (pt.d) { ++pt.d->ref; } diff --git a/qt5/src/poppler-outline.cc b/qt5/src/poppler-outline.cc index dd452b47..1c7e4a3d 100644 --- a/qt5/src/poppler-outline.cc +++ b/qt5/src/poppler-outline.cc @@ -44,6 +44,9 @@ OutlineItem::OutlineItem(const OutlineItem ) : m_data{new OutlineItemData{ OutlineItem ::operator=(const OutlineItem ) { + if (this == ) +return *this; + auto *data = new OutlineItemData{*other.m_data}; qSwap(m_data, data); delete data; ___ poppler mailing list poppler@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/poppler