fix travis compiler warnings

- older libpng don't have consts decls for some set/get funcs
- use g_ascii_strcasecmp() on program text strings (instead of strcasecmp)
This commit is contained in:
John Cupitt 2019-02-20 12:49:59 +00:00
parent cab3484d2e
commit 4af242b599
7 changed files with 22 additions and 20 deletions

View File

@ -104,7 +104,7 @@ vips_fallback_profile_get( const char *name, size_t *length )
for( p = vips_fallback_profile_list; p; p = p->next ) {
VipsFallbackProfile *fallback = (VipsFallbackProfile *) p->data;
if( strcasecmp( fallback->name, name ) == 0 ) {
if( g_ascii_strcasecmp( fallback->name, name ) == 0 ) {
*length = fallback->data_length;
return( fallback->data );
@ -128,7 +128,7 @@ vips_profile_load_build( VipsObject *object )
build( object ) )
return( -1 );
if( strcasecmp( load->name, "none" ) == 0 ) {
if( g_ascii_strcasecmp( load->name, "none" ) == 0 ) {
profile = NULL;
}
else if( (data = vips_fallback_profile_get( load->name, &length )) ) {

View File

@ -606,7 +606,7 @@ lookup_enum( GType type, const char *names[], const char *name )
return( value->value );
for( i = 0; names[i]; i++ )
if( strcasecmp( names[i], name ) == 0 )
if( g_ascii_strcasecmp( names[i], name ) == 0 )
return( i );
return( -1 );

View File

@ -2198,16 +2198,16 @@ vips_foreign_save_dz_file_build( VipsObject *object )
*/
if( (p = strrchr( dz->basename, '.' )) ) {
if( !vips_object_argument_isset( object, "container" ) )
if( strcasecmp( p + 1, "zip" ) == 0 ||
strcasecmp( p + 1, "szi" ) == 0 )
if( g_ascii_strcasecmp( p + 1, "zip" ) == 0 ||
g_ascii_strcasecmp( p + 1, "szi" ) == 0 )
dz->container = VIPS_FOREIGN_DZ_CONTAINER_ZIP;
/* Remove any legal suffix. We don't remove all suffixes
* since we might be writing to a dirname with a dot in.
*/
if( strcasecmp( p + 1, "zip" ) == 0 ||
strcasecmp( p + 1, "szi" ) == 0 ||
strcasecmp( p + 1, "dz" ) == 0 )
if( g_ascii_strcasecmp( p + 1, "zip" ) == 0 ||
g_ascii_strcasecmp( p + 1, "szi" ) == 0 ||
g_ascii_strcasecmp( p + 1, "dz" ) == 0 )
*p = '\0';
}

View File

@ -302,7 +302,7 @@ vips_foreign_load_heif_set_header( VipsForeignLoadHeif *heif, VipsImage *out )
/* We need to skip the first four bytes of EXIF, they just
* contain the offset.
*/
if( strcasecmp( type, "exif" ) == 0 ) {
if( g_ascii_strcasecmp( type, "exif" ) == 0 ) {
data += 4;
length -= 4;
}
@ -312,9 +312,9 @@ vips_foreign_load_heif_set_header( VipsForeignLoadHeif *heif, VipsImage *out )
* XMP metadata is just attached with the "mime" type, and
* usually start with "<x:xmpmeta".
*/
if( strcasecmp( type, "exif" ) == 0 )
if( g_ascii_strcasecmp( type, "exif" ) == 0 )
vips_snprintf( name, 256, VIPS_META_EXIF_NAME );
else if( strcasecmp( type, "mime" ) == 0 &&
else if( g_ascii_strcasecmp( type, "mime" ) == 0 &&
vips_isprefix( "<x:xmpmeta", (const char *) data ) )
snprintf( name, 256, VIPS_META_XMP_NAME );
else
@ -323,7 +323,7 @@ vips_foreign_load_heif_set_header( VipsForeignLoadHeif *heif, VipsImage *out )
vips_image_set_blob( out, name,
(VipsCallbackFn) NULL, data, length );
if( strcasecmp( type, "exif" ) == 0 )
if( g_ascii_strcasecmp( type, "exif" ) == 0 )
(void) vips__exif_parse( out );
}

View File

@ -1077,7 +1077,8 @@ write_vips( Write *write,
return( -1 );
if( blob ) {
size_t length;
const void *data = vips_blob_get( blob, &length );
const void *data
= vips_blob_get( blob, &length );
#ifdef DEBUG
printf( "write_vips: attaching %zd bytes "
@ -1086,7 +1087,7 @@ write_vips( Write *write,
png_set_iCCP( write->pPng, write->pInfo,
"icc", PNG_COMPRESSION_TYPE_BASE,
data, length );
(void *) data, length );
vips_area_unref( (VipsArea *) blob );
}
@ -1105,7 +1106,8 @@ write_vips( Write *write,
#endif /*DEBUG*/
png_set_iCCP( write->pPng, write->pInfo, "icc",
PNG_COMPRESSION_TYPE_BASE, data, length );
PNG_COMPRESSION_TYPE_BASE,
(void *) data, length );
}

View File

@ -1988,8 +1988,8 @@ vips_object_set_argument_from_string( VipsObject *object,
b = TRUE;
if( value &&
(strcasecmp( value, "false" ) == 0 ||
strcasecmp( value, "no" ) == 0 ||
(g_ascii_strcasecmp( value, "false" ) == 0 ||
g_ascii_strcasecmp( value, "no" ) == 0 ||
strcmp( value, "0" ) == 0) )
b = FALSE;
@ -2804,12 +2804,12 @@ vips_type_depth( GType type )
static void *
test_name( VipsObjectClass *class, const char *nickname )
{
if( strcasecmp( class->nickname, nickname ) == 0 )
if( g_ascii_strcasecmp( class->nickname, nickname ) == 0 )
return( class );
/* Check the class name too, why not.
*/
if( strcasecmp( G_OBJECT_CLASS_NAME( class ), nickname ) == 0 )
if( g_ascii_strcasecmp( G_OBJECT_CLASS_NAME( class ), nickname ) == 0 )
return( class );
return( NULL );

View File

@ -333,7 +333,7 @@ vips_iscasepostfix( const char *a, const char *b )
if( n > m )
return( FALSE );
return( strcasecmp( a + m - n, b ) == 0 );
return( g_ascii_strcasecmp( a + m - n, b ) == 0 );
}
/* Test for string a starts string b. a is a known-good string, b may be