diff options
| author | Roxie Linden <roxie@lindenlab.com> | 2024-06-13 14:59:28 -0700 |
|---|---|---|
| committer | Roxie Linden <roxie@lindenlab.com> | 2024-06-13 14:59:28 -0700 |
| commit | 5e60392c273f0c9c5efa765a05414c618381780a (patch) | |
| tree | d1eedbb1dfa86e66532a6d8746b7a81e5a444d3a /indra/llcommon/llbase64.cpp | |
| parent | 0f3c3563b0861e8ea82b201aab8343d99f993bbc (diff) | |
| parent | 100ebbab2437de7f5d124a0d7b8279a7a7b57656 (diff) | |
Merge branch 'develop' of github.com:secondlife/viewer into roxie/webrtc-voice
Diffstat (limited to 'indra/llcommon/llbase64.cpp')
| -rw-r--r-- | indra/llcommon/llbase64.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/indra/llcommon/llbase64.cpp b/indra/llcommon/llbase64.cpp index dbbbec9813..b8185a0c84 100644 --- a/indra/llcommon/llbase64.cpp +++ b/indra/llcommon/llbase64.cpp @@ -59,3 +59,19 @@ std::string LLBase64::encode(const U8* input, size_t input_size) return output; } +std::string LLBase64::decodeAsString(const std::string &input) +{ + int b64_buffer_length = apr_base64_decode_len(input.c_str()); + char* b64_buffer = new char[b64_buffer_length]; + + // This is faster than apr_base64_encode() if you know + // you're not on an EBCDIC machine. Also, the output is + // null terminated, even though the documentation doesn't + // specify. See apr_base64.c for details. JC + b64_buffer_length = apr_base64_decode(b64_buffer, input.c_str()); + std::string res; + res.assign(b64_buffer); + delete[] b64_buffer; + return res; +} + |
