MCPcopy Create free account
hub / github.com/apache/impala / Base64EncodeBufLen

Function Base64EncodeBufLen

be/src/util/coding-util.cc:126–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124}
125
126bool Base64EncodeBufLen(int64_t in_len, int64_t* out_max) {
127 // Base64 encoding turns every 3 bytes into 4 characters. If the length is not
128 // divisible by 3, it pads the input with extra 0 bytes until it is divisible by 3.
129 // One more character must be allocated to account for Base64Encode's null-padding
130 // of its output.
131 *out_max = 1 + 4 * ((in_len + 2) / 3);
132 if (UNLIKELY(in_len < 0 ||
133 *out_max > static_cast<unsigned>(std::numeric_limits<int>::max()))) {
134 return false;
135 }
136 return true;
137}
138
139bool Base64Encode(const char* in, int64_t in_len, int64_t out_max, char* out,
140 unsigned* out_len) {

Callers 4

Base64EncodeMethod · 0.85
PrimitiveValueToJSONMethod · 0.85
Base64EncodeFunction · 0.85

Calls 1

maxFunction · 0.85

Tested by 1