diff options
author | rubidium <rubidium@openttd.org> | 2007-12-08 14:50:41 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-12-08 14:50:41 +0000 |
commit | f1e4914b5f379f9821274e8ddc4196b152fcc9b0 (patch) | |
tree | b8ebe2d1af4279edf6f4a53f991c963c77f5bba0 /src/saveload.cpp | |
parent | 73c58d8a409d7e5f3dbb864be893a1c0b34defd6 (diff) | |
download | openttd-f1e4914b5f379f9821274e8ddc4196b152fcc9b0.tar.xz |
(svn r11597) -Change: replace all remaining instances of (re|m|c)alloc with (Re|M|C)allocT and add a check for out-of-memory situations to the *allocT functions.
Diffstat (limited to 'src/saveload.cpp')
-rw-r--r-- | src/saveload.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/saveload.cpp b/src/saveload.cpp index 7358f6a32..43ce745db 100644 --- a/src/saveload.cpp +++ b/src/saveload.cpp @@ -575,7 +575,7 @@ static void SlString(void *ptr, size_t length, VarType conv) if (len == 0) { *(char**)ptr = NULL; } else { - *(char**)ptr = (char*)malloc(len + 1); // terminating '\0' + *(char**)ptr = MallocT<char>(len + 1); // terminating '\0' ptr = *(char**)ptr; SlCopyBytes(ptr, len); } @@ -1060,7 +1060,7 @@ static void WriteLZO(uint size) static bool InitLZO() { _sl.bufsize = LZO_SIZE; - _sl.buf = _sl.buf_ori = (byte*)malloc(LZO_SIZE); + _sl.buf = _sl.buf_ori = MallocT<byte>(LZO_SIZE); return true; } @@ -1085,7 +1085,7 @@ static void WriteNoComp(uint size) static bool InitNoComp() { _sl.bufsize = LZO_SIZE; - _sl.buf = _sl.buf_ori = (byte*)malloc(LZO_SIZE); + _sl.buf = _sl.buf_ori = MallocT<byte>(LZO_SIZE); return true; } @@ -1154,7 +1154,7 @@ static bool InitReadZlib() if (inflateInit(&_z) != Z_OK) return false; _sl.bufsize = 4096; - _sl.buf = _sl.buf_ori = (byte*)malloc(4096 + 4096); // also contains fread buffer + _sl.buf = _sl.buf_ori = MallocT<byte>(4096 + 4096); // also contains fread buffer return true; } @@ -1194,7 +1194,7 @@ static bool InitWriteZlib() if (deflateInit(&_z, 6) != Z_OK) return false; _sl.bufsize = 4096; - _sl.buf = _sl.buf_ori = (byte*)malloc(4096); // also contains fread buffer + _sl.buf = _sl.buf_ori = MallocT<byte>(4096); // also contains fread buffer return true; } |