Merge remote-tracking branch 'origin/7.32' into 7.32

Conflicts:
	ChangeLog
This commit is contained in:
John Cupitt 2013-04-08 13:17:10 +01:00
commit f0cbe27bb2
4 changed files with 72 additions and 3 deletions

View File

@ -1,7 +1,9 @@
12/3/13 started 7.32.2 12/3/13 started 7.32.2
- removed some left-over debugging code from configure.ac - removed some left-over debugging code from configure.ac
- better handling of args without values, thanks Ruven
- better error messages from vips.c - better error messages from vips.c
- fix demand hints so "vips shrink" works again, thanks Jan - fix demand hints so "vips shrink" works again, thanks Jan
- im_jpeg2vips.c builds without jpeglib.h, thanks Alessandro
6/2/13 started 7.32.1 6/2/13 started 7.32.1
- fix --without-lcms, thanks speckins - fix --without-lcms, thanks speckins

View File

@ -44,13 +44,15 @@
#include <vips/intl.h> #include <vips/intl.h>
#include <stdlib.h> #include <stdlib.h>
#include <setjmp.h>
#include <vips/vips.h> #include <vips/vips.h>
#include <setjmp.h> #ifdef HAVE_JPEG
#include <jpeglib.h> #include <jpeglib.h>
#include <jerror.h> #include <jerror.h>
#include "../foreign/jpeg.h" #include "../foreign/jpeg.h"
#endif /*HAVE_JPEG*/
static int static int
jpeg2vips( const char *name, IMAGE *out, gboolean header_only ) jpeg2vips( const char *name, IMAGE *out, gboolean header_only )
@ -116,7 +118,8 @@ jpeg2vips( const char *name, IMAGE *out, gboolean header_only )
header_only, shrink, fail_on_warn ) ) header_only, shrink, fail_on_warn ) )
return( -1 ); return( -1 );
#else #else
vips_error( "im_jpeg2vips", _( "no JPEG support in your libvips" ) ); vips_error( "im_jpeg2vips",
"%s", _( "no JPEG support in your libvips" ) );
return( -1 ); return( -1 );
#endif /*HAVE_JPEG*/ #endif /*HAVE_JPEG*/

View File

@ -15,7 +15,8 @@
* *
* You should have received a copy of the GNU Library General Public * You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
* *
* \section{Base-64 Routines} * \section{Base-64 Routines}
* *

View File

