i have succeded by following code:
#include <QtZlib/zlib.h>
unsigned char *compressBuf = new unsigned char[CompressedDataLen];
memcpy(compressBuf, buffer, CompressedDataLen);
unsigned char *uncompressBuf = new unsigned char[RawDataLen];
unsigned long int compressBufLength = CompressedDataLen;
unsigned long int uncompressLength = RawDataLen;
int uncompressValue = uncompress(uncompressBuf, &uncompressLength, compressBuf, compressBufLength);
if (uncompressValue != Z_OK)
{
OutErrorMessage
("Uncompression error code " + QString::number(uncompressValue
),
false);
}
RawData
= QByteArray::fromRawData(reinterpret_cast<char
*>
(uncompressBuf
), uncompressLength
);
#include <QtZlib/zlib.h>
unsigned char *compressBuf = new unsigned char[CompressedDataLen];
memcpy(compressBuf, buffer, CompressedDataLen);
unsigned char *uncompressBuf = new unsigned char[RawDataLen];
unsigned long int compressBufLength = CompressedDataLen;
unsigned long int uncompressLength = RawDataLen;
int uncompressValue = uncompress(uncompressBuf, &uncompressLength, compressBuf, compressBufLength);
if (uncompressValue != Z_OK)
{
OutErrorMessage("Uncompression error code " + QString::number(uncompressValue), false);
}
RawData = QByteArray::fromRawData(reinterpret_cast<char*>(uncompressBuf), uncompressLength);
To copy to clipboard, switch view to plain text mode
Resulted decompressed buffer lies in uncompressBuf and in RawData
Thank you !
Bookmarks