Merge remote-tracking branch 'origin/7.36'
This commit is contained in:
commit
f387d13106
1
.gitignore
vendored
1
.gitignore
vendored
@ -18,6 +18,7 @@ Vips-8.0.typelib
|
||||
.*.swp
|
||||
*.lo
|
||||
*.bak
|
||||
*.vect
|
||||
*.la
|
||||
Vips-8.0.gir
|
||||
Vips-8.0.typelib
|
||||
|
@ -49,10 +49,6 @@
|
||||
#include <vips/vips.h>
|
||||
#include <vips/internal.h>
|
||||
|
||||
/* Max str we parse.
|
||||
*/
|
||||
#define IM_MAX_STR (4096)
|
||||
|
||||
/* String containing each of the characters which can be used within a
|
||||
* single command line argument to separate the elements of a vector.
|
||||
*/
|
||||
|
@ -705,7 +705,7 @@ int
|
||||
im_load_plugins( const char *fmt, ... )
|
||||
{
|
||||
va_list ap;
|
||||
char dir_name[4096];
|
||||
char dir_name[VIPS_PATH_MAX];
|
||||
GDir *dir;
|
||||
const char *name;
|
||||
int result;
|
||||
@ -716,7 +716,7 @@ im_load_plugins( const char *fmt, ... )
|
||||
return( 0 );
|
||||
|
||||
va_start( ap, fmt );
|
||||
(void) im_vsnprintf( dir_name, 4096 - 1, fmt, ap );
|
||||
(void) im_vsnprintf( dir_name, VIPS_PATH_MAX - 1, fmt, ap );
|
||||
va_end( ap );
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -731,9 +731,9 @@ im_load_plugins( const char *fmt, ... )
|
||||
result = 0;
|
||||
while( (name = g_dir_read_name( dir )) )
|
||||
if( im_ispostfix( name, ".plg" ) ) {
|
||||
char path[4096];
|
||||
char path[VIPS_PATH_MAX];
|
||||
|
||||
im_snprintf( path, 4096 - 1,
|
||||
im_snprintf( path, VIPS_PATH_MAX - 1,
|
||||
"%s" G_DIR_SEPARATOR_S "%s", dir_name, name );
|
||||
if( !im_load_plugin( path ) )
|
||||
result = -1;
|
||||
|
@ -364,12 +364,12 @@ pyramid_build( VipsForeignSaveDz *dz, Layer *above,
|
||||
static int
|
||||
pyramid_mkdir( VipsForeignSaveDz *dz )
|
||||
{
|
||||
char buf[4096];
|
||||
char buf[VIPS_PATH_MAX];
|
||||
|
||||
if( dz->layout == VIPS_FOREIGN_DZ_LAYOUT_DZ )
|
||||
vips_snprintf( buf, 4096, "%s_files", dz->basename );
|
||||
vips_snprintf( buf, VIPS_PATH_MAX, "%s_files", dz->basename );
|
||||
else
|
||||
vips_snprintf( buf, 4096, "%s", dz->basename );
|
||||
vips_snprintf( buf, VIPS_PATH_MAX, "%s", dz->basename );
|
||||
|
||||
if( vips_existsf( "%s", buf ) ) {
|
||||
vips_error( "dzsave",
|
||||
@ -386,14 +386,14 @@ static int
|
||||
write_dzi( VipsForeignSaveDz *dz )
|
||||
{
|
||||
FILE *fp;
|
||||
char buf[4096];
|
||||
char buf[VIPS_PATH_MAX];
|
||||
char *p;
|
||||
|
||||
vips_snprintf( buf, 4096, "%s.dzi", dz->basename );
|
||||
vips_snprintf( buf, VIPS_PATH_MAX, "%s.dzi", dz->basename );
|
||||
if( !(fp = vips__file_open_write( buf, TRUE )) )
|
||||
return( -1 );
|
||||
|
||||
vips_snprintf( buf, 4096, "%s", dz->suffix + 1 );
|
||||
vips_snprintf( buf, VIPS_PATH_MAX, "%s", dz->suffix + 1 );
|
||||
if( (p = (char *) vips__find_rightmost_brackets( buf )) )
|
||||
*p = '\0';
|
||||
|
||||
@ -419,9 +419,10 @@ static int
|
||||
write_properties( VipsForeignSaveDz *dz )
|
||||
{
|
||||
FILE *fp;
|
||||
char buf[4096];
|
||||
char buf[VIPS_PATH_MAX];
|
||||
|
||||
vips_snprintf( buf, 4096, "%s/ImageProperties.xml", dz->basename );
|
||||
vips_snprintf( buf, VIPS_PATH_MAX,
|
||||
"%s/ImageProperties.xml", dz->basename );
|
||||
if( !(fp = vips__file_open_write( buf, TRUE )) )
|
||||
return( -1 );
|
||||
|
||||
@ -441,14 +442,14 @@ write_properties( VipsForeignSaveDz *dz )
|
||||
static int
|
||||
write_blank( VipsForeignSaveDz *dz )
|
||||
{
|
||||
char buf[4096];
|
||||
char buf[VIPS_PATH_MAX];
|
||||
VipsImage *x, *t;
|
||||
int n;
|
||||
VipsArea *ones;
|
||||
double *d;
|
||||
int i;
|
||||
|
||||
vips_snprintf( buf, 4096, "%s/blank.png", dz->basename );
|
||||
vips_snprintf( buf, VIPS_PATH_MAX, "%s/blank.png", dz->basename );
|
||||
if( vips_black( &x, dz->tile_size, dz->tile_size, NULL ) )
|
||||
return( -1 );
|
||||
|
||||
@ -711,8 +712,8 @@ tile_name( Layer *layer, char *buf, int x, int y )
|
||||
|
||||
VipsForeignSaveDz *dz = layer->dz;
|
||||
|
||||
char dirname[4096];
|
||||
char dirname2[4096];
|
||||
char dirname[VIPS_PATH_MAX];
|
||||
char dirname2[VIPS_PATH_MAX];
|
||||
Layer *p;
|
||||
int n;
|
||||
|
||||
@ -722,10 +723,10 @@ tile_name( Layer *layer, char *buf, int x, int y )
|
||||
|
||||
switch( dz->layout ) {
|
||||
case VIPS_FOREIGN_DZ_LAYOUT_DZ:
|
||||
vips_snprintf( dirname, 4096, "%s_files/%d",
|
||||
dz->basename, layer->n );
|
||||
vips_snprintf( buf, 4096, "%s/%d_%d%s",
|
||||
dirname, x, y, dz->suffix );
|
||||
vips_snprintf( dirname, VIPS_PATH_MAX,
|
||||
"%s_files/%d", dz->basename, layer->n );
|
||||
vips_snprintf( buf, VIPS_PATH_MAX,
|
||||
"%s/%d_%d%s", dirname, x, y, dz->suffix );
|
||||
|
||||
if( !vips_existsf( "%s", dirname ) &&
|
||||
vips_mkdirf( "%s", dirname ) ) {
|
||||
@ -752,10 +753,10 @@ tile_name( Layer *layer, char *buf, int x, int y )
|
||||
*/
|
||||
n += y * layer->tiles_across + x;
|
||||
|
||||
vips_snprintf( dirname, 4096, "%s/TileGroup%d",
|
||||
dz->basename, n / 256 );
|
||||
vips_snprintf( buf, 4096, "%s/%d-%d-%d%s",
|
||||
dirname, layer->n, x, y, dz->suffix );
|
||||
vips_snprintf( dirname, VIPS_PATH_MAX,
|
||||
"%s/TileGroup%d", dz->basename, n / 256 );
|
||||
vips_snprintf( buf, VIPS_PATH_MAX,
|
||||
"%s/%d-%d-%d%s", dirname, layer->n, x, y, dz->suffix );
|
||||
|
||||
/* Used at the end in ImageProperties.xml
|
||||
*/
|
||||
@ -770,12 +771,12 @@ tile_name( Layer *layer, char *buf, int x, int y )
|
||||
break;
|
||||
|
||||
case VIPS_FOREIGN_DZ_LAYOUT_GOOGLE:
|
||||
vips_snprintf( dirname, 4096, "%s/%d",
|
||||
dz->basename, layer->n );
|
||||
vips_snprintf( dirname2, 4096, "%s/%d",
|
||||
dirname, y );
|
||||
vips_snprintf( buf, 4096, "%s/%d%s",
|
||||
dirname2, x, dz->suffix );
|
||||
vips_snprintf( dirname, VIPS_PATH_MAX,
|
||||
"%s/%d", dz->basename, layer->n );
|
||||
vips_snprintf( dirname2, VIPS_PATH_MAX,
|
||||
"%s/%d", dirname, y );
|
||||
vips_snprintf( buf, VIPS_PATH_MAX,
|
||||
"%s/%d%s", dirname2, x, dz->suffix );
|
||||
|
||||
if( !vips_existsf( "%s", dirname ) &&
|
||||
vips_mkdirf( "%s", dirname ) ) {
|
||||
@ -809,7 +810,7 @@ strip_work( VipsThreadState *state, void *a )
|
||||
Layer *layer = strip->layer;
|
||||
VipsForeignSaveDz *dz = layer->dz;
|
||||
|
||||
char buf[4096];
|
||||
char buf[VIPS_PATH_MAX];
|
||||
VipsImage *x;
|
||||
VipsImage *t;
|
||||
|
||||
|
@ -157,6 +157,11 @@ G_STMT_START { \
|
||||
|
||||
#define VIPS_CLIP_NONE( V, SEQ ) {}
|
||||
|
||||
/* Not all platforms have PATH_MAX (eg. Hurd) and we don't need a platform one
|
||||
* anyway, just a static buffer big enough for almost any path.
|
||||
*/
|
||||
#define VIPS_PATH_MAX (4096)
|
||||
|
||||
const char *vips_enum_string( GType enm, int value );
|
||||
const char *vips_enum_nick( GType enm, int value );
|
||||
int vips_enum_from_nick( const char *domain, GType type, const char *str );
|
||||
|
@ -1408,14 +1408,14 @@ int
|
||||
vips_image_history_printf( VipsImage *image, const char *fmt, ... )
|
||||
{
|
||||
va_list args;
|
||||
char line[4096];
|
||||
char line[VIPS_PATH_MAX];
|
||||
time_t timebuf;
|
||||
|
||||
/* Format command. -40, to leave 26 for the ctime, three for the # and
|
||||
* a bit.
|
||||
*/
|
||||
va_start( args, fmt );
|
||||
(void) vips_vsnprintf( line, 4096 - 40, fmt, args );
|
||||
(void) vips_vsnprintf( line, VIPS_PATH_MAX - 40, fmt, args );
|
||||
va_end( args );
|
||||
strcat( line, " # " );
|
||||
|
||||
|
@ -554,8 +554,8 @@ vips_get_option_group( void )
|
||||
static char *
|
||||
extract_prefix( const char *dir, const char *name )
|
||||
{
|
||||
char edir[4096];
|
||||
char vname[4096];
|
||||
char edir[VIPS_PATH_MAX];
|
||||
char vname[VIPS_PATH_MAX];
|
||||
int i;
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -569,12 +569,12 @@ extract_prefix( const char *dir, const char *name )
|
||||
char *cwd;
|
||||
|
||||
cwd = g_get_current_dir();
|
||||
vips_snprintf( edir, 4096, "%s" G_DIR_SEPARATOR_S "%s",
|
||||
cwd, dir );
|
||||
vips_snprintf( edir, VIPS_PATH_MAX,
|
||||
"%s" G_DIR_SEPARATOR_S "%s", cwd, dir );
|
||||
g_free( cwd );
|
||||
}
|
||||
else {
|
||||
vips_strncpy( edir, dir, 4096 );
|
||||
vips_strncpy( edir, dir, VIPS_PATH_MAX );
|
||||
}
|
||||
|
||||
/* Chop off the trailing prog name, plus the trailing
|
||||
@ -582,7 +582,7 @@ extract_prefix( const char *dir, const char *name )
|
||||
*/
|
||||
if( !vips_ispostfix( edir, name ) )
|
||||
return( NULL );
|
||||
vips_strncpy( vname, edir, 4096 );
|
||||
vips_strncpy( vname, edir, VIPS_PATH_MAX );
|
||||
vname[strlen( edir ) - strlen( name ) - 1] = '\0';
|
||||
|
||||
/* Remove any "/./", any trailing "/.", any trailing "/".
|
||||
@ -624,11 +624,11 @@ scan_path( char *path, const char *name )
|
||||
|
||||
for( p = path;
|
||||
(q = vips_break_token( p, G_SEARCHPATH_SEPARATOR_S )); p = q ) {
|
||||
char str[4096];
|
||||
char str[VIPS_PATH_MAX];
|
||||
|
||||
/* Form complete path.
|
||||
*/
|
||||
vips_snprintf( str, 4096,
|
||||
vips_snprintf( str, VIPS_PATH_MAX,
|
||||
"%s" G_DIR_SEPARATOR_S "%s", p, name );
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -652,7 +652,7 @@ find_file( const char *name )
|
||||
{
|
||||
const char *path = g_getenv( "PATH" );
|
||||
char *prefix;
|
||||
char full_path[4096];
|
||||
char full_path[VIPS_PATH_MAX];
|
||||
|
||||
if( !path )
|
||||
return( NULL );
|
||||
@ -668,12 +668,12 @@ find_file( const char *name )
|
||||
/* Windows always searches '.' first, so prepend cwd to path.
|
||||
*/
|
||||
dir = g_get_current_dir();
|
||||
vips_snprintf( full_path, 4096, "%s" G_SEARCHPATH_SEPARATOR_S "%s",
|
||||
dir, path );
|
||||
vips_snprintf( full_path, VIPS_PATH_MAX,
|
||||
"%s" G_SEARCHPATH_SEPARATOR_S "%s", dir, path );
|
||||
g_free( dir );
|
||||
}
|
||||
#else /*!OS_WIN32*/
|
||||
vips_strncpy( full_path, path, 4096 );
|
||||
vips_strncpy( full_path, path, VIPS_PATH_MAX );
|
||||
#endif /*OS_WIN32*/
|
||||
|
||||
if( (prefix = scan_path( full_path, name )) )
|
||||
@ -721,12 +721,12 @@ guess_prefix( const char *argv0, const char *name )
|
||||
* a full path in argv[0].
|
||||
*/
|
||||
if( !g_path_is_absolute( argv0 ) ) {
|
||||
char full_path[4096];
|
||||
char full_path[VIPS_PATH_MAX];
|
||||
char *resolved;
|
||||
char *dir;
|
||||
|
||||
dir = g_get_current_dir();
|
||||
vips_snprintf( full_path, 4096,
|
||||
vips_snprintf( full_path, VIPS_PATH_MAX,
|
||||
"%s" G_DIR_SEPARATOR_S "%s", dir, argv0 );
|
||||
g_free( dir );
|
||||
|
||||
@ -773,7 +773,7 @@ vips_guess_prefix( const char *argv0, const char *env_name )
|
||||
{
|
||||
const char *prefix;
|
||||
const char *p;
|
||||
char name[4096];
|
||||
char name[VIPS_PATH_MAX];
|
||||
|
||||
/* Already set?
|
||||
*/
|
||||
@ -794,10 +794,11 @@ vips_guess_prefix( const char *argv0, const char *env_name )
|
||||
if( strlen( VIPS_EXEEXT ) > 0 ) {
|
||||
const char *olds[] = { VIPS_EXEEXT };
|
||||
|
||||
vips__change_suffix( p, name, 4096, VIPS_EXEEXT, olds, 1 );
|
||||
vips__change_suffix( p, name,
|
||||
VIPS_PATH_MAX, VIPS_EXEEXT, olds, 1 );
|
||||
}
|
||||
else
|
||||
vips_strncpy( name, p, 4096 );
|
||||
vips_strncpy( name, p, VIPS_PATH_MAX );
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "vips_guess_prefix: argv0 = %s\n", argv0 );
|
||||
|
@ -1959,34 +1959,36 @@ vips_object_set_args( VipsObject *object, const char *p )
|
||||
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
|
||||
|
||||
VipsToken token;
|
||||
char string[4096];
|
||||
char string2[4096];
|
||||
char string[VIPS_PATH_MAX];
|
||||
char string2[VIPS_PATH_MAX];
|
||||
GParamSpec *pspec;
|
||||
VipsArgumentClass *argument_class;
|
||||
VipsArgumentInstance *argument_instance;
|
||||
|
||||
if( !(p = vips__token_need( p, VIPS_TOKEN_LEFT, string, 4096 )) )
|
||||
if( !(p = vips__token_need( p, VIPS_TOKEN_LEFT,
|
||||
string, VIPS_PATH_MAX )) )
|
||||
return( -1 );
|
||||
|
||||
do {
|
||||
if( !(p = vips__token_need( p, VIPS_TOKEN_STRING,
|
||||
string, 4096 )) )
|
||||
string, VIPS_PATH_MAX )) )
|
||||
return( -1 );
|
||||
|
||||
/* We have to look for a '=', ')' or a ',' to see if string is
|
||||
* a param name or a value.
|
||||
*/
|
||||
if( !(p = vips__token_must( p, &token, string2, 4096 )) )
|
||||
if( !(p = vips__token_must( p, &token,
|
||||
string2, VIPS_PATH_MAX )) )
|
||||
return( -1 );
|
||||
if( token == VIPS_TOKEN_EQUALS ) {
|
||||
if( !(p = vips__token_need( p, VIPS_TOKEN_STRING,
|
||||
string2, 4096 )) )
|
||||
string2, VIPS_PATH_MAX )) )
|
||||
return( -1 );
|
||||
if( vips_object_set_argument_from_string( object,
|
||||
string, string2 ) )
|
||||
return( -1 );
|
||||
if( !(p = vips__token_must( p, &token,
|
||||
string2, 4096 )) )
|
||||
string2, VIPS_PATH_MAX )) )
|
||||
return( -1 );
|
||||
}
|
||||
else if( g_object_class_find_property(
|
||||
@ -2022,7 +2024,7 @@ vips_object_set_args( VipsObject *object, const char *p )
|
||||
}
|
||||
} while( token != VIPS_TOKEN_RIGHT );
|
||||
|
||||
if( (p = vips__token_get( p, &token, string, 4096 )) ) {
|
||||
if( (p = vips__token_get( p, &token, string, VIPS_PATH_MAX )) ) {
|
||||
vips_error( class->nickname,
|
||||
"%s", _( "extra tokens after ')'" ) );
|
||||
return( -1 );
|
||||
@ -2035,7 +2037,7 @@ VipsObject *
|
||||
vips_object_new_from_string( VipsObjectClass *object_class, const char *p )
|
||||
{
|
||||
const char *q;
|
||||
char str[4096];
|
||||
char str[VIPS_PATH_MAX];
|
||||
VipsObject *object;
|
||||
|
||||
g_assert( object_class );
|
||||
@ -2045,9 +2047,9 @@ vips_object_new_from_string( VipsObjectClass *object_class, const char *p )
|
||||
* everything before that as the principal arg for the constructor.
|
||||
*/
|
||||
if( (q = vips__find_rightmost_brackets( p )) )
|
||||
vips_strncpy( str, p, VIPS_MIN( 4096, q - p + 1 ) );
|
||||
vips_strncpy( str, p, VIPS_MIN( VIPS_PATH_MAX, q - p + 1 ) );
|
||||
else
|
||||
vips_strncpy( str, p, 4096 );
|
||||
vips_strncpy( str, p, VIPS_PATH_MAX );
|
||||
if( !(object = object_class->new_from_string( str )) )
|
||||
return( NULL );
|
||||
|
||||
|
@ -63,8 +63,6 @@
|
||||
|
||||
#include <vips/vips.h>
|
||||
|
||||
#define MAX_STRSIZE (4096)
|
||||
|
||||
typedef struct _VipsSystem {
|
||||
VipsOperation parent_instance;
|
||||
|
||||
@ -111,8 +109,8 @@ vips_system_build( VipsObject *object )
|
||||
VipsSystem *system = (VipsSystem *) object;
|
||||
|
||||
FILE *fp;
|
||||
char line[MAX_STRSIZE];
|
||||
char txt[MAX_STRSIZE];
|
||||
char line[VIPS_PATH_MAX];
|
||||
char txt[VIPS_PATH_MAX];
|
||||
VipsBuf buf = VIPS_BUF_STATIC( txt );
|
||||
int result;
|
||||
|
||||
@ -151,7 +149,7 @@ vips_system_build( VipsObject *object )
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
while( fgets( line, MAX_STRSIZE, fp ) )
|
||||
while( fgets( line, VIPS_PATH_MAX, fp ) )
|
||||
if( !vips_buf_appends( &buf, line ) )
|
||||
break;
|
||||
|
||||
|
@ -1166,11 +1166,11 @@ FILE *
|
||||
vips_popenf( const char *fmt, const char *mode, ... )
|
||||
{
|
||||
va_list args;
|
||||
char buf[4096];
|
||||
char buf[VIPS_PATH_MAX];
|
||||
FILE *fp;
|
||||
|
||||
va_start( args, mode );
|
||||
(void) vips_vsnprintf( buf, 4096, fmt, args );
|
||||
(void) vips_vsnprintf( buf, VIPS_PATH_MAX, fmt, args );
|
||||
va_end( args );
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -1387,14 +1387,15 @@ vips__find_rightmost_brackets( const char *p )
|
||||
{
|
||||
const char *start[MAX_TOKENS];
|
||||
VipsToken tokens[MAX_TOKENS];
|
||||
char str[4096];
|
||||
char str[VIPS_PATH_MAX];
|
||||
int n, i;
|
||||
int nest;
|
||||
|
||||
start[0] = p;
|
||||
for( n = 0;
|
||||
n < MAX_TOKENS &&
|
||||
(p = vips__token_get( start[n], &tokens[n], str, 4096 ));
|
||||
(p = vips__token_get( start[n], &tokens[n],
|
||||
str, VIPS_PATH_MAX ));
|
||||
n++, start[n] = p )
|
||||
;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user