fix openslide_open error reporting for OpenSlide 3.3.0

This commit is contained in:
Benjamin Gilbert 2012-09-20 02:57:24 -04:00
parent bb53c952c4
commit 5e08757301
1 changed files with 15 additions and 2 deletions

View File

@ -2,7 +2,7 @@
*
* Benjamin Gilbert
*
* Copyright (c) 2011 Carnegie Mellon University
* Copyright (c) 2011-2012 Carnegie Mellon University
*
* 26/11/11
* - initial version
@ -31,6 +31,8 @@
* - small cleanups
* 11/4/12
* - fail if both level and associated image are specified
* 20/9/12
* - update openslide_open error handling for 3.3.0 semantics
*/
/*
@ -108,6 +110,9 @@ vips__openslide_isslide( const char *filename )
*/
vendor = openslide_get_property_value( osr,
OPENSLIDE_PROPERTY_NAME_VENDOR );
/* vendor will be NULL if osr is in error state.
*/
if( vendor &&
strcmp( vendor, "generic-tiff" ) != 0 )
ok = 1;
@ -148,6 +153,7 @@ readslide_new( const char *filename, VipsImage *out,
{
ReadSlide *rslide;
int64_t w, h;
const char *error;
const char *background;
const char * const *properties;
@ -169,7 +175,14 @@ readslide_new( const char *filename, VipsImage *out,
rslide->osr = openslide_open( filename );
if( rslide->osr == NULL ) {
vips_error( "openslide2vips",
"%s", _( "failure opening slide" ) );
"%s", _( "unsupported slide format" ) );
return( NULL );
}
error = openslide_get_error( rslide->osr );
if( error ) {
vips_error( "openslide2vips",
_( "opening slide: %s" ), error );
return( NULL );
}