Update on the JSON lib to support new parts encoding.

This commit is contained in:
Erik Zandvliet 2013-09-15 16:08:30 +02:00
parent b10185be2a
commit 5ea87a37f7
2 changed files with 17 additions and 0 deletions

View file

@ -992,3 +992,18 @@ JSON::Value JSON::fromDTMI2(const unsigned char * data, unsigned int len, unsign
tmp["trackid"] = tmpTrackID;
return tmp;
}
std::string JSON::encodeVector(std::vector<long long int> & toEncode){
std::string result;
for(int i = 0; i < toEncode.size(); i++){
long long int temp = toEncode[i];
while( temp >= 0xFFFF){
result += (char)0xFF;
result += (char)0xFF;
temp -= 0xFFFF;
}
result += (char)temp / 255;
result += (char)temp % 255;
}
return result;
}