diff --git a/ChangeLog b/ChangeLog index ab5930cb..2cdfb374 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,8 @@ - gifload supports n/page-height - added #defines for VIPS_SONAME, VIPS_LIBRARY_CURRENT, VIPS_LIBRARY_REVISION, VIPS_LIBRARY_AGE +- deprecate vips_warn(), use g_warning() instead +- deprecate vips_info(), use g_info() instead 8/12/16 started 8.4.5 - allow libgsf-1.14.26 to help centos, thanks tdiprima diff --git a/TODO b/TODO index 715f4c8f..285d5ee1 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,23 @@ +- need some simple way to turn on info output from CLI or env var + +- switch to glib logging + + vips_error() stuff must stay + + vips_info() and vips_warn() can change + + - switch to g_warning() and g_info(), have some compat stuff + + just calls + + g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format, args); + + also see + + vips_info_set(), --vips-info, VIPS_INFO + + + - not sure about utf8 error messages on win - strange: diff --git a/cplusplus/VImage.cpp b/cplusplus/VImage.cpp index d9b55133..a1905441 100644 --- a/cplusplus/VImage.cpp +++ b/cplusplus/VImage.cpp @@ -350,7 +350,7 @@ set_property( VipsObject *object, const char *name, const GValue *value ) if( vips_object_get_argument( object, name, &pspec, &argument_class, &argument_instance ) ) { - vips_warn( NULL, "%s", vips_error_buffer() ); + g_warning( "%s", vips_error_buffer() ); vips_error_clear(); return; } @@ -364,7 +364,7 @@ set_property( VipsObject *object, const char *name, const GValue *value ) if( (enum_value = vips_enum_from_nick( object_class->nickname, pspec_type, g_value_get_string( value ) )) < 0 ) { - vips_warn( NULL, "%s", vips_error_buffer() ); + g_warning( "%s", vips_error_buffer() ); vips_error_clear(); return; } diff --git a/libvips/arithmetic/measure.c b/libvips/arithmetic/measure.c index 9e7c881e..5bbfcfb5 100644 --- a/libvips/arithmetic/measure.c +++ b/libvips/arithmetic/measure.c @@ -165,9 +165,11 @@ vips_measure_build( VipsObject *object ) */ if( dev * 5 > VIPS_FABS( avg ) && VIPS_FABS( avg ) > 3 ) - vips_warn( class->nickname, - _( "patch %d x %d, band %d: " - "avg = %g, sdev = %g" ), + g_warning( _( "%s: " + "patch %d x %d, " + "band %d: " + "avg = %g, sdev = %g" ), + class->nickname, i, j, b, avg, dev ); *VIPS_MATRIX( measure->out, diff --git a/libvips/colour/icc_transform.c b/libvips/colour/icc_transform.c index 43c4c891..f41c12c9 100644 --- a/libvips/colour/icc_transform.c +++ b/libvips/colour/icc_transform.c @@ -193,9 +193,9 @@ static int icc_error( int code, const char *text ) { if( code == LCMS_ERRC_WARNING ) - vips_warn( "VipsIcc", "%s", text ); + g_warning( "%s", text ); else - vips_error( "VipsIcc", "%s", text ); + vips_error( "VipsIcc", text ); return( 0 ); } @@ -452,9 +452,9 @@ vips_check_intent( const char *domain, { if( profile && !cmsIsIntentSupported( profile, intent, direction ) ) - vips_warn( domain, - _( "intent %d (%s) not supported by " + g_warning( _( "%s: intent %d (%s) not supported by " "%s profile; falling back to default intent" ), + domain, intent, vips_enum_nick( VIPS_TYPE_INTENT, intent ), direction == LCMS_USED_AS_INPUT ? _( "input" ) : _( "output" ) ); @@ -542,7 +542,7 @@ vips_image_expected_bands( VipsImage *image ) } static cmsHPROFILE -vips_icc_load_profile_image( const char *domain, VipsImage *image ) +vips_icc_load_profile_image( VipsImage *image ) { void *data; size_t data_length; @@ -554,15 +554,15 @@ vips_icc_load_profile_image( const char *domain, VipsImage *image ) if( vips_image_get_blob( image, VIPS_META_ICC_NAME, &data, &data_length ) || !(profile = cmsOpenProfileFromMem( data, data_length )) ) { - vips_warn( domain, "%s", _( "corrupt embedded profile" ) ); + g_warning( "%s", _( "corrupt embedded profile" ) ); return( NULL ); } if( vips_image_expected_bands( image ) != vips_icc_profile_needs_bands( profile ) ) { VIPS_FREEF( cmsCloseProfile, profile ); - vips_warn( domain, - "%s", _( "embedded profile incompatible with image" ) ); + g_warning( "%s", + _( "embedded profile incompatible with image" ) ); return( NULL ); } @@ -584,8 +584,7 @@ vips_icc_load_profile_file( const char *domain, if( vips_image_expected_bands( image ) != vips_icc_profile_needs_bands( profile ) ) { VIPS_FREEF( cmsCloseProfile, profile ); - vips_warn( domain, - _( "profile \"%s\" incompatible with image" ), + g_warning( _( "profile \"%s\" incompatible with image" ), filename ); return( NULL ); } @@ -615,8 +614,7 @@ vips_icc_import_build( VipsObject *object ) if( code->in && (import->embedded || !import->input_profile_filename) ) - icc->in_profile = vips_icc_load_profile_image( class->nickname, - code->in ); + icc->in_profile = vips_icc_load_profile_image( code->in ); if( !icc->in_profile && code->in && @@ -1027,8 +1025,7 @@ vips_icc_transform_build( VipsObject *object ) if( code->in && (transform->embedded || !transform->input_profile_filename) ) - icc->in_profile = vips_icc_load_profile_image( class->nickname, - code->in ); + icc->in_profile = vips_icc_load_profile_image( code->in ); if( !icc->in_profile && code->in && diff --git a/libvips/conversion/cast.c b/libvips/conversion/cast.c index 3e4bb0fb..6e658ee5 100644 --- a/libvips/conversion/cast.c +++ b/libvips/conversion/cast.c @@ -126,11 +126,9 @@ vips_cast_preeval( VipsImage *image, VipsProgress *progress, VipsCast *cast ) static void vips_cast_posteval( VipsImage *image, VipsProgress *progress, VipsCast *cast ) { - VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( cast ); - - if( cast->overflow || cast->underflow ) - vips_warn( class->nickname, - _( "%d underflows and %d overflows detected" ), + if( cast->overflow || + cast->underflow ) + g_warning( _( "%d underflows and %d overflows detected" ), cast->underflow, cast->overflow ); } diff --git a/libvips/conversion/copy.c b/libvips/conversion/copy.c index ff3ee88e..168a0281 100644 --- a/libvips/conversion/copy.c +++ b/libvips/conversion/copy.c @@ -177,7 +177,7 @@ vips_copy_build( VipsObject *object ) return( -1 ); if( copy->swap ) - vips_warn( class->nickname, "%s", + g_warning( "%s", _( "copy swap is deprecated, use byteswap instead" ) ); if( vips_image_pipelinev( conversion->out, diff --git a/libvips/conversion/sequential.c b/libvips/conversion/sequential.c index 62b19c35..0942c2a1 100644 --- a/libvips/conversion/sequential.c +++ b/libvips/conversion/sequential.c @@ -124,7 +124,6 @@ vips_sequential_generate( VipsRegion *or, void *seq, void *a, void *b, gboolean *stop ) { VipsSequential *sequential = (VipsSequential *) b; - VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( sequential ); VipsRect *r = &or->valid; VipsRegion *ir = (VipsRegion *) seq; @@ -132,8 +131,7 @@ vips_sequential_generate( VipsRegion *or, g_thread_self(), r->top, r->height ); if( sequential->trace ) - vips_info( class->nickname, - "request for line %d, height %d", + g_info( "request for line %d, height %d", r->top, r->height ); VIPS_GATE_START( "vips_sequential_generate: wait" ); diff --git a/libvips/conversion/tilecache.c b/libvips/conversion/tilecache.c index d7299d0e..789e73a6 100644 --- a/libvips/conversion/tilecache.c +++ b/libvips/conversion/tilecache.c @@ -605,7 +605,6 @@ vips_tile_cache_gen( VipsRegion *or, { VipsRegion *in = (VipsRegion *) seq; VipsBlockCache *cache = (VipsBlockCache *) b; - VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( cache ); VipsRect *r = &or->valid; VipsTile *tile; @@ -702,8 +701,7 @@ vips_tile_cache_gen( VipsRegion *or, "vips_tile_cache_gen: " "error on tile %p\n", tile ); - vips_warn( class->nickname, - _( "error in tile %d x %d" ), + g_warning( _( "error in tile %d x %d" ), tile->pos.left, tile->pos.top ); vips_region_black( tile->region ); diff --git a/libvips/convolution/convi.c b/libvips/convolution/convi.c index d11e3606..b7c6845c 100644 --- a/libvips/convolution/convi.c +++ b/libvips/convolution/convi.c @@ -860,7 +860,7 @@ intize_to_fixed_point( VipsImage *in, int *out ) for( i = 0; i < ne; i++ ) if( scaled[i] >= 4.0 || scaled[i] < -4 ) { - vips_info( "intize_to_fixed_point", + g_info( "intize_to_fixed_point: " "out of range for vector path" ); return( -1 ); } @@ -880,7 +880,7 @@ intize_to_fixed_point( VipsImage *in, int *out ) /* 0.1 is a 10% error. */ if( total_error > 0.1 ) { - vips_info( "intize_to_fixed_point", "too many underflows" ); + g_info( "intize_to_fixed_point: too many underflows" ); return( -1 ); } @@ -906,7 +906,6 @@ intize_to_fixed_point( VipsImage *in, int *out ) static int vips_convi_build( VipsObject *object ) { - VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsConvolution *convolution = (VipsConvolution *) object; VipsConvi *convi = (VipsConvi *) object; VipsImage **t = (VipsImage **) vips_object_local_array( object, 4 ); @@ -941,7 +940,7 @@ vips_convi_build( VipsObject *object ) !intize_to_fixed_point( M, convi->fixed ) && !vips_convi_compile( convi, in ) ) { generate = vips_convi_gen_vector; - vips_info( class->nickname, "using vector path" ); + g_info( "using vector path" ); } else vips_convi_compile_free( convi ); @@ -980,7 +979,7 @@ vips_convi_build( VipsObject *object ) } generate = vips_convi_gen; - vips_info( class->nickname, "using C path" ); + g_info( "using C path" ); } g_object_set( convi, "out", vips_image_new(), NULL ); diff --git a/libvips/convolution/gaussblur.c b/libvips/convolution/gaussblur.c index 41800097..d5bfc29a 100644 --- a/libvips/convolution/gaussblur.c +++ b/libvips/convolution/gaussblur.c @@ -67,7 +67,6 @@ G_DEFINE_TYPE( VipsGaussblur, vips_gaussblur, VIPS_TYPE_OPERATION ); static int vips_gaussblur_build( VipsObject *object ) { - VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsGaussblur *gaussblur = (VipsGaussblur *) object; VipsImage **t = (VipsImage **) vips_object_local_array( object, 2 ); @@ -85,7 +84,7 @@ vips_gaussblur_build( VipsObject *object ) vips_matrixprint( t[0], NULL ); #endif /*DEBUG*/ - vips_info( class->nickname, "gaussblur mask width %d", t[0]->Xsize ); + g_info( "gaussblur mask width %d", t[0]->Xsize ); if( vips_convsep( gaussblur->in, &t[1], t[0], "precision", gaussblur->precision, diff --git a/libvips/deprecated/rename.c b/libvips/deprecated/rename.c index 7285ffa9..9244cc33 100644 --- a/libvips/deprecated/rename.c +++ b/libvips/deprecated/rename.c @@ -724,3 +724,67 @@ vips_check_bands_3ormore( const char *domain, VipsImage *im ) { return( vips_check_bands_atleast( domain, im, 3 ) ); } + +/* The old vips_info() stuff, now replaced by g_warning() / g_info(). + */ + +int vips__info = 0; + +void +vips_info_set( gboolean info ) +{ + vips__info = info; +} + +void +vips_vinfo( const char *domain, const char *fmt, va_list ap ) +{ + if( vips__info ) { + g_mutex_lock( vips__global_lock ); + (void) fprintf( stderr, _( "%s: " ), _( "info" ) ); + if( domain ) + (void) fprintf( stderr, _( "%s: " ), domain ); + (void) vfprintf( stderr, fmt, ap ); + (void) fprintf( stderr, "\n" ); + g_mutex_unlock( vips__global_lock ); + } +} + +void +vips_info( const char *domain, const char *fmt, ... ) +{ + va_list ap; + + va_start( ap, fmt ); + vips_vinfo( domain, fmt, ap ); + va_end( ap ); +} + +void +vips_vwarn( const char *domain, const char *fmt, va_list ap ) +{ + if( !g_getenv( "IM_WARNING" ) && + !g_getenv( "VIPS_WARNING" ) ) { + g_mutex_lock( vips__global_lock ); + (void) fprintf( stderr, _( "%s: " ), _( "vips warning" ) ); + if( domain ) + (void) fprintf( stderr, _( "%s: " ), domain ); + (void) vfprintf( stderr, fmt, ap ); + (void) fprintf( stderr, "\n" ); + g_mutex_unlock( vips__global_lock ); + } + + if( vips__fatal ) + vips_error_exit( "vips__fatal" ); +} + +void +vips_warn( const char *domain, const char *fmt, ... ) +{ + va_list ap; + + va_start( ap, fmt ); + vips_vwarn( domain, fmt, ap ); + va_end( ap ); +} + diff --git a/libvips/foreign/csv.c b/libvips/foreign/csv.c index 95f71f18..70aae08c 100644 --- a/libvips/foreign/csv.c +++ b/libvips/foreign/csv.c @@ -195,8 +195,7 @@ read_double( FILE *fp, const char whitemap[256], const char sepmap[256], /* Only a warning, since (for example) exported spreadsheets * will often have text or date fields. */ - vips_warn( "csv2vips", - _( "error parsing number, line %d, column %d" ), + g_warning( _( "error parsing number, line %d, column %d" ), lineno, colno ); if( fail ) return( EOF ); diff --git a/libvips/foreign/dzsave.c b/libvips/foreign/dzsave.c index f9897e8e..d35e55cb 100644 --- a/libvips/foreign/dzsave.c +++ b/libvips/foreign/dzsave.c @@ -1997,8 +1997,7 @@ vips_foreign_save_dz_build( VipsObject *object ) #ifndef HAVE_GSF_DEFLATE_LEVEL if( dz->compression > 0 ) { - vips_warn( class->nickname, "%s", - _( "deflate-level not supported by libgsf, " + g_warning( _( "deflate-level not supported by libgsf, " "using default compression" ) ); dz->compression = -1; } diff --git a/libvips/foreign/foreign.c b/libvips/foreign/foreign.c index ea7d03e3..65322c72 100644 --- a/libvips/foreign/foreign.c +++ b/libvips/foreign/foreign.c @@ -846,9 +846,9 @@ vips_foreign_load_build( VipsObject *object ) if( (flags & VIPS_FOREIGN_PARTIAL) && (flags & VIPS_FOREIGN_SEQUENTIAL) ) { - vips_warn( class->nickname, "%s", + g_warning( "%s", _( "VIPS_FOREIGN_PARTIAL and VIPS_FOREIGN_SEQUENTIAL " - "both set -- using SEQUENTIAL" ) ); + "both set -- using SEQUENTIAL" ) ); flags ^= VIPS_FOREIGN_PARTIAL; } @@ -865,12 +865,10 @@ vips_foreign_load_build( VipsObject *object ) build( object ) ) return( -1 ); - if( load->sequential ) { - vips_warn( class->nickname, "%s", - _( "ignoring deprecated \"sequential\" mode" ) ); - vips_warn( class->nickname, "%s", - _( "please use \"access\" instead" ) ); - } + if( load->sequential ) + g_warning( "%s", + _( "ignoring deprecated \"sequential\" mode -- " + "please use \"access\" instead" ) ); g_object_set( object, "out", vips_image_new(), NULL ); diff --git a/libvips/foreign/gifload.c b/libvips/foreign/gifload.c index 789598f1..5b347ac6 100644 --- a/libvips/foreign/gifload.c +++ b/libvips/foreign/gifload.c @@ -359,7 +359,6 @@ static void vips_foreign_load_gif_render_line( VipsForeignLoadGif *gif, int width, VipsPel * restrict q, VipsPel * restrict p ) { - VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( gif ); ColorMapObject *map = gif->file->Image.ColorMap ? gif->file->Image.ColorMap : gif->file->SColorMap; @@ -369,8 +368,7 @@ vips_foreign_load_gif_render_line( VipsForeignLoadGif *gif, VipsPel v = p[x]; if( v >= map->ColorCount ) { - vips_warn( class->nickname, - "%s", _( "pixel value out of range" ) ); + g_warning( "%s", _( "pixel value out of range" ) ); continue; } diff --git a/libvips/foreign/jpeg2vips.c b/libvips/foreign/jpeg2vips.c index 676ccd7e..dce2ed28 100644 --- a/libvips/foreign/jpeg2vips.c +++ b/libvips/foreign/jpeg2vips.c @@ -192,10 +192,9 @@ readjpeg_free( ReadJpeg *jpeg ) result = 0; if( jpeg->eman.pub.num_warnings != 0 ) { - vips_warn( "VipsJpeg", - _( "read gave %ld warnings" ), + g_warning( _( "read gave %ld warnings" ), jpeg->eman.pub.num_warnings ); - vips_warn( NULL, "%s", vips_error_buffer() ); + g_warning( "%s", vips_error_buffer() ); /* Make the message only appear once. */ @@ -575,8 +574,7 @@ res_from_exif( VipsImage *im, ExifData *ed ) if( get_entry_double( ed, 0, EXIF_TAG_X_RESOLUTION, &xres ) || get_entry_double( ed, 0, EXIF_TAG_Y_RESOLUTION, &yres ) || get_entry_int( ed, 0, EXIF_TAG_RESOLUTION_UNIT, &unit ) ) { - vips_warn( "VipsJpeg", - "%s", _( "error reading resolution" ) ); + g_warning( "%s", _( "error reading resolution" ) ); return( -1 ); } @@ -612,8 +610,7 @@ res_from_exif( VipsImage *im, ExifData *ed ) break; default: - vips_warn( "VipsJpeg", - "%s", _( "unknown EXIF resolution unit" ) ); + g_warning( "%s", _( "unknown EXIF resolution unit" ) ); return( -1 ); } @@ -827,8 +824,7 @@ read_jpeg_header( ReadJpeg *jpeg, VipsImage *out ) break; default: - vips_warn( "VipsJpeg", - "%s", _( "unknown JFIF resolution unit" ) ); + g_warning( "%s", _( "unknown JFIF resolution unit" ) ); break; } diff --git a/libvips/foreign/ppm.c b/libvips/foreign/ppm.c index 22315526..9a7677f5 100644 --- a/libvips/foreign/ppm.c +++ b/libvips/foreign/ppm.c @@ -799,9 +799,8 @@ vips__ppm_save( VipsImage *in, const char *filename, if( ascii && in->BandFmt == VIPS_FORMAT_FLOAT ) { - vips_warn( "vips2ppm", - "%s", _( "float images must be binary -- " - "disabling ascii" ) ); + g_warning( "%s", + _( "float images must be binary -- disabling ascii" ) ); ascii = FALSE; } @@ -810,8 +809,8 @@ vips__ppm_save( VipsImage *in, const char *filename, if( squash && (in->Bands != 1 || in->BandFmt != VIPS_FORMAT_UCHAR) ) { - vips_warn( "vips2ppm", - "%s", _( "can only squash 1 band uchar images -- " + g_warning( "%s", + _( "can only squash 1 band uchar images -- " "disabling squash" ) ); squash = FALSE; } diff --git a/libvips/foreign/tiff.c b/libvips/foreign/tiff.c index 07bf926d..dd9bdcd2 100644 --- a/libvips/foreign/tiff.c +++ b/libvips/foreign/tiff.c @@ -58,8 +58,7 @@ #include "tiff.h" /* Handle TIFF errors here. Shared with vips2tiff.c. These can be called from - * more than one thread, but vips_error and vips_warn have mutexes in, so that's - * OK. + * more than one thread. */ static void vips__thandler_error( const char *module, const char *fmt, va_list ap ) @@ -73,10 +72,7 @@ vips__thandler_error( const char *module, const char *fmt, va_list ap ) static void vips__thandler_warning( const char *module, const char *fmt, va_list ap ) { - char buf[256]; - - vips_vsnprintf( buf, 256, fmt, ap ); - vips_warn( module, "%s", buf ); + g_logv( G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, fmt, ap ); } /* Call this during startup. Other libraries may be using libtiff and we want diff --git a/libvips/foreign/tiff2vips.c b/libvips/foreign/tiff2vips.c index 0ec28d7f..5fae35ce 100644 --- a/libvips/foreign/tiff2vips.c +++ b/libvips/foreign/tiff2vips.c @@ -387,7 +387,7 @@ get_resolution( TIFF *tiff, VipsImage *out ) } } else { - vips_warn( "tiff2vips", _( "no resolution information for " + g_warning( _( "no resolution information for " "TIFF image \"%s\" -- defaulting to 1 pixel per mm" ), TIFFFileName( tiff ) ); x = 1.0; @@ -1041,7 +1041,7 @@ rtiff_parse_palette( Rtiff *rtiff, VipsImage *out ) read->blue8[i] = read->blue16[i] >> 8; } else { - vips_warn( "tiff2vips", "%s", _( "assuming 8-bit palette" ) ); + g_warning( "%s", _( "assuming 8-bit palette" ) ); for( i = 0; i < len; i++ ) { read->red8[i] = read->red16[i] & 0xff; diff --git a/libvips/foreign/vips2jpeg.c b/libvips/foreign/vips2jpeg.c index 9a6834b3..83ba17bc 100644 --- a/libvips/foreign/vips2jpeg.c +++ b/libvips/foreign/vips2jpeg.c @@ -495,8 +495,7 @@ vips__set_exif_resolution( ExifData *ed, VipsImage *im ) break; default: - vips_warn( "VipsJpeg", - "%s", _( "unknown EXIF resolution unit" ) ); + g_warning( "%s", _( "unknown EXIF resolution unit" ) ); return( 0 ); } @@ -626,7 +625,7 @@ vips_exif_image_field( VipsImage *image, /* value must be a string. */ if( vips_image_get_string( image, field, &string ) ) { - vips_warn( "VipsJpeg", _( "bad exif meta \"%s\"" ), field ); + g_warning( _( "bad exif meta \"%s\"" ), field ); return( NULL ); } @@ -636,12 +635,12 @@ vips_exif_image_field( VipsImage *image, for( ; isdigit( *p ); p++ ) ; if( *p != '-' ) { - vips_warn( "VipsJpeg", _( "bad exif meta \"%s\"" ), field ); + g_warning( _( "bad exif meta \"%s\"" ), field ); return( NULL ); } if( !(tag = exif_tag_from_name( p + 1 )) ) { - vips_warn( "VipsJpeg", _( "bad exif meta \"%s\"" ), field ); + g_warning( _( "bad exif meta \"%s\"" ), field ); return( NULL ); } @@ -764,7 +763,7 @@ write_blob( Write *write, const char *field, int app ) * For now, just ignore oversize objects and warn. */ if( data_length > 65530 ) - vips_warn( "VipsJpeg", _( "field \"%s\" is too large " + g_warning( _( "field \"%s\" is too large " "for a single JPEG marker, ignoring" ), field ); else { @@ -1082,8 +1081,7 @@ write_vips( Write *write, int qfac, const char *profile, write->cinfo.optimize_coding = TRUE; } else - vips_warn( "vips2jpeg", - "%s", _( "trellis_quant unsupported" ) ); + g_warning( "%s", _( "trellis_quant unsupported" ) ); } /* Apply overshooting to samples with extreme values e.g. 0 & 255 @@ -1095,8 +1093,8 @@ write_vips( Write *write, int qfac, const char *profile, jpeg_c_set_bool_param( &write->cinfo, JBOOLEAN_OVERSHOOT_DERINGING, TRUE ); else - vips_warn( "vips2jpeg", - "%s", _( "overshoot_deringing unsupported" ) ); + g_warning( "%s", + _( "overshoot_deringing unsupported" ) ); } /* Split the spectrum of DCT coefficients into separate scans. * Requires progressive output. Must be set before @@ -1109,12 +1107,12 @@ write_vips( Write *write, int qfac, const char *profile, jpeg_c_set_bool_param( &write->cinfo, JBOOLEAN_OPTIMIZE_SCANS, TRUE ); else - vips_warn( "vips2jpeg", - "%s", _( "Ignoring optimize_scans" ) ); + g_warning( "%s", + _( "ignoring optimize_scans" ) ); } else - vips_warn( "vips2jpeg", "%s", - _( "Ignoring optimize_scans for baseline" ) ); + g_warning( "%s", + _( "ignoring optimize_scans for baseline" ) ); } /* Use predefined quantization table. @@ -1125,22 +1123,21 @@ write_vips( Write *write, int qfac, const char *profile, jpeg_c_set_int_param( &write->cinfo, JINT_BASE_QUANT_TBL_IDX, quant_table ); else - vips_warn( "vips2jpeg", - "%s", _( "Setting quant_table unsupported" ) ); + g_warning( "%s", + _( "setting quant_table unsupported" ) ); } #else /* Using jpeglib.h without extension parameters, warn of ignored * options. */ if( trellis_quant ) - vips_warn( "vips2jpeg", "%s", _( "Ignoring trellis_quant" ) ); + g_warning( "%s", _( "ignoring trellis_quant" ) ); if( overshoot_deringing ) - vips_warn( "vips2jpeg", - "%s", _( "Ignoring overshoot_deringing" ) ); + g_warning( "%s", _( "ignoring overshoot_deringing" ) ); if( optimize_scans ) - vips_warn( "vips2jpeg", "%s", _( "Ignoring optimize_scans" ) ); + g_warning( "%s", _( "ignoring optimize_scans" ) ); if( quant_table > 0 ) - vips_warn( "vips2jpeg", "%s", _( "Ignoring quant_table" ) ); + g_warning( "%s", _( "ignoring quant_table" ) ); #endif /* Set compression quality. Must be called after setting params above. diff --git a/libvips/foreign/vips2tiff.c b/libvips/foreign/vips2tiff.c index 8cd9f744..3f3858cf 100644 --- a/libvips/foreign/vips2tiff.c +++ b/libvips/foreign/vips2tiff.c @@ -464,8 +464,7 @@ wtiff_embed_ipct( Wtiff *wtiff, TIFF *tif ) * long, not byte. */ if( data_length & 3 ) { - vips_warn( "vips2tiff", - "%s", _( "rounding up IPCT data length" ) ); + g_warning( "%s", _( "rounding up IPCT data length" ) ); data_length /= 4; data_length += 1; } @@ -958,8 +957,8 @@ wtiff_new( VipsImage *im, const char *filename, /* We can't pyramid toilet roll images. */ if( wtiff->pyramid ) { - vips_warn( "vips2tiff", - "%s", _( "can't pyramid multi page images --- " + g_warning( "%s", + _( "can't pyramid multi page images --- " "disabling pyramid" ) ); wtiff->pyramid = FALSE; } @@ -995,16 +994,16 @@ wtiff_new( VipsImage *im, const char *filename, (im->Coding != VIPS_CODING_NONE || im->BandFmt != VIPS_FORMAT_UCHAR || im->Bands != 1) ) { - vips_warn( "vips2tiff", - "%s", _( "can only squash 1 band uchar images -- " + g_warning( "%s", + _( "can only squash 1 band uchar images -- " "disabling squash" ) ); wtiff->onebit = 0; } if( wtiff->onebit && wtiff->compression == COMPRESSION_JPEG ) { - vips_warn( "vips2tiff", - "%s", _( "can't have 1-bit JPEG -- disabling JPEG" ) ); + g_warning( "%s", + _( "can't have 1-bit JPEG -- disabling JPEG" ) ); wtiff->compression = COMPRESSION_NONE; } @@ -1014,8 +1013,8 @@ wtiff_new( VipsImage *im, const char *filename, (im->Coding != VIPS_CODING_NONE || vips_band_format_iscomplex( im->BandFmt ) || im->Bands > 2) ) { - vips_warn( "vips2tiff", - "%s", _( "can only save non-complex greyscale images " + g_warning( "%s", + _( "can only save non-complex greyscale images " "as miniswhite -- disabling miniswhite" ) ); wtiff->miniswhite = FALSE; } diff --git a/libvips/foreign/vips2webp.c b/libvips/foreign/vips2webp.c index 662aae5b..7d3f49e0 100644 --- a/libvips/foreign/vips2webp.c +++ b/libvips/foreign/vips2webp.c @@ -161,11 +161,9 @@ write_webp( WebPPicture *pic, VipsImage *in, pic->use_argb = lossless || near_lossless || smart_subsample; #else if( lossless || near_lossless ) - vips_warn( "vips2webp", - "%s", _( "lossless unsupported" ) ); + g_warning( "%s", _( "lossless unsupported" ) ); if( alpha_q != 100 ) - vips_warn( "vips2webp", - "%s", _( "alpha_q unsupported" ) ); + g_warning( "%s", _( "alpha_q unsupported" ) ); #endif #if WEBP_ENCODER_ABI_VERSION >= 0x0209 @@ -175,11 +173,9 @@ write_webp( WebPPicture *pic, VipsImage *in, config.preprocessing |= 4; #else if( near_lossless ) - vips_warn( "vips2webp", - "%s", _( "near_lossless unsupported" ) ); + g_warning( "%s", _( "near_lossless unsupported" ) ); if( smart_subsample ) - vips_warn( "vips2webp", - "%s", _( "smart_subsample unsupported" ) ); + g_warning( "%s", _( "smart_subsample unsupported" ) ); #endif if( !WebPValidateConfig( &config ) ) { diff --git a/libvips/histogram/maplut.c b/libvips/histogram/maplut.c index 09631b95..95cb7054 100644 --- a/libvips/histogram/maplut.c +++ b/libvips/histogram/maplut.c @@ -106,11 +106,8 @@ static void vips_maplut_posteval( VipsImage *image, VipsProgress *progress, VipsMaplut *maplut ) { - VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( maplut ); - if( maplut->overflow ) - vips_warn( class->nickname, - _( "%d overflows detected" ), maplut->overflow ); + g_warning( _( "%d overflows detected" ), maplut->overflow ); } /* Our sequence value: the region this sequence is using, and local stats. diff --git a/libvips/include/vips/almostdeprecated.h b/libvips/include/vips/almostdeprecated.h index c16bf350..26d90937 100644 --- a/libvips/include/vips/almostdeprecated.h +++ b/libvips/include/vips/almostdeprecated.h @@ -284,6 +284,14 @@ int im_plotpoint( IMAGE *im, int x, int y, PEL *pel ); int im_smudge( IMAGE *image, int ix, int iy, VipsRect *r ); int im_smear( IMAGE *im, int ix, int iy, VipsRect *r ); +void vips_warn( const char *domain, const char *fmt, ... ) + __attribute__((format(printf, 2, 3))); +void vips_vwarn( const char *domain, const char *fmt, va_list ap ); +void vips_info_set( gboolean info ); +void vips_info( const char *domain, const char *fmt, ... ) + __attribute__((format(printf, 2, 3))); +void vips_vinfo( const char *domain, const char *fmt, va_list ap ); + #ifdef __cplusplus } #endif /*__cplusplus*/ diff --git a/libvips/include/vips/error.h b/libvips/include/vips/error.h index 6afa66cf..1b697afa 100644 --- a/libvips/include/vips/error.h +++ b/libvips/include/vips/error.h @@ -50,13 +50,6 @@ void vips_verror_system( int err, const char *domain, const char *fmt, va_list ap ); void vips_error_g( GError **error ); void vips_g_error( GError **error ); -void vips_warn( const char *domain, const char *fmt, ... ) - __attribute__((format(printf, 2, 3))); -void vips_vwarn( const char *domain, const char *fmt, va_list ap ); -void vips_info_set( gboolean info ); -void vips_info( const char *domain, const char *fmt, ... ) - __attribute__((format(printf, 2, 3))); -void vips_vinfo( const char *domain, const char *fmt, va_list ap ); void vips_error_exit( const char *fmt, ... ) __attribute__((noreturn, format(printf, 1, 2))); diff --git a/libvips/include/vips/vips.h b/libvips/include/vips/vips.h index cb21d52d..30be4706 100644 --- a/libvips/include/vips/vips.h +++ b/libvips/include/vips/vips.h @@ -166,12 +166,10 @@ extern "C" { #define VIPS_INIT( ARGV0 ) \ (vips_version( 3 ) - vips_version( 5 ) != \ VIPS_LIBRARY_CURRENT - VIPS_LIBRARY_AGE ? ( \ - vips_info( "vips_init", "ABI mismatch" ), \ - vips_info( "vips_init", \ - "library has ABI version %d", \ + g_warning( "ABI mismatch" ), \ + g_warning( "library has ABI version %d", \ vips_version( 3 ) - vips_version( 5 ) ), \ - vips_info( "vips_init", \ - "application needs ABI version %d", \ + g_warning( "application needs ABI version %d", \ VIPS_LIBRARY_CURRENT - VIPS_LIBRARY_AGE ), \ vips_error( "vips_init", "ABI mismatch" ), \ -1 ) : \ diff --git a/libvips/iofuncs/error.c b/libvips/iofuncs/error.c index d1f53d8b..546a4e2c 100644 --- a/libvips/iofuncs/error.c +++ b/libvips/iofuncs/error.c @@ -105,10 +105,6 @@ * supposed to indicate the component which failed. */ -/* Show info messages. Handy for debugging. - */ -int vips__info = 0; - /* Make global array to keep the error message buffer. */ #define VIPS_MAX_ERROR (10240) @@ -371,125 +367,6 @@ vips_error_clear( void ) g_mutex_unlock( vips__global_lock ); } -/** - * vips_info_set: - * @info: %TRUE to enable info messages - * - * If set, vips will output various informative messages to stderr as it works. - * - * See also: vips_info(). - */ -void -vips_info_set( gboolean info ) -{ - vips__info = info; -} - -/** - * vips_vinfo: - * @domain: the source of the message - * @fmt: printf()-style format string for the message - * @ap: arguments to the format string - * - * Sends a formatted informational message to stderr if the --vips-info flag - * has been given to the program, or the environment variable VIPS_INFO has been - * defined, or if vips_info_set() has been called. - * - * Informational messages are used to report details about the operation of - * functions. - * - * See also: vips_info(), vips_info_set(), vips_warn(). - */ -void -vips_vinfo( const char *domain, const char *fmt, va_list ap ) -{ - if( vips__info ) { - g_mutex_lock( vips__global_lock ); - (void) fprintf( stderr, _( "%s: " ), _( "info" ) ); - if( domain ) - (void) fprintf( stderr, _( "%s: " ), domain ); - (void) vfprintf( stderr, fmt, ap ); - (void) fprintf( stderr, "\n" ); - g_mutex_unlock( vips__global_lock ); - } -} - -/** - * vips_info: - * @domain: the source of the diagnostic message - * @fmt: printf()-style format string for the message - * @...: arguments to the format string - * - * Sends a formatted informational message to stderr if the --vips-info flag - * has been given to the program or the environment variable VIPS_INFO has been - * defined, or if vips_info_set() has been called. - * - * Informational messages are used to report details about the operation of - * functions. - * - * See also: vips_info_set(), vips_vinfo(), vips_warn(). - */ -void -vips_info( const char *domain, const char *fmt, ... ) -{ - va_list ap; - - va_start( ap, fmt ); - vips_vinfo( domain, fmt, ap ); - va_end( ap ); -} - -/** - * vips_vwarn: - * @domain: the source of the warning message - * @fmt: printf()-style format string for the message - * @ap: arguments to the format string - * - * Exactly as vips_warn(), but takes a va_list argument. - * - * See also: vips_warn(). - */ -void -vips_vwarn( const char *domain, const char *fmt, va_list ap ) -{ - if( !g_getenv( "IM_WARNING" ) && - !g_getenv( "VIPS_WARNING" ) ) { - g_mutex_lock( vips__global_lock ); - (void) fprintf( stderr, _( "%s: " ), _( "vips warning" ) ); - if( domain ) - (void) fprintf( stderr, _( "%s: " ), domain ); - (void) vfprintf( stderr, fmt, ap ); - (void) fprintf( stderr, "\n" ); - g_mutex_unlock( vips__global_lock ); - } - - if( vips__fatal ) - vips_error_exit( "vips__fatal" ); -} - -/** - * vips_warn: - * @domain: the source of the warning message - * @fmt: printf()-style format string for the message - * @...: arguments to the format string - * - * Sends a formatted warning message to stderr. If you define the - * environment variable VIPS_WARNING, these message are supressed. - * - * Warning messages are used to report things like overflow counts. - * - * See also: vips_info(), vips_vwarn(). - */ -void -vips_warn( const char *domain, const char *fmt, ... ) -{ - va_list ap; - - va_start( ap, fmt ); - vips_vwarn( domain, fmt, ap ); - va_end( ap ); -} - /** * vips_error_exit: * @fmt: printf()-style format string for the message diff --git a/libvips/iofuncs/gate.c b/libvips/iofuncs/gate.c index 41f72978..84dcbcc2 100644 --- a/libvips/iofuncs/gate.c +++ b/libvips/iofuncs/gate.c @@ -143,8 +143,7 @@ vips_thread_profile_save( VipsThreadProfile *profile ) vips__file_open_write( "vips-profile.txt", TRUE ); if( !vips__thread_fp ) { g_mutex_unlock( vips__global_lock ); - vips_warn( "VipsGate", - "%s", "unable to create profile log" ); + g_warning( "unable to create profile log" ); return; } @@ -204,8 +203,7 @@ vips__thread_profile_init_cb( VipsThreadProfile *profile ) * been called. */ if( vips__thread_profile ) - vips_warn( "VipsGate", - "discarding unsaved state for thread %p --- " + g_warning( "discarding unsaved state for thread %p --- " "call vips_thread_shutdown() for this thread", profile->thread ); diff --git a/libvips/iofuncs/generate.c b/libvips/iofuncs/generate.c index e24cd1d7..58a9c013 100644 --- a/libvips/iofuncs/generate.c +++ b/libvips/iofuncs/generate.c @@ -411,7 +411,7 @@ vips_image_pipelinev( VipsImage *image, VipsDemandStyle hint, ... ) ; va_end( ap ); if( i == MAX_IMAGES ) { - vips_warn( "vips_image_pipeline", "%s", _( "too many images" ) ); + g_warning( "%s", _( "too many images" ) ); /* Make sure we have a sentinel there. */ diff --git a/libvips/iofuncs/image.c b/libvips/iofuncs/image.c index 50627744..79475600 100644 --- a/libvips/iofuncs/image.c +++ b/libvips/iofuncs/image.c @@ -1006,8 +1006,7 @@ vips_image_build( VipsObject *object ) * still be able to process it without coredumps. */ if( image->file_length > sizeof_image ) - vips_warn( "VipsImage", - _( "%s is longer than expected" ), + g_warning( _( "%s is longer than expected" ), image->filename ); break; @@ -2590,9 +2589,8 @@ vips_image_write_to_memory( VipsImage *in, size_t *size_out ) vips_error( "vips_image_write_to_memory", _( "out of memory --- size == %dMB" ), (int) (size / (1024.0 * 1024.0)) ); - vips_warn( "vips_image_write_to_memory", - _( "out of memory --- size == %dMB" ), - (int) (size / (1024.0*1024.0)) ); + g_warning( _( "out of memory --- size == %dMB" ), + (int) (size / (1024.0 * 1024.0)) ); return( NULL ); } @@ -3143,8 +3141,7 @@ vips_image_wio_input( VipsImage *image ) * generate from this image. */ if( image->regions ) - vips_warn( "vips_image_wio_input", "%s", - "rewinding image with active regions" ); + g_warning( "rewinding image with active regions" ); break; diff --git a/libvips/iofuncs/init.c b/libvips/iofuncs/init.c index 3aa7a4c4..a851f354 100644 --- a/libvips/iofuncs/init.c +++ b/libvips/iofuncs/init.c @@ -226,10 +226,8 @@ vips_load_plugins( const char *fmt, ... ) module = g_module_open( path, G_MODULE_BIND_LAZY ); if( !module ) { - vips_warn( "vips_init", - _( "unable to load \"%s\" -- %s" ), - path, - g_module_error() ); + g_warning( _( "unable to load \"%s\" -- %s" ), + path, g_module_error() ); result = -1; } } @@ -343,11 +341,14 @@ vips_init( const char *argv0 ) bindtextdomain( GETTEXT_PACKAGE, name ); bind_textdomain_codeset( GETTEXT_PACKAGE, "UTF-8" ); - /* Default various settings from env. + /* Deprecated, this is just for compat. */ if( g_getenv( "VIPS_INFO" ) || g_getenv( "IM_INFO" ) ) vips_info_set( TRUE ); + + /* Default various settings from env. + */ if( g_getenv( "VIPS_TRACE" ) ) vips_cache_set_trace( TRUE ); @@ -391,7 +392,7 @@ vips_init( const char *argv0 ) */ if( im_load_plugins( "%s/vips-%d.%d", libdir, VIPS_MAJOR_VERSION, VIPS_MINOR_VERSION ) ) { - vips_warn( "vips_init", "%s", vips_error_buffer() ); + g_warning( "%s", vips_error_buffer() ); vips_error_clear(); } @@ -399,7 +400,7 @@ vips_init( const char *argv0 ) * :-( kept for back compat convenience. */ if( im_load_plugins( "%s", libdir ) ) { - vips_warn( "vips_init", "%s", vips_error_buffer() ); + g_warning( "%s", vips_error_buffer() ); vips_error_clear(); } diff --git a/libvips/iofuncs/mapfile.c b/libvips/iofuncs/mapfile.c index 3c7c3e3d..37e1cf90 100644 --- a/libvips/iofuncs/mapfile.c +++ b/libvips/iofuncs/mapfile.c @@ -177,7 +177,7 @@ vips__mmap( int fd, int writeable, size_t length, gint64 offset ) if( baseaddr == MAP_FAILED ) { vips_error_system( errno, "vips_mapfile", "%s", _( "unable to mmap" ) ); - vips_warn( "vips_mapfile", _( "map failed (%s), " + g_warning( _( "map failed (%s), " "running very low on system resources, " "expect a crash soon" ), strerror( errno ) ); return( NULL ); diff --git a/libvips/iofuncs/memory.c b/libvips/iofuncs/memory.c index c45dbdc1..58686750 100644 --- a/libvips/iofuncs/memory.c +++ b/libvips/iofuncs/memory.c @@ -248,11 +248,9 @@ vips_tracked_free( void *s ) g_mutex_lock( vips_tracked_mutex ); if( vips_tracked_allocs <= 0 ) - vips_warn( "vips_tracked", - "%s", _( "vips_free: too many frees" ) ); + g_warning( "%s", _( "vips_free: too many frees" ) ); if( vips_tracked_mem < size ) - vips_warn( "vips_tracked", - "%s", _( "vips_free: too much free" ) ); + g_warning( "%s", _( "vips_free: too much free" ) ); vips_tracked_mem -= size; vips_tracked_allocs -= 1; @@ -310,8 +308,7 @@ vips_tracked_malloc( size_t size ) vips_error( "vips_tracked", _( "out of memory --- size == %dMB" ), (int) (size / (1024.0 * 1024.0)) ); - vips_warn( "vips_tracked", - _( "out of memory --- size == %dMB" ), + g_warning( _( "out of memory --- size == %dMB" ), (int) (size / (1024.0 * 1024.0)) ); return( NULL ); diff --git a/libvips/iofuncs/operation.c b/libvips/iofuncs/operation.c index 6bd7fb85..4dfd5905 100644 --- a/libvips/iofuncs/operation.c +++ b/libvips/iofuncs/operation.c @@ -221,12 +221,8 @@ vips_operation_finalize( GObject *gobject ) VIPS_DEBUG_MSG( "vips_operation_finalize: %p\n", gobject ); - if( operation->pixels ) { - VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( gobject ); - - vips_info( class->nickname, - _( "%d pixels calculated" ), operation->pixels ); - } + if( operation->pixels ) + g_info( _( "%d pixels calculated" ), operation->pixels ); G_OBJECT_CLASS( vips_operation_parent_class )->finalize( gobject ); } diff --git a/libvips/iofuncs/region.c b/libvips/iofuncs/region.c index 766f2104..0ecc619e 100644 --- a/libvips/iofuncs/region.c +++ b/libvips/iofuncs/region.c @@ -269,8 +269,7 @@ vips__region_stop( VipsRegion *region ) * can really do with it, sadly. */ if( result ) - vips_warn( "VipsRegion", - "stop callback failed for image %s", + g_warning( "stop callback failed for image %s", image->filename ); region->seq = NULL; diff --git a/libvips/iofuncs/system.c b/libvips/iofuncs/system.c index 6357f869..4a7ea5ee 100644 --- a/libvips/iofuncs/system.c +++ b/libvips/iofuncs/system.c @@ -231,8 +231,7 @@ vips_system_build( VipsObject *object ) if( std_error ) { vips__chomp( std_error ); if( strcmp( std_error, "" ) != 0 ) - vips_warn( class->nickname, - _( "stderr output: %s" ), std_error ); + g_warning( _( "stderr output: %s" ), std_error ); } if( std_output ) { vips__chomp( std_output ); diff --git a/libvips/iofuncs/threadpool.c b/libvips/iofuncs/threadpool.c index 172f92cc..68640805 100644 --- a/libvips/iofuncs/threadpool.c +++ b/libvips/iofuncs/threadpool.c @@ -407,8 +407,7 @@ vips_concurrency_get( void ) if( nthr < 1 || nthr > MAX_THREADS ) { nthr = VIPS_CLIP( 1, nthr, MAX_THREADS ); - vips_warn( "vips_concurrency_get", - _( "threads clipped to %d" ), nthr ); + g_warning( _( "threads clipped to %d" ), nthr ); } /* Save for next time around. diff --git a/libvips/iofuncs/vector.c b/libvips/iofuncs/vector.c index f405c3ad..65b71889 100644 --- a/libvips/iofuncs/vector.c +++ b/libvips/iofuncs/vector.c @@ -73,7 +73,7 @@ vips_vector_error( VipsVector *vector ) { #ifdef HAVE_ORC_PROGRAM_GET_ERROR if( vector->program ) - vips_warn( "VipsVector", "orc error: %s", + g_warning( "orc error: %s", orc_program_get_error( vector->program ) ); #endif /*HAVE_ORC_PROGRAM_GET_ERROR*/ } diff --git a/libvips/iofuncs/vips.c b/libvips/iofuncs/vips.c index ef44ad6a..749007ff 100644 --- a/libvips/iofuncs/vips.c +++ b/libvips/iofuncs/vips.c @@ -915,8 +915,7 @@ vips_image_open_input( VipsImage *image ) return( -1 ); image->file_length = rsize; if( psize > rsize ) - vips_warn( "VipsImage", - _( "unable to read data for \"%s\", %s" ), + g_warning( _( "unable to read data for \"%s\", %s" ), image->filename, _( "file has been truncated" ) ); /* Set demand style. This suits a disc file we read sequentially. @@ -928,8 +927,7 @@ vips_image_open_input( VipsImage *image ) * harmless. */ if( readhist( image ) ) { - vips_warn( "VipsImage", _( "error reading XML: %s" ), - vips_error_buffer() ); + g_warning( _( "error reading XML: %s" ), vips_error_buffer() ); vips_error_clear(); } diff --git a/libvips/resample/reduceh.cpp b/libvips/resample/reduceh.cpp index 0fda98eb..52ec7d3d 100644 --- a/libvips/resample/reduceh.cpp +++ b/libvips/resample/reduceh.cpp @@ -465,7 +465,7 @@ vips_reduceh_build( VipsObject *object ) */ reduceh->n_point = vips_reduce_get_points( reduceh->kernel, reduceh->hshrink ); - vips_info( object_class->nickname, "%d point mask", reduceh->n_point ); + g_info( "%d point mask", reduceh->n_point ); if( reduceh->n_point > MAX_POINT ) { vips_error( object_class->nickname, "%s", _( "reduce factor too large" ) ); diff --git a/libvips/resample/reducev.cpp b/libvips/resample/reducev.cpp index b8017ebc..63a03c43 100644 --- a/libvips/resample/reducev.cpp +++ b/libvips/resample/reducev.cpp @@ -779,7 +779,7 @@ vips_reducev_raw( VipsReducev *reducev, VipsImage *in ) if( in->BandFmt == VIPS_FORMAT_UCHAR && vips_vector_isenabled() && !vips_reducev_compile( reducev ) ) { - vips_info( object_class->nickname, "using vector path" ); + g_info( "using vector path" ); generate = vips_reducev_vector_gen; } @@ -848,7 +848,7 @@ vips_reducev_build( VipsObject *object ) "%s", _( "reduce factor too large" ) ); return( -1 ); } - vips_info( object_class->nickname, "%d point mask", reducev->n_point ); + g_info( "%d point mask", reducev->n_point ); /* Unpack for processing. */ diff --git a/libvips/resample/resize.c b/libvips/resample/resize.c index 59d963c8..419717e5 100644 --- a/libvips/resample/resize.c +++ b/libvips/resample/resize.c @@ -155,7 +155,6 @@ vips_resize_interpolate( VipsKernel kernel ) static int vips_resize_build( VipsObject *object ) { - VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object ); VipsResample *resample = VIPS_RESAMPLE( object ); VipsResize *resize = (VipsResize *) object; @@ -186,7 +185,7 @@ vips_resize_build( VipsObject *object ) int_vshrink = vips_resize_int_shrink( resize, vscale ); if( int_vshrink > 1 ) { - vips_info( class->nickname, "shrinkv by %d", int_vshrink ); + g_info( "shrinkv by %d", int_vshrink ); if( vips_shrinkv( in, &t[0], int_vshrink, NULL ) ) return( -1 ); in = t[0]; @@ -195,7 +194,7 @@ vips_resize_build( VipsObject *object ) } if( int_hshrink > 1 ) { - vips_info( class->nickname, "shrinkh by %d", int_hshrink ); + g_info( "shrinkh by %d", int_hshrink ); if( vips_shrinkh( in, &t[1], int_hshrink, NULL ) ) return( -1 ); in = t[1]; @@ -251,8 +250,7 @@ vips_resize_build( VipsObject *object ) /* Any residual downsizing. */ if( vscale < 1.0 ) { - vips_info( class->nickname, "residual reducev by %g", - vscale ); + g_info( "residual reducev by %g", vscale ); if( vips_reducev( in, &t[2], 1.0 / vscale, "kernel", resize->kernel, "centre", resize->centre, @@ -262,7 +260,7 @@ vips_resize_build( VipsObject *object ) } if( hscale < 1.0 ) { - vips_info( class->nickname, "residual reduceh by %g", + g_info( "residual reduceh by %g", hscale ); if( vips_reduceh( in, &t[3], 1.0 / hscale, "kernel", resize->kernel, @@ -285,8 +283,7 @@ vips_resize_build( VipsObject *object ) if( hscale > 1.0 && vscale > 1.0 ) { - vips_info( class->nickname, - "residual scale %g x %g", hscale, vscale ); + g_info( "residual scale %g x %g", hscale, vscale ); if( vips_affine( in, &t[4], hscale, 0.0, 0.0, vscale, "interpolate", interpolate, @@ -295,8 +292,7 @@ vips_resize_build( VipsObject *object ) in = t[4]; } else if( hscale > 1.0 ) { - vips_info( class->nickname, - "residual scale %g", hscale ); + g_info( "residual scale %g", hscale ); if( vips_affine( in, &t[4], hscale, 0.0, 0.0, 1.0, "interpolate", interpolate, NULL ) ) @@ -304,8 +300,7 @@ vips_resize_build( VipsObject *object ) in = t[4]; } else { - vips_info( class->nickname, - "residual scale %g", vscale ); + g_info( "residual scale %g", vscale ); if( vips_affine( in, &t[4], 1.0, 0.0, 0.0, vscale, "interpolate", interpolate, NULL ) ) diff --git a/libvips/resample/thumbnail.c b/libvips/resample/thumbnail.c index dcf24259..c90c5610 100644 --- a/libvips/resample/thumbnail.c +++ b/libvips/resample/thumbnail.c @@ -195,9 +195,8 @@ vips_thumbnail_open( VipsThumbnail *thumbnail ) if( class->get_info( thumbnail ) ) return( NULL ); - vips_info( "thumbnail", "selected loader is %s", - thumbnail->loader ); - vips_info( "thumbnail", "input size is %d x %d", + g_info( "selected loader is %s", thumbnail->loader ); + g_info( "input size is %d x %d", thumbnail->input_width, thumbnail->input_height ); shrink = 1; @@ -206,21 +205,18 @@ vips_thumbnail_open( VipsThumbnail *thumbnail ) if( vips_isprefix( "VipsForeignLoadJpeg", thumbnail->loader ) ) { shrink = vips_thumbnail_find_jpegshrink( thumbnail, thumbnail->input_width, thumbnail->input_height ); - vips_info( "thumbnail", - "loading jpeg with factor %d pre-shrink", shrink ); + g_info( "loading jpeg with factor %d pre-shrink", shrink ); } else if( vips_isprefix( "VipsForeignLoadPdf", thumbnail->loader ) || vips_isprefix( "VipsForeignLoadSvg", thumbnail->loader ) ) { scale = 1.0 / vips_thumbnail_calculate_shrink( thumbnail, thumbnail->input_width, thumbnail->input_height ); - vips_info( "thumbnail", - "loading PDF/SVG with factor %g pre-scale", scale ); + g_info( "loading PDF/SVG with factor %g pre-scale", scale ); } else if( vips_isprefix( "VipsForeignLoadWebp", thumbnail->loader ) ) { shrink = vips_thumbnail_calculate_shrink( thumbnail, thumbnail->input_width, thumbnail->input_height ); - vips_info( "thumbnail", - "loading webp with factor %d pre-shrink", shrink ); + g_info( "loading webp with factor %d pre-shrink", shrink ); } if( !(im = class->open( thumbnail, shrink, scale )) ) @@ -269,7 +265,7 @@ vips_thumbnail_build( VipsObject *object ) /* RAD needs special unpacking. */ if( in->Coding == VIPS_CODING_RAD ) { - vips_info( "thumbnail", "unpacking Rad to float" ); + g_info( "unpacking Rad to float" ); /* rad is scrgb. */ @@ -296,11 +292,9 @@ vips_thumbnail_build( VipsObject *object ) (vips_image_get_typeof( in, VIPS_META_ICC_NAME ) || thumbnail->import_profile) ) { if( vips_image_get_typeof( in, VIPS_META_ICC_NAME ) ) - vips_info( "thumbnail", - "importing with embedded profile" ); + g_info( "importing with embedded profile" ); else - vips_info( "thumbnail", - "importing with profile %s", + g_info( "importing with profile %s", thumbnail->import_profile ); if( vips_icc_import( in, &t[1], @@ -317,7 +311,7 @@ vips_thumbnail_build( VipsObject *object ) /* To the processing colourspace. This will unpack LABQ as well. */ - vips_info( "thumbnail", "converting to processing space %s", + g_info( "converting to processing space %s", vips_enum_nick( VIPS_TYPE_INTERPRETATION, interpretation ) ); if( vips_colourspace( in, &t[2], interpretation, NULL ) ) return( -1 ); @@ -328,7 +322,7 @@ vips_thumbnail_build( VipsObject *object ) */ have_premultiplied = FALSE; if( vips_image_hasalpha( in ) ) { - vips_info( "thumbnail", "premultiplying alpha" ); + g_info( "premultiplying alpha" ); if( vips_premultiply( in, &t[3], NULL ) ) return( -1 ); have_premultiplied = TRUE; @@ -353,7 +347,7 @@ vips_thumbnail_build( VipsObject *object ) in = t[4]; if( have_premultiplied ) { - vips_info( "thumbnail", "unpremultiplying alpha" ); + g_info( "unpremultiplying alpha" ); if( vips_unpremultiply( in, &t[5], NULL ) || vips_cast( t[5], &t[6], unpremultiplied_format, NULL ) ) return( -1 ); @@ -369,8 +363,7 @@ vips_thumbnail_build( VipsObject *object ) if( have_imported ) { if( thumbnail->export_profile || vips_image_get_typeof( in, VIPS_META_ICC_NAME ) ) { - vips_info( "thumbnail", - "exporting to device space with a profile" ); + g_info( "exporting to device space with a profile" ); if( vips_icc_export( in, &t[7], "output_profile", thumbnail->export_profile, NULL ) ) @@ -378,7 +371,7 @@ vips_thumbnail_build( VipsObject *object ) in = t[7]; } else { - vips_info( "thumbnail", "converting to sRGB" ); + g_info( "converting to sRGB" ); if( vips_colourspace( in, &t[7], VIPS_INTERPRETATION_sRGB, NULL ) ) return( -1 ); @@ -390,23 +383,20 @@ vips_thumbnail_build( VipsObject *object ) thumbnail->import_profile) ) { VipsImage *out; - vips_info( "thumbnail", - "exporting with profile %s", thumbnail->export_profile ); + g_info( "exporting with profile %s", thumbnail->export_profile ); /* We first try with the embedded profile, if any, then if * that fails try again with the supplied fallback profile. */ out = NULL; if( vips_image_get_typeof( in, VIPS_META_ICC_NAME ) ) { - vips_info( "thumbnail", - "importing with embedded profile" ); + g_info( "importing with embedded profile" ); if( vips_icc_transform( in, &t[7], thumbnail->export_profile, "embedded", TRUE, NULL ) ) { - vips_warn( "thumbnail", - _( "unable to import with " + g_warning( _( "unable to import with " "embedded profile: %s" ), vips_error_buffer() ); @@ -418,8 +408,7 @@ vips_thumbnail_build( VipsObject *object ) if( !out && thumbnail->import_profile ) { - vips_info( "thumbnail", - "importing with fallback profile" ); + g_info( "importing with fallback profile" ); if( vips_icc_transform( in, &t[7], thumbnail->export_profile, @@ -442,7 +431,7 @@ vips_thumbnail_build( VipsObject *object ) int left = (in->Xsize - thumbnail->width) / 2; int top = (in->Ysize - thumbnail->height) / 2; - vips_info( "thumbnail", "cropping to %dx%d", + g_info( "cropping to %dx%d", thumbnail->width, thumbnail->height ); if( vips_extract_area( in, &t[8], left, top, thumbnail->width, thumbnail->height, NULL ) ) @@ -454,7 +443,7 @@ vips_thumbnail_build( VipsObject *object ) thumbnail->angle != VIPS_ANGLE_D0 ) { VipsAngle angle = vips_autorot_get_angle( in ); - vips_info( "thumbnail", "rotating by %s", + g_info( "rotating by %s", vips_enum_nick( VIPS_TYPE_ANGLE, angle ) ); /* Need to copy to memory, we have to stay seq. @@ -573,7 +562,7 @@ vips_thumbnail_file_get_info( VipsThumbnail *thumbnail ) VipsImage *image; - vips_info( "thumbnail", "thumbnailing %s", file->filename ); + g_info( "thumbnailing %s", file->filename ); if( !(thumbnail->loader = vips_foreign_find_load( file->filename )) || !(image = vips_image_new_from_file( file->filename, NULL )) ) @@ -726,8 +715,7 @@ vips_thumbnail_buffer_get_info( VipsThumbnail *thumbnail ) VipsImage *image; - vips_info( "thumbnail", "thumbnailing %zd bytes of data", - buffer->buf->length ); + g_info( "thumbnailing %zd bytes of data", buffer->buf->length ); if( !(thumbnail->loader = vips_foreign_find_load_buffer( buffer->buf->data, buffer->buf->length )) || diff --git a/tools/vipsthumbnail.c b/tools/vipsthumbnail.c index e09c8421..e6a184e4 100644 --- a/tools/vipsthumbnail.c +++ b/tools/vipsthumbnail.c @@ -213,8 +213,7 @@ thumbnail_write( VipsObject *process, VipsImage *im, const char *filename ) g_free( dir ); } - vips_info( "vipsthumbnail", - "thumbnailing %s as %s", filename, output_name ); + g_info( "thumbnailing %s as %s", filename, output_name ); g_free( file ); @@ -308,7 +307,7 @@ main( int argc, char **argv ) if( rotate_image ) { #ifndef HAVE_EXIF - vips_warn( "vipsthumbnail", "%s", + g_warning( "%s", _( "auto-rotate disabled: " "libvips built without exif support" ) ); #endif /*!HAVE_EXIF*/