[poppler] 3 commits - .gitlab-ci.yml poppler/CurlCachedFile.cc poppler/DateInfo.cc poppler/PSOutputDev.cc utils/HtmlOutputDev.cc
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Jan 3 00:15:12 UTC 2021
.gitlab-ci.yml | 4 +++-
poppler/CurlCachedFile.cc | 6 +++---
poppler/DateInfo.cc | 3 ++-
poppler/PSOutputDev.cc | 5 +++--
utils/HtmlOutputDev.cc | 4 ++--
5 files changed, 13 insertions(+), 9 deletions(-)
New commits:
commit 04aa2f7e416eb232821576fec7ed61b0b7273fbc
Author: Albert Astals Cid <aacid at kde.org>
Date: Sun Jan 3 01:06:39 2021 +0100
CI: Enable goostring-format-checker clang checker
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c99520d5..9c143682 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -53,7 +53,9 @@ 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-suspicious-include;-warnings-as-errors=*" ..
+ - apt-get install --yes --no-install-recommends libclang-dev llvm-dev
+ - clang++ -fPIC -shared -o goostring-format-checker.so ../test/goostring-format-checker/goostring-format-checker.cc -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -I /usr/lib/llvm-11/include/
+ - CC=clang CXX=clang++ cmake -G Ninja -DCMAKE_CXX_FLAGS="-stdlib=libc++ -Xclang -load -Xclang $PWD/goostring-format-checker.so -Xclang -add-plugin -Xclang goostring-format-checker" -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
commit 4d58ff810bb977855c55d4de7d75899aa9ef55b7
Author: Albert Astals Cid <aacid at kde.org>
Date: Sun Jan 3 01:05:01 2021 +0100
Change a few variables to types GooString::format knows about
None of them is problematic, but being more strict let's use enable the
goostring-format-checker clang plugin
diff --git a/poppler/CurlCachedFile.cc b/poppler/CurlCachedFile.cc
index d867626b..926a6f5b 100644
--- a/poppler/CurlCachedFile.cc
+++ b/poppler/CurlCachedFile.cc
@@ -6,7 +6,7 @@
//
// Copyright 2009 Stefan Thomas <thomas at eload24.com>
// Copyright 2010, 2011 Hib Eris <hib at hiberis.nl>
-// Copyright 2010, 2019 Albert Astals Cid <aacid at kde.org>
+// Copyright 2010, 2019, 2021 Albert Astals Cid <aacid at kde.org>
//
//========================================================================
@@ -72,12 +72,12 @@ static size_t load_cb(const char *ptr, size_t size, size_t nmemb, void *data)
int CurlCachedFileLoader::load(const std::vector<ByteRange> &ranges, CachedFileWriter *writer)
{
CURLcode r = CURLE_OK;
- size_t fromByte, toByte;
+ unsigned long long fromByte, toByte;
for (const ByteRange &bRange : ranges) {
fromByte = bRange.offset;
toByte = fromByte + bRange.length - 1;
- GooString *range = GooString::format("{0:ud}-{1:ud}", fromByte, toByte);
+ GooString *range = GooString::format("{0:ulld}-{1:ulld}", fromByte, toByte);
curl_easy_setopt(curl, CURLOPT_URL, url->c_str());
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, load_cb);
diff --git a/poppler/DateInfo.cc b/poppler/DateInfo.cc
index d277ee74..010a0dfb 100644
--- a/poppler/DateInfo.cc
+++ b/poppler/DateInfo.cc
@@ -8,6 +8,7 @@
// Copyright (C) 2015 André Esser <bepandre at hotmail.com>
// Copyright (C) 2016, 2018 Adrian Johnson <ajohnson at redneon.com>
// Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, <info at kdab.com>. Work sponsored by Technische Universität Dresden
+// Copyright (C) 2021 Albert Astals Cid <aacid at 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
@@ -86,7 +87,7 @@ GooString *timeToDateString(const time_t *timeA)
// calculate time zone offset by comparing local and gmtime time_t value for same
// time.
const time_t timeg = timegm(&localtime_tm);
- const time_t offset = difftime(timeg, timet); // find time zone offset in seconds
+ const int offset = difftime(timeg, timet); // find time zone offset in seconds
if (offset > 0) {
dateString->appendf("+{0:02d}'{1:02d}'", offset / 3600, (offset % 3600) / 60);
} else if (offset < 0) {
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 1b0bb66c..e97cb501 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -15,7 +15,7 @@
//
// Copyright (C) 2005 Martin Kretzschmar <martink at gnome.org>
// Copyright (C) 2005, 2006 Kristian Høgsberg <krh at redhat.com>
-// Copyright (C) 2006-2009, 2011-2013, 2015-2020 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2006-2009, 2011-2013, 2015-2021 Albert Astals Cid <aacid at kde.org>
// Copyright (C) 2006 Jeff Muizelaar <jeff at infidigm.net>
// Copyright (C) 2007, 2008 Brad Hards <bradh at kde.org>
// Copyright (C) 2008, 2009 Koji Otani <sho at bbr.jp>
@@ -6601,7 +6601,8 @@ void PSOutputDev::dumpColorSpaceL2(GfxState *state, GfxColorSpace *colorSpace, b
if (validref) {
name = GooString::format("ICCBased-{0:d}-{1:d}-{2:d}", ref.num, ref.gen, intent);
} else {
- name = GooString::format("ICCBased-hashed-{0:ullX}-{1:d}", std::hash<GfxLCMSProfilePtr> {}(iccBasedCS->getProfile()), intent);
+ const unsigned long long hash = std::hash<GfxLCMSProfilePtr> {}(iccBasedCS->getProfile());
+ name = GooString::format("ICCBased-hashed-{0:ullX}-{1:d}", hash, intent);
}
const auto &it = iccEmitted.find(name->toStr());
if (it != iccEmitted.end()) {
commit 6b4f07ad1b74a2fa715d76d9da9cef3a2670d92c
Author: Albert Astals Cid <aacid at kde.org>
Date: Sun Jan 3 01:02:53 2021 +0100
HtmlOutputDev: Fix error() parameter type
This would cause a crash if that error() is ever called
diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index 30eb464f..8fa1671b 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -17,7 +17,7 @@
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
-// Copyright (C) 2005-2013, 2016-2020 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005-2013, 2016-2021 Albert Astals Cid <aacid at kde.org>
// Copyright (C) 2008 Kjartan Maraas <kmaraas at gnome.org>
// Copyright (C) 2008 Boris Toloknov <tlknv at yandex.ru>
// Copyright (C) 2008 Haruyuki Kawabe <Haruyuki.Kawabe at unisys.co.jp>
@@ -819,7 +819,7 @@ int HtmlPage::dumpComplexHeaders(FILE *const file, FILE *&pageFile, int page)
}
if (!pageFile) {
- error(errIO, -1, "Couldn't open html file '{0:t}'", pageFileName.c_str());
+ error(errIO, -1, "Couldn't open html file '{0:s}'", pageFileName.c_str());
return 1;
}
More information about the poppler
mailing list