diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2016-02-02 10:27:05 +0000 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2016-02-02 10:27:05 +0000 |
commit | bb799fa99685fc9cd0177242a5f923180eda135c (patch) | |
tree | de84659d20ebf313c6549f41d3b420d80a132102 /base/sdcparam.c | |
parent | a7655b5d2fc42217eac71efd01f22fe3cca33d4a (diff) | |
download | ghostpdl-bb799fa99685fc9cd0177242a5f923180eda135c.tar.gz |
Revert and fix commit a7655b5d2fc42217eac71efd01f22fe3cca33d4a
In the previous commit I misunderstood the return value meanings from
s_DCT_byte_params leading to an incorrect default (and causing many
diffs)
This commit properly sets the return value so that, if the key is not
found we use the correct default.
Again, lots of diffs expected here.
Diffstat (limited to 'base/sdcparam.c')
-rw-r--r-- | base/sdcparam.c | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/base/sdcparam.c b/base/sdcparam.c index 035c63f93..2d1dea232 100644 --- a/base/sdcparam.c +++ b/base/sdcparam.c @@ -338,41 +338,45 @@ s_DCT_byte_params(gs_param_list * plist, gs_param_name key, int start, case 0: if (bytes.size < start + count) { code = gs_note_error(gs_error_rangecheck); - break; + } else { + for (i = 0; i < count; ++i) + pvals[i] = (UINT8) bytes.data[start + i]; + code = 0; } - for (i = 0; i < count; ++i) - pvals[i] = (UINT8) bytes.data[start + i]; - code = 1; + break; default: /* might be a float array */ code = param_read_int_array(plist, key, &ints); if (!code) { if (ints.size < start + count) { code = gs_note_error(gs_error_rangecheck); - break; - } - for (i = 0; i < count; ++i) { - pvals[i] = ints.data[start + i]; + } else { + for (i = 0; i < count; ++i) { + pvals[i] = ints.data[start + i]; + } + code = 0; } - code = 1; } else { code = param_read_float_array(plist, key, &floats); if (!code) { if (floats.size < start + count) { code = gs_note_error(gs_error_rangecheck); - break; - } - for (i = 0; i < count; ++i) { - float v = floats.data[start + i]; - - if (v < 0 || v > 255) { - code = gs_note_error(gs_error_rangecheck); - break; + } else { + for (i = 0; i < count; ++i) { + float v = floats.data[start + i]; + + if (v < 0 || v > 255) { + code = gs_note_error(gs_error_rangecheck); + break; + } + pvals[i] = (UINT8) (v + 0.5); } - pvals[i] = (UINT8) (v + 0.5); } - } - code = 1; + if (code >= 0) + code = 0; + } else + code = 1; } + break; } if (code < 0) param_signal_error(plist, key, code); |