summaryrefslogtreecommitdiff
path: root/src/screenshot.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-11-14 15:28:57 +0000
committersmatz <smatz@openttd.org>2009-11-14 15:28:57 +0000
commit7163c7d3ab1409029d61ef73f55e4e4fac48a216 (patch)
tree59a5d57360366d4d994e86108dd6f076ef96f94d /src/screenshot.cpp
parent32c6633bef1b2382ed882576e7523e0fe96d7a1e (diff)
downloadopenttd-7163c7d3ab1409029d61ef73f55e4e4fac48a216.tar.xz
(svn r18075) -Codechange: let ScreenshotHandlerProc() accept 'name' as 'const char \*'
Diffstat (limited to 'src/screenshot.cpp')
-rw-r--r--src/screenshot.cpp16
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) {