07-13-2014, 06:12 AM
(07-13-2014, 01:27 AM)daniel0916 Wrote:(07-13-2014, 12:39 AM)FakeTruth Wrote: Fix this line
It's probably wrong. Check the value you get from it.Code:int UncompressedMaxSize = DataLength - (DataLength << 12) - (DataLength << 14) - (DataLength << 25) - 16;
It's the opposite of the compress code.
I use now 1000000 for testing.
But then the uncompress crashes. Shouldn't i use c_str() or so?Code:char Output [1000000];
int success = uncompress((Bytef *)Output, (uLongf *)1000000, (const Bytef *)ChunkData.c_str(), (uLong)DataLength);
I don't know. I don't know what ChunkData is, or what DataLength is, or what it holds.
You should definitely focus on this line though:
Code:
int UncompressedMaxSize = DataLength - (DataLength << 12) - (DataLength << 14) - (DataLength << 25) - 16;
I'm telling you, check the resulting value of that calculation, it's probably not what you expect. I expect a negative number.
Do you know what << means?