This commit is contained in:
John Cupitt 2008-02-20 19:10:02 +00:00
parent 4a8b4add78
commit a6b0d8471b
4 changed files with 32 additions and 20 deletions

5
TODO
View File

@ -8,6 +8,11 @@
maybe just link with g++ instead of gcc? how can we do this? put a maybe just link with g++ instead of gcc? how can we do this? put a
dummy.cpp into libsrc? dummy.cpp into libsrc?
or do we only need to link the cimg convenience library with g++? libtool
should copy the libs up, shouldn't it?
add a --without-cimg option too
- test maxpos_avg, quite a few changes - test maxpos_avg, quite a few changes
WONTFIX WONTFIX

View File

@ -43,7 +43,7 @@
* - ooops, else missing for subsample stuff above * - ooops, else missing for subsample stuff above
* 2/10/99 JC * 2/10/99 JC
* - tiled 16-bit greyscale read was broken * - tiled 16-bit greyscale read was broken
* - added mutex for TIFF*() calls * - added mutex for TIFFReadTile() calls
* 11/5/00 JC * 11/5/00 JC
* - removed TIFFmalloc/TIFFfree usage * - removed TIFFmalloc/TIFFfree usage
* 23/4/01 JC * 23/4/01 JC
@ -225,16 +225,18 @@ typedef struct {
void *table; void *table;
} YCbCrParams; } YCbCrParams;
/* Handle TIFF errors here. /* Handle TIFF errors here. Shared with im_vips2tiff. These can be called from
* more than one thread, but im_error and im_warn have mutexes in, so that's
* OK.
*/ */
static void void
thandler_error( char *module, char *fmt, va_list ap ) im__thandler_error( char *module, char *fmt, va_list ap )
{ {
im_verror( module, fmt, ap ); im_verror( module, fmt, ap );
} }
static void void
thandler_warning( char *module, char *fmt, va_list ap ) im__thandler_warning( char *module, char *fmt, va_list ap )
{ {
char buf[256]; char buf[256];
@ -1426,8 +1428,8 @@ im_istiffpyramid( const char *name )
{ {
TIFF *tif; TIFF *tif;
TIFFSetErrorHandler( (TIFFErrorHandler) thandler_error ); TIFFSetErrorHandler( (TIFFErrorHandler) im__thandler_error );
TIFFSetWarningHandler( (TIFFErrorHandler) thandler_warning ); TIFFSetWarningHandler( (TIFFErrorHandler) im__thandler_warning );
if( (tif = get_directory( name, 2 )) ) { if( (tif = get_directory( name, 2 )) ) {
/* We can see page 2 ... assume it is. /* We can see page 2 ... assume it is.
@ -1448,8 +1450,8 @@ im_tiff2vips( const char *filename, IMAGE *out )
printf( "im_tiff2vips: libtiff version is \"%s\"\n", TIFFGetVersion() ); printf( "im_tiff2vips: libtiff version is \"%s\"\n", TIFFGetVersion() );
#endif /*DEBUG*/ #endif /*DEBUG*/
TIFFSetErrorHandler( (TIFFErrorHandler) thandler_error ); TIFFSetErrorHandler( (TIFFErrorHandler) im__thandler_error );
TIFFSetWarningHandler( (TIFFErrorHandler) thandler_warning ); TIFFSetWarningHandler( (TIFFErrorHandler) im__thandler_warning );
if( !(rtiff = readtiff_new( filename, out )) ) if( !(rtiff = readtiff_new( filename, out )) )
return( -1 ); return( -1 );
@ -1479,8 +1481,8 @@ im_tiff2vips_header( const char *filename, IMAGE *out )
{ {
ReadTiff *rtiff; ReadTiff *rtiff;
TIFFSetErrorHandler( (TIFFErrorHandler) thandler_error ); TIFFSetErrorHandler( (TIFFErrorHandler) im__thandler_error );
TIFFSetWarningHandler( (TIFFErrorHandler) thandler_warning ); TIFFSetWarningHandler( (TIFFErrorHandler) im__thandler_warning );
if( !(rtiff = readtiff_new( filename, out )) ) if( !(rtiff = readtiff_new( filename, out )) )
return( -1 ); return( -1 );

View File

@ -96,6 +96,8 @@
* 15/2/08 * 15/2/08
* - set TIFFTAG_JPEGQUALITY explicitly when we copy TIFF files, since * - set TIFFTAG_JPEGQUALITY explicitly when we copy TIFF files, since
* libtiff doesn't keep this in the header (thanks Joe) * libtiff doesn't keep this in the header (thanks Joe)
* 20/2/08
* - use tiff error handler from im_tiff2vips.c
*/ */
/* /*
@ -237,14 +239,10 @@ typedef struct tiff_write {
char *icc_profile; /* Profile to embed */ char *icc_profile; /* Profile to embed */
} TiffWrite; } TiffWrite;
/* Handle TIFF errors here. /* Use these from im_tiff2vips().
*/ */
static void void im__thandler_error( char *module, char *fmt, va_list ap );
vhandle( char *module, char *fmt, va_list ap ) void im__thandler_warning( char *module, char *fmt, va_list ap );
{
im_error( "im_vips2tiff", _( "TIFF error in \"%s\": " ), module );
im_verror( "im_vips2tiff", fmt, ap );
}
/* Open TIFF for output. /* Open TIFF for output.
*/ */
@ -1527,7 +1525,8 @@ im_vips2tiff( IMAGE *im, const char *filename )
/* Override the default TIFF error handler. /* Override the default TIFF error handler.
*/ */
TIFFSetErrorHandler( (TIFFErrorHandler) vhandle ); TIFFSetErrorHandler( (TIFFErrorHandler) im__thandler_error );
TIFFSetWarningHandler( (TIFFErrorHandler) im__thandler_warning );
/* Check input image. /* Check input image.
*/ */

View File

@ -12,6 +12,8 @@
* - i18n added, domain now separate arg * - i18n added, domain now separate arg
* 14/2/07 * 14/2/07
* - lock around error buffer changes * - lock around error buffer changes
* 20/2/08
* - lock around warnings and diagnostics too, why not
*/ */
/* /*
@ -160,10 +162,12 @@ void
im_vdiag( const char *domain, const char *fmt, va_list ap ) im_vdiag( const char *domain, const char *fmt, va_list ap )
{ {
if( !g_getenv( IM_DIAGNOSTICS ) ) { if( !g_getenv( IM_DIAGNOSTICS ) ) {
g_mutex_lock( im__global_lock );
(void) fprintf( stderr, _( "%s: " ), _( "vips diagnostic" ) ); (void) fprintf( stderr, _( "%s: " ), _( "vips diagnostic" ) );
(void) fprintf( stderr, _( "%s: " ), domain ); (void) fprintf( stderr, _( "%s: " ), domain );
(void) vfprintf( stderr, fmt, ap ); (void) vfprintf( stderr, fmt, ap );
(void) fprintf( stderr, "\n" ); (void) fprintf( stderr, "\n" );
g_mutex_unlock( im__global_lock );
} }
} }
@ -181,10 +185,12 @@ void
im_vwarn( const char *domain, const char *fmt, va_list ap ) im_vwarn( const char *domain, const char *fmt, va_list ap )
{ {
if( !g_getenv( IM_WARNING ) ) { if( !g_getenv( IM_WARNING ) ) {
g_mutex_lock( im__global_lock );
(void) fprintf( stderr, _( "%s: " ), _( "vips warning" ) ); (void) fprintf( stderr, _( "%s: " ), _( "vips warning" ) );
(void) fprintf( stderr, _( "%s: " ), domain ); (void) fprintf( stderr, _( "%s: " ), domain );
(void) vfprintf( stderr, fmt, ap ); (void) vfprintf( stderr, fmt, ap );
(void) fprintf( stderr, "\n" ); (void) fprintf( stderr, "\n" );
g_mutex_unlock( im__global_lock );
} }
} }