mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-05 06:32:30 +02:00
Revert "Unicode: s/codepoint/code_point/g"
This reverts commit ea9ac3155d.
It replaced "codepoint" with "code_points", not "code_point".
This commit is contained in:
committed by
Andreas Kling
parent
9664bac281
commit
19ac1f6368
Notes:
sideshowbarker
2024-07-19 04:15:33 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/19ac1f6368c Pull-request: https://github.com/SerenityOS/serenity/pull/3018
@@ -113,22 +113,22 @@ void StringBuilder::clear()
|
||||
m_length = 0;
|
||||
}
|
||||
|
||||
void StringBuilder::append_code_points(u32 code_points)
|
||||
void StringBuilder::append_codepoint(u32 codepoint)
|
||||
{
|
||||
if (code_points <= 0x7f) {
|
||||
append((char)code_points);
|
||||
} else if (code_points <= 0x07ff) {
|
||||
append((char)(((code_points >> 6) & 0x1f) | 0xc0));
|
||||
append((char)(((code_points >> 0) & 0x3f) | 0x80));
|
||||
} else if (code_points <= 0xffff) {
|
||||
append((char)(((code_points >> 12) & 0x0f) | 0xe0));
|
||||
append((char)(((code_points >> 6) & 0x3f) | 0x80));
|
||||
append((char)(((code_points >> 0) & 0x3f) | 0x80));
|
||||
} else if (code_points <= 0x10ffff) {
|
||||
append((char)(((code_points >> 18) & 0x07) | 0xf0));
|
||||
append((char)(((code_points >> 12) & 0x3f) | 0x80));
|
||||
append((char)(((code_points >> 6) & 0x3f) | 0x80));
|
||||
append((char)(((code_points >> 0) & 0x3f) | 0x80));
|
||||
if (codepoint <= 0x7f) {
|
||||
append((char)codepoint);
|
||||
} else if (codepoint <= 0x07ff) {
|
||||
append((char)(((codepoint >> 6) & 0x1f) | 0xc0));
|
||||
append((char)(((codepoint >> 0) & 0x3f) | 0x80));
|
||||
} else if (codepoint <= 0xffff) {
|
||||
append((char)(((codepoint >> 12) & 0x0f) | 0xe0));
|
||||
append((char)(((codepoint >> 6) & 0x3f) | 0x80));
|
||||
append((char)(((codepoint >> 0) & 0x3f) | 0x80));
|
||||
} else if (codepoint <= 0x10ffff) {
|
||||
append((char)(((codepoint >> 18) & 0x07) | 0xf0));
|
||||
append((char)(((codepoint >> 12) & 0x3f) | 0x80));
|
||||
append((char)(((codepoint >> 6) & 0x3f) | 0x80));
|
||||
append((char)(((codepoint >> 0) & 0x3f) | 0x80));
|
||||
} else {
|
||||
append(0xef);
|
||||
append(0xbf);
|
||||
@@ -139,8 +139,8 @@ void StringBuilder::append_code_points(u32 code_points)
|
||||
void StringBuilder::append(const Utf32View& utf32_view)
|
||||
{
|
||||
for (size_t i = 0; i < utf32_view.length(); ++i) {
|
||||
auto code_points = utf32_view.code_pointss()[i];
|
||||
append_code_points(code_points);
|
||||
auto codepoint = utf32_view.codepoints()[i];
|
||||
append_codepoint(codepoint);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user