2016-11-06  Juan Manuel Guerrero  <juan.guerrero@gmx.de>

	* include/lcms2.h [DJGPP]: For DJGPP define CMS_IS_DJGPP_.
	[CMS_IS_DJGPP_] : For DJGPP use 260 instead of 256 as default for
	cmsMAX_PATH.

	* src/cmscgats.c [CMS_IS_DJGPP_]: For DJGPP define DIR_CHAR_ALT as
	backslash for alternate directory separator character.
	(isabsolutepath) [CMS_IS_DJGPP_]: For DJGPP check for absolute path
	allowing both slash and backslash characters.
	(BuildAbsolutePath) [CMS_IS_DJGPP_]: For DJGPP check for absolute path
	allowing both slash and backslash charcters.

	* src/cmspcs.c (_cmsLCMScolorSpace):  Use int instead as cmsColorSpaceSignature
	as return type.

	* src/cmsplugin.c: Define internal types __cmsFloat32Number_a and
	__cmsUInt32Number_a to be used for avoiding strict aliasing warnings.
	(cmsReadFloat32Number): Use __cmsFloat32Number_a.
	(cmsWriteFloat32Number): Use __cmsUInt32Number_a.

	* utils/transicc/transicc.c [DJGPP]: For DJGPP include unistd.h for
	isatty prototype.






diff -aprNU5 lcms2-2.8.orig/include/lcms2.h lcms2-2.8/include/lcms2.h
--- lcms2-2.8.orig/include/lcms2.h	2016-07-20 09:46:02 -0513
+++ lcms2-2.8/include/lcms2.h	2016-11-06 01:23:26 -0513
@@ -158,10 +158,15 @@ typedef cmsInt32Number       cmsS15Fixed
 typedef cmsUInt32Number      cmsU16Fixed16Number;
 
 // Boolean type, which will be using the native integer
 typedef int                  cmsBool;
 
+// Try to detect DJGPP
+#if defined (DJGPP) || defined(__DJGPP__)
+#  define CMS_IS_DJGPP_ 1
+#endif
+
 // Try to detect windows
 #if defined (_WIN32) || defined(_WIN64) || defined(WIN32) || defined(_WIN32_)
 #  define CMS_IS_WINDOWS_ 1
 #endif
 
@@ -243,11 +248,15 @@ typedef int                  cmsBool;
 #    define CMS_NO_PTHREADS 1
 # endif
 #endif
 
 // Some common definitions
-#define cmsMAX_PATH     256
+#ifdef CMS_IS_DJGPP_
+# define cmsMAX_PATH     260  /*  Max value from pathconf.  */
+#else
+# define cmsMAX_PATH     256
+#endif
 
 #ifndef FALSE
 #       define FALSE 0
 #endif
 #ifndef TRUE
diff -aprNU5 lcms2-2.8.orig/src/cmscgats.c lcms2-2.8/src/cmscgats.c
--- lcms2-2.8.orig/src/cmscgats.c	2016-07-20 09:46:02 -0513
+++ lcms2-2.8/src/cmscgats.c	2016-11-06 01:23:26 -0513
@@ -39,11 +39,14 @@
 
 #ifdef CMS_IS_WINDOWS_
 #    include <io.h>
 #    define DIR_CHAR    '\\'
 #else
-#    define DIR_CHAR    '/'
+#    define DIR_CHAR            '/'
+#    ifdef CMS_IS_DJGPP_
+#        define DIR_CHAR_ALT    '\\'
+#    endif
 #endif
 
 
 // Symbols
 typedef enum {
@@ -394,14 +397,18 @@ cmsBool isabsolutepath(const char *path)
         return FALSE;
 
     strncpy(ThreeChars, path, 3);
     ThreeChars[3] = 0;
 
-    if(ThreeChars[0] == DIR_CHAR)
+#ifdef CMS_IS_DJGPP_
+    if(ThreeChars[0] == DIR_CHAR || ThreeChars[0] == DIR_CHAR_ALT)
+#else
+     if(ThreeChars[0] == DIR_CHAR)
+#endif
         return TRUE;
 
-#ifdef  CMS_IS_WINDOWS_
+#if defined( CMS_IS_DJGPP_) || defined( CMS_IS_WINDOWS_)
     if (isalpha((int) ThreeChars[0]) && ThreeChars[1] == ':')
         return TRUE;
 #endif
     return FALSE;
 }
@@ -425,11 +432,18 @@ cmsBool BuildAbsolutePath(const char *re
 
     // No, search for last
     strncpy(buffer, basePath, MaxLen);
     buffer[MaxLen-1] = 0;
 
+#ifdef CMS_IS_DJGPP_
+    for (len = MaxLen; len;)
+      if (len--, buffer[len] == DIR_CHAR || buffer[len] == DIR_CHAR_ALT)
+        break;
+    tail = len ? buffer + len : NULL;
+#else
     tail = strrchr(buffer, DIR_CHAR);
+#endif
     if (tail == NULL) return FALSE;    // Is not absolute and has no separators??
 
     len = (cmsUInt32Number) (tail - buffer);
     if (len >= MaxLen) return FALSE;
 
diff -aprNU5 lcms2-2.8.orig/src/cmspcs.c lcms2-2.8/src/cmspcs.c
--- lcms2-2.8.orig/src/cmspcs.c	2016-07-20 09:46:02 -0513
+++ lcms2-2.8/src/cmspcs.c	2016-11-06 01:23:26 -0513
@@ -867,11 +867,11 @@ int CMSEXPORT _cmsLCMScolorSpace(cmsColo
     case cmsSig14colorData:return PT_MCH14;
 
     case cmsSigMCHFData:
     case cmsSig15colorData:return PT_MCH15;
 
-    default:  return (cmsColorSpaceSignature) (-1);
+    default:  return (int) (-1);
     }
 }
 
 
 cmsUInt32Number CMSEXPORT cmsChannelsOf(cmsColorSpaceSignature ColorSpace)
diff -aprNU5 lcms2-2.8.orig/utils/transicc/transicc.c lcms2-2.8/utils/transicc/transicc.c
--- lcms2-2.8.orig/utils/transicc/transicc.c	2016-07-20 09:46:02 -0513
+++ lcms2-2.8/utils/transicc/transicc.c	2016-11-06 01:23:26 -0513
@@ -28,10 +28,14 @@
 
 #ifndef _MSC_VER 
 #    include <unistd.h> 
 #endif 
 
+#ifdef CMS_IS_DJGPP_
+#    include <unistd.h>
+#endif
+
 #ifdef CMS_IS_WINDOWS_
 #    include <io.h>
 #endif
 
 #define MAX_INPUT_BUFFER 4096
