Код: Выделить всё
lzoERR: Header error - invalid compressed data
Decompression failed: Header error - invalid compressed data
Вот фрагмент кода C++, который идеально подходит для распаковки:
Код: Выделить всё
void PacketParser(char* rawBuffer)
{
short maxPktSize = 506, headerOffset = 8;
int offsetRaw = 0;
int offsetData = 0;
int dataLen = 0;
int cNetId = (int)((rawBuffer+offsetRaw)[0]);
offsetRaw += 2;
short iNoPackets=0;
memcpy(&iNoPackets, rawBuffer+offsetRaw, 2);
offsetRaw += 2;
iNoPackets = ntohs(iNoPackets);
for(int t = 0; t < iNoPackets; t++)
{
short iCompLen = 0;
memcpy(&iCompLen, rawBuffer+offsetRaw, 2);
offsetRaw += 2;
iCompLen = ntohs(iCompLen);
if(iCompLen>0)
{
int lzoOutSize = 4096;
int lzoERR, lzoERRCount=0;
///Decompress using LZO
lzo_uint i_len = (lzo_uint)iCompLen;
lzo_uint o_len = (lzo_uint)-1;
lzo_byte i_buff[1024];
lzo_memset(i_buff,0,1024);
memcpy(i_buff, rawBuffer+offsetRaw, iCompLen);
if (i_buff == NULL) return;
offsetRaw += iCompLen;
lzo_byte o_buff[4096];
lzo_memset(o_buff,0, 4096);
lzoERR = lzo1z_decompress(i_buff,i_len,o_buff,&o_len,NULL);
if(lzoERR!=0)
{
cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79205731/using-lzo-decompress-in-python-fails-with-header-error-invalid-compressed-dat[/url]
Мобильная версия