Fixed compilation warnings

This commit is contained in:
Pax1601
2023-12-05 10:06:47 +01:00
parent 45b840fa72
commit 304e8ba3a0
8 changed files with 22 additions and 20 deletions

View File

@@ -18,7 +18,7 @@ namespace base64 {
uint32_t bit_stream = 0;
const std::string base64_chars = get_base64_chars();
std::string encoded;
encoded.reserve(ceil(4.0 / 3.0 * size));
encoded.reserve(static_cast<unsigned long>(ceil(4.0 / 3.0 * size)));
int offset = 0;
for (unsigned int idx = 0; idx < size; idx++) {
unsigned char c = data[idx];
@@ -63,7 +63,7 @@ namespace base64 {
auto num_val = base64_chars.find(c);
if (num_val != std::string::npos) {
offset = 18 - counter % 4 * 6;
bit_stream += num_val << offset;
bit_stream += static_cast<uint32_t>(num_val << offset);
if (offset == 12) {
decoded += static_cast<char>(bit_stream >> 16 & 0xff);
}