X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=src%2Fglyphs-eimage.c;h=3974bc0998326368d9d499cf3a039f08bd8cfaca;hp=79b4f87c4f46613b4c62309d0e26713fe44d9146;hb=ee38d21b330f5001b47a577cefb5ba7b82a3b7d3;hpb=3e447015251ce6dcde843cbed10d9033d5538622 diff --git a/src/glyphs-eimage.c b/src/glyphs-eimage.c index 79b4f87..3974bc0 100644 --- a/src/glyphs-eimage.c +++ b/src/glyphs-eimage.c @@ -2,7 +2,7 @@ Copyright (C) 1993, 1994, 1998 Free Software Foundation, Inc. Copyright (C) 1995 Board of Trustees, University of Illinois. Copyright (C) 1995 Tinker Systems - Copyright (C) 1995, 1996 Ben Wing + Copyright (C) 1995, 1996, 2005 Ben Wing Copyright (C) 1995 Sun Microsystems This file is part of XEmacs. @@ -56,6 +56,7 @@ Boston, MA 02111-1307, USA. */ #include "buffer.h" #include "frame.h" #include "opaque.h" +#include "window.h" #include "sysfile.h" @@ -104,6 +105,19 @@ Lisp_Object Qpng; #ifdef __cplusplus extern "C" { #endif + +#ifdef WIN32_NATIVE +/* #### Yuck! More horrifitude. tiffio.h, below, includes , + which defines INT32 and INT16, the former differently and incompatibly + from jmorecfg.h, included by jpeglib.h. We can disable the stuff in + jmorecfg.h by defining XMD_H (clever, huh?); then we define these + typedefs the way that wants them (which is more correct, + anyway; jmorecfg.h defines INT32 as `long'). */ +#define XMD_H +typedef signed int INT32; +typedef signed short INT16; +#endif + #include #include #ifdef __cplusplus @@ -118,7 +132,8 @@ jpeg_validate (Lisp_Object instantiator) } static Lisp_Object -jpeg_normalize (Lisp_Object inst, Lisp_Object console_type) +jpeg_normalize (Lisp_Object inst, Lisp_Object console_type, + Lisp_Object dest_mask) { return simple_image_type_normalize (inst, console_type, Qjpeg); } @@ -232,7 +247,7 @@ our_skip_input_data (j_decompress_ptr cinfo, long num_bytes) if (!src) { return; - } else if (num_bytes > src->bytes_in_buffer) + } else if (num_bytes > (long) src->bytes_in_buffer) { ERREXIT(cinfo, JERR_INPUT_EOF); /*NOTREACHED*/ @@ -442,7 +457,7 @@ jpeg_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, */ while (cinfo.output_scanline < cinfo.output_height) { - int i; + unsigned int i; /* jpeg_read_scanlines expects an array of pointers to scanlines. * Here the array is only one element long, but you could ask for @@ -480,7 +495,7 @@ jpeg_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, /* Step 6.5: Create the pixmap and set up the image instance */ /* now instantiate */ - MAYBE_DEVMETH (XDEVICE (ii->device), + MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain), init_image_instance_from_eimage, (ii, cinfo.output_width, cinfo.output_height, 1, unwind.eimage, dest_mask, @@ -514,7 +529,8 @@ gif_validate (Lisp_Object instantiator) } static Lisp_Object -gif_normalize (Lisp_Object inst, Lisp_Object console_type) +gif_normalize (Lisp_Object inst, Lisp_Object console_type, + Lisp_Object dest_mask) { return simple_image_type_normalize (inst, console_type, Qgif); } @@ -565,7 +581,7 @@ gif_read_from_memory(GifByteType *buf, size_t size, VoidPtr data) { gif_memory_storage *mem = (gif_memory_storage*)data; - if (size > (mem->len - mem->index)) + if ((ssize_t) size > (mem->len - mem->index)) return (size_t) -1; memcpy(buf, mem->bytes + mem->index, size); mem->index = mem->index + size; @@ -672,7 +688,7 @@ gif_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, for (slice = 0; slice < unwind.giffile->ImageCount; slice++) { - /* We check here that that the current image covers the full "screen" size. */ + /* We check here that the current image covers the full "screen" size. */ if (unwind.giffile->SavedImages[slice].ImageDesc.Height != height || unwind.giffile->SavedImages[slice].ImageDesc.Width != width || unwind.giffile->SavedImages[slice].ImageDesc.Left != 0 @@ -706,7 +722,7 @@ gif_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, } /* now instantiate */ - MAYBE_DEVMETH (XDEVICE (ii->device), + MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain), init_image_instance_from_eimage, (ii, width, height, unwind.giffile->ImageCount, unwind.eimage, dest_mask, instantiator, domain)); @@ -756,7 +772,8 @@ png_validate (Lisp_Object instantiator) } static Lisp_Object -png_normalize (Lisp_Object inst, Lisp_Object console_type) +png_normalize (Lisp_Object inst, Lisp_Object console_type, + Lisp_Object dest_mask) { return simple_image_type_normalize (inst, console_type, Qpng); } @@ -781,7 +798,7 @@ png_read_from_memory(png_structp png_ptr, png_bytep data, struct png_memory_storage *tbr = (struct png_memory_storage *) png_get_io_ptr (png_ptr); - if (length > (tbr->len - tbr->index)) + if ((ssize_t) length > (tbr->len - tbr->index)) png_error (png_ptr, (png_const_charp) "Read Error"); memcpy (data,tbr->bytes + tbr->index,length); tbr->index = tbr->index + length; @@ -949,9 +966,9 @@ png_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, rgblist = MAYBE_LISP_DEVMETH (XDEVICE (c->device), color_instance_rgb_components, (c)); - my_background.red = XINT (XCAR (rgblist)); - my_background.green = XINT (XCAR (XCDR (rgblist))); - my_background.blue = XINT (XCAR (XCDR (XCDR (rgblist)))); + my_background.red = (unsigned short) XINT (XCAR (rgblist)); + my_background.green = (unsigned short) XINT (XCAR (XCDR (rgblist))); + my_background.blue = (unsigned short) XINT (XCAR (XCDR (XCDR (rgblist)))); } if (png_get_bKGD (png_ptr, info_ptr, &image_background)) @@ -1017,7 +1034,7 @@ png_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, } /* now instantiate */ - MAYBE_DEVMETH (XDEVICE (ii->device), + MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain), init_image_instance_from_eimage, (ii, width, height, 1, unwind.eimage, dest_mask, instantiator, domain)); @@ -1042,7 +1059,8 @@ tiff_validate (Lisp_Object instantiator) } static Lisp_Object -tiff_normalize (Lisp_Object inst, Lisp_Object console_type) +tiff_normalize (Lisp_Object inst, Lisp_Object console_type, + Lisp_Object dest_mask) { return simple_image_type_normalize (inst, console_type, Qtiff); } @@ -1098,7 +1116,7 @@ tiff_memory_read(thandle_t data, tdata_t buf, tsize_t size) static size_t tiff_memory_write(thandle_t data, tdata_t buf, tsize_t size) { - abort(); + ABORT(); return 0; /* Shut up warnings. */ } @@ -1118,11 +1136,11 @@ static toff_t tiff_memory_seek(thandle_t data, toff_t off, int whence) break; default: fprintf(stderr,"Eh? invalid seek mode in tiff_memory_seek\n"); - return -1; + return (toff_t) -1; } if ((newidx > mem->len) || (newidx < 0)) - return -1; + return (toff_t) -1; mem->index = newidx; return newidx; @@ -1254,7 +1272,7 @@ tiff_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, mem_struct.len = len; mem_struct.index = 0; - unwind.tiff = TIFFClientOpen ("memfile", "r", &mem_struct, + unwind.tiff = TIFFClientOpen ("memfile", "r", (thandle_t) &mem_struct, (TIFFReadWriteProc)tiff_memory_read, (TIFFReadWriteProc)tiff_memory_write, tiff_memory_seek, tiff_memory_close, tiff_memory_size, @@ -1283,7 +1301,7 @@ tiff_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, /* This is to get around weirdness in the libtiff library where properly made TIFFs will come out upside down. libtiff bug or jhod-brainlock? */ rp = raster + (i * width); - for (j = 0; j < width; j++) + for (j = 0; (uint32) j < width; j++) { *ep++ = (unsigned char)TIFFGetR(*rp); *ep++ = (unsigned char)TIFFGetG(*rp); @@ -1299,7 +1317,7 @@ tiff_instantiate (Lisp_Object image_instance, Lisp_Object instantiator, } /* now instantiate */ - MAYBE_DEVMETH (XDEVICE (ii->device), + MAYBE_DEVMETH (DOMAIN_XDEVICE (ii->domain), init_image_instance_from_eimage, (ii, width, height, 1, unwind.eimage, dest_mask, instantiator, domain));