-*- Mode: diff -*- diff --git a/core/fpdfdoc/cpdf_metadata.cpp b/core/fpdfdoc/cpdf_metadata.cpp index 323de4ffc..f11a0b0ad 100644 --- a/core/fpdfdoc/cpdf_metadata.cpp +++ b/core/fpdfdoc/cpdf_metadata.cpp @@ -74,7 +74,7 @@ std::vector CPDF_Metadata::CheckForSharedForm() const { CFX_XMLParser parser(stream); std::unique_ptr doc = parser.Parse(); if (!doc) - return {}; + return std::vector(); std::vector unsupported; CheckForSharedFormInternal(doc->GetRoot(), &unsupported); diff --git a/third_party/base/span.h b/third_party/base/span.h index ec9f9903f..1c17ad091 100644 --- a/third_party/base/span.h +++ b/third_party/base/span.h @@ -208,7 +208,7 @@ class span { // Conversions from spans of compatible types: this allows a span to be // seamlessly used as a span, but not the other way around. template > - constexpr span(const span& other) : span(other.data(), other.size()) {} + span(const span& other) : span(other.data(), other.size()) {} span& operator=(const span& other) noexcept { if (this != &other) { ReleaseEmptySpan(); diff --git a/third_party/base/span.h b/third_party/base/span.h index 0fb627ba8..dda1fc8bc 100644 --- a/third_party/base/span.h +++ b/third_party/base/span.h @@ -204,7 +204,7 @@ class span { // size()|. template > - constexpr span(Container& container) + span(Container& container) : span(container.data(), container.size()) {} template < typename Container, diff --git a/core/fxcodec/jpx/cjpx_decoder.cpp b/core/fxcodec/jpx/cjpx_decoder.cpp index d8875786c..bc019ebe1 100644 --- a/core/fxcodec/jpx/cjpx_decoder.cpp +++ b/core/fxcodec/jpx/cjpx_decoder.cpp @@ -73,7 +73,7 @@ absl::optional alloc_rgb(size_t size) { if (!data.b) return absl::nullopt; - return data; + return std::move(data); } void sycc_to_rgb(int offset, diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp index 8b3a72700..ea1db23f4 100644 --- a/core/fxge/cfx_font.cpp +++ b/core/fxge/cfx_font.cpp @@ -47,25 +47,9 @@ struct OUTLINE_PARAMS { // TODO(crbug.com/pdfium/1400): When FT_Done_MM_Var() is more likely to be // available to all users in the future, remove FreeMMVar() and use // FT_Done_MM_Var() directly. -// -// Use weak symbols to check if FT_Done_MM_Var() is available at runtime. -#if !BUILDFLAG(IS_WIN) -extern "C" __attribute__((weak)) decltype(FT_Done_MM_Var) FT_Done_MM_Var; -#endif void FreeMMVar(FXFT_FaceRec* rec, FXFT_MM_VarPtr variation_desc) { -#if BUILDFLAG(IS_WIN) - // Assume `use_system_freetype` GN var is never set on Windows. - constexpr bool has_ft_done_mm_var_func = true; -#else - static const bool has_ft_done_mm_var_func = !!FT_Done_MM_Var; -#endif - if (has_ft_done_mm_var_func) { - FT_Done_MM_Var(CFX_GEModule::Get()->GetFontMgr()->GetFTLibrary(), - variation_desc); - } else { FXFT_Free(rec, variation_desc); - } } FX_RECT FXRectFromFTPos(FT_Pos left, FT_Pos top, FT_Pos right, FT_Pos bottom) { diff --git a/third_party/base/numerics/safe_conversions_impl.h b/third_party/base/numerics/safe_conversions_impl.h index 4d8a7b7d9..d14c6dc06 100644 --- a/third_party/base/numerics/safe_conversions_impl.h +++ b/third_party/base/numerics/safe_conversions_impl.h @@ -88,7 +88,7 @@ constexpr typename std::make_unsigned::type SafeUnsignedAbs(T value) { // TODO(jschuh): Switch to std::is_constant_evaluated() once C++20 is supported. // Alternately, the usage could be restructured for "consteval if" in C++23. -#define IsConstantEvaluated() (__builtin_is_constant_evaluated()) +#define IsConstantEvaluated() (false) // TODO(jschuh): Debug builds don't reliably propagate constants, so we restrict // some accelerated runtime paths to release builds until this can be forced --- pdfium/core/fpdfapi/font/cpdf_cidfont.cpp.orig 2022-05-20 09:25:52.066728467 +0000 +++ pdfium/core/fpdfapi/font/cpdf_cidfont.cpp 2022-05-20 09:25:56.146736531 +0000 @@ -738,7 +738,7 @@ uint32_t maccode = CharCodeFromUnicodeForFreetypeEncoding( FT_ENCODING_APPLE_ROMAN, name_unicode); index = maccode ? FT_Get_Char_Index(face, maccode) - : FT_Get_Name_Index(face, name); + : FT_Get_Name_Index(face, const_cast(name)); } if (index == 0 || index == 0xffff) return charcode ? static_cast(charcode) : -1; --- pdfium/core/fpdfapi/font/cpdf_type1font.cpp.orig 2022-05-20 09:26:59.090862058 +0000 +++ pdfium/core/fpdfapi/font/cpdf_type1font.cpp 2022-05-20 09:27:33.810932435 +0000 @@ -260,7 +260,7 @@ static_cast(charcode)); if (name) { m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name)); - m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), name); + m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), const_cast(name)); } else { m_GlyphIndex[charcode] = FT_Get_Char_Index( m_Font.GetFaceRec(), static_cast(charcode)); @@ -291,7 +291,7 @@ continue; m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name)); - m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), name); + m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), const_cast(name)); if (m_GlyphIndex[charcode] != 0) continue; --- pdfium/core/fpdfapi/font/cpdf_truetypefont.cpp.orig 2022-05-20 09:26:12.066767996 +0000 +++ pdfium/core/fpdfapi/font/cpdf_truetypefont.cpp 2022-05-20 09:26:46.690836923 +0000 @@ -90,7 +90,7 @@ FT_ENCODING_APPLE_ROMAN, m_Encoding.UnicodeFromCharCode(charcode)); if (!maccode) { - m_GlyphIndex[charcode] = FT_Get_Name_Index(face, name); + m_GlyphIndex[charcode] = FT_Get_Name_Index(face, const_cast(name)); } else { m_GlyphIndex[charcode] = FT_Get_Char_Index(face, maccode); } @@ -104,7 +104,7 @@ m_GlyphIndex[charcode] = FT_Get_Char_Index(face, 32); continue; } - m_GlyphIndex[charcode] = FT_Get_Name_Index(face, name); + m_GlyphIndex[charcode] = FT_Get_Name_Index(face, const_cast(name)); if (m_GlyphIndex[charcode] != 0 || !bToUnicode) continue; diff --git a/third_party/libopenjpeg/openjpeg.c b/third_party/libopenjpeg/openjpeg.c index 29d3ee528..d5c7a1bc9 100644 --- a/third_party/libopenjpeg/openjpeg.c +++ b/third_party/libopenjpeg/openjpeg.c @@ -433,7 +433,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/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp index a17ec0353..3b024ac91 100644 --- a/core/fpdfapi/parser/cpdf_data_avail.cpp +++ b/core/fpdfapi/parser/cpdf_data_avail.cpp @@ -902,7 +902,7 @@ CPDF_DataAvail::DocAvailStatus CPDF_DataAvail::CheckResources( CPDF_PageObjectAvail* resource_avail = m_PagesResourcesAvail .insert(std::make_pair( - resources, + resources.Get(), std::make_unique( GetValidator(), m_pDocument.Get(), resources.Get()))) .first->second.get();