Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/rheit/zdoom
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Oelckers committed May 8, 2014
2 parents 6988156 + ea7fb93 commit a7f8f7c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/resourcefiles/file_7z.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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);
Expand Down

0 comments on commit a7f8f7c

Please sign in to comment.