From a3394dc756cef8027e3de389481299db78a599bf Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 1 Jun 2018 23:01:33 +0100 Subject: [PATCH] fix webp metadata save with webpmux see https://github.com/jcupitt/libvips/pull/989 --- ChangeLog | 1 + libvips/foreign/vips2webp.c | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8f9fbdfc..410f6bba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ - strict round down on jpeg shrink on load [davidwood] - configure test for g++ 7.2 and composite.cpp - don't Ping in magickload, too unreliable +- ensure WebP can add metadata when compiled with libwebpmux [lovell] 12/2/18 started 8.6.3 - use pkg-config to find libjpeg, if we can diff --git a/libvips/foreign/vips2webp.c b/libvips/foreign/vips2webp.c index 3725e100..106d17f4 100644 --- a/libvips/foreign/vips2webp.c +++ b/libvips/foreign/vips2webp.c @@ -106,7 +106,7 @@ vips_webp_writer_init( VipsWebPWriter *writer ) writer->max_size = 0; } -static int +static gboolean vips_webp_writer_append( VipsWebPWriter *writer, const uint8_t *data, guint64 data_size ) { @@ -155,7 +155,7 @@ vips_webp_writer_append( VipsWebPWriter *writer, * lots of our tests start failing. */ #ifdef HAVE_LIBWEBPMUX -static int +static gboolean vips_webp_writer_appendle( VipsWebPWriter *writer, uint32_t val, int n ) { unsigned char buf[4]; @@ -171,19 +171,19 @@ vips_webp_writer_appendle( VipsWebPWriter *writer, uint32_t val, int n ) return( vips_webp_writer_append( writer, buf, n ) ); } -static int +static gboolean vips_webp_writer_appendle32( VipsWebPWriter *writer, uint32_t val ) { return( vips_webp_writer_appendle( writer, val, 4 ) ); } -static int +static gboolean vips_webp_writer_appendle24( VipsWebPWriter *writer, uint32_t val ) { return( vips_webp_writer_appendle( writer, val, 3 ) ); } -static int +static gboolean vips_webp_writer_appendcc( VipsWebPWriter *writer, const char buf[4] ) { return( vips_webp_writer_append( writer, (const uint8_t *) buf, 4 ) ); @@ -215,7 +215,7 @@ vips_webp_writer_unset( VipsWebPWriter *writer ) VIPS_FREE( writer->mem ); } -static int +static gboolean memory_write( const uint8_t *data, size_t data_size, const WebPPicture *picture ) { @@ -441,7 +441,7 @@ vips_webp_add_metadata( VipsWebPWriter *writer, VipsImage *image ) if( is_vp8x ) { /* Copy the existing VP8X body and update the flag bits. */ - if( vips_webp_writer_append( &new, writer->mem + 20, 10 ) ) { + if( !vips_webp_writer_append( &new, writer->mem + 20, 10 ) ) { vips_webp_writer_unset( &new ); return( -1 ); }