download.lst                                     |    4 -
 external/poppler/UnpackedTarball_poppler.mk      |    1 
 external/poppler/disable-freetype.patch.1        |    4 -
 external/poppler/disable-nss-and-gpgmepp.patch.1 |   45 ++++++++++---
 external/poppler/std_string.patch.1              |   77 +++++++++++++++++++++++
 5 files changed, 117 insertions(+), 14 deletions(-)

New commits:
commit d72c4a5aedfe632b695aa419cf8e8ecb77d2b478
Author:     Xisco Fauli <[email protected]>
AuthorDate: Mon May 13 11:14:06 2024 +0200
Commit:     Michael Stahl <[email protected]>
CommitDate: Thu Jan 9 18:15:33 2025 +0100

    poppler: Upgrade 24.05.0
    
    * external/poppler/char_traits.patch is no longer neeeded
    after 
https://cgit.freedesktop.org/poppler/poppler/commit/cpp/poppler-global.h?id=b4ac7d9af7cb5edfcfcbda035ed8b8c218ba8564
    
    * Adapt external/poppler/disable-nss-and-gpgmepp.patch.1
    after 
https://cgit.freedesktop.org/poppler/poppler/commit/?id=d40bb7e308c9e3299e50d3e2880229cd6272587e
    
    Downloaded from https://poppler.freedesktop.org/poppler-24.05.0.tar.xz
    
    Change-Id: I87ed833f92e504f0a39b5f64c1db42d579050a37
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167582
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173038
    Reviewed-by: Taichi Haradaguchi <[email protected]>
    (cherry picked from commit e70a307eab620e8a6572676398781c35f4925727)
    (cherry picked from commit 93c1e8f80b84445a6918b3f8a56016bbb8675757)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180008
    Tested-by: allotropia jenkins <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/download.lst b/download.lst
index 9fc8e5d16fdf..d71f89d89656 100644
--- a/download.lst
+++ b/download.lst
@@ -470,8 +470,8 @@ LIBPNG_TARBALL := libpng-1.6.44.tar.xz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
-POPPLER_SHA256SUM := 
bafbf0db5713dec25b5d16eb2cd87e4a62351cdc40f050c3937cd8dd6882d446
-POPPLER_TARBALL := poppler-24.03.0.tar.xz
+POPPLER_SHA256SUM := 
d8c5eb30b50285ad9f0af8c6335cc2d3b9597fca475cbc2598a5479fa379f779
+POPPLER_TARBALL := poppler-24.05.0.tar.xz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
diff --git a/external/poppler/UnpackedTarball_poppler.mk 
b/external/poppler/UnpackedTarball_poppler.mk
index a8f9af27fe60..a3f493bb204f 100644
--- a/external/poppler/UnpackedTarball_poppler.mk
+++ b/external/poppler/UnpackedTarball_poppler.mk
@@ -17,6 +17,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,poppler,\
        external/poppler/gcc7-EntityInfo.patch.1 \
        external/poppler/gcc7-GfxFont.patch.1 \
        external/poppler/std_charconv.patch.1 \
+       external/poppler/std_string.patch.1 \
        external/poppler/poppler-config.patch.1 \
 ))
 
diff --git a/external/poppler/disable-freetype.patch.1 
b/external/poppler/disable-freetype.patch.1
index 3c4d1d0f7a8a..5d7426242c35 100644
--- a/external/poppler/disable-freetype.patch.1
+++ b/external/poppler/disable-freetype.patch.1
@@ -22,13 +22,13 @@ disable freetype dependent code
  #include <unordered_set>
  
  // helper for using std::visit to get a dependent false for static_asserts
