check .v enums more carefully

This commit is contained in:
John Cupitt 2021-08-30 14:02:03 +01:00
parent 6444bfb5bb
commit b62287a792
2 changed files with 12 additions and 9 deletions

View File

@ -1,7 +1,7 @@
16/8/21 started 8.11.4 16/8/21 started 8.11.4
- fix off-by-one error in new rank fast path - fix off-by-one error in new rank fast path
- add "unlimited" flag to png load [joshuamsager] - add "unlimited" flag to png load [joshuamsager]
- improve filtering of Coding [lovell] - improve filtering of .v enums [lovell]
14/7/21 started 8.11.3 14/7/21 started 8.11.3
- build threadpool later [kleisauke] - build threadpool later [kleisauke]

View File

@ -332,6 +332,7 @@ vips__read_header_bytes( VipsImage *im, unsigned char *from )
{ {
gboolean swap; gboolean swap;
int i; int i;
GEnumValue *value;
#ifdef SHOW_HEADER #ifdef SHOW_HEADER
printf( "vips__read_header_bytes: file bytes:\n" ); printf( "vips__read_header_bytes: file bytes:\n" );
@ -383,14 +384,16 @@ vips__read_header_bytes( VipsImage *im, unsigned char *from )
/* Coding and Type have missing values, so we look up in the enum. /* Coding and Type have missing values, so we look up in the enum.
*/ */
im->Type = g_enum_get_value( value = g_enum_get_value( g_type_class_ref( VIPS_TYPE_INTERPRETATION ),
g_type_class_ref( VIPS_TYPE_INTERPRETATION ), im->Type );
im->Type ) ? if( !value ||
im->Type : VIPS_INTERPRETATION_ERROR; strcmp( value->value_nick, "last" ) == 0 )
im->Coding = g_enum_get_value( im->Type = VIPS_INTERPRETATION_ERROR;
g_type_class_ref( VIPS_TYPE_CODING ), value = g_enum_get_value( g_type_class_ref( VIPS_TYPE_CODING ),
im->Coding ) ? im->Coding );
im->Coding : VIPS_CODING_ERROR; if( !value ||
strcmp( value->value_nick, "last" ) == 0 )
im->Coding = VIPS_CODING_ERROR;
/* Offset, Res, etc. don't affect vips file layout, just /* Offset, Res, etc. don't affect vips file layout, just
* pixel interpretation, don't clip them. * pixel interpretation, don't clip them.