Hi, I'd like to fix up some of the most glaring problems with error handling in lcms2:
1. There doesn't exist a "const char *cmsErrorString(cmsUInt32Number ErrorCode)" so any programs need to include a cmsERROR_* -> string function 2. There's no void *user_data to cmsSetLogErrorHandler 1 is easily fixable, and a nice to have. 2 is a lot harder and a lot more important. If you're doing any kind of activity in the error callback, e.g. writing to a file, or writing a GError higher up the callchain you need to be able to pass in arbitrary data to the log handler *without* using global static variables. The way I can see this working is something like this: static void colord_log_handler_cb (cmsContext ContextID, cmsUInt32Number ErrorCode, const char *Text, void *user_data) { CdLog *log = CD_LOG (user_data); cd_log_example (log, "lcms2 went fubar"); } cmsSetLogErrorHandler2(colord_log_handler_cb, priv->logger); Of course, without breaking API, this means creating cmsSetLogErrorHandler2 and typedef cmsLogErrorHandler2Function (or perhaps cmsSetLogErrorHandlerUserdata or cmsSetLogErrorHandlerExtra). Ideas welcome. Richard. ------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk _______________________________________________ Lcms-user mailing list Lcms-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lcms-user