Patch jpeglib

From Second Life Wiki
Revision as of 13:20, 11 December 2006 by Phoenix Linden (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

On windows, we discovered jpeglib played more nicely with the development environment with small patch to include windows headers.

diff -uw jpeg-orig/jmorecfg.h jpeg-new/jmorecfg.h
--- jpeg-orig/jmorecfg.h	2006-12-11 12:01:52.468750000 -0800
+++ jpeg-new/jmorecfg.h	2006-12-11 12:02:11.250000000 -0800
@@ -11,6 +11,12 @@
  */
 
 
+// Added by Linden Lab to get consistent definition of INT32
+#ifdef WIN32
+#include <winsock2.h>
+#include <windows.h>
+#endif
+
 /*
  * Define BITS_IN_JSAMPLE as either
  *   8   for 8-bit sample values (the usual setting)
@@ -157,10 +163,17 @@
 
 /* INT32 must hold at least signed 32-bit values. */
 
-#ifndef XMD_H			/* X11/xmd.h correctly defines INT32 */
+// Original version
+//#ifndef XMD_H			/* X11/xmd.h correctly defines INT32 */
+//typedef long INT32;
+//#endif
+
+// Linden Lab version
+#if !defined( XMD_H ) && !defined( WIN32 )
 typedef long INT32;
 #endif
 
+
 /* Datatype used for image dimensions.  The JPEG standard only supports
  * images up to 64K*64K due to 16-bit fields in SOF markers.  Therefore
  * "unsigned int" is sufficient on all machines.  However, if you need to
@@ -212,6 +225,7 @@
 #ifdef NEED_FAR_POINTERS
 #define FAR  far
 #else
+#undef FAR  // Added by Linden Lab to remove warnings
 #define FAR
 #endif

Save this patch as jpeglib.patch in the libraries/include/jpeglib directory and apply it from cygwin with the command:

$ patch -p1 < jpeglib.patch