diff --git a/bc/system/file/posix/Stacked.cpp b/bc/system/file/posix/Stacked.cpp index 4b4e605..9cd9870 100644 --- a/bc/system/file/posix/Stacked.cpp +++ b/bc/system/file/posix/Stacked.cpp @@ -7,6 +7,7 @@ #include "bc/Debug.hpp" #include "bc/File.hpp" #include "bc/Memory.hpp" +#include "bc/memory/Storm.hpp" #include "bc/String.hpp" #include "bc/system/file/posix/Support.hpp" #include @@ -54,7 +55,7 @@ bool Close(FileParms* parms) { BLIZZARD_ASSERT(file != nullptr); ::close(file->filefd); - Blizzard::Memory::Free(file); + SMemFree(file); return true; } @@ -652,7 +653,7 @@ bool Open(FileParms* parms) { if (!file) { auto namelength = Blizzard::String::Length(name.ToString()) + 1; - file = reinterpret_cast(Blizzard::Memory::Allocate(sizeof(Blizzard::File::StreamRecord) + namelength)); + file = reinterpret_cast(SMemAlloc(sizeof(Blizzard::File::StreamRecord) + namelength, __FILE__, __LINE__, 0x8)); auto filename = reinterpret_cast(file) + sizeof(Blizzard::File::StreamRecord); file->name = filename; Blizzard::String::Copy(filename, name.ToString(), namelength); @@ -663,9 +664,10 @@ bool Open(FileParms* parms) { file->haveinfo = false; file->mode = parms->mode; - // if (!file->unk48 || !*file->unk48) { - file->info.size = info.st_size; - // } + // TODO: this part is likely GetFileInfoByFile + if (!file->unk48 || !*file->unk48) { + file->info.size = info.st_size; + } auto modtime = Blizzard::Time::FromUnixTime(info.st_mtime); diff --git a/bc/system/file/win/Stacked.cpp b/bc/system/file/win/Stacked.cpp index a9007de..0a8011b 100644 --- a/bc/system/file/win/Stacked.cpp +++ b/bc/system/file/win/Stacked.cpp @@ -10,6 +10,7 @@ #include "bc/Unicode.hpp" #include "bc/File.hpp" #include "bc/time/Time.hpp" +#include "bc/memory/Storm.hpp" #include @@ -208,8 +209,7 @@ bool Close(FileParms* parms) { ::CloseHandle(file->filehandle); } - Blizzard::Memory::Free(file); - + SMemFree(file); return true; } @@ -676,7 +676,7 @@ bool Open(FileParms* parms) { // alloc(sizeof(StreamRecord) + len(name) + 1) // block of memory holds file as well as C string of the filename auto namesize = Blizzard::String::Length(name); - file = reinterpret_cast(Blizzard::Memory::Allocate(sizeof(Blizzard::File::StreamRecord) + 1 + namesize)); + file = reinterpret_cast(SMemAlloc(sizeof(Blizzard::File::StreamRecord) + 1 + namesize, __FILE__, __LINE__, 0x8)); // set the name pointer inside of StreamRecord to point to the end of StreamRecord (i.e. the start of the name cstring in the memory block) auto filename = reinterpret_cast(file) + sizeof(Blizzard::File::StreamRecord); file->name = filename;