Skip to content

Commit

Permalink
Minor tweaks from PR #352
Browse files Browse the repository at this point in the history
  • Loading branch information
sduehr committed Nov 28, 2019
1 parent f32b030 commit 58bab11
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions core/src/lib/base64.cc
Expand Up @@ -226,15 +226,15 @@ int Base64ToBin(char* dest, int dest_size, char* src, int srclen)
*
* Returns: Length of unpadded base64
*/
int Base64LengthUnpadded(const int source_length)
int Base64LengthUnpadded(int source_length)
{
if (source_length == 0) { return 0; }

int quotient = source_length / 3;
const int remainder = source_length % 3;
if (remainder > 0) { ++quotient; }
int unpadded_length = 4 * quotient;
if (remainder > 0) { unpadded_length -= 3 - remainder; }
if (remainder > 0) { unpadded_length -= (3 - remainder); }

return unpadded_length;
}
2 changes: 1 addition & 1 deletion core/src/lib/base64.h
Expand Up @@ -36,4 +36,4 @@ int ToBase64(int64_t value, char* where);
int FromBase64(int64_t* value, char* where);
int BinToBase64(char* buf, int buflen, char* bin, int binlen, bool compatible);
int Base64ToBin(char* dest, int destlen, char* src, int srclen);
int Base64LengthUnpadded(const int source_length);
int Base64LengthUnpadded(int source_length);

0 comments on commit 58bab11

Please sign in to comment.