summaryrefslogtreecommitdiff
path: root/AK
diff options
context:
space:
mode:
authorLenny Maiorani <lenny@serenityos.org>2022-03-13 21:01:50 -0600
committerLinus Groh <mail@linusgroh.de>2022-03-16 16:19:53 +0000
commit5b59375a56b1c436e89f6a89079580ab514c50b2 (patch)
tree6b170ca94ed3c32a32877c04d57d1abc628363cf /AK
parent8d1d4d4f097f3e865d73f3c710269c3ec96e9cb7 (diff)
downloadserenity-5b59375a56b1c436e89f6a89079580ab514c50b2.zip
AK: Fix implicit and narrowing conversions in Base64
Diffstat (limited to 'AK')
-rw-r--r--AK/Base64.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/AK/Base64.cpp b/AK/Base64.cpp
index ad12be9949..028fe5d1ed 100644
--- a/AK/Base64.cpp
+++ b/AK/Base64.cpp
@@ -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);