mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 06:53:58 +00:00
- fixed: memory allocation for file names in 7z archives was broken. Changing it to use TArray instead of alloca makes it work.
This commit is contained in:
parent
2223c12938
commit
ea7fb936a8
1 changed files with 7 additions and 9 deletions
|
@ -264,6 +264,8 @@ bool F7ZFile::Open(bool quiet)
|
|||
Lumps = new F7ZLump[NumLumps];
|
||||
|
||||
F7ZLump *lump_p = Lumps;
|
||||
TArray<UInt16> nameUTF16;
|
||||
TArray<char> nameASCII;
|
||||
for (DWORD i = 0; i < NumLumps; ++i)
|
||||
{
|
||||
CSzFileItem *file = &Archive->DB.db.Files[i];
|
||||
|
@ -283,20 +285,16 @@ bool F7ZFile::Open(bool quiet)
|
|||
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));
|
||||
|
||||
nameUTF16.Resize(nameLength);
|
||||
nameASCII.Resize(nameLength);
|
||||
SzArEx_GetFileNameUtf16(&Archive->DB, i, &nameUTF16[0]);
|
||||
for (size_t c = 0; c < nameLength; ++c)
|
||||
{
|
||||
nameASCII[c] = static_cast<char>(nameUTF16[c]);
|
||||
}
|
||||
FixPathSeperator(&nameASCII[0]);
|
||||
|
||||
FString name = nameASCII;
|
||||
FixPathSeperator(name);
|
||||
FString name = &nameASCII[0];
|
||||
name.ToLower();
|
||||
|
||||
lump_p->LumpNameSetup(name);
|
||||
|
|
Loading…
Reference in a new issue