Updated to cbase64-1.1

This commit is contained in:
Jordan Cristiano 2015-07-12 22:50:55 -04:00
parent e959fb0334
commit 04b79ff3f8
5 changed files with 11 additions and 12 deletions

View File

@ -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,7 +174,7 @@ 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++);
@ -186,36 +185,36 @@ unsigned int cbase64_decode_block(const char* code_in, unsigned int length_in,
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

View File

@ -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"