Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package poppler for openSUSE:Factory checked in at 2023-12-28 22:54:44 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/poppler (Old) and /work/SRC/openSUSE:Factory/.poppler.new.28375 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "poppler" Thu Dec 28 22:54:44 2023 rev:201 rq:1135271 version:23.12.0 Changes: -------- --- /work/SRC/openSUSE:Factory/poppler/poppler.changes 2023-11-17 20:49:39.529403294 +0100 +++ /work/SRC/openSUSE:Factory/.poppler.new.28375/poppler.changes 2023-12-28 22:54:49.587890004 +0100 @@ -1,0 +2,8 @@ +Tue Dec 26 10:12:06 UTC 2023 - Antonio Larrosa <alarr...@suse.com> + +- version update to 23.12.0 + core: + * Rewrite FoFiType1::parse to be more flexible + * Small internal code refactoring + +------------------------------------------------------------------- Old: ---- poppler-23.11.0.tar.xz poppler-23.11.0.tar.xz.sig New: ---- poppler-23.12.0.tar.xz poppler-23.12.0.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ poppler.spec ++++++ --- /var/tmp/diff_new_pack.LPMDS2/_old 2023-12-28 22:54:50.183911762 +0100 +++ /var/tmp/diff_new_pack.LPMDS2/_new 2023-12-28 22:54:50.183911762 +0100 @@ -32,7 +32,7 @@ %define poppler_api 0.18 %define poppler_apipkg 0_18 Name: poppler%{?psuffix} -Version: 23.11.0 +Version: 23.12.0 Release: 0 Summary: PDF Rendering Library License: GPL-2.0-only OR GPL-3.0-only ++++++ poppler-23.11.0.tar.xz -> poppler-23.12.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-23.11.0/CMakeLists.txt new/poppler-23.12.0/CMakeLists.txt --- old/poppler-23.11.0/CMakeLists.txt 2023-11-01 22:47:06.000000000 +0100 +++ new/poppler-23.12.0/CMakeLists.txt 2023-12-01 10:31:59.000000000 +0100 @@ -40,7 +40,7 @@ endif() set(POPPLER_MAJOR_VERSION "23") -set(POPPLER_MINOR_VERSION_STRING "11") +set(POPPLER_MINOR_VERSION_STRING "12") # 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}") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-23.11.0/ChangeLog new/poppler-23.12.0/ChangeLog --- old/poppler-23.11.0/ChangeLog 2023-11-01 22:49:56.000000000 +0100 +++ new/poppler-23.12.0/ChangeLog 2023-12-01 10:35:52.000000000 +0100 @@ -1,3 +1,83 @@ +commit 6748cfc84ffef2bfa2328f1da7c70a99d93e0807 +Author: Albert Astals Cid <aa...@kde.org> +Date: Fri Dec 1 10:31:59 2023 +0100 + + poppler 23.12.0 + + CMakeLists.txt | 2 +- + NEWS | 5 +++++ + cpp/Doxyfile | 2 +- + qt5/src/Doxyfile | 2 +- + qt6/src/Doxyfile | 2 +- + 5 files changed, 9 insertions(+), 4 deletions(-) + +commit 84b359b82ee5b10ae714a0fbf3fda53f73e88722 +Author: Albert Astals Cid <aa...@kde.org> +Date: Thu Sep 28 00:27:54 2023 +0200 + + Rewrite FoFiType1::parse to be more flexible + + Previous code needed Encoding to be at the start of it's own line + + The file at issue #1422 doesn't have that and most of the other + renderers show it correctly so we should do the same. + + Also the code should be easier to understand now, and probably + faster since we're not copying string around like before + + fofi/FoFiType1.cc | 295 + ++++++++++++++++++++--------------------------------- + fofi/FoFiType1.h | 12 +-- + poppler/GfxFont.cc | 9 +- + 3 files changed, 120 insertions(+), 196 deletions(-) + +commit 0c53de52deb1328d4d45ab3dfc742acb6386a369 +Author: Albert Astals Cid <aa...@kde.org> +Date: Thu Nov 9 23:56:12 2023 +0100 + + Update (C) + + poppler/Object.h | 1 + + utils/pdfunite.cc | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +commit 73c7458073429371ef3a9ed4f7edd6060d1f822d +Author: Oliver Sander <oliver.san...@tu-dresden.de> +Date: Fri Nov 3 09:04:58 2023 +0100 + + Lexer: Allocate strings on the stack, not on the heap + + Makes the code easier to read, and possibly even a bit faster, too. + + poppler/Lexer.cc | 60 + +++++++++++++++++++++----------------------------------- + 1 file changed, 22 insertions(+), 38 deletions(-) + +commit 6d37f787abc05a658d342d42995c5df167c5e5b9 +Author: Oliver Sander <oliver.san...@tu-dresden.de> +Date: Fri Nov 3 15:30:15 2023 +0100 + + Object: Add constructor from r-value std::string + + This can simplify the calling code when the string to use + is stack-allocated. + + Unfortunately, the new constructor has to do a heap allocation + internally, because Object stores a pointer to a string, + not a string value. + + With the new constructor, construction of Object objects from + std::initializer_list is now ambiguous. This leads to compiler + errors in a few places where {num, gen} is used to initialize + an Object with a Ref object. The patch replaces this construction + by Ref{num, gen}, which fixes the problem. + + poppler/Object.h | 5 +++++ + qt5/tests/check_optcontent.cpp | 4 ++-- + qt6/tests/check_optcontent.cpp | 4 ++-- + utils/pdfunite.cc | 8 ++++---- + 4 files changed, 13 insertions(+), 8 deletions(-) + commit 975d6998b0ad979e81ea133be493bbf7be113fc7 Author: Albert Astals Cid <aa...@kde.org> Date: Wed Nov 1 22:47:06 2023 +0100 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-23.11.0/NEWS new/poppler-23.12.0/NEWS --- old/poppler-23.11.0/NEWS 2023-11-01 22:47:06.000000000 +0100 +++ new/poppler-23.12.0/NEWS 2023-12-01 10:31:59.000000000 +0100 @@ -1,3 +1,8 @@ +Release 23.12.0: + core: + * Rewrite FoFiType1::parse to be more flexible. Issue #1422 + * Small internal code refactoring + Release 23.11.0: core: * CairoOutputDev: Use internal downscaling algorithm if image exceeds Cairo's maximum dimensions. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-23.11.0/cpp/Doxyfile new/poppler-23.12.0/cpp/Doxyfile --- old/poppler-23.11.0/cpp/Doxyfile 2023-11-01 22:47:06.000000000 +0100 +++ new/poppler-23.12.0/cpp/Doxyfile 2023-12-01 10:31:59.000000000 +0100 @@ -31,7 +31,7 @@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 23.11.0 +PROJECT_NUMBER = 23.12.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-23.11.0/fofi/FoFiType1.cc new/poppler-23.12.0/fofi/FoFiType1.cc --- old/poppler-23.11.0/fofi/FoFiType1.cc 2023-11-01 22:47:06.000000000 +0100 +++ new/poppler-23.12.0/fofi/FoFiType1.cc 2023-12-01 10:31:59.000000000 +0100 @@ -13,7 +13,7 @@ // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2005, 2008, 2010, 2018, 2021, 2022 Albert Astals Cid <aa...@kde.org> +// Copyright (C) 2005, 2008, 2010, 2018, 2021-2023 Albert Astals Cid <aa...@kde.org> // Copyright (C) 2005 Kristian Høgsberg <k...@redhat.com> // Copyright (C) 2010 Jakub Wilk <jw...@jwilk.net> // Copyright (C) 2014 Carlos Garcia Campos <carlo...@gnome.org> @@ -28,6 +28,9 @@ #include <config.h> +#include <charconv> +#include <optional> + #include <cstdlib> #include <cstring> #include <climits> @@ -49,34 +52,22 @@ FoFiType1::FoFiType1(const unsigned char *fileA, int lenA, bool freeFileDataA) : FoFiBase(fileA, lenA, freeFileDataA) { - name = nullptr; encoding = nullptr; - fontMatrix[0] = 0.001; - fontMatrix[1] = 0; - fontMatrix[2] = 0; - fontMatrix[3] = 0.001; - fontMatrix[4] = 0; - fontMatrix[5] = 0; parsed = false; undoPFB(); } FoFiType1::~FoFiType1() { - int i; - - if (name) { - gfree(name); - } if (encoding && encoding != fofiType1StandardEncoding) { - for (i = 0; i < 256; ++i) { + for (int i = 0; i < 256; ++i) { gfree(encoding[i]); } gfree(encoding); } } -const char *FoFiType1::getName() +std::string FoFiType1::getName() { if (!parsed) { parse(); @@ -92,18 +83,6 @@ return encoding; } -void FoFiType1::getFontMatrix(double *mat) -{ - int i; - - if (!parsed) { - parse(); - } - for (i = 0; i < 6; ++i) { - mat[i] = fontMatrix[i]; - } -} - void FoFiType1::writeEncoded(const char **newEncoding, FoFiOutputFunc outputFunc, void *outputStream) const { char buf[512]; @@ -197,178 +176,126 @@ return line; } +static const char tokenSeparators[] = " \t\n\r"; + +class FoFiType1Tokenizer +{ +public: + explicit FoFiType1Tokenizer(std::string_view &&stringViewA) : stringView(stringViewA) { } + + std::optional<std::string_view> getToken() + { + const auto length = stringView.length(); + if (currentPos >= length) { + return {}; + } + + std::string_view::size_type pos = stringView.find_first_of(tokenSeparators, currentPos); + while (pos == currentPos) { + // skip multiple contiguous separators + ++currentPos; + pos = stringView.find_first_of(tokenSeparators, currentPos); + } + if (pos == std::string_view::npos) { + std::string_view token = stringView.substr(currentPos, length - currentPos); + currentPos = length; + return token; + } + + std::string_view token = stringView.substr(currentPos, pos - currentPos); + + currentPos = pos + 1; + + return token; + } + +private: + std::string_view::size_type currentPos = 0; + const std::string_view stringView; +}; + void FoFiType1::parse() { - char *line, *line1, *firstLine, *p, *p2; - char buf[256]; - char c; - int n, code, base, i, j; - char *tokptr; - bool gotMatrix, continueLine; - - gotMatrix = false; - for (i = 1, line = (char *)file; i <= 100 && line && (!name || !encoding || !gotMatrix); ++i) { - - // get font name - if (!name && (line + 9 <= (char *)file + len) && !strncmp(line, "/FontName", 9)) { - const auto availableFile = (char *)file + len - line; - const int lineLen = static_cast<int>(availableFile < 255 ? availableFile : 255); - strncpy(buf, line, lineLen); - buf[lineLen] = '\0'; - if ((p = strchr(buf + 9, '/')) && (p = strtok_r(p + 1, " \t\n\r", &tokptr))) { - name = copyString(p); + FoFiType1Tokenizer tokenizer(std::string_view(reinterpret_cast<const char *>(file), len)); + while (name.empty() || !encoding) { + const std::optional<std::string_view> token = tokenizer.getToken(); + + if (!token) { + break; + } + + if (name.empty() && token == "/FontName") { + const std::optional<std::string_view> fontNameToken = tokenizer.getToken(); + if (!fontNameToken) { + break; } - line = getNextLine(line); - // get encoding - } else if (!encoding && (line + 9 <= (char *)file + len) && !strncmp(line, "/Encoding", 9)) { - line = line + 9; - const auto availableFile = (char *)file + len - line; - const int lineLen = static_cast<int>(availableFile < 255 ? availableFile : 255); - strncpy(buf, line, lineLen); - buf[lineLen] = '\0'; - p = strtok_r(buf, " \t\n\r", &tokptr); - if (p && (p + 3 <= (char *)buf + lineLen) && !strncmp(p, "256", 3)) { - p = strtok_r(nullptr, " \t\n\r", &tokptr); - if (p && (p + 5 <= (char *)buf + lineLen) && !strncmp(p, "array", 5)) { - encoding = (char **)gmallocn(256, sizeof(char *)); - for (j = 0; j < 256; ++j) { - encoding[j] = nullptr; + // Skip the / + name = fontNameToken->substr(1); + + } else if (!encoding && token == "/Encoding") { + const std::optional<std::string_view> token2 = tokenizer.getToken(); + if (!token2) { + break; + } + + const std::optional<std::string_view> token3 = tokenizer.getToken(); + if (!token3) { + break; + } + + if (token2 == "StandardEncoding" && token3 == "def") { + encoding = (char **)fofiType1StandardEncoding; + } else if (token2 == "256" && token3 == "array") { + encoding = (char **)gmallocn(256, sizeof(char *)); + for (int j = 0; j < 256; ++j) { + encoding[j] = nullptr; + } + + while (true) { + const std::optional<std::string_view> encodingToken = tokenizer.getToken(); + if (!encodingToken) { + break; } - continueLine = false; - for (j = 0, line = getNextLine(line); j < 1200 && line && (line1 = getNextLine(line)); ++j, line = line1) { - if ((n = (int)(line1 - line)) > 255) { - error(errSyntaxWarning, -1, "FoFiType1::parse a line has more than 255 characters, we don't support this"); - n = 255; - } - if (continueLine) { - continueLine = false; - if ((line1 - firstLine) + 1 > (int)sizeof(buf)) { - break; - } - p = firstLine; - p2 = buf; - while (p < line1) { - if (*p == '\n' || *p == '\r') { - *p2++ = ' '; - p++; - } else { - *p2++ = *p++; - } - } - *p2 = '\0'; - } else { - firstLine = line; - strncpy(buf, line, n); - buf[n] = '\0'; - } - for (p = buf; *p == ' ' || *p == '\t'; ++p) { - ; + + if (encodingToken == "dup") { + std::optional<std::string_view> codeToken = tokenizer.getToken(); + if (!codeToken) { + break; } - if (!strncmp(p, "dup", 3)) { - while (true) { - p += 3; - for (; *p == ' ' || *p == '\t'; ++p) { - ; - } - code = 0; - if (*p == '8' && p[1] == '#') { - base = 8; - p += 2; - } else if (*p >= '0' && *p <= '9') { - base = 10; - } else if (*p == '\n' || *p == '\r') { - continueLine = true; - break; - } else { - break; - } - for (; *p >= '0' && *p < '0' + base && code < INT_MAX / (base + (*p - '0')); ++p) { - code = code * base + (*p - '0'); - } - for (; *p == ' ' || *p == '\t'; ++p) { - ; - } - if (*p == '\n' || *p == '\r' || *p == '\0') { - continueLine = true; - break; - } else if (*p != '/') { - break; - } - ++p; - for (p2 = p; *p2 && *p2 != ' ' && *p2 != '\t'; ++p2) { - ; - } - if (code >= 0 && code < 256) { - c = *p2; - *p2 = '\0'; - gfree(encoding[code]); - encoding[code] = copyString(p); - *p2 = c; - } - for (p = p2; *p == ' ' || *p == '\t'; ++p) { - ; - } - if (*p == '\n' || *p == '\r') { - continueLine = true; - break; - } - if (strncmp(p, "put", 3)) { - break; - } - for (p += 3; *p == ' ' || *p == '\t'; ++p) { - ; - } - if (strncmp(p, "dup", 3)) { - break; - } - } + + std::optional<std::string_view> nameToken; + // Sometimes font data has code and name together without spacing i.e. 33/exclam + // if that happens don't call getToken again and just split codeToken in 2 + const auto slashPositionInCodeToken = codeToken->find('/'); + if (slashPositionInCodeToken != std::string_view::npos) { + nameToken = codeToken->substr(slashPositionInCodeToken, codeToken->length() - slashPositionInCodeToken); + codeToken = codeToken->substr(0, slashPositionInCodeToken); } else { - if (strtok_r(buf, " \t", &tokptr) && (p = strtok_r(nullptr, " \t\n\r", &tokptr)) && !strcmp(p, "def")) { - break; - } + nameToken = tokenizer.getToken(); } - bool allEncodingSet = true; - for (int k = 0; allEncodingSet && k < 256; ++k) { - allEncodingSet = encoding[k] != nullptr; - } - if (allEncodingSet) { + if (!nameToken) { break; } - } - //~ check for getinterval/putinterval junk - } - } else if (p && (p + 16 <= (char *)buf + lineLen) && !strncmp(p, "StandardEncoding", 16)) { - p = strtok_r(nullptr, " \t\n\r", &tokptr); - if (p && (p + 3 <= (char *)buf + lineLen) && !strncmp(p, "def", 3)) { - encoding = (char **)fofiType1StandardEncoding; - } - } else { - line = getNextLine(line); - } - } else if (!gotMatrix && (line + 11 <= (char *)file + len) && !strncmp(line, "/FontMatrix", 11)) { - const auto availableFile = (char *)file + len - (line + 11); - const int bufLen = static_cast<int>(availableFile < 255 ? availableFile : 255); - strncpy(buf, line + 11, bufLen); - buf[bufLen] = '\0'; - if ((p = strchr(buf, '['))) { - ++p; - if ((p2 = strchr(p, ']'))) { - *p2 = '\0'; - for (j = 0; j < 6; ++j) { - if ((p = strtok_r(j == 0 ? p : nullptr, " \t\n\r", &tokptr))) { - fontMatrix[j] = atof(p); + + int code = 0; + if (codeToken->length() > 2 && codeToken->at(0) == '8' && codeToken->at(1) == '#') { + std::from_chars(codeToken->data() + 2, codeToken->data() + codeToken->length(), code, 8); } else { - break; + std::from_chars(codeToken->data(), codeToken->data() + codeToken->length(), code); + } + + if (code >= 0 && code < 256 && nameToken->length() > 1) { + gfree(encoding[code]); + encoding[code] = copyString(nameToken->data() + 1, nameToken->length() - 1); } + + } else if (encodingToken == "def") { + break; } } } - gotMatrix = true; - - } else { - line = getNextLine(line); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-23.11.0/fofi/FoFiType1.h new/poppler-23.12.0/fofi/FoFiType1.h --- old/poppler-23.11.0/fofi/FoFiType1.h 2023-11-01 22:47:06.000000000 +0100 +++ new/poppler-23.12.0/fofi/FoFiType1.h 2023-12-01 10:31:59.000000000 +0100 @@ -13,7 +13,7 @@ // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2018, 2022 Albert Astals Cid <aa...@kde.org> +// Copyright (C) 2018, 2022, 2023 Albert Astals Cid <aa...@kde.org> // Copyright (C) 2022 Oliver Sander <oliver.san...@tu-dresden.de> // // To see a description of the changes please see the Changelog file that @@ -26,6 +26,8 @@ #include "FoFiBase.h" +#include <string> + //------------------------------------------------------------------------ // FoFiType1 //------------------------------------------------------------------------ @@ -39,15 +41,12 @@ ~FoFiType1() override; // Return the font name. - const char *getName(); + std::string getName(); // Return the encoding, as an array of 256 names (any of which may // be NULL). char **getEncoding(); - // Return the font matrix as an array of six numbers. - void getFontMatrix(double *mat); - // Write a version of the Type 1 font file with a new encoding. void writeEncoded(const char **newEncoding, FoFiOutputFunc outputFunc, void *outputStream) const; @@ -58,9 +57,8 @@ void parse(); void undoPFB(); - char *name; + std::string name; char **encoding; - double fontMatrix[6]; bool parsed; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-23.11.0/glib/reference/html/index.html new/poppler-23.12.0/glib/reference/html/index.html --- old/poppler-23.11.0/glib/reference/html/index.html 2023-11-01 22:49:26.000000000 +0100 +++ new/poppler-23.12.0/glib/reference/html/index.html 2023-12-01 10:34:23.000000000 +0100 @@ -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 23.11.0 + for Poppler 23.12.0 </p></div> </div> <hr> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-23.11.0/glib/reference/html/poppler-Poppler-Features.html new/poppler-23.12.0/glib/reference/html/poppler-Poppler-Features.html --- old/poppler-23.11.0/glib/reference/html/poppler-Poppler-Features.html 2023-11-01 22:49:26.000000000 +0100 +++ new/poppler-23.12.0/glib/reference/html/poppler-Poppler-Features.html 2023-12-01 10:34:23.000000000 +0100 @@ -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 (11) +<pre class="programlisting">#define POPPLER_MINOR_VERSION (12) </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-23.11.0/poppler/GfxFont.cc new/poppler-23.12.0/poppler/GfxFont.cc --- old/poppler-23.11.0/poppler/GfxFont.cc 2023-11-01 22:47:06.000000000 +0100 +++ new/poppler-23.12.0/poppler/GfxFont.cc 2023-12-01 10:31:59.000000000 +0100 @@ -1140,11 +1140,10 @@ const std::optional<std::vector<unsigned char>> buf = readEmbFontFile(xref); if (buf) { if ((ffT1 = FoFiType1::make(buf->data(), buf->size()))) { - if (ffT1->getName()) { - if (embFontName) { - delete embFontName; - } - embFontName = new GooString(ffT1->getName()); + const std::string fontName = ffT1->getName(); + if (!fontName.empty()) { + delete embFontName; + embFontName = new GooString(fontName); } if (!baseEnc) { baseEnc = (const char **)ffT1->getEncoding(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-23.11.0/poppler/Lexer.cc new/poppler-23.12.0/poppler/Lexer.cc --- old/poppler-23.11.0/poppler/Lexer.cc 2023-11-01 22:47:06.000000000 +0100 +++ new/poppler-23.12.0/poppler/Lexer.cc 2023-12-01 10:31:59.000000000 +0100 @@ -167,7 +167,6 @@ int xi; long long xll = 0; double xf = 0, scale; - std::unique_ptr<GooString> s; int n, m; // skip whitespace and comments @@ -292,12 +291,12 @@ break; // string - case '(': + case '(': { p = tokBuf; n = 0; numParen = 1; done = false; - s = nullptr; + std::string s; do { c2 = EOF; switch (c = getChar()) { @@ -392,11 +391,7 @@ if (c2 != EOF) { if (n == tokBufSize) { - if (!s) { - s = std::make_unique<GooString>(tokBuf, tokBufSize); - } else { - s->append(tokBuf, tokBufSize); - } + s.append(tokBuf, tokBufSize); p = tokBuf; n = 0; @@ -406,7 +401,7 @@ if (newObjNum != objNum) { error(errSyntaxError, getPos(), "Unterminated string"); done = true; - s.reset(); + s.clear(); n = -2; } } @@ -416,26 +411,22 @@ } } while (!done); if (n >= 0) { - if (!s) { - s = std::make_unique<GooString>(tokBuf, n); - } else { - s->append(tokBuf, n); - } + s.append(tokBuf, n); // Check utf8 - if (isUtf8WithBom(s->toStr())) { - s = std::make_unique<GooString>(utf8ToUtf16WithBom(s->toStr())); + if (isUtf8WithBom(s)) { + s = utf8ToUtf16WithBom(s); } - return Object(s.release()); + return Object(std::move(s)); } else { return Object(objEOF); } break; - + } // name - case '/': + case '/': { p = tokBuf; n = 0; - s = nullptr; + std::string s; while ((c = lookChar()) != EOF && !specialChars[c]) { getChar(); if (c == '#') { @@ -472,24 +463,25 @@ } else if (n == tokBufSize) { error(errSyntaxError, getPos(), "Warning: name token is longer than what the specification says it can be"); *p = c; - s = std::make_unique<GooString>(tokBuf, n); + s = std::string(tokBuf, n); } else { // Somewhat arbitrary threshold if (unlikely(n == 1024 * 1024)) { error(errSyntaxError, getPos(), "Error: name token is larger than 1 MB. Suspicion of hostile file. Stopping parsing"); return Object(objEOF); } - s->append((char)c); + s.push_back((char)c); } } if (n < tokBufSize) { *p = '\0'; return Object(objName, tokBuf); } else { - Object obj(objName, s->c_str()); + Object obj(objName, s.c_str()); return obj; } break; + } // array punctuation case '[': @@ -515,7 +507,7 @@ p = tokBuf; m = n = 0; c2 = 0; - s = nullptr; + std::string s; while (true) { c = getChar(); if (c == '>') { @@ -536,11 +528,7 @@ } if (++m == 2) { if (n == tokBufSize) { - if (!s) { - s = std::make_unique<GooString>(tokBuf, tokBufSize); - } else { - s->append(tokBuf, tokBufSize); - } + s.append(tokBuf, tokBufSize); p = tokBuf; n = 0; } @@ -551,18 +539,14 @@ } } } - if (!s) { - s = std::make_unique<GooString>(tokBuf, n); - } else { - s->append(tokBuf, n); - } + s.append(tokBuf, n); if (m == 1) { - s->append((char)(c2 << 4)); + s.push_back((char)(c2 << 4)); } - if (isUtf8WithBom(s->toStr())) { - s = std::make_unique<GooString>(utf8ToUtf16WithBom(s->toStr())); + if (isUtf8WithBom(s)) { + s = utf8ToUtf16WithBom(s); } - return Object(s.release()); + return Object(std::move(s)); } break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-23.11.0/poppler/Object.h new/poppler-23.12.0/poppler/Object.h --- old/poppler-23.11.0/poppler/Object.h 2023-11-01 22:47:06.000000000 +0100 +++ new/poppler-23.12.0/poppler/Object.h 2023-12-01 10:31:59.000000000 +0100 @@ -25,6 +25,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) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, <i...@kdab.com>. Work sponsored by Technische Universität Dresden +// Copyright (C) 2023 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 @@ -214,6 +215,11 @@ type = objString; string = stringA; } + explicit Object(std::string &&stringA) + { + type = objString; + string = new GooString(stringA); + } Object(ObjType typeA, GooString *stringA) { assert(typeA == objHexString); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-23.11.0/qt5/src/Doxyfile new/poppler-23.12.0/qt5/src/Doxyfile --- old/poppler-23.11.0/qt5/src/Doxyfile 2023-11-01 22:47:06.000000000 +0100 +++ new/poppler-23.12.0/qt5/src/Doxyfile 2023-12-01 10:31:59.000000000 +0100 @@ -31,7 +31,7 @@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 23.11.0 +PROJECT_NUMBER = 23.12.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-23.11.0/qt5/tests/check_optcontent.cpp new/poppler-23.12.0/qt5/tests/check_optcontent.cpp --- old/poppler-23.11.0/qt5/tests/check_optcontent.cpp 2023-11-01 22:47:06.000000000 +0100 +++ new/poppler-23.12.0/qt5/tests/check_optcontent.cpp 2023-12-01 10:31:59.000000000 +0100 @@ -173,7 +173,7 @@ // In this test, both Ref(21,0) and Ref(28,0) start On, // based on the file settings - Object ref21obj({ 21, 0 }); + Object ref21obj(Ref { 21, 0 }); Ref ref21 = ref21obj.getRef(); OptionalContentGroup *ocgA = ocgs->findOcgByRef(ref21); QVERIFY(ocgA); @@ -181,7 +181,7 @@ QVERIFY((ocgA->getName()->cmp("A")) == 0); QCOMPARE(ocgA->getState(), OptionalContentGroup::On); - Object ref28obj({ 28, 0 }); + Object ref28obj(Ref { 28, 0 }); Ref ref28 = ref28obj.getRef(); OptionalContentGroup *ocgB = ocgs->findOcgByRef(ref28); QVERIFY(ocgB); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-23.11.0/qt6/src/Doxyfile new/poppler-23.12.0/qt6/src/Doxyfile --- old/poppler-23.11.0/qt6/src/Doxyfile 2023-11-01 22:47:06.000000000 +0100 +++ new/poppler-23.12.0/qt6/src/Doxyfile 2023-12-01 10:31:59.000000000 +0100 @@ -31,7 +31,7 @@ # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 23.11.0 +PROJECT_NUMBER = 23.12.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-23.11.0/qt6/tests/check_optcontent.cpp new/poppler-23.12.0/qt6/tests/check_optcontent.cpp --- old/poppler-23.11.0/qt6/tests/check_optcontent.cpp 2023-11-01 22:47:06.000000000 +0100 +++ new/poppler-23.12.0/qt6/tests/check_optcontent.cpp 2023-12-01 10:31:59.000000000 +0100 @@ -164,7 +164,7 @@ // In this test, both Ref(21,0) and Ref(28,0) start On, // based on the file settings - Object ref21obj({ 21, 0 }); + Object ref21obj(Ref { 21, 0 }); Ref ref21 = ref21obj.getRef(); OptionalContentGroup *ocgA = ocgs->findOcgByRef(ref21); QVERIFY(ocgA); @@ -172,7 +172,7 @@ QVERIFY((ocgA->getName()->cmp("A")) == 0); QCOMPARE(ocgA->getState(), OptionalContentGroup::On); - Object ref28obj({ 28, 0 }); + Object ref28obj(Ref { 28, 0 }); Ref ref28 = ref28obj.getRef(); OptionalContentGroup *ocgB = ocgs->findOcgByRef(ref28); QVERIFY(ocgB); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poppler-23.11.0/utils/pdfunite.cc new/poppler-23.12.0/utils/pdfunite.cc --- old/poppler-23.11.0/utils/pdfunite.cc 2023-11-01 22:47:06.000000000 +0100 +++ new/poppler-23.12.0/utils/pdfunite.cc 2023-12-01 10:31:59.000000000 +0100 @@ -14,7 +14,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) 2019 Marek Kasik <mka...@redhat.com> -// Copyright (C) 2019 Oliver Sander <oliver.san...@tu-dresden.de> +// Copyright (C) 2019, 2023 Oliver Sander <oliver.san...@tu-dresden.de> // Copyright (C) 2022 crt <ch...@cse.cuhk.edu.hk> // //======================================================================== @@ -49,7 +49,7 @@ if (mkey.isString() && mvalue.isRef()) { if (mkey.getString()->cmp(key.getString()) < 0) { newNameArray->add(Object(new GooString(mkey.getString()->c_str()))); - newNameArray->add(Object({ mvalue.getRef().num + numOffset, mvalue.getRef().gen })); + newNameArray->add(Object(Ref { mvalue.getRef().num + numOffset, mvalue.getRef().gen })); j += 2; } else if (mkey.getString()->cmp(key.getString()) == 0) { j += 2; @@ -69,7 +69,7 @@ const Object &mvalue = mergeNameArray.arrayGetNF(j + 1); if (mkey.isString() && mvalue.isRef()) { newNameArray->add(Object(new GooString(mkey.getString()->c_str()))); - newNameArray->add(Object({ mvalue.getRef().num + numOffset, mvalue.getRef().gen })); + newNameArray->add(Object(Ref { mvalue.getRef().num + numOffset, mvalue.getRef().gen })); } j += 2; } @@ -82,7 +82,7 @@ const Object &value = mergeNameArray.arrayGetNF(i + 1); if (key.isString() && value.isRef()) { newNameArray->add(Object(new GooString(key.getString()->c_str()))); - newNameArray->add(Object({ value.getRef().num + numOffset, value.getRef().gen })); + newNameArray->add(Object(Ref { value.getRef().num + numOffset, value.getRef().gen })); } } srcNameTree->add("Names", Object(newNameArray)); @@ -117,7 +117,7 @@ error(errSyntaxError, -1, "Fields object is not a Ref."); return false; } - srcFields.arrayAdd(Object({ value.getRef().num + numOffset, value.getRef().gen })); + srcFields.arrayAdd(Object(Ref { value.getRef().num + numOffset, value.getRef().gen })); } } return true;