shithub: jbig2

Download patch

ref: 204d69f4fce9cf5ee00e0fce774a622e9fca109f
parent: a82d670d005fdd3e4fc877fddcf69ff01f6d53df
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Thu Dec 4 11:11:27 EST 2003

We no longer need to artificially recurse when building the list of referred symbol dictionaries
now that we properly construct an exported result.


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

--- a/jbig2_symbol_dict.c
+++ b/jbig2_symbol_dict.c
@@ -132,10 +132,7 @@
  
     for (index = 0; index < segment->referred_to_segment_count; index++) {
         rsegment = jbig2_find_segment(ctx, segment->referred_to_segments[index]);
-        if (rsegment && ((rsegment->flags & 63) == 0)) {
-            n_dicts++;
-            n_dicts+= jbig2_sd_count_referred(ctx, rsegment);
-        }
+        if (rsegment && ((rsegment->flags & 63) == 0)) n_dicts++;
     }
                                                                                 
     return (n_dicts);
@@ -147,7 +144,7 @@
 {
     int index;
     Jbig2Segment *rsegment;
-    Jbig2SymbolDict **dicts, **rdicts;
+    Jbig2SymbolDict **dicts;
     int n_dicts = jbig2_sd_count_referred(ctx, segment);
     int dindex = 0;
                                                      
@@ -155,14 +152,6 @@
     for (index = 0; index < segment->referred_to_segment_count; index++) {
         rsegment = jbig2_find_segment(ctx, segment->referred_to_segments[index]);
         if (rsegment && ((rsegment->flags & 63) == 0)) {
-            /* recurse for imported symbols */
-            int j, n_rdicts = jbig2_sd_count_referred(ctx, rsegment);
-            if (n_rdicts > 0) {
-                rdicts = jbig2_sd_list_referred(ctx, rsegment);
-                for (j = 0; j < n_rdicts; j++)
-                    dicts[dindex++] = rdicts[j];
-                jbig2_free(ctx->allocator, rdicts);
-            }
             /* add this referred to symbol dictionary */
             dicts[dindex++] = (Jbig2SymbolDict *)rsegment->result;
         }
@@ -186,7 +175,6 @@
   int i,j,k, symbols;
   Jbig2SymbolDict *new = NULL;
   
-
   /* count the imported symbols and allocate a new array */
   symbols = 0;
   for(i = 0; i < n_dicts; i++)