fix vips__ftruncate

We'd forgotton to update this for the new vips__seek return.

See https://github.com/libvips/libvips/issues/1494#issuecomment-569413267
This commit is contained in:
John Cupitt 2019-12-28 12:47:50 +00:00
parent 664796acab
commit 32d3ba2a50
2 changed files with 4 additions and 14 deletions

View File

@ -3056,7 +3056,8 @@ vips_image_isMSBfirst( VipsImage *image )
*
* Return %TRUE if @image represents a file on disc in some way.
*/
gboolean vips_image_isfile( VipsImage *image )
gboolean
vips_image_isfile( VipsImage *image )
{
switch( image->dtype ) {
case VIPS_IMAGE_MMAPIN:

View File

@ -1037,16 +1037,7 @@ vips__seek_no_error( int fd, gint64 pos, int whence )
#ifdef OS_WIN32
{
HANDLE hFile = (HANDLE) _get_osfhandle( fd );
LARGE_INTEGER p;
LARGE_INTEGER q;
/* Whence uses the same numbering on win32 and posix.
*/
p.QuadPart = pos;
if( !SetFilePointerEx( hFile, p, &q, whence ) )
return( -1 );
new_pos = q.QuadPart;
new_pos = _lseeki64( fd, pos, whence );
}
#else /*!OS_WIN32*/
new_pos = lseek( fd, pos, whence );
@ -1089,10 +1080,8 @@ vips__ftruncate( int fd, gint64 pos )
#ifdef OS_WIN32
{
HANDLE hFile = (HANDLE) _get_osfhandle( fd );
LARGE_INTEGER p;
p.QuadPart = pos;
if( vips__seek( fd, pos, SEEK_SET ) )
if( vips__seek( fd, pos, SEEK_SET ) == -1 )
return( -1 );
if( !SetEndOfFile( hFile ) ) {
vips_error_system( GetLastError(), "vips__ftruncate",