Merge branch 'master' into add-magickload-page

This commit is contained in:
John Cupitt 2016-02-18 11:28:09 +00:00
commit de59ff0e5a
5 changed files with 22 additions and 21 deletions

View File

@ -5,6 +5,7 @@
- add pdfload, svgload, gifload for PDF, SVG and GIF rendering
- vipsthumbnail knows about pdfload and svgload
- added @page param to magickload
- matload is more specific (thanks bithive)
27/1/16 started 8.2.3
- fix a crash with SPARC byte-order labq vips images

View File

@ -705,9 +705,10 @@ vips__magick_read( const char *filename, VipsImage *out,
*/
/* This doesn't seem to work, strange.
*
* read->image_info->number_scenes = 1;
* read->image_info->scene = read->page;
read->image_info->number_scenes = 1;
read->image_info->scene = read->page;
*/
/* This works, but is no faster.

View File

@ -7,6 +7,8 @@
* 21/8/14
* - swap width/height
* - set interpretation to rgb16 etc.
* 16/2/16
* - more specific is_a test
*/
/*
@ -319,14 +321,13 @@ vips__mat_load( const char *filename, VipsImage *out )
int
vips__mat_ismat( const char *filename )
{
mat_t *mat;
unsigned char buf[15];
vips_error_freeze();
mat = Mat_Open( filename, MAT_ACC_RDONLY );
Mat_Close( mat );
vips_error_thaw();
if( vips__get_bytes( filename, buf, 10 ) &&
vips_isprefix( "MATLAB 5.0", (char *) buf ) )
return( 1 );
return( mat != NULL );
return( 0 );
}
const char *vips__mat_suffs[] = { ".mat", NULL };

View File

@ -122,11 +122,6 @@ vips_foreign_load_mat_class_init( VipsForeignLoadMatClass *class )
foreign_class->suffs = vips__mat_suffs;
/* We need to be lower priority than the jpeg loader, since some jpegs
* can make libmatio segv on Mat_Open().
*/
foreign_class->priority = -50;
load_class->is_a = vips__mat_ismat;
load_class->get_flags_filename =
vips_foreign_load_mat_get_flags_filename;

View File

@ -319,21 +319,24 @@ vips_ispostfix( const char *a, const char *b )
return( strcmp( a + m - n, b ) == 0 );
}
/* Test for string a starts string b.
/* Test for string a starts string b. a is a known-good string, b may be
* random data.
*/
gboolean
vips_isprefix( const char *a, const char *b )
{
int n = strlen( a );
int m = strlen( b );
int i;
if( m < n )
return( FALSE );
for( i = 0; i < n; i++ )
for( i = 0; a[i] && b[i]; i++ )
if( a[i] != b[i] )
return( FALSE );
/* If there's stuff left in a but b has finished, we must have a
* mismatch.
*/
if( a[i] && !b[i] )
return( FALSE );
return( TRUE );
}