[poppler] .gitlab-ci.yml poppler/GfxState.cc poppler/SplashOutputDev.cc utils/HtmlOutputDev.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Nov 29 15:24:03 UTC 2019


 .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 <aacid at kde.org>
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 = 0xffffffff;
     } else {
       overprintMask = 0x0f;
@@ -3093,18 +3093,18 @@ void GfxDeviceNColorSpace::createMapping(std::vector<GfxSeparationColorSpace*> *
   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 &encoding)
 {
   for(int i = 0; HtmlEncodings[i][0] != nullptr; i++)
   {
-    if( encoding.compare(HtmlEncodings[i][0]) == 0 )
+    if( encoding == HtmlEncodings[i][0] )
     {
       return HtmlEncodings[i][1];
     }


More information about the poppler mailing list