diff options
author | Alex Cherepanov <alex.cherepanov@artifex.com> | 2006-08-14 09:46:08 +0000 |
---|---|---|
committer | Alex Cherepanov <alex.cherepanov@artifex.com> | 2006-08-14 09:46:08 +0000 |
commit | caa5547740bf4d973adbdde1da01046ccd16b194 (patch) | |
tree | 1a52ead18a28eaeee0eee2bd0126ddf64fea5092 | |
parent | 8e3c51c9c26dc81dbe48ccc1894c82ce8157b4c3 (diff) |
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 .
git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@6989 a1074d23-0009-0410-80fe-cf8c14f379e6
-rw-r--r-- | gs/src/idparam.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/gs/src/idparam.c b/gs/src/idparam.c index 2fa4d0ce6..d7bb935db 100644 --- a/gs/src/idparam.c +++ b/gs/src/idparam.c @@ -50,7 +50,7 @@ dict_bool_param(const ref * pdict, const char *kstr, /* 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 @@ dict_int_null_param(const ref * pdict, const char *kstr, int minval, } 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 @@ dict_int_param(const ref * pdict, const char *kstr, int minval, int maxval, /* 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 @@ dict_uint_param(const ref * pdict, const char *kstr, 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; } |