MCPcopy Create free account
hub / github.com/apache/brpc / Base64Encode

Function Base64Encode

src/butil/base64.cc:11–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9namespace butil {
10
11void Base64Encode(const StringPiece& input, std::string* output) {
12 std::string temp;
13 temp.resize(modp_b64_encode_len(input.size())); // makes room for null byte
14
15 // modp_b64_encode_len() returns at least 1, so temp[0] is safe to use.
16 size_t output_size = modp_b64_encode(&(temp[0]), input.data(), input.size());
17
18 temp.resize(output_size); // strips off null byte
19 output->swap(temp);
20}
21
22bool Base64Decode(const StringPiece& input, std::string* output) {
23 std::string temp;

Callers 7

TESTFunction · 0.85
MakeHttpRequestHeadersFunction · 0.85
LLVMFuzzerTestOneInputFunction · 0.85
_PbFieldToJsonMethod · 0.85
NewMethod · 0.85
MakeRawHttpRequestFunction · 0.85
Base64UrlEncodeFunction · 0.85

Calls 4

resizeMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45
swapMethod · 0.45

Tested by 2

TESTFunction · 0.68
MakeHttpRequestHeadersFunction · 0.68