diff --git a/ChangeLog b/ChangeLog index e39cf239..2b4d3c7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ - improvements to configure for python - remove --disable-cxx configure flag - python imageize preserves interpretation +- fix dzsave as a target format 30/12/14 started 7.42.2 - C++ required output params were broken, thanks Lovell diff --git a/libvips/foreign/dzsave.c b/libvips/foreign/dzsave.c index 1d110271..7cc93eee 100644 --- a/libvips/foreign/dzsave.c +++ b/libvips/foreign/dzsave.c @@ -1734,12 +1734,12 @@ vips_foreign_save_dz_build( VipsObject *object ) { GsfOutput *out; GError *error = NULL; + char name[VIPS_PATH_MAX]; - /* We can't write to dirname: gsf_outfile_stdio_new() will - * make a dir called @arg1 to hold the things we make. - */ + vips_snprintf( name, VIPS_PATH_MAX, "%s/%s", + dz->dirname, dz->basename ); if( !(out = (GsfOutput *) - gsf_outfile_stdio_new( dz->name, &error )) ) { + gsf_outfile_stdio_new( name, &error )) ) { vips_g_error( &error ); return( -1 ); } @@ -1754,10 +1754,13 @@ vips_foreign_save_dz_build( VipsObject *object ) GsfOutput *zip; GsfOutput *out2; GError *error = NULL; + char name[VIPS_PATH_MAX]; /* This is the zip we are building. */ - if( !(out = gsf_output_stdio_new( dz->name, &error )) ) { + vips_snprintf( name, VIPS_PATH_MAX, "%s/%s.zip", + dz->dirname, dz->basename ); + if( !(out = gsf_output_stdio_new( name, &error )) ) { vips_g_error( &error ); return( -1 ); } diff --git a/test/test_formats.sh b/test/test_formats.sh index ee03ca45..427e2bc7 100755 --- a/test/test_formats.sh +++ b/test/test_formats.sh @@ -133,6 +133,26 @@ test_loader() { echo "ok" } +# a format for which we only have a saver (eg. dzsave) +# just run the operation and check exit status +test_saver() { + oper=$1 + in=$2 + suffix=$3 + + printf "testing $oper $(basename $in) $suffix ... " + + rm -rf $tmp/savertest* + cmd="$vips $oper $in $tmp/savertest$suffix" + if ! $cmd ; then + echo "error executing:" + echo " $cmd" + exit 1 + fi + + echo "ok" +} + # test for file format supported test_supported() { format=$1 @@ -192,5 +212,9 @@ if test_supported matload; then test_loader $matlab_ref $matlab matlab fi -# we have loaders but not savers for other formats, add tests here +if test_supported dzsave; then + test_saver dzsave $image .zip + test_saver copy $image .dz + test_saver copy $image .dz[container=zip] +fi