shithub: jbig2

Download patch

ref: a6752fd2a6859efeabbb29954d5b5d34ec0eb96b
parent: 6cb5f391cd0ec8bdc0485780697793b71004429c
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Mon Jun 24 14:44:45 EDT 2002

use the correct number of bytes in reading the referred-to segment numbers. (still untested)


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

--- a/jbig2_segment.c
+++ b/jbig2_segment.c
@@ -8,7 +8,7 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    $Id: jbig2_segment.c,v 1.7 2002/06/24 18:40:01 giles Exp $
+    $Id: jbig2_segment.c,v 1.8 2002/06/24 18:44:45 giles Exp $
 */
 
 #include <stdio.h>
@@ -70,7 +70,11 @@
       referred_to_segments = jbig2_alloc(ctx->allocator, referred_to_segment_count * referred_to_segment_size);
     
       for (i = 0; i < referred_to_segment_count; i++) {
-        referred_to_segments[i] = jbig2_get_int32(buf + offset);
+        
+        referred_to_segments[i] = 
+          (referred_to_segment_size == 1) ? buf[offset] :
+          (referred_to_segment_size == 2) ? jbig2_get_int16(buf+offset) :
+            jbig2_get_int32(buf + offset);
         offset += referred_to_segment_size;
       }
       result->referred_to_segments = referred_to_segments;