small cppcheck-suggested polishes

This commit is contained in:
John Cupitt 2013-05-07 17:22:29 +01:00
parent 7eb3513d46
commit a2d06e640e
4 changed files with 17 additions and 14 deletions

View File

@ -189,7 +189,6 @@ vips_max_build( VipsObject *object )
VipsStatistic *statistic = VIPS_STATISTIC( object );
VipsMax *max = (VipsMax *) object;
VipsValues *values = &max->values;
int i;
vips_values_init( values, max );
@ -198,9 +197,12 @@ vips_max_build( VipsObject *object )
/* For speed we accumulate max ** 2 for complex.
*/
if( vips_bandfmt_iscomplex( vips_image_get_format( statistic->in ) ) )
if( vips_bandfmt_iscomplex( vips_image_get_format( statistic->in ) ) ) {
int i;
for( i = 0; i < values->n; i++ )
values->value[i] = sqrt( values->value[i] );
}
/* Don't set if there's no value (eg. if every pixel is NaN). This
* will trigger an error later.
@ -232,12 +234,15 @@ vips_max_build( VipsObject *object )
}
#ifdef DEBUG
{ int i;
printf( "vips_max_build: %d values found\n", values->n );
for( i = 0; i < values->n; i++ )
printf( "%d) %g\t%d\t%d\n",
i,
values->value[i],
values->x_pos[i], values->y_pos[i] );
}
#endif /*DEBUG*/
return( 0 );

View File

@ -191,7 +191,6 @@ vips_min_build( VipsObject *object )
VipsStatistic *statistic = VIPS_STATISTIC( object );
VipsMin *min = (VipsMin *) object;
VipsValues *values = &min->values;
int i;
vips_values_init( values, min );
@ -200,9 +199,12 @@ vips_min_build( VipsObject *object )
/* For speed we accumulate min ** 2 for complex.
*/
if( vips_bandfmt_iscomplex( vips_image_get_format( statistic->in ) ) )
if( vips_bandfmt_iscomplex( vips_image_get_format( statistic->in ) ) ) {
int i;
for( i = 0; i < values->n; i++ )
values->value[i] = sqrt( values->value[i] );
}
/* Don't set if there's no value (eg. if every pixel is NaN). This
* will trigger an error later.
@ -234,12 +236,16 @@ vips_min_build( VipsObject *object )
}
#ifdef DEBUG
{
int i;
printf( "vips_min_build: %d values found\n", values->n );
for( i = 0; i < values->n; i++ )
printf( "%d) %g\t%d\t%d\n",
i,
values->value[i],
values->x_pos[i], values->y_pos[i] );
}
#endif /*DEBUG*/
return( 0 );

View File

@ -1889,9 +1889,7 @@ vips_object_set_valist( VipsObject *object, va_list ap )
VIPS_DEBUG_MSG( "vips_object_set_valist:\n" );
name = va_arg( ap, char * );
while( name ) {
for( name = va_arg( ap, char * ); name; name = va_arg( ap, char * ) ) {
GParamSpec *pspec;
VipsArgumentClass *argument_class;
VipsArgumentInstance *argument_instance;
@ -1910,8 +1908,6 @@ vips_object_set_valist( VipsObject *object, va_list ap )
VIPS_ARGUMENT_COLLECT_GET( pspec, argument_class, ap );
VIPS_ARGUMENT_COLLECT_END
name = va_arg( ap, char * );
}
return( 0 );

View File

@ -444,9 +444,7 @@ vips_operation_get_valist_optional( VipsOperation *operation, va_list ap )
VIPS_DEBUG_MSG( "vips_operation_get_valist_optional:\n" );
name = va_arg( ap, char * );
while( name ) {
for( name = va_arg( ap, char * ); name; name = va_arg( ap, char * ) ) {
GParamSpec *pspec;
VipsArgumentClass *argument_class;
VipsArgumentInstance *argument_instance;
@ -493,8 +491,6 @@ vips_operation_get_valist_optional( VipsOperation *operation, va_list ap )
}
VIPS_ARGUMENT_COLLECT_END
name = va_arg( ap, char * );
}
return( 0 );