x2t - ooxml flat - fix gzip image

This commit is contained in:
ElenaSubbotina
2020-09-09 11:32:55 +03:00
parent 6456fa802a
commit cd8adbe83b
2 changed files with 6 additions and 5 deletions

View File

@ -196,11 +196,12 @@ namespace NSShapeImageGen
bool result = false; bool result = false;
CImageFileFormatChecker checker; CImageFileFormatChecker checker;
std::wstring strFileSrc = strFileName;
std::wstring sTempUnpacked; std::wstring sTempUnpacked;
std::wstring strFileSrc = strFileName;
COfficeUtils officeUtils(NULL); COfficeUtils officeUtils(NULL);
if (officeUtils.IsArchive(strFileSrc))
while (officeUtils.IsArchive(strFileSrc))
{ {
sTempUnpacked = m_strTempMedia + FILE_SEPARATOR_STR + L"zip_unpacked"; sTempUnpacked = m_strTempMedia + FILE_SEPARATOR_STR + L"zip_unpacked";
NSDirectory::CreateDirectory(sTempUnpacked); NSDirectory::CreateDirectory(sTempUnpacked);
@ -214,14 +215,14 @@ namespace NSShapeImageGen
} }
} }
else else
{//deflate {//gzip
BYTE *pData = NULL; BYTE *pData = NULL;
DWORD nBytesCount = 0; DWORD nBytesCount = 0;
NSFile::CFileBinary file; NSFile::CFileBinary file;
if (file.ReadAllBytes(strFileSrc, &pData, nBytesCount)) if (file.ReadAllBytes(strFileSrc, &pData, nBytesCount))
{ {
ULONG nBytesUncompress = nBytesCount * 3; ULONG nBytesUncompress = nBytesCount * 10;
BYTE* pDataUncompress = new BYTE[nBytesUncompress]; BYTE* pDataUncompress = new BYTE[nBytesUncompress];
if (S_OK == officeUtils.Uncompress(pDataUncompress, &nBytesUncompress, pData, nBytesCount)) if (S_OK == officeUtils.Uncompress(pDataUncompress, &nBytesUncompress, pData, nBytesCount))
{ {

View File

@ -661,7 +661,7 @@ int flush;
} }
NEEDBITS(16); NEEDBITS(16);
#ifdef GUNZIP #ifdef GUNZIP
if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ if ((state->wrap & 2 || state->wrap & 5) && hold == 0x8b1f) { /* gzip header */
if (state->wbits == 0) if (state->wbits == 0)
state->wbits = 15; state->wbits = 15;
state->check = crc32(0L, Z_NULL, 0); state->check = crc32(0L, Z_NULL, 0);