mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
AK: Fix implicit and narrowing conversions in Base64
This commit is contained in:
parent
8d1d4d4f09
commit
5b59375a56
Notes:
sideshowbarker
2024-07-17 17:18:07 +09:00
Author: https://github.com/ldm5180 Commit: https://github.com/SerenityOS/serenity/commit/5b59375a56 Pull-request: https://github.com/SerenityOS/serenity/pull/13040 Reviewed-by: https://github.com/trflynn89
1 changed files with 5 additions and 5 deletions
|
@ -29,7 +29,7 @@ static consteval auto make_lookup_table()
|
|||
Array<i16, 256> table;
|
||||
table.fill(-1);
|
||||
for (size_t i = 0; i < alphabet.size(); ++i) {
|
||||
table[alphabet[i]] = i;
|
||||
table[alphabet[i]] = static_cast<i16>(i);
|
||||
}
|
||||
return table;
|
||||
}
|
||||
|
@ -126,10 +126,10 @@ String encode_base64(ReadonlyBytes input)
|
|||
const u8 index2 = ((in1 << 2) | (in2 >> 6)) & 0x3f;
|
||||
const u8 index3 = in2 & 0x3f;
|
||||
|
||||
const u8 out0 = alphabet[index0];
|
||||
const u8 out1 = alphabet[index1];
|
||||
const u8 out2 = is_16bit ? '=' : alphabet[index2];
|
||||
const u8 out3 = is_8bit ? '=' : alphabet[index3];
|
||||
const char out0 = alphabet[index0];
|
||||
const char out1 = alphabet[index1];
|
||||
const char out2 = is_16bit ? '=' : alphabet[index2];
|
||||
const char out3 = is_8bit ? '=' : alphabet[index3];
|
||||
|
||||
output.append(out0);
|
||||
output.append(out1);
|
||||
|
|
Loading…
Reference in a new issue