capture tiff warnings during startup
We were not capturing warnings from libtiff until we used libtiff ourselves. Other libraries whcih we call, such as ImageMagick, could use libtiff and generate an uncaptured warning. On Windows these warnings each produced a popup.
This commit is contained in:
parent
4ab937a8b6
commit
efcc53859a
@ -1,3 +1,6 @@
|
|||||||
|
14/11/12 started 7.30.6
|
||||||
|
- capture tiff warnings earlier
|
||||||
|
|
||||||
14/11/12 started 7.30.5
|
14/11/12 started 7.30.5
|
||||||
- fix libtool version mess up (thanks Benjamin)
|
- fix libtool version mess up (thanks Benjamin)
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# also update the version number in the m4 macros below
|
# also update the version number in the m4 macros below
|
||||||
|
|
||||||
AC_INIT([vips], [7.30.5], [vipsip@jiscmail.ac.uk])
|
AC_INIT([vips], [7.30.6], [vipsip@jiscmail.ac.uk])
|
||||||
# required for gobject-introspection
|
# required for gobject-introspection
|
||||||
AC_PREREQ(2.62)
|
AC_PREREQ(2.62)
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ AC_CONFIG_MACRO_DIR([m4])
|
|||||||
# user-visible library versioning
|
# user-visible library versioning
|
||||||
m4_define([vips_major_version], [7])
|
m4_define([vips_major_version], [7])
|
||||||
m4_define([vips_minor_version], [30])
|
m4_define([vips_minor_version], [30])
|
||||||
m4_define([vips_micro_version], [5])
|
m4_define([vips_micro_version], [6])
|
||||||
m4_define([vips_version],
|
m4_define([vips_version],
|
||||||
[vips_major_version.vips_minor_version.vips_micro_version])
|
[vips_major_version.vips_minor_version.vips_micro_version])
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date`
|
|||||||
# binary interface changes not backwards compatible?: reset age to 0
|
# binary interface changes not backwards compatible?: reset age to 0
|
||||||
|
|
||||||
LIBRARY_CURRENT=33
|
LIBRARY_CURRENT=33
|
||||||
LIBRARY_REVISION=7
|
LIBRARY_REVISION=8
|
||||||
LIBRARY_AGE=2
|
LIBRARY_AGE=2
|
||||||
|
|
||||||
# patched into include/vips/version.h
|
# patched into include/vips/version.h
|
||||||
|
@ -36,8 +36,7 @@ extern "C" {
|
|||||||
|
|
||||||
extern const char *vips__foreign_tiff_suffs[];
|
extern const char *vips__foreign_tiff_suffs[];
|
||||||
|
|
||||||
void vips__thandler_error( const char *module, const char *fmt, va_list ap );
|
void vips__tiff_init( void );
|
||||||
void vips__thandler_warning( const char *module, const char *fmt, va_list ap );
|
|
||||||
|
|
||||||
int vips__tiff_write( VipsImage *in, const char *filename,
|
int vips__tiff_write( VipsImage *in, const char *filename,
|
||||||
VipsForeignTiffCompression compression, int Q,
|
VipsForeignTiffCompression compression, int Q,
|
||||||
|
@ -229,13 +229,13 @@ typedef struct {
|
|||||||
* more than one thread, but vips_error and vips_warn have mutexes in, so that's
|
* more than one thread, but vips_error and vips_warn have mutexes in, so that's
|
||||||
* OK.
|
* OK.
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
vips__thandler_error( const char *module, const char *fmt, va_list ap )
|
vips__thandler_error( const char *module, const char *fmt, va_list ap )
|
||||||
{
|
{
|
||||||
vips_verror( module, fmt, ap );
|
vips_verror( module, fmt, ap );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
vips__thandler_warning( const char *module, const char *fmt, va_list ap )
|
vips__thandler_warning( const char *module, const char *fmt, va_list ap )
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
@ -244,6 +244,16 @@ vips__thandler_warning( const char *module, const char *fmt, va_list ap )
|
|||||||
vips_warn( module, "%s", buf );
|
vips_warn( module, "%s", buf );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Call this during startup. Other libraries may be using libtiff and we want
|
||||||
|
* to capture any messages they send as well.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
vips__tiff_init( void )
|
||||||
|
{
|
||||||
|
TIFFSetErrorHandler( vips__thandler_error );
|
||||||
|
TIFFSetWarningHandler( vips__thandler_warning );
|
||||||
|
}
|
||||||
|
|
||||||
/* Test for field exists.
|
/* Test for field exists.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
@ -1506,8 +1516,7 @@ istiffpyramid( const char *name )
|
|||||||
{
|
{
|
||||||
TIFF *tif;
|
TIFF *tif;
|
||||||
|
|
||||||
TIFFSetErrorHandler( vips__thandler_error );
|
vips__tiff_init();
|
||||||
TIFFSetWarningHandler( vips__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.
|
||||||
@ -1529,8 +1538,7 @@ vips__tiff_read( const char *filename, VipsImage *out, int page )
|
|||||||
printf( "tiff2vips: libtiff starting for %s\n", filename );
|
printf( "tiff2vips: libtiff starting for %s\n", filename );
|
||||||
#endif /*DEBUG*/
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
TIFFSetErrorHandler( vips__thandler_error );
|
vips__tiff_init();
|
||||||
TIFFSetWarningHandler( vips__thandler_warning );
|
|
||||||
|
|
||||||
if( !(rtiff = readtiff_new( filename, out, page )) )
|
if( !(rtiff = readtiff_new( filename, out, page )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
@ -1558,8 +1566,7 @@ vips__tiff_read_header( const char *filename, VipsImage *out, int page )
|
|||||||
{
|
{
|
||||||
ReadTiff *rtiff;
|
ReadTiff *rtiff;
|
||||||
|
|
||||||
TIFFSetErrorHandler( vips__thandler_error );
|
vips__tiff_init();
|
||||||
TIFFSetWarningHandler( vips__thandler_warning );
|
|
||||||
|
|
||||||
if( !(rtiff = readtiff_new( filename, out, page )) )
|
if( !(rtiff = readtiff_new( filename, out, page )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
@ -1583,10 +1590,7 @@ vips__istifftiled( const char *filename )
|
|||||||
TIFF *tif;
|
TIFF *tif;
|
||||||
gboolean tiled;
|
gboolean tiled;
|
||||||
|
|
||||||
/* Override the default TIFF error handler.
|
vips__tiff_init();
|
||||||
*/
|
|
||||||
TIFFSetErrorHandler( vips__thandler_error );
|
|
||||||
TIFFSetWarningHandler( vips__thandler_warning );
|
|
||||||
|
|
||||||
if( !(tif = TIFFOpen( filename, "rm" )) ) {
|
if( !(tif = TIFFOpen( filename, "rm" )) ) {
|
||||||
vips_error_clear();
|
vips_error_clear();
|
||||||
|
@ -123,6 +123,13 @@ vips_foreign_load_tiff_class_init( VipsForeignLoadTiffClass *class )
|
|||||||
VipsForeignClass *foreign_class = (VipsForeignClass *) class;
|
VipsForeignClass *foreign_class = (VipsForeignClass *) class;
|
||||||
VipsForeignLoadClass *load_class = (VipsForeignLoadClass *) class;
|
VipsForeignLoadClass *load_class = (VipsForeignLoadClass *) class;
|
||||||
|
|
||||||
|
/* Other libraries may be using libtiff, we want to capture tiff
|
||||||
|
* warning and error as soon as we can.
|
||||||
|
*
|
||||||
|
* This class init will be triggered during startup.
|
||||||
|
*/
|
||||||
|
vips__tiff_init();
|
||||||
|
|
||||||
gobject_class->set_property = vips_object_set_property;
|
gobject_class->set_property = vips_object_set_property;
|
||||||
gobject_class->get_property = vips_object_get_property;
|
gobject_class->get_property = vips_object_get_property;
|
||||||
|
|
||||||
|
@ -1474,7 +1474,6 @@ gather_pyramid( TiffWrite *tw )
|
|||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
vips__tiff_write( VipsImage *in, const char *filename,
|
vips__tiff_write( VipsImage *in, const char *filename,
|
||||||
VipsForeignTiffCompression compression, int Q,
|
VipsForeignTiffCompression compression, int Q,
|
||||||
@ -1493,10 +1492,7 @@ vips__tiff_write( VipsImage *in, const char *filename,
|
|||||||
printf( "tiff2vips: libtiff version is \"%s\"\n", TIFFGetVersion() );
|
printf( "tiff2vips: libtiff version is \"%s\"\n", TIFFGetVersion() );
|
||||||
#endif /*DEBUG*/
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
/* Override the default TIFF error handler.
|
vips__tiff_init();
|
||||||
*/
|
|
||||||
TIFFSetErrorHandler( vips__thandler_error );
|
|
||||||
TIFFSetWarningHandler( vips__thandler_warning );
|
|
||||||
|
|
||||||
/* Check input image.
|
/* Check input image.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user