try to build with older glibs

This commit is contained in:
John Cupitt 2012-06-20 18:01:46 +01:00
parent 542d7f9c10
commit f7a7fa384d
4 changed files with 63 additions and 28 deletions

View File

@ -1,3 +1,6 @@
18/6/12 started 7.28.8
- try to make it buildable with glib-2.12
18/6/12 started 7.28.7
- add vips_flatten() -- flatten RGBA to RGB
- better alpha handling in PNG load

10
TODO
View File

@ -1,3 +1,13 @@
- try
$ vipsthumbnail wtc.tif --vips-leak
160 objects alive:
0) VipsRegion (0x7f5ef804fd10)
....
argh
blocking bugs
=============

View File

@ -2,7 +2,7 @@
# also update the version number in the m4 macros below
AC_INIT(vips, 7.28.7, vipsip@jiscmail.ac.uk)
AC_INIT(vips, 7.28.8, vipsip@jiscmail.ac.uk)
# required for gobject-introspection
AC_PREREQ(2.62)
@ -15,7 +15,7 @@ AC_CONFIG_MACRO_DIR([m4])
# user-visible library versioning
m4_define([vips_major_version], [7])
m4_define([vips_minor_version], [28])
m4_define([vips_micro_version], [7])
m4_define([vips_micro_version], [8])
m4_define([vips_version],
[vips_major_version.vips_minor_version.vips_micro_version])
@ -35,7 +35,7 @@ VIPS_VERSION_STRING=$VIPS_VERSION-`date`
# interface changes not backwards compatible?: reset age to 0
LIBRARY_CURRENT=33
LIBRARY_REVISION=0
LIBRARY_REVISION=1
LIBRARY_AGE=1
# patched into include/vips/version.h

View File

@ -1,4 +1,7 @@
/* cache vips operations
*
* 20/6/12
* - now works with glib-2.12
*/
/*
@ -100,6 +103,12 @@ static GHashTable *vips_cache_table = NULL;
*/
static int vips_cache_time = 0;
/* Old versions of glib are missing these. When we abandon centos 5, switch to
* g_int64_hash() and g_double_hash().
*/
#define INT64_HASH(X) (((unsigned int *) (X))[0] ^ ((unsigned int *) (X))[1])
#define DOUBLE_HASH(X) (INT64_HASH(*((guint64 *) (X))))
/* Pass in the pspec so we can get the generic type. For example, a
* held in a GParamSpec allowing OBJECT, but the value could be of type
* VipsImage. generics are much faster to compare.
@ -134,12 +143,12 @@ vips_value_hash( GParamSpec *pspec, GValue *value )
else if( generic == G_TYPE_PARAM_UINT64 ) {
guint64 i = g_value_get_uint64( value );
return( g_int64_hash( (gint64 *) &i ) );
return( INT64_HASH( (gint64 *) &i ) );
}
else if( generic == G_TYPE_PARAM_INT64 ) {
gint64 i = g_value_get_int64( value );
return( g_int64_hash( &i ) );
return( INT64_HASH( &i ) );
}
else if( generic == G_TYPE_PARAM_FLOAT ) {
float f = g_value_get_float( value );
@ -149,7 +158,7 @@ vips_value_hash( GParamSpec *pspec, GValue *value )
else if( generic == G_TYPE_PARAM_DOUBLE ) {
double d = g_value_get_double( value );
return( g_double_hash( &d ) );
return( DOUBLE_HASH( &d ) );
}
else if( generic == G_TYPE_PARAM_STRING ) {
const char *s = g_value_get_string( value );
@ -416,23 +425,26 @@ vips_cache_init( void )
}
}
static void *
vips_cache_dump_fn( void *value, void *a, void *b)
{
char str[32768];
VipsBuf buf = VIPS_BUF_STATIC( str );
vips_object_to_string( VIPS_OBJECT( value ), &buf );
printf( "%p - %s\n", value, vips_buf_all( &buf ) );
return( NULL );
}
static void
vips_cache_dump( void )
{
if( vips_cache_table ) {
GHashTableIter iter;
gpointer key, value;
printf( "Operation cache:\n" );
g_hash_table_iter_init( &iter, vips_cache_table );
while( g_hash_table_iter_next( &iter, &key, &value ) ) {
char str[32768];
VipsBuf buf = VIPS_BUF_STATIC( str );
vips_object_to_string( VIPS_OBJECT( key ), &buf );
printf( "%p - %s\n", key, vips_buf_all( &buf ) );
}
vips_hash_table_map( vips_cache_table,
vips_cache_dump_fn, NULL, NULL );
}
}
@ -485,6 +497,22 @@ vips_cache_drop( VipsOperation *operation )
vips_cache_unref( operation );
}
static void *
vips_cache_find_first_fn( void *value, void *a, void *b )
{
return( value );
}
static VipsOperation *
vips_cache_find_first( void )
{
if( vips_cache_table )
return( VIPS_OPERATION( vips_hash_table_map( vips_cache_table,
vips_cache_find_first_fn, NULL, NULL ) ) );
else
return( NULL );
}
/**
* vips_cache_drop_all:
*
@ -494,6 +522,8 @@ void
vips_cache_drop_all( void )
{
if( vips_cache_table ) {
VipsOperation *operation;
if( vips__cache_dump )
vips_cache_dump();
@ -501,16 +531,8 @@ vips_cache_drop_all( void )
* g_hash_table_foreach() and friends. Repeatedly drop the
* first item instead.
*/
for(;;) {
GHashTableIter iter;
gpointer key, value;
g_hash_table_iter_init( &iter, vips_cache_table );
if( !g_hash_table_iter_next( &iter, &key, &value ) )
break;
vips_cache_drop( (VipsOperation *) key );
}
while( (operation = vips_cache_find_first()) )
vips_cache_drop( operation );
VIPS_FREEF( g_hash_table_unref, vips_cache_table );
}