forked from soutade/libgourou
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
55ab41613e | |||
8129ec4423 | |||
9ab66ddba9 |
@@ -40,7 +40,7 @@
|
||||
#define ACS_SERVER "http://adeactivate.adobe.com/adept"
|
||||
#endif
|
||||
|
||||
#define LIBGOUROU_VERSION "0.4.3"
|
||||
#define LIBGOUROU_VERSION "0.4.4"
|
||||
|
||||
namespace gourou
|
||||
{
|
||||
|
@@ -441,26 +441,31 @@ void DRMProcessorClientImpl::inflate(std::string data, gourou::ByteArray& result
|
||||
|
||||
int ret = inflateInit2(&infstream, wbits);
|
||||
|
||||
ret = ::inflate(&infstream, Z_SYNC_FLUSH);
|
||||
if (ret != Z_OK)
|
||||
EXCEPTION(gourou::CLIENT_ZIP_ERROR, infstream.msg);
|
||||
|
||||
ret = ::inflate(&infstream, Z_FINISH);
|
||||
while (ret == Z_OK || ret == Z_STREAM_END)
|
||||
{
|
||||
result.append(buffer, dataSize-infstream.avail_out);
|
||||
if (ret == Z_STREAM_END) break;
|
||||
if ((ret == Z_OK && infstream.avail_out != 0) || ret == Z_STREAM_END)
|
||||
break;
|
||||
infstream.avail_out = (uInt)dataSize; // size of output
|
||||
infstream.next_out = (Bytef *)buffer; // output char array
|
||||
ret = ::inflate(&infstream, Z_SYNC_FLUSH);
|
||||
ret = ::inflate(&infstream, Z_FINISH);
|
||||
}
|
||||
|
||||
inflateEnd(&infstream);
|
||||
if (ret == Z_STREAM_END)
|
||||
ret = deflateEnd(&infstream);
|
||||
|
||||
delete[] buffer;
|
||||
|
||||
if (ret != Z_OK && ret != Z_STREAM_END && ret != Z_BUF_ERROR)
|
||||
if (ret != Z_OK && ret != Z_STREAM_END)
|
||||
EXCEPTION(gourou::CLIENT_ZIP_ERROR, zError(ret));
|
||||
}
|
||||
|
||||
void DRMProcessorClientImpl::deflate(std::string data, gourou::ByteArray& result,
|
||||
int wbits, int compressionLevel)
|
||||
int wbits, int compressionLevel)
|
||||
{
|
||||
unsigned int dataSize = data.size();
|
||||
unsigned char* buffer = new unsigned char[dataSize];
|
||||
@@ -479,20 +484,25 @@ void DRMProcessorClientImpl::deflate(std::string data, gourou::ByteArray& result
|
||||
int ret = deflateInit2(&defstream, Z_DEFAULT_COMPRESSION, Z_DEFLATED, wbits,
|
||||
compressionLevel, Z_DEFAULT_STRATEGY);
|
||||
|
||||
ret = ::deflate(&defstream, Z_SYNC_FLUSH);
|
||||
if (ret != Z_OK)
|
||||
EXCEPTION(gourou::CLIENT_ZIP_ERROR, defstream.msg);
|
||||
|
||||
ret = ::deflate(&defstream, Z_FINISH);
|
||||
while (ret == Z_OK || ret == Z_STREAM_END)
|
||||
{
|
||||
result.append(buffer, dataSize-defstream.avail_out);
|
||||
if (ret == Z_STREAM_END) break;
|
||||
if ((ret == Z_OK && defstream.avail_out != 0) || ret == Z_STREAM_END)
|
||||
break;
|
||||
defstream.avail_out = (uInt)dataSize; // size of output
|
||||
defstream.next_out = (Bytef *)buffer; // output char array
|
||||
ret = ::deflate(&defstream, Z_SYNC_FLUSH);
|
||||
ret = ::deflate(&defstream, Z_FINISH);
|
||||
}
|
||||
|
||||
deflateEnd(&defstream);
|
||||
|
||||
if (ret == Z_STREAM_END)
|
||||
ret = deflateEnd(&defstream);
|
||||
|
||||
delete[] buffer;
|
||||
|
||||
if (ret != Z_OK && ret != Z_STREAM_END && ret != Z_BUF_ERROR)
|
||||
if (ret != Z_OK && ret != Z_STREAM_END)
|
||||
EXCEPTION(gourou::CLIENT_ZIP_ERROR, zError(ret));
|
||||
}
|
||||
|
Reference in New Issue
Block a user