fail vips7 openslide if level argument is not numeric

in case users forget the leading comma when specifying an associated
image, etc.
This commit is contained in:
Benjamin Gilbert 2012-04-11 14:07:04 -04:00
parent 334452d681
commit 5e1b4f2c00
1 changed files with 9 additions and 2 deletions

View File

@ -58,14 +58,21 @@ im_openslide2vips( const char *name, IMAGE *out )
char *p, *q;
char *associated;
int level;
char *endptr;
VipsImage *t;
im_filename_split( name, filename, mode );
level = 0;
associated = NULL;
p = &mode[0];
if( (q = im_getnextoption( &p )) )
level = atoi( q );
if( (q = im_getnextoption( &p )) ) {
level = strtoul( q, &endptr, 10 );
if( *endptr ) {
vips_error( "openslide2vips", "%s",
_( "level must be a number" ) );
return( -1 );
}
}
if( (q = im_getnextoption( &p )) )
associated = q;