Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / external / pdfium / build.patch.1
blob2c177b3b61a4991fc1c8b1da25682d017117f254
1 -*- Mode: diff -*-
2 diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
3 index f5a51b24e..8b308d0a6 100644
4 --- a/core/fpdfapi/font/cpdf_cidfont.cpp
5 +++ b/core/fpdfapi/font/cpdf_cidfont.cpp
6 @@ -755,7 +755,7 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
7          uint32_t maccode = CharCodeFromUnicodeForFreetypeEncoding(
8              FT_ENCODING_APPLE_ROMAN, name_unicode);
9          index = maccode ? FT_Get_Char_Index(face, maccode)
10 -                        : FT_Get_Name_Index(face, name);
11 +                        : FT_Get_Name_Index(face, const_cast<char*>(name));
12        }
13        if (index == 0 || index == 0xffff)
14          return charcode ? static_cast<int>(charcode) : -1;
15 diff --git a/core/fpdfapi/font/cpdf_truetypefont.cpp b/core/fpdfapi/font/cpdf_truetypefont.cpp
16 index 0a59b54eb..a96e11759 100644
17 --- a/core/fpdfapi/font/cpdf_truetypefont.cpp
18 +++ b/core/fpdfapi/font/cpdf_truetypefont.cpp
19 @@ -91,7 +91,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
20                FT_ENCODING_APPLE_ROMAN,
21                m_Encoding.UnicodeFromCharCode(charcode));
22            if (!maccode) {
23 -            m_GlyphIndex[charcode] = FT_Get_Name_Index(face, name);
24 +            m_GlyphIndex[charcode] = FT_Get_Name_Index(face, const_cast<char*>(name));
25            } else {
26              m_GlyphIndex[charcode] = FT_Get_Char_Index(face, maccode);
27            }
28 @@ -105,7 +105,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
29          m_GlyphIndex[charcode] = FT_Get_Char_Index(face, 32);
30          continue;
31        }
32 -      m_GlyphIndex[charcode] = FT_Get_Name_Index(face, name);
33 +      m_GlyphIndex[charcode] = FT_Get_Name_Index(face, const_cast<char*>(name));
34        if (m_GlyphIndex[charcode] != 0 || !bToUnicode)
35          continue;
37 diff --git a/core/fpdfapi/font/cpdf_type1font.cpp b/core/fpdfapi/font/cpdf_type1font.cpp
38 index 55510e7d7..2f13f00b8 100644
39 --- a/core/fpdfapi/font/cpdf_type1font.cpp
40 +++ b/core/fpdfapi/font/cpdf_type1font.cpp
41 @@ -263,7 +263,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
42                                            static_cast<uint32_t>(charcode));
43        if (name) {
44          m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
45 -        m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), name);
46 +        m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), const_cast<char*>(name));
47        } else {
48          m_GlyphIndex[charcode] = FT_Get_Char_Index(
49              m_Font.GetFaceRec(), static_cast<uint32_t>(charcode));
50 @@ -294,7 +294,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
51        continue;
53      m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
54 -    m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), name);
55 +    m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), const_cast<char*>(name));
56      if (m_GlyphIndex[charcode] != 0)
57        continue;
59 diff --git a/core/fpdfdoc/cpdf_metadata.cpp b/core/fpdfdoc/cpdf_metadata.cpp
60 index 228a0c137..bf512beb3 100644
61 --- a/core/fpdfdoc/cpdf_metadata.cpp
62 +++ b/core/fpdfdoc/cpdf_metadata.cpp
63 @@ -77,7 +77,7 @@ std::vector<UnsupportedFeature> CPDF_Metadata::CheckForSharedForm() const {
64    CFX_XMLParser parser(stream);
65    std::unique_ptr<CFX_XMLDocument> doc = parser.Parse();
66    if (!doc)
67 -    return {};
68 +    return std::vector<UnsupportedFeature>();
70    std::vector<UnsupportedFeature> unsupported;
71    CheckForSharedFormInternal(doc->GetRoot(), &unsupported);
72 diff --git a/core/fxcodec/jpx/cjpx_decoder.cpp b/core/fxcodec/jpx/cjpx_decoder.cpp
73 index 9391d61ab..490ce2230 100644
74 --- a/core/fxcodec/jpx/cjpx_decoder.cpp
75 +++ b/core/fxcodec/jpx/cjpx_decoder.cpp
76 @@ -75,7 +75,7 @@ absl::optional<OpjImageRgbData> alloc_rgb(size_t size) {
77    if (!data.b)
78      return absl::nullopt;
80 -  return data;
81 +  return std::move(data);
82  }
84  void sycc_to_rgb(int offset,
85 diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
86 index a2a44df39..d6cedee46 100644
87 --- a/core/fxge/cfx_font.cpp
88 +++ b/core/fxge/cfx_font.cpp
89 @@ -48,25 +48,9 @@ struct OUTLINE_PARAMS {
90  // TODO(crbug.com/pdfium/1400): When FT_Done_MM_Var() is more likely to be
91  // available to all users in the future, remove FreeMMVar() and use
92  // FT_Done_MM_Var() directly.
93 -//
94 -// Use weak symbols to check if FT_Done_MM_Var() is available at runtime.
95 -#if !BUILDFLAG(IS_WIN)
96 -extern "C" __attribute__((weak)) decltype(FT_Done_MM_Var) FT_Done_MM_Var;
97 -#endif
99  void FreeMMVar(FXFT_FaceRec* rec, FXFT_MM_VarPtr variation_desc) {
100 -#if BUILDFLAG(IS_WIN)
101 -  // Assume `use_system_freetype` GN var is never set on Windows.
102 -  constexpr bool has_ft_done_mm_var_func = true;
103 -#else
104 -  static const bool has_ft_done_mm_var_func = !!FT_Done_MM_Var;
105 -#endif
106 -  if (has_ft_done_mm_var_func) {
107 -    FT_Done_MM_Var(CFX_GEModule::Get()->GetFontMgr()->GetFTLibrary(),
108 -                   variation_desc);
109 -  } else {
110      FXFT_Free(rec, variation_desc);
111 -  }
114  FX_RECT FXRectFromFTPos(FT_Pos left, FT_Pos top, FT_Pos right, FT_Pos bottom) {
115 diff --git a/third_party/base/numerics/safe_conversions_impl.h b/third_party/base/numerics/safe_conversions_impl.h
116 index 44c921a14..0152a89b7 100644
117 --- a/third_party/base/numerics/safe_conversions_impl.h
118 +++ b/third_party/base/numerics/safe_conversions_impl.h
119 @@ -89,7 +89,7 @@ constexpr typename std::make_unsigned<T>::type SafeUnsignedAbs(T value) {
121  // TODO(jschuh): Switch to std::is_constant_evaluated() once C++20 is supported.
122  // Alternately, the usage could be restructured for "consteval if" in C++23.
123 -#define IsConstantEvaluated() (__builtin_is_constant_evaluated())
124 +#define IsConstantEvaluated() (false)
126  // TODO(jschuh): Debug builds don't reliably propagate constants, so we restrict
127  // some accelerated runtime paths to release builds until this can be forced
128 diff --git a/third_party/base/span.h b/third_party/base/span.h
129 index ed2a3c8de..87493861c 100644
130 --- a/third_party/base/span.h
131 +++ b/third_party/base/span.h
132 @@ -211,7 +211,7 @@ class TRIVIAL_ABI GSL_POINTER span {
133  #else
134    template <typename Container,
135              typename = internal::EnableIfSpanCompatibleContainer<Container, T>>
136 -  constexpr span(Container& container)
137 +  span(Container& container)
138        : span(container.data(), container.size()) {}
139  #endif
141 @@ -225,7 +225,7 @@ class TRIVIAL_ABI GSL_POINTER span {
142    // Conversions from spans of compatible types: this allows a span<T> to be
143    // seamlessly used as a span<const T>, but not the other way around.
144    template <typename U, typename = internal::EnableIfLegalSpanConversion<U, T>>
145 -  constexpr span(const span<U>& other) : span(other.data(), other.size()) {}
146 +  span(const span<U>& other) : span(other.data(), other.size()) {}
147    span& operator=(const span& other) noexcept {
148      if (this != &other) {
149        ReleaseEmptySpan();
150 diff --git a/third_party/libopenjpeg/openjpeg.c b/third_party/libopenjpeg/openjpeg.c
151 index 29d3ee528..d5c7a1bc9 100644
152 --- a/third_party/libopenjpeg/openjpeg.c
153 +++ b/third_party/libopenjpeg/openjpeg.c
154 @@ -433,7 +433,7 @@ OPJ_BOOL OPJ_CALLCONV opj_setup_decoder(opj_codec_t *p_codec,
155      return OPJ_FALSE;
158 -OPJ_API OPJ_BOOL OPJ_CALLCONV opj_decoder_set_strict_mode(opj_codec_t *p_codec,
159 +OPJ_BOOL OPJ_CALLCONV opj_decoder_set_strict_mode(opj_codec_t *p_codec,
160          OPJ_BOOL strict)
162      if (p_codec) {