From 4af242b59935a6f330c788d6dc0f4e90e1c1ad0f Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 20 Feb 2019 12:49:59 +0000 Subject: [PATCH] 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) --- libvips/colour/profile_load.c | 4 ++-- libvips/deprecated/vips7compat.c | 2 +- libvips/foreign/dzsave.c | 10 +++++----- libvips/foreign/heifload.c | 8 ++++---- libvips/foreign/vipspng.c | 8 +++++--- libvips/iofuncs/object.c | 8 ++++---- libvips/iofuncs/util.c | 2 +- 7 files changed, 22 insertions(+), 20 deletions(-) diff --git a/libvips/colour/profile_load.c b/libvips/colour/profile_load.c index a4964c7a..9f9016c7 100644 --- a/libvips/colour/profile_load.c +++ b/libvips/colour/profile_load.c @@ -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 )) ) { diff --git a/libvips/deprecated/vips7compat.c b/libvips/deprecated/vips7compat.c index 8a925ad1..308220b7 100644 --- a/libvips/deprecated/vips7compat.c +++ b/libvips/deprecated/vips7compat.c @@ -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 ); diff --git a/libvips/foreign/dzsave.c b/libvips/foreign/dzsave.c index 65ea028b..9f0d761d 100644 --- a/libvips/foreign/dzsave.c +++ b/libvips/foreign/dzsave.c @@ -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'; } diff --git a/libvips/foreign/heifload.c b/libvips/foreign/heifload.c index 4f6d8826..d15a81a3 100644 --- a/libvips/foreign/heifload.c +++ b/libvips/foreign/heifload.c @@ -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 "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 ); } diff --git a/libvips/iofuncs/object.c b/libvips/iofuncs/object.c index 8c7a9e99..c6f1050b 100644 --- a/libvips/iofuncs/object.c +++ b/libvips/iofuncs/object.c @@ -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 ); diff --git a/libvips/iofuncs/util.c b/libvips/iofuncs/util.c index b715403b..e0eeb734 100644 --- a/libvips/iofuncs/util.c +++ b/libvips/iofuncs/util.c @@ -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