From 22e075d05a0ac6d66b284a97c269e3fdb146735f Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Thu, 4 Sep 2014 11:23:37 +0100 Subject: [PATCH] add const to vipsblob --- libvips/include/vips/type.h | 5 +++-- libvips/iofuncs/type.c | 6 +++--- python/vips8/vips.py | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libvips/include/vips/type.h b/libvips/include/vips/type.h index d8c0e2c8..e5f14e56 100644 --- a/libvips/include/vips/type.h +++ b/libvips/include/vips/type.h @@ -148,8 +148,9 @@ typedef struct _VipsBlob { VipsArea area; } VipsBlob; -VipsBlob *vips_blob_new( VipsCallbackFn free_fn, void *data, size_t size ); -void *vips_blob_get( VipsBlob *blob, size_t *size ); +VipsBlob *vips_blob_new( VipsCallbackFn free_fn, + const void *data, size_t size ); +const void *vips_blob_get( VipsBlob *blob, size_t *size ); GType vips_blob_get_type( void ); /** diff --git a/libvips/iofuncs/type.c b/libvips/iofuncs/type.c index f89d6a00..9d0a4a65 100644 --- a/libvips/iofuncs/type.c +++ b/libvips/iofuncs/type.c @@ -529,11 +529,11 @@ vips_ref_string_get_type( void ) * Returns: (transfer full): the new #VipsBlob. */ VipsBlob * -vips_blob_new( VipsCallbackFn free_fn, void *data, size_t size ) +vips_blob_new( VipsCallbackFn free_fn, const void *data, size_t size ) { VipsArea *area; - area = vips_area_new( free_fn, data ); + area = vips_area_new( free_fn, (void *) data ); area->length = size; return( (VipsBlob *) area ); @@ -550,7 +550,7 @@ vips_blob_new( VipsCallbackFn free_fn, void *data, size_t size ) * * Returns: (array length=size) (element-type guint8) (transfer none): the data */ -void * +const void * vips_blob_get( VipsBlob *blob, size_t *size ) { return( vips_area_get_data( VIPS_AREA( blob ), diff --git a/python/vips8/vips.py b/python/vips8/vips.py index 33a89fe0..3c15f399 100644 --- a/python/vips8/vips.py +++ b/python/vips8/vips.py @@ -83,8 +83,8 @@ class Argument: # turn VipsBlobs into strings # FIXME ... this will involve a copy, we should use # buffer() instead - if isinstance(value, Vips.Blob): - value = value.get() +# if isinstance(value, Vips.Blob): +# value = value.get() return value