[gs-cvs] rev 6989 - trunk/gs/src

alexcher at ghostscript.com alexcher at ghostscript.com
Mon Aug 14 02:46:09 PDT 2006


Author: alexcher
Date: 2006-08-14 02:46:08 -0700 (Mon, 14 Aug 2006)
New Revision: 6989

Modified:
   trunk/gs/src/idparam.c
Log:
Return undefinedresult instead of rangecheck from dict_int_null_param()
and dict_uint_param() procedures when the key is not found.
Partial fix for 12-07a.ps and 12-08b.ps .


Modified: trunk/gs/src/idparam.c
===================================================================
--- trunk/gs/src/idparam.c	2006-08-13 03:28:06 UTC (rev 6988)
+++ trunk/gs/src/idparam.c	2006-08-14 09:46:08 UTC (rev 6989)
@@ -50,7 +50,7 @@
 /* Return 0 if found, 1 if defaulted, <0 if invalid. */
 /* If the parameter is null, return 2 without setting *pvalue. */
 /* Note that the default value may be out of range, in which case */
-/* a missing value will return e_rangecheck rather than 1. */
+/* a missing value will return e_undefined rather than 1. */
 int
 dict_int_null_param(const ref * pdict, const char *kstr, int minval,
 		    int maxval, int defaultval, int *pvalue)
@@ -85,8 +85,12 @@
 	}
 	code = 0;
     }
-    if (ival < minval || ival > maxval)
-	return_error(e_rangecheck);
+    if (ival < minval || ival > maxval) {
+	if (code == 1)
+            return_error(e_undefined);
+        else
+            return_error(e_rangecheck);
+    }
     *pvalue = (int)ival;
     return code;
 }
@@ -105,7 +109,7 @@
 /* Get an unsigned integer parameter from a dictionary. */
 /* Return 0 if found, 1 if defaulted, <0 if invalid. */
 /* Note that the default value may be out of range, in which case */
-/* a missing value will return e_rangecheck rather than 1. */
+/* a missing value will return e_undefined rather than 1. */
 int
 dict_uint_param(const ref * pdict, const char *kstr,
 		uint minval, uint maxval, uint defaultval, uint * pvalue)
@@ -124,8 +128,12 @@
 	ival = (uint) pdval->value.intval;
 	code = 0;
     }
-    if (ival < minval || ival > maxval)
-	return_error(e_rangecheck);
+    if (ival < minval || ival > maxval) {
+	if (code == 1)
+            return_error(e_undefined);
+        else
+            return_error(e_rangecheck);
+    }
     *pvalue = ival;
     return code;
 }



More information about the gs-cvs mailing list