Merge pull request #1697 from kleisauke/wasm-function-pointers
Support for use in WASM environments (#192)
This commit is contained in:
commit
e728e5638d
@ -96,7 +96,7 @@ vips_profile_load_build( VipsObject *object )
|
|||||||
else if( (data = vips__file_read_name( load->name,
|
else if( (data = vips__file_read_name( load->name,
|
||||||
vips__icc_dir(), &length )) )
|
vips__icc_dir(), &length )) )
|
||||||
profile = vips_blob_new(
|
profile = vips_blob_new(
|
||||||
(VipsCallbackFn) g_free, data, length );
|
(VipsCallbackFn) vips_area_free_cb, data, length );
|
||||||
else {
|
else {
|
||||||
vips_error( class->nickname,
|
vips_error( class->nickname,
|
||||||
_( "unable to load profile \"%s\"" ), load->name );
|
_( "unable to load profile \"%s\"" ), load->name );
|
||||||
|
@ -172,6 +172,14 @@ vips_extract_area_build( VipsObject *object )
|
|||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __EMSCRIPTEN__
|
||||||
|
static void
|
||||||
|
vips_crop_class_init_adapter( VipsExtractAreaClass *class, void *dummy )
|
||||||
|
{
|
||||||
|
vips_extract_area_class_init( class );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vips_extract_area_class_init( VipsExtractAreaClass *class )
|
vips_extract_area_class_init( VipsExtractAreaClass *class )
|
||||||
{
|
{
|
||||||
@ -226,6 +234,14 @@ vips_extract_area_class_init( VipsExtractAreaClass *class )
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __EMSCRIPTEN__
|
||||||
|
static void
|
||||||
|
vips_crop_init_adapter( VipsExtractArea *extract, void *dummy )
|
||||||
|
{
|
||||||
|
vips_extract_area_init( extract );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vips_extract_area_init( VipsExtractArea *extract )
|
vips_extract_area_init( VipsExtractArea *extract )
|
||||||
{
|
{
|
||||||
@ -275,12 +291,20 @@ vips_crop_get_type( void )
|
|||||||
sizeof( VipsExtractAreaClass ),
|
sizeof( VipsExtractAreaClass ),
|
||||||
NULL, /* base_init */
|
NULL, /* base_init */
|
||||||
NULL, /* base_finalize */
|
NULL, /* base_finalize */
|
||||||
|
#ifdef __EMSCRIPTEN__
|
||||||
|
(GClassInitFunc) vips_crop_class_init_adapter,
|
||||||
|
#else
|
||||||
(GClassInitFunc) vips_extract_area_class_init,
|
(GClassInitFunc) vips_extract_area_class_init,
|
||||||
|
#endif
|
||||||
NULL, /* class_finalize */
|
NULL, /* class_finalize */
|
||||||
NULL, /* class_data */
|
NULL, /* class_data */
|
||||||
sizeof( VipsExtractArea ),
|
sizeof( VipsExtractArea ),
|
||||||
32, /* n_preallocs */
|
32, /* n_preallocs */
|
||||||
|
#ifdef __EMSCRIPTEN__
|
||||||
|
(GInstanceInitFunc) vips_crop_init_adapter,
|
||||||
|
#else
|
||||||
(GInstanceInitFunc) vips_extract_area_init,
|
(GInstanceInitFunc) vips_extract_area_init,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
type = g_type_register_static( VIPS_TYPE_CONVERSION,
|
type = g_type_register_static( VIPS_TYPE_CONVERSION,
|
||||||
|
@ -473,7 +473,7 @@ vips_tile_destroy( VipsTile *tile )
|
|||||||
|
|
||||||
VIPS_UNREF( tile->region );
|
VIPS_UNREF( tile->region );
|
||||||
|
|
||||||
vips_free( tile );
|
g_free( tile );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -225,7 +225,7 @@ vips_canny_polar( VipsImage **args, VipsImage **out )
|
|||||||
{
|
{
|
||||||
static GOnce once = G_ONCE_INIT;
|
static GOnce once = G_ONCE_INIT;
|
||||||
|
|
||||||
g_once( &once, (GThreadFunc) vips_atan2_init, NULL );
|
g_once( &once, vips_atan2_init, NULL );
|
||||||
|
|
||||||
*out = vips_image_new();
|
*out = vips_image_new();
|
||||||
if( vips_image_pipeline_array( *out,
|
if( vips_image_pipeline_array( *out,
|
||||||
|
@ -910,7 +910,7 @@ im_free_vargv( im_function *fn, im_object *vargv )
|
|||||||
/* If there is local storage, free it.
|
/* If there is local storage, free it.
|
||||||
*/
|
*/
|
||||||
if( fn->argv[i].desc->size != 0 )
|
if( fn->argv[i].desc->size != 0 )
|
||||||
vips_free( vargv[i] );
|
g_free( vargv[i] );
|
||||||
|
|
||||||
/* NULL out pointer.
|
/* NULL out pointer.
|
||||||
*/
|
*/
|
||||||
|
@ -813,3 +813,13 @@ vips_autorot_get_angle( VipsImage *im )
|
|||||||
return( VIPS_ANGLE_D0 );
|
return( VIPS_ANGLE_D0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* The old vips_free(), now replaced by g_free() and vips_area_free_cb().
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
vips_free( void *buf )
|
||||||
|
{
|
||||||
|
g_free( buf );
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -309,7 +309,7 @@ read_header( const char *header )
|
|||||||
if( len != sizeof( struct dsr ) ) {
|
if( len != sizeof( struct dsr ) ) {
|
||||||
vips_error( "analyze2vips",
|
vips_error( "analyze2vips",
|
||||||
"%s", _( "header file size incorrect" ) );
|
"%s", _( "header file size incorrect" ) );
|
||||||
vips_free( d );
|
g_free( d );
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,7 +354,7 @@ read_header( const char *header )
|
|||||||
if( (int) len != d->hk.sizeof_hdr ) {
|
if( (int) len != d->hk.sizeof_hdr ) {
|
||||||
vips_error( "analyze2vips",
|
vips_error( "analyze2vips",
|
||||||
"%s", _( "header size incorrect" ) );
|
"%s", _( "header size incorrect" ) );
|
||||||
vips_free( d );
|
g_free( d );
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -444,7 +444,7 @@ attach_meta( VipsImage *out, struct dsr *d )
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
vips_image_set_blob( out, "dsr",
|
vips_image_set_blob( out, "dsr",
|
||||||
(VipsCallbackFn) vips_free, d, d->hk.sizeof_hdr );
|
(VipsCallbackFn) vips_area_free_cb, d, d->hk.sizeof_hdr );
|
||||||
|
|
||||||
for( i = 0; i < VIPS_NUMBER( dsr_header ); i++ ) {
|
for( i = 0; i < VIPS_NUMBER( dsr_header ); i++ ) {
|
||||||
switch( dsr_header[i].type ) {
|
switch( dsr_header[i].type ) {
|
||||||
@ -514,7 +514,7 @@ vips__isanalyze( const char *filename )
|
|||||||
result = get_vips_properties( d, &width, &height, &bands, &fmt );
|
result = get_vips_properties( d, &width, &height, &bands, &fmt );
|
||||||
vips_error_thaw();
|
vips_error_thaw();
|
||||||
|
|
||||||
vips_free( d );
|
g_free( d );
|
||||||
|
|
||||||
return( result == 0 );
|
return( result == 0 );
|
||||||
}
|
}
|
||||||
@ -538,7 +538,7 @@ vips__analyze_read_header( const char *filename, VipsImage *out )
|
|||||||
#endif /*DEBUG*/
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
if( get_vips_properties( d, &width, &height, &bands, &fmt ) ) {
|
if( get_vips_properties( d, &width, &height, &bands, &fmt ) ) {
|
||||||
vips_free( d );
|
g_free( d );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ vips_gsf_tree_new( GsfOutput *out, gint deflate_level )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
vips_gsf_child_by_name_sub( VipsGsfDirectory *dir, const char *name )
|
vips_gsf_child_by_name_sub( VipsGsfDirectory *dir, const char *name, void *b )
|
||||||
{
|
{
|
||||||
if( strcmp( dir->name, name ) == 0 )
|
if( strcmp( dir->name, name ) == 0 )
|
||||||
return( dir );
|
return( dir );
|
||||||
@ -2692,7 +2692,7 @@ vips_foreign_save_dz_buffer_build( VipsObject *object )
|
|||||||
gsf_output_memory_get_bytes( GSF_OUTPUT_MEMORY( dz->out ) ),
|
gsf_output_memory_get_bytes( GSF_OUTPUT_MEMORY( dz->out ) ),
|
||||||
olen );
|
olen );
|
||||||
|
|
||||||
blob = vips_blob_new( (VipsCallbackFn) g_free, obuf, olen );
|
blob = vips_blob_new( (VipsCallbackFn) vips_area_free_cb, obuf, olen );
|
||||||
g_object_set( object, "buffer", blob, NULL );
|
g_object_set( object, "buffer", blob, NULL );
|
||||||
vips_area_unref( VIPS_AREA( blob ) );
|
vips_area_unref( VIPS_AREA( blob ) );
|
||||||
|
|
||||||
|
@ -1258,7 +1258,7 @@ vips_exif_exif_entry( ExifEntry *entry, VipsExifRemove *ve )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
vips_exif_exif_remove( ExifEntry *entry, VipsExifRemove *ve )
|
vips_exif_exif_remove( ExifEntry *entry, VipsExifRemove *ve, void *b )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
{
|
{
|
||||||
@ -1405,7 +1405,7 @@ vips__exif_update( VipsImage *image )
|
|||||||
#endif /*DEBUG*/
|
#endif /*DEBUG*/
|
||||||
|
|
||||||
vips_image_set_blob( image, VIPS_META_EXIF_NAME,
|
vips_image_set_blob( image, VIPS_META_EXIF_NAME,
|
||||||
(VipsCallbackFn) vips_free, data, length );
|
(VipsCallbackFn) vips_area_free_cb, data, length );
|
||||||
|
|
||||||
exif_data_free( ed );
|
exif_data_free( ed );
|
||||||
|
|
||||||
|
@ -390,7 +390,7 @@ file_add_class( VipsForeignClass *class, GSList **files )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
file_compare( VipsForeignClass *a, VipsForeignClass *b )
|
file_compare( VipsForeignClass *a, VipsForeignClass *b, void *user_data )
|
||||||
{
|
{
|
||||||
return( b->priority - a->priority );
|
return( b->priority - a->priority );
|
||||||
}
|
}
|
||||||
@ -479,7 +479,7 @@ vips_foreign_load_summary_class( VipsObjectClass *object_class, VipsBuf *buf )
|
|||||||
*/
|
*/
|
||||||
static void *
|
static void *
|
||||||
vips_foreign_find_load_sub( VipsForeignLoadClass *load_class,
|
vips_foreign_find_load_sub( VipsForeignLoadClass *load_class,
|
||||||
const char *filename )
|
const char *filename, void *b )
|
||||||
{
|
{
|
||||||
VipsObjectClass *object_class = VIPS_OBJECT_CLASS( load_class );
|
VipsObjectClass *object_class = VIPS_OBJECT_CLASS( load_class );
|
||||||
VipsForeignClass *class = VIPS_FOREIGN_CLASS( load_class );
|
VipsForeignClass *class = VIPS_FOREIGN_CLASS( load_class );
|
||||||
@ -1763,7 +1763,7 @@ vips_foreign_save_init( VipsForeignSave *save )
|
|||||||
*/
|
*/
|
||||||
static void *
|
static void *
|
||||||
vips_foreign_find_save_sub( VipsForeignSaveClass *save_class,
|
vips_foreign_find_save_sub( VipsForeignSaveClass *save_class,
|
||||||
const char *filename )
|
const char *filename, void *b )
|
||||||
{
|
{
|
||||||
VipsObjectClass *object_class = VIPS_OBJECT_CLASS( save_class );
|
VipsObjectClass *object_class = VIPS_OBJECT_CLASS( save_class );
|
||||||
VipsForeignClass *class = VIPS_FOREIGN_CLASS( save_class );
|
VipsForeignClass *class = VIPS_FOREIGN_CLASS( save_class );
|
||||||
@ -1919,7 +1919,7 @@ vips_foreign_save( VipsImage *in, const char *name, ... )
|
|||||||
*/
|
*/
|
||||||
static void *
|
static void *
|
||||||
vips_foreign_find_save_target_sub( VipsForeignSaveClass *save_class,
|
vips_foreign_find_save_target_sub( VipsForeignSaveClass *save_class,
|
||||||
const char *suffix )
|
const char *suffix, void *b )
|
||||||
{
|
{
|
||||||
VipsObjectClass *object_class = VIPS_OBJECT_CLASS( save_class );
|
VipsObjectClass *object_class = VIPS_OBJECT_CLASS( save_class );
|
||||||
VipsForeignClass *class = VIPS_FOREIGN_CLASS( save_class );
|
VipsForeignClass *class = VIPS_FOREIGN_CLASS( save_class );
|
||||||
@ -1977,7 +1977,7 @@ vips_foreign_find_save_target( const char *name )
|
|||||||
*/
|
*/
|
||||||
static void *
|
static void *
|
||||||
vips_foreign_find_save_buffer_sub( VipsForeignSaveClass *save_class,
|
vips_foreign_find_save_buffer_sub( VipsForeignSaveClass *save_class,
|
||||||
const char *suffix )
|
const char *suffix, void *b )
|
||||||
{
|
{
|
||||||
VipsObjectClass *object_class = VIPS_OBJECT_CLASS( save_class );
|
VipsObjectClass *object_class = VIPS_OBJECT_CLASS( save_class );
|
||||||
VipsForeignClass *class = VIPS_FOREIGN_CLASS( save_class );
|
VipsForeignClass *class = VIPS_FOREIGN_CLASS( save_class );
|
||||||
|
@ -334,7 +334,7 @@ readjpeg_free( ReadJpeg *jpeg )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
readjpeg_close_cb( VipsObject *object, ReadJpeg *jpeg )
|
readjpeg_close_cb( VipsImage *image, ReadJpeg *jpeg )
|
||||||
{
|
{
|
||||||
(void) readjpeg_free( jpeg );
|
(void) readjpeg_free( jpeg );
|
||||||
}
|
}
|
||||||
@ -728,7 +728,7 @@ read_jpeg_header( ReadJpeg *jpeg, VipsImage *out )
|
|||||||
}
|
}
|
||||||
|
|
||||||
vips_image_set_blob( out, VIPS_META_ICC_NAME,
|
vips_image_set_blob( out, VIPS_META_ICC_NAME,
|
||||||
(VipsCallbackFn) vips_free, data, data_length );
|
(VipsCallbackFn) vips_area_free_cb, data, data_length );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
|
@ -593,9 +593,7 @@ vips_foreign_save_magick_buffer_build( VipsObject *object )
|
|||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* obuf is a g_free() buffer, not vips_free().
|
blob = vips_blob_new( (VipsCallbackFn) vips_area_free_cb, obuf, olen );
|
||||||
*/
|
|
||||||
blob = vips_blob_new( (VipsCallbackFn) g_free, obuf, olen );
|
|
||||||
g_object_set( buffer, "buffer", blob, NULL );
|
g_object_set( buffer, "buffer", blob, NULL );
|
||||||
vips_area_unref( VIPS_AREA( blob ) );
|
vips_area_unref( VIPS_AREA( blob ) );
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ read_destroy( Read *read )
|
|||||||
VIPS_FREEF( Mat_VarFree, read->var );
|
VIPS_FREEF( Mat_VarFree, read->var );
|
||||||
VIPS_FREEF( Mat_Close, read->mat );
|
VIPS_FREEF( Mat_Close, read->mat );
|
||||||
|
|
||||||
vips_free( read );
|
g_free( read );
|
||||||
}
|
}
|
||||||
|
|
||||||
static Read *
|
static Read *
|
||||||
|
@ -139,7 +139,7 @@ read_destroy( VipsImage *out, Read *read )
|
|||||||
|
|
||||||
read_close( read );
|
read_close( read );
|
||||||
|
|
||||||
vips_free( read );
|
g_free( read );
|
||||||
}
|
}
|
||||||
|
|
||||||
static Read *
|
static Read *
|
||||||
|
@ -739,13 +739,13 @@ vips__rad_israd( VipsSource *source )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
read_destroy( VipsObject *object, Read *read )
|
read_destroy( VipsImage *image, Read *read )
|
||||||
{
|
{
|
||||||
VIPS_UNREF( read->sbuf );
|
VIPS_UNREF( read->sbuf );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
read_minimise_cb( VipsObject *object, Read *read )
|
read_minimise_cb( VipsImage *image, Read *read )
|
||||||
{
|
{
|
||||||
if( read->sbuf )
|
if( read->sbuf )
|
||||||
vips_source_minimise( read->sbuf->source );
|
vips_source_minimise( read->sbuf->source );
|
||||||
@ -994,7 +994,7 @@ write_destroy( Write *write )
|
|||||||
VIPS_FREE( write->line );
|
VIPS_FREE( write->line );
|
||||||
VIPS_UNREF( write->target );
|
VIPS_UNREF( write->target );
|
||||||
|
|
||||||
vips_free( write );
|
g_free( write );
|
||||||
}
|
}
|
||||||
|
|
||||||
static Write *
|
static Write *
|
||||||
|
@ -522,7 +522,7 @@ rtiff_free( Rtiff *rtiff )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rtiff_close_cb( VipsObject *object, Rtiff *rtiff )
|
rtiff_close_cb( VipsImage *image, Rtiff *rtiff )
|
||||||
{
|
{
|
||||||
rtiff_free( rtiff );
|
rtiff_free( rtiff );
|
||||||
}
|
}
|
||||||
@ -1926,7 +1926,7 @@ rtiff_fill_region( VipsRegion *out,
|
|||||||
static int
|
static int
|
||||||
rtiff_seq_stop( void *seq, void *a, void *b )
|
rtiff_seq_stop( void *seq, void *a, void *b )
|
||||||
{
|
{
|
||||||
vips_free( seq );
|
g_free( seq );
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
@ -503,10 +503,7 @@ vips_foreign_save_tiff_buffer_build( VipsObject *object )
|
|||||||
tiff->subifd ) )
|
tiff->subifd ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
/* vips__tiff_write_buf() makes a buffer that needs g_free(), not
|
blob = vips_blob_new( (VipsCallbackFn) vips_area_free_cb, obuf, olen );
|
||||||
* vips_free().
|
|
||||||
*/
|
|
||||||
blob = vips_blob_new( (VipsCallbackFn) g_free, obuf, olen );
|
|
||||||
g_object_set( object, "buffer", blob, NULL );
|
g_object_set( object, "buffer", blob, NULL );
|
||||||
vips_area_unref( VIPS_AREA( blob ) );
|
vips_area_unref( VIPS_AREA( blob ) );
|
||||||
|
|
||||||
|
@ -979,9 +979,9 @@ wtiff_free( Wtiff *wtiff )
|
|||||||
wtiff_delete_temps( wtiff );
|
wtiff_delete_temps( wtiff );
|
||||||
|
|
||||||
VIPS_UNREF( wtiff->ready );
|
VIPS_UNREF( wtiff->ready );
|
||||||
VIPS_FREEF( vips_free, wtiff->tbuf );
|
VIPS_FREE( wtiff->tbuf );
|
||||||
VIPS_FREEF( layer_free_all, wtiff->layer );
|
VIPS_FREEF( layer_free_all, wtiff->layer );
|
||||||
VIPS_FREEF( vips_free, wtiff->icc_profile );
|
VIPS_FREE( wtiff->icc_profile );
|
||||||
VIPS_FREE( wtiff->filename );
|
VIPS_FREE( wtiff->filename );
|
||||||
VIPS_FREE( wtiff );
|
VIPS_FREE( wtiff );
|
||||||
}
|
}
|
||||||
@ -1888,11 +1888,11 @@ wtiff_copy_tiff( Wtiff *wtiff, TIFF *out, TIFF *in )
|
|||||||
len = TIFFReadEncodedTile( in, tile, buf, -1 );
|
len = TIFFReadEncodedTile( in, tile, buf, -1 );
|
||||||
if( len < 0 ||
|
if( len < 0 ||
|
||||||
TIFFWriteEncodedTile( out, tile, buf, len ) < 0 ) {
|
TIFFWriteEncodedTile( out, tile, buf, len ) < 0 ) {
|
||||||
vips_free( buf );
|
g_free( buf );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vips_free( buf );
|
g_free( buf );
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
@ -294,6 +294,10 @@ void vips_vinfo( const char *domain, const char *fmt, va_list ap );
|
|||||||
|
|
||||||
VipsAngle vips_autorot_get_angle( VipsImage *image );
|
VipsAngle vips_autorot_get_angle( VipsImage *image );
|
||||||
|
|
||||||
|
/* iofuncs
|
||||||
|
*/
|
||||||
|
int vips_free( void *buf );
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /*__cplusplus*/
|
#endif /*__cplusplus*/
|
||||||
|
@ -319,27 +319,27 @@ typedef struct _VipsImageClass {
|
|||||||
|
|
||||||
/* Evaluation is starting.
|
/* Evaluation is starting.
|
||||||
*/
|
*/
|
||||||
void (*preeval)( VipsImage *image, VipsProgress *progress );
|
void (*preeval)( VipsImage *image, VipsProgress *progress, void *data );
|
||||||
|
|
||||||
/* Evaluation progress.
|
/* Evaluation progress.
|
||||||
*/
|
*/
|
||||||
void (*eval)( VipsImage *image, VipsProgress *progress );
|
void (*eval)( VipsImage *image, VipsProgress *progress, void *data );
|
||||||
|
|
||||||
/* Evaluation is ending.
|
/* Evaluation is ending.
|
||||||
*/
|
*/
|
||||||
void (*posteval)( VipsImage *image, VipsProgress *progress );
|
void (*posteval)( VipsImage *image, VipsProgress *progress, void *data );
|
||||||
|
|
||||||
/* An image has been written to.
|
/* An image has been written to.
|
||||||
* Used by eg. vips_image_new_mode("x.jpg", "w") to do the
|
* Used by eg. vips_image_new_mode("x.jpg", "w") to do the
|
||||||
* final write to jpeg.
|
* final write to jpeg.
|
||||||
* Set *result to non-zero to indicate an error on write.
|
* Set *result to non-zero to indicate an error on write.
|
||||||
*/
|
*/
|
||||||
void (*written)( VipsImage *image, int *result );
|
void (*written)( VipsImage *image, int *result, void *data );
|
||||||
|
|
||||||
/* An image has been modified in some way and all caches
|
/* An image has been modified in some way and all caches
|
||||||
* need dropping.
|
* need dropping.
|
||||||
*/
|
*/
|
||||||
void (*invalidate)( VipsImage *image );
|
void (*invalidate)( VipsImage *image, void *data );
|
||||||
|
|
||||||
/* Minimise this pipeline.
|
/* Minimise this pipeline.
|
||||||
*
|
*
|
||||||
@ -349,7 +349,7 @@ typedef struct _VipsImageClass {
|
|||||||
*
|
*
|
||||||
* See vips_tilecache().
|
* See vips_tilecache().
|
||||||
*/
|
*/
|
||||||
void (*minimise)( VipsImage *image );
|
void (*minimise)( VipsImage *image, void *data );
|
||||||
|
|
||||||
} VipsImageClass;
|
} VipsImageClass;
|
||||||
|
|
||||||
|
@ -66,7 +66,6 @@ G_STMT_START { \
|
|||||||
|
|
||||||
void *vips_malloc( VipsObject *object, size_t size );
|
void *vips_malloc( VipsObject *object, size_t size );
|
||||||
char *vips_strdup( VipsObject *object, const char *str );
|
char *vips_strdup( VipsObject *object, const char *str );
|
||||||
int vips_free( void *buf );
|
|
||||||
|
|
||||||
void vips_tracked_free( void *s );
|
void vips_tracked_free( void *s );
|
||||||
void *vips_tracked_malloc( size_t size );
|
void *vips_tracked_malloc( size_t size );
|
||||||
|
@ -455,7 +455,7 @@ struct _VipsObjectClass {
|
|||||||
|
|
||||||
/* Just after build ... the object is fully ready for work.
|
/* Just after build ... the object is fully ready for work.
|
||||||
*/
|
*/
|
||||||
int (*postbuild)( VipsObject *object );
|
int (*postbuild)( VipsObject *object, void *data );
|
||||||
|
|
||||||
/* Try to print something about the class, handy for help displays.
|
/* Try to print something about the class, handy for help displays.
|
||||||
* Keep to one line.
|
* Keep to one line.
|
||||||
|
@ -92,6 +92,7 @@ typedef struct _VipsArea {
|
|||||||
} VipsArea;
|
} VipsArea;
|
||||||
|
|
||||||
VipsArea *vips_area_copy( VipsArea *area );
|
VipsArea *vips_area_copy( VipsArea *area );
|
||||||
|
int vips_area_free_cb( void *mem, VipsArea *area );
|
||||||
void vips_area_unref( VipsArea *area );
|
void vips_area_unref( VipsArea *area );
|
||||||
|
|
||||||
VipsArea *vips_area_new( VipsCallbackFn free_fn, void *data );
|
VipsArea *vips_area_new( VipsCallbackFn free_fn, void *data );
|
||||||
|
@ -153,7 +153,7 @@ vips_buffer_dump( VipsBuffer *buffer, size_t *reserve, size_t *alive )
|
|||||||
|
|
||||||
#ifdef DEBUG_CREATE
|
#ifdef DEBUG_CREATE
|
||||||
static void *
|
static void *
|
||||||
vips_buffer_cache_dump( VipsBufferCache *cache )
|
vips_buffer_cache_dump( VipsBufferCache *cache, void *a, void *b )
|
||||||
{
|
{
|
||||||
printf( "VipsBufferCache: %p\n", cache );
|
printf( "VipsBufferCache: %p\n", cache );
|
||||||
printf( "\t%d buffers\n", g_slist_length( cache->buffers ) );
|
printf( "\t%d buffers\n", g_slist_length( cache->buffers ) );
|
||||||
|
@ -453,7 +453,7 @@ vips_operation_equal( VipsOperation *a, VipsOperation *b )
|
|||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
vips__cache_once_init( void )
|
vips__cache_once_init( void *data )
|
||||||
{
|
{
|
||||||
vips_cache_lock = vips_g_mutex_new();
|
vips_cache_lock = vips_g_mutex_new();
|
||||||
|
|
||||||
@ -469,7 +469,7 @@ vips__cache_init( void )
|
|||||||
{
|
{
|
||||||
static GOnce once = G_ONCE_INIT;
|
static GOnce once = G_ONCE_INIT;
|
||||||
|
|
||||||
VIPS_ONCE( &once, (GThreadFunc) vips__cache_once_init, NULL );
|
VIPS_ONCE( &once, vips__cache_once_init, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
|
@ -210,8 +210,8 @@ vips__thread_profile_init_cb( VipsThreadProfile *profile )
|
|||||||
vips_thread_profile_free( profile );
|
vips_thread_profile_free( profile );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void *
|
||||||
vips__thread_profile_init( void )
|
vips__thread_profile_init( void *data )
|
||||||
{
|
{
|
||||||
#ifdef HAVE_PRIVATE_INIT
|
#ifdef HAVE_PRIVATE_INIT
|
||||||
static GPrivate private =
|
static GPrivate private =
|
||||||
@ -223,6 +223,8 @@ vips__thread_profile_init( void )
|
|||||||
vips_thread_profile_key = g_private_new(
|
vips_thread_profile_key = g_private_new(
|
||||||
(GDestroyNotify) vips__thread_profile_init_cb );
|
(GDestroyNotify) vips__thread_profile_init_cb );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
static VipsThreadGate *
|
static VipsThreadGate *
|
||||||
@ -245,7 +247,7 @@ vips__thread_profile_attach( const char *thread_name )
|
|||||||
|
|
||||||
VipsThreadProfile *profile;
|
VipsThreadProfile *profile;
|
||||||
|
|
||||||
VIPS_ONCE( &once, (GThreadFunc) vips__thread_profile_init, NULL );
|
VIPS_ONCE( &once, vips__thread_profile_init, NULL );
|
||||||
|
|
||||||
VIPS_DEBUG_MSG( "vips__thread_profile_attach: %s\n", thread_name );
|
VIPS_DEBUG_MSG( "vips__thread_profile_attach: %s\n", thread_name );
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ vips__link_make( VipsImage *image_up, VipsImage *image_down )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
vips__link_break( VipsImage *image_up, VipsImage *image_down )
|
vips__link_break( VipsImage *image_up, VipsImage *image_down, void *b )
|
||||||
{
|
{
|
||||||
g_assert( image_up );
|
g_assert( image_up );
|
||||||
g_assert( image_down );
|
g_assert( image_down );
|
||||||
@ -171,9 +171,9 @@ vips__link_break( VipsImage *image_up, VipsImage *image_down )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
vips__link_break_rev( VipsImage *image_down, VipsImage *image_up )
|
vips__link_break_rev( VipsImage *image_down, VipsImage *image_up, void *b )
|
||||||
{
|
{
|
||||||
return( vips__link_break( image_up, image_down ) );
|
return( vips__link_break( image_up, image_down, b ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A VipsImage is going ... break all links.
|
/* A VipsImage is going ... break all links.
|
||||||
@ -203,7 +203,7 @@ typedef struct _LinkMap {
|
|||||||
} LinkMap;
|
} LinkMap;
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
vips__link_mapp( VipsImage *image, LinkMap *map )
|
vips__link_mapp( VipsImage *image, LinkMap *map, void *b )
|
||||||
{
|
{
|
||||||
void *res;
|
void *res;
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ vips__link_mapp( VipsImage *image, LinkMap *map )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
vips__link_map_cb( VipsImage *image, GSList **images )
|
vips__link_map_cb( VipsImage *image, GSList **images, void *b )
|
||||||
{
|
{
|
||||||
*images = g_slist_prepend( *images, image );
|
*images = g_slist_prepend( *images, image );
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ vips__link_map( VipsImage *image, gboolean upstream,
|
|||||||
serial += 1;
|
serial += 1;
|
||||||
map.serial = serial;
|
map.serial = serial;
|
||||||
|
|
||||||
vips__link_mapp( image, &map );
|
vips__link_mapp( image, &map, NULL );
|
||||||
|
|
||||||
for( p = images; p; p = p->next )
|
for( p = images; p; p = p->next )
|
||||||
g_object_ref( p->data );
|
g_object_ref( p->data );
|
||||||
@ -494,7 +494,7 @@ vips_stop_many( void *seq, void *a, void *b )
|
|||||||
|
|
||||||
for( i = 0; ar[i]; i++ )
|
for( i = 0; ar[i]; i++ )
|
||||||
g_object_unref( ar[i] );
|
g_object_unref( ar[i] );
|
||||||
vips_free( (char *) ar );
|
g_free( (char *) ar );
|
||||||
}
|
}
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
@ -630,7 +630,7 @@ vips_allocate_input_array( VipsImage *out, ... )
|
|||||||
/* A write function for VIPS images. Just write() the pixel data.
|
/* A write function for VIPS images. Just write() the pixel data.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
write_vips( VipsRegion *region, VipsRect *area, void *a, void *b )
|
write_vips( VipsRegion *region, VipsRect *area, void *a )
|
||||||
{
|
{
|
||||||
size_t nwritten, count;
|
size_t nwritten, count;
|
||||||
void *buf;
|
void *buf;
|
||||||
@ -753,8 +753,7 @@ vips_image_generate( VipsImage *image,
|
|||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
if( image->dtype == VIPS_IMAGE_OPENOUT )
|
if( image->dtype == VIPS_IMAGE_OPENOUT )
|
||||||
res = vips_sink_disc( image,
|
res = vips_sink_disc( image, write_vips, NULL );
|
||||||
(VipsRegionWrite) write_vips, NULL );
|
|
||||||
else
|
else
|
||||||
res = vips_sink_memory( image );
|
res = vips_sink_memory( image );
|
||||||
|
|
||||||
|
@ -235,7 +235,7 @@ vips_format_sizeof_unsafe( VipsBandFormat format )
|
|||||||
/* Check that this meta is on the hash table.
|
/* Check that this meta is on the hash table.
|
||||||
*/
|
*/
|
||||||
static void *
|
static void *
|
||||||
meta_sanity_on_hash( VipsMeta *meta, VipsImage *im )
|
meta_sanity_on_hash( VipsMeta *meta, VipsImage *im, void *b )
|
||||||
{
|
{
|
||||||
VipsMeta *found;
|
VipsMeta *found;
|
||||||
|
|
||||||
@ -970,7 +970,7 @@ vips_image_init_fields( VipsImage *image,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
meta_cp_field( VipsMeta *meta, VipsImage *dst )
|
meta_cp_field( VipsMeta *meta, VipsImage *dst, void *b )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
{
|
{
|
||||||
@ -1569,7 +1569,7 @@ vips_image_set_blob_copy( VipsImage *image,
|
|||||||
((unsigned char *) data_copy)[length] = '\0';
|
((unsigned char *) data_copy)[length] = '\0';
|
||||||
|
|
||||||
vips_image_set_blob( image,
|
vips_image_set_blob( image,
|
||||||
name, (VipsCallbackFn) vips_free, data_copy, length );
|
name, (VipsCallbackFn) vips_area_free_cb, data_copy, length );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -651,7 +651,7 @@ vips_image_summary( VipsObject *object, VipsBuf *buf )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
vips_image_sanity_upstream( VipsImage *up, VipsImage *down )
|
vips_image_sanity_upstream( VipsImage *up, VipsImage *down, void *b )
|
||||||
{
|
{
|
||||||
if( !g_slist_find( up->downstream, down ) ||
|
if( !g_slist_find( up->downstream, down ) ||
|
||||||
!g_slist_find( down->upstream, up ) )
|
!g_slist_find( down->upstream, up ) )
|
||||||
@ -661,9 +661,9 @@ vips_image_sanity_upstream( VipsImage *up, VipsImage *down )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
vips_image_sanity_downstream( VipsImage *down, VipsImage *up )
|
vips_image_sanity_downstream( VipsImage *down, VipsImage *up, void *b )
|
||||||
{
|
{
|
||||||
return( vips_image_sanity_upstream( up, down ) );
|
return( vips_image_sanity_upstream( up, down, b ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -738,7 +738,7 @@ vips_image_rewind( VipsObject *object )
|
|||||||
/* From "written" callback: save to image->filename using VipsForeign.
|
/* From "written" callback: save to image->filename using VipsForeign.
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
vips_image_save_cb( VipsImage *image, int *result )
|
vips_image_save_cb( VipsImage *image, int *result, void *data )
|
||||||
{
|
{
|
||||||
if( vips_foreign_save( image, image->filename, NULL ) )
|
if( vips_foreign_save( image, image->filename, NULL ) )
|
||||||
*result = -1;
|
*result = -1;
|
||||||
@ -786,7 +786,7 @@ vips_image_eval_cb( VipsImage *image, VipsProgress *progress, int *last )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vips_image_posteval_cb( VipsImage *image, VipsProgress *progress )
|
vips_image_posteval_cb( VipsImage *image, VipsProgress *progress, void *data )
|
||||||
{
|
{
|
||||||
/* Spaces at end help to erase the %complete message we overwrite.
|
/* Spaces at end help to erase the %complete message we overwrite.
|
||||||
*/
|
*/
|
||||||
@ -1016,7 +1016,7 @@ vips_image_build( VipsObject *object )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
vips_image_real_invalidate_cb( VipsRegion *reg )
|
vips_image_real_invalidate_cb( VipsRegion *reg, void *a, void *b )
|
||||||
{
|
{
|
||||||
vips_region_invalidate( reg );
|
vips_region_invalidate( reg );
|
||||||
|
|
||||||
@ -1024,7 +1024,7 @@ vips_image_real_invalidate_cb( VipsRegion *reg )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vips_image_real_invalidate( VipsImage *image )
|
vips_image_real_invalidate( VipsImage *image, void *data )
|
||||||
{
|
{
|
||||||
VIPS_DEBUG_MSG( "vips_image_real_invalidate: %p\n", image );
|
VIPS_DEBUG_MSG( "vips_image_real_invalidate: %p\n", image );
|
||||||
|
|
||||||
@ -1041,13 +1041,13 @@ vips_image_real_invalidate( VipsImage *image )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vips_image_real_minimise( VipsImage *image )
|
vips_image_real_minimise( VipsImage *image, void *data )
|
||||||
{
|
{
|
||||||
VIPS_DEBUG_MSG( "vips_image_real_minimise: %p\n", image );
|
VIPS_DEBUG_MSG( "vips_image_real_minimise: %p\n", image );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vips_image_real_written( VipsImage *image, int *result )
|
vips_image_real_written( VipsImage *image, int *result, void *data )
|
||||||
{
|
{
|
||||||
VIPS_DEBUG_MSG( "vips_image_real_written: %p\n", image );
|
VIPS_DEBUG_MSG( "vips_image_real_written: %p\n", image );
|
||||||
|
|
||||||
@ -1390,7 +1390,7 @@ vips_image_invalidate( VipsImage *image )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
vips_image_invalidate_all_cb( VipsImage *image )
|
vips_image_invalidate_all_cb( VipsImage *image, void *a, void *b )
|
||||||
{
|
{
|
||||||
vips_image_invalidate( image );
|
vips_image_invalidate( image );
|
||||||
|
|
||||||
@ -1430,7 +1430,7 @@ vips_image_minimise( VipsImage *image )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
vips_image_minimise_all_cb( VipsImage *image )
|
vips_image_minimise_all_cb( VipsImage *image, void *a, void *b )
|
||||||
{
|
{
|
||||||
vips_image_minimise( image );
|
vips_image_minimise( image );
|
||||||
|
|
||||||
|
@ -215,24 +215,6 @@ vips_strdup( VipsObject *object, const char *str )
|
|||||||
return( str_dup );
|
return( str_dup );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* vips_free:
|
|
||||||
* @buf: memory to free
|
|
||||||
*
|
|
||||||
* Frees memory with g_free() and returns 0. Handy for callbacks.
|
|
||||||
*
|
|
||||||
* See also: vips_malloc().
|
|
||||||
*
|
|
||||||
* Returns: 0
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
vips_free( void *buf )
|
|
||||||
{
|
|
||||||
g_free( buf );
|
|
||||||
|
|
||||||
return( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* vips_tracked_free:
|
* vips_tracked_free:
|
||||||
* @s: (transfer full): memory to free
|
* @s: (transfer full): memory to free
|
||||||
@ -273,10 +255,12 @@ vips_tracked_free( void *s )
|
|||||||
VIPS_GATE_FREE( size );
|
VIPS_GATE_FREE( size );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void *
|
||||||
vips_tracked_init_mutex( void )
|
vips_tracked_init_mutex( void *data )
|
||||||
{
|
{
|
||||||
vips_tracked_mutex = vips_g_mutex_new();
|
vips_tracked_mutex = vips_g_mutex_new();
|
||||||
|
|
||||||
|
return( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -285,7 +269,7 @@ vips_tracked_init( void )
|
|||||||
static GOnce vips_tracked_once = G_ONCE_INIT;
|
static GOnce vips_tracked_once = G_ONCE_INIT;
|
||||||
|
|
||||||
VIPS_ONCE( &vips_tracked_once,
|
VIPS_ONCE( &vips_tracked_once,
|
||||||
(GThreadFunc) vips_tracked_init_mutex, NULL );
|
vips_tracked_init_mutex, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1460,7 +1460,7 @@ vips_object_real_build( VipsObject *object )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vips_object_real_postbuild( VipsObject *object )
|
vips_object_real_postbuild( VipsObject *object, void *data )
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf( "vips_object_real_postbuild: " );
|
printf( "vips_object_real_postbuild: " );
|
||||||
@ -1701,7 +1701,7 @@ traverse_find_required_priority( void *data, void *a, void *b )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
traverse_sort( gconstpointer a, gconstpointer b )
|
traverse_sort( gconstpointer a, gconstpointer b, void *user_data )
|
||||||
{
|
{
|
||||||
VipsArgumentClass *class1 = (VipsArgumentClass *) a;
|
VipsArgumentClass *class1 = (VipsArgumentClass *) a;
|
||||||
VipsArgumentClass *class2 = (VipsArgumentClass *) b;
|
VipsArgumentClass *class2 = (VipsArgumentClass *) b;
|
||||||
@ -1803,7 +1803,7 @@ vips_object_class_install_argument( VipsObjectClass *object_class,
|
|||||||
argument_table_traverse = g_slist_prepend(
|
argument_table_traverse = g_slist_prepend(
|
||||||
argument_table_traverse, argument_class );
|
argument_table_traverse, argument_class );
|
||||||
argument_table_traverse = g_slist_sort(
|
argument_table_traverse = g_slist_sort(
|
||||||
argument_table_traverse, traverse_sort );
|
argument_table_traverse, (GCompareFunc) traverse_sort );
|
||||||
VIPS_SWAP( GSList *,
|
VIPS_SWAP( GSList *,
|
||||||
argument_table_traverse,
|
argument_table_traverse,
|
||||||
object_class->argument_table_traverse );
|
object_class->argument_table_traverse );
|
||||||
@ -3045,7 +3045,7 @@ typedef struct {
|
|||||||
} VipsObjectLocal;
|
} VipsObjectLocal;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vips_object_local_array_cb( GObject *parent, VipsObjectLocal *local )
|
vips_object_local_array_cb( VipsObject *parent, VipsObjectLocal *local )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -3111,7 +3111,7 @@ vips_object_set_static( VipsObject *object, gboolean static_object )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
vips_object_n_static_cb( VipsObject *object, int *n )
|
vips_object_n_static_cb( VipsObject *object, int *n, void *b )
|
||||||
{
|
{
|
||||||
if( object->static_object )
|
if( object->static_object )
|
||||||
*n += 1;
|
*n += 1;
|
||||||
@ -3132,7 +3132,7 @@ vips_object_n_static( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
vips_object_print_all_cb( VipsObject *object, int *n )
|
vips_object_print_all_cb( VipsObject *object, int *n, void *b )
|
||||||
{
|
{
|
||||||
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
|
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
|
||||||
|
|
||||||
@ -3176,7 +3176,7 @@ vips_object_print_all( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
vips_object_sanity_all_cb( VipsObject *object )
|
vips_object_sanity_all_cb( VipsObject *object, void *a, void *b )
|
||||||
{
|
{
|
||||||
(void) vips_object_sanity( object );
|
(void) vips_object_sanity( object );
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ vips_rect_unionrect( const VipsRect *r1, const VipsRect *r2, VipsRect *out )
|
|||||||
* vips_rect_dup: (skip)
|
* vips_rect_dup: (skip)
|
||||||
* @r: rectangle to duplicate
|
* @r: rectangle to duplicate
|
||||||
*
|
*
|
||||||
* Duplicate a rect to the heap. You need to free the result with vips_free().
|
* Duplicate a rect to the heap. You need to free the result with g_free().
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): a pointer to copy of @r allocated on the heap.
|
* Returns: (transfer full): a pointer to copy of @r allocated on the heap.
|
||||||
*/
|
*/
|
||||||
|
@ -1576,7 +1576,7 @@ vips_region_shrink( VipsRegion *from, VipsRegion *to, const VipsRect *target )
|
|||||||
/* Generate into a region.
|
/* Generate into a region.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
vips_region_generate( VipsRegion *reg )
|
vips_region_generate( VipsRegion *reg, void *a )
|
||||||
{
|
{
|
||||||
VipsImage *im = reg->im;
|
VipsImage *im = reg->im;
|
||||||
|
|
||||||
@ -1659,8 +1659,7 @@ vips_region_prepare( VipsRegion *reg, const VipsRect *r )
|
|||||||
|
|
||||||
switch( im->dtype ) {
|
switch( im->dtype ) {
|
||||||
case VIPS_IMAGE_PARTIAL:
|
case VIPS_IMAGE_PARTIAL:
|
||||||
if( vips_region_fill( reg, r,
|
if( vips_region_fill( reg, r, vips_region_generate, NULL ) )
|
||||||
(VipsRegionFillFn) vips_region_generate, NULL ) )
|
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -1716,7 +1715,7 @@ vips_region_prepare_to_generate( VipsRegion *reg,
|
|||||||
|
|
||||||
/* Run sequence into reg.
|
/* Run sequence into reg.
|
||||||
*/
|
*/
|
||||||
if( vips_region_generate( reg ) )
|
if( vips_region_generate( reg, NULL ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
/* The generate function may not have actually made any pixels ... it
|
/* The generate function may not have actually made any pixels ... it
|
||||||
@ -2007,7 +2006,7 @@ vips_region_invalidate( VipsRegion *reg )
|
|||||||
|
|
||||||
#ifdef VIPS_DEBUG
|
#ifdef VIPS_DEBUG
|
||||||
static void *
|
static void *
|
||||||
vips_region_dump_all_cb( VipsRegion *region, size_t *alive )
|
vips_region_dump_all_cb( VipsRegion *region, size_t *alive, void *b )
|
||||||
{
|
{
|
||||||
char str[2048];
|
char str[2048];
|
||||||
VipsBuf buf = VIPS_BUF_STATIC( str );
|
VipsBuf buf = VIPS_BUF_STATIC( str );
|
||||||
|
@ -120,7 +120,7 @@ static void
|
|||||||
sink_area_free( SinkArea *area )
|
sink_area_free( SinkArea *area )
|
||||||
{
|
{
|
||||||
vips_semaphore_destroy( &area->n_thread );
|
vips_semaphore_destroy( &area->n_thread );
|
||||||
vips_free( area );
|
g_free( area );
|
||||||
}
|
}
|
||||||
|
|
||||||
static SinkArea *
|
static SinkArea *
|
||||||
|
@ -157,7 +157,7 @@ wbuffer_free( WriteBuffer *wbuffer )
|
|||||||
vips_semaphore_destroy( &wbuffer->go );
|
vips_semaphore_destroy( &wbuffer->go );
|
||||||
vips_semaphore_destroy( &wbuffer->nwrite );
|
vips_semaphore_destroy( &wbuffer->nwrite );
|
||||||
vips_semaphore_destroy( &wbuffer->done );
|
vips_semaphore_destroy( &wbuffer->done );
|
||||||
vips_free( wbuffer );
|
g_free( wbuffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -126,7 +126,7 @@ static void
|
|||||||
sink_memory_area_free( SinkMemoryArea *area )
|
sink_memory_area_free( SinkMemoryArea *area )
|
||||||
{
|
{
|
||||||
vips_semaphore_destroy( &area->nwrite );
|
vips_semaphore_destroy( &area->nwrite );
|
||||||
vips_free( area );
|
g_free( area );
|
||||||
}
|
}
|
||||||
|
|
||||||
static SinkMemoryArea *
|
static SinkMemoryArea *
|
||||||
|
@ -206,12 +206,12 @@ render_thread_state_new( VipsImage *im, void *a )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
tile_free( Tile *tile )
|
tile_free( Tile *tile, void *a, void *b )
|
||||||
{
|
{
|
||||||
VIPS_DEBUG_MSG_AMBER( "tile_free\n" );
|
VIPS_DEBUG_MSG_AMBER( "tile_free\n" );
|
||||||
|
|
||||||
VIPS_UNREF( tile->region );
|
VIPS_UNREF( tile->region );
|
||||||
vips_free( tile );
|
g_free( tile );
|
||||||
|
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
@ -245,7 +245,7 @@ render_free( Render *render )
|
|||||||
|
|
||||||
VIPS_UNREF( render->in );
|
VIPS_UNREF( render->in );
|
||||||
|
|
||||||
vips_free( render );
|
g_free( render );
|
||||||
|
|
||||||
#ifdef VIPS_DEBUG_AMBER
|
#ifdef VIPS_DEBUG_AMBER
|
||||||
render_num_renders -= 1;
|
render_num_renders -= 1;
|
||||||
@ -454,7 +454,7 @@ vips__render_shutdown( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
render_dirty_sort( Render *a, Render *b )
|
render_dirty_sort( Render *a, Render *b, void *user_data )
|
||||||
{
|
{
|
||||||
return( b->priority - a->priority );
|
return( b->priority - a->priority );
|
||||||
}
|
}
|
||||||
@ -504,7 +504,7 @@ tile_equal( gconstpointer a, gconstpointer b )
|
|||||||
rect1->top == rect2->top );
|
rect1->top == rect2->top );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static void
|
||||||
render_close_cb( VipsImage *image, Render *render )
|
render_close_cb( VipsImage *image, Render *render )
|
||||||
{
|
{
|
||||||
VIPS_DEBUG_MSG_AMBER( "render_close_cb\n" );
|
VIPS_DEBUG_MSG_AMBER( "render_close_cb\n" );
|
||||||
@ -523,8 +523,6 @@ render_close_cb( VipsImage *image, Render *render )
|
|||||||
*/
|
*/
|
||||||
VIPS_DEBUG_MSG_GREEN( "render_close_cb: reschedule\n" );
|
VIPS_DEBUG_MSG_GREEN( "render_close_cb: reschedule\n" );
|
||||||
render_reschedule = TRUE;
|
render_reschedule = TRUE;
|
||||||
|
|
||||||
return( 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Render *
|
static Render *
|
||||||
@ -617,7 +615,7 @@ tile_new( Render *render )
|
|||||||
tile->ticks = render->ticks;
|
tile->ticks = render->ticks;
|
||||||
|
|
||||||
if( !(tile->region = vips_region_new( render->in )) ) {
|
if( !(tile->region = vips_region_new( render->in )) ) {
|
||||||
(void) tile_free( tile );
|
(void) tile_free( tile, NULL, NULL );
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1000,9 +1000,8 @@ vips_source_map( VipsSource *source, size_t *length_out )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vips_source_map_cb( void *a, void *b )
|
vips_source_map_cb( void *a, VipsArea *area )
|
||||||
{
|
{
|
||||||
VipsArea *area = VIPS_AREA( b );
|
|
||||||
GObject *gobject = G_OBJECT( area->client );
|
GObject *gobject = G_OBJECT( area->client );
|
||||||
|
|
||||||
VIPS_UNREF( gobject );
|
VIPS_UNREF( gobject );
|
||||||
@ -1027,7 +1026,8 @@ vips_source_map_blob( VipsSource *source )
|
|||||||
VipsBlob *blob;
|
VipsBlob *blob;
|
||||||
|
|
||||||
if( !(buf = vips_source_map( source, &len )) ||
|
if( !(buf = vips_source_map( source, &len )) ||
|
||||||
!(blob = vips_blob_new( vips_source_map_cb, buf, len )) )
|
!(blob = vips_blob_new( (VipsCallbackFn) vips_source_map_cb,
|
||||||
|
buf, len )) )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
|
|
||||||
/* The source must stay alive until the blob is done.
|
/* The source must stay alive until the blob is done.
|
||||||
|
@ -413,7 +413,7 @@ vips_target_finish( VipsTarget *target )
|
|||||||
data = g_byte_array_free( target->memory_buffer, FALSE );
|
data = g_byte_array_free( target->memory_buffer, FALSE );
|
||||||
target->memory_buffer = NULL;
|
target->memory_buffer = NULL;
|
||||||
vips_blob_set( target->blob,
|
vips_blob_set( target->blob,
|
||||||
(VipsCallbackFn) g_free, data, length );
|
(VipsCallbackFn) vips_area_free_cb, data, length );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
class->finish( target );
|
class->finish( target );
|
||||||
|
@ -171,6 +171,14 @@ vips_area_copy( VipsArea *area )
|
|||||||
return( area );
|
return( area );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
vips_area_free_cb( void *mem, VipsArea *area )
|
||||||
|
{
|
||||||
|
g_free( mem );
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
vips_area_free( VipsArea *area )
|
vips_area_free( VipsArea *area )
|
||||||
{
|
{
|
||||||
@ -314,7 +322,7 @@ vips_area_new_array( GType type, size_t sizeof_type, int n )
|
|||||||
void *array;
|
void *array;
|
||||||
|
|
||||||
array = g_malloc( n * sizeof_type );
|
array = g_malloc( n * sizeof_type );
|
||||||
area = vips_area_new( (VipsCallbackFn) g_free, array );
|
area = vips_area_new( (VipsCallbackFn) vips_area_free_cb, array );
|
||||||
area->n = n;
|
area->n = n;
|
||||||
area->length = n * sizeof_type;
|
area->length = n * sizeof_type;
|
||||||
area->type = type;
|
area->type = type;
|
||||||
@ -323,7 +331,7 @@ vips_area_new_array( GType type, size_t sizeof_type, int n )
|
|||||||
return( area );
|
return( area );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
vips_area_free_array_object( GObject **array, VipsArea *area )
|
vips_area_free_array_object( GObject **array, VipsArea *area )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@ -333,6 +341,8 @@ vips_area_free_array_object( GObject **array, VipsArea *area )
|
|||||||
VIPS_FREE( array );
|
VIPS_FREE( array );
|
||||||
|
|
||||||
area->n = 0;
|
area->n = 0;
|
||||||
|
|
||||||
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -556,7 +566,7 @@ vips_ref_string_new( const char *str )
|
|||||||
if( !g_utf8_validate( str, -1, NULL ) )
|
if( !g_utf8_validate( str, -1, NULL ) )
|
||||||
str = "<invalid utf-8 string>";
|
str = "<invalid utf-8 string>";
|
||||||
|
|
||||||
area = vips_area_new( (VipsCallbackFn) g_free, g_strdup( str ) );
|
area = vips_area_new( (VipsCallbackFn) vips_area_free_cb, g_strdup( str ) );
|
||||||
|
|
||||||
/* Handy place to cache this.
|
/* Handy place to cache this.
|
||||||
*/
|
*/
|
||||||
@ -655,7 +665,7 @@ vips_blob_copy( const void *data, size_t length )
|
|||||||
|
|
||||||
data_copy = vips_malloc( NULL, length );
|
data_copy = vips_malloc( NULL, length );
|
||||||
memcpy( data_copy, data, length );
|
memcpy( data_copy, data, length );
|
||||||
area = vips_area_new( (VipsCallbackFn) g_free, data_copy );
|
area = vips_area_new( (VipsCallbackFn) vips_area_free_cb, data_copy );
|
||||||
area->length = length;
|
area->length = length;
|
||||||
|
|
||||||
return( (VipsBlob *) area );
|
return( (VipsBlob *) area );
|
||||||
@ -737,7 +747,7 @@ transform_blob_save_string( const GValue *src_value, GValue *dest_value )
|
|||||||
blob = vips_value_get_blob( src_value, &length );
|
blob = vips_value_get_blob( src_value, &length );
|
||||||
if( (b64 = g_base64_encode( blob, length )) ) {
|
if( (b64 = g_base64_encode( blob, length )) ) {
|
||||||
vips_value_set_save_string( dest_value, b64 );
|
vips_value_set_save_string( dest_value, b64 );
|
||||||
vips_free( b64 );
|
g_free( b64 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
/* No error return from transform, but we should set it to
|
/* No error return from transform, but we should set it to
|
||||||
@ -756,7 +766,7 @@ transform_save_string_blob( const GValue *src_value, GValue *dest_value )
|
|||||||
b64 = vips_value_get_save_string( src_value );
|
b64 = vips_value_get_save_string( src_value );
|
||||||
if( (blob = g_base64_decode( b64, &length )) )
|
if( (blob = g_base64_decode( b64, &length )) )
|
||||||
vips_value_set_blob( dest_value,
|
vips_value_set_blob( dest_value,
|
||||||
(VipsCallbackFn) vips_free, blob, length );
|
(VipsCallbackFn) vips_area_free_cb, blob, length );
|
||||||
else
|
else
|
||||||
/* No error return from transform, but we should set it to
|
/* No error return from transform, but we should set it to
|
||||||
* something.
|
* something.
|
||||||
@ -1641,7 +1651,7 @@ vips_value_set_blob_free( GValue *value, void *data, size_t length )
|
|||||||
|
|
||||||
g_assert( G_VALUE_TYPE( value ) == VIPS_TYPE_BLOB );
|
g_assert( G_VALUE_TYPE( value ) == VIPS_TYPE_BLOB );
|
||||||
|
|
||||||
blob = vips_blob_new( (VipsCallbackFn) g_free, data, length );
|
blob = vips_blob_new( (VipsCallbackFn) vips_area_free_cb, data, length );
|
||||||
g_value_set_boxed( value, blob );
|
g_value_set_boxed( value, blob );
|
||||||
vips_area_unref( VIPS_AREA( blob ) );
|
vips_area_unref( VIPS_AREA( blob ) );
|
||||||
}
|
}
|
||||||
|
@ -222,10 +222,10 @@ vips_slist_filter( GSList *list, VipsSListMap2Fn fn, void *a, void *b )
|
|||||||
static void
|
static void
|
||||||
vips_slist_free_all_cb( void * thing, void * dummy )
|
vips_slist_free_all_cb( void * thing, void * dummy )
|
||||||
{
|
{
|
||||||
vips_free( thing );
|
g_free( thing );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free a g_slist of things which need vips_free()ing.
|
/* Free a g_slist of things which need g_free()ing.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
vips_slist_free_all( GSList *list )
|
vips_slist_free_all( GSList *list )
|
||||||
@ -815,7 +815,7 @@ vips__file_read( FILE *fp, const char *filename, size_t *length_out )
|
|||||||
rewind( fp );
|
rewind( fp );
|
||||||
read = fread( str, sizeof( char ), (size_t) len, fp );
|
read = fread( str, sizeof( char ), (size_t) len, fp );
|
||||||
if( read != (size_t) len ) {
|
if( read != (size_t) len ) {
|
||||||
vips_free( str );
|
g_free( str );
|
||||||
vips_error( "vips__file_read",
|
vips_error( "vips__file_read",
|
||||||
_( "error reading from file \"%s\"" ),
|
_( "error reading from file \"%s\"" ),
|
||||||
filename );
|
filename );
|
||||||
@ -944,7 +944,7 @@ vips__gvalue_copy( GValue *value )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vips__gvalue_free( GValue *value )
|
vips__gvalue_free( GValue *value, void *user_data )
|
||||||
{
|
{
|
||||||
g_value_unset( value );
|
g_value_unset( value );
|
||||||
g_free( value );
|
g_free( value );
|
||||||
@ -2031,7 +2031,7 @@ vips__icc_dir( void )
|
|||||||
static GOnce once = G_ONCE_INIT;
|
static GOnce once = G_ONCE_INIT;
|
||||||
|
|
||||||
return( (const char *) g_once( &once,
|
return( (const char *) g_once( &once,
|
||||||
(GThreadFunc) vips_icc_dir_once, NULL ) );
|
vips_icc_dir_once, NULL ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef OS_WIN32
|
#ifdef OS_WIN32
|
||||||
@ -2069,7 +2069,7 @@ vips__windows_prefix( void )
|
|||||||
static GOnce once = G_ONCE_INIT;
|
static GOnce once = G_ONCE_INIT;
|
||||||
|
|
||||||
return( (const char *) g_once( &once,
|
return( (const char *) g_once( &once,
|
||||||
(GThreadFunc) vips__windows_prefix_once, NULL ) );
|
vips__windows_prefix_once, NULL ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
@ -490,7 +490,7 @@ read_chunk( int fd, gint64 offset, size_t length )
|
|||||||
if( !(buf = vips_malloc( NULL, length + 1 )) )
|
if( !(buf = vips_malloc( NULL, length + 1 )) )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
if( read( fd, buf, length ) != (ssize_t) length ) {
|
if( read( fd, buf, length ) != (ssize_t) length ) {
|
||||||
vips_free( buf );
|
g_free( buf );
|
||||||
vips_error( "VipsImage", "%s", _( "unable to read history" ) );
|
vips_error( "VipsImage", "%s", _( "unable to read history" ) );
|
||||||
return( NULL );
|
return( NULL );
|
||||||
}
|
}
|
||||||
@ -828,7 +828,7 @@ target_write_quotes( VipsTarget *target, const char *str )
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
build_xml_meta( VipsMeta *meta, VipsTarget *target )
|
build_xml_meta( VipsMeta *meta, VipsTarget *target, void *b )
|
||||||
{
|
{
|
||||||
GType type = G_VALUE_TYPE( &meta->value );
|
GType type = G_VALUE_TYPE( &meta->value );
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ vips_window_free( VipsWindow *window )
|
|||||||
|
|
||||||
window->im = NULL;
|
window->im = NULL;
|
||||||
|
|
||||||
vips_free( window );
|
g_free( window );
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
@ -307,7 +307,7 @@ typedef struct {
|
|||||||
} request_t;
|
} request_t;
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
vips_window_fits( VipsWindow *window, request_t *req )
|
vips_window_fits( VipsWindow *window, request_t *req, void *b )
|
||||||
{
|
{
|
||||||
if( window->top <= req->top &&
|
if( window->top <= req->top &&
|
||||||
window->top + window->height >= req->top + req->height )
|
window->top + window->height >= req->top + req->height )
|
||||||
|
Loading…
Reference in New Issue
Block a user