diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2020-03-12 17:22:36 +0000 |
---|---|---|
committer | Robin Watts <Robin.Watts@artifex.com> | 2020-03-17 12:18:15 +0000 |
commit | d7961033ee224fc5d2c96a16bea3f3399dd29561 (patch) | |
tree | dbb49973c1b69ac01349a291c697ac791b1f48e6 /psi | |
parent | e1b322c8ca8f08b5af398a912c511dc041cd9c86 (diff) | |
download | ghostpdl-d7961033ee224fc5d2c96a16bea3f3399dd29561.tar.gz |
Add support for 64bit and size_t paramaters.
Cope with both int64_t's and size_t's with appropriate
rangechecks when casting will cause problems.
-d values on the command line are read as int64_t's.
If we ever find outselves wanting to assign a size_t where
the 63rd bit matters, then we may have to rethink this :)
We also change various params (such as MaxBitmap, MaxPatternBitmap
etc) to be size_t's. This affects the device structure itself.
Diffstat (limited to 'psi')
-rw-r--r-- | psi/imainarg.c | 7 | ||||
-rw-r--r-- | psi/iparam.c | 13 |
2 files changed, 15 insertions, 5 deletions
diff --git a/psi/imainarg.c b/psi/imainarg.c index c5d74caf0..6ff12df7b 100644 --- a/psi/imainarg.c +++ b/psi/imainarg.c @@ -829,14 +829,15 @@ run_stdin: ialloc_set_space(idmemory, avm_system); if (isd) { - int num, i; + int i; + int64_t num; /* Check for numbers so we can provide for suffix scalers */ /* Note the check for '#' is for PS "radix" numbers such as 16#ff */ /* and check for '.' and 'e' or 'E' which are 'real' numbers */ if ((strchr(eqp, '#') == NULL) && (strchr(eqp, '.') == NULL) && (strchr(eqp, 'e') == NULL) && (strchr(eqp, 'E') == NULL) && - ((i = sscanf((const char *)eqp, "%d", &num)) == 1)) { + ((i = sscanf((const char *)eqp, "%"PRIi64, &num)) == 1)) { char suffix = eqp[strlen(eqp) - 1]; switch (suffix) { @@ -857,7 +858,7 @@ run_stdin: default: break; /* not a valid suffix or last char was digit */ } - make_int(&value, num); + make_int(&value, (ps_int)num); } else { /* use the PS scanner to capture other valid token types */ stream astream; diff --git a/psi/iparam.c b/psi/iparam.c index 3106f412e..6ae475125 100644 --- a/psi/iparam.c +++ b/psi/iparam.c @@ -222,8 +222,17 @@ ref_param_write_typed(gs_param_list * plist, gs_param_name pkey, make_int(&value, pvalue->value.i); break; case gs_param_type_long: + /* FIXME: Rangecheck? */ make_int(&value, pvalue->value.l); break; + case gs_param_type_size_t: + /* FIXME: Rangecheck? */ + make_int(&value, pvalue->value.z); + break; + case gs_param_type_i64: + /* FIXME: Rangecheck? */ + make_int(&value, pvalue->value.i64); + break; case gs_param_type_float: make_real(&value, pvalue->value.f); break; @@ -782,8 +791,8 @@ ref_param_read_typed(gs_param_list * plist, gs_param_name pkey, } return 0; case t_integer: - pvalue->type = gs_param_type_long; - pvalue->value.l = loc.pvalue->value.intval; + pvalue->type = gs_param_type_i64; + pvalue->value.i64 = loc.pvalue->value.intval; return 0; case t_name: pvalue->type = gs_param_type_name; |