performing arithmetic on a void* is not in the standard C, GCC uses an extension for using it, in VS2017 this is non-existant, so the recommended way is to cast to char* to perform increments on the pointer

This commit is contained in:
Angel Sánchez 2018-05-31 13:53:31 +02:00
parent 3282e464a1
commit 258311cec2
4 changed files with 5 additions and 5 deletions

View File

@ -1843,7 +1843,7 @@ rtiff_stripwise_generate( VipsRegion *or,
/* Do any repacking to generate pixels in vips layout.
*/
p = rtiff->contig_buf +
p = (char*)(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++ ) {

View File

@ -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, read->buffer + read->read_pos, length );
memcpy( data, (const char*)(read->buffer) + read->read_pos, length );
read->read_pos += length;
}

View File

@ -100,7 +100,7 @@ void *vips_area_get_data( VipsArea *area,
#ifdef VIPS_DEBUG
#define VIPS_ARRAY_ADDR( X, I ) \
(((I) >= 0 && (I) < VIPS_AREA( X )->n) ? \
(VIPS_AREA( X )->data + VIPS_AREA( X )->sizeof_type * (I)) : \
((char*)(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 +109,7 @@ void *vips_area_get_data( VipsArea *area,
(I), VIPS_AREA( X )->n ), NULL ))
#else /*!VIPS_DEBUG*/
#define VIPS_ARRAY_ADDR( X, I ) \
(VIPS_AREA( X )->data + VIPS_AREA( X )->sizeof_type * (I))
((char*)(VIPS_AREA( X )->data) + VIPS_AREA( X )->sizeof_type * (I))
#endif /*VIPS_DEBUG*/
/**

View File

@ -3269,7 +3269,7 @@ vips_image_wio_input( VipsImage *image )
*/
if( vips_mapfile( image ) )
return( -1 );
image->data = image->baseaddr + image->sizeof_header;
image->data = ((char*)image->baseaddr) + image->sizeof_header;
image->dtype = VIPS_IMAGE_MMAPIN;
break;