use a define for PATH_MAX
add VIPS_PATH_MAX, a long-enough-for-almost-any-path buffer size we ought to switch to dynamic paths really ... do this when we fix filename encoding
This commit is contained in:
parent
53562905d4
commit
d7037618fc
1
.gitignore
vendored
1
.gitignore
vendored
@ -16,6 +16,7 @@ Vips-8.0.typelib
|
|||||||
.*.swp
|
.*.swp
|
||||||
*.lo
|
*.lo
|
||||||
*.bak
|
*.bak
|
||||||
|
*.vect
|
||||||
*.la
|
*.la
|
||||||
Vips-8.0.gir
|
Vips-8.0.gir
|
||||||
Vips-8.0.typelib
|
Vips-8.0.typelib
|
||||||
|
@ -49,10 +49,6 @@
|
|||||||
#include <vips/vips.h>
|
#include <vips/vips.h>
|
||||||
#include <vips/internal.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
|
/* String containing each of the characters which can be used within a
|
||||||
* single command line argument to separate the elements of a vector.
|
* single command line argument to separate the elements of a vector.
|
||||||
*/
|
*/
|
||||||
|
@ -705,7 +705,7 @@ int
|
|||||||
im_load_plugins( const char *fmt, ... )
|
im_load_plugins( const char *fmt, ... )
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
char dir_name[4096];
|
char dir_name[VIPS_PATH_MAX];
|
||||||
GDir *dir;
|
GDir *dir;
|
||||||
const char *name;
|
const char *name;
|
||||||
int result;
|
int result;
|
||||||
@ -716,7 +716,7 @@ im_load_plugins( const char *fmt, ... )
|
|||||||
return( 0 );
|
return( 0 );
|
||||||
|
|
||||||
va_start( ap, fmt );
|
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 );
|
va_end( ap );
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -731,9 +731,9 @@ im_load_plugins( const char *fmt, ... )
|
|||||||
result = 0;
|
result = 0;
|
||||||
while( (name = g_dir_read_name( dir )) )
|
while( (name = g_dir_read_name( dir )) )
|
||||||
if( im_ispostfix( name, ".plg" ) ) {
|
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 );
|
"%s" G_DIR_SEPARATOR_S "%s", dir_name, name );
|
||||||
if( !im_load_plugin( path ) )
|
if( !im_load_plugin( path ) )
|
||||||
result = -1;
|
result = -1;
|
||||||
|
@ -363,12 +363,12 @@ pyramid_build( VipsForeignSaveDz *dz, Layer *above,
|
|||||||
static int
|
static int
|
||||||
pyramid_mkdir( VipsForeignSaveDz *dz )
|
pyramid_mkdir( VipsForeignSaveDz *dz )
|
||||||
{
|
{
|
||||||
char buf[4096];
|
char buf[VIPS_PATH_MAX];
|
||||||
|
|
||||||
if( dz->layout == VIPS_FOREIGN_DZ_LAYOUT_DZ )
|
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
|
else
|
||||||
vips_snprintf( buf, 4096, "%s", dz->basename );
|
vips_snprintf( buf, VIPS_PATH_MAX, "%s", dz->basename );
|
||||||
|
|
||||||
if( vips_existsf( "%s", buf ) ) {
|
if( vips_existsf( "%s", buf ) ) {
|
||||||
vips_error( "dzsave",
|
vips_error( "dzsave",
|
||||||
@ -385,14 +385,14 @@ static int
|
|||||||
write_dzi( VipsForeignSaveDz *dz )
|
write_dzi( VipsForeignSaveDz *dz )
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buf[4096];
|
char buf[VIPS_PATH_MAX];
|
||||||
char *p;
|
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 )) )
|
if( !(fp = vips__file_open_write( buf, TRUE )) )
|
||||||
return( -1 );
|
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 )) )
|
if( (p = (char *) vips__find_rightmost_brackets( buf )) )
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
|
||||||
@ -418,9 +418,10 @@ static int
|
|||||||
write_properties( VipsForeignSaveDz *dz )
|
write_properties( VipsForeignSaveDz *dz )
|
||||||
{
|
{
|
||||||
FILE *fp;
|
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 )) )
|
if( !(fp = vips__file_open_write( buf, TRUE )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
@ -440,14 +441,14 @@ write_properties( VipsForeignSaveDz *dz )
|
|||||||
static int
|
static int
|
||||||
write_blank( VipsForeignSaveDz *dz )
|
write_blank( VipsForeignSaveDz *dz )
|
||||||
{
|
{
|
||||||
char buf[4096];
|
char buf[VIPS_PATH_MAX];
|
||||||
VipsImage *x, *t;
|
VipsImage *x, *t;
|
||||||
int n;
|
int n;
|
||||||
VipsArea *ones;
|
VipsArea *ones;
|
||||||
double *d;
|
double *d;
|
||||||
int i;
|
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 ) )
|
if( vips_black( &x, dz->tile_size, dz->tile_size, NULL ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
@ -710,8 +711,8 @@ tile_name( Layer *layer, char *buf, int x, int y )
|
|||||||
|
|
||||||
VipsForeignSaveDz *dz = layer->dz;
|
VipsForeignSaveDz *dz = layer->dz;
|
||||||
|
|
||||||
char dirname[4096];
|
char dirname[VIPS_PATH_MAX];
|
||||||
char dirname2[4096];
|
char dirname2[VIPS_PATH_MAX];
|
||||||
Layer *p;
|
Layer *p;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
@ -721,10 +722,10 @@ tile_name( Layer *layer, char *buf, int x, int y )
|
|||||||
|
|
||||||
switch( dz->layout ) {
|
switch( dz->layout ) {
|
||||||
case VIPS_FOREIGN_DZ_LAYOUT_DZ:
|
case VIPS_FOREIGN_DZ_LAYOUT_DZ:
|
||||||
vips_snprintf( dirname, 4096, "%s_files/%d",
|
vips_snprintf( dirname, VIPS_PATH_MAX,
|
||||||
dz->basename, layer->n );
|
"%s_files/%d", dz->basename, layer->n );
|
||||||
vips_snprintf( buf, 4096, "%s/%d_%d%s",
|
vips_snprintf( buf, VIPS_PATH_MAX,
|
||||||
dirname, x, y, dz->suffix );
|
"%s/%d_%d%s", dirname, x, y, dz->suffix );
|
||||||
|
|
||||||
if( !vips_existsf( "%s", dirname ) &&
|
if( !vips_existsf( "%s", dirname ) &&
|
||||||
vips_mkdirf( "%s", dirname ) ) {
|
vips_mkdirf( "%s", dirname ) ) {
|
||||||
@ -751,10 +752,10 @@ tile_name( Layer *layer, char *buf, int x, int y )
|
|||||||
*/
|
*/
|
||||||
n += y * layer->tiles_across + x;
|
n += y * layer->tiles_across + x;
|
||||||
|
|
||||||
vips_snprintf( dirname, 4096, "%s/TileGroup%d",
|
vips_snprintf( dirname, VIPS_PATH_MAX,
|
||||||
dz->basename, n / 256 );
|
"%s/TileGroup%d", dz->basename, n / 256 );
|
||||||
vips_snprintf( buf, 4096, "%s/%d-%d-%d%s",
|
vips_snprintf( buf, VIPS_PATH_MAX,
|
||||||
dirname, layer->n, x, y, dz->suffix );
|
"%s/%d-%d-%d%s", dirname, layer->n, x, y, dz->suffix );
|
||||||
|
|
||||||
/* Used at the end in ImageProperties.xml
|
/* Used at the end in ImageProperties.xml
|
||||||
*/
|
*/
|
||||||
@ -769,12 +770,12 @@ tile_name( Layer *layer, char *buf, int x, int y )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VIPS_FOREIGN_DZ_LAYOUT_GOOGLE:
|
case VIPS_FOREIGN_DZ_LAYOUT_GOOGLE:
|
||||||
vips_snprintf( dirname, 4096, "%s/%d",
|
vips_snprintf( dirname, VIPS_PATH_MAX,
|
||||||
dz->basename, layer->n );
|
"%s/%d", dz->basename, layer->n );
|
||||||
vips_snprintf( dirname2, 4096, "%s/%d",
|
vips_snprintf( dirname2, VIPS_PATH_MAX,
|
||||||
dirname, y );
|
"%s/%d", dirname, y );
|
||||||
vips_snprintf( buf, 4096, "%s/%d%s",
|
vips_snprintf( buf, VIPS_PATH_MAX,
|
||||||
dirname2, x, dz->suffix );
|
"%s/%d%s", dirname2, x, dz->suffix );
|
||||||
|
|
||||||
if( !vips_existsf( "%s", dirname ) &&
|
if( !vips_existsf( "%s", dirname ) &&
|
||||||
vips_mkdirf( "%s", dirname ) ) {
|
vips_mkdirf( "%s", dirname ) ) {
|
||||||
@ -808,7 +809,7 @@ strip_work( VipsThreadState *state, void *a )
|
|||||||
Layer *layer = strip->layer;
|
Layer *layer = strip->layer;
|
||||||
VipsForeignSaveDz *dz = layer->dz;
|
VipsForeignSaveDz *dz = layer->dz;
|
||||||
|
|
||||||
char buf[4096];
|
char buf[VIPS_PATH_MAX];
|
||||||
VipsImage *x;
|
VipsImage *x;
|
||||||
VipsImage *t;
|
VipsImage *t;
|
||||||
|
|
||||||
|
@ -157,6 +157,11 @@ G_STMT_START { \
|
|||||||
|
|
||||||
#define VIPS_CLIP_NONE( V, SEQ ) {}
|
#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_string( GType enm, int value );
|
||||||
const char *vips_enum_nick( 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 );
|
int vips_enum_from_nick( const char *domain, GType type, const char *str );
|
||||||
|
@ -1485,14 +1485,14 @@ int
|
|||||||
vips_image_history_printf( VipsImage *image, const char *fmt, ... )
|
vips_image_history_printf( VipsImage *image, const char *fmt, ... )
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char line[4096];
|
char line[VIPS_PATH_MAX];
|
||||||
time_t timebuf;
|
time_t timebuf;
|
||||||
|
|
||||||
/* Format command. -40, to leave 26 for the ctime, three for the # and
|
/* Format command. -40, to leave 26 for the ctime, three for the # and
|
||||||
* a bit.
|
* a bit.
|
||||||
*/
|
*/
|
||||||
va_start( args, fmt );
|
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 );
|
va_end( args );
|
||||||
strcat( line, " # " );
|
strcat( line, " # " );
|
||||||
|
|
||||||
|
@ -507,8 +507,8 @@ vips_get_option_group( void )
|
|||||||
static char *
|
static char *
|
||||||
extract_prefix( const char *dir, const char *name )
|
extract_prefix( const char *dir, const char *name )
|
||||||
{
|
{
|
||||||
char edir[4096];
|
char edir[VIPS_PATH_MAX];
|
||||||
char vname[4096];
|
char vname[VIPS_PATH_MAX];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -522,12 +522,12 @@ extract_prefix( const char *dir, const char *name )
|
|||||||
char *cwd;
|
char *cwd;
|
||||||
|
|
||||||
cwd = g_get_current_dir();
|
cwd = g_get_current_dir();
|
||||||
vips_snprintf( edir, 4096, "%s" G_DIR_SEPARATOR_S "%s",
|
vips_snprintf( edir, VIPS_PATH_MAX,
|
||||||
cwd, dir );
|
"%s" G_DIR_SEPARATOR_S "%s", cwd, dir );
|
||||||
g_free( cwd );
|
g_free( cwd );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
vips_strncpy( edir, dir, 4096 );
|
vips_strncpy( edir, dir, VIPS_PATH_MAX );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Chop off the trailing prog name, plus the trailing
|
/* Chop off the trailing prog name, plus the trailing
|
||||||
@ -535,7 +535,7 @@ extract_prefix( const char *dir, const char *name )
|
|||||||
*/
|
*/
|
||||||
if( !vips_ispostfix( edir, name ) )
|
if( !vips_ispostfix( edir, name ) )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
vips_strncpy( vname, edir, 4096 );
|
vips_strncpy( vname, edir, VIPS_PATH_MAX );
|
||||||
vname[strlen( edir ) - strlen( name ) - 1] = '\0';
|
vname[strlen( edir ) - strlen( name ) - 1] = '\0';
|
||||||
|
|
||||||
/* Remove any "/./", any trailing "/.", any trailing "/".
|
/* Remove any "/./", any trailing "/.", any trailing "/".
|
||||||
@ -577,11 +577,11 @@ scan_path( char *path, const char *name )
|
|||||||
|
|
||||||
for( p = path;
|
for( p = path;
|
||||||
(q = vips_break_token( p, G_SEARCHPATH_SEPARATOR_S )); p = q ) {
|
(q = vips_break_token( p, G_SEARCHPATH_SEPARATOR_S )); p = q ) {
|
||||||
char str[4096];
|
char str[VIPS_PATH_MAX];
|
||||||
|
|
||||||
/* Form complete path.
|
/* Form complete path.
|
||||||
*/
|
*/
|
||||||
vips_snprintf( str, 4096,
|
vips_snprintf( str, VIPS_PATH_MAX,
|
||||||
"%s" G_DIR_SEPARATOR_S "%s", p, name );
|
"%s" G_DIR_SEPARATOR_S "%s", p, name );
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -605,7 +605,7 @@ find_file( const char *name )
|
|||||||
{
|
{
|
||||||
const char *path = g_getenv( "PATH" );
|
const char *path = g_getenv( "PATH" );
|
||||||
char *prefix;
|
char *prefix;
|
||||||
char full_path[4096];
|
char full_path[VIPS_PATH_MAX];
|
||||||
|
|
||||||
if( !path )
|
if( !path )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
@ -621,12 +621,12 @@ find_file( const char *name )
|
|||||||
/* Windows always searches '.' first, so prepend cwd to path.
|
/* Windows always searches '.' first, so prepend cwd to path.
|
||||||
*/
|
*/
|
||||||
dir = g_get_current_dir();
|
dir = g_get_current_dir();
|
||||||
vips_snprintf( full_path, 4096, "%s" G_SEARCHPATH_SEPARATOR_S "%s",
|
vips_snprintf( full_path, VIPS_PATH_MAX,
|
||||||
dir, path );
|
"%s" G_SEARCHPATH_SEPARATOR_S "%s", dir, path );
|
||||||
g_free( dir );
|
g_free( dir );
|
||||||
}
|
}
|
||||||
#else /*!OS_WIN32*/
|
#else /*!OS_WIN32*/
|
||||||
vips_strncpy( full_path, path, 4096 );
|
vips_strncpy( full_path, path, VIPS_PATH_MAX );
|
||||||
#endif /*OS_WIN32*/
|
#endif /*OS_WIN32*/
|
||||||
|
|
||||||
if( (prefix = scan_path( full_path, name )) )
|
if( (prefix = scan_path( full_path, name )) )
|
||||||
@ -674,12 +674,12 @@ guess_prefix( const char *argv0, const char *name )
|
|||||||
* a full path in argv[0].
|
* a full path in argv[0].
|
||||||
*/
|
*/
|
||||||
if( !g_path_is_absolute( argv0 ) ) {
|
if( !g_path_is_absolute( argv0 ) ) {
|
||||||
char full_path[4096];
|
char full_path[VIPS_PATH_MAX];
|
||||||
char *resolved;
|
char *resolved;
|
||||||
char *dir;
|
char *dir;
|
||||||
|
|
||||||
dir = g_get_current_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 );
|
"%s" G_DIR_SEPARATOR_S "%s", dir, argv0 );
|
||||||
g_free( dir );
|
g_free( dir );
|
||||||
|
|
||||||
@ -726,7 +726,7 @@ vips_guess_prefix( const char *argv0, const char *env_name )
|
|||||||
{
|
{
|
||||||
const char *prefix;
|
const char *prefix;
|
||||||
const char *p;
|
const char *p;
|
||||||
char name[4096];
|
char name[VIPS_PATH_MAX];
|
||||||
|
|
||||||
/* Already set?
|
/* Already set?
|
||||||
*/
|
*/
|
||||||
@ -747,10 +747,11 @@ vips_guess_prefix( const char *argv0, const char *env_name )
|
|||||||
if( strlen( VIPS_EXEEXT ) > 0 ) {
|
if( strlen( VIPS_EXEEXT ) > 0 ) {
|
||||||
const char *olds[] = { VIPS_EXEEXT };
|
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
|
else
|
||||||
vips_strncpy( name, p, 4096 );
|
vips_strncpy( name, p, VIPS_PATH_MAX );
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf( "vips_guess_prefix: argv0 = %s\n", argv0 );
|
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 );
|
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
|
||||||
|
|
||||||
VipsToken token;
|
VipsToken token;
|
||||||
char string[4096];
|
char string[VIPS_PATH_MAX];
|
||||||
char string2[4096];
|
char string2[VIPS_PATH_MAX];
|
||||||
GParamSpec *pspec;
|
GParamSpec *pspec;
|
||||||
VipsArgumentClass *argument_class;
|
VipsArgumentClass *argument_class;
|
||||||
VipsArgumentInstance *argument_instance;
|
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 );
|
return( -1 );
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if( !(p = vips__token_need( p, VIPS_TOKEN_STRING,
|
if( !(p = vips__token_need( p, VIPS_TOKEN_STRING,
|
||||||
string, 4096 )) )
|
string, VIPS_PATH_MAX )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
||||||
/* We have to look for a '=', ')' or a ',' to see if string is
|
/* We have to look for a '=', ')' or a ',' to see if string is
|
||||||
* a param name or a value.
|
* 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 );
|
return( -1 );
|
||||||
if( token == VIPS_TOKEN_EQUALS ) {
|
if( token == VIPS_TOKEN_EQUALS ) {
|
||||||
if( !(p = vips__token_need( p, VIPS_TOKEN_STRING,
|
if( !(p = vips__token_need( p, VIPS_TOKEN_STRING,
|
||||||
string2, 4096 )) )
|
string2, VIPS_PATH_MAX )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
if( vips_object_set_argument_from_string( object,
|
if( vips_object_set_argument_from_string( object,
|
||||||
string, string2 ) )
|
string, string2 ) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
if( !(p = vips__token_must( p, &token,
|
if( !(p = vips__token_must( p, &token,
|
||||||
string2, 4096 )) )
|
string2, VIPS_PATH_MAX )) )
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
else if( g_object_class_find_property(
|
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 );
|
} 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,
|
vips_error( class->nickname,
|
||||||
"%s", _( "extra tokens after ')'" ) );
|
"%s", _( "extra tokens after ')'" ) );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
@ -2035,7 +2037,7 @@ VipsObject *
|
|||||||
vips_object_new_from_string( VipsObjectClass *object_class, const char *p )
|
vips_object_new_from_string( VipsObjectClass *object_class, const char *p )
|
||||||
{
|
{
|
||||||
const char *q;
|
const char *q;
|
||||||
char str[4096];
|
char str[VIPS_PATH_MAX];
|
||||||
VipsObject *object;
|
VipsObject *object;
|
||||||
|
|
||||||
g_assert( object_class );
|
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.
|
* everything before that as the principal arg for the constructor.
|
||||||
*/
|
*/
|
||||||
if( (q = vips__find_rightmost_brackets( p )) )
|
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
|
else
|
||||||
vips_strncpy( str, p, 4096 );
|
vips_strncpy( str, p, VIPS_PATH_MAX );
|
||||||
if( !(object = object_class->new_from_string( str )) )
|
if( !(object = object_class->new_from_string( str )) )
|
||||||
return( NULL );
|
return( NULL );
|
||||||
|
|
||||||
|
@ -63,8 +63,6 @@
|
|||||||
|
|
||||||
#include <vips/vips.h>
|
#include <vips/vips.h>
|
||||||
|
|
||||||
#define MAX_STRSIZE (4096)
|
|
||||||
|
|
||||||
typedef struct _VipsSystem {
|
typedef struct _VipsSystem {
|
||||||
VipsOperation parent_instance;
|
VipsOperation parent_instance;
|
||||||
|
|
||||||
@ -111,8 +109,8 @@ vips_system_build( VipsObject *object )
|
|||||||
VipsSystem *system = (VipsSystem *) object;
|
VipsSystem *system = (VipsSystem *) object;
|
||||||
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char line[MAX_STRSIZE];
|
char line[VIPS_PATH_MAX];
|
||||||
char txt[MAX_STRSIZE];
|
char txt[VIPS_PATH_MAX];
|
||||||
VipsBuf buf = VIPS_BUF_STATIC( txt );
|
VipsBuf buf = VIPS_BUF_STATIC( txt );
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
@ -151,7 +149,7 @@ vips_system_build( VipsObject *object )
|
|||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
while( fgets( line, MAX_STRSIZE, fp ) )
|
while( fgets( line, VIPS_PATH_MAX, fp ) )
|
||||||
if( !vips_buf_appends( &buf, line ) )
|
if( !vips_buf_appends( &buf, line ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1166,11 +1166,11 @@ FILE *
|
|||||||
vips_popenf( const char *fmt, const char *mode, ... )
|
vips_popenf( const char *fmt, const char *mode, ... )
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char buf[4096];
|
char buf[VIPS_PATH_MAX];
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
va_start( args, mode );
|
va_start( args, mode );
|
||||||
(void) vips_vsnprintf( buf, 4096, fmt, args );
|
(void) vips_vsnprintf( buf, VIPS_PATH_MAX, fmt, args );
|
||||||
va_end( args );
|
va_end( args );
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -1387,14 +1387,15 @@ vips__find_rightmost_brackets( const char *p )
|
|||||||
{
|
{
|
||||||
const char *start[MAX_TOKENS];
|
const char *start[MAX_TOKENS];
|
||||||
VipsToken tokens[MAX_TOKENS];
|
VipsToken tokens[MAX_TOKENS];
|
||||||
char str[4096];
|
char str[VIPS_PATH_MAX];
|
||||||
int n, i;
|
int n, i;
|
||||||
int nest;
|
int nest;
|
||||||
|
|
||||||
start[0] = p;
|
start[0] = p;
|
||||||
for( n = 0;
|
for( n = 0;
|
||||||
n < MAX_TOKENS &&
|
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 )
|
n++, start[n] = p )
|
||||||
;
|
;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user