diff options
author | KUDr <kudr@openttd.org> | 2007-01-11 17:29:39 +0000 |
---|---|---|
committer | KUDr <kudr@openttd.org> | 2007-01-11 17:29:39 +0000 |
commit | 33be1ecfb1a9056b027d50d7b558cff87c5b744d (patch) | |
tree | d644a3831ca0947198b191fa3e4e8973d3a9786e /src/screenshot.cpp | |
parent | 91ff74641060445dc1647bbf05baeb03b45c3099 (diff) | |
download | openttd-33be1ecfb1a9056b027d50d7b558cff87c5b744d.tar.xz |
(svn r8066) - Codechange: MallocT(), CallocT(), ReallocT() now return the pointer to allocated memory instead of modifying the pointer given as parameter
Diffstat (limited to 'src/screenshot.cpp')
-rw-r--r-- | src/screenshot.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/screenshot.cpp b/src/screenshot.cpp index f66745540..9408d20f0 100644 --- a/src/screenshot.cpp +++ b/src/screenshot.cpp @@ -68,7 +68,6 @@ static bool MakeBmpImage(const char *name, ScreenshotCallback *callb, void *user BitmapFileHeader bfh; BitmapInfoHeader bih; RgbQuad rq[256]; - Pixel *buff; FILE *f; uint i, padw; uint n, maxlines; @@ -119,7 +118,7 @@ static bool MakeBmpImage(const char *name, ScreenshotCallback *callb, void *user maxlines = clamp(65536 / padw, 16, 128); // now generate the bitmap bits - MallocT(&buff, padw * maxlines); // by default generate 128 lines at a time. + Pixel *buff = MallocT<Pixel>(padw * maxlines); // by default generate 128 lines at a time. if (buff == NULL) { fclose(f); return false; @@ -170,7 +169,6 @@ static void PNGAPI png_my_warning(png_structp png_ptr, png_const_charp message) static bool MakePNGImage(const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette) { png_color rq[256]; - Pixel *buff; FILE *f; uint i, y, n; uint maxlines; @@ -226,7 +224,7 @@ static bool MakePNGImage(const char *name, ScreenshotCallback *callb, void *user maxlines = clamp(65536 / w, 16, 128); // now generate the bitmap bits - MallocT(&buff, w * maxlines); // by default generate 128 lines at a time. + Pixel *buff = MallocT<Pixel>(w * maxlines); // by default generate 128 lines at a time. if (buff == NULL) { png_destroy_write_struct(&png_ptr, &info_ptr); fclose(f); @@ -283,7 +281,6 @@ assert_compile(sizeof(PcxHeader) == 128); static bool MakePCXImage(const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette) { - Pixel *buff; FILE *f; uint maxlines; uint y; @@ -323,7 +320,7 @@ static bool MakePCXImage(const char *name, ScreenshotCallback *callb, void *user maxlines = clamp(65536 / w, 16, 128); // now generate the bitmap bits - MallocT(&buff, w * maxlines); // by default generate 128 lines at a time. + Pixel *buff = MallocT<Pixel>(w * maxlines); // by default generate 128 lines at a time. if (buff == NULL) { fclose(f); return false; |