[webkit-reviews] review granted: [Bug 216081] Align EUC-KR encoding with Chrome, Firefox, and specification : [Attachment 407815] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Sep 2 21:40:57 PDT 2020


Darin Adler <darin at apple.com> has granted Alex Christensen
<achristensen at apple.com>'s request for review:
Bug 216081: Align EUC-KR encoding with Chrome, Firefox, and specification
https://bugs.webkit.org/show_bug.cgi?id=216081

Attachment 407815: Patch

https://bugs.webkit.org/attachment.cgi?id=407815&action=review




--- Comment #7 from Darin Adler <darin at apple.com> ---
Comment on attachment 407815
  --> https://bugs.webkit.org/attachment.cgi?id=407815
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=407815&action=review

> Source/WebCore/platform/text/TextCodecCJK.cpp:340
> +    static auto* table = [] {
> +	   auto table = new EUCKREncodingIndex();
> +	   for (size_t i = 0; i < WTF_ARRAY_LENGTH(eucKRDecodingIndex); i++)
> +	       (*table)[i] = { eucKRDecodingIndex[i].second,
eucKRDecodingIndex[i].first };
> +	   std::sort(table->begin(), table->end(), [] (auto& a, auto& b) {
> +	       return a.first < b.first;
> +	   });
> +	   return table;
> +    }();
> +    return *table;

Since we allocate these tables on the heap, can we figure out a way to make
these smaller, some kind of simple compression scheme? Not about this
particular one, but all the giant tables.

> Source/WebCore/platform/text/TextCodecCJK.cpp:372
> +	   result.append(pointer / 190 + 0x81);
> +	   result.append(pointer % 190 + 0x41);

Where do these magic numbers come from?

> Source/WebCore/platform/text/TextCodecCJK.cpp:385
> +		   uint16_t pointer = (lead - 0x81) * 190 + byte - 0x41;

Where do these magic numbers come from?


More information about the webkit-reviews mailing list