mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
add json BJSON_TYPE_BYTES support
This commit is contained in:
parent
6f4a7db910
commit
f8fadf8b74
7 changed files with 72 additions and 8 deletions
|
|
@ -319,8 +319,8 @@ std::string util::mangleid(uint64_t value) {
|
|||
return ss.str();
|
||||
}
|
||||
|
||||
std::vector<ubyte> util::base64_decode(const char* str, size_t size) {
|
||||
std::vector<ubyte> bytes((size / 4) * 3);
|
||||
util::Buffer<ubyte> util::base64_decode(const char* str, size_t size) {
|
||||
util::Buffer<ubyte> bytes((size / 4) * 3);
|
||||
ubyte* dst = bytes.data();
|
||||
for (size_t i = 0; i < size;) {
|
||||
ubyte a = base64_decode_char(ubyte(str[i++]));
|
||||
|
|
@ -335,12 +335,12 @@ std::vector<ubyte> util::base64_decode(const char* str, size_t size) {
|
|||
size_t outsize = bytes.size();
|
||||
if (str[size - 1] == '=') outsize--;
|
||||
if (str[size - 2] == '=') outsize--;
|
||||
bytes.resize(outsize);
|
||||
bytes.resizeFast(outsize);
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
std::vector<ubyte> util::base64_decode(const std::string& str) {
|
||||
util::Buffer<ubyte> util::base64_decode(const std::string& str) {
|
||||
return base64_decode(str.c_str(), str.size());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue