diff --git a/libvips/include/vips/internal.h b/libvips/include/vips/internal.h index 2c55451a..b842b477 100644 --- a/libvips/include/vips/internal.h +++ b/libvips/include/vips/internal.h @@ -200,8 +200,6 @@ int vips_mapfilerw( VipsImage * ); int vips_remapfilerw( VipsImage * ); int im__write( int, const void *, size_t ); -void im__change_suffix( const char *name, char *out, int mx, - const char *new_suff, const char **olds, int nolds ); int im__trigger_callbacks( GSList *cblist ); int im__close( VipsImage * ); int im__fft_sp( float *rvec, float *ivec, int logrows, int logcols ); diff --git a/libvips/include/vips/intl.h b/libvips/include/vips/intl.h index 22877aea..edfea4bb 100644 --- a/libvips/include/vips/intl.h +++ b/libvips/include/vips/intl.h @@ -8,20 +8,20 @@ extern "C" { #endif /*__cplusplus*/ -const char *im__gettext( const char *msgid ); -const char *im__ngettext( const char *msgid, +const char *vips__gettext( const char *msgid ); +const char *vips__ngettext( const char *msgid, const char *plural, unsigned long int n ); #ifdef ENABLE_NLS #include -#define _(String) im__gettext(String) +#define _(String) vips__gettext(String) /* ngettext may be defined as a macro if we're optimised. */ #ifdef ngettext #undef ngettext #endif /*ngettext*/ -#define ngettext(String,Plural,number) im__ngettext(String,Plural,number) +#define ngettext(String,Plural,number) vips__ngettext(String,Plural,number) #ifdef gettext_noop #define N_(String) gettext_noop(String) #else diff --git a/libvips/include/vips/util.h b/libvips/include/vips/util.h index bddf08f7..b34c0ccb 100644 --- a/libvips/include/vips/util.h +++ b/libvips/include/vips/util.h @@ -239,6 +239,9 @@ int im_amiMSBfirst( void ); char *im__temp_name( const char *format ); +void vips__change_suffix( const char *name, char *out, int mx, + const char *new_suff, const char **olds, int nolds ); + #ifdef __cplusplus } #endif /*__cplusplus*/ diff --git a/libvips/include/vips/vips7compat.h b/libvips/include/vips/vips7compat.h index 27480d51..ecbce338 100644 --- a/libvips/include/vips/vips7compat.h +++ b/libvips/include/vips/vips7compat.h @@ -350,6 +350,8 @@ VipsDemandStyle im_char2dhint( const char *str ); #define vips_bandfmt_isfloat vips_band_format_isfloat #define vips_bandfmt_iscomplex vips_band_format_iscomplex +#define im__change_suffix vips__change_suffix + /* Buffer processing. */ typedef void (*im_wrapone_fn)( void *in, void *out, int width, diff --git a/libvips/iofuncs/init.c b/libvips/iofuncs/init.c index 9f3110c1..8a2f6280 100644 --- a/libvips/iofuncs/init.c +++ b/libvips/iofuncs/init.c @@ -143,13 +143,13 @@ vips_get_argv0( void ) * int main( int argc, char **argv ) * { * if( vips_init( argv[0] ) ) - * error_exit( "unable to start VIPS" ); + * vips_error_exit( "unable to start VIPS" ); * * return( 0 ); * } * ]| * - * See also: im_get_option_group(), im_version(), vips_guess_prefix(), + * See also: vips_get_option_group(), vips_version(), vips_guess_prefix(), * vips_guess_libdir(). * * Returns: 0 on success, -1 otherwise @@ -249,7 +249,7 @@ vips_init( const char *argv0 ) } const char * -im__gettext( const char *msgid ) +vips__gettext( const char *msgid ) { /* Pass in a nonsense name for argv0 ... this init path is only here * for old programs which are missing an vips_init() call. We need @@ -262,7 +262,7 @@ im__gettext( const char *msgid ) } const char * -im__ngettext( const char *msgid, const char *plural, unsigned long int n ) +vips__ngettext( const char *msgid, const char *plural, unsigned long int n ) { if( vips_init( "giant_banana" ) ) vips_error_clear(); @@ -321,45 +321,6 @@ vips_get_option_group( void ) return( option_group ); } -/* Strip off any of a set of old suffixes (eg. [".v", ".jpg"]), add a single - * new suffix (eg. ".tif"). - */ -void -im__change_suffix( const char *name, char *out, int mx, - const char *new, const char **olds, int nolds ) -{ - char *p; - int i; - int len; - - /* Copy start string. - */ - im_strncpy( out, name, mx ); - - /* Drop all matching suffixes. - */ - while( (p = strrchr( out, '.' )) ) { - /* Found suffix - test against list of alternatives. Ignore - * case. - */ - for( i = 0; i < nolds; i++ ) - if( g_ascii_strcasecmp( p, olds[i] ) == 0 ) { - *p = '\0'; - break; - } - - /* Found match? If not, break from loop. - */ - if( *p ) - break; - } - - /* Add new suffix. - */ - len = strlen( out ); - im_strncpy( out + len, new, mx - len ); -} - static char * get_current_dir( void ) { @@ -622,7 +583,7 @@ vips_guess_prefix( const char *argv0, const char *env_name ) if( strlen( IM_EXEEXT ) > 0 ) { const char *olds[] = { IM_EXEEXT }; - im__change_suffix( p, name, PATH_MAX, IM_EXEEXT, olds, 1 ); + vips__change_suffix( p, name, PATH_MAX, IM_EXEEXT, olds, 1 ); } else im_strncpy( name, p, PATH_MAX ); diff --git a/libvips/iofuncs/meta.c b/libvips/iofuncs/meta.c index 70b3f915..194b6798 100644 --- a/libvips/iofuncs/meta.c +++ b/libvips/iofuncs/meta.c @@ -101,7 +101,7 @@ * over an image's fields, including all metadata. * * Items of metadata are identified by strings. Some strings are reserved, for - * example the ICC pofile for an image is known by convention as + * example the ICC profile for an image is known by convention as * "icc-profile-data". * * If you save an image in VIPS format, all metadata (with a restriction, see diff --git a/libvips/iofuncs/util.c b/libvips/iofuncs/util.c index 9ea78245..e3083d91 100644 --- a/libvips/iofuncs/util.c +++ b/libvips/iofuncs/util.c @@ -1396,3 +1396,42 @@ im__temp_name( const char *format ) return( name ); } +/* Strip off any of a set of old suffixes (eg. [".v", ".jpg"]), add a single + * new suffix (eg. ".tif"). + */ +void +vips__change_suffix( const char *name, char *out, int mx, + const char *new, const char **olds, int nolds ) +{ + char *p; + int i; + int len; + + /* Copy start string. + */ + im_strncpy( out, name, mx ); + + /* Drop all matching suffixes. + */ + while( (p = strrchr( out, '.' )) ) { + /* Found suffix - test against list of alternatives. Ignore + * case. + */ + for( i = 0; i < nolds; i++ ) + if( g_ascii_strcasecmp( p, olds[i] ) == 0 ) { + *p = '\0'; + break; + } + + /* Found match? If not, break from loop. + */ + if( *p ) + break; + } + + /* Add new suffix. + */ + len = strlen( out ); + im_strncpy( out + len, new, mx - len ); +} +