Skip to content

Commit

Permalink
hotplace rev.520 grooming
Browse files Browse the repository at this point in the history
  • Loading branch information
princeb612 committed May 3, 2024
1 parent fe5e183 commit 5eb8ca6
Show file tree
Hide file tree
Showing 149 changed files with 1,268 additions and 1,154 deletions.
20 changes: 10 additions & 10 deletions sdk/base/basic/base16.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,18 @@ return_t base16_encode(const byte_t* source, size_t size, stream_t* stream, uint
return ret;
}

return_t base16_encode(binary_t const& source, char* buf, size_t* buflen) { return base16_encode(&source[0], source.size(), buf, buflen); }
return_t base16_encode(const binary_t& source, char* buf, size_t* buflen) { return base16_encode(&source[0], source.size(), buf, buflen); }

return_t base16_encode(binary_t const& source, std::string& outpart, uint32 flags) { return base16_encode(&source[0], source.size(), outpart, flags); }
return_t base16_encode(const binary_t& source, std::string& outpart, uint32 flags) { return base16_encode(&source[0], source.size(), outpart, flags); }

std::string base16_encode(binary_t const& source) {
std::string base16_encode(const binary_t& source) {
std::string outpart;

base16_encode(source, outpart);
return outpart;
}

return_t base16_encode(binary_t const& source, stream_t* stream) { return base16_encode(&source[0], source.size(), stream); }
return_t base16_encode(const binary_t& source, stream_t* stream) { return base16_encode(&source[0], source.size(), stream); }

std::string base16_encode(const char* source) {
std::string outpart;
Expand Down Expand Up @@ -165,7 +165,7 @@ return_t base16_encode(const char* source, binary_t& outpart) {
return ret;
}

return_t base16_encode(std::string const& source, binary_t& outpart) { return base16_encode(source.c_str(), outpart); }
return_t base16_encode(const std::string& source, binary_t& outpart) { return base16_encode(source.c_str(), outpart); }

static byte_t conv(char c) {
byte_t ret = 0;
Expand Down Expand Up @@ -256,9 +256,9 @@ return_t base16_decode(const char* source, size_t size, stream_t* stream, uint32
return ret;
}

return_t base16_decode(std::string const& source, binary_t& outpart, uint32 flags) { return base16_decode(source.c_str(), source.size(), outpart, flags); }
return_t base16_decode(const std::string& source, binary_t& outpart, uint32 flags) { return base16_decode(source.c_str(), source.size(), outpart, flags); }

return_t base16_decode(std::string const& source, stream_t* stream, uint32 flags) { return base16_decode(source.c_str(), source.size(), stream, flags); }
return_t base16_decode(const std::string& source, stream_t* stream, uint32 flags) { return base16_decode(source.c_str(), source.size(), stream, flags); }

binary_t base16_decode(const char* source) {
binary_t outpart;
Expand All @@ -275,14 +275,14 @@ binary_t base16_decode(const char* source, size_t size) {
return outpart;
}

binary_t base16_decode(std::string const& source) {
binary_t base16_decode(const std::string& source) {
binary_t outpart;

base16_decode(source, outpart);
return outpart;
}

std::string base16_encode_rfc(std::string const& source) {
std::string base16_encode_rfc(const std::string& source) {
std::string inpart = source;
std::string outpart;

Expand Down Expand Up @@ -328,7 +328,7 @@ std::string base16_encode_rfc(std::string const& source) {
return outpart;
}

binary_t base16_decode_rfc(std::string const& source) {
binary_t base16_decode_rfc(const std::string& source) {
std::string inpart = source;
binary_t outpart;

Expand Down
36 changes: 18 additions & 18 deletions sdk/base/basic/base16.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* std::string hex;
* binary_t bin;
* base16_encode (message, 6, hex);
* std::cout << hex.c_str () << std::endl;
* std::cout << hex << std::endl;
* base16_decode (hex, bin);
* basic_stream bs;
* dump_memory (&bin[0], bin.size (), &bs);
Expand Down Expand Up @@ -79,7 +79,7 @@ return_t base16_encode(const byte_t* source, size_t size, std::string& outpart,
return_t base16_encode(const byte_t* source, size_t size, stream_t* stream, uint32 flags = 0);
/*
* @brief encode
* @param binary_t const& source [in]
* @param const binary_t& source [in]
* @param char* buf [out]
* @param size_t* buflen [out]
* @example
Expand All @@ -90,41 +90,41 @@ return_t base16_encode(const byte_t* source, size_t size, stream_t* stream, uint
* base16_decode (source, buf, &size);
* free (buf);
*/
return_t base16_encode(binary_t const& source, char* buf, size_t* buflen);
return_t base16_encode(const binary_t& source, char* buf, size_t* buflen);
/*
* @brief encode
* @param binary_t const& source [in]
* @param const binary_t& source [in]
* @param std::string& outpart [out]
* @param uint32 flags [inopt] default 0, possible flags base16_notrunc | base16_capital
* @example
* binary_t source = convert ("wild wild world");
* std::string encoded;
* base16_decode (source, encoded);
*/
return_t base16_encode(binary_t const& source, std::string& outpart, uint32 flags = 0);
return_t base16_encode(const binary_t& source, std::string& outpart, uint32 flags = 0);
/*
* @brief encode
* @param binary_t const& source [in]
* @param const binary_t& source [in]
* @param stream_t* stream [out]
* @example
* binary_t source = convert ("wild wild world");
* basic_stream encoded;
* base16_decode (source, &encoded);
*/
return_t base16_encode(binary_t const& source, stream_t* stream);
return_t base16_encode(const binary_t& source, stream_t* stream);
/*
* @brief encode
* @param binary_t const& source [in]
* @param const binary_t& source [in]
* @example
* binary_t source = convert ("wild wild world");
* std::string encoded = base16_decode (source);;
*/
std::string base16_encode(binary_t const& source);
std::string base16_encode(const binary_t& source);

std::string base16_encode(const char* source);
return_t base16_encode(const char* source, std::string& outpart);
return_t base16_encode(const char* source, binary_t& outpart);
return_t base16_encode(std::string const& source, binary_t& outpart);
return_t base16_encode(const std::string& source, binary_t& outpart);

/**
* @brief decode
Expand All @@ -144,18 +144,18 @@ return_t base16_decode(const char* source, size_t size, binary_t& outpart, uint3
return_t base16_decode(const char* source, size_t size, stream_t* stream, uint32 flags = 0);
/**
* @brief decode
* @param std::string const& source [in]
* @param const std::string& source [in]
* @param binary_t& outpart [out]
* @param uint32 flags [inopt] default 0, possible flags base16_notrunc
*/
return_t base16_decode(std::string const& source, binary_t& outpart, uint32 flags = 0);
return_t base16_decode(const std::string& source, binary_t& outpart, uint32 flags = 0);
/**
* @brief decode
* @param std::string const& source [in]
* @param const std::string& source [in]
* @param stream_t* stream [out]
* @param uint32 flags [inopt] default 0, possible flags base16_notrunc
*/
return_t base16_decode(std::string const& source, stream_t* stream, uint32 flags = 0);
return_t base16_decode(const std::string& source, stream_t* stream, uint32 flags = 0);
/**
* @brief decode
* @param const char* source [in]
Expand All @@ -171,10 +171,10 @@ binary_t base16_decode(const char* source);
binary_t base16_decode(const char* source, size_t size);
/**
* @brief decode
* @param std::string const& source [in]
* @param const std::string& source [in]
* @return binary_t
*/
binary_t base16_decode(std::string const& source);
binary_t base16_decode(const std::string& source);

/**
* @brief encode (support various rfc-style)
Expand All @@ -190,8 +190,8 @@ binary_t base16_decode(std::string const& source);
* binary_t key = base16_encode_rfc("80 81 82 83 84 85 86 87 88 89 8a 8b 8c 8d 8e 8f"
* "90 91 92 93 94 95 96 97 98 99 9a 9b 9c 9d 9e 9f");
*/
std::string base16_encode_rfc(std::string const& source);
binary_t base16_decode_rfc(std::string const& source);
std::string base16_encode_rfc(const std::string& source);
binary_t base16_decode_rfc(const std::string& source);

} // namespace hotplace

Expand Down
12 changes: 6 additions & 6 deletions sdk/base/basic/base64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,9 @@ std::string base64_encode(const byte_t* source, size_t source_size, int encoding
return encoded;
}

std::string base64_encode(binary_t const& source, int encoding) { return base64_encode(&source[0], source.size(), encoding); }
std::string base64_encode(const binary_t& source, int encoding) { return base64_encode(&source[0], source.size(), encoding); }

std::string base64_encode(std::string const& source, int encoding) { return base64_encode((byte_t*)source.c_str(), source.size(), encoding); }
std::string base64_encode(const std::string& source, int encoding) { return base64_encode((byte_t*)source.c_str(), source.size(), encoding); }

return_t base64_decode(const char* source, size_t source_size, binary_t& decoded, int encoding) {
return_t ret = errorcode_t::success;
Expand All @@ -304,7 +304,7 @@ return_t base64_decode(const char* source, size_t source_size, binary_t& decoded
return ret;
}

return_t base64_decode(std::string const& source, binary_t& decoded, int encoding) {
return_t base64_decode(const std::string& source, binary_t& decoded, int encoding) {
return_t ret = errorcode_t::success;

size_t size = 0;
Expand All @@ -324,11 +324,11 @@ binary_t base64_decode(const char* source, size_t source_size, int encoding) {
return decoded;
}

binary_t base64_decode(binary_t const& source, int encoding) { return base64_decode((char*)&source[0], source.size(), encoding); }
binary_t base64_decode(const binary_t& source, int encoding) { return base64_decode((char*)&source[0], source.size(), encoding); }

binary_t base64_decode(std::string const& source, int encoding) { return base64_decode(source.c_str(), source.size(), encoding); }
binary_t base64_decode(const std::string& source, int encoding) { return base64_decode(source.c_str(), source.size(), encoding); }

std::string base64_decode_careful(std::string const& source, int encoding) { return base64_decode_careful(source.c_str(), source.size(), encoding); }
std::string base64_decode_careful(const std::string& source, int encoding) { return base64_decode_careful(source.c_str(), source.size(), encoding); }

std::string base64_decode_careful(const char* source, size_t source_size, int encoding) {
std::string decoded;
Expand Down
12 changes: 6 additions & 6 deletions sdk/base/basic/base64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ return_t base64_encode(const byte_t* source, size_t source_size, byte_t* buffer,
return_t base64_encode(const byte_t* source, size_t source_size, binary_t& encoded, int encoding = base64_encoding_t::base64_encoding);
return_t base64_encode(const byte_t* source, size_t source_size, std::string& encoded, int encoding = base64_encoding_t::base64_encoding);
std::string base64_encode(const byte_t* source, size_t source_size, int encoding = base64_encoding_t::base64_encoding);
std::string base64_encode(binary_t const& source, int encoding = base64_encoding_t::base64_encoding);
std::string base64_encode(std::string const& source, int encoding = base64_encoding_t::base64_encoding);
std::string base64_encode(const binary_t& source, int encoding = base64_encoding_t::base64_encoding);
std::string base64_encode(const std::string& source, int encoding = base64_encoding_t::base64_encoding);

/**
* decode base64 and base64url
Expand All @@ -72,11 +72,11 @@ std::string base64_encode(std::string const& source, int encoding = base64_encod
return_t base64_decode(const byte_t* source, size_t source_size, byte_t* buffer, size_t* buffer_size, int encoding = base64_encoding_t::base64_encoding);

return_t base64_decode(const char* source, size_t source_size, binary_t& decoded, int encoding = base64_encoding_t::base64_encoding);
return_t base64_decode(std::string const& source, binary_t& decoded, int encoding = base64_encoding_t::base64_encoding);
return_t base64_decode(const std::string& source, binary_t& decoded, int encoding = base64_encoding_t::base64_encoding);
binary_t base64_decode(const char* source, size_t source_size, int encoding = base64_encoding_t::base64_encoding);
binary_t base64_decode(binary_t const& source, int encoding = base64_encoding_t::base64_encoding);
binary_t base64_decode(std::string const& source, int encoding = base64_encoding_t::base64_encoding);
std::string base64_decode_careful(std::string const& source, int encoding = base64_encoding_t::base64_encoding);
binary_t base64_decode(const binary_t& source, int encoding = base64_encoding_t::base64_encoding);
binary_t base64_decode(const std::string& source, int encoding = base64_encoding_t::base64_encoding);
std::string base64_decode_careful(const std::string& source, int encoding = base64_encoding_t::base64_encoding);
std::string base64_decode_careful(const char* source, size_t source_size, int encoding = base64_encoding_t::base64_encoding);

} // namespace hotplace
Expand Down
2 changes: 1 addition & 1 deletion sdk/base/basic/dump_memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace hotplace {
*
* basic_stream bs;
* dump_memory ((byte_t*) data, strlen (data), &bs, 16, 0, 0x0, dump_memory_flag_t::header);
* std::cout << bs.c_str () << std::endl;
* std::cout << bs << std::endl;
*/

enum dump_memory_flag_t {
Expand Down
6 changes: 3 additions & 3 deletions sdk/base/basic/obfuscate_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ bool obfuscate_string::operator==(obfuscate_string& o) { return true == compare(

bool obfuscate_string::operator!=(obfuscate_string& o) { return false == compare(o); }

std::string& operator<<(std::string& lhs, obfuscate_string const& rhs) {
std::string& operator<<(std::string& lhs, const obfuscate_string& rhs) {
binary_t::const_iterator it;

for (it = rhs._contents.begin(); it != rhs._contents.end(); it++) {
Expand All @@ -169,7 +169,7 @@ std::string& operator<<(std::string& lhs, obfuscate_string const& rhs) {
return lhs;
}

basic_stream& operator<<(basic_stream& lhs, obfuscate_string const& rhs) {
basic_stream& operator<<(basic_stream& lhs, const obfuscate_string& rhs) {
binary_t::const_iterator it;

for (it = rhs._contents.begin(); it != rhs._contents.end(); it++) {
Expand All @@ -178,7 +178,7 @@ basic_stream& operator<<(basic_stream& lhs, obfuscate_string const& rhs) {
return lhs;
}

binary_t& operator<<(binary_t& lhs, obfuscate_string const& rhs) {
binary_t& operator<<(binary_t& lhs, const obfuscate_string& rhs) {
binary_t::const_iterator it;

for (it = rhs._contents.begin(); it != rhs._contents.end(); it++) {
Expand Down
12 changes: 6 additions & 6 deletions sdk/base/basic/obfuscate_string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,24 +152,24 @@ class obfuscate_string {
/**
* @brief append
* @param std::string& lhs [out]
* @param obfuscate_string const& rhs [in]
* @param const obfuscate_string& rhs [in]
* @return std::string&
*/
friend std::string& operator<<(std::string& lhs, obfuscate_string const& rhs);
friend std::string& operator<<(std::string& lhs, const obfuscate_string& rhs);
/**
* @brief append
* @param std::string& lhs [out]
* @param obfuscate_string const& rhs [in]
* @param const obfuscate_string& rhs [in]
* @return basic_stream&
*/
friend basic_stream& operator<<(basic_stream& lhs, obfuscate_string const& rhs);
friend basic_stream& operator<<(basic_stream& lhs, const obfuscate_string& rhs);
/**
* @brief append
* @param binary_t& lhs [out]
* @param obfuscate_string const& rhs [in]
* @param const obfuscate_string& rhs [in]
* @return binary_t&
*/
friend binary_t& operator<<(binary_t& lhs, obfuscate_string const& rhs);
friend binary_t& operator<<(binary_t& lhs, const obfuscate_string& rhs);

protected:
void startup();
Expand Down
6 changes: 3 additions & 3 deletions sdk/base/basic/valist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ valist& valist::assign(const valist& object) {
return *this;
}

valist& valist::assign(std::vector<variant_t> const& args) {
valist& valist::assign(const std::vector<variant_t>& args) {
critical_section_guard guard(_lock);

_args = args; // copy vector
Expand Down Expand Up @@ -191,7 +191,7 @@ valist& valist::operator<<(const char* value) {
return *this;
}

valist& valist::operator<<(variant_t const& v) {
valist& valist::operator<<(const variant_t& v) {
insert(v);
return *this;
}
Expand Down Expand Up @@ -512,7 +512,7 @@ void valist::build() {
}
}

void valist::insert(variant_t const& v) {
void valist::insert(const variant_t& v) {
critical_section_guard guard(_lock);

_args.push_back(v);
Expand Down
6 changes: 3 additions & 3 deletions sdk/base/basic/valist.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class valist {
* @return *this
*/
valist& assign(const valist& object);
valist& assign(std::vector<variant_t> const& args);
valist& assign(const std::vector<variant_t>& args);

valist& operator<<(bool value);
valist& operator<<(char value);
Expand All @@ -110,7 +110,7 @@ class valist {
valist& operator<<(double value);
valist& operator<<(void* value);
valist& operator<<(const char* value);
valist& operator<<(variant_t const& v);
valist& operator<<(const variant_t& v);
valist& operator<<(const valist& object);
/**
* @brief clear
Expand Down Expand Up @@ -143,7 +143,7 @@ class valist {
* @brief insert
* @param variant_t& v [in]
*/
void insert(variant_t const& v);
void insert(const variant_t& v);

typedef std::vector<variant_t> args_t;

Expand Down
4 changes: 2 additions & 2 deletions sdk/base/basic/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ variant& variant::set_nstr_new(const char* value, size_t n) {
return *this;
}

variant& variant::set_binary_new(binary_t const& bin) {
variant& variant::set_binary_new(const binary_t& bin) {
_vt.type = TYPE_BINARY;
_vt.size = 0;
_vt.flag = flag_binary;
Expand Down Expand Up @@ -426,7 +426,7 @@ return_t variant::dump(binary_t& target, bool change_endian) const {
return ret;
}

variant& variant::copy(variant_t const& value) {
variant& variant::copy(const variant_t& value) {
__try2 {
reset();

Expand Down
Loading

0 comments on commit 5eb8ca6

Please sign in to comment.