llcommon merge. Added LLUnits.
This commit is contained in:
@@ -30,32 +30,36 @@
|
||||
#include "llbase64.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "apr_base64.h"
|
||||
|
||||
|
||||
// static
|
||||
std::string LLBase64::encode(const U8* input, size_t input_size)
|
||||
{
|
||||
if (!(input && input_size > 0)) return LLStringUtil::null;
|
||||
|
||||
// Yes, it returns int.
|
||||
int b64_buffer_length = apr_base64_encode_len(input_size);
|
||||
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_encode_binary(
|
||||
b64_buffer,
|
||||
input,
|
||||
input_size);
|
||||
std::string result;
|
||||
result.assign(b64_buffer);
|
||||
delete[] b64_buffer;
|
||||
|
||||
return result;
|
||||
std::string output;
|
||||
if (input
|
||||
&& input_size > 0)
|
||||
{
|
||||
// Yes, it returns int.
|
||||
int b64_buffer_length = apr_base64_encode_len(input_size);
|
||||
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_encode_binary(
|
||||
b64_buffer,
|
||||
input,
|
||||
input_size);
|
||||
output.assign(b64_buffer);
|
||||
delete[] b64_buffer;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
std::string LLBase64::encode(const std::string& in_str)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user