[CodeFormat] Clang-format cpp sources (#4965)

Clang-format all c++ source files.
This commit is contained in:
sduzh
2020-11-28 18:36:49 +08:00
committed by GitHub
parent f944bf4d44
commit 6fedf5881b
1331 changed files with 62548 additions and 68514 deletions

View File

@ -17,22 +17,22 @@
#include "exprs/encryption_functions.h"
#include "util/aes_util.h"
#include "util/md5.h"
#include <boost/smart_ptr.hpp>
#include "exprs/anyval_util.h"
#include "exprs/expr.h"
#include "util/debug_util.h"
#include "runtime/tuple_row.h"
#include "util/url_coding.h"
#include <boost/smart_ptr.hpp>
#include "runtime/string_value.h"
#include "runtime/tuple_row.h"
#include "util/aes_util.h"
#include "util/debug_util.h"
#include "util/md5.h"
#include "util/url_coding.h"
namespace doris {
void EncryptionFunctions::init() {
}
void EncryptionFunctions::init() {}
StringVal EncryptionFunctions::aes_encrypt(FunctionContext* ctx,
const StringVal &src, const StringVal &key) {
StringVal EncryptionFunctions::aes_encrypt(FunctionContext* ctx, const StringVal& src,
const StringVal& key) {
if (src.len == 0) {
return StringVal::null();
}
@ -42,16 +42,17 @@ StringVal EncryptionFunctions::aes_encrypt(FunctionContext* ctx,
boost::scoped_array<char> p;
p.reset(new char[cipher_len]);
int ret_code = AesUtil::encrypt(AES_128_ECB, (unsigned char*)src.ptr, src.len,
(unsigned char*)key.ptr, key.len, NULL, true, (unsigned char*)p.get());
int ret_code =
AesUtil::encrypt(AES_128_ECB, (unsigned char*)src.ptr, src.len, (unsigned char*)key.ptr,
key.len, NULL, true, (unsigned char*)p.get());
if (ret_code < 0) {
return StringVal::null();
}
return AnyValUtil::from_buffer_temp(ctx, p.get(), ret_code);
}
StringVal EncryptionFunctions::aes_decrypt(FunctionContext* ctx,
const StringVal &src, const StringVal &key) {
StringVal EncryptionFunctions::aes_decrypt(FunctionContext* ctx, const StringVal& src,
const StringVal& key) {
if (src.len == 0) {
return StringVal::null();
}
@ -60,15 +61,16 @@ StringVal EncryptionFunctions::aes_decrypt(FunctionContext* ctx,
boost::scoped_array<char> p;
p.reset(new char[cipher_len]);
int ret_code = AesUtil::decrypt(AES_128_ECB, (unsigned char*)src.ptr, src.len,
(unsigned char*)key.ptr, key.len, NULL, true, (unsigned char*)p.get());
int ret_code =
AesUtil::decrypt(AES_128_ECB, (unsigned char*)src.ptr, src.len, (unsigned char*)key.ptr,
key.len, NULL, true, (unsigned char*)p.get());
if (ret_code < 0) {
return StringVal::null();
}
return AnyValUtil::from_buffer_temp(ctx, p.get(), ret_code);
}
StringVal EncryptionFunctions::from_base64(FunctionContext* ctx, const StringVal &src) {
StringVal EncryptionFunctions::from_base64(FunctionContext* ctx, const StringVal& src) {
if (src.len == 0 || src.is_null) {
return StringVal::null();
}
@ -77,31 +79,30 @@ StringVal EncryptionFunctions::from_base64(FunctionContext* ctx, const StringVal
boost::scoped_array<char> p;
p.reset(new char[cipher_len]);
int ret_code = base64_decode((const char *)src.ptr, src.len, p.get());
int ret_code = base64_decode((const char*)src.ptr, src.len, p.get());
if (ret_code < 0) {
return StringVal::null();
}
return AnyValUtil::from_buffer_temp(ctx, p.get(), ret_code);
}
StringVal EncryptionFunctions::to_base64(FunctionContext* ctx, const StringVal &src) {
StringVal EncryptionFunctions::to_base64(FunctionContext* ctx, const StringVal& src) {
if (src.len == 0 || src.is_null) {
return StringVal::null();
}
int cipher_len = (size_t) (4.0 * ceil((double) src.len / 3.0));
int cipher_len = (size_t)(4.0 * ceil((double)src.len / 3.0));
boost::scoped_array<char> p;
p.reset(new char[cipher_len]);
int ret_code = base64_encode((unsigned char *)src.ptr, src.len, (unsigned char *)p.get());
int ret_code = base64_encode((unsigned char*)src.ptr, src.len, (unsigned char*)p.get());
if (ret_code < 0) {
return StringVal::null();
}
return AnyValUtil::from_buffer_temp(ctx, p.get(), ret_code);
}
StringVal EncryptionFunctions::md5sum(
FunctionContext* ctx, int num_args, const StringVal* args) {
StringVal EncryptionFunctions::md5sum(FunctionContext* ctx, int num_args, const StringVal* args) {
Md5Digest digest;
for (int i = 0; i < num_args; ++i) {
const StringVal& arg = args[i];
@ -124,4 +125,4 @@ StringVal EncryptionFunctions::md5(FunctionContext* ctx, const StringVal& src) {
return AnyValUtil::from_buffer_temp(ctx, digest.hex().c_str(), digest.hex().size());
}
}
} // namespace doris