From e9aaedc60ab32b7874ad61fe745fd9e6b8dc7e7f Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 1 Jun 2018 19:44:43 +0100 Subject: [PATCH] fix some compiler warnings from the msvc patch --- ChangeLog | 1 + libvips/arithmetic/divide.c | 2 +- libvips/arithmetic/multiply.c | 2 +- libvips/foreign/exif.c | 6 +++--- libvips/foreign/tiff2vips.c | 2 +- libvips/foreign/vipspng.c | 2 +- libvips/include/vips/type.h | 6 ++++-- libvips/iofuncs/image.c | 3 ++- libvips/iofuncs/util.c | 2 +- libvipsCC/vipsc++.cc | 2 +- 10 files changed, 16 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2dd36e28..60400b7a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,6 +23,7 @@ - add vips_transpose3d() -- swap major dimensions in a volumetric image - remove vips7 stuff from default API ... you must now #include it explicitly - added vips_argument_get_id() to fix derived classes on win32 [angelmixu] +- fix compile with MSVC 2017 [angelmixu] 12/3/18 started 8.6.4 - better fitting of fonts with overhanging edges [AdriĆ ] diff --git a/libvips/arithmetic/divide.c b/libvips/arithmetic/divide.c index 0cc3970c..fcbec4b3 100644 --- a/libvips/arithmetic/divide.c +++ b/libvips/arithmetic/divide.c @@ -13,7 +13,7 @@ * 19/10/93 JC * - coredump-inducing bug in complex*complex fixed * 13/12/93 - * - char*short bug fixed + * - char * short bug fixed * 12/6/95 JC * - new im_multiply adapted to make new im_divide * 27/9/04 diff --git a/libvips/arithmetic/multiply.c b/libvips/arithmetic/multiply.c index 424b9097..3d30079b 100644 --- a/libvips/arithmetic/multiply.c +++ b/libvips/arithmetic/multiply.c @@ -13,7 +13,7 @@ * 19/10/93 JC * - coredump-inducing bug in complex*complex fixed * 13/12/93 - * - char*short bug fixed + * - char * short bug fixed * 12/6/95 JC * - new im_add adapted to make new im_multiply * 27/9/04 diff --git a/libvips/foreign/exif.c b/libvips/foreign/exif.c index ef3fcef6..af6ff54e 100644 --- a/libvips/foreign/exif.c +++ b/libvips/foreign/exif.c @@ -570,7 +570,7 @@ vips_exif_double_to_srational( double value, ExifSRational *srv ) srv->denominator = 1000; } -/* Parse a char* into an ExifRational. We allow floats as well. +/* Parse a char * into an ExifRational. We allow floats as well. */ static void vips_exif_parse_rational( const char *str, ExifRational *rv ) @@ -580,7 +580,7 @@ vips_exif_parse_rational( const char *str, ExifRational *rv ) vips_exif_double_to_rational( g_ascii_strtod( str, NULL ), rv ); } -/* Parse a char* into an ExifSRational. We allow floats as well. +/* Parse a char * into an ExifSRational. We allow floats as well. */ static void vips_exif_parse_srational( const char *str, ExifSRational *srv ) @@ -591,7 +591,7 @@ vips_exif_parse_srational( const char *str, ExifSRational *srv ) vips_exif_double_to_srational( g_ascii_strtod( str, NULL ), srv ); } -/* Does both signed and unsigned rationals from a char*. +/* Does both signed and unsigned rationals from a char *. */ static void vips_exif_set_rational( ExifData *ed, diff --git a/libvips/foreign/tiff2vips.c b/libvips/foreign/tiff2vips.c index 522e9a49..b5978e84 100644 --- a/libvips/foreign/tiff2vips.c +++ b/libvips/foreign/tiff2vips.c @@ -1843,7 +1843,7 @@ rtiff_stripwise_generate( VipsRegion *or, /* Do any repacking to generate pixels in vips layout. */ - p = (char*)(rtiff->contig_buf) + + p = (VipsPel *) rtiff->contig_buf + (hit.top - strip.top) * scanline_size; q = VIPS_REGION_ADDR( or, 0, r->top + y ); for( z = 0; z < hit.height; z++ ) { diff --git a/libvips/foreign/vipspng.c b/libvips/foreign/vipspng.c index d659b9fe..e4913c97 100644 --- a/libvips/foreign/vipspng.c +++ b/libvips/foreign/vipspng.c @@ -700,7 +700,7 @@ vips_png_read_buffer( png_structp pPng, png_bytep data, png_size_t length ) if( read->read_pos + length > read->length ) png_error( pPng, "not enough data in buffer" ); - memcpy( data, (const char*)(read->buffer) + read->read_pos, length ); + memcpy( data, (VipsPel *) read->buffer + read->read_pos, length ); read->read_pos += length; } diff --git a/libvips/include/vips/type.h b/libvips/include/vips/type.h index 1d545a2d..0cc2a275 100644 --- a/libvips/include/vips/type.h +++ b/libvips/include/vips/type.h @@ -100,7 +100,8 @@ void *vips_area_get_data( VipsArea *area, #ifdef VIPS_DEBUG #define VIPS_ARRAY_ADDR( X, I ) \ (((I) >= 0 && (I) < VIPS_AREA( X )->n) ? \ - ((char*)(VIPS_AREA( X )->data) + VIPS_AREA( X )->sizeof_type * (I)) : \ + (void *) ((VipsPel *) VIPS_AREA( X )->data + \ + VIPS_AREA( X )->sizeof_type * (I)) : \ (fprintf( stderr, \ "VIPS_ARRAY_ADDR: index out of bounds, " \ "file \"%s\", line %d\n" \ @@ -109,7 +110,8 @@ void *vips_area_get_data( VipsArea *area, (I), VIPS_AREA( X )->n ), NULL )) #else /*!VIPS_DEBUG*/ #define VIPS_ARRAY_ADDR( X, I ) \ - ((char*)(VIPS_AREA( X )->data) + VIPS_AREA( X )->sizeof_type * (I)) + ((void *) \ + ((VipsPel *) VIPS_AREA( X )->data + VIPS_AREA( X )->sizeof_type * (I))) #endif /*VIPS_DEBUG*/ /** diff --git a/libvips/iofuncs/image.c b/libvips/iofuncs/image.c index 7aaada2c..0679ac7b 100644 --- a/libvips/iofuncs/image.c +++ b/libvips/iofuncs/image.c @@ -3269,7 +3269,8 @@ vips_image_wio_input( VipsImage *image ) */ if( vips_mapfile( image ) ) return( -1 ); - image->data = ((char*)image->baseaddr) + image->sizeof_header; + image->data = (VipsPel *) image->baseaddr + + image->sizeof_header; image->dtype = VIPS_IMAGE_MMAPIN; break; diff --git a/libvips/iofuncs/util.c b/libvips/iofuncs/util.c index a9f3bb86..6ea75172 100644 --- a/libvips/iofuncs/util.c +++ b/libvips/iofuncs/util.c @@ -1005,7 +1005,7 @@ vips__gslist_gvalue_merge( GSList *a, const GSList *b ) return( a ); } -/* Make a char* from GSList of GValue. Each GValue should be a ref_string. +/* Make a char * from GSList of GValue. Each GValue should be a ref_string. * free the result. Empty list -> "", not NULL. Join strings with '\n'. */ char * diff --git a/libvipsCC/vipsc++.cc b/libvipsCC/vipsc++.cc index 37f52e1d..73e81c84 100644 --- a/libvipsCC/vipsc++.cc +++ b/libvipsCC/vipsc++.cc @@ -717,7 +717,7 @@ VDMask VImage::stats() Vargv _vec( "im_stats" ); _vec.data(0) = in.image(); - ((im_mask_object*) _vec.data(1))->name = (char*)"noname"; + ((im_mask_object*) _vec.data(1))->name = (char*) "noname"; _vec.call(); statistics.embed( (DOUBLEMASK *)((im_mask_object*)_vec.data(1))->mask );