Hotfix for encoding parts.
This commit is contained in:
parent
a80eeef659
commit
d77ce7d9e8
1 changed files with 5 additions and 4 deletions
|
@ -120,8 +120,8 @@ namespace JSON {
|
||||||
result += (char)0xFF;
|
result += (char)0xFF;
|
||||||
tmp -= 0xFFFF;
|
tmp -= 0xFFFF;
|
||||||
}
|
}
|
||||||
result += (char)tmp / 255;
|
result += (char)(tmp / 256);
|
||||||
result += (char)tmp % 255;
|
result += (char)(tmp % 256);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -131,8 +131,9 @@ namespace JSON {
|
||||||
result.clear();
|
result.clear();
|
||||||
int tmp = 0;
|
int tmp = 0;
|
||||||
for( int i = 0; i < input.size(); i += 2){
|
for( int i = 0; i < input.size(); i += 2){
|
||||||
tmp += input[i] + input[i + 1];
|
int curLen = (input[i] << 8) + input[i + 1];
|
||||||
if ((tmp % 0xFFFF) != 0 || (input[i] + input[i+1]) == 0){
|
tmp += curLen;
|
||||||
|
if (curLen != 0xFFFF){
|
||||||
result.push_back(tmp);
|
result.push_back(tmp);
|
||||||
tmp = 0;
|
tmp = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue