more hacking on gio warnings

all the serious ones seem to be fixed now
This commit is contained in:
John Cupitt 2012-01-01 12:04:46 +00:00
parent d0ec401a12
commit 7ae919e4f4
13 changed files with 166 additions and 87 deletions

25
TODO
View File

@ -1,26 +1,13 @@
- remaining warnings
include/vips/type.h:99: Warning: Vips: vips_value_get_area: return value: Missing (transfer) annotation
include/vips/type.h:98: Warning: Vips: vips_value_set_area: argument free_fn: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async)
include/vips/type.h:137: Warning: Vips: vips_value_get_array: return value: Missing (transfer) annotation
include/vips/type.h:156: Warning: Vips: vips_value_get_array_object: return value: Missing (transfer) annotation
include/vips/type.h:86: Warning: Vips: vips_area_new: argument free_fn: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async)
include/vips/type.h:87: Warning: Vips: vips_area_new_blob: argument free_fn: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async)
include/vips/type.h:156: Warning: Vips: vips_value_get_array_object: return
value: Missing (transfer) annotation
include/vips/operation.h:81: Warning: Vips: vips_operation_class_print_usage:
argument operation_class: Unresolved type: 'VipsOperationClass*'
foreign/foreign.c:383: Warning: Vips: vips_foreign_map: argument fn:
Unresolved type: 'VipsSListMap2Fn'
iofuncs/type.c:518: Warning: Vips: vips_value_get_blob: return value: Missing (transfer) annotation
iofuncs/type.c:471: Warning: Vips: vips_value_set_blob: argument free_fn: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async)
iofuncs/header.c:921: Warning: Vips: vips_image_set_area: argument free_fn: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async)
iofuncs/header.c:993: Warning: Vips: vips_image_set_blob: argument free_fn: Missing (scope) annotation for callback without GDestroyNotify (valid: call, async)
include/vips/object.h:273: Warning: Vips: vips__argument_table_lookup: return value: Unresolved type: 'VipsArgument*'
include/vips/operation.h:81: Warning: Vips: vips_operation_class_print_usage: argument operation_class: Unresolved type: 'VipsOperationClass*'
foreign/foreign.c:383: Warning: Vips: vips_foreign_map: argument fn: Unresolved type: 'VipsSListMap2Fn'
foreign/foreign.c:399: Warning: Vips: vips_foreign_map: return value: Missing (transfer) annotation
conversion/im_system_image.c:129: Warning: Vips: im_system_image: return value: Missing (transfer) annotation

View File

@ -55,8 +55,7 @@ vips_introspection_sources="$introspection_sources2"
# add headers that form the public vips8 API .. don't do a find and exclude,
# we end up excluding almost everything argh
headers="vips.h object.h image.h error.h foreign.h interpolate.h header.h
operation.h enumtypes.h arithmetic.h conversion.h type.h"
headers="basic.h vips.h object.h image.h error.h foreign.h interpolate.h header.h operation.h enumtypes.h arithmetic.h conversion.h type.h"
for name in $headers; do
vips_introspection_sources="$vips_introspection_sources include/vips/$name"
done

View File

@ -126,7 +126,7 @@ system_image( IMAGE *im,
*
* See also: im_system().
*
* Returns: an image on success, NULL on error
* Returns: (transfer full): an image on success, NULL on error
*/
IMAGE *
im_system_image( IMAGE *im,

View File

@ -383,7 +383,7 @@ file_compare( VipsForeignClass *a, VipsForeignClass *b )
/**
* vips_foreign_map:
* @base: base class to search below (eg. "VipsForeignLoad")
* @fn: function to apply to each #VipsForeignClass
* @fn: (scope call): function to apply to each #VipsForeignClass
* @a: user data
* @b: user data
*
@ -396,7 +396,7 @@ file_compare( VipsForeignClass *a, VipsForeignClass *b )
*
* See also: vips_slist_map().
*
* Returns: the result of iteration
* Returns: (transfer none): the result of iteration
*/
void *
vips_foreign_map( const char *base, VipsSListMap2Fn fn, void *a, void *b )

View File

@ -1,4 +1,5 @@
pkginclude_HEADERS = \
basic.h \
type.h \
almostdeprecated.h \
deprecated.h \

View File

@ -0,0 +1,63 @@
/* A few basic types needed everywhere.
*
* 27/10/11
* - from type.h
*/
/*
This file is part of VIPS.
VIPS is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
#ifndef VIPS_BASIC_H
#define VIPS_BASIC_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
/**
* VipsPel:
*
* A picture element. Cast this to whatever the associated VipsBandFormat says
* to get the value.
*/
typedef unsigned char VipsPel;
/* Also used for eg. vips_local() and friends.
*/
typedef int (*VipsCallbackFn)( void *a, void *b );
/* Like GFunc, but return a value.
*/
typedef void *(*VipsSListMap2Fn)( void *, void *, void * );
typedef void *(*VipsSListMap4Fn)( void *, void *, void *, void *, void * );
typedef void *(*VipsSListFold2Fn)( void *, void *, void *, void * );
#ifdef __cplusplus
}
#endif /*__cplusplus*/
#endif /*VIPS_BASIC_H*/

View File

@ -1,4 +1,4 @@
/* area.h
/* the GTypes we define
*
* 27/10/11
* - from header.h
@ -30,25 +30,13 @@
*/
#ifndef VIPS_AREA_H
#define VIPS_AREA_H
#ifndef VIPS_TYPE_H
#define VIPS_TYPE_H
#ifdef __cplusplus
extern "C" {
#endif /*__cplusplus*/
/**
* VipsPel:
*
* A picture element. Cast this to whatever the associated VipsBandFormat says
* to get the value.
*/
typedef unsigned char VipsPel;
/* Also used for eg. vips_local() and friends.
*/
typedef int (*VipsCallbackFn)( void *a, void *b );
/* A ref-counted area of memory. Can hold arrays of things as well.
*/
typedef struct _VipsArea {
@ -95,7 +83,7 @@ VipsArea *vips_area_new_array_object( int n );
* The #GType for a #vips_area.
*/
#define VIPS_TYPE_AREA (vips_area_get_type())
int vips_value_set_area( GValue *value, VipsCallbackFn free_fn, void *data );
void vips_value_set_area( GValue *value, VipsCallbackFn free_fn, void *data );
void *vips_value_get_area( const GValue *value, size_t *length );
GType vips_area_get_type( void );
@ -128,12 +116,12 @@ GType vips_ref_string_get_type( void );
*/
#define VIPS_TYPE_BLOB (vips_blob_get_type())
void *vips_value_get_blob( const GValue *value, size_t *length );
int vips_value_set_blob( GValue *value,
void vips_value_set_blob( GValue *value,
VipsCallbackFn free_fn, void *data, size_t length );
GType vips_blob_get_type( void );
int vips_value_set_array( GValue *value,
GType type, size_t sizeof_type, int n );
void vips_value_set_array( GValue *value,
int n, GType type, size_t sizeof_type );
void *vips_value_get_array( const GValue *value,
int *n, GType *type, size_t *sizeof_type );
@ -163,4 +151,4 @@ void vips__meta_init_types( void );
}
#endif /*__cplusplus*/
#endif /*VIPS_AREA_H*/
#endif /*VIPS_TYPE_H*/

View File

@ -155,12 +155,6 @@ G_STMT_START { \
#define VIPS_ENUM_NICK( ENUM, VALUE ) \
(g_enum_get_value( g_type_class_ref( ENUM ), VALUE )->value_nick)
/* Like GFunc, but return a value.
*/
typedef void *(*VipsSListMap2Fn)( void *, void *, void * );
typedef void *(*VipsSListMap4Fn)( void *, void *, void *, void *, void * );
typedef void *(*VipsSListFold2Fn)( void *, void *, void *, void * );
gboolean vips_slist_equal( GSList *l1, GSList *l2 );
void *vips_slist_map2( GSList *list, VipsSListMap2Fn fn, void *a, void *b );
void *vips_slist_map2_rev( GSList *list, VipsSListMap2Fn fn, void *a, void *b );

View File

@ -94,6 +94,8 @@ extern "C" {
# endif
#endif /*SWIG*/
#include <vips/basic.h>
#include <vips/buf.h>
#include <vips/util.h>
#include <vips/object.h>

View File

@ -922,7 +922,7 @@ vips_image_map( VipsImage *image, VipsImageMapFn fn, void *a )
* vips_image_set_area:
* @image: image to attach the metadata to
* @field: metadata name
* @free_fn: free function for @data
* @free_fn: (scope async): free function for @data
* @data: pointer to area of memory
*
* Attaches @data as a metadata item on @image under the name @field. When
@ -994,7 +994,7 @@ vips_image_get_area( VipsImage *image, const char *field, void **data )
* vips_image_set_blob:
* @image: image to attach the metadata to
* @field: metadata name
* @free_fn: free function for @data
* @free_fn: (scope async): free function for @data
* @data: pointer to area of memory
* @length: length of memory area
*

View File

@ -287,6 +287,10 @@ vips_argument_instance_free( VipsArgumentInstance *argument_instance )
/**
* vips__argument_table_lookup: (skip)
* @table: table to search
* @pspec: spec to search for
*
* Find the #VipsArgument for a @pspec.
*/
VipsArgument *
vips__argument_table_lookup( VipsArgumentTable *table, GParamSpec *pspec )

View File

@ -209,6 +209,12 @@ vips_operation_init( VipsOperation *operation )
*/
}
/**
* vips_operation_class_print_usage: (skip)
* @operation_class: class to print usage for
*
* Print a usage message for the operation to stdout.
*/
void
vips_operation_class_print_usage( VipsOperationClass *operation_class )
{

View File

@ -112,7 +112,10 @@ vips_area_unref( VipsArea *area )
}
}
/* An area of mem with a free func. (eg. \0-terminated string, or a struct).
/**
* vips_area_new: (skip)
*
* An area of mem with a free func. (eg. \0-terminated string, or a struct).
* Inital count == 1, so _unref() after attaching somewhere.
*/
VipsArea *
@ -137,7 +140,10 @@ vips_area_new( VipsCallbackFn free_fn, void *data )
return( area );
}
/* An area of mem with a free func and a length (some sort of binary object,
/**
* vips_area_new_blob: (skip)
*
* An area of mem with a free func and a length (some sort of binary object,
* like an ICC profile).
*/
VipsArea *
@ -200,9 +206,15 @@ vips_area_new_array_object( int n )
return( area );
}
/* Set value to be a ref-counted area of memory with a free function.
/**
* vips_value_set_area:
* @value: set this value
* @free_fn: (scope async): data will be freed with this function
* @data: set @value to track this pointer
*
* Set value to be a ref-counted area of memory with a free function.
*/
int
void
vips_value_set_area( GValue *value, VipsCallbackFn free_fn, void *data )
{
VipsArea *area;
@ -211,11 +223,16 @@ vips_value_set_area( GValue *value, VipsCallbackFn free_fn, void *data )
g_value_init( value, VIPS_TYPE_AREA );
g_value_set_boxed( value, area );
vips_area_unref( area );
return( 0 );
}
/* Don't touch count (area is static).
/**
* vips_value_get_area:
* @value: get from this value
* @length: (allow-none): optionally return length here
*
* Get the pointer from an area. Don't touch count (area is static).
*
* Returns: (transfer none): The pointer held by @value.
*/
void *
vips_value_get_area( const GValue *value, size_t *length )
@ -265,7 +282,7 @@ vips_area_get_type( void )
*
* Get the C string held internally by the GValue.
*
* Returns: The C string held by @value. This must not be freed.
* Returns: (transfer none): The C string held by @value.
*/
const char *
vips_value_get_save_string( const GValue *value )
@ -367,12 +384,12 @@ vips_save_string_get_type( void )
/**
* vips_value_get_ref_string:
* @value: #GValue to get from
* @length: return length here, optionally
* @value: %GValue to get from
* @length: (allow-none): return length here, optionally
*
* Get the C string held internally by the GValue.
*
* Returns: (transfer none): the C string held by @value.
* Returns: (transfer none): The C string held by @value.
*/
const char *
vips_value_get_ref_string( const GValue *value, size_t *length )
@ -471,7 +488,7 @@ vips_ref_string_get_type( void )
/**
* vips_value_set_blob:
* @value: GValue to set
* @free_fn: free function for @data
* @free_fn: (scope async): free function for @data
* @data: pointer to area of memory
* @length: length of memory area
*
@ -484,10 +501,8 @@ vips_ref_string_get_type( void )
* copied by copying reference-counted pointers.
*
* See also: vips_value_get_blob()
*
* Returns: 0 on success, -1 otherwise.
*/
int
void
vips_value_set_blob( GValue *value,
VipsCallbackFn free_fn, void *data, size_t length )
{
@ -498,14 +513,12 @@ vips_value_set_blob( GValue *value,
area = vips_area_new_blob( free_fn, data, length );
g_value_set_boxed( value, area );
vips_area_unref( area );
return( 0 );
}
/**
* vips_value_get_blob:
* @value: GValue to set
* @length: (out): optionally return length of memory area
* @length: (allow-none): optionally return length of memory area
*
* Returns the data pointer from a blob. Optionally returns the length too.
*
@ -515,7 +528,7 @@ vips_value_set_blob( GValue *value,
*
* See also: vips_value_set_blob()
*
* Returns: (transfer none): a pointer to the area
* Returns: (transfer none): The pointer held by @value.
*/
void *
vips_value_get_blob( const GValue *value, size_t *length )
@ -587,21 +600,43 @@ vips_blob_get_type( void )
return( type );
}
/* Set value to be an array of things. Don't initialise the contents: get the
* pointer and write instead.
/**
* vips_value_set_array:
* @value: %GValue to set
* @n: number of elements
* @type: the type of each element
* @sizeof_type: the sizeof each element
*
* Set @value to be an array of things.
*
* This allocates memory but does not
* initialise the contents: get the pointer and write instead.
*/
int
vips_value_set_array( GValue *value, GType type, size_t sizeof_type, int n )
void
vips_value_set_array( GValue *value, int n, GType type, size_t sizeof_type )
{
VipsArea *area;
area = vips_area_new_array( type, sizeof_type, n );
g_value_set_boxed( value, area );
vips_area_unref( area );
return( 0 );
}
/**
* vips_value_get_array:
* @value: %GValue to get from
* @n: (allow-none): return the number of elements here, optionally
* @type: (allow-none): return the type of each element here, optionally
* @sizeof_type: (allow-none): return the sizeof each element here, optionally
*
* Return the pointer to the array held by @value.
* Optionally return the other properties of the array in @n, @type,
* @sizeof_type.
*
* See also: vips_value_set_array().
*
* Returns: (transfer none): The array address.
*/
void *
vips_value_get_array( const GValue *value,
int *n, GType *type, size_t *sizeof_type )
@ -625,8 +660,8 @@ vips_value_get_array( const GValue *value,
/**
* vips_value_get_array_double:
* @value: #GValue to get from
* @n: return the number of elements here, optionally
* @value: %GValue to get from
* @n: (allow-none): return the number of elements here, optionally
*
* Return the start of the array of doubles held by @value.
* optionally return the number of elements in @n.
@ -643,7 +678,7 @@ vips_value_get_array_double( const GValue *value, int *n )
/**
* vips_value_set_array_double:
* @value: #GValue to get from
* @value: %GValue to get from
* @array: array of doubles
* @n: the number of elements
*
@ -659,7 +694,7 @@ vips_value_set_array_double( GValue *value, const double *array, int n )
double *array_copy;
g_value_init( value, VIPS_TYPE_ARRAY_DOUBLE );
vips_value_set_array( value, G_TYPE_DOUBLE, sizeof( double ), n );
vips_value_set_array( value, n, G_TYPE_DOUBLE, sizeof( double ) );
array_copy = vips_value_get_array_double( value, NULL );
memcpy( array_copy, array, n * sizeof( double ) );
@ -710,7 +745,7 @@ transform_g_string_array_double( const GValue *src_value, GValue *dest_value )
n += 1;
g_free( str );
vips_value_set_array( dest_value, G_TYPE_DOUBLE, sizeof( double ), n );
vips_value_set_array( dest_value, n, G_TYPE_DOUBLE, sizeof( double ) );
array = (double *) vips_value_get_array( dest_value, NULL, NULL, NULL );
str = g_value_dup_string( src_value );
@ -739,11 +774,11 @@ vips_array_double_get_type( void )
}
/**
* vips_array_object_get:
* @value: #GValue to get from
* @n: return the number of elements here, optionally
* vips_array_object_get: (skip)
* @value: %GValue to get from
* @n: (allow-none): return the number of elements here, optionally
*
* Return the start of the array of #GObject held by @value.
* Return the start of the array of %GObject held by @value.
* optionally return the number of elements in @n.
*
* See also: vips_array_object_set().
@ -758,7 +793,7 @@ vips_value_get_array_object( const GValue *value, int *n )
/**
* vips_array_object_set:
* @value: #GValue to set
* @value: %GValue to set
* @n: the number of elements
*
* Set @value to hold an array of GObject. Pass in the array length in @n.