diff options
| author | YAMAMOTO Mitsuharu | 2006-10-31 08:31:01 +0000 |
|---|---|---|
| committer | YAMAMOTO Mitsuharu | 2006-10-31 08:31:01 +0000 |
| commit | 46accb8f6d56db75c565dc42d19899abb12329a4 (patch) | |
| tree | ff15d5b40db88dcd40c07141f86d9764f4fb7562 /src | |
| parent | 7147863a1cadafc27dcab1d3f28ccab2224a6316 (diff) | |
| download | emacs-46accb8f6d56db75c565dc42d19899abb12329a4.tar.gz emacs-46accb8f6d56db75c565dc42d19899abb12329a4.zip | |
[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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/image.c | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/src/image.c b/src/image.c index 30c01702d85..f4616b626a6 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -2393,7 +2393,7 @@ image_load_qt_1 (f, img, type, fss, dh) | |||
| 2393 | struct frame *f; | 2393 | struct frame *f; |
| 2394 | struct image *img; | 2394 | struct image *img; |
| 2395 | OSType type; | 2395 | OSType type; |
| 2396 | FSSpec *fss; | 2396 | const FSSpec *fss; |
| 2397 | Handle dh; | 2397 | Handle dh; |
| 2398 | { | 2398 | { |
| 2399 | ComponentResult err; | 2399 | ComponentResult err; |
| @@ -2407,8 +2407,7 @@ image_load_qt_1 (f, img, type, fss, dh) | |||
| 2407 | XImagePtr ximg; | 2407 | XImagePtr ximg; |
| 2408 | RGBColor bg_color; | 2408 | RGBColor bg_color; |
| 2409 | 2409 | ||
| 2410 | err = OpenADefaultComponent (GraphicsImporterComponentType, | 2410 | err = OpenADefaultComponent (GraphicsImporterComponentType, type, &gi); |
| 2411 | type, &gi); | ||
| 2412 | if (err != noErr) | 2411 | if (err != noErr) |
| 2413 | { | 2412 | { |
| 2414 | image_error ("Cannot get importer component for `%s'", img->spec, Qnil); | 2413 | image_error ("Cannot get importer component for `%s'", img->spec, Qnil); |
| @@ -4110,25 +4109,25 @@ xpm_load (f, img) | |||
| 4110 | /* XPM support functions for Mac OS where libxpm is not available. | 4109 | /* XPM support functions for Mac OS where libxpm is not available. |
| 4111 | Only XPM version 3 (without any extensions) is supported. */ | 4110 | Only XPM version 3 (without any extensions) is supported. */ |
| 4112 | 4111 | ||
| 4113 | static int xpm_scan P_ ((unsigned char **, unsigned char *, | 4112 | static int xpm_scan P_ ((const unsigned char **, const unsigned char *, |
| 4114 | unsigned char **, int *)); | 4113 | const unsigned char **, int *)); |
| 4115 | static Lisp_Object xpm_make_color_table_v | 4114 | static Lisp_Object xpm_make_color_table_v |
| 4116 | P_ ((void (**) (Lisp_Object, unsigned char *, int, Lisp_Object), | 4115 | P_ ((void (**) (Lisp_Object, const unsigned char *, int, Lisp_Object), |
| 4117 | Lisp_Object (**) (Lisp_Object, unsigned char *, int))); | 4116 | Lisp_Object (**) (Lisp_Object, const unsigned char *, int))); |
| 4118 | static void xpm_put_color_table_v P_ ((Lisp_Object, unsigned char *, | 4117 | static void xpm_put_color_table_v P_ ((Lisp_Object, const unsigned char *, |
| 4119 | int, Lisp_Object)); | 4118 | int, Lisp_Object)); |
| 4120 | static Lisp_Object xpm_get_color_table_v P_ ((Lisp_Object, | 4119 | static Lisp_Object xpm_get_color_table_v P_ ((Lisp_Object, |
| 4121 | unsigned char *, int)); | 4120 | const unsigned char *, int)); |
| 4122 | static Lisp_Object xpm_make_color_table_h | 4121 | static Lisp_Object xpm_make_color_table_h |
| 4123 | P_ ((void (**) (Lisp_Object, unsigned char *, int, Lisp_Object), | 4122 | P_ ((void (**) (Lisp_Object, const unsigned char *, int, Lisp_Object), |
| 4124 | Lisp_Object (**) (Lisp_Object, unsigned char *, int))); | 4123 | Lisp_Object (**) (Lisp_Object, const unsigned char *, int))); |
| 4125 | static void xpm_put_color_table_h P_ ((Lisp_Object, unsigned char *, | 4124 | static void xpm_put_color_table_h P_ ((Lisp_Object, const unsigned char *, |
| 4126 | int, Lisp_Object)); | 4125 | int, Lisp_Object)); |
| 4127 | static Lisp_Object xpm_get_color_table_h P_ ((Lisp_Object, | 4126 | static Lisp_Object xpm_get_color_table_h P_ ((Lisp_Object, |
| 4128 | unsigned char *, int)); | 4127 | const unsigned char *, int)); |
| 4129 | static int xpm_str_to_color_key P_ ((char *)); | 4128 | static int xpm_str_to_color_key P_ ((const char *)); |
| 4130 | static int xpm_load_image P_ ((struct frame *, struct image *, | 4129 | static int xpm_load_image P_ ((struct frame *, struct image *, |
| 4131 | unsigned char *, unsigned char *)); | 4130 | const unsigned char *, const unsigned char *)); |
| 4132 | 4131 | ||
| 4133 | /* Tokens returned from xpm_scan. */ | 4132 | /* Tokens returned from xpm_scan. */ |
| 4134 | 4133 | ||
| @@ -4148,7 +4147,7 @@ enum xpm_token | |||
| 4148 | 4147 | ||
| 4149 | static int | 4148 | static int |
| 4150 | xpm_scan (s, end, beg, len) | 4149 | xpm_scan (s, end, beg, len) |
| 4151 | unsigned char **s, *end, **beg; | 4150 | const unsigned char **s, *end, **beg; |
| 4152 | int *len; | 4151 | int *len; |
| 4153 | { | 4152 | { |
| 4154 | int c; | 4153 | int c; |
| @@ -4214,8 +4213,8 @@ xpm_scan (s, end, beg, len) | |||
| 4214 | 4213 | ||
| 4215 | static Lisp_Object | 4214 | static Lisp_Object |
| 4216 | xpm_make_color_table_v (put_func, get_func) | 4215 | xpm_make_color_table_v (put_func, get_func) |
| 4217 | void (**put_func) (Lisp_Object, unsigned char *, int, Lisp_Object); | 4216 | void (**put_func) (Lisp_Object, const unsigned char *, int, Lisp_Object); |
| 4218 | Lisp_Object (**get_func) (Lisp_Object, unsigned char *, int); | 4217 | Lisp_Object (**get_func) (Lisp_Object, const unsigned char *, int); |
| 4219 | { | 4218 | { |
| 4220 | *put_func = xpm_put_color_table_v; | 4219 | *put_func = xpm_put_color_table_v; |
| 4221 | *get_func = xpm_get_color_table_v; | 4220 | *get_func = xpm_get_color_table_v; |
| @@ -4225,7 +4224,7 @@ xpm_make_color_table_v (put_func, get_func) | |||
| 4225 | static void | 4224 | static void |
| 4226 | xpm_put_color_table_v (color_table, chars_start, chars_len, color) | 4225 | xpm_put_color_table_v (color_table, chars_start, chars_len, color) |
| 4227 | Lisp_Object color_table; | 4226 | Lisp_Object color_table; |
| 4228 | unsigned char *chars_start; | 4227 | const unsigned char *chars_start; |
| 4229 | int chars_len; | 4228 | int chars_len; |
| 4230 | Lisp_Object color; | 4229 | Lisp_Object color; |
| 4231 | { | 4230 | { |
| @@ -4235,7 +4234,7 @@ xpm_put_color_table_v (color_table, chars_start, chars_len, color) | |||
| 4235 | static Lisp_Object | 4234 | static Lisp_Object |
| 4236 | xpm_get_color_table_v (color_table, chars_start, chars_len) | 4235 | xpm_get_color_table_v (color_table, chars_start, chars_len) |
| 4237 | Lisp_Object color_table; | 4236 | Lisp_Object color_table; |
| 4238 | unsigned char *chars_start; | 4237 | const unsigned char *chars_start; |
| 4239 | int chars_len; | 4238 | int chars_len; |
| 4240 | { | 4239 | { |
| 4241 | return XVECTOR (color_table)->contents[*chars_start]; | 4240 | return XVECTOR (color_table)->contents[*chars_start]; |
| @@ -4243,8 +4242,8 @@ xpm_get_color_table_v (color_table, chars_start, chars_len) | |||
| 4243 | 4242 | ||
| 4244 | static Lisp_Object | 4243 | static Lisp_Object |
| 4245 | xpm_make_color_table_h (put_func, get_func) | 4244 | xpm_make_color_table_h (put_func, get_func) |
| 4246 | void (**put_func) (Lisp_Object, unsigned char *, int, Lisp_Object); | 4245 | void (**put_func) (Lisp_Object, const unsigned char *, int, Lisp_Object); |
| 4247 | Lisp_Object (**get_func) (Lisp_Object, unsigned char *, int); | 4246 | Lisp_Object (**get_func) (Lisp_Object, const unsigned char *, int); |
| 4248 | { | 4247 | { |
| 4249 | *put_func = xpm_put_color_table_h; | 4248 | *put_func = xpm_put_color_table_h; |
| 4250 | *get_func = xpm_get_color_table_h; | 4249 | *get_func = xpm_get_color_table_h; |
| @@ -4257,7 +4256,7 @@ xpm_make_color_table_h (put_func, get_func) | |||
| 4257 | static void | 4256 | static void |
| 4258 | xpm_put_color_table_h (color_table, chars_start, chars_len, color) | 4257 | xpm_put_color_table_h (color_table, chars_start, chars_len, color) |
| 4259 | Lisp_Object color_table; | 4258 | Lisp_Object color_table; |
| 4260 | unsigned char *chars_start; | 4259 | const unsigned char *chars_start; |
| 4261 | int chars_len; | 4260 | int chars_len; |
| 4262 | Lisp_Object color; | 4261 | Lisp_Object color; |
| 4263 | { | 4262 | { |
| @@ -4272,7 +4271,7 @@ xpm_put_color_table_h (color_table, chars_start, chars_len, color) | |||
| 4272 | static Lisp_Object | 4271 | static Lisp_Object |
| 4273 | xpm_get_color_table_h (color_table, chars_start, chars_len) | 4272 | xpm_get_color_table_h (color_table, chars_start, chars_len) |
| 4274 | Lisp_Object color_table; | 4273 | Lisp_Object color_table; |
| 4275 | unsigned char *chars_start; | 4274 | const unsigned char *chars_start; |
| 4276 | int chars_len; | 4275 | int chars_len; |
| 4277 | { | 4276 | { |
| 4278 | struct Lisp_Hash_Table *table = XHASH_TABLE (color_table); | 4277 | struct Lisp_Hash_Table *table = XHASH_TABLE (color_table); |
| @@ -4290,11 +4289,11 @@ enum xpm_color_key { | |||
| 4290 | XPM_COLOR_KEY_C | 4289 | XPM_COLOR_KEY_C |
| 4291 | }; | 4290 | }; |
| 4292 | 4291 | ||
| 4293 | static char xpm_color_key_strings[][4] = {"s", "m", "g4", "g", "c"}; | 4292 | static const char xpm_color_key_strings[][4] = {"s", "m", "g4", "g", "c"}; |
| 4294 | 4293 | ||
| 4295 | static int | 4294 | static int |
| 4296 | xpm_str_to_color_key (s) | 4295 | xpm_str_to_color_key (s) |
| 4297 | char *s; | 4296 | const char *s; |
| 4298 | { | 4297 | { |
| 4299 | int i; | 4298 | int i; |
| 4300 | 4299 | ||
| @@ -4310,15 +4309,15 @@ static int | |||
| 4310 | xpm_load_image (f, img, contents, end) | 4309 | xpm_load_image (f, img, contents, end) |
| 4311 | struct frame *f; | 4310 | struct frame *f; |
| 4312 | struct image *img; | 4311 | struct image *img; |
| 4313 | unsigned char *contents, *end; | 4312 | const unsigned char *contents, *end; |
| 4314 | { | 4313 | { |
| 4315 | unsigned char *s = contents, *beg, *str; | 4314 | const unsigned char *s = contents, *beg, *str; |
| 4316 | unsigned char buffer[BUFSIZ]; | 4315 | unsigned char buffer[BUFSIZ]; |
| 4317 | int width, height, x, y; | 4316 | int width, height, x, y; |
| 4318 | int num_colors, chars_per_pixel; | 4317 | int num_colors, chars_per_pixel; |
| 4319 | int len, LA1; | 4318 | int len, LA1; |
| 4320 | void (*put_color_table) (Lisp_Object, unsigned char *, int, Lisp_Object); | 4319 | void (*put_color_table) (Lisp_Object, const unsigned char *, int, Lisp_Object); |
| 4321 | Lisp_Object (*get_color_table) (Lisp_Object, unsigned char *, int); | 4320 | Lisp_Object (*get_color_table) (Lisp_Object, const unsigned char *, int); |
| 4322 | Lisp_Object frame, color_symbols, color_table; | 4321 | Lisp_Object frame, color_symbols, color_table; |
| 4323 | int best_key, have_mask = 0; | 4322 | int best_key, have_mask = 0; |
| 4324 | XImagePtr ximg = NULL, mask_img = NULL; | 4323 | XImagePtr ximg = NULL, mask_img = NULL; |