shithub: jbig2

Download patch

ref: 808d2dd8d5a549f63af69688752b6171529e687f
parent: c8ca06c65a11e60cbcefa02693ba1f937cfda427
author: Sebastian Rasmussen <[email protected]>
date: Tue Apr 24 20:50:12 EDT 2018

jbig2dec: Remove many unnecessary parentheses.

--- a/jbig2_page.c
+++ b/jbig2_page.c
@@ -63,7 +63,7 @@
 
     /* a new page info segment implies the previous page is finished */
     page = &(ctx->pages[ctx->current_page]);
-    if ((page->number != 0) && ((page->state == JBIG2_PAGE_NEW) || (page->state == JBIG2_PAGE_FREE))) {
+    if (page->number != 0 && (page->state == JBIG2_PAGE_NEW || page->state == JBIG2_PAGE_FREE)) {
         page->state = JBIG2_PAGE_COMPLETE;
         jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "unexpected page info segment, marking previous page finished");
     }
--- a/jbig2_symbol_dict.c
+++ b/jbig2_symbol_dict.c
@@ -273,7 +273,7 @@
         IADW = jbig2_arith_int_ctx_new(ctx);
         IAEX = jbig2_arith_int_ctx_new(ctx);
         IAAI = jbig2_arith_int_ctx_new(ctx);
-        if ((IADH == NULL) || (IADW == NULL) || (IAEX == NULL) || (IAAI == NULL)) {
+        if (IADH == NULL || IADW == NULL || IAEX == NULL || IAAI == NULL) {
             jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate storage for symbol bitmap");
             goto cleanup1;
         }
@@ -284,7 +284,7 @@
             IAID = jbig2_arith_iaid_ctx_new(ctx, SBSYMCODELEN);
             IARDX = jbig2_arith_int_ctx_new(ctx);
             IARDY = jbig2_arith_int_ctx_new(ctx);
-            if ((IAID == NULL) || (IARDX == NULL) || (IARDY == NULL)) {
+            if (IAID == NULL || IARDX == NULL || IARDY == NULL) {
                 jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate storage for symbol bitmap");
                 goto cleanup2;
             }
@@ -294,7 +294,7 @@
         hs = jbig2_huffman_new(ctx, ws);
         SDHUFFRDX = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_O);
         SBHUFFRSIZE = jbig2_build_huffman_table(ctx, &jbig2_huffman_params_A);
-        if ((hs == NULL) || (SDHUFFRDX == NULL) || (SBHUFFRSIZE == NULL)) {
+        if (hs == NULL || SDHUFFRDX == NULL || SBHUFFRSIZE == NULL) {
             jbig2_error(ctx, JBIG2_SEVERITY_WARNING, segment->number, "failed to allocate storage for symbol bitmap");
             goto cleanup2;
         }
@@ -547,7 +547,7 @@
                             code3 = jbig2_arith_int_decode(ctx, IARDY, as, &RDY);
                         }
 
-                        if ((code1 < 0) || (code2 < 0) || (code3 < 0) || (code4 < 0)) {
+                        if (code1 < 0 || code2 < 0 || code3 < 0 || code4 < 0) {
                             code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to decode data");
                             goto cleanup4;
                         }
@@ -742,7 +742,7 @@
                 code = jbig2_arith_int_decode(ctx, IAEX, as, (int32_t *) &exrunlength);
             /* prevent infinite loop */
             zerolength = exrunlength > 0 ? 0 : zerolength + 1;
-            if (code || (exrunlength > limit - i) || (zerolength > 4) || (exflag && (exrunlength + j > params->SDNUMEXSYMS))) {
+            if (code || exrunlength > limit - i || zerolength > 4 || (exflag && (exrunlength + j > params->SDNUMEXSYMS))) {
                 if (code)
                     jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to decode exrunlength for exported symbols");
                 else if (exrunlength <= 0)
--- a/jbig2_text.c
+++ b/jbig2_text.c
@@ -353,7 +353,7 @@
                     jbig2_huffman_skip(hs);
                 }
 
-                if ((code1 < 0) || (code2 < 0) || (code3 < 0) || (code4 < 0) || (code5 < 0)) {
+                if (code1 < 0 || code2 < 0 || code3 < 0 || code4 < 0 || code5 < 0) {
                     jbig2_image_release(ctx, IB);
                     code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "failed to decode data");
                     goto cleanup2;
@@ -864,7 +864,7 @@
         params.IAFS = jbig2_arith_int_ctx_new(ctx);
         params.IADS = jbig2_arith_int_ctx_new(ctx);
         params.IAIT = jbig2_arith_int_ctx_new(ctx);
-        if ((params.IADT == NULL) || (params.IAFS == NULL) || (params.IADS == NULL) || (params.IAIT == NULL)) {
+        if (params.IADT == NULL || params.IAFS == NULL || params.IADS == NULL || params.IAIT == NULL) {
             code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "couldn't allocate text region image data");
             goto cleanup3;
         }
@@ -878,8 +878,8 @@
         params.IARDH = jbig2_arith_int_ctx_new(ctx);
         params.IARDX = jbig2_arith_int_ctx_new(ctx);
         params.IARDY = jbig2_arith_int_ctx_new(ctx);
-        if ((params.IAID == NULL) || (params.IARI == NULL) ||
-            (params.IARDW == NULL) || (params.IARDH == NULL) || (params.IARDX == NULL) || (params.IARDY == NULL)) {
+        if (params.IAID == NULL || params.IARI == NULL ||
+            params.IARDW == NULL || params.IARDH == NULL || params.IARDX == NULL || params.IARDY == NULL) {
             code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, "couldn't allocate text region image data");
             goto cleanup4;
         }