-@@ -2760,6 +2760,8 @@
+@@ -2840,6 +2840,8 @@
  
  Form::AddFontResult Form::addFontToDefaultResources(const std::string 
&filepath, int faceIndex, const std::string &fontFamily, const std::string 
&fontStyle, bool forceName)
  {
 +    return {};
 +#if 0
-     if (!GooString::endsWith(filepath, ".ttf") && 
!GooString::endsWith(filepath, ".ttc") && !GooString::endsWith(filepath, 
".otf")) {
+     if (!filepath.ends_with(".ttf") && !filepath.ends_with(".ttc") && 
!filepath.ends_with(".otf")) {
          error(errIO, -1, "We only support embedding ttf/ttc/otf fonts for 
now. The font file for {0:s} {1:s} was {2:s}", fontFamily.c_str(), 
fontStyle.c_str(), filepath.c_str());
          return {};
 @@ -2994,6 +2996,7 @@
diff --git a/external/poppler/disable-nss-and-gpgmepp.patch.1 
b/external/poppler/disable-nss-and-gpgmepp.patch.1
index 1d7f7f933433..1fc9ede6035c 100644
--- a/external/poppler/disable-nss-and-gpgmepp.patch.1
+++ b/external/poppler/disable-nss-and-gpgmepp.patch.1
@@ -11,9 +11,9 @@ disable NSS/GPGMEPP dependent code.
  #include "SignatureInfo.h"
  #include "CertificateInfo.h"
  #include "XRef.h"
-@@ -578,7 +578,7 @@
+@@ -584,7 +584,7 @@
  {
-     return static_cast<FormFieldSignature 
*>(field)->validateSignature(doVerifyCert, forceRevalidation, validationTime, 
ocspRevocationCheck, enableAIA);
+     return static_cast<FormFieldSignature 
*>(field)->validateSignatureResult();
  }
 -
 +#if 0
@@ -60,19 +60,44 @@ disable NSS/GPGMEPP dependent code.
  }
 
  FormSignatureType FormWidgetSignature::signatureType() const
-@@ -2388,6 +2392,7 @@
-
- SignatureInfo *FormFieldSignature::validateSignature(bool doVerifyCert, bool 
forceRevalidation, time_t validationTime, bool ocspRevocationCheck, bool 
enableAIA)
+@@ -2395,6 +2399,7 @@
+ 
+ SignatureInfo *FormFieldSignature::validateSignatureAsync(bool doVerifyCert, 
bool forceRevalidation, time_t validationTime, bool ocspRevocationCheck, bool 
enableAIA, const std::function<void()> &doneCallback)
  {
 +#if 0
      auto backend = CryptoSign::Factory::createActive();
      if (!backend) {
-         return signature_info;
-@@ -2464,6 +2469,7 @@
-     const CertificateValidationStatus cert_val_state = 
signature_handler->validateCertificate(std::chrono::system_clock::from_time_t(validationTime),
 ocspRevocationCheck, enableAIA);
-     signature_info->setCertificateValStatus(cert_val_state);
-
+         if (doneCallback) {
+@@ -2497,6 +2502,7 @@
+ 
+     
signature_handler->validateCertificateAsync(std::chrono::system_clock::from_time_t(validationTime),
 ocspRevocationCheck, enableAIA, doneCallback);
+ 
 +#endif
      return signature_info;
  }
 
+@@ -2508,10 +2508,13 @@
+ 
+ CertificateValidationStatus FormFieldSignature::validateSignatureResult()
+ {
++#if 0
+     if (!signature_handler) {
+         return CERTIFICATE_GENERIC_ERROR;
+     }
+     return signature_handler->validateCertificateResult();
++#endif
++    return CERTIFICATE_GENERIC_ERROR;
+ }
+ 
+ std::vector<Goffset> FormFieldSignature::getSignedRangeBounds() const
+
+--- poppler/poppler/Form.h     2024-05-13 10:18:04.303912457 +0200
++++ poppler/poppler/Form.h     2024-05-13 11:41:51.547002511 +0200
+@@ -669,7 +669,6 @@
+     double customAppearanceLeftFontSize = 20;
+     Ref imageResource = Ref::INVALID();
+     std::unique_ptr<X509CertificateInfo> certificate_info;
+-    std::unique_ptr<CryptoSign::VerificationInterface> signature_handler;
+ 
+     void print(int indent) override;
+ };
diff --git a/external/poppler/std_string.patch.1 
b/external/poppler/std_string.patch.1
new file mode 100644
index 000000000000..6c5ce136ca47
--- /dev/null
+++ b/external/poppler/std_string.patch.1
@@ -0,0 +1,77 @@
+remove C++20 starts_with
+
+--- poppler/goo/GooString.h.orig       2025-01-09 11:15:13.174300578 +0100
++++ poppler/goo/GooString.h    2025-01-09 11:17:39.568825610 +0100
+@@ -237,11 +237,16 @@
+     int cmp(const char *sA) const { return compare(sA); }
+     int cmpN(const char *sA, int n) const { return compare(0, n, sA); }
+ 
+-    // Return true if strings starts with prefix
+-    using std::string::starts_with;
+-
+-    // Return true if string ends with suffix
+-    using std::string::ends_with;
++    bool starts_with(const char *prefix) const
++    {
++        return startsWith(toStr(), prefix);
++    }
++    bool ends_with(const char *suffix) const
++    {
++        return endsWith(toStr(), suffix);
++    }
++    static bool startsWith(std::string_view str, std::string_view prefix) { 
return str.size() >= prefix.size() && 0 == str.compare(0, prefix.size(), 
prefix); }
++    static bool endsWith(std::string_view str, std::string_view suffix) { 
return str.size() >= suffix.size() && 0 == str.compare(str.size() - 
suffix.size(), suffix.size(), suffix); }
+ };
+ 
+ #endif
+--- poppler/poppler/UTF.h.orig 2025-01-09 11:25:36.593385806 +0100
++++ poppler/poppler/UTF.h      2025-01-09 11:25:30.852367770 +0100
+@@ -54,13 +54,13 @@
+ // check whether string starts with Big-Endian byte order mark
+ inline bool hasUnicodeByteOrderMark(const std::string &s)
+ {
+-    return s.starts_with(unicodeByteOrderMark);
++    return s.size() >= unicodeByteOrderMark.size() && 0 == s.compare(0, 
unicodeByteOrderMark.size(), unicodeByteOrderMark);
+ }
+ 
+ // check whether string starts with Little-Endian byte order mark
+ inline bool hasUnicodeByteOrderMarkLE(const std::string &s)
+ {
+-    return s.starts_with(unicodeByteOrderMarkLE);
++    return s.size() >= unicodeByteOrderMarkLE.size() && 0 == s.compare(0, 
unicodeByteOrderMarkLE.size(), unicodeByteOrderMarkLE);
+ }
+ 
+ // put big-endian unicode byte order mark at the beginning of a string
+--- poppler/poppler/GlobalParams.cc.orig       2025-01-09 11:26:46.850606552 
+0100
++++ poppler/poppler/GlobalParams.cc    2025-01-09 11:29:28.030112935 +0100
+@@ -903,7 +903,7 @@
+ 
+ static bool supportedFontForEmbedding(Unicode uChar, const char *filepath, 
int faceIndex)
+ {
+-    if (!std::string_view(filepath).ends_with(".ttf") && 
!std::string_view(filepath).ends_with(".ttc") && 
!std::string_view(filepath).ends_with(".otf")) {
++    if (!GooString::endsWith(std::string_view(filepath), ".ttf") && 
!GooString::endsWith(std::string_view(filepath), ".ttc") && 
!GooString::endsWith(std::string_view(filepath), ".otf")) {
+         // for now we only support ttf, ttc, otf fonts
+         return false;
+     }
+--- poppler/poppler/GfxFont.cc.orig    2025-01-09 11:26:07.863484064 +0100
++++ poppler/poppler/GfxFont.cc 2025-01-09 11:31:47.164550059 +0100
+@@ -1252,7 +1252,7 @@
+ 
+     // pass 1: use the name-to-Unicode mapping table
+     missing = hex = false;
+-    bool isZapfDingbats = name && name->ends_with("ZapfDingbats");
++    bool isZapfDingbats = name && GooString::endsWith(*name, "ZapfDingbats");
+     for (int code = 0; code < 256; ++code) {
+         if ((charName = enc[code])) {
+             if (isZapfDingbats) {
+--- poppler/poppler/Form.cc.orig2      2025-01-09 11:33:42.284911742 +0100
++++ poppler/poppler/Form.cc    2025-01-09 11:34:46.013111945 +0100
+@@ -2818,7 +2818,7 @@
+     const Dict *fontDict = fontDictObj.getDict();
+     for (int i = 0; i < fontDict->getLength(); ++i) {
+         const char *key = fontDict->getKey(i);
+-        if (std::string_view(key).starts_with(kOurDictFontNamePrefix)) {
++        if (GooString::startsWith(std::string_view(key), 
kOurDictFontNamePrefix)) {
+             const Object fontObj = fontDict->getVal(i);
+             if (fontObj.isDict() && fontObj.dictIs("Font")) {
+                 const Object fontBaseFontObj = fontObj.dictLookup("BaseFont");

Reply via email to