download.lst | 4 external/pdfium/Library_pdfium.mk | 28 ++- external/pdfium/UnpackedTarball_pdfium.mk | 5 external/pdfium/build.patch.1 | 104 ++++++++++---- external/pdfium/buildfix-7.patch.1 | 177 ++++++++++++++++++++++++- external/pdfium/inc/pch/precompiled_pdfium.hxx | 43 +++--- external/pdfium/windows7.patch.1 | 14 - svx/source/svdraw/svdpdf.cxx | 2 8 files changed, 305 insertions(+), 72 deletions(-)
New commits: commit 5e9b02bbac8cf476d419cd363a91b96464a87813 Author: Miklos Vajna <[email protected]> AuthorDate: Thu Aug 15 10:09:52 2024 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Wed Nov 12 17:55:55 2025 +0100 Update pdfium to 6656 Drop external/pdfium/annot.patch.1, it has been upstreamed as <https://pdfium-review.googlesource.com/c/pdfium/+/120750>. Update PDFiumPageObjectImpl::getFontName() to match <https://pdfium-review.googlesource.com/c/pdfium/+/121911> "Rename FPDFFont_GetFontName() to FPDFFont_GetFamilyName()". Extend external/pdfium/build.patch.1 to work around: > C:/cygwin/home/tdf/jenkins/workspace/gerrit_windows/workdir/UnpackedTarball/pdfium/fpdfsdk/fpdf_annot.cpp(1083): fatal error C1001: Internal compiler error. Change-Id: I94ed21265a79d484759f240f3baeb51c92365c78 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171884 Tested-by: Jenkins Reviewed-by: Miklos Vajna <[email protected]> (cherry picked from commit 0cde8913d8cb183224d03d5cbb37072e63e745d1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193764 Tested-by: Jenkins CollaboraOffice <[email protected]> (cherry picked from commit 70cbe79e3343285812c809736641ce4625a53e82) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193881 Reviewed-by: Michael Stahl <[email protected]> Tested-by: allotropia jenkins <[email protected]> diff --git a/download.lst b/download.lst index a05d129cb1f8..fc5d98d000b0 100644 --- a/download.lst +++ b/download.lst @@ -455,8 +455,8 @@ PAGEMAKER_TARBALL := libpagemaker-0.0.4.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts -PDFIUM_SHA256SUM := 9c2db89e9ea96f632108170bce7d901dbfc773bb09d03b7cd0ac68ebe26b9092 -PDFIUM_TARBALL := pdfium-6536.tar.bz2 +PDFIUM_SHA256SUM := ea2d59946fbd0c72a8b07d19bd58bb99cf66add27f5388b02d99bd7f37c13388 +PDFIUM_TARBALL := pdfium-6656.tar.bz2 # three static lines # so that git cherry-pick # will not run into conflicts diff --git a/external/pdfium/Library_pdfium.mk b/external/pdfium/Library_pdfium.mk index 9e1d6b4ea217..57ca765a3b61 100644 --- a/external/pdfium/Library_pdfium.mk +++ b/external/pdfium/Library_pdfium.mk @@ -177,6 +177,9 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/core/fpdfapi/cmaps/Korea1/cmaps_korea1 \ UnpackedTarball/pdfium/core/fpdfapi/cmaps/fpdf_cmaps \ UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_pagecontentgenerator \ + UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_npagetooneexporter \ + UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_pageexporter \ + UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_pageorganizer \ UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_cidfont \ UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_font \ UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_fontencoding \ @@ -435,11 +438,9 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ # fxge $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ - UnpackedTarball/pdfium/core/fxge/dib/cfx_bitmapcomposer \ UnpackedTarball/pdfium/core/fxge/dib/cfx_bitmapstorer \ UnpackedTarball/pdfium/core/fxge/dib/cfx_dibitmap \ UnpackedTarball/pdfium/core/fxge/cfx_drawutils \ - UnpackedTarball/pdfium/core/fxge/dib/cfx_imagerenderer \ UnpackedTarball/pdfium/core/fxge/dib/cfx_imagestretcher \ UnpackedTarball/pdfium/core/fxge/dib/cfx_imagetransformer \ UnpackedTarball/pdfium/core/fxge/dib/cfx_scanlinecompositor \ @@ -464,7 +465,9 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/core/fxge/fontdata/chromefontdata/FoxitSymbol \ UnpackedTarball/pdfium/core/fxge/freetype/fx_freetype \ UnpackedTarball/pdfium/core/fxge/renderdevicedriver_iface \ - UnpackedTarball/pdfium/core/fxge/agg/fx_agg_driver \ + UnpackedTarball/pdfium/core/fxge/agg/cfx_agg_bitmapcomposer \ + UnpackedTarball/pdfium/core/fxge/agg/cfx_agg_devicedriver \ + UnpackedTarball/pdfium/core/fxge/agg/cfx_agg_imagerenderer \ UnpackedTarball/pdfium/core/fxge/cfx_cliprgn \ UnpackedTarball/pdfium/core/fxge/cfx_color \ UnpackedTarball/pdfium/core/fxge/cfx_glyphcache \ diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1 index 5db8fb649598..c1c733aca306 100644 --- a/external/pdfium/build.patch.1 +++ b/external/pdfium/build.patch.1 @@ -132,3 +132,16 @@ index 8026a75d5..34c20d62f 100644 } // namespace +--- pdfium/fpdfsdk/fpdf_annot.cpp.orig 2024-08-15 10:01:30.443712200 +0200 ++++ pdfium/fpdfsdk/fpdf_annot.cpp 2024-08-15 10:04:41.161274500 +0200 +@@ -1079,8 +1079,8 @@ + if (appearanceMode < 0 || appearanceMode >= FPDF_ANNOT_APPEARANCEMODE_COUNT) + return false; + +- static constexpr auto kModeKeyForMode = +- fxcrt::ToArray<const char*>({"N", "R", "D"}); ++ static constexpr std::array<const char*, 3UL> kModeKeyForMode ++ ({"N", "R", "D"}); + static_assert(kModeKeyForMode.size() == FPDF_ANNOT_APPEARANCEMODE_COUNT, + "length of kModeKeyForMode should be equal to " + "FPDF_ANNOT_APPEARANCEMODE_COUNT"); diff --git a/external/pdfium/buildfix-7.patch.1 b/external/pdfium/buildfix-7.patch.1 index e36e95b43d20..a5540617fd9e 100644 --- a/external/pdfium/buildfix-7.patch.1 +++ b/external/pdfium/buildfix-7.patch.1 @@ -144,3 +144,63 @@ pdfium/core/fpdfdoc/cpdf_formcontrol.cpp:134: undefined reference to `fxcrt::Str // Returns negative values on failure. int GetWeightLevel(FX_Charset charset, size_t index) { +--- pdfium/core/fpdfapi/page/cpdf_colorspace.cpp.orig 2025-11-12 11:17:00.123332719 +0100 ++++ pdfium/core/fpdfapi/page/cpdf_colorspace.cpp 2025-11-12 11:22:19.902936971 +0100 +@@ -51,7 +51,7 @@ + + namespace { + +-constexpr auto kSRGBSamples1 = fxcrt::ToArray<const uint8_t>({ ++std::array<const uint8_t, 192> kSRGBSamples1 = { + 0, 3, 6, 10, 13, 15, 18, 20, 22, 23, 25, 27, 28, 30, 31, + 32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 49, 50, 51, 52, 53, 53, 54, 55, 56, 56, 57, 58, 58, +@@ -65,9 +65,9 @@ + 107, 107, 108, 108, 108, 109, 109, 109, 110, 110, 110, 110, 111, 111, 111, + 112, 112, 112, 113, 113, 113, 114, 114, 114, 115, 115, 115, 115, 116, 116, + 116, 117, 117, 117, 118, 118, 118, 118, 119, 119, 119, 120, +-}); ++}; + +-constexpr auto kSRGBSamples2 = fxcrt::ToArray<const uint8_t>({ ++std::array<const uint8_t, 208> kSRGBSamples2 = { + 120, 121, 122, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 148, 149, + 150, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 159, 160, 161, 162, +@@ -82,7 +82,7 @@ + 236, 236, 237, 237, 238, 238, 238, 239, 239, 240, 240, 241, 241, 242, 242, + 243, 243, 244, 244, 245, 245, 246, 246, 246, 247, 247, 248, 248, 249, 249, + 250, 250, 251, 251, 251, 252, 252, 253, 253, 254, 254, 255, 255, +-}); ++}; + + constexpr size_t kBlackWhitePointCount = 3; + +--- pdfium/core/fpdfdoc/cpdf_pagelabel.cpp.orig 2025-11-12 11:24:55.120659410 +0100 ++++ pdfium/core/fpdfdoc/cpdf_pagelabel.cpp 2025-11-12 11:26:09.615649063 +0100 +@@ -20,9 +20,9 @@ + WideString MakeRoman(int num) { + constexpr auto kArabic = fxcrt::ToArray<const int>( + {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1}); +- const auto kRoman = fxcrt::ToArray<const WideStringView>( ++ std::array<const WideStringView, 13> kRoman = + {L"m", L"cm", L"d", L"cd", L"c", L"xc", L"l", L"xl", L"x", L"ix", L"v", +- L"iv", L"i"}); ++ L"iv", L"i"}; + constexpr int kMaxNum = 1000000; + + num %= kMaxNum; +--- pdfium/core/fpdfdoc/cpvt_variabletext.cpp.orig 2025-11-12 11:28:21.534664730 +0100 ++++ pdfium/core/fpdfdoc/cpvt_variabletext.cpp 2025-11-12 11:27:51.960710697 +0100 +@@ -26,9 +26,9 @@ + constexpr float kFontScale = 0.001f; + constexpr uint8_t kReturnLength = 1; + +-constexpr auto kFontSizeSteps = fxcrt::ToArray<const uint8_t>( ++std::array<const uint8_t, 25> kFontSizeSteps = + {4, 6, 8, 9, 10, 12, 14, 18, 20, 25, 30, 35, 40, +- 45, 50, 55, 60, 70, 80, 90, 100, 110, 120, 130, 144}); ++ 45, 50, 55, 60, 70, 80, 90, 100, 110, 120, 130, 144}; + + } // namespace + diff --git a/external/pdfium/inc/pch/precompiled_pdfium.hxx b/external/pdfium/inc/pch/precompiled_pdfium.hxx index 5b94cea8372d..ef0860bee248 100644 --- a/external/pdfium/inc/pch/precompiled_pdfium.hxx +++ b/external/pdfium/inc/pch/precompiled_pdfium.hxx @@ -37,6 +37,7 @@ #include <cmath> #include <ctype.h> #include <functional> +#include <initializer_list> #include <iterator> #include <limits.h> #include <limits> @@ -53,7 +54,6 @@ #include <setjmp.h> #include <sstream> #include <stack> -#include <stdarg.h> #include <stddef.h> #include <stdint.h> #include <stdlib.h> @@ -91,8 +91,11 @@ #include <core/fpdfapi/cmaps/fpdf_cmaps.h> #include <core/fpdfapi/edit/cpdf_contentstream_write_utils.h> #include <core/fpdfapi/edit/cpdf_creator.h> +#include <core/fpdfapi/edit/cpdf_npagetooneexporter.h> #include <core/fpdfapi/edit/cpdf_pagecontentgenerator.h> #include <core/fpdfapi/edit/cpdf_pagecontentmanager.h> +#include <core/fpdfapi/edit/cpdf_pageexporter.h> +#include <core/fpdfapi/edit/cpdf_pageorganizer.h> #include <core/fpdfapi/edit/cpdf_stringarchivestream.h> #include <core/fpdfapi/font/cfx_cttgsubtable.h> #include <core/fpdfapi/font/cfx_stockfontarray.h> @@ -368,7 +371,10 @@ #include <core/fxcrt/xml/cfx_xmlnode.h> #include <core/fxcrt/xml/cfx_xmlparser.h> #include <core/fxcrt/xml/cfx_xmltext.h> -#include <core/fxge/agg/fx_agg_driver.h> +#include <core/fxcrt/zip.h> +#include <core/fxge/agg/cfx_agg_bitmapcomposer.h> +#include <core/fxge/agg/cfx_agg_devicedriver.h> +#include <core/fxge/agg/cfx_agg_imagerenderer.h> #include <core/fxge/calculate_pitch.h> #include <core/fxge/cfx_cliprgn.h> #include <core/fxge/cfx_color.h> @@ -392,12 +398,10 @@ #include <core/fxge/cfx_textrenderoptions.h> #include <core/fxge/cfx_unicodeencoding.h> #include <core/fxge/dib/blend.h> -#include <core/fxge/dib/cfx_bitmapcomposer.h> #include <core/fxge/dib/cfx_bitmapstorer.h> #include <core/fxge/dib/cfx_cmyk_to_srgb.h> #include <core/fxge/dib/cfx_dibbase.h> #include <core/fxge/dib/cfx_dibitmap.h> -#include <core/fxge/dib/cfx_imagerenderer.h> #include <core/fxge/dib/cfx_imagestretcher.h> #include <core/fxge/dib/cfx_imagetransformer.h> #include <core/fxge/dib/cfx_scanlinecompositor.h> diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx index d9c478f9f31c..30525179f783 100644 --- a/svx/source/svdraw/svdpdf.cxx +++ b/svx/source/svdraw/svdpdf.cxx @@ -827,7 +827,7 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT pPageObject, FPDF_TEXTPAGE pTex const int nFontName = 80 + 1; std::unique_ptr<char[]> pFontName(new char[nFontName]); // + terminating null FPDF_FONT pFontObject = FPDFTextObj_GetFont(pPageObject); - int nFontNameChars = FPDFFont_GetFontName(pFontObject, pFontName.get(), nFontName); + int nFontNameChars = FPDFFont_GetFamilyName(pFontObject, pFontName.get(), nFontName); if (nFontName >= nFontNameChars) { OUString sFontName = OUString::createFromAscii(pFontName.get()); commit a9d6fa79078c0aa85e69c25a9f9265dc2610cb20 Author: Miklos Vajna <[email protected]> AuthorDate: Fri Jun 14 08:23:58 2024 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Wed Nov 12 17:55:49 2025 +0100 Update pdfium to 6536 Drop part of build.patch.1, which is no longer needed. (cherry picked from commit 99500569187101cd47b2a491ca8d8878eb034b2e) Conflicts: external/pdfium/system-abseil.diff Change-Id: Ie68364d473d344904fd55ced2cd0915534fa816c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169458 Reviewed-by: Mike Kaganski <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> (cherry picked from commit 6d91efc9c90cd4354af17cb1cb6f40d992d98799) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193823 Tested-by: allotropia jenkins <[email protected]> Reviewed-by: Michael Stahl <[email protected]> diff --git a/download.lst b/download.lst index ca5e86470beb..a05d129cb1f8 100644 --- a/download.lst +++ b/download.lst @@ -455,8 +455,8 @@ PAGEMAKER_TARBALL := libpagemaker-0.0.4.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts -PDFIUM_SHA256SUM := fe0291b96d7352bac530d13ef2e5fd63ad9980e0128911f88b957b5992508f1c -PDFIUM_TARBALL := pdfium-6425.tar.bz2 +PDFIUM_SHA256SUM := 9c2db89e9ea96f632108170bce7d901dbfc773bb09d03b7cd0ac68ebe26b9092 +PDFIUM_TARBALL := pdfium-6536.tar.bz2 # three static lines # so that git cherry-pick # will not run into conflicts diff --git a/external/pdfium/Library_pdfium.mk b/external/pdfium/Library_pdfium.mk index 2a7bec394026..9e1d6b4ea217 100644 --- a/external/pdfium/Library_pdfium.mk +++ b/external/pdfium/Library_pdfium.mk @@ -372,6 +372,7 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/core/fxcodec/icc/icc_transform \ UnpackedTarball/pdfium/core/fxcodec/jbig2/jbig2_decoder \ UnpackedTarball/pdfium/core/fxcodec/jpeg/jpeg_common \ + UnpackedTarball/pdfium/core/fxcodec/data_and_bytes_consumed \ )) # fxcrt diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1 index 373cb15d2b26..5db8fb649598 100644 --- a/external/pdfium/build.patch.1 +++ b/external/pdfium/build.patch.1 @@ -25,7 +25,7 @@ index 31564f45f..5858549ef 100644 DCHECK_EQ(k1, FXSYS_roundf(k * 255)); +#endif - FX_RGB<uint8_t> int_results = AdobeCMYK_to_sRGB1(c1, m1, y1, k1); + FX_RGB_STRUCT<uint8_t> int_results = AdobeCMYK_to_sRGB1(c1, m1, y1, k1); // Multiply by a constant rather than dividing because division is much diff --git a/core/fxcodec/jpx/cjpx_decoder.cpp b/core/fxcodec/jpx/cjpx_decoder.cpp index 2e7a72aa1..65fb3deaa 100644 @@ -75,19 +75,6 @@ index 44c921a14..0152a89b7 100644 // TODO(jschuh): Debug builds don't reliably propagate constants, so we restrict // some accelerated runtime paths to release builds until this can be forced -diff --git a/third_party/libopenjpeg/openjpeg.c b/third_party/libopenjpeg/openjpeg.c -index 9dd4256d7..949d65830 100644 ---- a/third_party/libopenjpeg/openjpeg.c -+++ b/third_party/libopenjpeg/openjpeg.c -@@ -358,7 +358,7 @@ OPJ_BOOL OPJ_CALLCONV opj_setup_decoder(opj_codec_t *p_codec, - return OPJ_FALSE; - } - --OPJ_API OPJ_BOOL OPJ_CALLCONV opj_decoder_set_strict_mode(opj_codec_t *p_codec, -+OPJ_BOOL OPJ_CALLCONV opj_decoder_set_strict_mode(opj_codec_t *p_codec, - OPJ_BOOL strict) - { - if (p_codec) { diff --git a/core/fxge/cfx_face.cpp b/core/fxge/cfx_face.cpp index 7d9cd0f44..0d0a311aa 100644 --- a/core/fxge/cfx_face.cpp @@ -101,3 +88,47 @@ index 7d9cd0f44..0d0a311aa 100644 } FX_RECT CFX_Face::GetCharBBox(uint32_t code, int glyph_index) { +diff --git a/core/fpdfdoc/cpdf_action.cpp b/core/fpdfdoc/cpdf_action.cpp +index a5b687d76..076a260d5 100644 +--- a/core/fpdfdoc/cpdf_action.cpp ++++ b/core/fpdfdoc/cpdf_action.cpp +@@ -21,7 +21,7 @@ + + namespace { + +-constexpr auto kActionTypeStrings = fxcrt::ToArray<const char*>({ ++std::array<const char*, 18> kActionTypeStrings = { + "GoTo", + "GoToR", + "GoToE", +@@ -40,7 +40,7 @@ constexpr auto kActionTypeStrings = fxcrt::ToArray<const char*>({ + "Rendition", + "Trans", + "GoTo3DView", +-}); ++}; + + } // namespace + +diff --git a/core/fpdfdoc/cpdf_dest.cpp b/core/fpdfdoc/cpdf_dest.cpp +index 8026a75d5..34c20d62f 100644 +--- a/core/fpdfdoc/cpdf_dest.cpp ++++ b/core/fpdfdoc/cpdf_dest.cpp +@@ -21,12 +21,12 @@ namespace { + + // These arrays are indexed by the PDFDEST_VIEW_* constants. + +-constexpr auto kZoomModes = +- fxcrt::ToArray<const char*>({"Unknown", "XYZ", "Fit", "FitH", "FitV", +- "FitR", "FitB", "FitBH", "FitBV"}); ++std::array<const char*, 9> kZoomModes = { ++ "Unknown", "XYZ", "Fit", "FitH", "FitV", ++ "FitR", "FitB", "FitBH", "FitBV"}; + +-constexpr auto kZoomModeMaxParamCount = +- fxcrt::ToArray<const uint8_t>({0, 3, 0, 1, 1, 4, 0, 1, 1}); ++std::array<const uint8_t, 9> kZoomModeMaxParamCount = ++ {0, 3, 0, 1, 1, 4, 0, 1, 1}; + + } // namespace + diff --git a/external/pdfium/buildfix-7.patch.1 b/external/pdfium/buildfix-7.patch.1 index b34f417ea0dd..e36e95b43d20 100644 --- a/external/pdfium/buildfix-7.patch.1 +++ b/external/pdfium/buildfix-7.patch.1 @@ -31,3 +31,116 @@ pdfium/core/fpdfdoc/cpdf_formcontrol.cpp:134: undefined reference to `fxcrt::Str return fxge::FontEncoding::kGB2312; case FT_ENCODING_JOHAB: return fxge::FontEncoding::kJohab; +--- pdfium/core/fdrm/fx_crypt_sha.cpp.orig 2025-11-11 17:53:34.095920155 +0100 ++++ pdfium/core/fdrm/fx_crypt_sha.cpp 2025-11-11 17:55:25.689875991 +0100 +@@ -271,7 +271,16 @@ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + }; + ++#ifdef __GNUC__ ++template <size_t N> ++constexpr std::array<uint64_t, N> ToArrayULL(const unsigned long long (&data)[N]) { ++ return fxcrt::ToArrayImpl<uint64_t>(data, std::make_index_sequence<N>()); ++} ++ ++constexpr auto constants = ToArrayULL({ ++#else + constexpr auto constants = fxcrt::ToArray<const uint64_t>({ ++#endif + 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, 0xb5c0fbcfec4d3b2fULL, + 0xe9b5dba58189dbbcULL, 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL, + 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL, 0xd807aa98a3030242ULL, +--- pdfium/core/fpdfapi/parser/fpdf_parser_decode.cpp.orig 2025-11-11 18:07:41.549916141 +0100 ++++ pdfium/core/fpdfapi/parser/fpdf_parser_decode.cpp 2025-11-11 18:08:01.711043241 +0100 +@@ -449,7 +449,7 @@ + if (bImageAcc && i == nSize - 1) { + result.image_encoding = "FlateDecode"; + result.image_params = std::move(pParam); +- return result; ++ std::optional<PDFDataDecodeResult> ret; ret = std::move(result); return ret; + } + DataAndBytesConsumed decode_result = FlateOrLZWDecode( + /*use_lzw=*/false, last_span, pParam, estimated_size); +@@ -472,7 +472,7 @@ + if (bImageAcc && i == nSize - 1) { + result.image_encoding = "RunLengthDecode"; + result.image_params = std::move(pParam); +- return result; ++ std::optional<PDFDataDecodeResult> ret; ret = std::move(result); return ret; + } + DataAndBytesConsumed decode_result = RunLengthDecode(last_span); + new_buf = std::move(decode_result.data); +@@ -486,7 +486,7 @@ + } + result.image_encoding = std::move(decoder); + result.image_params = std::move(pParam); +- return result; ++ std::optional<PDFDataDecodeResult> ret; ret = std::move(result); return ret; + } + if (bytes_consumed == FX_INVALID_OFFSET) { + return std::nullopt; +@@ -498,7 +498,7 @@ + + result.image_encoding.clear(); + result.image_params = nullptr; +- return result; ++ std::optional<PDFDataDecodeResult> ret; ret = std::move(result); return ret; + } + + static size_t StripLanguageCodes(pdfium::span<wchar_t> s, size_t n) { +--- pdfium/core/fxge/cfx_face.cpp.orig2 2025-11-11 18:44:37.469693380 +0100 ++++ pdfium/core/fxge/cfx_face.cpp 2025-11-11 18:53:20.076562115 +0100 +@@ -51,7 +51,7 @@ + // Boundary value to avoid integer overflow when adding 1/64th of the value. + constexpr int kMaxRectTop = 2114445437; + +-constexpr auto kWeightPow = fxcrt::ToArray<const uint8_t>({ ++std::array<const uint8_t, 100> kWeightPow = { + 0, 6, 12, 14, 16, 18, 22, 24, 28, 30, 32, 34, 36, 38, 40, + 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, + 70, 72, 72, 74, 74, 74, 76, 76, 76, 78, 78, 78, 80, 80, 80, +@@ -59,18 +59,18 @@ + 90, 90, 90, 92, 92, 92, 92, 94, 94, 94, 94, 96, 96, 96, 96, + 96, 98, 98, 98, 98, 100, 100, 100, 100, 100, 102, 102, 102, 102, 102, + 104, 104, 104, 104, 104, 106, 106, 106, 106, 106, +-}); ++}; + +-constexpr auto kWeightPow11 = fxcrt::ToArray<const uint8_t>({ ++std::array<const uint8_t, 100> kWeightPow11 = { + 0, 4, 7, 8, 9, 10, 12, 13, 15, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 39, 39, 40, 40, 41, + 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, 45, 45, 45, 46, 46, 46, + 46, 43, 47, 47, 48, 48, 48, 48, 45, 50, 50, 50, 46, 51, 51, 51, 52, + 52, 52, 52, 53, 53, 53, 53, 53, 54, 54, 54, 54, 55, 55, 55, 55, 55, + 56, 56, 56, 56, 56, 57, 57, 57, 57, 57, 58, 58, 58, 58, 58, +-}); ++}; + +-constexpr auto kWeightPowShiftJis = fxcrt::ToArray<const uint8_t>({ ++std::array<const uint8_t, 100> kWeightPowShiftJis = { + 0, 0, 2, 4, 6, 8, 10, 14, 16, 20, 22, 26, 28, 32, 34, + 38, 42, 44, 48, 52, 56, 60, 64, 66, 70, 74, 78, 82, 86, 90, + 96, 96, 96, 96, 98, 98, 98, 100, 100, 100, 100, 102, 102, 102, 102, +@@ -78,7 +78,7 @@ + 110, 110, 110, 110, 110, 112, 112, 112, 112, 112, 112, 114, 114, 114, 114, + 114, 114, 114, 116, 116, 116, 116, 116, 116, 116, 118, 118, 118, 118, 118, + 118, 118, 120, 120, 120, 120, 120, 120, 120, 120, +-}); ++}; + + constexpr size_t kWeightPowArraySize = 100; + static_assert(kWeightPowArraySize == std::size(kWeightPow), "Wrong size"); +@@ -86,10 +86,10 @@ + static_assert(kWeightPowArraySize == std::size(kWeightPowShiftJis), + "Wrong size"); + +-constexpr auto kAngleSkew = fxcrt::ToArray<const int8_t>({ ++std::array<const int8_t, 30> kAngleSkew = { + -0, -2, -3, -5, -7, -9, -11, -12, -14, -16, -18, -19, -21, -23, -25, + -27, -29, -31, -32, -34, -36, -38, -40, -42, -45, -47, -49, -51, -53, -55, +-}); ++}; + + // Returns negative values on failure. + int GetWeightLevel(FX_Charset charset, size_t index) { diff --git a/external/pdfium/inc/pch/precompiled_pdfium.hxx b/external/pdfium/inc/pch/precompiled_pdfium.hxx index f3e3330c65f4..5b94cea8372d 100644 --- a/external/pdfium/inc/pch/precompiled_pdfium.hxx +++ b/external/pdfium/inc/pch/precompiled_pdfium.hxx @@ -82,6 +82,8 @@ #include <constants/stream_dict_common.h> #include <constants/transparency.h> #include <core/fdrm/fx_crypt.h> +#include <core/fdrm/fx_crypt_aes.h> +#include <core/fdrm/fx_crypt_sha.h> #include <core/fpdfapi/cmaps/CNS1/cmaps_cns1.h> #include <core/fpdfapi/cmaps/GB1/cmaps_gb1.h> #include <core/fpdfapi/cmaps/Japan1/cmaps_japan1.h> @@ -244,6 +246,7 @@ #include <core/fpdftext/unicodenormalizationdata.h> #include <core/fxcodec/basic/basicmodule.h> #include <core/fxcodec/cfx_codec_memory.h> +#include <core/fxcodec/data_and_bytes_consumed.h> #include <core/fxcodec/fax/faxmodule.h> #include <core/fxcodec/flate/flatemodule.h> #include <core/fxcodec/fx_codec.h> commit 2b6cd39d7630c3850a6ecab895c07953dc02a553 Author: Miklos Vajna <[email protected]> AuthorDate: Mon Apr 22 08:17:09 2024 +0200 Commit: Michael Stahl <[email protected]> CommitDate: Wed Nov 12 17:55:46 2025 +0100 Update pdfium to 6425 Drop parts of build.patch.1 and the entire include.patch, which are probably obsolete and don't apply anymore. (cherry picked from commit 116ac059a3c30146d7a30bd917e048256f7b3cd8) Conflicts: external/pdfium/UnpackedTarball_pdfium.mk Change-Id: I18c8d5e2ee97c7793e75ac0e47b5705b99585d59 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169457 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Mike Kaganski <[email protected]> (cherry picked from commit d1f29087cca44a4b7ba36fce4d759f72b57082b6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193822 Reviewed-by: Michael Stahl <[email protected]> Tested-by: allotropia jenkins <[email protected]> diff --git a/download.lst b/download.lst index 5f74128f58ab..ca5e86470beb 100644 --- a/download.lst +++ b/download.lst @@ -455,8 +455,8 @@ PAGEMAKER_TARBALL := libpagemaker-0.0.4.tar.xz # three static lines # so that git cherry-pick # will not run into conflicts -PDFIUM_SHA256SUM := 6bc4dac8f1ef646a9bbd50848cb3fb8a108087ed6b3973bbee5846dc371b646d -PDFIUM_TARBALL := pdfium-6296.tar.bz2 +PDFIUM_SHA256SUM := fe0291b96d7352bac530d13ef2e5fd63ad9980e0128911f88b957b5992508f1c +PDFIUM_TARBALL := pdfium-6425.tar.bz2 # three static lines # so that git cherry-pick # will not run into conflicts diff --git a/external/pdfium/Library_pdfium.mk b/external/pdfium/Library_pdfium.mk index ec4363332f0f..2a7bec394026 100644 --- a/external/pdfium/Library_pdfium.mk +++ b/external/pdfium/Library_pdfium.mk @@ -428,6 +428,8 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/core/fxcrt/cfx_read_only_vector_stream \ UnpackedTarball/pdfium/core/fxcrt/fx_memory_malloc \ UnpackedTarball/pdfium/core/fxcrt/widetext_buffer \ + UnpackedTarball/pdfium/core/fxcrt/debug/alias \ + UnpackedTarball/pdfium/core/fxcrt/string_template \ )) # fxge @@ -567,12 +569,6 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/third_party/libopenjpeg/opj_malloc \ )) -# pdfium_base -$(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ - UnpackedTarball/pdfium/third_party/base/debug/alias \ - UnpackedTarball/pdfium/third_party/base/memory/aligned_memory \ -)) - $(eval $(call gb_Library_use_externals,pdfium,\ libjpeg \ lcms2 \ @@ -651,7 +647,8 @@ $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\ UnpackedTarball/pdfium/core/fxge/cfx_windowsrenderdevice \ UnpackedTarball/pdfium/core/fxcrt/cfx_fileaccess_windows \ UnpackedTarball/pdfium/core/fxcrt/fx_folder_windows \ - UnpackedTarball/pdfium/third_party/base/win/win_util \ + UnpackedTarball/pdfium/core/fxcrt/win/win_util \ + UnpackedTarball/pdfium/core/fxcrt/code_point_view \ UnpackedTarball/pdfium/core/fpdfapi/render/cpdf_windowsrenderdevice \ )) diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk index fbfa196bba69..e70ea82d0183 100644 --- a/external/pdfium/UnpackedTarball_pdfium.mk +++ b/external/pdfium/UnpackedTarball_pdfium.mk @@ -33,9 +33,8 @@ $(eval $(call gb_UnpackedTarball_set_post_action,pdfium,\ mv third_party/bigint/BigIntegerUtils.cc third_party/bigint/BigIntegerUtils.cpp && \ mv third_party/bigint/BigUnsigned.cc third_party/bigint/BigUnsigned.cpp && \ mv third_party/bigint/BigUnsignedInABase.cc third_party/bigint/BigUnsignedInABase.cpp && \ - mv third_party/base/debug/alias.cc third_party/base/debug/alias.cpp && \ - mv third_party/base/memory/aligned_memory.cc third_party/base/memory/aligned_memory.cpp && \ - mv third_party/base/win/win_util.cc third_party/base/win/win_util.cpp && \ + mv core/fxcrt/debug/alias.cc core/fxcrt/debug/alias.cpp && \ + mv core/fxcrt/win/win_util.cc core/fxcrt/win/win_util.cpp && \ mv third_party/libopenjpeg/opj_malloc.cc third_party/libopenjpeg/opj_malloc.cpp && \ mv third_party/abseil-cpp/absl/types/bad_optional_access.cc third_party/abseil-cpp/absl/types/bad_optional_access.cpp && \ mv third_party/abseil-cpp/absl/types/bad_variant_access.cc third_party/abseil-cpp/absl/types/bad_variant_access.cpp \ diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1 index c34920ac6627..373cb15d2b26 100644 --- a/external/pdfium/build.patch.1 +++ b/external/pdfium/build.patch.1 @@ -15,8 +15,8 @@ index 31564f45f..5858549ef 100644 --- a/core/fxge/dib/cfx_cmyk_to_srgb.cpp 2020-09-10 17:32:37.165872018 +0200 +++ b/core/fxge/dib/cfx_cmyk_to_srgb.cpp 2020-09-10 17:33:15.870395738 +0200 @@ -1740,10 +1740,12 @@ - uint8_t y1 = static_cast<int>(y * 255.f + rounding_offset); - uint8_t k1 = static_cast<int>(k * 255.f + rounding_offset); + uint8_t y1 = static_cast<int>(y * 255.f + kRoundingOffset); + uint8_t k1 = static_cast<int>(k * 255.f + kRoundingOffset); +#ifndef _WIN32 DCHECK_EQ(c1, FXSYS_roundf(c * 255)); @@ -25,8 +25,8 @@ index 31564f45f..5858549ef 100644 DCHECK_EQ(k1, FXSYS_roundf(k * 255)); +#endif - uint8_t r; - uint8_t g; + FX_RGB<uint8_t> int_results = AdobeCMYK_to_sRGB1(c1, m1, y1, k1); + // Multiply by a constant rather than dividing because division is much diff --git a/core/fxcodec/jpx/cjpx_decoder.cpp b/core/fxcodec/jpx/cjpx_decoder.cpp index 2e7a72aa1..65fb3deaa 100644 --- a/core/fxcodec/jpx/cjpx_decoder.cpp @@ -40,10 +40,10 @@ index 2e7a72aa1..65fb3deaa 100644 } void sycc_to_rgb(int offset, -diff --git a/third_party/base/containers/span.h b/third_party/base/containers/span.h +diff --git a/core/fxcrt/span.h b/core/fxcrt/span.h index 435fafa85..d8e8bfbc4 100644 ---- a/third_party/base/containers/span.h -+++ b/third_party/base/containers/span.h +--- a/core/fxcrt/span.h ++++ b/core/fxcrt/span.h @@ -211,7 +211,7 @@ class TRIVIAL_ABI GSL_POINTER span { #else template <typename Container, @@ -54,18 +54,18 @@ index 435fafa85..d8e8bfbc4 100644 #endif @@ -225,7 +225,7 @@ class TRIVIAL_ABI GSL_POINTER span { - // Conversions from spans of compatible types: this allows a span<T> to be - // seamlessly used as a span<const T>, but not the other way around. - template <typename U, typename = internal::EnableIfLegalSpanConversion<U, T>> -- constexpr span(const span<U>& other) : span(other.data(), other.size()) {} -+ span(const span<U>& other) : span(other.data(), other.size()) {} + size_t M, + typename R, + typename = internal::EnableIfLegalSpanConversion<U, T>> +- constexpr span(const span<U, M, R>& other) ++ span(const span<U, M, R>& other) + : span(other.data(), other.size()) {} + span& operator=(const span& other) noexcept { - if (this != &other) { - data_ = other.data_; -diff --git a/third_party/base/numerics/safe_conversions_impl.h b/third_party/base/numerics/safe_conversions_impl.h +diff --git a/core/fxcrt/numerics/safe_conversions_impl.h b/core/fxcrt/numerics/safe_conversions_impl.h index 44c921a14..0152a89b7 100644 ---- a/third_party/base/numerics/safe_conversions_impl.h -+++ b/third_party/base/numerics/safe_conversions_impl.h +--- a/core/fxcrt/numerics/safe_conversions_impl.h ++++ b/core/fxcrt/numerics/safe_conversions_impl.h @@ -89,7 +89,7 @@ constexpr typename std::make_unsigned<T>::type SafeUnsignedAbs(T value) { // TODO(jschuh): Switch to std::is_constant_evaluated() once C++20 is supported. diff --git a/external/pdfium/buildfix-7.patch.1 b/external/pdfium/buildfix-7.patch.1 index 8285d4a147fa..b34f417ea0dd 100644 --- a/external/pdfium/buildfix-7.patch.1 +++ b/external/pdfium/buildfix-7.patch.1 @@ -8,9 +8,9 @@ pdfium/core/fpdfdoc/cpdf_formcontrol.cpp:134: undefined reference to `fxcrt::Str // NOLINTNEXTLINE(runtime/explicit) - constexpr StringViewTemplate(const CharType& ch) noexcept + StringViewTemplate(const CharType& ch) noexcept - : m_Span(reinterpret_cast<const UnsignedType*>(&ch), 1u) {} + : m_Span( + reinterpret_span<const UnsignedType>(pdfium::span_from_ref(ch))) {} - StringViewTemplate& operator=(const CharType* src) { --- pdfium/core/fxge/cfx_face.cpp.orig 2025-11-11 13:42:28.181052508 +0100 +++ pdfium/core/fxge/cfx_face.cpp 2025-11-11 13:45:12.583343976 +0100 @@ -227,7 +227,7 @@ diff --git a/external/pdfium/inc/pch/precompiled_pdfium.hxx b/external/pdfium/inc/pch/precompiled_pdfium.hxx index 083b05571de5..f3e3330c65f4 100644 --- a/external/pdfium/inc/pch/precompiled_pdfium.hxx +++ b/external/pdfium/inc/pch/precompiled_pdfium.hxx @@ -277,6 +277,7 @@ #include <core/fxcrt/autonuller.h> #include <core/fxcrt/autorestorer.h> #include <core/fxcrt/binary_buffer.h> +#include <core/fxcrt/byteorder.h> #include <core/fxcrt/bytestring.h> #include <core/fxcrt/cfx_bitstream.h> #include <core/fxcrt/cfx_datetime.h> @@ -286,7 +287,12 @@ #include <core/fxcrt/cfx_read_only_vector_stream.h> #include <core/fxcrt/cfx_seekablestreamproxy.h> #include <core/fxcrt/cfx_timer.h> +#include <core/fxcrt/check.h> +#include <core/fxcrt/check_op.h> #include <core/fxcrt/code_point_view.h> +#include <core/fxcrt/compiler_specific.h> +#include <core/fxcrt/containers/adapters.h> +#include <core/fxcrt/containers/contains.h> #include <core/fxcrt/css/cfx_css.h> #include <core/fxcrt/css/cfx_csscolorvalue.h> #include <core/fxcrt/css/cfx_csscomputedstyle.h> @@ -309,6 +315,7 @@ #include <core/fxcrt/css/cfx_cssvaluelist.h> #include <core/fxcrt/css/cfx_cssvaluelistparser.h> #include <core/fxcrt/data_vector.h> +#include <core/fxcrt/debug/alias.h> #include <core/fxcrt/fileaccess_iface.h> #include <core/fxcrt/fixed_size_data_vector.h> #include <core/fxcrt/fx_2d_size.h> @@ -329,14 +336,22 @@ #include <core/fxcrt/fx_system.h> #include <core/fxcrt/fx_unicode.h> #include <core/fxcrt/maybe_owned.h> +#include <core/fxcrt/notreached.h> +#include <core/fxcrt/numerics/clamped_math.h> +#include <core/fxcrt/numerics/safe_conversions.h> +#include <core/fxcrt/numerics/safe_math.h> #include <core/fxcrt/observed_ptr.h> #include <core/fxcrt/pauseindicator_iface.h> +#include <core/fxcrt/ptr_util.h> +#include <core/fxcrt/raw_span.h> #include <core/fxcrt/retain_ptr.h> #include <core/fxcrt/scoped_set_insertion.h> +#include <core/fxcrt/span.h> #include <core/fxcrt/span_util.h> #include <core/fxcrt/stl_util.h> #include <core/fxcrt/string_data_template.h> #include <core/fxcrt/string_pool_template.h> +#include <core/fxcrt/string_template.h> #include <core/fxcrt/string_view_template.h> #include <core/fxcrt/unowned_ptr.h> #include <core/fxcrt/unowned_ptr_exclusion.h> @@ -468,19 +483,6 @@ #include <third_party/agg23/agg_rasterizer_scanline_aa.h> #include <third_party/agg23/agg_renderer_scanline.h> #include <third_party/agg23/agg_scanline_u.h> -#include <third_party/base/check.h> -#include <third_party/base/check_op.h> -#include <third_party/base/compiler_specific.h> -#include <third_party/base/containers/adapters.h> -#include <third_party/base/containers/contains.h> -#include <third_party/base/containers/span.h> -#include <third_party/base/debug/alias.h> -#include <third_party/base/memory/aligned_memory.h> -#include <third_party/base/memory/ptr_util.h> -#include <third_party/base/notreached.h> -#include <third_party/base/numerics/clamped_math.h> -#include <third_party/base/numerics/safe_conversions.h> -#include <third_party/base/numerics/safe_math.h> #endif // PCH_LEVEL >= 3 #if PCH_LEVEL >= 4 #endif // PCH_LEVEL >= 4 diff --git a/external/pdfium/windows7.patch.1 b/external/pdfium/windows7.patch.1 index d33f273ff4ca..9c82a8a34d49 100644 --- a/external/pdfium/windows7.patch.1 +++ b/external/pdfium/windows7.patch.1 @@ -1,9 +1,9 @@ -diff --git a/third_party/base/win/win_util.cc b/third_party/base/win/win_util.cc -index ae2dba84d..7a3718848 100644 ---- a/third_party/base/win/win_util.cc -+++ b/third_party/base/win/win_util.cc -@@ -12,28 +12,7 @@ namespace base { - namespace win { +diff --git a/core/fxcrt/win/win_util.cc b/core/fxcrt/win/win_util.cc +index 43e9151d1..76657ac0a 100644 +--- a/core/fxcrt/win/win_util.cc ++++ b/core/fxcrt/win/win_util.cc +@@ -10,28 +10,7 @@ + namespace pdfium { bool IsUser32AndGdi32Available() { - static auto is_user32_and_gdi32_available = []() { @@ -31,4 +31,4 @@ index ae2dba84d..7a3718848 100644 + return true; } - } // namespace win + } // namespace pdfium commit d8101a2f76899e1f7dfd4ec24baafdae843b7fd1 Author: Michael Stahl <[email protected]> AuthorDate: Wed Nov 12 09:17:51 2025 +0100 Commit: Michael Stahl <[email protected]> CommitDate: Wed Nov 12 17:55:43 2025 +0100 pdfium: try to use -std:c++20 with MSVC Change-Id: I1f1eb83093181b947bcb5c4b78242a9b00d6c60a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193840 Tested-by: allotropia jenkins <[email protected]> Reviewed-by: Michael Stahl <[email protected]> diff --git a/external/pdfium/Library_pdfium.mk b/external/pdfium/Library_pdfium.mk index d7bb11b2d847..ec4363332f0f 100644 --- a/external/pdfium/Library_pdfium.mk +++ b/external/pdfium/Library_pdfium.mk @@ -15,6 +15,13 @@ $(eval $(call gb_Library_set_warnings_disabled,pdfium)) $(eval $(call gb_Library_set_precompiled_header,pdfium,external/pdfium/inc/pch/precompiled_pdfium)) +# force C++20 with MSVC +ifneq ($(filter -std:c++17,$(CXXFLAGS_CXX11)),) +$(eval $(call gb_Library_add_cxxflags,pdfium, \ + -std:c++20 \ +)) +endif + $(eval $(call gb_Library_set_include,pdfium,\ -I$(call gb_UnpackedTarball_get_dir,pdfium) \ -I$(call gb_UnpackedTarball_get_dir,pdfium)/third_party \
