Skip to content

Instantly share code, notes, and snippets.

@isaacs
Created May 20, 2013 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaacs/5615305 to your computer and use it in GitHub Desktop.
Save isaacs/5615305 to your computer and use it in GitHub Desktop.
diff --git a/src/string_bytes.cc b/src/string_bytes.cc
index 5bf0a30..d68e3bc 100644
--- a/src/string_bytes.cc
+++ b/src/string_bytes.cc
@@ -63,8 +63,6 @@ static inline size_t base64_decoded_size_fast(size_t size) {
}
static inline size_t base64_decoded_size(const char* src, size_t size) {
- size = base64_decoded_size_fast(size);
-
const char* end = src + size;
// check for trailing padding (1 or 2 bytes)
if (size > 0) {
@@ -72,6 +70,8 @@ static inline size_t base64_decoded_size(const char* src, size_t size) {
if (size > 0 && end[-2] == '=') size--;
}
+ size = base64_decoded_size_fast(size);
+
return size;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment