shithub: jbig2

Download patch

ref: 46ff1e6277a432b9e1d18784ab5c30fc40b45476
parent: 1eb7ae738d7af4508d7cbc547c0e386d55821820
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Mon Jun 20 07:09:19 EDT 2005

Minor cleanup of unimplemented huffman sections.


git-svn-id: http://svn.ghostscript.com/jbig2dec/trunk@414 ded80894-8fb9-0310-811b-c03f3676ab4d

--- a/jbig2_symbol_dict.c
+++ b/jbig2_symbol_dict.c
@@ -255,7 +255,7 @@
       jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number,
 	"huffman coded symbol dictionary");
       hs = jbig2_huffman_new(ctx, ws);
-      if (params->SDREFAGG) {
+      if (!params->SDREFAGG) {
 	  SDNEWSYMWIDTHS = jbig2_alloc(ctx->allocator,
 		sizeof(*SDNEWSYMWIDTHS)*params->SDNUMNEWSYMS);
 	  if (SDNEWSYMWIDTHS == NULL) {
@@ -450,17 +450,11 @@
 		  }
 #endif
 
-	  } else {
-	      code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
-                "unhandled bitmap case!!!");
-	      return NULL;
-          }
+	  }
 
 	  /* 6.5.5 (4c.iii) */
 	  if (params->SDHUFF && !params->SDREFAGG) {
-	    code = jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
-              "NYI: parsing collective bitmaps!!!");
-	    return NULL;
+	    SDNEWSYMWIDTHS[NSYMSDECODED] = SYMWIDTH;
 	  }
 	
 	  /* 6.5.5 (4c.iv) */
@@ -470,6 +464,14 @@
 	  jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number,
             "%d of %d decoded", NSYMSDECODED, params->SDNUMNEWSYMS);
 #endif
+
+	  /* 6.5.5 (4d) */
+	  if (params->SDHUFF && !params->SDREFAGG) {
+	    /* 6.5.9 */
+	    jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
+		"unhandled collective bitmap");
+	    return NULL;
+	  }
 
 	}
      }