more small coverity tweaks

This commit is contained in:
John Cupitt 2015-09-30 11:11:11 +01:00
parent 2a82286dad
commit 67a45a3749
4 changed files with 12 additions and 10 deletions

View File

@ -122,11 +122,8 @@ vips_linear_build( VipsObject *object )
VipsUnary *unary = (VipsUnary *) object;
VipsLinear *linear = (VipsLinear *) object;
int bands;
int i;
vips_image_decode_predict( unary->in, &bands, NULL );
/* If we have a three-element vector we need to bandup the image to
* match.
*/
@ -135,8 +132,12 @@ vips_linear_build( VipsObject *object )
linear->n = VIPS_MAX( linear->n, linear->a->n );
if( linear->b )
linear->n = VIPS_MAX( linear->n, linear->b->n );
if( unary->in )
if( unary->in ) {
int bands;
vips_image_decode_predict( unary->in, &bands, NULL );
linear->n = VIPS_MAX( linear->n, bands );
}
arithmetic->base_bands = linear->n;
if( unary->in &&

View File

@ -104,7 +104,8 @@ vips_measure_build( VipsObject *object )
if( VIPS_OBJECT_CLASS( vips_measure_parent_class )->build( object ) )
return( -1 );
vips_image_decode( measure->in, &ready );
if( vips_image_decode( measure->in, &ready ) )
return( -1 );
vips_object_local( measure, ready );
bands = vips_image_get_bands( ready );

View File

@ -113,7 +113,7 @@ vips_stats_build( VipsObject *object )
double *row0, *row;
int b, y, i;
if( statistic->in ) {
if( vips_object_argument_isset( object, "in" ) )
int bands = vips_image_get_bands( statistic->in );
if( vips_check_noncomplex( class->nickname, statistic->in ) )

View File

@ -151,7 +151,7 @@ vips_col_Lcmc2L( float Lcmc )
int known;
known = floor( Lcmc * 10.0 );
known = VIPS_CLIP( 0, known, 1000 );
known = VIPS_CLIP( 0, known, 999 );
return( LI[known] +
(LI[known + 1] - LI[known]) * (Lcmc * 10.0 - known) );
@ -173,7 +173,7 @@ vips_col_Ccmc2C( float Ccmc )
int known;
known = floor( Ccmc * 10.0 );
known = VIPS_CLIP( 0, known, 3000 );
known = VIPS_CLIP( 0, known, 2999 );
return( CI[known] +
(CI[known + 1] - CI[known]) * (Ccmc * 10.0 - known) );
@ -199,10 +199,10 @@ vips_col_Chcmc2h( float C, float hcmc )
/* Which row of the table?
*/
r = (int) ((C + 1.0) / 2.0);
r = VIPS_CLIP( 0, r, 100 );
r = VIPS_CLIP( 0, r, 99 );
known = floor( hcmc );
known = VIPS_CLIP( 0, known, 360 );
known = VIPS_CLIP( 0, known, 359 );
return( hI[r][known] +
(hI[r][(known + 1) % 360] - hI[r][known]) * (hcmc - known) );