Fix `dzsave_target` for ZIP output (#2927)

This commit is contained in:
Kleis Auke Wolthuizen 2022-07-15 20:39:56 +02:00 committed by GitHub
parent 1bf1a32f2c
commit d546c81fa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -248,9 +248,30 @@ gsf_output_target_write( GsfOutput *output,
static gboolean
gsf_output_target_seek( GsfOutput *output, gsf_off_t offset, GSeekType whence )
{
#ifdef HAVE_GSF_ZIP64
/* No seek needed.
*/
return( FALSE );
#else
GsfOutputTarget *output_target = (GsfOutputTarget *) output;
int stdio_whence;
switch( whence ) {
case G_SEEK_CUR: stdio_whence = SEEK_CUR; break;
case G_SEEK_END: stdio_whence = SEEK_END; break;
case G_SEEK_SET: stdio_whence = SEEK_SET; break;
default:
g_assert_not_reached();
}
if( vips_target_seek( output_target->target,
offset, stdio_whence ) == -1 )
return( FALSE );
/* This will make our parent class handle the seek.
*/
return( TRUE );
#endif
}
static void

View File

@ -569,7 +569,7 @@ vips_target_read( VipsTarget *target, void *buffer, size_t length )
* Seeking a target sounds weird, but libtiff needs this. This method will
* fail for targets like pipes.
*
* Returns: 0 on success, -1 on error.
* Returns: the new seek position, -1 on error.
*/
off_t
vips_target_seek( VipsTarget *target, off_t position, int whence )