LibUnicode: Ensure case conversion methods increment the current index
There was one branch in these methods (the branch where a special casing was found) that neglected to update the current index.
This commit is contained in:
parent
077a693de6
commit
68b2680040
Notes:
sideshowbarker
2024-07-18 04:36:46 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/68b26800402 Pull-request: https://github.com/SerenityOS/serenity/pull/9841 Reviewed-by: https://github.com/IdanHo Reviewed-by: https://github.com/linusg ✅
1 changed files with 8 additions and 8 deletions
|
@ -121,21 +121,21 @@ String to_unicode_lowercase_full(StringView const& string)
|
|||
StringBuilder builder;
|
||||
|
||||
size_t index = 0;
|
||||
for (auto it = view.begin(); it != view.end(); ++it) {
|
||||
size_t byte_length = 0;
|
||||
|
||||
for (auto it = view.begin(); it != view.end(); ++it, index += byte_length) {
|
||||
u32 code_point = *it;
|
||||
size_t byte_length = it.underlying_code_point_length_in_bytes();
|
||||
byte_length = it.underlying_code_point_length_in_bytes();
|
||||
|
||||
auto unicode_data = Detail::unicode_data_for_code_point(code_point);
|
||||
if (!unicode_data.has_value()) {
|
||||
builder.append_code_point(code_point);
|
||||
index += byte_length;
|
||||
continue;
|
||||
}
|
||||
|
||||
auto const* special_casing = find_matching_special_case(view, index, byte_length, *unicode_data);
|
||||
if (!special_casing) {
|
||||
builder.append_code_point(unicode_data->simple_lowercase_mapping);
|
||||
index += byte_length;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -156,21 +156,21 @@ String to_unicode_uppercase_full(StringView const& string)
|
|||
StringBuilder builder;
|
||||
|
||||
size_t index = 0;
|
||||
for (auto it = view.begin(); it != view.end(); ++it) {
|
||||
size_t byte_length = 0;
|
||||
|
||||
for (auto it = view.begin(); it != view.end(); ++it, index += byte_length) {
|
||||
u32 code_point = *it;
|
||||
size_t byte_length = it.underlying_code_point_length_in_bytes();
|
||||
byte_length = it.underlying_code_point_length_in_bytes();
|
||||
|
||||
auto unicode_data = Detail::unicode_data_for_code_point(code_point);
|
||||
if (!unicode_data.has_value()) {
|
||||
builder.append_code_point(code_point);
|
||||
index += byte_length;
|
||||
continue;
|
||||
}
|
||||
|
||||
auto const* special_casing = find_matching_special_case(view, index, byte_length, *unicode_data);
|
||||
if (!special_casing) {
|
||||
builder.append_code_point(unicode_data->simple_uppercase_mapping);
|
||||
index += byte_length;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue