Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package poppler for openSUSE:Factory checked in at 2022-10-12 18:23:25 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/poppler (Old) and /work/SRC/openSUSE:Factory/.poppler.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "poppler" Wed Oct 12 18:23:25 2022 rev:185 rq:1009288 version:22.10.0 Changes: -------- --- /work/SRC/openSUSE:Factory/poppler/poppler.changes 2022-09-25 15:34:09.499457505 +0200 +++ /work/SRC/openSUSE:Factory/.poppler.new.2275/poppler.changes 2022-10-12 18:24:20.405611795 +0200 @@ -1,0 +2,16 @@ +Tue Oct 4 13:21:17 UTC 2022 - Dirk M??ller <dmuel...@suse.com> + +- update to 22.10.0: + * SplashOutputDev::tilingPatternFill: Properly restore CTM on failure. + * Protect against malformed files + * Refactor code to not use strndup + * Other small code refactoring + utils: + * pdftoppm: Avoid round-off errors when determining raster dimensions + * pdftocairo: Avoid round-off errors when determining raster dimensions + * pdftotext: Simplify memory handling + qt: + * Take into account flagNoView when getting/setting the visible status. + KDE bug #456313 + +------------------------------------------------------------------- Old: ---- poppler-22.09.0.tar.xz poppler-22.09.0.tar.xz.sig New: ---- poppler-22.10.0.tar.xz poppler-22.10.0.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ poppler.spec ++++++ --- /var/tmp/diff_new_pack.W25CFM/_old 2022-10-12 18:24:20.913613064 +0200 +++ /var/tmp/diff_new_pack.W25CFM/_new 2022-10-12 18:24:20.917613074 +0200 @@ -24,7 +24,7 @@ %endif # Actual version of poppler-data: %define poppler_data_version 0.4.11 -%define poppler_sover 124 +%define poppler_sover 125 %define poppler_cpp_sover 0 %define poppler_glib_sover 8 %define poppler_qt5_sover 1 @@ -32,7 +32,7 @@ %define poppler_api 0.18 %define poppler_apipkg 0_18 Name: poppler%{?psuffix} -Version: 22.09.0 +Version: 22.10.0 Release: 0 Summary: PDF Rendering Library License: GPL-2.0-only OR GPL-3.0-only ++++++ poppler-22.09.0.tar.xz -> poppler-22.10.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.09.0/.gitlab-ci.yml new/poppler-22.10.0/.gitlab-ci.yml --- old/poppler-22.09.0/.gitlab-ci.yml 2022-09-01 00:30:57.000000000 +0200 +++ new/poppler-22.10.0/.gitlab-ci.yml 2022-10-03 18:11:20.000000000 +0200 @@ -76,9 +76,9 @@ - cmake -G Ninja .. - ninja -build_mingw64_fedora36: +build_mingw64_fedora37: stage: build - image: fedora:36 + image: fedora:37 before_script: - dnf install -y 'dnf-command(builddep)' - dnf builddep -y mingw64-poppler diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.09.0/CMakeLists.txt new/poppler-22.10.0/CMakeLists.txt --- old/poppler-22.09.0/CMakeLists.txt 2022-09-01 00:30:57.000000000 +0200 +++ new/poppler-22.10.0/CMakeLists.txt 2022-10-03 18:11:20.000000000 +0200 @@ -39,7 +39,7 @@ endif() set(POPPLER_MAJOR_VERSION "22") -set(POPPLER_MINOR_VERSION_STRING "09") +set(POPPLER_MINOR_VERSION_STRING "10") # We want the string version to have 08 but the integer version can't have a leading 0 since otherwise it's considered octal # So strip a leading 0 if found in POPPLER_MINOR_VERSION_STRING and store the result in POPPLER_MINOR_VERSION string(REGEX REPLACE "^0?(.+)$" "\\1" POPPLER_MINOR_VERSION "${POPPLER_MINOR_VERSION_STRING}") @@ -542,7 +542,7 @@ add_custom_command(OUTPUT poppler/${input}.c COMMAND ${GPERF} poppler/${input}.gperf > ${CMAKE_CURRENT_BINARY_DIR}/poppler/${input}.c COMMAND ${GPERF} poppler/${input}.gperf > ${CMAKE_CURRENT_SOURCE_DIR}/poppler/${input}.pregenerated.c - COMMAND ${SED} -i "s#${GPERF}#gperf#" ${CMAKE_CURRENT_SOURCE_DIR}/poppler/${input}.pregenerated.c + COMMAND ${SED} -i -e "s#${GPERF}#gperf#" ${CMAKE_CURRENT_SOURCE_DIR}/poppler/${input}.pregenerated.c COMMAND clang-format -i ${CMAKE_CURRENT_SOURCE_DIR}/poppler/${input}.pregenerated.c || true DEPENDS poppler/${input}.gperf WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) @@ -579,7 +579,7 @@ endif() add_library(poppler ${poppler_SRCS}) generate_export_header(poppler BASE_NAME poppler-private EXPORT_FILE_NAME "${CMAKE_CURRENT_BINARY_DIR}/poppler_private_export.h") -set_target_properties(poppler PROPERTIES VERSION 124.0.0 SOVERSION 124) +set_target_properties(poppler PROPERTIES VERSION 125.0.0 SOVERSION 125) if(MINGW AND BUILD_SHARED_LIBS) get_target_property(POPPLER_SOVERSION poppler SOVERSION) set_target_properties(poppler PROPERTIES SUFFIX "-${POPPLER_SOVERSION}${CMAKE_SHARED_LIBRARY_SUFFIX}") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.09.0/ChangeLog new/poppler-22.10.0/ChangeLog --- old/poppler-22.09.0/ChangeLog 2022-09-01 00:33:24.000000000 +0200 +++ new/poppler-22.10.0/ChangeLog 2022-10-03 18:17:24.000000000 +0200 @@ -1,3 +1,167 @@ +commit 2b65dde7b0e402127b664aa1802ab990d59995b5 +Author: Albert Astals Cid <aa...@kde.org> +Date: Mon Oct 3 18:11:20 2022 +0200 + + poppler 22.10.0 + + CMakeLists.txt | 4 ++-- + NEWS | 18 ++++++++++++++++++ + cpp/Doxyfile | 2 +- + qt5/src/Doxyfile | 2 +- + qt6/src/Doxyfile | 2 +- + 5 files changed, 23 insertions(+), 5 deletions(-) + +commit 0ee0a90061abdd8858b1b6141f0e705088df29e9 +Author: Albert Astals Cid <aa...@kde.org> +Date: Tue Sep 27 01:07:13 2022 +0200 + + SplashOutputDev::tilingPatternFill: Properly restore CTM on failure + + Fixes issue #1292 + + poppler/SplashOutputDev.cc | 3 +++ + 1 file changed, 3 insertions(+) + +commit 315ab3006fb24bf47b595343e6a3e90995f2a588 +Author: Albert Astals Cid <aa...@kde.org> +Date: Sat Sep 17 10:28:00 2022 +0200 + + CI: Update Fedora CI to 37, it's close enough to the release date + + .gitlab-ci.yml | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +commit 098b8622cc804c9fd41e2a56fbb2e116226b22b3 +Author: Albert Astals Cid <aa...@kde.org> +Date: Thu Sep 15 23:32:48 2022 +0200 + + Update (C) + + goo/GooString.cc | 2 +- + goo/GooString.h | 2 +- + poppler/PDFDoc.cc | 2 +- + poppler/PDFDoc.h | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +commit d6b7ef8794bad35366257e2644843f686326f4df +Author: Oliver Sander <oliver.san...@tu-dresden.de> +Date: Thu Sep 15 16:19:19 2022 +0200 + + Remove the psmode argument from GooString::sanitizedName + + It is always 'false'. + + goo/GooString.cc | 12 +----------- + goo/GooString.h | 3 +-- + poppler/PDFDoc.cc | 4 ++-- + 3 files changed, 4 insertions(+), 15 deletions(-) + +commit 48974ec48f6e42084d0ff98f546e7211949f5d39 +Author: Oliver Sander <oliver.san...@tu-dresden.de> +Date: Thu Sep 15 16:02:07 2022 +0200 + + Fix typos in method names + + 'dictionary' has only one 'n'. + + poppler/PDFDoc.cc | 24 ++++++++++++------------ + poppler/PDFDoc.h | 4 ++-- + 2 files changed, 14 insertions(+), 14 deletions(-) + +commit be94b9c1d46db29592817d4afda63d9733b70b36 +Author: Albert Astals Cid <aa...@kde.org> +Date: Tue Sep 13 22:32:10 2022 +0200 + + pdftotext: Simplify memory handling + + utils/pdftotext.cc | 112 + ++++++++++++++++++++--------------------------------- + 1 file changed, 43 insertions(+), 69 deletions(-) + +commit 7441d79e31de909954675a76d33ccb25147cf0ff +Author: Claes N??st??n <pek...@gmail.com> +Date: Tue Jan 18 21:26:29 2022 +0100 + + Replace parts of font parsing code with std::string alternative + + strndup is not available on all platforms, instead of adding a compat + variant use std::string functionality for parsing instead. + + poppler/GlobalParams.cc | 80 + ++++++++++++++++++++++--------------------------- + 1 file changed, 36 insertions(+), 44 deletions(-) + +commit 2cd23e7e6de1e854e22c7fd666a9167a58662211 +Author: Albert Astals Cid <aa...@kde.org> +Date: Wed Sep 7 01:03:57 2022 +0200 + + Update (C) + + utils/pdftocairo.cc | 1 + + utils/pdftoppm.cc | 1 + + 2 files changed, 2 insertions(+) + +commit 756ab7a061f505722a92efdeb61765311d00e313 +Author: Albert Astals Cid <aa...@kde.org> +Date: Thu Jul 21 19:41:22 2022 +0200 + + JBIG2Stream::readPatternDictSeg: Protect against some overflow + + poppler/JBIG2Stream.cc | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +commit 119af9e894a928d9bad7d4f9e1681e54c9923439 +Author: James Cloos <cl...@jhcloos.com> +Date: Tue Aug 9 23:37:07 2022 +0200 + + Avoid round-off errors when determining raster dimensions. + + The code in pdftoppm.cc and pdftocairo.cc carefully avoided overflow + when converting page sizes from points to pixels. + + This worked well when the math was performed at extended precision, + as is done when using x387 opcodes, but could lead to results too + large by a ulp when computed without extra precision. + + The code then needs to call ceil(3) to round fractional results up + to the next larger integer, resulting in an off-by-one error if the + computed size is even one ulp more than an integer. + + The initial size is already a multiple of 72, so rearranging the math + to multiply before dividing by 72 avoids that imprecision. + + Issue #253 + + utils/pdftocairo.cc | 2 +- + utils/pdftoppm.cc | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +commit d06eb33d1668ca3a08055bd033d8f5ea725e5be7 +Author: Albert Astals Cid <aa...@kde.org> +Date: Fri Aug 12 23:29:01 2022 +0200 + + qt: Also take into account flagNoView when getting/setting the + visible status + + KDE bug #456313 + + qt5/src/poppler-form.cc | 10 +++++++++- + qt6/src/poppler-form.cc | 10 +++++++++- + 2 files changed, 18 insertions(+), 2 deletions(-) + +commit 9e0d0e65261384bde8cb7f1932738bbeb19d3292 +Author: Carlo Cabrera <30379873+carlo...@users.noreply.github.com> +Date: Thu Sep 1 13:18:39 2022 +0800 + + Fix `sed` invocation. + + The current `sed` call works only for GNU sed. We can fix that + by using + the `-e` flag. + + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + commit 4602cac96104b74037862e223bb774be26bfd67c Author: Albert Astals Cid <aa...@kde.org> Date: Thu Sep 1 00:30:57 2022 +0200 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.09.0/NEWS new/poppler-22.10.0/NEWS --- old/poppler-22.09.0/NEWS 2022-09-01 00:30:57.000000000 +0200 +++ new/poppler-22.10.0/NEWS 2022-10-03 18:11:20.000000000 +0200 @@ -1,3 +1,21 @@ +Release 22.10.0: + core: + * SplashOutputDev::tilingPatternFill: Properly restore CTM on failure. Issue #1292 + * Protect against malformed files + * Refactor code to not use strndup + * Other small code refactoring + + utils: + * pdftoppm: Avoid round-off errors when determining raster dimensions + * pdftocairo: Avoid round-off errors when determining raster dimensions + * pdftotext: Simplify memory handling + + qt: + * Take into account flagNoView when getting/setting the visible status. KDE bug #456313 + + build system: + * Fix sed invocation + Release 22.09.0: core: * Splash: Do not truncate line dash patterns with more than 20 entries. Issue #1281 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.09.0/cpp/Doxyfile new/poppler-22.10.0/cpp/Doxyfile --- old/poppler-22.09.0/cpp/Doxyfile 2022-09-01 00:30:57.000000000 +0200 +++ new/poppler-22.10.0/cpp/Doxyfile 2022-10-03 18:11:20.000000000 +0200 @@ -31,7 +31,7 @@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 22.09.0 +PROJECT_NUMBER = 22.10.0 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.09.0/glib/reference/html/index.html new/poppler-22.10.0/glib/reference/html/index.html --- old/poppler-22.09.0/glib/reference/html/index.html 2022-09-01 00:32:24.000000000 +0200 +++ new/poppler-22.10.0/glib/reference/html/index.html 2022-10-03 18:16:40.000000000 +0200 @@ -15,7 +15,7 @@ <div> <div><table class="navigation" id="top" width="100%" cellpadding="2" cellspacing="0"><tr><th valign="middle"><p class="title">Poppler Reference Manual</p></th></tr></table></div> <div><p class="releaseinfo"> - for Poppler 22.09.0 + for Poppler 22.10.0 </p></div> </div> <hr> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.09.0/glib/reference/html/poppler-Poppler-Features.html new/poppler-22.10.0/glib/reference/html/poppler-Poppler-Features.html --- old/poppler-22.09.0/glib/reference/html/poppler-Poppler-Features.html 2022-09-01 00:32:24.000000000 +0200 +++ new/poppler-22.10.0/glib/reference/html/poppler-Poppler-Features.html 2022-10-03 18:16:40.000000000 +0200 @@ -205,7 +205,7 @@ <hr> <div class="refsect2"> <a name="POPPLER-MINOR-VERSION:CAPS"></a><h3>POPPLER_MINOR_VERSION</h3> -<pre class="programlisting">#define POPPLER_MINOR_VERSION (9) +<pre class="programlisting">#define POPPLER_MINOR_VERSION (10) </pre> <p>The major version number of the poppler header files (e.g. in poppler version 0.1.2 this is 1.)</p> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.09.0/goo/GooString.cc new/poppler-22.10.0/goo/GooString.cc --- old/poppler-22.09.0/goo/GooString.cc 2022-09-01 00:30:57.000000000 +0200 +++ new/poppler-22.10.0/goo/GooString.cc 2022-10-03 18:11:20.000000000 +0200 @@ -29,7 +29,7 @@ // Copyright (C) 2018 Klar??lvdalens Datakonsult AB, a KDAB Group company, <i...@kdab.com>. Work sponsored by the LiMux project of the city of Munich // Copyright (C) 2018 Adam Reichold <adam.reich...@t-online.de> // Copyright (C) 2018 Greg Knight <lyn...@gmail.com> -// Copyright (C) 2019 Oliver Sander <oliver.san...@tu-dresden.de> +// Copyright (C) 2019, 2022 Oliver Sander <oliver.san...@tu-dresden.de> // // 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 @@ -625,20 +625,10 @@ return endsWith(toStr(), suffix); } -GooString *GooString::sanitizedName(bool psmode) const +GooString *GooString::sanitizedName() const { auto *name = new GooString(); - if (psmode) { - // ghostscript chokes on names that begin with out-of-limits - // numbers, e.g., 1e4foo is handled correctly (as a name), but - // 1e999foo generates a limitcheck error - const auto c = getChar(0); - if (c >= '0' && c <= '9') { - name->append('f'); - } - } - for (const auto c : *this) { if (c <= (char)0x20 || c >= (char)0x7f || c == ' ' || c == '(' || c == ')' || c == '<' || c == '>' || c == '[' || c == ']' || c == '{' || c == '}' || c == '/' || c == '%' || c == '#') { char buf[8]; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.09.0/goo/GooString.h new/poppler-22.10.0/goo/GooString.h --- old/poppler-22.09.0/goo/GooString.h 2022-09-01 00:30:57.000000000 +0200 +++ new/poppler-22.10.0/goo/GooString.h 2022-10-03 18:11:20.000000000 +0200 @@ -26,7 +26,7 @@ // Copyright (C) 2018 Klar??lvdalens Datakonsult AB, a KDAB Group company, <i...@kdab.com>. Work sponsored by the LiMux project of the city of Munich // Copyright (C) 2019 Christophe Fergeau <cferg...@redhat.com> // Copyright (C) 2019 Tomoyuki Kubota <himajin100...@gmail.com> -// Copyright (C) 2019, 2020 Oliver Sander <oliver.san...@tu-dresden.de> +// Copyright (C) 2019, 2020, 2022 Oliver Sander <oliver.san...@tu-dresden.de> // Copyright (C) 2019 Hans-Ulrich J??ttner <h...@froreich-bioscientia.de> // Copyright (C) 2020 Thorsten Behrens <thorsten.behr...@cib.de> // Copyright (C) 2022 Even Rouault <even.roua...@spatialys.com> @@ -259,9 +259,8 @@ // Sanitizes the string so that it does // not contain any ( ) < > [ ] { } / % - // The postscript mode also has some more strict checks // The caller owns the return value - POPPLER_PRIVATE_EXPORT GooString *sanitizedName(bool psmode) const; + POPPLER_PRIVATE_EXPORT GooString *sanitizedName() const; }; #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.09.0/poppler/GlobalParams.cc new/poppler-22.10.0/poppler/GlobalParams.cc --- old/poppler-22.09.0/poppler/GlobalParams.cc 2022-09-01 00:30:57.000000000 +0200 +++ new/poppler-22.10.0/poppler/GlobalParams.cc 2022-10-03 18:11:20.000000000 +0200 @@ -45,6 +45,7 @@ // Copyright (C) 2021, 2022 Stefan L??ffler <st.loeff...@gmail.com> // Copyright (C) 2021 sunderme <sunde...@gmx.de> // Copyright (C) 2022 Even Rouault <even.roua...@spatialys.com> +// Copyright (C) 2022 Claes N??st??n <pek...@gmail.com> // // 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 @@ -53,6 +54,7 @@ #include <config.h> +#include <algorithm> #include <cstring> #include <cstdio> #include <cctype> @@ -664,22 +666,20 @@ } #ifdef WITH_FONTCONFIGURATION_FONTCONFIG -static bool findModifier(const char *name, const char *modifier, const char **start) +static bool findModifier(const std::string &name, const size_t modStart, const char *modifier, size_t &start) { - const char *match; - - if (name == nullptr) { + if (modStart == std::string::npos) { return false; } - match = strstr(name, modifier); - if (match) { - if (*start == nullptr || match < *start) { - *start = match; + size_t match = name.find(modifier, modStart); + if (match == std::string::npos) { + return false; + } else { + if (start == std::string::npos || match < start) { + start = match; } return true; - } else { - return false; } } @@ -721,57 +721,55 @@ static FcPattern *buildFcPattern(const GfxFont *font, const GooString *base14Name) { int weight = -1, slant = -1, width = -1, spacing = -1; - const char *family; - const char *start; FcPattern *p; // this is all heuristics will be overwritten if font had proper info - char *fontName = strdup(((base14Name == nullptr) ? font->getNameWithoutSubsetTag() : base14Name->toStr()).c_str()); + std::string fontName; + if (base14Name == nullptr) { + fontName = font->getNameWithoutSubsetTag(); + } else { + fontName = base14Name->toStr(); + } - const char *modifiers = strchr(fontName, ','); - if (modifiers == nullptr) { - modifiers = strchr(fontName, '-'); + size_t modStart = fontName.find(','); + if (modStart == std::string::npos) { + modStart = fontName.find('-'); } // remove the - from the names, for some reason, Fontconfig does not // understand "MS-Mincho" but does with "MS Mincho" - const int len = strlen(fontName); - for (int i = 0; i < len; i++) { - fontName[i] = (fontName[i] == '-' ? ' ' : fontName[i]); - } + std::replace(fontName.begin(), fontName.end(), '-', ' '); - start = nullptr; - findModifier(modifiers, "Regular", &start); - findModifier(modifiers, "Roman", &start); + size_t start = std::string::npos; + findModifier(fontName, modStart, "Regular", start); + findModifier(fontName, modStart, "Roman", start); - if (findModifier(modifiers, "Oblique", &start)) { + if (findModifier(fontName, modStart, "Oblique", start)) { slant = FC_SLANT_OBLIQUE; } - if (findModifier(modifiers, "Italic", &start)) { + if (findModifier(fontName, modStart, "Italic", start)) { slant = FC_SLANT_ITALIC; } - if (findModifier(modifiers, "Bold", &start)) { + if (findModifier(fontName, modStart, "Bold", start)) { weight = FC_WEIGHT_BOLD; } - if (findModifier(modifiers, "Light", &start)) { + if (findModifier(fontName, modStart, "Light", start)) { weight = FC_WEIGHT_LIGHT; } - if (findModifier(modifiers, "Medium", &start)) { + if (findModifier(fontName, modStart, "Medium", start)) { weight = FC_WEIGHT_MEDIUM; } - if (findModifier(modifiers, "Condensed", &start)) { + if (findModifier(fontName, modStart, "Condensed", start)) { width = FC_WIDTH_CONDENSED; } - if (start) { + std::string family; + if (start == std::string::npos) { + family = fontName; + } else { // There have been "modifiers" in the name, crop them to obtain // the family name - family = strndup(fontName, modifiers - fontName); - free(fontName); - fontName = nullptr; - } else { - family = fontName; - fontName = nullptr; + family = fontName.substr(0, modStart); } // use font flags @@ -785,12 +783,9 @@ slant = FC_SLANT_ITALIC; } - bool freeFamily = true; // if the FontDescriptor specified a family name use it if (font->getFamily()) { - free((char *)family); - family = font->getFamily()->c_str(); - freeFamily = false; + family = font->getFamily()->toStr(); } // if the FontDescriptor specified a weight use it @@ -861,7 +856,7 @@ const char *lang = getFontLang(font); - p = FcPatternBuild(nullptr, FC_FAMILY, FcTypeString, family, FC_LANG, FcTypeString, lang, NULL); + p = FcPatternBuild(nullptr, FC_FAMILY, FcTypeString, family.c_str(), FC_LANG, FcTypeString, lang, NULL); if (slant != -1) { FcPatternAddInteger(p, FC_SLANT, slant); } @@ -875,9 +870,6 @@ FcPatternAddInteger(p, FC_SPACING, spacing); } - if (freeFamily) { - free((char *)family); - } return p; } #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.09.0/poppler/JBIG2Stream.cc new/poppler-22.10.0/poppler/JBIG2Stream.cc --- old/poppler-22.09.0/poppler/JBIG2Stream.cc 2022-09-01 00:30:57.000000000 +0200 +++ new/poppler-22.10.0/poppler/JBIG2Stream.cc 2022-10-03 18:11:20.000000000 +0200 @@ -2506,7 +2506,19 @@ aty[2] = -2; atx[3] = -2; aty[3] = -2; - bitmap = readGenericBitmap(mmr, (grayMax + 1) * patternW, patternH, templ, false, false, nullptr, atx, aty, length - 7); + + unsigned int grayMaxPlusOne; + if (unlikely(checkedAdd(grayMax, 1u, &grayMaxPlusOne))) { + return; + } + unsigned int bitmapW; + if (unlikely(checkedMultiply(grayMaxPlusOne, patternW, &bitmapW))) { + return; + } + if (bitmapW >= INT_MAX) { + return; + } + bitmap = readGenericBitmap(mmr, static_cast<int>(bitmapW), patternH, templ, false, false, nullptr, atx, aty, length - 7); if (!bitmap) { return; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.09.0/poppler/PDFDoc.cc new/poppler-22.10.0/poppler/PDFDoc.cc --- old/poppler-22.09.0/poppler/PDFDoc.cc 2022-09-01 00:30:57.000000000 +0200 +++ new/poppler-22.10.0/poppler/PDFDoc.cc 2022-10-03 18:11:20.000000000 +0200 @@ -46,7 +46,7 @@ // Copyright (C) 2020 Nelson Ben??tez Le??n <nbenit...@gmail.com> // Copyright (C) 2020 Thorsten Behrens <thorsten.behr...@cib.de> // Copyright (C) 2020 Adam Sampson <a...@offog.org> -// Copyright (C) 2021 Oliver Sander <oliver.san...@tu-dresden.de> +// Copyright (C) 2021, 2022 Oliver Sander <oliver.san...@tu-dresden.de> // Copyright (C) 2021 Mahmoud Khalil <mahmoudkhali...@gmail.com> // Copyright (C) 2021 RM <rm+...@arcsin.org> // Copyright (C) 2021 Georgiy Sgibnev <geor...@sgibnev.com>. Work sponsored by lab50.net. @@ -1200,7 +1200,7 @@ delete uxref; } -void PDFDoc::writeDictionnary(Dict *dict, OutStream *outStr, XRef *xRef, unsigned int numOffset, unsigned char *fileKey, CryptAlgorithm encAlgorithm, int keyLength, Ref ref, std::set<Dict *> *alreadyWrittenDicts) +void PDFDoc::writeDictionary(Dict *dict, OutStream *outStr, XRef *xRef, unsigned int numOffset, unsigned char *fileKey, CryptAlgorithm encAlgorithm, int keyLength, Ref ref, std::set<Dict *> *alreadyWrittenDicts) { bool deleteSet = false; if (!alreadyWrittenDicts) { @@ -1209,7 +1209,7 @@ } if (alreadyWrittenDicts->find(dict) != alreadyWrittenDicts->end()) { - error(errSyntaxWarning, -1, "PDFDoc::writeDictionnary: Found recursive dicts"); + error(errSyntaxWarning, -1, "PDFDoc::writeDictionary: Found recursive dicts"); if (deleteSet) { delete alreadyWrittenDicts; } @@ -1221,7 +1221,7 @@ outStr->printf("<<"); for (int i = 0; i < dict->getLength(); i++) { GooString keyName(dict->getKey(i)); - GooString *keyNameToPrint = keyName.sanitizedName(false /* non ps mode */); + GooString *keyNameToPrint = keyName.sanitizedName(); outStr->printf("/%s ", keyNameToPrint->c_str()); delete keyNameToPrint; Object obj1 = dict->getValNF(i).copy(); @@ -1371,7 +1371,7 @@ } case objName: { GooString name(obj->getName()); - GooString *nameToPrint = name.sanitizedName(false /* non ps mode */); + GooString *nameToPrint = name.sanitizedName(); outStr->printf("/%s ", nameToPrint->c_str()); delete nameToPrint; break; @@ -1389,7 +1389,7 @@ outStr->printf("] "); break; case objDict: - writeDictionnary(obj->getDict(), outStr, xRef, numOffset, fileKey, encAlgorithm, keyLength, ref, alreadyWrittenDicts); + writeDictionary(obj->getDict(), outStr, xRef, numOffset, fileKey, encAlgorithm, keyLength, ref, alreadyWrittenDicts); break; case objStream: { // We can't modify stream with the current implementation (no write functions in Stream API) @@ -1449,13 +1449,13 @@ } stream->getDict()->remove("DecodeParms"); - writeDictionnary(stream->getDict(), outStr, xRef, numOffset, fileKey, encAlgorithm, keyLength, ref, alreadyWrittenDicts); + writeDictionary(stream->getDict(), outStr, xRef, numOffset, fileKey, encAlgorithm, keyLength, ref, alreadyWrittenDicts); writeStream(stream, outStr); delete encStream; } else if (fileKey != nullptr && stream->getKind() == strFile && static_cast<FileStream *>(stream)->getNeedsEncryptionOnSave()) { EncryptStream *encStream = new EncryptStream(stream, fileKey, encAlgorithm, keyLength, ref); encStream->setAutoDelete(false); - writeDictionnary(encStream->getDict(), outStr, xRef, numOffset, fileKey, encAlgorithm, keyLength, ref, alreadyWrittenDicts); + writeDictionary(encStream->getDict(), outStr, xRef, numOffset, fileKey, encAlgorithm, keyLength, ref, alreadyWrittenDicts); writeStream(encStream, outStr); delete encStream; } else { @@ -1471,7 +1471,7 @@ } } } - writeDictionnary(stream->getDict(), outStr, xRef, numOffset, fileKey, encAlgorithm, keyLength, ref, alreadyWrittenDicts); + writeDictionary(stream->getDict(), outStr, xRef, numOffset, fileKey, encAlgorithm, keyLength, ref, alreadyWrittenDicts); writeRawStream(stream, outStr); } break; @@ -1511,7 +1511,7 @@ // - current time // - file name // - file size - // - values of entry in information dictionnary + // - values of entry in information dictionary GooString message; char buffer[256]; sprintf(buffer, "%i", (int)time(nullptr)); @@ -1594,7 +1594,7 @@ { uxref->writeTableToFile(outStr, writeAllEntries); outStr->printf("trailer\r\n"); - writeDictionnary(trailerDict.getDict(), outStr, xRef, 0, nullptr, cryptRC4, 0, { 0, 0 }, nullptr); + writeDictionary(trailerDict.getDict(), outStr, xRef, 0, nullptr, cryptRC4, 0, { 0, 0 }, nullptr); outStr->printf("\r\nstartxref\r\n"); outStr->printf("%lli\r\n", uxrefOffset); outStr->printf("%%%%EOF\r\n"); @@ -1643,7 +1643,7 @@ outStr->printf("%%%c%c%c%c\n", 0xE2, 0xE3, 0xCF, 0xD3); } -bool PDFDoc::markDictionnary(Dict *dict, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldRefNum, int newRefNum, std::set<Dict *> *alreadyMarkedDicts) +bool PDFDoc::markDictionary(Dict *dict, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldRefNum, int newRefNum, std::set<Dict *> *alreadyMarkedDicts) { bool deleteSet = false; if (!alreadyMarkedDicts) { @@ -1652,7 +1652,7 @@ } if (alreadyMarkedDicts->find(dict) != alreadyMarkedDicts->end()) { - error(errSyntaxWarning, -1, "PDFDoc::markDictionnary: Found recursive dicts"); + error(errSyntaxWarning, -1, "PDFDoc::markDictionary: Found recursive dicts"); if (deleteSet) { delete alreadyMarkedDicts; } @@ -1700,14 +1700,14 @@ } break; case objDict: { - const bool success = markDictionnary(obj->getDict(), xRef, countRef, numOffset, oldRefNum, newRefNum, alreadyMarkedDicts); + const bool success = markDictionary(obj->getDict(), xRef, countRef, numOffset, oldRefNum, newRefNum, alreadyMarkedDicts); if (unlikely(!success)) { return false; } } break; case objStream: { Stream *stream = obj->getStream(); - const bool success = markDictionnary(stream->getDict(), xRef, countRef, numOffset, oldRefNum, newRefNum, alreadyMarkedDicts); + const bool success = markDictionary(stream->getDict(), xRef, countRef, numOffset, oldRefNum, newRefNum, alreadyMarkedDicts); if (unlikely(!success)) { return false; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.09.0/poppler/PDFDoc.h new/poppler-22.10.0/poppler/PDFDoc.h --- old/poppler-22.09.0/poppler/PDFDoc.h 2022-09-01 00:30:57.000000000 +0200 +++ new/poppler-22.10.0/poppler/PDFDoc.h 2022-10-03 18:11:20.000000000 +0200 @@ -32,7 +32,7 @@ // Copyright (C) 2016 Jakub Alba <jakuba...@gmail.com> // Copyright (C) 2018 Klar??lvdalens Datakonsult AB, a KDAB Group company, <i...@kdab.com>. Work sponsored by the LiMux project of the city of Munich // Copyright (C) 2018 Evangelos Rigas <eri...@rnd2.org> -// Copyright (C) 2020, 2021 Oliver Sander <oliver.san...@tu-dresden.de> +// Copyright (C) 2020-2022 Oliver Sander <oliver.san...@tu-dresden.de> // Copyright (C) 2020 Nelson Ben??tez Le??n <nbenit...@gmail.com> // Copyright (C) 2021 Mahmoud Khalil <mahmoudkhali...@gmail.com> // Copyright (C) 2021 Georgiy Sgibnev <geor...@sgibnev.com>. Work sponsored by lab50.net. @@ -497,9 +497,9 @@ private: // insert referenced objects in XRef - bool markDictionnary(Dict *dict, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldRefNum, int newRefNum, std::set<Dict *> *alreadyMarkedDicts); + bool markDictionary(Dict *dict, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldRefNum, int newRefNum, std::set<Dict *> *alreadyMarkedDicts); bool markObject(Object *obj, XRef *xRef, XRef *countRef, unsigned int numOffset, int oldRefNum, int newRefNum, std::set<Dict *> *alreadyMarkedDicts = nullptr); - static void writeDictionnary(Dict *dict, OutStream *outStr, XRef *xRef, unsigned int numOffset, unsigned char *fileKey, CryptAlgorithm encAlgorithm, int keyLength, Ref ref, std::set<Dict *> *alreadyWrittenDicts); + static void writeDictionary(Dict *dict, OutStream *outStr, XRef *xRef, unsigned int numOffset, unsigned char *fileKey, CryptAlgorithm encAlgorithm, int keyLength, Ref ref, std::set<Dict *> *alreadyWrittenDicts); // Write object header to current file stream and return its offset static Goffset writeObjectHeader(Ref *ref, OutStream *outStr); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.09.0/poppler/SplashOutputDev.cc new/poppler-22.10.0/poppler/SplashOutputDev.cc --- old/poppler-22.09.0/poppler/SplashOutputDev.cc 2022-09-01 00:30:57.000000000 +0200 +++ new/poppler-22.10.0/poppler/SplashOutputDev.cc 2022-10-03 18:11:20.000000000 +0200 @@ -4457,6 +4457,9 @@ retValue = splash->drawImage(&tilingBitmapSrc, nullptr, &imgData, colorMode, true, result_width, result_height, matc, false, true) == splashOk; } delete tBitmap; + if (!retValue) { + state->setCTM(savedCTM[0], savedCTM[1], savedCTM[2], savedCTM[3], savedCTM[4], savedCTM[5]); + } return retValue; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.09.0/qt5/src/Doxyfile new/poppler-22.10.0/qt5/src/Doxyfile --- old/poppler-22.09.0/qt5/src/Doxyfile 2022-09-01 00:30:57.000000000 +0200 +++ new/poppler-22.10.0/qt5/src/Doxyfile 2022-10-03 18:11:20.000000000 +0200 @@ -31,7 +31,7 @@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 22.09.0 +PROJECT_NUMBER = 22.10.0 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.09.0/qt5/src/poppler-form.cc new/poppler-22.10.0/qt5/src/poppler-form.cc --- old/poppler-22.09.0/qt5/src/poppler-form.cc 2022-09-01 00:30:57.000000000 +0200 +++ new/poppler-22.10.0/qt5/src/poppler-form.cc 2022-10-03 18:11:20.000000000 +0200 @@ -194,7 +194,14 @@ bool FormField::isVisible() const { - return !(m_formData->fm->getWidgetAnnotation()->getFlags() & Annot::flagHidden); + const unsigned int flags = m_formData->fm->getWidgetAnnotation()->getFlags(); + if (flags & Annot::flagHidden) { + return false; + } + if (flags & Annot::flagNoView) { + return false; + } + return true; } void FormField::setVisible(bool value) @@ -202,6 +209,7 @@ unsigned int flags = m_formData->fm->getWidgetAnnotation()->getFlags(); if (value) { flags &= ~Annot::flagHidden; + flags &= ~Annot::flagNoView; } else { flags |= Annot::flagHidden; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.09.0/qt6/src/Doxyfile new/poppler-22.10.0/qt6/src/Doxyfile --- old/poppler-22.09.0/qt6/src/Doxyfile 2022-09-01 00:30:57.000000000 +0200 +++ new/poppler-22.10.0/qt6/src/Doxyfile 2022-10-03 18:11:20.000000000 +0200 @@ -31,7 +31,7 @@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 22.09.0 +PROJECT_NUMBER = 22.10.0 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.09.0/qt6/src/poppler-form.cc new/poppler-22.10.0/qt6/src/poppler-form.cc --- old/poppler-22.09.0/qt6/src/poppler-form.cc 2022-09-01 00:30:57.000000000 +0200 +++ new/poppler-22.10.0/qt6/src/poppler-form.cc 2022-10-03 18:11:20.000000000 +0200 @@ -194,7 +194,14 @@ bool FormField::isVisible() const { - return !(m_formData->fm->getWidgetAnnotation()->getFlags() & Annot::flagHidden); + const unsigned int flags = m_formData->fm->getWidgetAnnotation()->getFlags(); + if (flags & Annot::flagHidden) { + return false; + } + if (flags & Annot::flagNoView) { + return false; + } + return true; } void FormField::setVisible(bool value) @@ -202,6 +209,7 @@ unsigned int flags = m_formData->fm->getWidgetAnnotation()->getFlags(); if (value) { flags &= ~Annot::flagHidden; + flags &= ~Annot::flagNoView; } else { flags |= Annot::flagHidden; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.09.0/utils/pdftocairo.cc new/poppler-22.10.0/utils/pdftocairo.cc --- old/poppler-22.09.0/utils/pdftocairo.cc 2022-09-01 00:30:57.000000000 +0200 +++ new/poppler-22.10.0/utils/pdftocairo.cc 2022-10-03 18:11:20.000000000 +0200 @@ -39,6 +39,7 @@ // Copyright (C) 2020 Salvo Miosi <salvo.ilmi...@gmail.com> // Copyright (C) 2021 Peter Williams <pe...@newton.cx> // Copyright (C) 2021 Christian Persch <c...@src.gnome.org> +// Copyright (C) 2022 James Cloos <cl...@jhcloos.com> // // 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 @@ -527,7 +528,7 @@ } } } else { - getCropSize(page_w * (x_resolution / 72.0), page_h * (y_resolution / 72.0), width, height); + getCropSize(page_w * x_resolution / 72.0, page_h * y_resolution / 72.0, width, height); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.09.0/utils/pdftoppm.cc new/poppler-22.10.0/utils/pdftoppm.cc --- old/poppler-22.09.0/utils/pdftoppm.cc 2022-09-01 00:30:57.000000000 +0200 +++ new/poppler-22.10.0/utils/pdftoppm.cc 2022-10-03 18:11:20.000000000 +0200 @@ -37,6 +37,7 @@ // Copyright (C) 2020 Philipp Knechtges <philipp-...@knechtges.com> // Copyright (C) 2021 Diogo Kollross <diog...@gmail.com> // Copyright (C) 2021 Peter Williams <pe...@newton.cx> +// Copyright (C) 2022 James Cloos <cl...@jhcloos.com> // // 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 @@ -666,10 +667,10 @@ // No specific image size requested---compute the size from the resolution if (x_scaleTo <= 0) { - pg_w = pg_w * (x_resolution / 72.0); + pg_w = pg_w * x_resolution / 72.0; } if (y_scaleTo <= 0) { - pg_h = pg_h * (y_resolution / 72.0); + pg_h = pg_h * y_resolution / 72.0; } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-22.09.0/utils/pdftotext.cc new/poppler-22.10.0/utils/pdftotext.cc --- old/poppler-22.09.0/utils/pdftotext.cc 2022-09-01 00:30:57.000000000 +0200 +++ new/poppler-22.10.0/utils/pdftotext.cc 2022-10-03 18:11:20.000000000 +0200 @@ -165,19 +165,15 @@ int main(int argc, char *argv[]) { std::unique_ptr<PDFDoc> doc; - GooString *fileName; - GooString *textFileName; + std::unique_ptr<GooString> textFileName; std::optional<GooString> ownerPW, userPW; - TextOutputDev *textOut; FILE *f; const UnicodeMap *uMap; Object info; bool ok; - int exitCode; EndOfLineKind textEOL = TextOutputDev::defaultEndOfLine(); Win32Console win32Console(&argc, &argv); - exitCode = 99; // parse args ok = parseArgs(argDesc, &argc, argv); @@ -189,7 +185,7 @@ } if (colspacing <= 0 || colspacing > 10) { error(errCommandLine, -1, "Bogus value provided for -colspacing"); - goto err1; + return 99; } if (!ok || (argc < 2 && !printEnc) || argc > 3 || printVersion || printHelp) { fprintf(stderr, "pdftotext version %s\n", PACKAGE_VERSION); @@ -199,9 +195,9 @@ printUsage("pdftotext", "<PDF-file> [<text-file>]", argDesc); } if (printVersion || printHelp) { - exitCode = 0; + return 0; } - goto err0; + return 99; } // read config file @@ -209,11 +205,10 @@ if (printEnc) { printEncodings(); - exitCode = 0; - goto err0; + return 0; } - fileName = new GooString(argv[1]); + GooString fileName(argv[1]); if (fixedPitch) { physLayout = true; } @@ -239,8 +234,7 @@ // get mapping to output encoding if (!(uMap = globalParams->getTextEncoding())) { error(errCommandLine, -1, "Couldn't get text encoding"); - delete fileName; - goto err1; + return 99; } // open PDF file @@ -251,39 +245,36 @@ userPW = GooString(userPassword); } - if (fileName->cmp("-") == 0) { - delete fileName; - fileName = new GooString("fd://0"); + if (fileName.cmp("-") == 0) { + fileName = GooString("fd://0"); } - doc = PDFDocFactory().createPDFDoc(*fileName, ownerPW, userPW); + doc = PDFDocFactory().createPDFDoc(fileName, ownerPW, userPW); if (!doc->isOk()) { - exitCode = 1; - goto err2; + return 1; } #ifdef ENFORCE_PERMISSIONS // check for copy permission if (!doc->okToCopy()) { error(errNotAllowed, -1, "Copying of text from this document is not allowed."); - exitCode = 3; - goto err2; + return 3; } #endif // construct text file name if (argc == 3) { - textFileName = new GooString(argv[2]); - } else if (fileName->cmp("fd://0") == 0) { + textFileName = std::make_unique<GooString>(argv[2]); + } else if (fileName.cmp("fd://0") == 0) { error(errCommandLine, -1, "You have to provide an output filename when reading from stdin."); - goto err2; + return 99; } else { - const char *p = fileName->c_str() + fileName->getLength() - 4; + const char *p = fileName.c_str() + fileName.getLength() - 4; if (!strcmp(p, ".pdf") || !strcmp(p, ".PDF")) { - textFileName = new GooString(fileName->c_str(), fileName->getLength() - 4); + textFileName = std::make_unique<GooString>(fileName.c_str(), fileName.getLength() - 4); } else { - textFileName = fileName->copy(); + textFileName.reset(fileName.copy()); } textFileName->append(htmlMeta ? ".html" : ".txt"); } @@ -297,7 +288,7 @@ } if (lastPage < firstPage) { error(errCommandLine, -1, "Wrong page range given: the first page ({0:d}) can not be after the last page ({1:d}).", firstPage, lastPage); - goto err3; + return 99; } // write HTML header @@ -306,9 +297,8 @@ f = stdout; } else { if (!(f = fopen(textFileName->c_str(), "wb"))) { - error(errIO, -1, "Couldn't open text file '{0:t}'", textFileName); - exitCode = 2; - goto err3; + error(errIO, -1, "Couldn't open text file '{0:t}'", textFileName.get()); + return 2; } } fputs("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">", f); @@ -342,18 +332,18 @@ // write text file if (htmlMeta && bbox) { // htmlMeta && is superfluous but makes gcc happier - textOut = new TextOutputDev(nullptr, physLayout, fixedPitch, rawOrder, htmlMeta, discardDiag); + TextOutputDev textOut(nullptr, physLayout, fixedPitch, rawOrder, htmlMeta, discardDiag); - if (textOut->isOk()) { - textOut->setTextEOL(textEOL); - textOut->setMinColSpacing1(colspacing); + if (textOut.isOk()) { + textOut.setTextEOL(textEOL); + textOut.setMinColSpacing1(colspacing); if (noPageBreaks) { - textOut->setTextPageBreaks(false); + textOut.setTextPageBreaks(false); } if (bboxLayout) { - printDocBBox(f, doc.get(), textOut, firstPage, lastPage); + printDocBBox(f, doc.get(), &textOut, firstPage, lastPage); } else { - printWordBBox(f, doc.get(), textOut, firstPage, lastPage); + printWordBBox(f, doc.get(), &textOut, firstPage, lastPage); } } if (f != stdout) { @@ -362,47 +352,42 @@ } else { if (tsvMode) { - textOut = new TextOutputDev(nullptr, physLayout, fixedPitch, rawOrder, htmlMeta, discardDiag); + TextOutputDev textOut(nullptr, physLayout, fixedPitch, rawOrder, htmlMeta, discardDiag); if (!textFileName->cmp("-")) { f = stdout; } else { if (!(f = fopen(textFileName->c_str(), "wb"))) { - error(errIO, -1, "Couldn't open text file '{0:t}'", textFileName); - delete textOut; - exitCode = 2; - goto err3; + error(errIO, -1, "Couldn't open text file '{0:t}'", textFileName.get()); + return 2; } } - printTSVBBox(f, doc.get(), textOut, firstPage, lastPage); + printTSVBBox(f, doc.get(), &textOut, firstPage, lastPage); if (f != stdout) { fclose(f); } } else { - textOut = new TextOutputDev(textFileName->c_str(), physLayout, fixedPitch, rawOrder, htmlMeta, discardDiag); - if (textOut->isOk()) { - textOut->setTextEOL(textEOL); - textOut->setMinColSpacing1(colspacing); + TextOutputDev textOut(textFileName->c_str(), physLayout, fixedPitch, rawOrder, htmlMeta, discardDiag); + if (textOut.isOk()) { + textOut.setTextEOL(textEOL); + textOut.setMinColSpacing1(colspacing); if (noPageBreaks) { - textOut->setTextPageBreaks(false); + textOut.setTextPageBreaks(false); } if ((w == 0) && (h == 0) && (x == 0) && (y == 0)) { - doc->displayPages(textOut, firstPage, lastPage, resolution, resolution, 0, true, false, false); + doc->displayPages(&textOut, firstPage, lastPage, resolution, resolution, 0, true, false, false); } else { for (int page = firstPage; page <= lastPage; ++page) { - doc->displayPageSlice(textOut, page, resolution, resolution, 0, true, false, false, x, y, w, h); + doc->displayPageSlice(&textOut, page, resolution, resolution, 0, true, false, false, x, y, w, h); } } } else { - delete textOut; - exitCode = 2; - goto err3; + return 2; } } } - delete textOut; // write end of HTML file if (htmlMeta) { @@ -410,9 +395,8 @@ f = stdout; } else { if (!(f = fopen(textFileName->c_str(), "ab"))) { - error(errIO, -1, "Couldn't open text file '{0:t}'", textFileName); - exitCode = 2; - goto err3; + error(errIO, -1, "Couldn't open text file '{0:t}'", textFileName.get()); + return 2; } } if (!bbox) { @@ -425,17 +409,7 @@ } } - exitCode = 0; - - // clean up -err3: - delete textFileName; -err2: - delete fileName; -err1: -err0: - - return exitCode; + return 0; } static void printInfoString(FILE *f, Dict *infoDict, const char *key, const char *text1, const char *text2, const UnicodeMap *uMap)