diff options
author | smatz <smatz@openttd.org> | 2009-11-14 15:28:57 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-11-14 15:28:57 +0000 |
commit | 7163c7d3ab1409029d61ef73f55e4e4fac48a216 (patch) | |
tree | 59a5d57360366d4d994e86108dd6f076ef96f94d | |
parent | 32c6633bef1b2382ed882576e7523e0fe96d7a1e (diff) | |
download | openttd-7163c7d3ab1409029d61ef73f55e4e4fac48a216.tar.xz |
(svn r18075) -Codechange: let ScreenshotHandlerProc() accept 'name' as 'const char \*'
-rw-r--r-- | src/screenshot.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/screenshot.cpp b/src/screenshot.cpp index 6c4020413..f9d06cd61 100644 --- a/src/screenshot.cpp +++ b/src/screenshot.cpp @@ -31,7 +31,7 @@ static ScreenshotType _screenshot_type; /* called by the ScreenShot proc to generate screenshot lines. */ typedef void ScreenshotCallback(void *userdata, void *buf, uint y, uint pitch, uint n); -typedef bool ScreenshotHandlerProc(char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette); +typedef bool ScreenshotHandlerProc(const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette); struct ScreenshotFormat { const char *name; @@ -91,7 +91,7 @@ assert_compile(sizeof(RgbTriplet) == 3); * @param palette colour palette (for 8bpp mode) * @return was everything ok? */ -static bool MakeBmpImage(char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette) +static bool MakeBmpImage(const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette) { uint bpp; // bytes per pixel switch (pixelformat) { @@ -208,16 +208,16 @@ static bool MakeBmpImage(char *name, ScreenshotCallback *callb, void *userdata, static void PNGAPI png_my_error(png_structp png_ptr, png_const_charp message) { - DEBUG(misc, 0, "[libpng] error: %s - %s", message, (char *)png_get_error_ptr(png_ptr)); + DEBUG(misc, 0, "[libpng] error: %s - %s", message, (const char *)png_get_error_ptr(png_ptr)); longjmp(png_ptr->jmpbuf, 1); } static void PNGAPI png_my_warning(png_structp png_ptr, png_const_charp message) { - DEBUG(misc, 1, "[libpng] warning: %s - %s", message, (char *)png_get_error_ptr(png_ptr)); + DEBUG(misc, 1, "[libpng] warning: %s - %s", message, (const char *)png_get_error_ptr(png_ptr)); } -static bool MakePNGImage(char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette) +static bool MakePNGImage(const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette) { png_color rq[256]; FILE *f; @@ -233,7 +233,7 @@ static bool MakePNGImage(char *name, ScreenshotCallback *callb, void *userdata, f = fopen(name, "wb"); if (f == NULL) return false; - png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, name, png_my_error, png_my_warning); + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, (void *)name, png_my_error, png_my_warning); if (png_ptr == NULL) { fclose(f); @@ -346,7 +346,7 @@ struct PcxHeader { }; assert_compile(sizeof(PcxHeader) == 128); -static bool MakePCXImage(char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette) +static bool MakePCXImage(const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette) { FILE *f; uint maxlines; @@ -569,7 +569,7 @@ static void LargeWorldCallback(void *userdata, void *buf, uint y, uint pitch, ui _screen_disable_anim = old_disable_anim; } -static char *MakeScreenshotName(const char *ext) +static const char *MakeScreenshotName(const char *ext) { if (_screenshot_name[0] == '\0') { if (_game_mode == GM_EDITOR || _game_mode == GM_MENU || _local_company == COMPANY_SPECTATOR) { |