Merge remote-tracking branch 'origin/7.36'
This commit is contained in:
commit
1da3064e7b
@ -29,6 +29,7 @@
|
||||
20/11/13 started 7.36.5
|
||||
- better cache sizing in unbuffered sequential mode
|
||||
- allow larger tile_size in dzsave
|
||||
- remove use of PATH_MAX to help gnu hurd
|
||||
|
||||
15/11/13 started 7.36.4
|
||||
- improve compat with im_init_world()
|
||||
|
@ -705,7 +705,7 @@ int
|
||||
im_load_plugins( const char *fmt, ... )
|
||||
{
|
||||
va_list ap;
|
||||
char dir_name[PATH_MAX];
|
||||
char dir_name[4096];
|
||||
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, PATH_MAX - 1, fmt, ap );
|
||||
(void) im_vsnprintf( dir_name, 4096 - 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[PATH_MAX];
|
||||
char path[4096];
|
||||
|
||||
im_snprintf( path, PATH_MAX - 1,
|
||||
im_snprintf( path, 4096 - 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[PATH_MAX];
|
||||
char buf[4096];
|
||||
|
||||
if( dz->layout == VIPS_FOREIGN_DZ_LAYOUT_DZ )
|
||||
vips_snprintf( buf, PATH_MAX, "%s_files", dz->basename );
|
||||
vips_snprintf( buf, 4096, "%s_files", dz->basename );
|
||||
else
|
||||
vips_snprintf( buf, PATH_MAX, "%s", dz->basename );
|
||||
vips_snprintf( buf, 4096, "%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[PATH_MAX];
|
||||
char buf[4096];
|
||||
char *p;
|
||||
|
||||
vips_snprintf( buf, PATH_MAX, "%s.dzi", dz->basename );
|
||||
vips_snprintf( buf, 4096, "%s.dzi", dz->basename );
|
||||
if( !(fp = vips__file_open_write( buf, TRUE )) )
|
||||
return( -1 );
|
||||
|
||||
vips_snprintf( buf, PATH_MAX, "%s", dz->suffix + 1 );
|
||||
vips_snprintf( buf, 4096, "%s", dz->suffix + 1 );
|
||||
if( (p = (char *) vips__find_rightmost_brackets( buf )) )
|
||||
*p = '\0';
|
||||
|
||||
@ -419,9 +419,9 @@ static int
|
||||
write_properties( VipsForeignSaveDz *dz )
|
||||
{
|
||||
FILE *fp;
|
||||
char buf[PATH_MAX];
|
||||
char buf[4096];
|
||||
|
||||
vips_snprintf( buf, PATH_MAX, "%s/ImageProperties.xml", dz->basename );
|
||||
vips_snprintf( buf, 4096, "%s/ImageProperties.xml", dz->basename );
|
||||
if( !(fp = vips__file_open_write( buf, TRUE )) )
|
||||
return( -1 );
|
||||
|
||||
@ -441,14 +441,14 @@ write_properties( VipsForeignSaveDz *dz )
|
||||
static int
|
||||
write_blank( VipsForeignSaveDz *dz )
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
char buf[4096];
|
||||
VipsImage *x, *t;
|
||||
int n;
|
||||
VipsArea *ones;
|
||||
double *d;
|
||||
int i;
|
||||
|
||||
vips_snprintf( buf, PATH_MAX, "%s/blank.png", dz->basename );
|
||||
vips_snprintf( buf, 4096, "%s/blank.png", dz->basename );
|
||||
if( vips_black( &x, dz->tile_size, dz->tile_size, NULL ) )
|
||||
return( -1 );
|
||||
|
||||
@ -711,8 +711,8 @@ tile_name( Layer *layer, char *buf, int x, int y )
|
||||
|
||||
VipsForeignSaveDz *dz = layer->dz;
|
||||
|
||||
char dirname[PATH_MAX];
|
||||
char dirname2[PATH_MAX];
|
||||
char dirname[4096];
|
||||
char dirname2[4096];
|
||||
Layer *p;
|
||||
int n;
|
||||
|
||||
@ -722,9 +722,9 @@ tile_name( Layer *layer, char *buf, int x, int y )
|
||||
|
||||
switch( dz->layout ) {
|
||||
case VIPS_FOREIGN_DZ_LAYOUT_DZ:
|
||||
vips_snprintf( dirname, PATH_MAX, "%s_files/%d",
|
||||
vips_snprintf( dirname, 4096, "%s_files/%d",
|
||||
dz->basename, layer->n );
|
||||
vips_snprintf( buf, PATH_MAX, "%s/%d_%d%s",
|
||||
vips_snprintf( buf, 4096, "%s/%d_%d%s",
|
||||
dirname, x, y, dz->suffix );
|
||||
|
||||
if( !vips_existsf( "%s", dirname ) &&
|
||||
@ -752,9 +752,9 @@ tile_name( Layer *layer, char *buf, int x, int y )
|
||||
*/
|
||||
n += y * layer->tiles_across + x;
|
||||
|
||||
vips_snprintf( dirname, PATH_MAX, "%s/TileGroup%d",
|
||||
vips_snprintf( dirname, 4096, "%s/TileGroup%d",
|
||||
dz->basename, n / 256 );
|
||||
vips_snprintf( buf, PATH_MAX, "%s/%d-%d-%d%s",
|
||||
vips_snprintf( buf, 4096, "%s/%d-%d-%d%s",
|
||||
dirname, layer->n, x, y, dz->suffix );
|
||||
|
||||
/* Used at the end in ImageProperties.xml
|
||||
@ -770,11 +770,11 @@ tile_name( Layer *layer, char *buf, int x, int y )
|
||||
break;
|
||||
|
||||
case VIPS_FOREIGN_DZ_LAYOUT_GOOGLE:
|
||||
vips_snprintf( dirname, PATH_MAX, "%s/%d",
|
||||
vips_snprintf( dirname, 4096, "%s/%d",
|
||||
dz->basename, layer->n );
|
||||
vips_snprintf( dirname2, PATH_MAX, "%s/%d",
|
||||
vips_snprintf( dirname2, 4096, "%s/%d",
|
||||
dirname, y );
|
||||
vips_snprintf( buf, PATH_MAX, "%s/%d%s",
|
||||
vips_snprintf( buf, 4096, "%s/%d%s",
|
||||
dirname2, x, dz->suffix );
|
||||
|
||||
if( !vips_existsf( "%s", dirname ) &&
|
||||
@ -809,7 +809,7 @@ strip_work( VipsThreadState *state, void *a )
|
||||
Layer *layer = strip->layer;
|
||||
VipsForeignSaveDz *dz = layer->dz;
|
||||
|
||||
char buf[PATH_MAX];
|
||||
char buf[4096];
|
||||
VipsImage *x;
|
||||
VipsImage *t;
|
||||
|
||||
|
@ -542,30 +542,6 @@ vips_get_option_group( void )
|
||||
return( option_group );
|
||||
}
|
||||
|
||||
static char *
|
||||
get_current_dir( void )
|
||||
{
|
||||
static char buffer[PATH_MAX];
|
||||
char *dir;
|
||||
|
||||
/* We don't use getcwd(3) on SUNOS, because, it does a popen("pwd")
|
||||
* and, if that wasn't bad enough, hangs in doing so.
|
||||
*/
|
||||
#if defined( sun ) && !defined( __SVR4 )
|
||||
dir = getwd( buffer );
|
||||
#else /* !sun */
|
||||
dir = getcwd( buffer, PATH_MAX );
|
||||
#endif /* !sun */
|
||||
|
||||
if( !dir ) {
|
||||
buffer[0] = G_DIR_SEPARATOR;
|
||||
buffer[1] = '\0';
|
||||
dir = buffer;
|
||||
}
|
||||
|
||||
return( dir );
|
||||
}
|
||||
|
||||
/* Find the prefix part of a dir ... name is the name of this prog from argv0.
|
||||
*
|
||||
* dir name guess prefix
|
||||
@ -578,8 +554,8 @@ get_current_dir( void )
|
||||
static char *
|
||||
extract_prefix( const char *dir, const char *name )
|
||||
{
|
||||
char edir[PATH_MAX];
|
||||
char vname[PATH_MAX];
|
||||
char edir[4096];
|
||||
char vname[4096];
|
||||
int i;
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -590,11 +566,15 @@ extract_prefix( const char *dir, const char *name )
|
||||
/* Is dir relative? Prefix with cwd.
|
||||
*/
|
||||
if( !g_path_is_absolute( dir ) ) {
|
||||
vips_snprintf( edir, PATH_MAX, "%s" G_DIR_SEPARATOR_S "%s",
|
||||
get_current_dir(), dir );
|
||||
char *cwd;
|
||||
|
||||
cwd = g_get_current_dir();
|
||||
vips_snprintf( edir, 4096, "%s" G_DIR_SEPARATOR_S "%s",
|
||||
cwd, dir );
|
||||
g_free( cwd );
|
||||
}
|
||||
else {
|
||||
vips_strncpy( edir, dir, PATH_MAX );
|
||||
vips_strncpy( edir, dir, 4096 );
|
||||
}
|
||||
|
||||
/* Chop off the trailing prog name, plus the trailing
|
||||
@ -602,7 +582,7 @@ extract_prefix( const char *dir, const char *name )
|
||||
*/
|
||||
if( !vips_ispostfix( edir, name ) )
|
||||
return( NULL );
|
||||
vips_strncpy( vname, edir, PATH_MAX );
|
||||
vips_strncpy( vname, edir, 4096 );
|
||||
vname[strlen( edir ) - strlen( name ) - 1] = '\0';
|
||||
|
||||
/* Remove any "/./", any trailing "/.", any trailing "/".
|
||||
@ -644,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[PATH_MAX];
|
||||
char str[4096];
|
||||
|
||||
/* Form complete path.
|
||||
*/
|
||||
vips_snprintf( str, PATH_MAX,
|
||||
vips_snprintf( str, 4096,
|
||||
"%s" G_DIR_SEPARATOR_S "%s", p, name );
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -672,7 +652,7 @@ find_file( const char *name )
|
||||
{
|
||||
const char *path = g_getenv( "PATH" );
|
||||
char *prefix;
|
||||
char full_path[PATH_MAX];
|
||||
char full_path[4096];
|
||||
|
||||
if( !path )
|
||||
return( NULL );
|
||||
@ -682,12 +662,18 @@ find_file( const char *name )
|
||||
#endif /*DEBUG*/
|
||||
|
||||
#ifdef OS_WIN32
|
||||
{
|
||||
char *dir;
|
||||
|
||||
/* Windows always searches '.' first, so prepend cwd to path.
|
||||
*/
|
||||
vips_snprintf( full_path, PATH_MAX, "%s" G_SEARCHPATH_SEPARATOR_S "%s",
|
||||
get_current_dir(), path );
|
||||
dir = g_get_current_dir();
|
||||
vips_snprintf( full_path, 4096, "%s" G_SEARCHPATH_SEPARATOR_S "%s",
|
||||
dir, path );
|
||||
g_free( dir );
|
||||
}
|
||||
#else /*!OS_WIN32*/
|
||||
vips_strncpy( full_path, path, PATH_MAX );
|
||||
vips_strncpy( full_path, path, 4096 );
|
||||
#endif /*OS_WIN32*/
|
||||
|
||||
if( (prefix = scan_path( full_path, name )) )
|
||||
@ -735,15 +721,19 @@ guess_prefix( const char *argv0, const char *name )
|
||||
* a full path in argv[0].
|
||||
*/
|
||||
if( !g_path_is_absolute( argv0 ) ) {
|
||||
char full_path[PATH_MAX];
|
||||
char resolved[PATH_MAX];
|
||||
char full_path[4096];
|
||||
char *resolved;
|
||||
char *dir;
|
||||
|
||||
vips_snprintf( full_path, PATH_MAX,
|
||||
"%s" G_DIR_SEPARATOR_S "%s", get_current_dir(), argv0 );
|
||||
|
||||
if( realpath( full_path, resolved ) ) {
|
||||
if( (prefix = extract_prefix( resolved, name )) ) {
|
||||
dir = g_get_current_dir();
|
||||
vips_snprintf( full_path, 4096,
|
||||
"%s" G_DIR_SEPARATOR_S "%s", dir, argv0 );
|
||||
g_free( dir );
|
||||
|
||||
if( (resolved = realpath( full_path, NULL )) ) {
|
||||
prefix = extract_prefix( resolved, name );
|
||||
free( resolved );
|
||||
if( prefix ) {
|
||||
#ifdef DEBUG
|
||||
printf( "vips_guess_prefix: found \"%s\" "
|
||||
"from cwd\n", prefix );
|
||||
@ -783,7 +773,7 @@ vips_guess_prefix( const char *argv0, const char *env_name )
|
||||
{
|
||||
const char *prefix;
|
||||
const char *p;
|
||||
char name[PATH_MAX];
|
||||
char name[4096];
|
||||
|
||||
/* Already set?
|
||||
*/
|
||||
@ -804,15 +794,14 @@ 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, PATH_MAX, VIPS_EXEEXT, olds, 1 );
|
||||
vips__change_suffix( p, name, 4096, VIPS_EXEEXT, olds, 1 );
|
||||
}
|
||||
else
|
||||
vips_strncpy( name, p, PATH_MAX );
|
||||
vips_strncpy( name, p, 4096 );
|
||||
|
||||
#ifdef DEBUG
|
||||
printf( "vips_guess_prefix: argv0 = %s\n", argv0 );
|
||||
printf( "vips_guess_prefix: name = %s\n", name );
|
||||
printf( "vips_guess_prefix: cwd = %s\n", get_current_dir() );
|
||||
#endif /*DEBUG*/
|
||||
|
||||
prefix = guess_prefix( argv0, name );
|
||||
|
@ -1959,34 +1959,34 @@ vips_object_set_args( VipsObject *object, const char *p )
|
||||
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
|
||||
|
||||
VipsToken token;
|
||||
char string[PATH_MAX];
|
||||
char string2[PATH_MAX];
|
||||
char string[4096];
|
||||
char string2[4096];
|
||||
GParamSpec *pspec;
|
||||
VipsArgumentClass *argument_class;
|
||||
VipsArgumentInstance *argument_instance;
|
||||
|
||||
if( !(p = vips__token_need( p, VIPS_TOKEN_LEFT, string, PATH_MAX )) )
|
||||
if( !(p = vips__token_need( p, VIPS_TOKEN_LEFT, string, 4096 )) )
|
||||
return( -1 );
|
||||
|
||||
do {
|
||||
if( !(p = vips__token_need( p, VIPS_TOKEN_STRING,
|
||||
string, PATH_MAX )) )
|
||||
string, 4096 )) )
|
||||
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, PATH_MAX )) )
|
||||
if( !(p = vips__token_must( p, &token, string2, 4096 )) )
|
||||
return( -1 );
|
||||
if( token == VIPS_TOKEN_EQUALS ) {
|
||||
if( !(p = vips__token_need( p, VIPS_TOKEN_STRING,
|
||||
string2, PATH_MAX )) )
|
||||
string2, 4096 )) )
|
||||
return( -1 );
|
||||
if( vips_object_set_argument_from_string( object,
|
||||
string, string2 ) )
|
||||
return( -1 );
|
||||
if( !(p = vips__token_must( p, &token,
|
||||
string2, PATH_MAX )) )
|
||||
string2, 4096 )) )
|
||||
return( -1 );
|
||||
}
|
||||
else if( g_object_class_find_property(
|
||||
@ -2022,7 +2022,7 @@ vips_object_set_args( VipsObject *object, const char *p )
|
||||
}
|
||||
} while( token != VIPS_TOKEN_RIGHT );
|
||||
|
||||
if( (p = vips__token_get( p, &token, string, PATH_MAX )) ) {
|
||||
if( (p = vips__token_get( p, &token, string, 4096 )) ) {
|
||||
vips_error( class->nickname,
|
||||
"%s", _( "extra tokens after ')'" ) );
|
||||
return( -1 );
|
||||
@ -2035,7 +2035,7 @@ VipsObject *
|
||||
vips_object_new_from_string( VipsObjectClass *object_class, const char *p )
|
||||
{
|
||||
const char *q;
|
||||
char str[PATH_MAX];
|
||||
char str[4096];
|
||||
VipsObject *object;
|
||||
|
||||
g_assert( object_class );
|
||||
@ -2045,9 +2045,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( PATH_MAX, q - p + 1 ) );
|
||||
vips_strncpy( str, p, VIPS_MIN( 4096, q - p + 1 ) );
|
||||
else
|
||||
vips_strncpy( str, p, PATH_MAX );
|
||||
vips_strncpy( str, p, 4096 );
|
||||
if( !(object = object_class->new_from_string( str )) )
|
||||
return( NULL );
|
||||
|
||||
|
@ -1141,18 +1141,18 @@ int
|
||||
vips_existsf( const char *name, ... )
|
||||
{
|
||||
va_list ap;
|
||||
char buf1[PATH_MAX];
|
||||
char *path;
|
||||
int result;
|
||||
|
||||
va_start( ap, name );
|
||||
(void) vips_vsnprintf( buf1, PATH_MAX - 1, name, ap );
|
||||
path = g_strdup_vprintf( name, ap );
|
||||
va_end( ap );
|
||||
|
||||
/* Try that.
|
||||
*/
|
||||
if( !access( buf1, R_OK ) )
|
||||
return( 1 );
|
||||
result = access( path, R_OK );
|
||||
|
||||
return( 0 );
|
||||
g_free( path );
|
||||
|
||||
return( !result );
|
||||
}
|
||||
|
||||
#ifdef OS_WIN32
|
||||
@ -1191,20 +1191,20 @@ int
|
||||
vips_mkdirf( const char *name, ... )
|
||||
{
|
||||
va_list ap;
|
||||
char buf1[PATH_MAX];
|
||||
char *path;
|
||||
|
||||
va_start( ap, name );
|
||||
(void) vips_vsnprintf( buf1, PATH_MAX - 1, name, ap );
|
||||
path = g_strdup_vprintf( name, ap );
|
||||
va_end( ap );
|
||||
|
||||
/* Try that.
|
||||
*/
|
||||
if( g_mkdir( buf1, 0755 ) ) {
|
||||
if( g_mkdir( path, 0755 ) ) {
|
||||
vips_error( "mkdirf",
|
||||
_( "unable to create directory \"%s\", %s" ),
|
||||
buf1, strerror( errno ) );
|
||||
path, strerror( errno ) );
|
||||
g_free( path );
|
||||
return( -1 );
|
||||
}
|
||||
g_free( path );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
@ -1213,7 +1213,7 @@ vips_mkdirf( const char *name, ... )
|
||||
*
|
||||
* Strings can't be adjacent, so "hello world" (without quotes) is a single
|
||||
* string. Strings are written (with \" escaped) into @string. If the string
|
||||
* is larger than @size, it is silently null-termionated and truncated.
|
||||
* is larger than @size, it is silently null-terminated and truncated.
|
||||
*
|
||||
* Return NULL for end of tokens.
|
||||
*/
|
||||
@ -1387,14 +1387,14 @@ vips__find_rightmost_brackets( const char *p )
|
||||
{
|
||||
const char *start[MAX_TOKENS];
|
||||
VipsToken tokens[MAX_TOKENS];
|
||||
char str[PATH_MAX];
|
||||
char str[4096];
|
||||
int n, i;
|
||||
int nest;
|
||||
|
||||
start[0] = p;
|
||||
for( n = 0;
|
||||
n < MAX_TOKENS &&
|
||||
(p = vips__token_get( start[n], &tokens[n], str, PATH_MAX ));
|
||||
(p = vips__token_get( start[n], &tokens[n], str, 4096 ));
|
||||
n++, start[n] = p )
|
||||
;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user