diff --git a/libvips/conversion/sequential.c b/libvips/conversion/sequential.c index c90b4cdc..1823ba48 100644 --- a/libvips/conversion/sequential.c +++ b/libvips/conversion/sequential.c @@ -195,7 +195,7 @@ vips_sequential_build( VipsObject *object ) if( vips_linecache( sequential->in, &t, "tile_height", sequential->tile_height, "access", VIPS_ACCESS_SEQUENTIAL, - /* We need seq caches to persist across minimise, in case + /* We need seq caches to persist across minimise in case * someone is trying to read an image with a series of crop * operations. */ diff --git a/libvips/foreign/tiff2vips.c b/libvips/foreign/tiff2vips.c index 933325e4..1023a132 100644 --- a/libvips/foreign/tiff2vips.c +++ b/libvips/foreign/tiff2vips.c @@ -2041,15 +2041,6 @@ rtiff_stripwise_generate( VipsRegion *or, rtiff->y_pos += hit.height; } - /* Shut down the input file as soon as we can. - */ - if( rtiff->y_pos >= or->im->Ysize ) { -#ifdef DEBUG - printf( "rtiff_stripwise_generate: early shutdown\n" ); -#endif /*DEBUG*/ - rtiff_free( rtiff ); - } - VIPS_GATE_STOP( "rtiff_stripwise_generate: work" ); return( 0 ); diff --git a/libvips/foreign/vips2tiff.c b/libvips/foreign/vips2tiff.c index e548f143..8fcda841 100644 --- a/libvips/foreign/vips2tiff.c +++ b/libvips/foreign/vips2tiff.c @@ -1235,23 +1235,24 @@ invert_band0( Wtiff *wtiff, VipsPel *q, VipsPel *p, int n ) static void LabS2Lab16( VipsPel *q, VipsPel *p, int n, int samples_per_pixel ) { - int x; short *p1 = (short *) p; unsigned short *q1 = (unsigned short *) q; + int x; + for( x = 0; x < n; x++ ) { int i; - /* TIFF uses unsigned 16 bit ... move zero, scale up L. + /* LABS L can be negative. */ - q1[0] = VIPS_LSHIFT_INT( (int) p1[0], 1 ); + q1[0] = VIPS_LSHIFT_INT( VIPS_MAX( 0, p1[0] ), 1 ); for( i = 1; i < samples_per_pixel; i++ ) q1[i] = p1[i]; q1 += samples_per_pixel; p1 += samples_per_pixel; - } + } } /* Pack the pixels in @area from @in into a TIFF tile buffer.