From 748a99d245a1ac84e88c4060342b26bd71a5aaa3 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 21 Jun 2022 19:07:35 +0100 Subject: [PATCH] reorder Target struct to improve compat so fields are at the same position at least see https://github.com/libvips/libvips/issues/2880 --- libvips/include/vips/connection.h | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/libvips/include/vips/connection.h b/libvips/include/vips/connection.h index f3dc07e9..47da0ec9 100644 --- a/libvips/include/vips/connection.h +++ b/libvips/include/vips/connection.h @@ -412,11 +412,11 @@ struct _VipsTarget { */ gboolean ended; - /* Write memory output and track write point here. We use a GString - * rather than a GByteArray since we need eg. g_string_overwrite_len(). + /* Write memory output here. We use a GString rather than a + * GByteArray since we need eg. g_string_overwrite_len(). + * @position tracks the current write position in this. */ GString *memory_buffer; - off_t position; /* And return memory via this blob. */ @@ -428,6 +428,10 @@ struct _VipsTarget { unsigned char output_buffer[VIPS_TARGET_BUFFER_SIZE]; int write_point; + /* Write position in memory_buffer. + */ + off_t position; + /* Temp targets on the filesystem need deleting, sometimes. */ gboolean delete_on_close; @@ -445,6 +449,10 @@ typedef struct _VipsTargetClass { */ gint64 (*write)( VipsTarget *, const void *, size_t ); + /* Deprecated in favour of ::end. + */ + void (*finish)( VipsTarget * ); + /* libtiff needs to be able to seek and read on targets, * unfortunately. * @@ -468,10 +476,6 @@ typedef struct _VipsTargetClass { */ int (*end)( VipsTarget * ); - /* Deprecated in favour of ::end. - */ - void (*finish)( VipsTarget * ); - } VipsTargetClass; VIPS_API @@ -547,10 +551,10 @@ typedef struct _VipsTargetCustomClass { */ gint64 (*write)( VipsTargetCustom *, const void *, gint64 ); + void (*finish)( VipsTargetCustom * ); gint64 (*read)( VipsTargetCustom *, void *, gint64 ); gint64 (*seek)( VipsTargetCustom *, gint64, int ); int (*end)( VipsTargetCustom * ); - void (*finish)( VipsTargetCustom * ); } VipsTargetCustomClass;