XEmacs 21.4.17 "Jumbo Shrimp".
[chise/xemacs-chise.git.1] / src / glyphs-eimage.c
index 3308449..3974bc0 100644 (file)
@@ -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.
@@ -105,6 +105,19 @@ Lisp_Object Qpng;
 #ifdef __cplusplus
 extern "C" {
 #endif
+
+#ifdef WIN32_NATIVE
+/* #### Yuck!  More horrifitude.  tiffio.h, below, includes <windows.h>,
+   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 <windows.h> 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 <jpeglib.h>
 #include <jerror.h>
 #ifdef __cplusplus
@@ -1103,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. */
 }
 
@@ -1123,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;
@@ -1277,7 +1290,7 @@ tiff_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
     raster = (uint32*) _TIFFmalloc (width * height * sizeof (uint32));
     if (raster != NULL)
       {
-       unsigned int i,j;
+       int i,j;
        uint32 *rp;
        ep = unwind.eimage;
        rp = raster;
@@ -1288,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);