aboutsummaryrefslogtreecommitdiffstats
path: root/src/image.c
diff options
context:
space:
mode:
authorJuanma Barranquero2010-07-05 12:36:06 +0200
committerJuanma Barranquero2010-07-05 12:36:06 +0200
commitd3da34e0dab1404e80dba5413b3c449a6ea8fa0c (patch)
treec24d736f75b63d4abb1b8ddd49b088632ccd8aee /src/image.c
parent00be444c737e95c7455aa1808d9da75d4affd51f (diff)
downloademacs-d3da34e0dab1404e80dba5413b3c449a6ea8fa0c.tar.gz
emacs-d3da34e0dab1404e80dba5413b3c449a6ea8fa0c.zip
Convert most remaining function definitions to standard C.
* buffer.c, cm.c, eval.c, keyboard.c, process.c, term.c, vm-limit.c, * xdisp.c: Convert function definitions to standard C. * cm.c (cmputc): Arg C is now int, not char. * process.c (Fmake_network_process): Cast sockaddr_in* to sockaddr*.
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c495
1 files changed, 132 insertions, 363 deletions
diff --git a/src/image.c b/src/image.c
index 821246eac03..adc28ba8d38 100644
--- a/src/image.c
+++ b/src/image.c
@@ -181,26 +181,20 @@ XPutPixel (XImagePtr ximage, int x, int y, unsigned long pixel)
181/* Functions to access the contents of a bitmap, given an id. */ 181/* Functions to access the contents of a bitmap, given an id. */
182 182
183int 183int
184x_bitmap_height (f, id) 184x_bitmap_height (FRAME_PTR f, int id)
185 FRAME_PTR f;
186 int id;
187{ 185{
188 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].height; 186 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].height;
189} 187}
190 188
191int 189int
192x_bitmap_width (f, id) 190x_bitmap_width (FRAME_PTR f, int id)
193 FRAME_PTR f;
194 int id;
195{ 191{
196 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].width; 192 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].width;
197} 193}
198 194
199#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) 195#if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI)
200int 196int
201x_bitmap_pixmap (f, id) 197x_bitmap_pixmap (FRAME_PTR f, int id)
202 FRAME_PTR f;
203 int id;
204{ 198{
205 return (int) FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap; 199 return (int) FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap;
206} 200}
@@ -208,9 +202,7 @@ x_bitmap_pixmap (f, id)
208 202
209#ifdef HAVE_X_WINDOWS 203#ifdef HAVE_X_WINDOWS
210int 204int
211x_bitmap_mask (f, id) 205x_bitmap_mask (FRAME_PTR f, int id)
212 FRAME_PTR f;
213 int id;
214{ 206{
215 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].mask; 207 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].mask;
216} 208}
@@ -219,8 +211,7 @@ x_bitmap_mask (f, id)
219/* Allocate a new bitmap record. Returns index of new record. */ 211/* Allocate a new bitmap record. Returns index of new record. */
220 212
221static int 213static int
222x_allocate_bitmap_record (f) 214x_allocate_bitmap_record (FRAME_PTR f)
223 FRAME_PTR f;
224{ 215{
225 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 216 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
226 int i; 217 int i;
@@ -251,9 +242,7 @@ x_allocate_bitmap_record (f)
251/* Add one reference to the reference count of the bitmap with id ID. */ 242/* Add one reference to the reference count of the bitmap with id ID. */
252 243
253void 244void
254x_reference_bitmap (f, id) 245x_reference_bitmap (FRAME_PTR f, int id)
255 FRAME_PTR f;
256 int id;
257{ 246{
258 ++FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].refcount; 247 ++FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].refcount;
259} 248}
@@ -261,10 +250,7 @@ x_reference_bitmap (f, id)
261/* Create a bitmap for frame F from a HEIGHT x WIDTH array of bits at BITS. */ 250/* Create a bitmap for frame F from a HEIGHT x WIDTH array of bits at BITS. */
262 251
263int 252int
264x_create_bitmap_from_data (f, bits, width, height) 253x_create_bitmap_from_data (struct frame *f, char *bits, unsigned int width, unsigned int height)
265 struct frame *f;
266 char *bits;
267 unsigned int width, height;
268{ 254{
269 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 255 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
270 int id; 256 int id;
@@ -323,9 +309,7 @@ x_create_bitmap_from_data (f, bits, width, height)
323/* Create bitmap from file FILE for frame F. */ 309/* Create bitmap from file FILE for frame F. */
324 310
325int 311int
326x_create_bitmap_from_file (f, file) 312x_create_bitmap_from_file (struct frame *f, Lisp_Object file)
327 struct frame *f;
328 Lisp_Object file;
329{ 313{
330 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 314 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
331 315
@@ -402,9 +386,7 @@ x_create_bitmap_from_file (f, file)
402/* Free bitmap B. */ 386/* Free bitmap B. */
403 387
404static void 388static void
405free_bitmap_record (dpyinfo, bm) 389free_bitmap_record (Display_Info *dpyinfo, Bitmap_Record *bm)
406 Display_Info *dpyinfo;
407 Bitmap_Record *bm;
408{ 390{
409#ifdef HAVE_X_WINDOWS 391#ifdef HAVE_X_WINDOWS
410 XFreePixmap (dpyinfo->display, bm->pixmap); 392 XFreePixmap (dpyinfo->display, bm->pixmap);
@@ -430,9 +412,7 @@ free_bitmap_record (dpyinfo, bm)
430/* Remove reference to bitmap with id number ID. */ 412/* Remove reference to bitmap with id number ID. */
431 413
432void 414void
433x_destroy_bitmap (f, id) 415x_destroy_bitmap (FRAME_PTR f, int id)
434 FRAME_PTR f;
435 int id;
436{ 416{
437 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 417 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
438 418
@@ -452,8 +432,7 @@ x_destroy_bitmap (f, id)
452/* Free all the bitmaps for the display specified by DPYINFO. */ 432/* Free all the bitmaps for the display specified by DPYINFO. */
453 433
454void 434void
455x_destroy_all_bitmaps (dpyinfo) 435x_destroy_all_bitmaps (Display_Info *dpyinfo)
456 Display_Info *dpyinfo;
457{ 436{
458 int i; 437 int i;
459 Bitmap_Record *bm = dpyinfo->bitmaps; 438 Bitmap_Record *bm = dpyinfo->bitmaps;
@@ -487,9 +466,7 @@ static void x_destroy_x_image (XImagePtr ximg);
487 It's nicer with some borders in this context */ 466 It's nicer with some borders in this context */
488 467
489int 468int
490x_create_bitmap_mask (f, id) 469x_create_bitmap_mask (struct frame *f, int id)
491 struct frame *f;
492 int id;
493{ 470{
494 Pixmap pixmap, mask; 471 Pixmap pixmap, mask;
495 XImagePtr ximg, mask_img; 472 XImagePtr ximg, mask_img;
@@ -637,9 +614,7 @@ static int x_build_heuristic_mask (struct frame *, struct image *,
637 image_types and caches the loading status of TYPE. */ 614 image_types and caches the loading status of TYPE. */
638 615
639static Lisp_Object 616static Lisp_Object
640define_image_type (type, loaded) 617define_image_type (struct image_type *type, int loaded)
641 struct image_type *type;
642 int loaded;
643{ 618{
644 Lisp_Object success; 619 Lisp_Object success;
645 620
@@ -665,8 +640,7 @@ define_image_type (type, loaded)
665 structure. Value is null if SYMBOL is not a known image type. */ 640 structure. Value is null if SYMBOL is not a known image type. */
666 641
667static INLINE struct image_type * 642static INLINE struct image_type *
668lookup_image_type (symbol) 643lookup_image_type (Lisp_Object symbol)
669 Lisp_Object symbol;
670{ 644{
671 struct image_type *type; 645 struct image_type *type;
672 646
@@ -690,8 +664,7 @@ lookup_image_type (symbol)
690 image type. */ 664 image type. */
691 665
692int 666int
693valid_image_p (object) 667valid_image_p (Lisp_Object object)
694 Lisp_Object object;
695{ 668{
696 int valid_p = 0; 669 int valid_p = 0;
697 670
@@ -726,9 +699,7 @@ valid_image_p (object)
726 therefore simply displays a message. */ 699 therefore simply displays a message. */
727 700
728static void 701static void
729image_error (format, arg1, arg2) 702image_error (char *format, Lisp_Object arg1, Lisp_Object arg2)
730 char *format;
731 Lisp_Object arg1, arg2;
732{ 703{
733 add_to_log (format, arg1, arg2); 704 add_to_log (format, arg1, arg2);
734} 705}
@@ -788,11 +759,8 @@ static Lisp_Object image_spec_value (Lisp_Object, Lisp_Object, int *);
788 allowed keyword/value pairs. Value is non-zero if SPEC is valid. */ 759 allowed keyword/value pairs. Value is non-zero if SPEC is valid. */
789 760
790static int 761static int
791parse_image_spec (spec, keywords, nkeywords, type) 762parse_image_spec (Lisp_Object spec, struct image_keyword *keywords,
792 Lisp_Object spec; 763 int nkeywords, Lisp_Object type)
793 struct image_keyword *keywords;
794 int nkeywords;
795 Lisp_Object type;
796{ 764{
797 int i; 765 int i;
798 Lisp_Object plist; 766 Lisp_Object plist;
@@ -928,9 +896,7 @@ parse_image_spec (spec, keywords, nkeywords, type)
928 to 1 if KEY was found in SPEC, set it to 0 otherwise. */ 896 to 1 if KEY was found in SPEC, set it to 0 otherwise. */
929 897
930static Lisp_Object 898static Lisp_Object
931image_spec_value (spec, key, found) 899image_spec_value (Lisp_Object spec, Lisp_Object key, int *found)
932 Lisp_Object spec, key;
933 int *found;
934{ 900{
935 Lisp_Object tail; 901 Lisp_Object tail;
936 902
@@ -1048,9 +1014,7 @@ Lisp_Object Vmax_image_size;
1048 SPEC. SPEC has a hash value of HASH. */ 1014 SPEC. SPEC has a hash value of HASH. */
1049 1015
1050static struct image * 1016static struct image *
1051make_image (spec, hash) 1017make_image (Lisp_Object spec, unsigned int hash)
1052 Lisp_Object spec;
1053 unsigned hash;
1054{ 1018{
1055 struct image *img = (struct image *) xmalloc (sizeof *img); 1019 struct image *img = (struct image *) xmalloc (sizeof *img);
1056 Lisp_Object file = image_spec_value (spec, QCfile, NULL); 1020 Lisp_Object file = image_spec_value (spec, QCfile, NULL);
@@ -1072,9 +1036,7 @@ make_image (spec, hash)
1072/* Free image IMG which was used on frame F, including its resources. */ 1036/* Free image IMG which was used on frame F, including its resources. */
1073 1037
1074static void 1038static void
1075free_image (f, img) 1039free_image (struct frame *f, struct image *img)
1076 struct frame *f;
1077 struct image *img;
1078{ 1040{
1079 if (img) 1041 if (img)
1080 { 1042 {
@@ -1101,10 +1063,7 @@ free_image (f, img)
1101 otherwise, return 0. */ 1063 otherwise, return 0. */
1102 1064
1103int 1065int
1104check_image_size (f, width, height) 1066check_image_size (struct frame *f, int width, int height)
1105 struct frame *f;
1106 int width;
1107 int height;
1108{ 1067{
1109 int w, h; 1068 int w, h;
1110 1069
@@ -1135,9 +1094,7 @@ check_image_size (f, width, height)
1135 drawing an image. */ 1094 drawing an image. */
1136 1095
1137void 1096void
1138prepare_image_for_display (f, img) 1097prepare_image_for_display (struct frame *f, struct image *img)
1139 struct frame *f;
1140 struct image *img;
1141{ 1098{
1142 EMACS_TIME t; 1099 EMACS_TIME t;
1143 1100
@@ -1157,10 +1114,7 @@ prepare_image_for_display (f, img)
1157 drawn in face FACE. */ 1114 drawn in face FACE. */
1158 1115
1159int 1116int
1160image_ascent (img, face, slice) 1117image_ascent (struct image *img, struct face *face, struct glyph_slice *slice)
1161 struct image *img;
1162 struct face *face;
1163 struct glyph_slice *slice;
1164{ 1118{
1165 int height; 1119 int height;
1166 int ascent; 1120 int ascent;
@@ -1206,10 +1160,8 @@ image_ascent (img, face, slice)
1206 On W32, XIMG is assumed to a device context with the bitmap selected. */ 1160 On W32, XIMG is assumed to a device context with the bitmap selected. */
1207 1161
1208static RGB_PIXEL_COLOR 1162static RGB_PIXEL_COLOR
1209four_corners_best (ximg, corners, width, height) 1163four_corners_best (XImagePtr_or_DC ximg, int *corners,
1210 XImagePtr_or_DC ximg; 1164 unsigned long width, unsigned long height)
1211 int *corners;
1212 unsigned long width, height;
1213{ 1165{
1214 RGB_PIXEL_COLOR corner_pixels[4], best; 1166 RGB_PIXEL_COLOR corner_pixels[4], best;
1215 int i, best_count; 1167 int i, best_count;
@@ -1281,10 +1233,7 @@ four_corners_best (ximg, corners, width, height)
1281 use for the heuristic. */ 1233 use for the heuristic. */
1282 1234
1283RGB_PIXEL_COLOR 1235RGB_PIXEL_COLOR
1284image_background (img, f, ximg) 1236image_background (struct image *img, struct frame *f, XImagePtr_or_DC ximg)
1285 struct image *img;
1286 struct frame *f;
1287 XImagePtr_or_DC ximg;
1288{ 1237{
1289 if (! img->background_valid) 1238 if (! img->background_valid)
1290 /* IMG doesn't have a background yet, try to guess a reasonable value. */ 1239 /* IMG doesn't have a background yet, try to guess a reasonable value. */
@@ -1323,10 +1272,7 @@ image_background (img, f, ximg)
1323 existing XImage object to use for the heuristic. */ 1272 existing XImage object to use for the heuristic. */
1324 1273
1325int 1274int
1326image_background_transparent (img, f, mask) 1275image_background_transparent (struct image *img, struct frame *f, XImagePtr_or_DC mask)
1327 struct image *img;
1328 struct frame *f;
1329 XImagePtr_or_DC mask;
1330{ 1276{
1331 if (! img->background_transparent_valid) 1277 if (! img->background_transparent_valid)
1332 /* IMG doesn't have a background yet, try to guess a reasonable value. */ 1278 /* IMG doesn't have a background yet, try to guess a reasonable value. */
@@ -1386,10 +1332,8 @@ static unsigned long x_alloc_image_color (struct frame *f,
1386 the image, if any. */ 1332 the image, if any. */
1387 1333
1388static void 1334static void
1389x_clear_image_1 (f, img, pixmap_p, mask_p, colors_p) 1335x_clear_image_1 (struct frame *f, struct image *img, int pixmap_p, int mask_p,
1390 struct frame *f; 1336 int colors_p)
1391 struct image *img;
1392 int pixmap_p, mask_p, colors_p;
1393{ 1337{
1394 if (pixmap_p && img->pixmap) 1338 if (pixmap_p && img->pixmap)
1395 { 1339 {
@@ -1422,9 +1366,7 @@ x_clear_image_1 (f, img, pixmap_p, mask_p, colors_p)
1422/* Free X resources of image IMG which is used on frame F. */ 1366/* Free X resources of image IMG which is used on frame F. */
1423 1367
1424static void 1368static void
1425x_clear_image (f, img) 1369x_clear_image (struct frame *f, struct image *img)
1426 struct frame *f;
1427 struct image *img;
1428{ 1370{
1429 BLOCK_INPUT; 1371 BLOCK_INPUT;
1430 x_clear_image_1 (f, img, 1, 1, 1); 1372 x_clear_image_1 (f, img, 1, 1, 1);
@@ -1438,11 +1380,8 @@ x_clear_image (f, img)
1438 color. */ 1380 color. */
1439 1381
1440static unsigned long 1382static unsigned long
1441x_alloc_image_color (f, img, color_name, dflt) 1383x_alloc_image_color (struct frame *f, struct image *img, Lisp_Object color_name,
1442 struct frame *f; 1384 unsigned long dflt)
1443 struct image *img;
1444 Lisp_Object color_name;
1445 unsigned long dflt;
1446{ 1385{
1447 XColor color; 1386 XColor color;
1448 unsigned long result; 1387 unsigned long result;
@@ -1480,7 +1419,7 @@ static void postprocess_image (struct frame *, struct image *);
1480 heap. Call free_image_cache to free an image cache. */ 1419 heap. Call free_image_cache to free an image cache. */
1481 1420
1482struct image_cache * 1421struct image_cache *
1483make_image_cache () 1422make_image_cache (void)
1484{ 1423{
1485 struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c); 1424 struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c);
1486 int size; 1425 int size;
@@ -1498,10 +1437,7 @@ make_image_cache ()
1498/* Find an image matching SPEC in the cache, and return it. If no 1437/* Find an image matching SPEC in the cache, and return it. If no
1499 image is found, return NULL. */ 1438 image is found, return NULL. */
1500static struct image * 1439static struct image *
1501search_image_cache (f, spec, hash) 1440search_image_cache (struct frame *f, Lisp_Object spec, unsigned int hash)
1502 struct frame *f;
1503 Lisp_Object spec;
1504 unsigned hash;
1505{ 1441{
1506 struct image *img; 1442 struct image *img;
1507 struct image_cache *c = FRAME_IMAGE_CACHE (f); 1443 struct image_cache *c = FRAME_IMAGE_CACHE (f);
@@ -1534,9 +1470,7 @@ search_image_cache (f, spec, hash)
1534/* Search frame F for an image with spec SPEC, and free it. */ 1470/* Search frame F for an image with spec SPEC, and free it. */
1535 1471
1536static void 1472static void
1537uncache_image (f, spec) 1473uncache_image (struct frame *f, Lisp_Object spec)
1538 struct frame *f;
1539 Lisp_Object spec;
1540{ 1474{
1541 struct image *img = search_image_cache (f, spec, sxhash (spec, 0)); 1475 struct image *img = search_image_cache (f, spec, sxhash (spec, 0));
1542 if (img) 1476 if (img)
@@ -1548,8 +1482,7 @@ uncache_image (f, spec)
1548 caches. */ 1482 caches. */
1549 1483
1550void 1484void
1551free_image_cache (f) 1485free_image_cache (struct frame *f)
1552 struct frame *f;
1553{ 1486{
1554 struct image_cache *c = FRAME_IMAGE_CACHE (f); 1487 struct image_cache *c = FRAME_IMAGE_CACHE (f);
1555 if (c) 1488 if (c)
@@ -1725,9 +1658,7 @@ FRAME t means refresh the image on all frames. */)
1725 by the image's specification, */ 1658 by the image's specification, */
1726 1659
1727static void 1660static void
1728postprocess_image (f, img) 1661postprocess_image (struct frame *f, struct image *img)
1729 struct frame *f;
1730 struct image *img;
1731{ 1662{
1732 /* Manipulation of the image's mask. */ 1663 /* Manipulation of the image's mask. */
1733 if (img->pixmap) 1664 if (img->pixmap)
@@ -1800,9 +1731,7 @@ postprocess_image (f, img)
1800 SPEC must be a valid Lisp image specification (see valid_image_p). */ 1731 SPEC must be a valid Lisp image specification (see valid_image_p). */
1801 1732
1802int 1733int
1803lookup_image (f, spec) 1734lookup_image (struct frame *f, Lisp_Object spec)
1804 struct frame *f;
1805 Lisp_Object spec;
1806{ 1735{
1807 struct image_cache *c; 1736 struct image_cache *c;
1808 struct image *img; 1737 struct image *img;
@@ -1922,9 +1851,7 @@ lookup_image (f, spec)
1922/* Cache image IMG in the image cache of frame F. */ 1851/* Cache image IMG in the image cache of frame F. */
1923 1852
1924static void 1853static void
1925cache_image (f, img) 1854cache_image (struct frame *f, struct image *img)
1926 struct frame *f;
1927 struct image *img;
1928{ 1855{
1929 struct image_cache *c = FRAME_IMAGE_CACHE (f); 1856 struct image_cache *c = FRAME_IMAGE_CACHE (f);
1930 int i; 1857 int i;
@@ -1964,8 +1891,7 @@ cache_image (f, img)
1964/* Mark Lisp objects in image IMG. */ 1891/* Mark Lisp objects in image IMG. */
1965 1892
1966static void 1893static void
1967mark_image (img) 1894mark_image (struct image *img)
1968 struct image *img;
1969{ 1895{
1970 mark_object (img->spec); 1896 mark_object (img->spec);
1971 mark_object (img->dependencies); 1897 mark_object (img->dependencies);
@@ -2049,11 +1975,8 @@ static void x_put_x_image (struct frame *, XImagePtr, Pixmap, int, int);
2049 should indicate the bit depth of the image. */ 1975 should indicate the bit depth of the image. */
2050 1976
2051static int 1977static int
2052x_create_x_image_and_pixmap (f, width, height, depth, ximg, pixmap) 1978x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
2053 struct frame *f; 1979 XImagePtr *ximg, Pixmap *pixmap)
2054 int width, height, depth;
2055 XImagePtr *ximg;
2056 Pixmap *pixmap;
2057{ 1980{
2058#ifdef HAVE_X_WINDOWS 1981#ifdef HAVE_X_WINDOWS
2059 Display *display = FRAME_X_DISPLAY (f); 1982 Display *display = FRAME_X_DISPLAY (f);
@@ -2192,8 +2115,7 @@ x_create_x_image_and_pixmap (f, width, height, depth, ximg, pixmap)
2192/* Destroy XImage XIMG. Free XIMG->data. */ 2115/* Destroy XImage XIMG. Free XIMG->data. */
2193 2116
2194static void 2117static void
2195x_destroy_x_image (ximg) 2118x_destroy_x_image (XImagePtr ximg)
2196 XImagePtr ximg;
2197{ 2119{
2198 xassert (interrupt_input_blocked); 2120 xassert (interrupt_input_blocked);
2199 if (ximg) 2121 if (ximg)
@@ -2219,11 +2141,7 @@ x_destroy_x_image (ximg)
2219 are width and height of both the image and pixmap. */ 2141 are width and height of both the image and pixmap. */
2220 2142
2221static void 2143static void
2222x_put_x_image (f, ximg, pixmap, width, height) 2144x_put_x_image (struct frame *f, XImagePtr ximg, Pixmap pixmap, int width, int height)
2223 struct frame *f;
2224 XImagePtr ximg;
2225 Pixmap pixmap;
2226 int width, height;
2227{ 2145{
2228#ifdef HAVE_X_WINDOWS 2146#ifdef HAVE_X_WINDOWS
2229 GC gc; 2147 GC gc;
@@ -2261,8 +2179,7 @@ static unsigned char *slurp_file (char *, int *);
2261 found, or nil if not found. */ 2179 found, or nil if not found. */
2262 2180
2263Lisp_Object 2181Lisp_Object
2264x_find_image_file (file) 2182x_find_image_file (Lisp_Object file)
2265 Lisp_Object file;
2266{ 2183{
2267 Lisp_Object file_found, search_path; 2184 Lisp_Object file_found, search_path;
2268 struct gcpro gcpro1, gcpro2; 2185 struct gcpro gcpro1, gcpro2;
@@ -2297,9 +2214,7 @@ x_find_image_file (file)
2297 occurred. *SIZE is set to the size of the file. */ 2214 occurred. *SIZE is set to the size of the file. */
2298 2215
2299static unsigned char * 2216static unsigned char *
2300slurp_file (file, size) 2217slurp_file (char *file, int *size)
2301 char *file;
2302 int *size;
2303{ 2218{
2304 FILE *fp = NULL; 2219 FILE *fp = NULL;
2305 unsigned char *buf = NULL; 2220 unsigned char *buf = NULL;
@@ -2434,8 +2349,7 @@ enum xbm_token
2434 displayed is used. */ 2349 displayed is used. */
2435 2350
2436static int 2351static int
2437xbm_image_p (object) 2352xbm_image_p (Lisp_Object object)
2438 Lisp_Object object;
2439{ 2353{
2440 struct image_keyword kw[XBM_LAST]; 2354 struct image_keyword kw[XBM_LAST];
2441 2355
@@ -2528,10 +2442,7 @@ xbm_image_p (object)
2528 scanning a number, store its value in *IVAL. */ 2442 scanning a number, store its value in *IVAL. */
2529 2443
2530static int 2444static int
2531xbm_scan (s, end, sval, ival) 2445xbm_scan (unsigned char **s, unsigned char *end, char *sval, int *ival)
2532 unsigned char **s, *end;
2533 char *sval;
2534 int *ival;
2535{ 2446{
2536 unsigned int c; 2447 unsigned int c;
2537 2448
@@ -2695,12 +2606,9 @@ convert_mono_to_color_image (f, img, foreground, background)
2695 2606
2696 2607
2697static void 2608static void
2698Create_Pixmap_From_Bitmap_Data (f, img, data, fg, bg, non_default_colors) 2609Create_Pixmap_From_Bitmap_Data (struct frame *f, struct image *img, char *data,
2699 struct frame *f; 2610 RGB_PIXEL_COLOR fg, RGB_PIXEL_COLOR bg,
2700 struct image *img; 2611 int non_default_colors)
2701 char *data;
2702 RGB_PIXEL_COLOR fg, bg;
2703 int non_default_colors;
2704{ 2612{
2705#ifdef HAVE_NTGUI 2613#ifdef HAVE_NTGUI
2706 img->pixmap 2614 img->pixmap
@@ -2736,12 +2644,9 @@ Create_Pixmap_From_Bitmap_Data (f, img, data, fg, bg, non_default_colors)
2736 invalid (the bitmap remains unread). */ 2644 invalid (the bitmap remains unread). */
2737 2645
2738static int 2646static int
2739xbm_read_bitmap_data (f, contents, end, width, height, data, inhibit_image_error) 2647xbm_read_bitmap_data (struct frame *f, unsigned char *contents, unsigned char *end,
2740 struct frame *f; 2648 int *width, int *height, unsigned char **data,
2741 unsigned char *contents, *end; 2649 int inhibit_image_error)
2742 int *width, *height;
2743 unsigned char **data;
2744 int inhibit_image_error;
2745{ 2650{
2746 unsigned char *s = contents; 2651 unsigned char *s = contents;
2747 char buffer[BUFSIZ]; 2652 char buffer[BUFSIZ];
@@ -2890,10 +2795,8 @@ xbm_read_bitmap_data (f, contents, end, width, height, data, inhibit_image_error
2890 successful. */ 2795 successful. */
2891 2796
2892static int 2797static int
2893xbm_load_image (f, img, contents, end) 2798xbm_load_image (struct frame *f, struct image *img, unsigned char *contents,
2894 struct frame *f; 2799 unsigned char *end)
2895 struct image *img;
2896 unsigned char *contents, *end;
2897{ 2800{
2898 int rc; 2801 int rc;
2899 unsigned char *data; 2802 unsigned char *data;
@@ -2949,8 +2852,7 @@ xbm_load_image (f, img, contents, end)
2949/* Value is non-zero if DATA looks like an in-memory XBM file. */ 2852/* Value is non-zero if DATA looks like an in-memory XBM file. */
2950 2853
2951static int 2854static int
2952xbm_file_p (data) 2855xbm_file_p (Lisp_Object data)
2953 Lisp_Object data;
2954{ 2856{
2955 int w, h; 2857 int w, h;
2956 return (STRINGP (data) 2858 return (STRINGP (data)
@@ -2964,9 +2866,7 @@ xbm_file_p (data)
2964 non-zero if successful. */ 2866 non-zero if successful. */
2965 2867
2966static int 2868static int
2967xbm_load (f, img) 2869xbm_load (struct frame *f, struct image *img)
2968 struct frame *f;
2969 struct image *img;
2970{ 2870{
2971 int success_p = 0; 2871 int success_p = 0;
2972 Lisp_Object file_name; 2872 Lisp_Object file_name;
@@ -3240,9 +3140,7 @@ struct xpm_cached_color **xpm_color_cache;
3240/* Initialize the color cache. */ 3140/* Initialize the color cache. */
3241 3141
3242static void 3142static void
3243xpm_init_color_cache (f, attrs) 3143xpm_init_color_cache (struct frame *f, XpmAttributes *attrs)
3244 struct frame *f;
3245 XpmAttributes *attrs;
3246{ 3144{
3247 size_t nbytes = XPM_COLOR_CACHE_BUCKETS * sizeof *xpm_color_cache; 3145 size_t nbytes = XPM_COLOR_CACHE_BUCKETS * sizeof *xpm_color_cache;
3248 xpm_color_cache = (struct xpm_cached_color **) xmalloc (nbytes); 3146 xpm_color_cache = (struct xpm_cached_color **) xmalloc (nbytes);
@@ -3268,7 +3166,7 @@ xpm_init_color_cache (f, attrs)
3268/* Free the color cache. */ 3166/* Free the color cache. */
3269 3167
3270static void 3168static void
3271xpm_free_color_cache () 3169xpm_free_color_cache (void)
3272{ 3170{
3273 struct xpm_cached_color *p, *next; 3171 struct xpm_cached_color *p, *next;
3274 int i; 3172 int i;
@@ -3289,8 +3187,7 @@ xpm_free_color_cache ()
3289 cache. */ 3187 cache. */
3290 3188
3291static int 3189static int
3292xpm_color_bucket (color_name) 3190xpm_color_bucket (char *color_name)
3293 char *color_name;
3294{ 3191{
3295 unsigned h = 0; 3192 unsigned h = 0;
3296 char *s; 3193 char *s;
@@ -3306,11 +3203,7 @@ xpm_color_bucket (color_name)
3306 entry added. */ 3203 entry added. */
3307 3204
3308static struct xpm_cached_color * 3205static struct xpm_cached_color *
3309xpm_cache_color (f, color_name, color, bucket) 3206xpm_cache_color (struct frame *f, char *color_name, XColor *color, int bucket)
3310 struct frame *f;
3311 char *color_name;
3312 XColor *color;
3313 int bucket;
3314{ 3207{
3315 size_t nbytes; 3208 size_t nbytes;
3316 struct xpm_cached_color *p; 3209 struct xpm_cached_color *p;
@@ -3333,10 +3226,7 @@ xpm_cache_color (f, color_name, color, bucket)
3333 allocation failed. */ 3226 allocation failed. */
3334 3227
3335static int 3228static int
3336xpm_lookup_color (f, color_name, color) 3229xpm_lookup_color (struct frame *f, char *color_name, XColor *color)
3337 struct frame *f;
3338 char *color_name;
3339 XColor *color;
3340{ 3230{
3341 struct xpm_cached_color *p; 3231 struct xpm_cached_color *p;
3342 int h = xpm_color_bucket (color_name); 3232 int h = xpm_color_bucket (color_name);
@@ -3373,12 +3263,8 @@ xpm_lookup_color (f, color_name, color)
3373 if successful. */ 3263 if successful. */
3374 3264
3375static int 3265static int
3376xpm_alloc_color (dpy, cmap, color_name, color, closure) 3266xpm_alloc_color (Display *dpy, Colormap cmap, char *color_name, XColor *color,
3377 Display *dpy; 3267 void *closure)
3378 Colormap cmap;
3379 char *color_name;
3380 XColor *color;
3381 void *closure;
3382{ 3268{
3383 return xpm_lookup_color ((struct frame *) closure, color_name, color); 3269 return xpm_lookup_color ((struct frame *) closure, color_name, color);
3384} 3270}
@@ -3389,12 +3275,7 @@ xpm_alloc_color (dpy, cmap, color_name, color, closure)
3389 non-zero if successful. */ 3275 non-zero if successful. */
3390 3276
3391static int 3277static int
3392xpm_free_colors (dpy, cmap, pixels, npixels, closure) 3278xpm_free_colors (Display *dpy, Colormap cmap, Pixel *pixels, int npixels, void *closure)
3393 Display *dpy;
3394 Colormap cmap;
3395 Pixel *pixels;
3396 int npixels;
3397 void *closure;
3398{ 3279{
3399 return 1; 3280 return 1;
3400} 3281}
@@ -3434,8 +3315,7 @@ init_xpm_functions (Lisp_Object libraries)
3434 cdr are strings. */ 3315 cdr are strings. */
3435 3316
3436static int 3317static int
3437xpm_valid_color_symbols_p (color_symbols) 3318xpm_valid_color_symbols_p (Lisp_Object color_symbols)
3438 Lisp_Object color_symbols;
3439{ 3319{
3440 while (CONSP (color_symbols)) 3320 while (CONSP (color_symbols))
3441 { 3321 {
@@ -3454,8 +3334,7 @@ xpm_valid_color_symbols_p (color_symbols)
3454/* Value is non-zero if OBJECT is a valid XPM image specification. */ 3334/* Value is non-zero if OBJECT is a valid XPM image specification. */
3455 3335
3456static int 3336static int
3457xpm_image_p (object) 3337xpm_image_p (Lisp_Object object)
3458 Lisp_Object object;
3459{ 3338{
3460 struct image_keyword fmt[XPM_LAST]; 3339 struct image_keyword fmt[XPM_LAST];
3461 bcopy (xpm_format, fmt, sizeof fmt); 3340 bcopy (xpm_format, fmt, sizeof fmt);
@@ -3472,9 +3351,7 @@ xpm_image_p (object)
3472 3351
3473#if defined (HAVE_XPM) && defined (HAVE_X_WINDOWS) 3352#if defined (HAVE_XPM) && defined (HAVE_X_WINDOWS)
3474int 3353int
3475x_create_bitmap_from_xpm_data (f, bits) 3354x_create_bitmap_from_xpm_data (struct frame *f, char **bits)
3476 struct frame *f;
3477 char **bits;
3478{ 3355{
3479 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 3356 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
3480 int id, rc; 3357 int id, rc;
@@ -3517,9 +3394,7 @@ x_create_bitmap_from_xpm_data (f, bits)
3517#ifdef HAVE_XPM 3394#ifdef HAVE_XPM
3518 3395
3519static int 3396static int
3520xpm_load (f, img) 3397xpm_load (struct frame *f, struct image *img)
3521 struct frame *f;
3522 struct image *img;
3523{ 3398{
3524 int rc; 3399 int rc;
3525 XpmAttributes attrs; 3400 XpmAttributes attrs;
@@ -4273,7 +4148,7 @@ int ct_colors_allocated;
4273/* Initialize the color table. */ 4148/* Initialize the color table. */
4274 4149
4275static void 4150static void
4276init_color_table () 4151init_color_table (void)
4277{ 4152{
4278 int size = CT_SIZE * sizeof (*ct_table); 4153 int size = CT_SIZE * sizeof (*ct_table);
4279 ct_table = (struct ct_color **) xmalloc (size); 4154 ct_table = (struct ct_color **) xmalloc (size);
@@ -4285,7 +4160,7 @@ init_color_table ()
4285/* Free memory associated with the color table. */ 4160/* Free memory associated with the color table. */
4286 4161
4287static void 4162static void
4288free_color_table () 4163free_color_table (void)
4289{ 4164{
4290 int i; 4165 int i;
4291 struct ct_color *p, *next; 4166 struct ct_color *p, *next;
@@ -4308,9 +4183,7 @@ free_color_table ()
4308 G, B, and make an entry in the color table. */ 4183 G, B, and make an entry in the color table. */
4309 4184
4310static unsigned long 4185static unsigned long
4311lookup_rgb_color (f, r, g, b) 4186lookup_rgb_color (struct frame *f, int r, int g, int b)
4312 struct frame *f;
4313 int r, g, b;
4314{ 4187{
4315 unsigned hash = CT_HASH_RGB (r, g, b); 4188 unsigned hash = CT_HASH_RGB (r, g, b);
4316 int i = hash % CT_SIZE; 4189 int i = hash % CT_SIZE;
@@ -4405,9 +4278,7 @@ lookup_rgb_color (f, r, g, b)
4405 table. If not already present, allocate it. Value is PIXEL. */ 4278 table. If not already present, allocate it. Value is PIXEL. */
4406 4279
4407static unsigned long 4280static unsigned long
4408lookup_pixel_color (f, pixel) 4281lookup_pixel_color (struct frame *f, unsigned long pixel)
4409 struct frame *f;
4410 unsigned long pixel;
4411{ 4282{
4412 int i = pixel % CT_SIZE; 4283 int i = pixel % CT_SIZE;
4413 struct ct_color *p; 4284 struct ct_color *p;
@@ -4459,8 +4330,7 @@ lookup_pixel_color (f, pixel)
4459 allocated via xmalloc. Set *N to the number of colors. */ 4330 allocated via xmalloc. Set *N to the number of colors. */
4460 4331
4461static unsigned long * 4332static unsigned long *
4462colors_in_color_table (n) 4333colors_in_color_table (int *n)
4463 int *n;
4464{ 4334{
4465 int i, j; 4335 int i, j;
4466 struct ct_color *p; 4336 struct ct_color *p;
@@ -4558,10 +4428,7 @@ static int laplace_matrix[9] = {
4558 allocated with xmalloc; it must be freed by the caller. */ 4428 allocated with xmalloc; it must be freed by the caller. */
4559 4429
4560static XColor * 4430static XColor *
4561x_to_xcolors (f, img, rgb_p) 4431x_to_xcolors (struct frame *f, struct image *img, int rgb_p)
4562 struct frame *f;
4563 struct image *img;
4564 int rgb_p;
4565{ 4432{
4566 int x, y; 4433 int x, y;
4567 XColor *colors, *p; 4434 XColor *colors, *p;
@@ -4674,10 +4541,7 @@ XPutPixel (ximg, x, y, color)
4674 COLORS will be freed; an existing IMG->pixmap will be freed, too. */ 4541 COLORS will be freed; an existing IMG->pixmap will be freed, too. */
4675 4542
4676static void 4543static void
4677x_from_xcolors (f, img, colors) 4544x_from_xcolors (struct frame *f, struct image *img, XColor *colors)
4678 struct frame *f;
4679 struct image *img;
4680 XColor *colors;
4681{ 4545{
4682 int x, y; 4546 int x, y;
4683 XImagePtr oimg = NULL; 4547 XImagePtr oimg = NULL;
@@ -4719,10 +4583,7 @@ x_from_xcolors (f, img, colors)
4719 outgoing image. */ 4583 outgoing image. */
4720 4584
4721static void 4585static void
4722x_detect_edges (f, img, matrix, color_adjust) 4586x_detect_edges (struct frame *f, struct image *img, int *matrix, int color_adjust)
4723 struct frame *f;
4724 struct image *img;
4725 int matrix[9], color_adjust;
4726{ 4587{
4727 XColor *colors = x_to_xcolors (f, img, 1); 4588 XColor *colors = x_to_xcolors (f, img, 1);
4728 XColor *new, *p; 4589 XColor *new, *p;
@@ -4788,9 +4649,7 @@ x_detect_edges (f, img, matrix, color_adjust)
4788 on frame F. */ 4649 on frame F. */
4789 4650
4790static void 4651static void
4791x_emboss (f, img) 4652x_emboss (struct frame *f, struct image *img)
4792 struct frame *f;
4793 struct image *img;
4794{ 4653{
4795 x_detect_edges (f, img, emboss_matrix, 0xffff / 2); 4654 x_detect_edges (f, img, emboss_matrix, 0xffff / 2);
4796} 4655}
@@ -4801,9 +4660,7 @@ x_emboss (f, img)
4801 to draw disabled buttons, for example. */ 4660 to draw disabled buttons, for example. */
4802 4661
4803static void 4662static void
4804x_laplace (f, img) 4663x_laplace (struct frame *f, struct image *img)
4805 struct frame *f;
4806 struct image *img;
4807{ 4664{
4808 x_detect_edges (f, img, laplace_matrix, 45000); 4665 x_detect_edges (f, img, laplace_matrix, 45000);
4809} 4666}
@@ -4821,10 +4678,8 @@ x_laplace (f, img)
4821 number. */ 4678 number. */
4822 4679
4823static void 4680static void
4824x_edge_detection (f, img, matrix, color_adjust) 4681x_edge_detection (struct frame *f, struct image *img, Lisp_Object matrix,
4825 struct frame *f; 4682 Lisp_Object color_adjust)
4826 struct image *img;
4827 Lisp_Object matrix, color_adjust;
4828{ 4683{
4829 int i = 0; 4684 int i = 0;
4830 int trans[9]; 4685 int trans[9];
@@ -4853,9 +4708,7 @@ x_edge_detection (f, img, matrix, color_adjust)
4853/* Transform image IMG on frame F so that it looks disabled. */ 4708/* Transform image IMG on frame F so that it looks disabled. */
4854 4709
4855static void 4710static void
4856x_disable_image (f, img) 4711x_disable_image (struct frame *f, struct image *img)
4857 struct frame *f;
4858 struct image *img;
4859{ 4712{
4860 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 4713 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
4861#ifdef HAVE_NTGUI 4714#ifdef HAVE_NTGUI
@@ -4957,10 +4810,7 @@ x_disable_image (f, img)
4957 heuristically. Value is non-zero if successful. */ 4810 heuristically. Value is non-zero if successful. */
4958 4811
4959static int 4812static int
4960x_build_heuristic_mask (f, img, how) 4813x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
4961 struct frame *f;
4962 struct image *img;
4963 Lisp_Object how;
4964{ 4814{
4965 XImagePtr_or_DC ximg; 4815 XImagePtr_or_DC ximg;
4966#ifndef HAVE_NTGUI 4816#ifndef HAVE_NTGUI
@@ -5146,8 +4996,7 @@ static struct image_type pbm_type =
5146/* Return non-zero if OBJECT is a valid PBM image specification. */ 4996/* Return non-zero if OBJECT is a valid PBM image specification. */
5147 4997
5148static int 4998static int
5149pbm_image_p (object) 4999pbm_image_p (Lisp_Object object)
5150 Lisp_Object object;
5151{ 5000{
5152 struct image_keyword fmt[PBM_LAST]; 5001 struct image_keyword fmt[PBM_LAST];
5153 5002
@@ -5166,8 +5015,7 @@ pbm_image_p (object)
5166 end of input. */ 5015 end of input. */
5167 5016
5168static int 5017static int
5169pbm_scan_number (s, end) 5018pbm_scan_number (unsigned char **s, unsigned char *end)
5170 unsigned char **s, *end;
5171{ 5019{
5172 int c = 0, val = -1; 5020 int c = 0, val = -1;
5173 5021
@@ -5242,9 +5090,7 @@ pbm_read_file (file, size)
5242/* Load PBM image IMG for use on frame F. */ 5090/* Load PBM image IMG for use on frame F. */
5243 5091
5244static int 5092static int
5245pbm_load (f, img) 5093pbm_load (struct frame *f, struct image *img)
5246 struct frame *f;
5247 struct image *img;
5248{ 5094{
5249 int raw_p, x, y; 5095 int raw_p, x, y;
5250 int width, height, max_color_idx = 0; 5096 int width, height, max_color_idx = 0;
@@ -5566,8 +5412,7 @@ static struct image_type png_type =
5566/* Return non-zero if OBJECT is a valid PNG image specification. */ 5412/* Return non-zero if OBJECT is a valid PNG image specification. */
5567 5413
5568static int 5414static int
5569png_image_p (object) 5415png_image_p (Lisp_Object object)
5570 Lisp_Object object;
5571{ 5416{
5572 struct image_keyword fmt[PNG_LAST]; 5417 struct image_keyword fmt[PNG_LAST];
5573 bcopy (png_format, fmt, sizeof fmt); 5418 bcopy (png_format, fmt, sizeof fmt);
@@ -5671,9 +5516,7 @@ init_png_functions (Lisp_Object libraries)
5671 is initialized. */ 5516 is initialized. */
5672 5517
5673static void 5518static void
5674my_png_error (png_ptr, msg) 5519my_png_error (png_struct *png_ptr, const char *msg)
5675 png_struct *png_ptr;
5676 char *msg;
5677{ 5520{
5678 xassert (png_ptr != NULL); 5521 xassert (png_ptr != NULL);
5679 image_error ("PNG error: %s", build_string (msg), Qnil); 5522 image_error ("PNG error: %s", build_string (msg), Qnil);
@@ -5682,9 +5525,7 @@ my_png_error (png_ptr, msg)
5682 5525
5683 5526
5684static void 5527static void
5685my_png_warning (png_ptr, msg) 5528my_png_warning (png_struct *png_ptr, const char *msg)
5686 png_struct *png_ptr;
5687 char *msg;
5688{ 5529{
5689 xassert (png_ptr != NULL); 5530 xassert (png_ptr != NULL);
5690 image_error ("PNG warning: %s", build_string (msg), Qnil); 5531 image_error ("PNG warning: %s", build_string (msg), Qnil);
@@ -5705,10 +5546,7 @@ struct png_memory_storage
5705 bytes from the input to DATA. */ 5546 bytes from the input to DATA. */
5706 5547
5707static void 5548static void
5708png_read_from_memory (png_ptr, data, length) 5549png_read_from_memory (png_structp png_ptr, png_bytep data, png_size_t length)
5709 png_structp png_ptr;
5710 png_bytep data;
5711 png_size_t length;
5712{ 5550{
5713 struct png_memory_storage *tbr 5551 struct png_memory_storage *tbr
5714 = (struct png_memory_storage *) fn_png_get_io_ptr (png_ptr); 5552 = (struct png_memory_storage *) fn_png_get_io_ptr (png_ptr);
@@ -5726,10 +5564,7 @@ png_read_from_memory (png_ptr, data, length)
5726 bytes from the input to DATA. */ 5564 bytes from the input to DATA. */
5727 5565
5728static void 5566static void
5729png_read_from_file (png_ptr, data, length) 5567png_read_from_file (png_structp png_ptr, png_bytep data, png_size_t length)
5730 png_structp png_ptr;
5731 png_bytep data;
5732 png_size_t length;
5733{ 5568{
5734 FILE *fp = (FILE *) fn_png_get_io_ptr (png_ptr); 5569 FILE *fp = (FILE *) fn_png_get_io_ptr (png_ptr);
5735 5570
@@ -5742,9 +5577,7 @@ png_read_from_file (png_ptr, data, length)
5742 successful. */ 5577 successful. */
5743 5578
5744static int 5579static int
5745png_load (f, img) 5580png_load (struct frame *f, struct image *img)
5746 struct frame *f;
5747 struct image *img;
5748{ 5581{
5749 Lisp_Object file, specified_file; 5582 Lisp_Object file, specified_file;
5750 Lisp_Object specified_data; 5583 Lisp_Object specified_data;
@@ -6168,8 +6001,7 @@ static struct image_type jpeg_type =
6168/* Return non-zero if OBJECT is a valid JPEG image specification. */ 6001/* Return non-zero if OBJECT is a valid JPEG image specification. */
6169 6002
6170static int 6003static int
6171jpeg_image_p (object) 6004jpeg_image_p (Lisp_Object object)
6172 Lisp_Object object;
6173{ 6005{
6174 struct image_keyword fmt[JPEG_LAST]; 6006 struct image_keyword fmt[JPEG_LAST];
6175 6007
@@ -6268,8 +6100,7 @@ struct my_jpeg_error_mgr
6268 6100
6269 6101
6270static void 6102static void
6271my_error_exit (cinfo) 6103my_error_exit (j_common_ptr cinfo)
6272 j_common_ptr cinfo;
6273{ 6104{
6274 struct my_jpeg_error_mgr *mgr = (struct my_jpeg_error_mgr *) cinfo->err; 6105 struct my_jpeg_error_mgr *mgr = (struct my_jpeg_error_mgr *) cinfo->err;
6275 longjmp (mgr->setjmp_buffer, 1); 6106 longjmp (mgr->setjmp_buffer, 1);
@@ -6281,8 +6112,7 @@ my_error_exit (cinfo)
6281 libjpeg.doc from the JPEG lib distribution. */ 6112 libjpeg.doc from the JPEG lib distribution. */
6282 6113
6283static void 6114static void
6284our_common_init_source (cinfo) 6115our_common_init_source (j_decompress_ptr cinfo)
6285 j_decompress_ptr cinfo;
6286{ 6116{
6287} 6117}
6288 6118
@@ -6291,8 +6121,7 @@ our_common_init_source (cinfo)
6291 jpeg_finish_decompress() after all data has been processed. */ 6121 jpeg_finish_decompress() after all data has been processed. */
6292 6122
6293static void 6123static void
6294our_common_term_source (cinfo) 6124our_common_term_source (j_decompress_ptr cinfo)
6295 j_decompress_ptr cinfo;
6296{ 6125{
6297} 6126}
6298 6127
@@ -6304,8 +6133,7 @@ our_common_term_source (cinfo)
6304static JOCTET our_memory_buffer[2]; 6133static JOCTET our_memory_buffer[2];
6305 6134
6306static boolean 6135static boolean
6307our_memory_fill_input_buffer (cinfo) 6136our_memory_fill_input_buffer (j_decompress_ptr cinfo)
6308 j_decompress_ptr cinfo;
6309{ 6137{
6310 /* Insert a fake EOI marker. */ 6138 /* Insert a fake EOI marker. */
6311 struct jpeg_source_mgr *src = cinfo->src; 6139 struct jpeg_source_mgr *src = cinfo->src;
@@ -6323,9 +6151,7 @@ our_memory_fill_input_buffer (cinfo)
6323 is the JPEG data source manager. */ 6151 is the JPEG data source manager. */
6324 6152
6325static void 6153static void
6326our_memory_skip_input_data (cinfo, num_bytes) 6154our_memory_skip_input_data (j_decompress_ptr cinfo, long int num_bytes)
6327 j_decompress_ptr cinfo;
6328 long num_bytes;
6329{ 6155{
6330 struct jpeg_source_mgr *src = (struct jpeg_source_mgr *) cinfo->src; 6156 struct jpeg_source_mgr *src = (struct jpeg_source_mgr *) cinfo->src;
6331 6157
@@ -6345,10 +6171,7 @@ our_memory_skip_input_data (cinfo, num_bytes)
6345 reading the image. */ 6171 reading the image. */
6346 6172
6347static void 6173static void
6348jpeg_memory_src (cinfo, data, len) 6174jpeg_memory_src (j_decompress_ptr cinfo, JOCTET *data, unsigned int len)
6349 j_decompress_ptr cinfo;
6350 JOCTET *data;
6351 unsigned int len;
6352{ 6175{
6353 struct jpeg_source_mgr *src; 6176 struct jpeg_source_mgr *src;
6354 6177
@@ -6391,8 +6214,7 @@ struct jpeg_stdio_mgr
6391 whenever more data is needed. The data is read from a FILE *. */ 6214 whenever more data is needed. The data is read from a FILE *. */
6392 6215
6393static boolean 6216static boolean
6394our_stdio_fill_input_buffer (cinfo) 6217our_stdio_fill_input_buffer (j_decompress_ptr cinfo)
6395 j_decompress_ptr cinfo;
6396{ 6218{
6397 struct jpeg_stdio_mgr *src; 6219 struct jpeg_stdio_mgr *src;
6398 6220
@@ -6423,9 +6245,7 @@ our_stdio_fill_input_buffer (cinfo)
6423 is the JPEG data source manager. */ 6245 is the JPEG data source manager. */
6424 6246
6425static void 6247static void
6426our_stdio_skip_input_data (cinfo, num_bytes) 6248our_stdio_skip_input_data (j_decompress_ptr cinfo, long int num_bytes)
6427 j_decompress_ptr cinfo;
6428 long num_bytes;
6429{ 6249{
6430 struct jpeg_stdio_mgr *src; 6250 struct jpeg_stdio_mgr *src;
6431 src = (struct jpeg_stdio_mgr *) cinfo->src; 6251 src = (struct jpeg_stdio_mgr *) cinfo->src;
@@ -6455,9 +6275,7 @@ our_stdio_skip_input_data (cinfo, num_bytes)
6455 reading the image. */ 6275 reading the image. */
6456 6276
6457static void 6277static void
6458jpeg_file_src (cinfo, fp) 6278jpeg_file_src (j_decompress_ptr cinfo, FILE *fp)
6459 j_decompress_ptr cinfo;
6460 FILE *fp;
6461{ 6279{
6462 struct jpeg_stdio_mgr *src; 6280 struct jpeg_stdio_mgr *src;
6463 6281
@@ -6491,9 +6309,7 @@ jpeg_file_src (cinfo, fp)
6491 from the JPEG lib. */ 6309 from the JPEG lib. */
6492 6310
6493static int 6311static int
6494jpeg_load (f, img) 6312jpeg_load (struct frame *f, struct image *img)
6495 struct frame *f;
6496 struct image *img;
6497{ 6313{
6498 struct jpeg_decompress_struct cinfo; 6314 struct jpeg_decompress_struct cinfo;
6499 struct my_jpeg_error_mgr mgr; 6315 struct my_jpeg_error_mgr mgr;
@@ -6742,8 +6558,7 @@ static struct image_type tiff_type =
6742/* Return non-zero if OBJECT is a valid TIFF image specification. */ 6558/* Return non-zero if OBJECT is a valid TIFF image specification. */
6743 6559
6744static int 6560static int
6745tiff_image_p (object) 6561tiff_image_p (Lisp_Object object)
6746 Lisp_Object object;
6747{ 6562{
6748 struct image_keyword fmt[TIFF_LAST]; 6563 struct image_keyword fmt[TIFF_LAST];
6749 bcopy (tiff_format, fmt, sizeof fmt); 6564 bcopy (tiff_format, fmt, sizeof fmt);
@@ -6823,10 +6638,7 @@ typedef struct
6823tiff_memory_source; 6638tiff_memory_source;
6824 6639
6825static size_t 6640static size_t
6826tiff_read_from_memory (data, buf, size) 6641tiff_read_from_memory (thandle_t data, tdata_t buf, tsize_t size)
6827 thandle_t data;
6828 tdata_t buf;
6829 tsize_t size;
6830{ 6642{
6831 tiff_memory_source *src = (tiff_memory_source *) data; 6643 tiff_memory_source *src = (tiff_memory_source *) data;
6832 6644
@@ -6838,19 +6650,13 @@ tiff_read_from_memory (data, buf, size)
6838} 6650}
6839 6651
6840static size_t 6652static size_t
6841tiff_write_from_memory (data, buf, size) 6653tiff_write_from_memory (thandle_t data, tdata_t buf, tsize_t size)
6842 thandle_t data;
6843 tdata_t buf;
6844 tsize_t size;
6845{ 6654{
6846 return (size_t) -1; 6655 return (size_t) -1;
6847} 6656}
6848 6657
6849static toff_t 6658static toff_t
6850tiff_seek_in_memory (data, off, whence) 6659tiff_seek_in_memory (thandle_t data, toff_t off, int whence)
6851 thandle_t data;
6852 toff_t off;
6853 int whence;
6854{ 6660{
6855 tiff_memory_source *src = (tiff_memory_source *) data; 6661 tiff_memory_source *src = (tiff_memory_source *) data;
6856 int idx; 6662 int idx;
@@ -6881,44 +6687,34 @@ tiff_seek_in_memory (data, off, whence)
6881} 6687}
6882 6688
6883static int 6689static int
6884tiff_close_memory (data) 6690tiff_close_memory (thandle_t data)
6885 thandle_t data;
6886{ 6691{
6887 /* NOOP */ 6692 /* NOOP */
6888 return 0; 6693 return 0;
6889} 6694}
6890 6695
6891static int 6696static int
6892tiff_mmap_memory (data, pbase, psize) 6697tiff_mmap_memory (thandle_t data, tdata_t *pbase, toff_t *psize)
6893 thandle_t data;
6894 tdata_t *pbase;
6895 toff_t *psize;
6896{ 6698{
6897 /* It is already _IN_ memory. */ 6699 /* It is already _IN_ memory. */
6898 return 0; 6700 return 0;
6899} 6701}
6900 6702
6901static void 6703static void
6902tiff_unmap_memory (data, base, size) 6704tiff_unmap_memory (thandle_t data, tdata_t base, toff_t size)
6903 thandle_t data;
6904 tdata_t base;
6905 toff_t size;
6906{ 6705{
6907 /* We don't need to do this. */ 6706 /* We don't need to do this. */
6908} 6707}
6909 6708
6910static toff_t 6709static toff_t
6911tiff_size_of_memory (data) 6710tiff_size_of_memory (thandle_t data)
6912 thandle_t data;
6913{ 6711{
6914 return ((tiff_memory_source *) data)->len; 6712 return ((tiff_memory_source *) data)->len;
6915} 6713}
6916 6714
6917 6715
6918static void 6716static void
6919tiff_error_handler (title, format, ap) 6717tiff_error_handler (const char *title, const char *format, va_list ap)
6920 const char *title, *format;
6921 va_list ap;
6922{ 6718{
6923 char buf[512]; 6719 char buf[512];
6924 int len; 6720 int len;
@@ -6930,9 +6726,7 @@ tiff_error_handler (title, format, ap)
6930 6726
6931 6727
6932static void 6728static void
6933tiff_warning_handler (title, format, ap) 6729tiff_warning_handler (const char *title, const char *format, va_list ap)
6934 const char *title, *format;
6935 va_list ap;
6936{ 6730{
6937 char buf[512]; 6731 char buf[512];
6938 int len; 6732 int len;
@@ -6947,9 +6741,7 @@ tiff_warning_handler (title, format, ap)
6947 successful. */ 6741 successful. */
6948 6742
6949static int 6743static int
6950tiff_load (f, img) 6744tiff_load (struct frame *f, struct image *img)
6951 struct frame *f;
6952 struct image *img;
6953{ 6745{
6954 Lisp_Object file, specified_file; 6746 Lisp_Object file, specified_file;
6955 Lisp_Object specified_data; 6747 Lisp_Object specified_data;
@@ -7194,9 +6986,7 @@ static struct image_type gif_type =
7194/* Free X resources of GIF image IMG which is used on frame F. */ 6986/* Free X resources of GIF image IMG which is used on frame F. */
7195 6987
7196static void 6988static void
7197gif_clear_image (f, img) 6989gif_clear_image (struct frame *f, struct image *img)
7198 struct frame *f;
7199 struct image *img;
7200{ 6990{
7201 /* IMG->data.ptr_val may contain metadata with extension data. */ 6991 /* IMG->data.ptr_val may contain metadata with extension data. */
7202 img->data.lisp_val = Qnil; 6992 img->data.lisp_val = Qnil;
@@ -7206,8 +6996,7 @@ gif_clear_image (f, img)
7206/* Return non-zero if OBJECT is a valid GIF image specification. */ 6996/* Return non-zero if OBJECT is a valid GIF image specification. */
7207 6997
7208static int 6998static int
7209gif_image_p (object) 6999gif_image_p (Lisp_Object object)
7210 Lisp_Object object;
7211{ 7000{
7212 struct image_keyword fmt[GIF_LAST]; 7001 struct image_keyword fmt[GIF_LAST];
7213 bcopy (gif_format, fmt, sizeof fmt); 7002 bcopy (gif_format, fmt, sizeof fmt);
@@ -7290,10 +7079,7 @@ gif_memory_source;
7290static gif_memory_source *current_gif_memory_src; 7079static gif_memory_source *current_gif_memory_src;
7291 7080
7292static int 7081static int
7293gif_read_from_memory (file, buf, len) 7082gif_read_from_memory (GifFileType *file, GifByteType *buf, int len)
7294 GifFileType *file;
7295 GifByteType *buf;
7296 int len;
7297{ 7083{
7298 gif_memory_source *src = current_gif_memory_src; 7084 gif_memory_source *src = current_gif_memory_src;
7299 7085
@@ -7313,9 +7099,7 @@ static const int interlace_start[] = {0, 4, 2, 1};
7313static const int interlace_increment[] = {8, 8, 4, 2}; 7099static const int interlace_increment[] = {8, 8, 4, 2};
7314 7100
7315static int 7101static int
7316gif_load (f, img) 7102gif_load (struct frame *f, struct image *img)
7317 struct frame *f;
7318 struct image *img;
7319{ 7103{
7320 Lisp_Object file, specified_file; 7104 Lisp_Object file, specified_file;
7321 Lisp_Object specified_data; 7105 Lisp_Object specified_data;
@@ -7645,8 +7429,7 @@ static struct image_type svg_type =
7645 identify the SVG format. */ 7429 identify the SVG format. */
7646 7430
7647static int 7431static int
7648svg_image_p (object) 7432svg_image_p (Lisp_Object object)
7649 Lisp_Object object;
7650{ 7433{
7651 struct image_keyword fmt[SVG_LAST]; 7434 struct image_keyword fmt[SVG_LAST];
7652 bcopy (svg_format, fmt, sizeof fmt); 7435 bcopy (svg_format, fmt, sizeof fmt);
@@ -7748,9 +7531,7 @@ init_svg_functions (Lisp_Object libraries)
7748 the prototype thus needs to be compatible with that structure. */ 7531 the prototype thus needs to be compatible with that structure. */
7749 7532
7750static int 7533static int
7751svg_load (f, img) 7534svg_load (struct frame *f, struct image *img)
7752 struct frame *f;
7753 struct image *img;
7754{ 7535{
7755 int success_p = 0; 7536 int success_p = 0;
7756 Lisp_Object file_name; 7537 Lisp_Object file_name;
@@ -7807,15 +7588,10 @@ svg_load (f, img)
7807 7588
7808 Returns non-zero when successful. */ 7589 Returns non-zero when successful. */
7809static int 7590static int
7810svg_load_image (f, img, contents, size) 7591svg_load_image (struct frame *f, /* Pointer to emacs frame structure. */
7811 /* Pointer to emacs frame structure. */ 7592 struct image *img, /* Pointer to emacs image structure. */
7812 struct frame *f; 7593 unsigned char *contents, /* String containing the SVG XML data to be parsed. */
7813 /* Pointer to emacs image structure. */ 7594 unsigned int size) /* Size of data in bytes. */
7814 struct image *img;
7815 /* String containing the SVG XML data to be parsed. */
7816 unsigned char *contents;
7817 /* Size of data in bytes. */
7818 unsigned int size;
7819{ 7595{
7820 RsvgHandle *rsvg_handle; 7596 RsvgHandle *rsvg_handle;
7821 RsvgDimensionData dimension_data; 7597 RsvgDimensionData dimension_data;
@@ -8045,9 +7821,7 @@ static struct image_type gs_type =
8045/* Free X resources of Ghostscript image IMG which is used on frame F. */ 7821/* Free X resources of Ghostscript image IMG which is used on frame F. */
8046 7822
8047static void 7823static void
8048gs_clear_image (f, img) 7824gs_clear_image (struct frame *f, struct image *img)
8049 struct frame *f;
8050 struct image *img;
8051{ 7825{
8052 /* IMG->data.ptr_val may contain a recorded colormap. */ 7826 /* IMG->data.ptr_val may contain a recorded colormap. */
8053 xfree (img->data.ptr_val); 7827 xfree (img->data.ptr_val);
@@ -8059,8 +7833,7 @@ gs_clear_image (f, img)
8059 specification. */ 7833 specification. */
8060 7834
8061static int 7835static int
8062gs_image_p (object) 7836gs_image_p (Lisp_Object object)
8063 Lisp_Object object;
8064{ 7837{
8065 struct image_keyword fmt[GS_LAST]; 7838 struct image_keyword fmt[GS_LAST];
8066 Lisp_Object tem; 7839 Lisp_Object tem;
@@ -8100,9 +7873,7 @@ gs_image_p (object)
8100 if successful. */ 7873 if successful. */
8101 7874
8102static int 7875static int
8103gs_load (f, img) 7876gs_load (struct frame *f, struct image *img)
8104 struct frame *f;
8105 struct image *img;
8106{ 7877{
8107 char buffer[100]; 7878 char buffer[100];
8108 Lisp_Object window_and_pixmap_id = Qnil, loader, pt_height, pt_width; 7879 Lisp_Object window_and_pixmap_id = Qnil, loader, pt_height, pt_width;
@@ -8180,9 +7951,7 @@ gs_load (f, img)
8180 telling Emacs that Ghostscript has finished drawing. */ 7951 telling Emacs that Ghostscript has finished drawing. */
8181 7952
8182void 7953void
8183x_kill_gs_process (pixmap, f) 7954x_kill_gs_process (Pixmap pixmap, struct frame *f)
8184 Pixmap pixmap;
8185 struct frame *f;
8186{ 7955{
8187 struct image_cache *c = FRAME_IMAGE_CACHE (f); 7956 struct image_cache *c = FRAME_IMAGE_CACHE (f);
8188 int class, i; 7957 int class, i;
@@ -8375,7 +8144,7 @@ of `image-library-alist', which see). */)
8375} 8144}
8376 8145
8377void 8146void
8378syms_of_image () 8147syms_of_image (void)
8379{ 8148{
8380 extern Lisp_Object Qrisky_local_variable; /* Syms_of_xdisp has already run. */ 8149 extern Lisp_Object Qrisky_local_variable; /* Syms_of_xdisp has already run. */
8381 8150
@@ -8560,7 +8329,7 @@ The function `clear-image-cache' disregards this variable. */);
8560} 8329}
8561 8330
8562void 8331void
8563init_image () 8332init_image (void)
8564{ 8333{
8565} 8334}
8566 8335