summaryrefslogtreecommitdiff
path: root/jbig2dec/jbig2_arith_int.c
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2019-09-15 17:58:40 +0200
committerSebastian Rasmussen <sebras@gmail.com>2020-03-20 17:54:14 +0800
commit17e84cb1a4903fab26b5fc5d2e4805a1097f5a33 (patch)
tree364691f4f3e99ac0c198be76669bda659a634e96 /jbig2dec/jbig2_arith_int.c
parent716560bf5f2bc4b821ca6924ec648ca4949826bb (diff)
downloadghostpdl-17e84cb1a4903fab26b5fc5d2e4805a1097f5a33.tar.gz
jbig2dec: Let arithmetic decoder and the underlying stream report errors.
When a called function indicates an error, the caller should print warnings. Since the arithmetic decoder now uses the normal way of reporting errors, the callers of the decoder are changed to report warnings.
Diffstat (limited to 'jbig2dec/jbig2_arith_int.c')
-rw-r--r--jbig2dec/jbig2_arith_int.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/jbig2dec/jbig2_arith_int.c b/jbig2dec/jbig2_arith_int.c
index c574bb03b..7ad47adbf 100644
--- a/jbig2dec/jbig2_arith_int.c
+++ b/jbig2dec/jbig2_arith_int.c
@@ -64,37 +64,37 @@ jbig2_arith_int_decode(Jbig2Ctx *ctx, Jbig2ArithIntCtx *actx, Jbig2ArithState *a
int n_tail, offset;
int i;
- S = jbig2_arith_decode(as, &IAx[PREV]);
+ S = jbig2_arith_decode(ctx, as, &IAx[PREV]);
if (S < 0)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode IAx S");
+ return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, -1, "failed to decode IAx S");
PREV = (PREV << 1) | S;
- bit = jbig2_arith_decode(as, &IAx[PREV]);
+ bit = jbig2_arith_decode(ctx, as, &IAx[PREV]);
if (bit < 0)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode IAx decision bit 0");
+ return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, -1, "failed to decode IAx decision bit 0");
PREV = (PREV << 1) | bit;
if (bit) {
- bit = jbig2_arith_decode(as, &IAx[PREV]);
+ bit = jbig2_arith_decode(ctx, as, &IAx[PREV]);
if (bit < 0)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode IAx decision bit 1");
+ return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, -1, "failed to decode IAx decision bit 1");
PREV = (PREV << 1) | bit;
if (bit) {
- bit = jbig2_arith_decode(as, &IAx[PREV]);
+ bit = jbig2_arith_decode(ctx, as, &IAx[PREV]);
if (bit < 0)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode IAx decision bit 2");
+ return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, -1, "failed to decode IAx decision bit 2");
PREV = (PREV << 1) | bit;
if (bit) {
- bit = jbig2_arith_decode(as, &IAx[PREV]);
+ bit = jbig2_arith_decode(ctx, as, &IAx[PREV]);
if (bit < 0)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode IAx decision bit 3");
+ return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, -1, "failed to decode IAx decision bit 3");
PREV = (PREV << 1) | bit;
if (bit) {
- bit = jbig2_arith_decode(as, &IAx[PREV]);
+ bit = jbig2_arith_decode(ctx, as, &IAx[PREV]);
if (bit < 0)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode IAx decision bit 4");
+ return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, -1, "failed to decode IAx decision bit 4");
PREV = (PREV << 1) | bit;
if (bit) {
@@ -123,9 +123,9 @@ jbig2_arith_int_decode(Jbig2Ctx *ctx, Jbig2ArithIntCtx *actx, Jbig2ArithState *a
V = 0;
for (i = 0; i < n_tail; i++) {
- bit = jbig2_arith_decode(as, &IAx[PREV]);
+ bit = jbig2_arith_decode(ctx, as, &IAx[PREV]);
if (bit < 0)
- return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, -1, "failed to decode IAx V bit %d", i);
+ return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, -1, "failed to decode IAx V bit %d", i);
PREV = ((PREV << 1) & 511) | (PREV & 256) | bit;
V = (V << 1) | bit;
}