mirror of
https://github.com/ZDoom/qzdoom.git
synced 2025-02-02 22:01:41 +00:00
- fixed allocation size when constructing a string from a file system entry.
The internal allocator already added space for the terminazing \0, so the string's size was one character too large.
This commit is contained in:
parent
8d3c1adf05
commit
513d8cea8d
1 changed files with 6 additions and 6 deletions
|
@ -1608,17 +1608,17 @@ FileData::~FileData ()
|
|||
{
|
||||
}
|
||||
|
||||
FString::FString (ELumpNum lumpnum)
|
||||
FString::FString(ELumpNum lumpnum)
|
||||
{
|
||||
auto lumpr = fileSystem.OpenFileReader ((int)lumpnum);
|
||||
auto size = lumpr.GetLength ();
|
||||
AllocBuffer (1 + size);
|
||||
auto numread = lumpr.Read (&Chars[0], size);
|
||||
auto lumpr = fileSystem.OpenFileReader((int)lumpnum);
|
||||
auto size = lumpr.GetLength();
|
||||
AllocBuffer(size);
|
||||
auto numread = lumpr.Read(&Chars[0], size);
|
||||
Chars[size] = '\0';
|
||||
|
||||
if (numread != size)
|
||||
{
|
||||
I_Error ("ConstructStringFromLump: Only read %ld of %ld bytes on lump %i (%s)\n",
|
||||
I_Error("ConstructStringFromLump: Only read %ld of %ld bytes on lump %i (%s)\n",
|
||||
numread, size, lumpnum, fileSystem.GetFileFullName((int)lumpnum));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue