- refactored all places which treated FileData as zero terminated.
This commit is contained in:
parent
79e6d068a9
commit
2c2bf0265f
19 changed files with 63 additions and 47 deletions
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
#include "cmdlib.h"
|
||||
#include "fs_findfile.h"
|
||||
#include "filesystem.h"
|
||||
#include "files.h"
|
||||
#include "md5.h"
|
||||
|
||||
|
|
@ -1008,3 +1009,17 @@ void uppercopy(char* to, const char* from)
|
|||
to[i] = 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// GetStringFromLump
|
||||
//
|
||||
// Loads a zero terminated string from a lump in the file system
|
||||
//==========================================================================
|
||||
|
||||
FString GetStringFromLump(int lump)
|
||||
{
|
||||
FileData fd = fileSystem.ReadFile(lump);
|
||||
FString ScriptBuffer(fd.GetString(), fd.GetSize());
|
||||
ScriptBuffer.Truncate(strlen(ScriptBuffer.GetChars())); // this is necessary to properly truncate the generated string to not contain 0 bytes.
|
||||
return ScriptBuffer;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue