7f78d7
From 789b763bff1701ef31bd077ae49671dfe1c82a51 Mon Sep 17 00:00:00 2001
7f78d7
From: Nils Philippsen <nils@redhat.com>
7f78d7
Date: Wed, 4 Sep 2013 17:13:49 +0200
7f78d7
Subject: [PATCH] Add support for LCMS version 2.x.
7f78d7
7f78d7
---
7f78d7
 dcraw.c | 21 ++++++++++++++++++++-
7f78d7
 1 file changed, 20 insertions(+), 1 deletion(-)
7f78d7
7f78d7
diff --git a/dcraw.c b/dcraw.c
7f78d7
index 96e3d1f..4b280b5 100644
7f78d7
--- a/dcraw.c
7f78d7
+++ b/dcraw.c
7f78d7
@@ -80,7 +80,13 @@ typedef unsigned long long UINT64;
7f78d7
 #include <jpeglib.h>		/* Decode compressed Kodak DC120 photos */
7f78d7
 #endif				/* and Adobe Lossy DNGs */
7f78d7
 #ifndef NO_LCMS
7f78d7
-#include <lcms.h>		/* Support color profiles */
7f78d7
+#ifdef USE_LCMS2
7f78d7
+#include <lcms2.h>		/* Support color profiles */
7f78d7
+#else
7f78d7
+#undef USE_LCMS1
7f78d7
+#define USE_LCMS1
7f78d7
+#include <lcms.h>
7f78d7
+#endif
7f78d7
 #endif
7f78d7
 #ifdef LOCALEDIR
7f78d7
 #include <libintl.h>
7f78d7
@@ -8581,6 +8587,15 @@ notraw:
7f78d7
 }
7f78d7
 
7f78d7
 #ifndef NO_LCMS
7f78d7
+#ifdef USE_LCMS2
7f78d7
+static void lcms2_error_show_handler (cmsContext ContextID,
7f78d7
+                                      cmsUInt32Number ErrorCode,
7f78d7
+                                      const char *Text)
7f78d7
+{
7f78d7
+  fprintf (stderr, "lcms2: Error #%d; %s\n", ErrorCode, Text);
7f78d7
+}
7f78d7
+#endif
7f78d7
+
7f78d7
 void CLASS apply_profile (const char *input, const char *output)
7f78d7
 {
7f78d7
   char *prof;
7f78d7
@@ -8589,7 +8604,11 @@ void CLASS apply_profile (const char *input, const char *output)
7f78d7
   FILE *fp;
7f78d7
   unsigned size;
7f78d7
 
7f78d7
+#ifdef USE_LCMS2
7f78d7
+  cmsSetLogErrorHandler (lcms2_error_show_handler);
7f78d7
+#else
7f78d7
   cmsErrorAction (LCMS_ERROR_SHOW);
7f78d7
+#endif
7f78d7
   if (strcmp (input, "embed"))
7f78d7
     hInProfile = cmsOpenProfileFromFile (input, "r");
7f78d7
   else if (profile_length) {
7f78d7
-- 
7f78d7
1.8.3.1
7f78d7