2cf66c
From affda75b7d868350d7ef9e7a67367826fb3e950d Mon Sep 17 00:00:00 2001
2cf66c
From: Nils Philippsen <nils@redhat.com>
2cf66c
Date: Wed, 4 Sep 2013 17:13:49 +0200
2cf66c
Subject: [PATCH] Report errors with LCMS version 2.x.
2cf66c
2cf66c
---
2cf66c
 dcraw.c | 8 ++++++++
2cf66c
 1 file changed, 8 insertions(+)
2cf66c
2cf66c
diff --git a/dcraw.c b/dcraw.c
2cf66c
index 6f8dbbe..d80db64 100644
2cf66c
--- a/dcraw.c
2cf66c
+++ b/dcraw.c
2cf66c
@@ -8902,6 +8902,13 @@ notraw:
2cf66c
 }
2cf66c
 
2cf66c
 #ifndef NO_LCMS
2cf66c
+static void lcms2_error_show_handler (cmsContext ContextID,
2cf66c
+                                      cmsUInt32Number ErrorCode,
2cf66c
+                                      const char *Text)
2cf66c
+{
2cf66c
+  fprintf (stderr, "lcms2: Error #%d; %s\n", ErrorCode, Text);
2cf66c
+}
2cf66c
+
2cf66c
 void CLASS apply_profile (const char *input, const char *output)
2cf66c
 {
2cf66c
   char *prof;
2cf66c
@@ -8910,6 +8917,7 @@ void CLASS apply_profile (const char *input, const char *output)
2cf66c
   FILE *fp;
2cf66c
   unsigned size;
2cf66c
 
2cf66c
+  cmsSetLogErrorHandler (lcms2_error_show_handler);
2cf66c
   if (strcmp (input, "embed"))
2cf66c
     hInProfile = cmsOpenProfileFromFile (input, "r");
2cf66c
   else if (profile_length) {
2cf66c
-- 
2cf66c
1.9.0
2cf66c