Commit 0d883411 authored by mercury233's avatar mercury233 Committed by GitHub

fix CZipReader error log (#21)

parent 174aa518
...@@ -521,7 +521,6 @@ IReadFile* CZipReader::createAndOpenFile(u32 index) ...@@ -521,7 +521,6 @@ IReadFile* CZipReader::createAndOpenFile(u32 index)
//99 - AES encryption, WinZip 9 //99 - AES encryption, WinZip 9
const SZipFileEntry &e = FileInfo[Files[index].ID]; const SZipFileEntry &e = FileInfo[Files[index].ID];
wchar_t buf[64];
s16 actualCompressionMethod=e.header.CompressionMethod; s16 actualCompressionMethod=e.header.CompressionMethod;
IReadFile* decrypted=0; IReadFile* decrypted=0;
u8* decryptedBuf=0; u8* decryptedBuf=0;
...@@ -620,8 +619,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index) ...@@ -620,8 +619,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index)
c8* pBuf = new c8[ uncompressedSize ]; c8* pBuf = new c8[ uncompressedSize ];
if (!pBuf) if (!pBuf)
{ {
swprintf ( buf, 64, L"Not enough memory for decompressing %s", Files[index].FullName.c_str() ); os::Printer::log("Not enough memory for decompressing", Files[index].FullName, ELL_ERROR);
os::Printer::log( buf, ELL_ERROR);
if (decrypted) if (decrypted)
decrypted->drop(); decrypted->drop();
return 0; return 0;
...@@ -633,8 +631,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index) ...@@ -633,8 +631,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index)
pcData = new u8[decryptedSize]; pcData = new u8[decryptedSize];
if (!pcData) if (!pcData)
{ {
swprintf ( buf, 64, L"Not enough memory for decompressing %s", Files[index].FullName.c_str() ); os::Printer::log("Not enough memory for decompressing", Files[index].FullName, ELL_ERROR);
os::Printer::log( buf, ELL_ERROR);
delete [] pBuf; delete [] pBuf;
return 0; return 0;
} }
...@@ -674,8 +671,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index) ...@@ -674,8 +671,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index)
if (err != Z_OK) if (err != Z_OK)
{ {
swprintf ( buf, 64, L"Error decompressing %s", Files[index].FullName.c_str() ); os::Printer::log("Error decompressing", Files[index].FullName, ELL_ERROR);
os::Printer::log( buf, ELL_ERROR);
delete [] pBuf; delete [] pBuf;
return 0; return 0;
} }
...@@ -694,8 +690,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index) ...@@ -694,8 +690,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index)
c8* pBuf = new c8[ uncompressedSize ]; c8* pBuf = new c8[ uncompressedSize ];
if (!pBuf) if (!pBuf)
{ {
swprintf ( buf, 64, L"Not enough memory for decompressing %s", Files[index].FullName.c_str() ); os::Printer::log("Not enough memory for decompressing", Files[index].FullName, ELL_ERROR);
os::Printer::log( buf, ELL_ERROR);
if (decrypted) if (decrypted)
decrypted->drop(); decrypted->drop();
return 0; return 0;
...@@ -707,8 +702,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index) ...@@ -707,8 +702,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index)
pcData = new u8[decryptedSize]; pcData = new u8[decryptedSize];
if (!pcData) if (!pcData)
{ {
swprintf ( buf, 64, L"Not enough memory for decompressing %s", Files[index].FullName.c_str() ); os::Printer::log("Not enough memory for decompressing", Files[index].FullName, ELL_ERROR);
os::Printer::log( buf, ELL_ERROR);
delete [] pBuf; delete [] pBuf;
return 0; return 0;
} }
...@@ -745,8 +739,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index) ...@@ -745,8 +739,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index)
if (err != BZ_OK) if (err != BZ_OK)
{ {
swprintf ( buf, 64, L"Error decompressing %s", Files[index].FullName.c_str() ); os::Printer::log("Error decompressing", Files[index].FullName, ELL_ERROR);
os::Printer::log( buf, ELL_ERROR);
delete [] pBuf; delete [] pBuf;
return 0; return 0;
} }
...@@ -766,8 +759,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index) ...@@ -766,8 +759,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index)
c8* pBuf = new c8[ uncompressedSize ]; c8* pBuf = new c8[ uncompressedSize ];
if (!pBuf) if (!pBuf)
{ {
swprintf ( buf, 64, L"Not enough memory for decompressing %s", Files[index].FullName.c_str() ); os::Printer::log("Not enough memory for decompressing", Files[index].FullName, ELL_ERROR);
os::Printer::log( buf, ELL_ERROR);
if (decrypted) if (decrypted)
decrypted->drop(); decrypted->drop();
return 0; return 0;
...@@ -779,8 +771,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index) ...@@ -779,8 +771,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index)
pcData = new u8[decryptedSize]; pcData = new u8[decryptedSize];
if (!pcData) if (!pcData)
{ {
swprintf ( buf, 64, L"Not enough memory for decompressing %s", Files[index].FullName.c_str() ); os::Printer::log("Not enough memory for decompressing", Files[index].FullName, ELL_ERROR);
os::Printer::log( buf, ELL_ERROR);
delete [] pBuf; delete [] pBuf;
return 0; return 0;
} }
...@@ -826,8 +817,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index) ...@@ -826,8 +817,7 @@ IReadFile* CZipReader::createAndOpenFile(u32 index)
os::Printer::log("Decryption support not enabled. File cannot be read.", ELL_ERROR); os::Printer::log("Decryption support not enabled. File cannot be read.", ELL_ERROR);
return 0; return 0;
default: default:
swprintf ( buf, 64, L"file has unsupported compression method. %s", Files[index].FullName.c_str() ); os::Printer::log("file has unsupported compression method.", Files[index].FullName, ELL_ERROR);
os::Printer::log( buf, ELL_ERROR);
return 0; return 0;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment