clean up length return
read file to mem was using uint for length for historical reasons
This commit is contained in:
parent
36d1312a32
commit
1e6cd1b1a5
@ -277,7 +277,7 @@ static int
|
||||
vips_colour_attach_profile( VipsImage *im, const char *filename )
|
||||
{
|
||||
char *data;
|
||||
unsigned int data_length;
|
||||
size_t data_length;
|
||||
|
||||
if( !(data = vips__file_read_name( filename, VIPS_ICC_DIR,
|
||||
&data_length )) )
|
||||
|
@ -299,7 +299,7 @@ static struct dsr *
|
||||
read_header( const char *header )
|
||||
{
|
||||
struct dsr *d;
|
||||
unsigned int len;
|
||||
size_t len;
|
||||
|
||||
if( !(d = (struct dsr *) vips__file_read_name( header, NULL, &len )) )
|
||||
return( NULL );
|
||||
|
@ -181,7 +181,7 @@ typedef struct {
|
||||
ErrorManager eman;
|
||||
JSAMPROW *row_pointer;
|
||||
char *profile_bytes;
|
||||
unsigned int profile_length;
|
||||
size_t profile_length;
|
||||
VipsImage *inverted;
|
||||
} Write;
|
||||
|
||||
|
@ -402,7 +402,7 @@ static int
|
||||
embed_profile_file( TIFF *tif, const char *profile )
|
||||
{
|
||||
char *buffer;
|
||||
unsigned int length;
|
||||
size_t length;
|
||||
|
||||
if( !(buffer = vips__file_read_name( profile, VIPS_ICC_DIR, &length )) )
|
||||
return( -1 );
|
||||
|
@ -857,22 +857,20 @@ write_vips( Write *write, int compress, int interlace, const char *profile )
|
||||
if( profile ) {
|
||||
if( strcmp( profile, "none" ) != 0 ) {
|
||||
void *data;
|
||||
unsigned int length;
|
||||
size_t length;
|
||||
|
||||
if( !(data =
|
||||
vips__file_read_name( profile, VIPS_ICC_DIR,
|
||||
&length )) )
|
||||
if( !(data = vips__file_read_name( profile,
|
||||
VIPS_ICC_DIR, &length )) )
|
||||
return( -1 );
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "write_vips: "
|
||||
"attaching %d bytes of ICC profile\n",
|
||||
"attaching %zd bytes of ICC profile\n",
|
||||
length );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
png_set_iCCP( write->pPng, write->pInfo, "icc",
|
||||
PNG_COMPRESSION_TYPE_BASE,
|
||||
data, length );
|
||||
PNG_COMPRESSION_TYPE_BASE, data, length );
|
||||
}
|
||||
}
|
||||
else if( vips_image_get_typeof( in, VIPS_META_ICC_NAME ) ) {
|
||||
|
@ -201,9 +201,9 @@ FILE *vips__file_open_read( const char *filename,
|
||||
const char *fallback_dir, gboolean text_mode );
|
||||
FILE *vips__file_open_write( const char *filename,
|
||||
gboolean text_mode );
|
||||
char *vips__file_read( FILE *fp, const char *name, unsigned int *length_out );
|
||||
char *vips__file_read( FILE *fp, const char *name, size_t *length_out );
|
||||
char *vips__file_read_name( const char *name, const char *fallback_dir,
|
||||
unsigned int *length_out );
|
||||
size_t *length_out );
|
||||
int vips__file_write( void *data, size_t size, size_t nmemb, FILE *stream );
|
||||
int vips__get_bytes( const char *filename, unsigned char buf[], int len );
|
||||
|
||||
|
@ -620,7 +620,7 @@ vips__file_open_write( const char *filename, gboolean text_mode )
|
||||
/* Load up a file as a string.
|
||||
*/
|
||||
char *
|
||||
vips__file_read( FILE *fp, const char *filename, unsigned int *length_out )
|
||||
vips__file_read( FILE *fp, const char *filename, size_t *length_out )
|
||||
{
|
||||
gint64 len;
|
||||
size_t read;
|
||||
@ -697,7 +697,7 @@ vips__file_read( FILE *fp, const char *filename, unsigned int *length_out )
|
||||
*/
|
||||
char *
|
||||
vips__file_read_name( const char *filename, const char *fallback_dir,
|
||||
unsigned int *length_out )
|
||||
size_t *length_out )
|
||||
{
|
||||
FILE *fp;
|
||||
char *buffer;
|
||||
|
@ -216,7 +216,7 @@ main( int argc, char **argv )
|
||||
|
||||
if( setext ) {
|
||||
char *xml;
|
||||
unsigned int size;
|
||||
size_t size;
|
||||
|
||||
if( !(xml = im__file_read( stdin, "stdin", &size )) )
|
||||
error_exit( "%s", _( "could not get ext data" ) );
|
||||
|
Loading…
Reference in New Issue
Block a user