Mercurial > hg > orthanc
comparison Resources/ThirdParty/base64/base64.cpp @ 3332:79178122842c
fix warnings
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Fri, 22 Mar 2019 14:06:38 +0100 |
parents | 98cd69135999 |
children |
comparison
equal
deleted
inserted
replaced
3331:a600e5e8bd1c | 3332:79178122842c |
---|---|
156 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | 156 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
157 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, | 157 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
158 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 | 158 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 |
159 }; | 159 }; |
160 | 160 |
161 | |
161 void base64_decode(std::string& result, const std::string &stringToDecode) { | 162 void base64_decode(std::string& result, const std::string &stringToDecode) { |
162 | 163 |
163 result.reserve(result.size() + stringToDecode.size() * 3 / 4 + 10); | 164 result.reserve(result.size() + stringToDecode.size() * 3 / 4 + 10); |
164 | 165 |
165 int val=0, valb=-8; | 166 int val=0, valb=-8; |
166 for (std::string::const_iterator c = stringToDecode.begin(); c != stringToDecode.end(); ++c) { | 167 for (std::string::const_iterator c = stringToDecode.begin(); c != stringToDecode.end(); ++c) |
167 if (decode_indexes[*c] == -1) | 168 { |
169 size_t index = static_cast<size_t>(*c); | |
170 if (decode_indexes[index] == -1) | |
168 break; | 171 break; |
169 val = (val<<6) + decode_indexes[*c]; | 172 val = (val<<6) + decode_indexes[index]; |
170 valb += 6; | 173 valb += 6; |
171 if (valb>=0) { | 174 if (valb>=0) { |
172 result.push_back(char((val>>valb)&0xFF)); | 175 result.push_back(char((val>>valb)&0xFF)); |
173 valb-=8; | 176 valb-=8; |
174 } | 177 } |