fix a few small things

found with clang static analyzer
This commit is contained in:
John Cupitt 2017-03-25 17:55:08 +00:00
parent edf513cf27
commit cf938280d0
7 changed files with 24 additions and 8 deletions

View File

@ -112,7 +112,7 @@ Clang build:
Clang static analysis: Clang static analysis:
$ scan-build ./configure --disable-introspection $ scan-build ./configure --disable-introspection --disable-debug
$ scan-build -o scan -v make $ scan-build -o scan -v make
$ scan-view scan/2013-11-22-2 $ scan-view scan/2013-11-22-2

View File

@ -102,6 +102,11 @@ vips_col_Ch2ab( float C, float h, float *a, float *b )
float out[3]; float out[3];
float *x; float *x;
/* could be anything, we don't use this value, but we must supply one
* or static analyzers will complain.
*/
in[0] = 50.0;
in[1] = C; in[1] = C;
in[2] = h; in[2] = h;
x = &in[0]; x = &in[0];

View File

@ -286,6 +286,8 @@ vips_smartcrop_build( VipsObject *object )
switch( smartcrop->interesting ) { switch( smartcrop->interesting ) {
case VIPS_INTERESTING_NONE: case VIPS_INTERESTING_NONE:
left = 0;
top = 0;
break; break;
case VIPS_INTERESTING_CENTRE: case VIPS_INTERESTING_CENTRE:

View File

@ -932,6 +932,10 @@ vips_convi_build( VipsObject *object )
return( -1 ); return( -1 );
in = t[0]; in = t[0];
/* Default to the C path.
*/
generate = vips_convi_gen;
/* For uchar input, try to make a vector path. /* For uchar input, try to make a vector path.
*/ */
if( vips_vector_isenabled() && if( vips_vector_isenabled() &&
@ -946,9 +950,11 @@ vips_convi_build( VipsObject *object )
vips_convi_compile_free( convi ); vips_convi_compile_free( convi );
} }
/* If there's no vector path, fall back to C. /* Make the data for the C path.
*/ */
if( !convi->n_pass ) { if( generate == vips_convi_gen ) {
g_info( "using C path" );
/* Make an int version of our mask. /* Make an int version of our mask.
*/ */
if( vips__image_intize( M, &t[1] ) ) if( vips__image_intize( M, &t[1] ) )
@ -977,9 +983,6 @@ vips_convi_build( VipsObject *object )
convi->coeff_pos[0] = 0; convi->coeff_pos[0] = 0;
convi->nnz = 1; convi->nnz = 1;
} }
generate = vips_convi_gen;
g_info( "using C path" );
} }
g_object_set( convi, "out", vips_image_new(), NULL ); g_object_set( convi, "out", vips_image_new(), NULL );

View File

@ -76,7 +76,7 @@ vips_convsep_build( VipsObject *object )
in = convolution->in; in = convolution->in;
if( convsep->precision == VIPS_PRECISION_APPROXIMATE ) { if( convsep->precision == VIPS_PRECISION_APPROXIMATE ) {
if( vips_convasep( convolution->in, &t[0], convolution->M, if( vips_convasep( in, &t[0], convolution->M,
"layers", convsep->layers, "layers", convsep->layers,
NULL ) ) NULL ) )
return( -1 ); return( -1 );
@ -90,7 +90,7 @@ vips_convsep_build( VipsObject *object )
*/ */
vips_image_set_double( t[0], "offset", 0 ); vips_image_set_double( t[0], "offset", 0 );
if( vips_conv( convolution->in, &t[1], convolution->M, if( vips_conv( in, &t[1], convolution->M,
"precision", convsep->precision, "precision", convsep->precision,
"layers", convsep->layers, "layers", convsep->layers,
"cluster", convsep->cluster, "cluster", convsep->cluster,

View File

@ -1462,6 +1462,11 @@ rtiff_fill_region( VipsRegion *out, void *seq, void *a, void *b, gboolean *stop
while( y < r->height ) { while( y < r->height ) {
VipsRect tile, page, hit; VipsRect tile, page, hit;
/* Not necessary, but it stops static analyzers complaining
* about a used-before-set.
*/
tile.height = 0;
x = 0; x = 0;
while( x < r->width ) { while( x < r->width ) {
int page_no = rtiff->page + (r->top + y) / int page_no = rtiff->page + (r->top + y) /

View File

@ -507,6 +507,7 @@ vips_buffer_new( VipsImage *im, VipsRect *area )
g_assert( buffer->cache ); g_assert( buffer->cache );
buffer->ref_count = 1; buffer->ref_count = 1;
buffer->done = FALSE;
buffer->cache = NULL; buffer->cache = NULL;
} }
else { else {