@ -1462,6 +1462,29 @@ vips_enum_error( VipsObjectClass *class, GType otype, const char *value )
g_type_name( otype ), value, vips_buf_all( &buf ) ); g_type_name( otype ), value, vips_buf_all( &buf ) );
} }
static void
vips_object_no_value( VipsObject *object, const char *name )
{
VipsObjectClass *class = VIPS_OBJECT_GET_CLASS( object );
GParamSpec *pspec;
VipsArgumentClass *argument_class;
VipsArgumentInstance *argument_instance;
if( vips_object_get_argument( object, name,
&pspec, &argument_class, &argument_instance ) )
g_assert( 0 );
if( strcmp( name, g_param_spec_get_name( pspec ) ) == 0 )
vips_error( class->nickname,
_( "no value supplied for argument '%s'" ), name );
else
vips_error( class->nickname,
_( "no value supplied for argument '%s' ('%s')" ),
name,
g_param_spec_get_name( pspec ) );
}
/* Set a named arg from a string. /* Set a named arg from a string.
*/ */
int int
@ -1498,6 +1521,11 @@ vips_object_set_argument_from_string( VipsObject *object,
flags = vips_operation_get_flags( flags = vips_operation_get_flags(
VIPS_OPERATION( object ) ); VIPS_OPERATION( object ) );
if( !value ) {
vips_object_no_value( object, name );
return( -1 );
}
/* Read the filename. vips_foreign_load_options() /* Read the filename. vips_foreign_load_options()
* handles embedded options. * handles embedded options.
*/ */
@ -1525,6 +1553,11 @@ vips_object_set_argument_from_string( VipsObject *object,
(oclass = g_type_class_ref( otype )) ) { (oclass = g_type_class_ref( otype )) ) {
VipsObject *new_object; VipsObject *new_object;
if( !value ) {
vips_object_no_value( object, name );
return( -1 );
}
if( !(new_object = if( !(new_object =
vips_object_new_from_string( oclass, value )) ) vips_object_new_from_string( oclass, value )) )
return( -1 ); return( -1 );
@ -1560,6 +1593,11 @@ vips_object_set_argument_from_string( VipsObject *object,
else if( G_IS_PARAM_SPEC_INT( pspec ) ) { else if( G_IS_PARAM_SPEC_INT( pspec ) ) {
int i; int i;
if( !value ) {
vips_object_no_value( object, name );
return( -1 );
}
if( sscanf( value, "%d", &i ) != 1 ) { if( sscanf( value, "%d", &i ) != 1 ) {
vips_error( class->nickname, vips_error( class->nickname,
_( "'%s' is not an integer" ), value ); _( "'%s' is not an integer" ), value );
@ -1574,6 +1612,11 @@ vips_object_set_argument_from_string( VipsObject *object,
*/ */
long long l; long long l;
if( !value ) {
vips_object_no_value( object, name );
return( -1 );
}
if( sscanf( value, "%Ld", &l ) != 1 ) { if( sscanf( value, "%Ld", &l ) != 1 ) {
vips_error( class->nickname, vips_error( class->nickname,
_( "'%s' is not an integer" ), value ); _( "'%s' is not an integer" ), value );
@ -1586,6 +1629,11 @@ vips_object_set_argument_from_string( VipsObject *object,
else if( G_IS_PARAM_SPEC_DOUBLE( pspec ) ) { else if( G_IS_PARAM_SPEC_DOUBLE( pspec ) ) {
double d; double d;
if( !value ) {
vips_object_no_value( object, name );
return( -1 );
}
if( sscanf( value, "%lg", &d ) != 1 ) { if( sscanf( value, "%lg", &d ) != 1 ) {
vips_error( class->nickname, vips_error( class->nickname,
_( "'%s' is not a double" ), value ); _( "'%s' is not a double" ), value );
@ -1598,6 +1646,11 @@ vips_object_set_argument_from_string( VipsObject *object,
else if( G_IS_PARAM_SPEC_ENUM( pspec ) ) { else if( G_IS_PARAM_SPEC_ENUM( pspec ) ) {
GEnumValue *enum_value; GEnumValue *enum_value;
if( !value ) {
vips_object_no_value( object, name );
return( -1 );
}
if( !(enum_value = g_enum_get_value_by_name( if( !(enum_value = g_enum_get_value_by_name(
g_type_class_ref( otype ), value )) ) { g_type_class_ref( otype ), value )) ) {
if( !(enum_value = g_enum_get_value_by_nick( if( !(enum_value = g_enum_get_value_by_nick(
@ -1615,6 +1668,11 @@ vips_object_set_argument_from_string( VipsObject *object,
*/ */
int i; int i;
if( !value ) {
vips_object_no_value( object, name );
return( -1 );
}
if( sscanf( value, "%d", &i ) != 1 ) { if( sscanf( value, "%d", &i ) != 1 ) {
vips_error( class->nickname, vips_error( class->nickname,
_( "'%s' is not an integer" ), value ); _( "'%s' is not an integer" ), value );
@ -1625,6 +1683,11 @@ vips_object_set_argument_from_string( VipsObject *object,
g_value_set_flags( &gvalue, i ); g_value_set_flags( &gvalue, i );
} }
else { else {
if( !value ) {
vips_object_no_value( object, name );
return( -1 );
}
g_value_init( &gvalue, G_TYPE_STRING ); g_value_init( &gvalue, G_TYPE_STRING );
g_value_set_string( &gvalue, value ); g_value_set_string( &gvalue, value );
} }