65 const size_t length = encoded.length();
66 #if defined JSON_DEBUG || defined JSON_SAFE
67 size_t pos = encoded.find_first_not_of(
chars64);
71 if (pos != length - 1){
82 const json_char * runner = encoded.c_str();
83 size_t aligned = length / 4;
88 result.reserve((
size_t)((
float)length / 1.37) + 1);
91 for (
unsigned int i = 0; i < aligned; ++i){
95 result += (
toBinary(runner[0]) << 2) + ((second & 0x30) >> 4);
96 result += ((second & 0xf) << 4) + ((third & 0x3c) >> 2);
97 result += ((third & 0x3) << 6) +
toBinary(runner[3]);
103 result += (
toBinary(runner[0]) << 2) + ((second & 0x30) >> 4);
104 if (runner[2] !=
'='){
107 result += ((second & 0xf) << 4) + ((third & 0x3c) >> 2);
108 if (runner[3] !=
'='){
110 result += ((third & 0x3) << 6) +
toBinary(runner[3]);
static std::string json_decode64(const json_string &encoded) json_nothrow json_cold
Definition: JSON_Base64.cpp:64
#define JSON_TEXT(s)
Definition: Strings_Defs.h:30
json_uchar toBinary(json_uchar c) json_pure
Definition: JSON_Base64.cpp:57
#define json_unlikely(x)
Definition: Unknown_C.h:17
#define HitScopeCoverage(name, id)
Definition: JSONDebug.h:130
static const json_char * chars64(JSON_TEXT("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"))
#define json_global(NAME)
Definition: JSONGlobals.h:26
#define json_char
Definition: Strings_Defs.h:21
#define JSON_ASSERT_SAFE(condition, msg, code)
Definition: JSONDebug.h:49
#define json_likely(x)
Definition: Unknown_C.h:16