revise caching of seq mode loaders

We were not caching seq mode loaders used in random access mode.

see https://github.com/libvips/libvips/issues/3044
This commit is contained in:
John Cupitt 2022-09-20 10:03:00 +01:00
parent 6bf1422548
commit 907d17cd06
2 changed files with 8 additions and 10 deletions

View File

@ -2,6 +2,7 @@
- in dzsave, add add missing include directive for errno/EEXIST [kleisauke]
- fix 8 bit pallete PNG save [lovell]
- fix null string in buffer print [pclewis]
- revise caching of seq mode loaders [jcupitt]
24/7/22 started 8.13.1
- fix im7 feature detection in meson

View File

@ -1044,7 +1044,6 @@ vips_foreign_load_build( VipsObject *object )
VipsForeignLoadClass *fclass = VIPS_FOREIGN_LOAD_GET_CLASS( object );
VipsForeignFlags flags;
gboolean sequential;
#ifdef DEBUG
printf( "vips_foreign_load_build:\n" );
@ -1064,14 +1063,12 @@ vips_foreign_load_build( VipsObject *object )
g_object_set( load, "flags", flags, NULL );
/* Seq access has been requested, or the loader requires seq.
/* We must block caching of seq loaders running in seq mode. A seq
* loader in random mode is fine, since we'll read to ram or a temp
* file.
*/
sequential = (load->flags & VIPS_FOREIGN_SEQUENTIAL) ||
load->access != VIPS_ACCESS_RANDOM;
/* We must block caching of seq loads.
*/
if( sequential )
if( (load->flags & VIPS_FOREIGN_SEQUENTIAL) &&
load->access != VIPS_ACCESS_RANDOM )
load->nocache = TRUE;
/* The deprecated "fail" field sets fail_on warning.
@ -1134,9 +1131,9 @@ vips_foreign_load_build( VipsObject *object )
return( -1 );
}
/* Tell downstream if we are reading sequentially.
/* Tell downstream if seq mode was requested.
*/
if( sequential )
if( load->access != VIPS_ACCESS_RANDOM )
vips_image_set_int( load->out, VIPS_META_SEQUENTIAL, 1 );
return( 0 );