mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-30 01:48:15 +03:00
Always add null terminator when loading files
This removes the `addnull` argument from `FILESYSTEM_loadFileToMemory` and `FILESYSTEM_loadAssetToMemory`, and makes it so a null terminator is always appended no matter what. This simplifies things and removes the need for callers to make the decision about null termination and what its implications are. Then you get cases where null termination might not happen when it should be, such as the onedf577c59ef(#947) fixed. When FIQ added the `addnull` argument in5862af4445(#117), I'm guessing he did it because he wanted to be cautious about adding the null terminator to every file, so he only did it for XML files, which was the only case needed at the time. But really, there's no downsides to always appending a null terminator. In fact, it's already always done whenever the STDIN buffer is loaded.
This commit is contained in:
@@ -100,7 +100,7 @@ public:
|
||||
SDL_AudioSpec spec;
|
||||
SDL_RWops *fileIn;
|
||||
SDL_zerop(this);
|
||||
FILESYSTEM_loadAssetToMemory(fileName, &mem, &length, false);
|
||||
FILESYSTEM_loadAssetToMemory(fileName, &mem, &length);
|
||||
if (mem == NULL)
|
||||
{
|
||||
vlog_error("Unable to load WAV file %s", fileName);
|
||||
|
||||
Reference in New Issue
Block a user