From 3d961653a90e6a8c9329890f123b8fb4c348e4bc Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Wed, 1 Mar 2017 11:29:39 +0000 Subject: [PATCH] use VIPS_MAX_COORD in a few more places we had RANGE defined in each file before --- libvips/arithmetic/getpoint.c | 9 ++------- libvips/arithmetic/measure.c | 17 ++++++----------- libvips/conversion/extract.c | 17 ++++++----------- libvips/conversion/insert.c | 9 ++------- libvips/conversion/subsample.c | 9 ++------- libvips/conversion/zoom.c | 9 ++------- 6 files changed, 20 insertions(+), 50 deletions(-) diff --git a/libvips/arithmetic/getpoint.c b/libvips/arithmetic/getpoint.c index fb6c2218..3eb81bef 100644 --- a/libvips/arithmetic/getpoint.c +++ b/libvips/arithmetic/getpoint.c @@ -118,11 +118,6 @@ vips_getpoint_build( VipsObject *object ) return( 0 ); } -/* xy range we sanity check on ... just to stop crazy numbers from 1/0 etc. - * causing g_assert() failures later. - */ -#define RANGE (100000000) - static void vips_getpoint_class_init( VipsGetpointClass *class ) { @@ -154,14 +149,14 @@ vips_getpoint_class_init( VipsGetpointClass *class ) _( "Point to read" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsGetpoint, x ), - 0, RANGE, 0 ); + 0, VIPS_MAX_COORD, 0 ); VIPS_ARG_INT( class, "y", 6, _( "y" ), _( "Point to read" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsGetpoint, y ), - 0, RANGE, 0 ); + 0, VIPS_MAX_COORD, 0 ); } diff --git a/libvips/arithmetic/measure.c b/libvips/arithmetic/measure.c index 5bbfcfb5..e9d09e7b 100644 --- a/libvips/arithmetic/measure.c +++ b/libvips/arithmetic/measure.c @@ -181,11 +181,6 @@ vips_measure_build( VipsObject *object ) return( 0 ); } -/* xy range we sanity check on ... just to stop crazy numbers from 1/0 etc. - * causing g_assert() failures later. - */ -#define RANGE (100000000) - static void vips_measure_class_init( VipsMeasureClass *class ) { @@ -217,42 +212,42 @@ vips_measure_class_init( VipsMeasureClass *class ) _( "Number of patches across chart" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsMeasure, h ), - 1, RANGE, 1 ); + 1, VIPS_MAX_COORD, 1 ); VIPS_ARG_INT( class, "v", 6, _( "Down" ), _( "Number of patches down chart" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsMeasure, v ), - 1, RANGE, 1 ); + 1, VIPS_MAX_COORD, 1 ); VIPS_ARG_INT( class, "left", 10, _( "Left" ), _( "Left edge of extract area" ), VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsMeasure, left ), - 0, RANGE, 0 ); + 0, VIPS_MAX_COORD, 0 ); VIPS_ARG_INT( class, "top", 11, _( "Top" ), _( "Top edge of extract area" ), VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsMeasure, top ), - 0, RANGE, 0 ); + 0, VIPS_MAX_COORD, 0 ); VIPS_ARG_INT( class, "width", 12, _( "Width" ), _( "Width of extract area" ), VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsMeasure, width ), - 1, RANGE, 1 ); + 1, VIPS_MAX_COORD, 1 ); VIPS_ARG_INT( class, "height", 13, _( "Height" ), _( "Height of extract area" ), VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsMeasure, height ), - 1, RANGE, 1 ); + 1, VIPS_MAX_COORD, 1 ); } diff --git a/libvips/conversion/extract.c b/libvips/conversion/extract.c index 879efae1..6042a2cc 100644 --- a/libvips/conversion/extract.c +++ b/libvips/conversion/extract.c @@ -172,11 +172,6 @@ vips_extract_area_build( VipsObject *object ) return( 0 ); } -/* xy range we sanity check on ... just to stop crazy numbers from divide by 0 - * etc. causing g_assert() failures later. - */ -#define RANGE (100000000) - static void vips_extract_area_class_init( VipsExtractAreaClass *class ) { @@ -206,28 +201,28 @@ vips_extract_area_class_init( VipsExtractAreaClass *class ) _( "Left edge of extract area" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsExtractArea, left ), - -RANGE, RANGE, 0 ); + -VIPS_MAX_COORD, VIPS_MAX_COORD, 0 ); VIPS_ARG_INT( class, "top", 3, _( "Top" ), _( "Top edge of extract area" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsExtractArea, top ), - -RANGE, RANGE, 0 ); + -VIPS_MAX_COORD, VIPS_MAX_COORD, 0 ); VIPS_ARG_INT( class, "width", 4, _( "Width" ), _( "Width of extract area" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsExtractArea, width ), - 1, RANGE, 1 ); + 1, VIPS_MAX_COORD, 1 ); VIPS_ARG_INT( class, "height", 5, _( "Height" ), _( "Height of extract area" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsExtractArea, height ), - 1, RANGE, 1 ); + 1, VIPS_MAX_COORD, 1 ); } @@ -429,14 +424,14 @@ vips_extract_band_class_init( VipsExtractBandClass *class ) _( "Band to extract" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsExtractBand, band ), - 0, RANGE, 0 ); + 0, VIPS_MAX_COORD, 0 ); VIPS_ARG_INT( class, "n", 4, _( "n" ), _( "Number of bands to extract" ), VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsExtractBand, n ), - 1, RANGE, 1 ); + 1, VIPS_MAX_COORD, 1 ); } diff --git a/libvips/conversion/insert.c b/libvips/conversion/insert.c index 872c71d4..1e4dd668 100644 --- a/libvips/conversion/insert.c +++ b/libvips/conversion/insert.c @@ -487,11 +487,6 @@ vips_insert_build( VipsObject *object ) return( 0 ); } -/* xy range we sanity check on ... just to stop crazy numbers from 1/0 etc. - * causing g_assert() failures later. - */ -#define RANGE (100000000) - static void vips_insert_class_init( VipsInsertClass *class ) { @@ -530,14 +525,14 @@ vips_insert_class_init( VipsInsertClass *class ) _( "Left edge of sub in main" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsInsert, x ), - -RANGE, RANGE, 0 ); + -VIPS_MAX_COORD, VIPS_MAX_COORD, 0 ); VIPS_ARG_INT( class, "y", 3, _( "Y" ), _( "Top edge of sub in main" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsInsert, y ), - -RANGE, RANGE, 0 ); + -VIPS_MAX_COORD, VIPS_MAX_COORD, 0 ); VIPS_ARG_BOOL( class, "expand", 4, _( "Expand" ), diff --git a/libvips/conversion/subsample.c b/libvips/conversion/subsample.c index 0f5029ac..1fdfde8f 100644 --- a/libvips/conversion/subsample.c +++ b/libvips/conversion/subsample.c @@ -248,11 +248,6 @@ vips_subsample_build( VipsObject *object ) return( 0 ); } -/* xy range we sanity check on ... just to stop crazy numbers from divide by 0 - * etc. causing g_assert() failures later. - */ -#define RANGE (100000000) - static void vips_subsample_class_init( VipsSubsampleClass *class ) { @@ -281,14 +276,14 @@ vips_subsample_class_init( VipsSubsampleClass *class ) _( "Horizontal subsample factor" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsSubsample, xfac ), - 1, RANGE, 1 ); + 1, VIPS_MAX_COORD, 1 ); VIPS_ARG_INT( class, "yfac", 3, _( "Yfac" ), _( "Vertical subsample factor" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsSubsample, yfac ), - 1, RANGE, 1 ); + 1, VIPS_MAX_COORD, 1 ); VIPS_ARG_BOOL( class, "point", 2, _( "Point" ), diff --git a/libvips/conversion/zoom.c b/libvips/conversion/zoom.c index 8421b091..af6800e9 100644 --- a/libvips/conversion/zoom.c +++ b/libvips/conversion/zoom.c @@ -358,11 +358,6 @@ vips_zoom_build( VipsObject *object ) return( 0 ); } -/* xy range we sanity check on ... just to stop crazy numbers from divide by 0 - * etc. causing g_assert() failures later. - */ -#define RANGE (100000000) - static void vips_zoom_class_init( VipsZoomClass *class ) { @@ -390,14 +385,14 @@ vips_zoom_class_init( VipsZoomClass *class ) _( "Horizontal zoom factor" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsZoom, xfac ), - 1, RANGE, 1 ); + 1, VIPS_MAX_COORD, 1 ); VIPS_ARG_INT( class, "yfac", 3, _( "Yfac" ), _( "Vertical zoom factor" ), VIPS_ARGUMENT_REQUIRED_INPUT, G_STRUCT_OFFSET( VipsZoom, yfac ), - 1, RANGE, 1 ); + 1, VIPS_MAX_COORD, 1 ); }