| 44 | } |
| 45 | |
| 46 | bool Base64::Decode(const StringPiece& input, std::string* output) |
| 47 | { |
| 48 | std::string temp; |
| 49 | temp.resize(modp_b64_decode_len(input.size())); |
| 50 | |
| 51 | // does not null terminate result since result is binary data! |
| 52 | int input_size = static_cast<int>(input.size()); |
| 53 | int output_size = modp_b64_decode(&(temp[0]), input.data(), input_size); |
| 54 | if (output_size < 0) |
| 55 | return false; |
| 56 | |
| 57 | temp.resize(output_size); |
| 58 | output->swap(temp); |
| 59 | return true; |
| 60 | } |
| 61 | |
| 62 | bool Base64::WebSafeDecode(const StringPiece& input, std::string* output) |
| 63 | { |