route all fopen() though util.c
im__file_open_read() / _write() now have a text_mode flag, so we can use them everywhere and get rid of the last fopen() calls.
This commit is contained in:
parent
233cbf1f15
commit
b9760f7a02
BIN
libvips/format/.radiance.c.swp
Normal file
BIN
libvips/format/.radiance.c.swp
Normal file
Binary file not shown.
@ -700,7 +700,7 @@ jpeg2vips( const char *name, IMAGE *out, gboolean header_only )
|
||||
|
||||
/* Make input.
|
||||
*/
|
||||
if( !(fp = im__file_open_read( filename, NULL )) )
|
||||
if( !(fp = im__file_open_read( filename, NULL, FALSE )) )
|
||||
return( -1 );
|
||||
eman.fp = fp;
|
||||
jpeg_stdio_src( &cinfo, fp );
|
||||
|
@ -140,7 +140,7 @@ read_new( const char *name, IMAGE *out )
|
||||
read->row_pointer = NULL;
|
||||
read->data = NULL;
|
||||
|
||||
if( !(read->fp = im__file_open_read( name, NULL )) ) {
|
||||
if( !(read->fp = im__file_open_read( name, NULL, FALSE )) ) {
|
||||
read_destroy( read );
|
||||
return( NULL );
|
||||
}
|
||||
|
@ -419,7 +419,7 @@ ppm2vips_header( const char *filename, IMAGE *out )
|
||||
int ascii;
|
||||
int msb_first;
|
||||
|
||||
if( !(fp = im__file_open_read( filename, NULL )) )
|
||||
if( !(fp = im__file_open_read( filename, NULL, FALSE )) )
|
||||
return( -1 );
|
||||
if( read_header( fp, out, &bits, &ascii, &msb_first ) ) {
|
||||
fclose( fp );
|
||||
@ -442,7 +442,7 @@ isppmmmap( const char *filename )
|
||||
int ascii;
|
||||
int msb_first;
|
||||
|
||||
if( !(fp = im__file_open_read( filename, NULL )) )
|
||||
if( !(fp = im__file_open_read( filename, NULL, FALSE )) )
|
||||
return( -1 );
|
||||
|
||||
if( !(im = im_open( "temp", "p" )) ) {
|
||||
@ -481,7 +481,10 @@ im_ppm2vips( const char *filename, IMAGE *out )
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
if( !(fp = im__file_open_read( filename, NULL )) )
|
||||
/* Note that we open in binary mode. If this is a binary PPM, we need
|
||||
* to be able to mmap it.
|
||||
*/
|
||||
if( !(fp = im__file_open_read( filename, NULL, FALSE )) )
|
||||
return( -1 );
|
||||
if( parse_ppm( fp, filename, out ) ) {
|
||||
fclose( fp );
|
||||
|
@ -755,7 +755,7 @@ im_vips2jpeg( IMAGE *in, const char *filename )
|
||||
|
||||
/* Make output.
|
||||
*/
|
||||
if( !(write->eman.fp = im__file_open_write( name )) ) {
|
||||
if( !(write->eman.fp = im__file_open_write( name, FALSE )) ) {
|
||||
write_destroy( write );
|
||||
return( -1 );
|
||||
}
|
||||
|
@ -370,7 +370,7 @@ im_vips2png( IMAGE *in, const char *filename )
|
||||
|
||||
/* Make output.
|
||||
*/
|
||||
if( !(write->fp = im__file_open_write( name )) ) {
|
||||
if( !(write->fp = im__file_open_write( name, FALSE )) ) {
|
||||
write_destroy( write );
|
||||
return( -1 );
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ write_new( IMAGE *in, const char *name )
|
||||
|
||||
write->in = in;
|
||||
write->name = im_strdup( NULL, name );
|
||||
write->fp = im__file_open_write( name );
|
||||
write->fp = im__file_open_write( name, FALSE );
|
||||
|
||||
if( !write->name || !write->fp ) {
|
||||
write_destroy( write );
|
||||
|
@ -779,7 +779,7 @@ israd( const char *filename )
|
||||
printf( "israd: \"%s\"\n", filename );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
if( !(fin = im__file_open_read( filename, NULL )) )
|
||||
if( !(fin = im__file_open_read( filename, NULL, FALSE )) )
|
||||
return( 0 );
|
||||
strcpy( format, PICFMT );
|
||||
result = checkheader( fin, format, NULL );
|
||||
@ -825,7 +825,7 @@ read_new( const char *filename, IMAGE *out )
|
||||
read->prims[3][1] = CIE_y_w;
|
||||
read->buf = NULL;
|
||||
|
||||
if( !(read->fin = im__file_open_read( filename, NULL )) ) {
|
||||
if( !(read->fin = im__file_open_read( filename, NULL, FALSE )) ) {
|
||||
read_destroy( read );
|
||||
return( NULL );
|
||||
}
|
||||
@ -1052,7 +1052,7 @@ write_new( IMAGE *in, const char *filename )
|
||||
|
||||
write->in = in;
|
||||
write->filename = im_strdup( NULL, filename );
|
||||
write->fout = im__file_open_write( filename );
|
||||
write->fout = im__file_open_write( filename, FALSE );
|
||||
strcpy( write->format, COLRFMT );
|
||||
write->expos = 1.0;
|
||||
for( i = 0; i < 3; i++ )
|
||||
|
@ -482,7 +482,7 @@ im_read_dmask( const char *filename )
|
||||
int x, y, i, size;
|
||||
char buf[IM_MAX_LINE];
|
||||
|
||||
if( !(fp = im__file_open_read( filename, NULL )) )
|
||||
if( !(fp = im__file_open_read( filename, NULL, TRUE )) )
|
||||
return( NULL );
|
||||
|
||||
if( read_header( fp, &xs, &ys, &sc, &off ) ) {
|
||||
|
Loading…
Reference in New Issue
Block a user