Added support for LZMA2 compression method in .7z archives

Updated LZMA SDK to version 9.20
http://www.7-zip.org/sdk.html
http://downloads.sourceforge.net/sevenzip/lzma920.tar.bz2
This commit is contained in:
alexey.lysiuk 2014-04-27 13:05:40 +03:00
commit 3af7d8a245
46 changed files with 2306 additions and 1788 deletions

View file

@ -41,12 +41,8 @@
#include "i_system.h"
#include "w_wad.h"
extern "C" {
#include "Archive/7z/7zHeader.h"
#include "Archive/7z/7zExtract.h"
#include "Archive/7z/7zIn.h"
#include "7z.h"
#include "7zCrc.h"
}
//-----------------------------------------------------------------------
@ -151,7 +147,7 @@ struct C7zArchive
SRes Extract(UInt32 file_index, char *buffer)
{
size_t offset, out_size_processed;
SRes res = SzAr_Extract(&DB, &LookStream.s, file_index,
SRes res = SzArEx_Extract(&DB, &LookStream.s, file_index,
&BlockIndex, &OutBuffer, &OutBufferSize,
&offset, &out_size_processed,
&g_Alloc, &g_Alloc);
@ -279,7 +275,27 @@ bool F7ZFile::Open(bool quiet)
continue;
}
FString name = file->Name;
const size_t nameLength = SzArEx_GetFileNameUtf16(&Archive->DB, i, NULL);
if (0 == nameLength)
{
++skipped;
continue;
}
// Convert UTF-16 filename to plain ASCII
UInt16* const nameUTF16 = static_cast<UInt16*>(alloca(sizeof(UInt16) * nameLength));
SzArEx_GetFileNameUtf16(&Archive->DB, i, nameUTF16);
char* const nameASCII = static_cast<char*>(alloca(nameLength));
for (size_t c = 0; c < nameLength; ++c)
{
nameASCII[c] = static_cast<char>(nameUTF16[c]);
}
FString name = nameASCII;
FixPathSeperator(name);
name.ToLower();