[poppler] cpp/poppler-global.cpp .gitlab-ci.yml poppler/CharCodeToUnicode.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Dec 8 11:37:15 UTC 2020


 .gitlab-ci.yml               |    2 +-
 cpp/poppler-global.cpp       |    5 +++--
 poppler/CharCodeToUnicode.cc |    6 +++---
 3 files changed, 7 insertions(+), 6 deletions(-)

New commits:
commit 32857374f02457b247b9f02f33c9342a1334526d
Author: Albert Astals Cid <aacid at kde.org>
Date:   Tue Dec 8 12:30:01 2020 +0100

    Enable bugprone-signed-char-misuse

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index abf4f372..c99520d5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -53,7 +53,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,readability-string-compare,modernize-deprecated-headers,modernize-make-unique,modernize-make-shared,modernize-use-override,modernize-use-equals-delete,modernize-use-emplace,modernize-use-bool-literals,modernize-redundant-void-arg,modernize-loop-convert,-bugprone-narrowing-conversions,-bugprone-macro-parentheses,-bugprone-suspicious-string-compare,-bugprone-incorrect-roundings,-bugprone-undefined-memory-manipulation,-bugprone-sizeof-expression,-bugprone-branch-clone,-bugprone-reserved-identifier,-bugprone-signed-char-misuse,-bugprone-suspicious-include;-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,modernize-deprecated-headers,modernize-make-unique,modernize-make-shared,modernize-use-override,modernize-use-equals-delete,modernize-use-emplace,modernize-use-bool-literals,modernize-redundant-void-arg,modernize-loop-convert,-bugprone-narrowing-conversions,-bugprone-macro-parentheses,-bugprone-suspicious-string-compare,-bugprone-incorrect-roundings,-bugprone-undefined-memory-manipulation,-bugprone-sizeof-expression,-bugprone-branch-clone,-bugprone-reserved-identifier,-bugprone-suspicious-include;-warnings-as-errors=*" ..
     - ninja
     - ctest --output-on-failure
 
diff --git a/cpp/poppler-global.cpp b/cpp/poppler-global.cpp
index 8fc1e9d0..52ecd636 100644
--- a/cpp/poppler-global.cpp
+++ b/cpp/poppler-global.cpp
@@ -4,7 +4,7 @@
  * Copyright (C) 2014, 2015 Hans-Peter Deifel <hpdeifel at gmx.de>
  * Copyright (C) 2015, Tamas Szekeres <szekerest at gmail.com>
  * Copyright (C) 2016 Jakub Alba <jakubalba at gmail.com>
- * Copyright (C) 2018, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2018, 2020, Albert Astals Cid <aacid at kde.org>
  * Copyright (C) 2018 Suzuki Toshiya <mpsuzuki at hiroshima-u.ac.jp>
  * Copyright (C) 2018, 2020, Adam Reichold <adam.reichold at t-online.de>
  *
@@ -309,7 +309,8 @@ ustring ustring::from_latin1(const std::string &str)
     const char *c = str.data();
     ustring ret(l, 0);
     for (size_type i = 0; i < l; ++i) {
-        ret[i] = *c++;
+        ret[i] = static_cast<unsigned char>(*c);
+        c++;
     }
     return ret;
 }
diff --git a/poppler/CharCodeToUnicode.cc b/poppler/CharCodeToUnicode.cc
index 618bd9c8..eba94d62 100644
--- a/poppler/CharCodeToUnicode.cc
+++ b/poppler/CharCodeToUnicode.cc
@@ -62,13 +62,13 @@ struct CharCodeToUnicodeString
 
 static int getCharFromString(void *data)
 {
-    char *p;
+    unsigned char *p;
     int c;
 
-    p = *(char **)data;
+    p = *(unsigned char **)data;
     if (*p) {
         c = *p++;
-        *(char **)data = p;
+        *(unsigned char **)data = p;
     } else {
         c = EOF;
     }


More information about the poppler mailing list