allow vips images to have a missing XML block
This commit is contained in:
parent
162e224186
commit
8c4abf7c42
8
TODO
8
TODO
@ -1,11 +1,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
- VIPS_META_SEQUENTIAL will be saved to vips files, then loaded back again argh
|
- VIPS_META_SEQUENTIAL will be saved to vips files, then loaded back again argh
|
||||||
|
|
||||||
we need to set a value that can't be saved
|
we need to set a value that can't be saved
|
||||||
|
|
||||||
do we need a seq cache for reducev as well? we could have up to a 3x
|
maybe a NULL boxed pointer?
|
||||||
|
|
||||||
|
looks like vips_image_set_area(im, "poop", NULL, NULL); might work
|
||||||
|
|
||||||
|
- do we need a seq cache for reducev as well? we could have up to a 3x
|
||||||
reduction there
|
reduction there
|
||||||
|
|
||||||
|
|
||||||
|
@ -464,6 +464,9 @@ parser_read_fd( XML_Parser parser, int fd )
|
|||||||
const int chunk_size = 1024;
|
const int chunk_size = 1024;
|
||||||
|
|
||||||
ssize_t bytes_read;
|
ssize_t bytes_read;
|
||||||
|
ssize_t len;
|
||||||
|
|
||||||
|
bytes_read = 0;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
void *buf;
|
void *buf;
|
||||||
@ -473,19 +476,25 @@ parser_read_fd( XML_Parser parser, int fd )
|
|||||||
"%s", _( "unable to allocate read buffer" ) );
|
"%s", _( "unable to allocate read buffer" ) );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
bytes_read = read( fd, buf, chunk_size );
|
len = read( fd, buf, chunk_size );
|
||||||
if( bytes_read == (ssize_t) -1 ) {
|
if( len == (ssize_t) -1 ) {
|
||||||
vips_error( "VipsImage",
|
vips_error( "VipsImage",
|
||||||
"%s", _( "read error while fetching XML" ) );
|
"%s", _( "read error while fetching XML" ) );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !XML_ParseBuffer( parser, bytes_read, bytes_read == 0 ) ) {
|
/* Allow missing XML block.
|
||||||
vips_error( "VipsImage",
|
*/
|
||||||
"%s", _( "XML parse error" ) );
|
if( bytes_read == 0 &&
|
||||||
|
len == 0 )
|
||||||
|
break;
|
||||||
|
bytes_read += len;
|
||||||
|
|
||||||
|
if( !XML_ParseBuffer( parser, len, len == 0 ) ) {
|
||||||
|
vips_error( "VipsImage", "%s", _( "XML parse error" ) );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
} while( bytes_read > 0 );
|
} while( len > 0 );
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
@ -993,7 +1002,8 @@ vips_image_open_input( VipsImage *image )
|
|||||||
* harmless.
|
* harmless.
|
||||||
*/
|
*/
|
||||||
if( readhist( image ) ) {
|
if( readhist( image ) ) {
|
||||||
g_warning( _( "error reading XML: %s" ), vips_error_buffer() );
|
g_warning( _( "error reading vips image metadata: %s" ),
|
||||||
|
vips_error_buffer() );
|
||||||
vips_error_clear();
|
vips_error_clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user