better handling of jpeg warnings

This commit is contained in:
John Cupitt 2012-08-23 21:44:14 +01:00
parent b183d32b15
commit 8653b23810
5 changed files with 33 additions and 12 deletions

View File

@ -398,6 +398,8 @@ vips_tile_destroy( VipsTile *tile )
static void
vips_block_cache_init( VipsBlockCache *cache )
{
printf( "vips_block_cache_init\n" );
cache->tile_width = 128;
cache->tile_height = 128;
cache->max_tiles = 1000;
@ -652,10 +654,6 @@ vips_line_cache_build( VipsObject *object )
block_cache->tile_width = block_cache->in->Xsize;
block_cache->tile_height = 1;
/* This adjust with request size, see vips_line_cache_gen().
*/
block_cache->max_tiles = 100;
if( vips_image_pio_input( block_cache->in ) )
return( -1 );
@ -692,6 +690,13 @@ vips_line_cache_class_init( VipsLineCacheClass *class )
static void
vips_line_cache_init( VipsLineCache *cache )
{
printf( "vips_line_cache_init\n" );
/* This adjust with request size, see vips_line_cache_gen().
*/
((VipsBlockCache *) cache)->max_tiles = 500;
((VipsBlockCache *) cache)->strategy = VIPS_CACHE_SEQUENTIAL;
}
/**

View File

@ -167,7 +167,7 @@ readjpeg_free( ReadJpeg *jpeg )
vips_warn( "VipsJpeg",
_( "read gave %ld warnings" ),
jpeg->eman.pub.num_warnings );
vips_warn( "VipsJpeg", "%s", vips_error_buffer() );
vips_warn( NULL, "%s", vips_error_buffer() );
}
/* Make the message only appear once.

View File

@ -202,6 +202,7 @@ write_new( VipsImage *in )
write->cinfo.err = jpeg_std_error( &write->eman.pub );
write->eman.pub.error_exit = vips__new_error_exit;
write->eman.pub.output_message = vips__new_output_message;
write->eman.pub.output_message = vips__new_output_message;
write->eman.fp = NULL;
write->profile_bytes = NULL;
write->profile_length = 0;

View File

@ -311,7 +311,8 @@ vips_vdiag( const char *domain, const char *fmt, va_list ap )
if( !g_getenv( IM_DIAGNOSTICS ) ) {
g_mutex_lock( vips__global_lock );
(void) fprintf( stderr, _( "%s: " ), _( "vips diagnostic" ) );
(void) fprintf( stderr, _( "%s: " ), domain );
if( domain )
(void) fprintf( stderr, _( "%s: " ), domain );
(void) vfprintf( stderr, fmt, ap );
(void) fprintf( stderr, "\n" );
g_mutex_unlock( vips__global_lock );
@ -361,7 +362,8 @@ vips_vwarn( const char *domain, const char *fmt, va_list ap )
if( !g_getenv( IM_WARNING ) ) {
g_mutex_lock( vips__global_lock );
(void) fprintf( stderr, _( "%s: " ), _( "vips warning" ) );
(void) fprintf( stderr, _( "%s: " ), domain );
if( domain )
(void) fprintf( stderr, _( "%s: " ), domain );
(void) vfprintf( stderr, fmt, ap );
(void) fprintf( stderr, "\n" );
g_mutex_unlock( vips__global_lock );

View File

@ -1073,7 +1073,8 @@ main( int argc, char **argv )
* since we don't want to use the vips7 compat wrappers in vips8
* unless we have to. They don't support all args types.
*/
if( action && !handled &&
if( action &&
!handled &&
(fn = im_find_function( action )) ) {
(void) add_main_group( context, NULL );
parse_options( context, &argc, argv );
@ -1087,11 +1088,17 @@ main( int argc, char **argv )
handled = TRUE;
}
im_error_clear();
/* im_find_function() set an error msg.
*/
if( action &&
!handled )
im_error_clear();
/* Could be a vips8 VipsOperation.
*/
if( action && !handled &&
if( action &&
!handled &&
(operation = vips_operation_new( action )) ) {
main_group = add_main_group( context, operation );
vips_call_options( main_group, operation );
@ -1113,9 +1120,15 @@ main( int argc, char **argv )
handled = TRUE;
}
im_error_clear();
if( action && !handled ) {
/* vips_operation_new() set an error msg for unknown operation.
*/
if( action &&
!handled )
im_error_clear();
if( action &&
!handled ) {
printf( "%s", _( "possible actions:\n" ) );
for( i = 0; i < VIPS_NUMBER( actions ); i++ )
printf( "%10s - %s\n",