From e9414f8d8f90e7966e3802273e2aa46f67016616 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Mon, 20 Jun 2022 13:19:35 +0100 Subject: [PATCH] fix build with older libgsf build on libgsf without zip64 support was broken, thanks @remicollet see https://github.com/libvips/libvips/issues/2878 --- libvips/foreign/dzsave.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/libvips/foreign/dzsave.c b/libvips/foreign/dzsave.c index 3480f4fb..296e9963 100644 --- a/libvips/foreign/dzsave.c +++ b/libvips/foreign/dzsave.c @@ -678,6 +678,21 @@ G_DEFINE_ABSTRACT_TYPE( VipsForeignSaveDz, vips_foreign_save_dz, #define VIPS_ZIP_EOCD_SIZE 22 #ifndef HAVE_GSF_ZIP64 +/* ZIP and SZI are both written as zip files. + */ +static gboolean +iszip( VipsForeignDzContainer container ) +{ + switch( container ) { + case VIPS_FOREIGN_DZ_CONTAINER_ZIP: + case VIPS_FOREIGN_DZ_CONTAINER_SZI: + return( TRUE ); + + default: + return( FALSE ); + } +} + static size_t estimate_zip_size( VipsForeignSaveDz *dz ) { @@ -744,7 +759,7 @@ write_image( VipsForeignSaveDz *dz, gsf_output_close( out ); #ifndef HAVE_GSF_ZIP64 - if( iszip( dz->container ) ) { + if( iszip( dz->container ) ) { /* Leave 3 entry headroom for blank.png and metadata files. */ if( dz->tree->file_count + 3 >= (unsigned int) USHRT_MAX ) {