summaryrefslogtreecommitdiff
path: root/src/bmp.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-01-10 18:56:51 +0000
committerrubidium <rubidium@openttd.org>2007-01-10 18:56:51 +0000
commitf35ed4bbc2b05f1b83476b60948d64375f77f1b4 (patch)
tree1a1c59c13ddb1d152052f3a3a0bcffe4fb531173 /src/bmp.cpp
parenta332d10fd938f345fff18e5f4a662a58f692f734 (diff)
downloadopenttd-f35ed4bbc2b05f1b83476b60948d64375f77f1b4.tar.xz
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
Diffstat (limited to 'src/bmp.cpp')
-rw-r--r--src/bmp.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/bmp.cpp b/src/bmp.cpp
index c2bd91270..e9a882021 100644
--- a/src/bmp.cpp
+++ b/src/bmp.cpp
@@ -5,6 +5,7 @@
#include "gfx.h"
#include "bmp.h"
#include "macros.h"
+#include "helpers.hpp"
void BmpInitializeBuffer(BmpBuffer *buffer, FILE *file) {
buffer->pos = -1;
@@ -328,7 +329,7 @@ bool BmpReadHeader(BmpBuffer *buffer, BmpInfo *info, BmpData *data)
}
if (info->palette_size == 0) info->palette_size = 1 << info->bpp;
- data->palette = calloc(info->palette_size, sizeof(*(data->palette)));
+ CallocT(&data->palette, info->palette_size);
if (data->palette == NULL) return false;
for (i = 0; i < info->palette_size; i++) {
@@ -350,7 +351,7 @@ bool BmpReadBitmap(BmpBuffer *buffer, BmpInfo *info, BmpData *data)
{
assert(info != NULL && data != NULL);
- data->bitmap = calloc(info->width * info->height, ((info->bpp == 24) ? 3 : 1) * sizeof(byte));
+ data->bitmap = (byte*)calloc(info->width * info->height, ((info->bpp == 24) ? 3 : 1) * sizeof(byte));
if (data->bitmap == NULL) return false;
/* Load image */