Hans Leidekker : mscms: Handle errors from lcms more gracefully.

Alexandre Julliard julliard at winehq.org
Thu Mar 5 10:31:05 CST 2009


Module: wine
Branch: master
Commit: 12dac70a32b49fa4fda574bb7908c15710aa734d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=12dac70a32b49fa4fda574bb7908c15710aa734d

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Thu Mar  5 12:11:30 2009 +0100

mscms: Handle errors from lcms more gracefully.

Default behavior of lcms is to abort the process when it encounters
an error it considers fatal, such as a corrupt color profile.

---

 dlls/mscms/mscms_main.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/dlls/mscms/mscms_main.c b/dlls/mscms/mscms_main.c
index 00e2a75..3199c0b 100644
--- a/dlls/mscms/mscms_main.c
+++ b/dlls/mscms/mscms_main.c
@@ -36,6 +36,23 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(mscms);
 
+#ifdef HAVE_LCMS
+static int lcms_error_handler( int error, const char *text )
+{
+    switch (error)
+    {
+    case LCMS_ERRC_WARNING:
+    case LCMS_ERRC_RECOVERABLE:
+    case LCMS_ERRC_ABORTED:
+        WARN("%d %s\n", error, debugstr_a(text));
+        return 1;
+    default:
+        ERR("unknown error %d %s\n", error, debugstr_a(text));
+        return 0;
+    }
+}
+#endif
+
 BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
 {
     TRACE( "(%p, %d, %p)\n", hinst, reason, reserved );
@@ -44,6 +61,9 @@ BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
     {
     case DLL_PROCESS_ATTACH:
         DisableThreadLibraryCalls( hinst );
+#ifdef HAVE_LCMS
+        cmsSetErrorHandler( lcms_error_handler );
+#endif
         break;
     case DLL_PROCESS_DETACH:
 #ifdef HAVE_LCMS




More information about the wine-cvs mailing list