catch lcms errors

This commit is contained in:
John Cupitt 2009-04-06 22:09:51 +00:00
parent 62c4fd03ab
commit 54d88d2679
3 changed files with 19 additions and 18 deletions

View File

@ -1,6 +1,7 @@
3/4/09 started 7.19.0
- version bump
- tiny conv speedup
- catch lcms error messages
25/3/09 started 7.18.0
- revised version numbers

2
TODO
View File

@ -1,6 +1,8 @@
- import ~/summer-demo/summer.tif fails with "unable to read embedded
profile", is this a bug? better err msg would be good
trying to catch errors now, but is it working? not sure
WONTFIX for 7.18
================

View File

@ -9,6 +9,8 @@
* - lock around cmsDoTransform
* 23/1/07
* - set RGB16 on 16-bit RGB export
* 6/4/09
* - catch lcms error messages
*/
/*
@ -173,6 +175,19 @@ typedef struct {
GMutex *lock;
} Icc;
/* Error from lcms.
*/
static int
icc_error( int code, const char *text )
{
if( code == LCMS_ERRC_WARNING )
im_warn( "im_icc", "%s", text );
else
im_error( "im_icc", "%s", text );
return( 0 );
}
static int
icc_destroy( Icc *icc )
{
@ -192,6 +207,7 @@ icc_new( IMAGE *in, IMAGE *out, int intent )
/* Ask lcms not to abort on error.
*/
cmsErrorAction( LCMS_ERROR_IGNORE );
cmsSetErrorHandler( icc_error );
if( !(icc = IM_NEW( out, Icc )) )
return( NULL );
@ -329,24 +345,6 @@ decode_lab( WORD *fixed, float *lab, int n )
}
}
/*
lcms calls this on error ... but only for dynamically linked
programs :-(
void
cmsSignalError( int code, const char *fmt, ... )
{
va_list ap;
im_error( "im_icc", "error code #%d from little cms: " );
va_start( ap, fmt );
im_verrormsg( fmt, ap );
va_end( ap );
}
*/
static void
transform_buf( PEL *in, PEL *out, int n, Icc *icc )
{