Updated to cbase64-1.1
This commit is contained in:
parent
e959fb0334
commit
04b79ff3f8
|
@ -163,8 +163,7 @@ unsigned int cbase64_decode_block(const char* code_in, unsigned int length_in,
|
|||
const char* const codeend = code_in + length_in;
|
||||
unsigned char* datachar = data_out;
|
||||
char fragment;
|
||||
|
||||
*datachar = state_in->result;
|
||||
char overwrite = state_in->result;
|
||||
|
||||
switch (state_in->step)
|
||||
{
|
||||
|
@ -175,47 +174,47 @@ unsigned int cbase64_decode_block(const char* code_in, unsigned int length_in,
|
|||
if (codechar == codeend)
|
||||
{
|
||||
state_in->step = step_A;
|
||||
state_in->result = *datachar;
|
||||
state_in->result = overwrite;
|
||||
return datachar - data_out;
|
||||
}
|
||||
fragment = cbase64__decode_value(*codechar++);
|
||||
} while (fragment < 0);
|
||||
*datachar = (fragment & 0x03f) << 2;
|
||||
*datachar = (fragment & 0x03f) << 2;
|
||||
case step_B:
|
||||
do {
|
||||
if (codechar == codeend)
|
||||
{
|
||||
state_in->step = step_B;
|
||||
state_in->result = *datachar;
|
||||
state_in->result = overwrite;
|
||||
return datachar - data_out;
|
||||
}
|
||||
fragment = cbase64__decode_value(*codechar++);
|
||||
} while (fragment < 0);
|
||||
*datachar++ |= (fragment & 0x030) >> 4;
|
||||
*datachar = (fragment & 0x00f) << 4;
|
||||
overwrite = (fragment & 0x00f) << 4;
|
||||
case step_C:
|
||||
do {
|
||||
if (codechar == codeend)
|
||||
{
|
||||
state_in->step = step_C;
|
||||
state_in->result = *datachar;
|
||||
state_in->result = overwrite;
|
||||
return datachar - data_out;
|
||||
}
|
||||
fragment = cbase64__decode_value(*codechar++);
|
||||
} while (fragment < 0);
|
||||
*datachar++ |= (fragment & 0x03c) >> 2;
|
||||
*datachar = (fragment & 0x003) << 6;
|
||||
*datachar++ = overwrite | (fragment & 0x03c) >> 2;
|
||||
overwrite = (fragment & 0x003) << 6;
|
||||
case step_D:
|
||||
do {
|
||||
if (codechar == codeend)
|
||||
{
|
||||
state_in->step = step_D;
|
||||
state_in->result = *datachar;
|
||||
state_in->result = overwrite;
|
||||
return datachar - data_out;
|
||||
}
|
||||
fragment = cbase64__decode_value(*codechar++);
|
||||
} while (fragment < 0);
|
||||
*datachar++ |= (fragment & 0x03f);
|
||||
*datachar++ = overwrite | (fragment & 0x03f);
|
||||
}
|
||||
}
|
||||
// control should not reach here
|
|
@ -29,7 +29,7 @@ solution "demboyz"
|
|||
includedirs
|
||||
{
|
||||
"../external/json_checker/include",
|
||||
"../external/cbase64-1.0/include",
|
||||
"../external/cbase64-1.1/include",
|
||||
"../external/sourcesdk/include",
|
||||
"../external/rapidjson-1.0.2/include",
|
||||
"../demboyz"
|
||||
|
|
Loading…
Reference in New Issue
Block a user