diff options
author | Adrian Kummerlaender | 2017-10-06 14:37:53 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2017-10-06 14:43:00 +0200 |
commit | d951a22faf35aabe526de2588006c9381904b137 (patch) | |
tree | 3d02269647d0d8490f5d105c50c49295d688af72 /src/util | |
parent | 538236772ce6edde390079c32533c1e70cf8bdca (diff) | |
download | DictzipQuery-d951a22faf35aabe526de2588006c9381904b137.tar DictzipQuery-d951a22faf35aabe526de2588006c9381904b137.tar.gz DictzipQuery-d951a22faf35aabe526de2588006c9381904b137.tar.bz2 DictzipQuery-d951a22faf35aabe526de2588006c9381904b137.tar.lz DictzipQuery-d951a22faf35aabe526de2588006c9381904b137.tar.xz DictzipQuery-d951a22faf35aabe526de2588006c9381904b137.tar.zst DictzipQuery-d951a22faf35aabe526de2588006c9381904b137.zip |
Provide definition reader primitive
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/base64.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/util/base64.cc b/src/util/base64.cc index 4e8d0a4..4a4f095 100644 --- a/src/util/base64.cc +++ b/src/util/base64.cc @@ -8,22 +8,22 @@ namespace dictzip { std::size_t base64_decode(const std::string& encoded) { std::vector<std::int8_t> map(256,-1); - for ( int i = 0; i < 64; ++i ) { + for ( int i = 0; i < 64; ++i ) { map["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[i]] = i; } std::size_t value = 0; - for ( std::uint8_t c : encoded ) { - if ( map[c] == -1 ) { + for ( std::uint8_t c : encoded ) { + if ( map[c] == -1 ) { throw std::invalid_argument("Invalid character in BASE64 string."); } else { value *= 64; value += map[c]; } - } + } - return value; + return value; } } |