mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-17 10:59:39 +00:00
Use an unsigned accumulator in base64_encode (#2477)
* use an unsigned accumulator in base64_encode * Forward-declare detail::base64_encode for split builds
This commit is contained in:
1 parent
9d159bb412
commit
a7b886b9cb
2 files changed
+29
-1
No files matched your search
@@ -4665,7 +4665,9 @@ inline std::string base64_encode(const std::string &in) {
|
||||
std::string out;
|
||||
out.reserve(in.size());
|
||||
|
||||
auto val = 0;
|
||||
// Unsigned: once four bytes are folded in the top bit is set, so the next
|
||||
// `val << 8` would left-shift a negative int (undefined behaviour).
|
||||
uint32_t val = 0;
|
||||
auto valb = -6;
|
||||
|
||||
for (auto c : in) {
|
||||
|
||||
Reference in new issue
Block a user