Ensure that streams are properly read in spngload
This commit is contained in:
parent
6894159ad5
commit
0a91e2d8c7
@ -94,13 +94,18 @@ vips_foreign_load_png_stream( spng_ctx *ctx, void *user,
|
||||
{
|
||||
VipsSource *source = VIPS_SOURCE( user );
|
||||
|
||||
while( length > 0 ) {
|
||||
gint64 bytes_read;
|
||||
|
||||
bytes_read = vips_source_read( source, dest, length );
|
||||
if( bytes_read < 0 )
|
||||
return( SPNG_IO_ERROR );
|
||||
if( bytes_read < length )
|
||||
return( SPNG_IO_EOF);
|
||||
if( bytes_read == 0 )
|
||||
return( SPNG_IO_EOF );
|
||||
|
||||
dest += bytes_read;
|
||||
length -= bytes_read;
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user