diff --git a/velox/common/encode/Base64.cpp b/velox/common/encode/Base64.cpp index b36cb55e8558..7d36032bec90 100644 --- a/velox/common/encode/Base64.cpp +++ b/velox/common/encode/Base64.cpp @@ -184,14 +184,16 @@ size_t Base64::calculateEncodedSize(size_t inputSize, bool withPadding) { } // static -Status Base64::encode(const char* input, size_t inputSize, char* output) { +void Base64::encode(const char* input, size_t inputSize, char* output) { return encodeImpl( folly::StringPiece(input, inputSize), kBase64Charset, true, output); } // static -Status -Base64::encodeUrl(const char* input, size_t inputSize, char* outputBuffer) { +void Base64::encodeUrl( + const char* input, + size_t inputSize, + char* outputBuffer) { return encodeImpl( folly::StringPiece(input, inputSize), kBase64UrlCharset, @@ -201,14 +203,14 @@ Base64::encodeUrl(const char* input, size_t inputSize, char* outputBuffer) { // static template -Status Base64::encodeImpl( +void Base64::encodeImpl( const T& input, const Charset& charset, bool includePadding, char* outputBuffer) { auto inputSize = input.size(); if (inputSize == 0) { - return Status::OK(); + return; } auto outputPointer = outputBuffer; @@ -248,7 +250,6 @@ Status Base64::encodeImpl( } } } - return Status::OK(); } // static @@ -322,7 +323,7 @@ void Base64::decode( const std::pair& payload, std::string& decodedOutput) { size_t inputSize = payload.second; - size_t decodedSize; + size_t decodedSize{0}; (void)calculateDecodedSize(payload.first, inputSize, decodedSize); decodedOutput.resize(decodedSize); (void)decode( diff --git a/velox/common/encode/Base64.h b/velox/common/encode/Base64.h index f351d6e340fb..a78ec1176e5d 100644 --- a/velox/common/encode/Base64.h +++ b/velox/common/encode/Base64.h @@ -53,7 +53,7 @@ class Base64 { /// Encodes the specified number of characters from the 'input' and writes the /// result to the 'outputBuffer'. The output must have enough space as /// returned by the calculateEncodedSize(). - static Status encode(const char* input, size_t inputSize, char* outputBuffer); + static void encode(const char* input, size_t inputSize, char* outputBuffer); /// Encodes the specified number of characters from the 'input' using URL /// encoding. @@ -68,7 +68,7 @@ class Base64 { /// Encodes the specified number of characters from the 'input' and writes the /// result to the 'outputBuffer' using URL encoding. The output must have /// enough space as returned by the calculateEncodedSize(). - static Status + static void encodeUrl(const char* input, size_t inputSize, char* outputBuffer); /// Decodes the input Base64 encoded string. @@ -153,7 +153,7 @@ class Base64 { // Encodes the specified data using the provided charset. template - static Status encodeImpl( + static void encodeImpl( const T& input, const Charset& charset, bool includePadding,