fix more cppcheck warnings

cppcheck now passes, with a few false positives

see https://github.com/jcupitt/libvips/issues/331
This commit is contained in:
John Cupitt 2015-09-29 09:23:01 +01:00
parent 01025328da
commit e62df8c573
3 changed files with 30 additions and 15 deletions

6
TODO
View File

@ -1,3 +1,9 @@
- try vips_shrink() in two passes: first, sum horizontal strips, second sum
vertical
we would then only need to demand the source a line at a time, and the
intermediate image would be much smaller ... possible cache savings as well
- add bandjoinconst ... append a band (or bands?) from a constant
see https://github.com/jcupitt/libvips/issues/325

View File

@ -21,6 +21,8 @@
* - redo as a class
* 21/11/11
* - add vips_complexget()
* 29/9/15
* - return 0 for cross-product where one arg is zero
*/
/*
@ -411,16 +413,28 @@ G_DEFINE_TYPE( VipsComplex2, vips_complex2, VIPS_TYPE_BINARY );
#ifdef USE_MODARG_DIV
#define CROSS( Q, X1, Y1, X2, Y2 ) { \
double arg = atan2( X2, X1 ) - atan2( Y2, Y1 ); \
\
Q[0] = cos( arg ); \
Q[1] = sin( arg ); \
if( ((X1) == 0.0 && (Y1) == 0.0) || \
((X2) == 0.0 && (Y2) == 0.0) ) { \
Q[0] = 0.0; \
Q[1] = 0.0; \
} \
else { \
double arg = atan2( X2, X1 ) - atan2( Y2, Y1 ); \
\
Q[0] = cos( arg ); \
Q[1] = sin( arg ); \
} \
}
#else /* USE_MODARG_DIV */
#define CROSS( Q, X1, Y1, X2, Y2 ) { \
if( ABS( Y1 ) > ABS( Y2 ) ) { \
if( ((X1) == 0.0 && (Y1) == 0.0) || \
((X2) == 0.0 && (Y2) == 0.0) ) { \
Q[0] = 0.0; \
Q[1] = 0.0; \
} \
else if( ABS( Y1 ) > ABS( Y2 ) ) { \
double a = Y2 / Y1; \
double b = Y1 + Y2 * a; \
double re = (X1 + X2 * a) / b; \
@ -455,7 +469,9 @@ vips_complex2_buffer( VipsArithmetic *arithmetic,
int x;
switch( cmplx->cmplx ) {
case VIPS_OPERATION_COMPLEX2_CROSS_PHASE: SWITCH2( CROSS ); break;
case VIPS_OPERATION_COMPLEX2_CROSS_PHASE:
SWITCH2( CROSS );
break;
default:
g_assert( 0 );

View File

@ -759,9 +759,8 @@ vips_object_get_argument( VipsObject *object, const char *name,
_( "no vips argument named `%s'" ), name );
return( -1 );
}
if( argument_class &&
!(*argument_instance = vips__argument_get_instance(
*argument_class, object )) ) {
if( !(*argument_instance = vips__argument_get_instance(
*argument_class, object )) ) {
vips_error( class->nickname,
_( "argument `%s' has no instance" ), name );
return( -1 );
@ -1313,12 +1312,6 @@ vips_object_get_property( GObject *gobject,
VipsArgumentInstance *argument_instance =
vips__argument_get_instance( argument_class, object );
if( !argument_class ) {
G_OBJECT_WARN_INVALID_PROPERTY_ID( gobject,
property_id, pspec );
return;
}
g_assert( ((VipsArgument *) argument_class)->pspec == pspec );
if( !argument_instance->assigned ) {