From b6f4e30044100e223954a31eb7753d024d6413f6 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 8 Oct 2012 13:19:35 +0200 Subject: [PATCH] Avoid compiler warnings on w32, caused by cygw32 changes. src/w32fns.c (w32_color_map_lookup, x_to_w32_color): Argument is now 'const char *'. (x_to_w32_color): Don't modify the argument, modify a copy instead. --- src/ChangeLog | 6 ++++++ src/w32fns.c | 15 +++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index f9a47ebb4b6..7d2509b88cf 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2012-10-08 Eli Zaretskii + + * w32fns.c (w32_color_map_lookup, x_to_w32_color): Argument is now + 'const char *'. + (x_to_w32_color): Don't modify the argument, modify a copy instead. + 2012-10-08 Daniel Colascione * image.c: Permanent fix for JPEG compilation issue --- limit diff --git a/src/w32fns.c b/src/w32fns.c index 996c37f57f9..8620fa8b1e8 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -697,7 +697,7 @@ DEFUN ("w32-default-color-map", Fw32_default_color_map, Sw32_default_color_map, } static Lisp_Object -w32_color_map_lookup (char *colorname) +w32_color_map_lookup (const char *colorname) { Lisp_Object tail, ret = Qnil; @@ -776,7 +776,7 @@ add_system_logical_colors_to_map (Lisp_Object *system_colors) static Lisp_Object -x_to_w32_color (char * colorname) +x_to_w32_color (const char * colorname) { register Lisp_Object ret = Qnil; @@ -785,11 +785,10 @@ x_to_w32_color (char * colorname) if (colorname[0] == '#') { /* Could be an old-style RGB Device specification. */ - char *color; - int size; - color = colorname + 1; + int size = strlen (colorname + 1); + char *color = alloca (size + 1); - size = strlen (color); + strcpy (color, colorname + 1); if (size == 3 || size == 6 || size == 9 || size == 12) { UINT colorval; @@ -843,7 +842,7 @@ x_to_w32_color (char * colorname) } else if (strnicmp (colorname, "rgb:", 4) == 0) { - char *color; + const char *color; UINT colorval; int i, pos; pos = 0; @@ -899,7 +898,7 @@ x_to_w32_color (char * colorname) else if (strnicmp (colorname, "rgbi:", 5) == 0) { /* This is an RGB Intensity specification. */ - char *color; + const char *color; UINT colorval; int i, pos; pos = 0; -- 2.39.2