PKGBUILDs/extra/chromium/const-atomicstring-conversion.patch
2024-11-13 00:26:42 +00:00

35 lines
1.5 KiB
Diff

From 403ee5b14df12c8ee3b3583177bbd30d930e9aaf Mon Sep 17 00:00:00 2001
From: Matt Jolly <kangie@gentoo.org>
Date: Sat, 12 Oct 2024 13:45:37 +1000
Subject: [PATCH] Convert 'Const AtomicString' to 'const char *'.
I don't know why this is suddenly required?
--- a/third_party/blink/renderer/platform/wtf/text/text_codec_icu.cc
+++ b/third_party/blink/renderer/platform/wtf/text/text_codec_icu.cc
@@ -323,7 +323,10 @@ void TextCodecICU::CreateICUConverter() const {
DCHECK(!converter_icu_);
#if defined(USING_SYSTEM_ICU)
- const char* name = encoding_.GetName();
+ //convert to WTF::String to use existing `const char *` dependent functions
+ WTF::String nameString = encoding_.GetName();
+ std::string nameUtf8 = nameString.Utf8();
+ const char* name = nameUtf8.c_str();
needs_gbk_fallbacks_ =
name[0] == 'G' && name[1] == 'B' && name[2] == 'K' && !name[3];
#endif
@@ -448,7 +451,10 @@ String TextCodecICU::Decode(base::span<const uint8_t> data,
// <http://bugs.webkit.org/show_bug.cgi?id=17014>
// Simplified Chinese pages use the code A3A0 to mean "full-width space", but
// ICU decodes it as U+E5E5.
- if (!strcmp(encoding_.GetName(), "GBK")) {
+ // Convert AtomicString to String
+ WTF::String nameString = encoding_.GetName();
+ std::string nameUtf8 = nameString.Utf8();
+ if (!strcmp(nameUtf8.c_str(), "GBK")) {
if (EqualIgnoringASCIICase(encoding_.GetName(), "gb18030"))
resultString.Replace(0xE5E5, kIdeographicSpaceCharacter);
// Make GBK compliant to the encoding spec and align with GB18030
--
2.46.2