better vips_init() fallback
the vips_init() fallback was not working well ... new, better one gets called more often
This commit is contained in:
parent
a6255af981
commit
df599f2f55
@ -1,3 +1,6 @@
|
|||||||
|
12/9/11 started 7.26.4
|
||||||
|
- fallback vips_init()
|
||||||
|
|
||||||
10/8/11 started 7.26.3
|
10/8/11 started 7.26.3
|
||||||
- don't use G_VALUE_COLLECT_INIT(), many platforms do not have a glib this
|
- don't use G_VALUE_COLLECT_INIT(), many platforms do not have a glib this
|
||||||
recent
|
recent
|
||||||
|
@ -6,7 +6,7 @@ AC_CONFIG_MACRO_DIR(m4)
|
|||||||
# user-visible library versioning
|
# user-visible library versioning
|
||||||
m4_define([vips_major_version], [7])
|
m4_define([vips_major_version], [7])
|
||||||
m4_define([vips_minor_version], [26])
|
m4_define([vips_minor_version], [26])
|
||||||
m4_define([vips_micro_version], [3])
|
m4_define([vips_micro_version], [4])
|
||||||
m4_define([vips_version],
|
m4_define([vips_version],
|
||||||
[vips_major_version.vips_minor_version.vips_micro_version])
|
[vips_major_version.vips_minor_version.vips_micro_version])
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ PACKAGE=vips
|
|||||||
# interface changes not backwards compatible?: reset age to 0
|
# interface changes not backwards compatible?: reset age to 0
|
||||||
|
|
||||||
LIBRARY_CURRENT=30
|
LIBRARY_CURRENT=30
|
||||||
LIBRARY_REVISION=2
|
LIBRARY_REVISION=3
|
||||||
LIBRARY_AGE=15
|
LIBRARY_AGE=15
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
|
AM_INIT_AUTOMAKE($PACKAGE,$VERSION)
|
||||||
|
@ -149,6 +149,7 @@ extern "C" {
|
|||||||
|
|
||||||
const char *vips_get_argv0( void );
|
const char *vips_get_argv0( void );
|
||||||
int vips_init( const char *argv0 );
|
int vips_init( const char *argv0 );
|
||||||
|
void vips_check_init( void );
|
||||||
GOptionGroup *vips_get_option_group( void );
|
GOptionGroup *vips_get_option_group( void );
|
||||||
|
|
||||||
const char *vips_version_string( void );
|
const char *vips_version_string( void );
|
||||||
|
@ -299,6 +299,8 @@ vips_image_new_from_file_object( const char *string )
|
|||||||
{
|
{
|
||||||
VipsImage *image;
|
VipsImage *image;
|
||||||
|
|
||||||
|
vips_check_init();
|
||||||
|
|
||||||
/* We mustn't _build() the object here, so we can't just call
|
/* We mustn't _build() the object here, so we can't just call
|
||||||
* vips_image_new_from_file().
|
* vips_image_new_from_file().
|
||||||
*/
|
*/
|
||||||
@ -1408,6 +1410,8 @@ vips_image_new( void )
|
|||||||
{
|
{
|
||||||
VipsImage *image;
|
VipsImage *image;
|
||||||
|
|
||||||
|
vips_check_init();
|
||||||
|
|
||||||
image = VIPS_IMAGE( g_object_new( VIPS_TYPE_IMAGE, NULL ) );
|
image = VIPS_IMAGE( g_object_new( VIPS_TYPE_IMAGE, NULL ) );
|
||||||
g_object_set( image,
|
g_object_set( image,
|
||||||
"filename", vips_image_temp_name(),
|
"filename", vips_image_temp_name(),
|
||||||
@ -1561,6 +1565,8 @@ vips_image_new_mode( const char *filename, const char *mode )
|
|||||||
{
|
{
|
||||||
VipsImage *image;
|
VipsImage *image;
|
||||||
|
|
||||||
|
vips_check_init();
|
||||||
|
|
||||||
image = VIPS_IMAGE( g_object_new( VIPS_TYPE_IMAGE, NULL ) );
|
image = VIPS_IMAGE( g_object_new( VIPS_TYPE_IMAGE, NULL ) );
|
||||||
g_object_set( image,
|
g_object_set( image,
|
||||||
"filename", filename,
|
"filename", filename,
|
||||||
@ -1615,6 +1621,8 @@ vips_image_new_from_file_raw( const char *filename,
|
|||||||
{
|
{
|
||||||
VipsImage *image;
|
VipsImage *image;
|
||||||
|
|
||||||
|
vips_check_init();
|
||||||
|
|
||||||
image = VIPS_IMAGE( g_object_new( VIPS_TYPE_IMAGE, NULL ) );
|
image = VIPS_IMAGE( g_object_new( VIPS_TYPE_IMAGE, NULL ) );
|
||||||
g_object_set( image,
|
g_object_set( image,
|
||||||
"filename", filename,
|
"filename", filename,
|
||||||
@ -1654,6 +1662,8 @@ vips_image_new_from_memory( void *buffer,
|
|||||||
{
|
{
|
||||||
VipsImage *image;
|
VipsImage *image;
|
||||||
|
|
||||||
|
vips_check_init();
|
||||||
|
|
||||||
image = VIPS_IMAGE( g_object_new( VIPS_TYPE_IMAGE, NULL ) );
|
image = VIPS_IMAGE( g_object_new( VIPS_TYPE_IMAGE, NULL ) );
|
||||||
g_object_set( image,
|
g_object_set( image,
|
||||||
"filename", vips_image_temp_name(),
|
"filename", vips_image_temp_name(),
|
||||||
|
@ -262,8 +262,10 @@ vips_init( const char *argv0 )
|
|||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
/* Call this before vips stuff that uses stuff we need to have inited.
|
||||||
vips__gettext( const char *msgid )
|
*/
|
||||||
|
void
|
||||||
|
vips_check_init( void )
|
||||||
{
|
{
|
||||||
/* Pass in a nonsense name for argv0 ... this init path is only here
|
/* 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
|
* for old programs which are missing an vips_init() call. We need
|
||||||
@ -271,6 +273,12 @@ vips__gettext( const char *msgid )
|
|||||||
*/
|
*/
|
||||||
if( vips_init( "giant_banana" ) )
|
if( vips_init( "giant_banana" ) )
|
||||||
vips_error_clear();
|
vips_error_clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
vips__gettext( const char *msgid )
|
||||||
|
{
|
||||||
|
vips_check_init();
|
||||||
|
|
||||||
return( dgettext( GETTEXT_PACKAGE, msgid ) );
|
return( dgettext( GETTEXT_PACKAGE, msgid ) );
|
||||||
}
|
}
|
||||||
@ -278,8 +286,7 @@ vips__gettext( const char *msgid )
|
|||||||
const char *
|
const char *
|
||||||
vips__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_check_init();
|
||||||
vips_error_clear();
|
|
||||||
|
|
||||||
return( dngettext( GETTEXT_PACKAGE, msgid, plural, n ) );
|
return( dngettext( GETTEXT_PACKAGE, msgid, plural, n ) );
|
||||||
}
|
}
|
||||||
|
@ -952,6 +952,8 @@ vips_object_real_new_from_string( const char *string )
|
|||||||
{
|
{
|
||||||
GType type;
|
GType type;
|
||||||
|
|
||||||
|
vips_check_init();
|
||||||
|
|
||||||
/* The main arg selects the subclass.
|
/* The main arg selects the subclass.
|
||||||
*/
|
*/
|
||||||
if( !(type = vips_type_find( "VipsObject", string )) )
|
if( !(type = vips_type_find( "VipsObject", string )) )
|
||||||
@ -1334,6 +1336,8 @@ vips_object_new( GType type, VipsObjectSetArguments set, void *a, void *b )
|
|||||||
{
|
{
|
||||||
VipsObject *object;
|
VipsObject *object;
|
||||||
|
|
||||||
|
vips_check_init();
|
||||||
|
|
||||||
object = VIPS_OBJECT( g_object_new( type, NULL ) );
|
object = VIPS_OBJECT( g_object_new( type, NULL ) );
|
||||||
|
|
||||||
if( set && set( object, a, b ) ) {
|
if( set && set( object, a, b ) ) {
|
||||||
|
@ -218,6 +218,8 @@ vips_operation_new( const char *name )
|
|||||||
GType type;
|
GType type;
|
||||||
VipsOperation *operation;
|
VipsOperation *operation;
|
||||||
|
|
||||||
|
vips_check_init();
|
||||||
|
|
||||||
if( !(type = vips_type_find( "VipsOperation", name )) )
|
if( !(type = vips_type_find( "VipsOperation", name )) )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
operation = VIPS_OPERATION( g_object_new( type, NULL ) );
|
operation = VIPS_OPERATION( g_object_new( type, NULL ) );
|
||||||
|
@ -167,6 +167,8 @@ vips_pool_new( const char *name )
|
|||||||
{
|
{
|
||||||
VipsPool *pool;
|
VipsPool *pool;
|
||||||
|
|
||||||
|
vips_check_init();
|
||||||
|
|
||||||
pool = VIPS_POOL( g_object_new( VIPS_TYPE_POOL, NULL ) );
|
pool = VIPS_POOL( g_object_new( VIPS_TYPE_POOL, NULL ) );
|
||||||
|
|
||||||
g_object_set( pool, "name", name, NULL );
|
g_object_set( pool, "name", name, NULL );
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
# shrink to a target width
|
|
||||||
|
|
||||||
# default prefix
|
|
||||||
VIPSHOME=${VIPSHOME-/home/john/vips}
|
|
||||||
|
|
||||||
name=$0
|
|
||||||
bname=`basename $0`
|
|
||||||
|
|
||||||
if [ $# != 3 ]; then
|
|
||||||
echo "${bname}: usage: $bname <in> <out> <target width>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
inwidth=`$VIPSHOME/bin/vips im_header_int Xsize $1`
|
|
||||||
factor=`(echo scale=10; echo $inwidth / $3) | bc`
|
|
||||||
|
|
||||||
$VIPSHOME/bin/vips im_shrink $1 $2 $factor $factor
|
|
Loading…
Reference in New Issue
Block a user