# HG changeset patch # User YAMAMOTO Mitsuharu # Date 1162283461 0 # Node ID a87d92458ce06c3eb076ff98bb8d9c90415d4ce1 # Parent 7c88de81d0f5ffea6f78dff79a15c044485c3926 [MAC_OS] (image_load_qt_1, xpm_scan, xpm_make_color_table_v) (xpm_put_color_table_v, xpm_get_color_table_v, xpm_make_color_table_h) (xpm_put_color_table_h, xpm_get_color_table_h, xpm_str_to_color_key) (xpm_load_image): Add const qualifier to arguments. [MAC_OS] (xpm_color_key_strings): Make static const. diff -r 7c88de81d0f5 -r a87d92458ce0 src/image.c --- a/src/image.c Tue Oct 31 06:42:59 2006 +0000 +++ b/src/image.c Tue Oct 31 08:31:01 2006 +0000 @@ -2393,7 +2393,7 @@ struct frame *f; struct image *img; OSType type; - FSSpec *fss; + const FSSpec *fss; Handle dh; { ComponentResult err; @@ -2407,8 +2407,7 @@ XImagePtr ximg; RGBColor bg_color; - err = OpenADefaultComponent (GraphicsImporterComponentType, - type, &gi); + err = OpenADefaultComponent (GraphicsImporterComponentType, type, &gi); if (err != noErr) { image_error ("Cannot get importer component for `%s'", img->spec, Qnil); @@ -4110,25 +4109,25 @@ /* XPM support functions for Mac OS where libxpm is not available. Only XPM version 3 (without any extensions) is supported. */ -static int xpm_scan P_ ((unsigned char **, unsigned char *, - unsigned char **, int *)); +static int xpm_scan P_ ((const unsigned char **, const unsigned char *, + const unsigned char **, int *)); static Lisp_Object xpm_make_color_table_v - P_ ((void (**) (Lisp_Object, unsigned char *, int, Lisp_Object), - Lisp_Object (**) (Lisp_Object, unsigned char *, int))); -static void xpm_put_color_table_v P_ ((Lisp_Object, unsigned char *, + P_ ((void (**) (Lisp_Object, const unsigned char *, int, Lisp_Object), + Lisp_Object (**) (Lisp_Object, const unsigned char *, int))); +static void xpm_put_color_table_v P_ ((Lisp_Object, const unsigned char *, int, Lisp_Object)); static Lisp_Object xpm_get_color_table_v P_ ((Lisp_Object, - unsigned char *, int)); + const unsigned char *, int)); static Lisp_Object xpm_make_color_table_h - P_ ((void (**) (Lisp_Object, unsigned char *, int, Lisp_Object), - Lisp_Object (**) (Lisp_Object, unsigned char *, int))); -static void xpm_put_color_table_h P_ ((Lisp_Object, unsigned char *, + P_ ((void (**) (Lisp_Object, const unsigned char *, int, Lisp_Object), + Lisp_Object (**) (Lisp_Object, const unsigned char *, int))); +static void xpm_put_color_table_h P_ ((Lisp_Object, const unsigned char *, int, Lisp_Object)); static Lisp_Object xpm_get_color_table_h P_ ((Lisp_Object, - unsigned char *, int)); -static int xpm_str_to_color_key P_ ((char *)); + const unsigned char *, int)); +static int xpm_str_to_color_key P_ ((const char *)); static int xpm_load_image P_ ((struct frame *, struct image *, - unsigned char *, unsigned char *)); + const unsigned char *, const unsigned char *)); /* Tokens returned from xpm_scan. */ @@ -4148,7 +4147,7 @@ static int xpm_scan (s, end, beg, len) - unsigned char **s, *end, **beg; + const unsigned char **s, *end, **beg; int *len; { int c; @@ -4214,8 +4213,8 @@ static Lisp_Object xpm_make_color_table_v (put_func, get_func) - void (**put_func) (Lisp_Object, unsigned char *, int, Lisp_Object); - Lisp_Object (**get_func) (Lisp_Object, unsigned char *, int); + void (**put_func) (Lisp_Object, const unsigned char *, int, Lisp_Object); + Lisp_Object (**get_func) (Lisp_Object, const unsigned char *, int); { *put_func = xpm_put_color_table_v; *get_func = xpm_get_color_table_v; @@ -4225,7 +4224,7 @@ static void xpm_put_color_table_v (color_table, chars_start, chars_len, color) Lisp_Object color_table; - unsigned char *chars_start; + const unsigned char *chars_start; int chars_len; Lisp_Object color; { @@ -4235,7 +4234,7 @@ static Lisp_Object xpm_get_color_table_v (color_table, chars_start, chars_len) Lisp_Object color_table; - unsigned char *chars_start; + const unsigned char *chars_start; int chars_len; { return XVECTOR (color_table)->contents[*chars_start]; @@ -4243,8 +4242,8 @@ static Lisp_Object xpm_make_color_table_h (put_func, get_func) - void (**put_func) (Lisp_Object, unsigned char *, int, Lisp_Object); - Lisp_Object (**get_func) (Lisp_Object, unsigned char *, int); + void (**put_func) (Lisp_Object, const unsigned char *, int, Lisp_Object); + Lisp_Object (**get_func) (Lisp_Object, const unsigned char *, int); { *put_func = xpm_put_color_table_h; *get_func = xpm_get_color_table_h; @@ -4257,7 +4256,7 @@ static void xpm_put_color_table_h (color_table, chars_start, chars_len, color) Lisp_Object color_table; - unsigned char *chars_start; + const unsigned char *chars_start; int chars_len; Lisp_Object color; { @@ -4272,7 +4271,7 @@ static Lisp_Object xpm_get_color_table_h (color_table, chars_start, chars_len) Lisp_Object color_table; - unsigned char *chars_start; + const unsigned char *chars_start; int chars_len; { struct Lisp_Hash_Table *table = XHASH_TABLE (color_table); @@ -4290,11 +4289,11 @@ XPM_COLOR_KEY_C }; -static char xpm_color_key_strings[][4] = {"s", "m", "g4", "g", "c"}; +static const char xpm_color_key_strings[][4] = {"s", "m", "g4", "g", "c"}; static int xpm_str_to_color_key (s) - char *s; + const char *s; { int i; @@ -4310,15 +4309,15 @@ xpm_load_image (f, img, contents, end) struct frame *f; struct image *img; - unsigned char *contents, *end; -{ - unsigned char *s = contents, *beg, *str; + const unsigned char *contents, *end; +{ + const unsigned char *s = contents, *beg, *str; unsigned char buffer[BUFSIZ]; int width, height, x, y; int num_colors, chars_per_pixel; int len, LA1; - void (*put_color_table) (Lisp_Object, unsigned char *, int, Lisp_Object); - Lisp_Object (*get_color_table) (Lisp_Object, unsigned char *, int); + void (*put_color_table) (Lisp_Object, const unsigned char *, int, Lisp_Object); + Lisp_Object (*get_color_table) (Lisp_Object, const unsigned char *, int); Lisp_Object frame, color_symbols, color_table; int best_key, have_mask = 0; XImagePtr ximg = NULL, mask_img = NULL;