I am trying to uncompress some data created in VB6 using the zlib API.
I have read this is possible with the qUncompress function: http://doc.trolltech.com/4.4/qbytearray.html#qUncompress
I have read the data in from QDataStream via readRawBytes into a char array, which I then converted to a QByteArray for decompression. I have the compressed length and the expected decompressed length but am not getting anything back from qUncompress.
However I need to prepend the expected decompressed length in big endian format. Has anybody done this and have an example?
I haven’t used VB6 in ages, so I hope this is approximately correct. I think that vb6 used () for array indexing. If I got anything wrong, please let me know.
Looking at the qUncompress docs, you should have put your data in your QByteArray starting at byte 5 (I’m going to assume that you left the array index base set to 1 for this example).
Let’s say the array is named qArr, and the expected uncompressed size is Size. In a ‘big-endian’ representation, the first byte is at the first address.
Does that make sense?
If you needed little endian, you could just reverse the order of the indexes (qArr(4) – qArr(1)) and leave the calculations the same.