shithub: jbig2

Download patch

ref: 033b9666bac46060559b74b2f2a620fde5fc7f32
parent: 867871515b0d0bce9d092e66a1a787b45681ad76
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Tue Jun 18 05:46:45 EDT 2002

Add warnings for remaining unhandled segment types. remove dead code.


git-svn-id: http://svn.ghostscript.com/jbig2dec/trunk@71 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.2 2002/06/17 21:06:38 giles Exp $
+    $Id: jbig2_segment.c,v 1.3 2002/06/18 09:46:45 giles Exp $
 */
 
 #include <stdio.h>
@@ -107,36 +107,65 @@
     {
     case 0:
       return jbig2_symbol_dictionary(ctx, sh, segment_data);
+    case 4:
+      return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
+        "unhandled segment type 'intermediate text region'");
+    case 6:
+      return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
+        "unhandled segment type 'immediate text region'");
+    case 7:
+      return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
+        "unhandled segment type 'immediate lossless text region'");
+    case 16:
+      return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
+        "unhandled segment type 'pattern dictionary'");
+    case 20:
+      return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
+        "unhandled segment type 'intermediate halftone region'");
+    case 22:
+      return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
+        "unhandled segment type 'immediate halftone region'");
+    case 23:
+      return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
+        "unhandled segment type 'immediate lossless halftone region'");
+    case 36:
+      return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
+        "unhandled segment type 'intermediate generic region'");
     case 38:
       return jbig2_immediate_generic_region(ctx, sh, segment_data);
+    case 39:
+      return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
+        "unhandled segment type 'immediate lossless generic region'");
+    case 40:
+      return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
+        "unhandled segment type 'intermediate generic refinement region'");
+    case 42:
+      return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
+        "unhandled segment type 'immediate generic refinement region'");
+    case 43:
+      return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
+        "unhandled segment type 'immediate lossless generic refinement region'");
     case 48:
-      jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
+      return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
         "unhandled segment type 'page info'");
-      break;
     case 49:
-      jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
+      return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
         "unhandled segment type 'end of page'");
-      break;
     case 50:
-      jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
+      return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
         "unhandled segment type 'end of stripe'");
-      break;
     case 51:
-      jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
+      return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
         "unhandled segment type 'end of file'");
-      break;
     case 52:
-      jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
+      return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
         "unhandled segment type 'profile'");
-      break;
     case 53:
-      jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
+      return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
         "unhandled table segment");
-      break;
     case 62:
-      jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
+      return jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
         "unhandled extension segment");
-      break;
     default:
         jbig2_error(ctx, JBIG2_SEVERITY_WARNING, sh->segment_number,
           "unknown segment type %d", sh->flags & 63);
@@ -143,98 +172,3 @@
     }
   return 0;
 }
-
-#ifdef GILES
-
-int dump_segment (Jbig2Ctx *ctx)
-{
-  Jbig2SegmentHeader *sh;
-  Jbig2SymbolDictionary *sd;
-  Jbig2PageInfo	*page_info;
-
-  sh = jbig2_read_segment_header(ctx);
-  if (sh == NULL)
-    return TRUE;
-  
-  printf("segment %d (%d bytes)\t", sh->segment_number, sh->data_length);
-  switch (sh->flags & 63)
-    {
-    case 0:
-      sd = jbig2_read_symbol_dictionary(ctx);
-	  printf("\n");
-      dump_symbol_dictionary(sd);
-      break;
-	case 4:
-		printf("intermediate text region:");
-		break;
-	case 6:
-		printf("immediate text region:");
-		break;
-	case 7:
-		printf("immediate lossless text region:");
-		break;
-	case 16:
-		printf("pattern dictionary:");
-		break;
-	case 20:
-		printf("intermediate halftone region:");
-		break;
-	case 22:
-		printf("immediate halftone region:");
-		break;
-	case 23:
-		printf("immediate lossless halftone region:");
-		break;
-	case 36:
-		printf("intermediate generic region:");
-		break;
-	case 38:
-		printf("immediate generic region:");
-		break;
-	case 39:
-		printf("immediate lossless generic region:");
-		break;
-	case 40:
-		printf("intermediate generic refinement region:");
-		break;
-	case 42:
-		printf("immediate generic refinement region:");
-		break;
-	case 43:
-		printf("immediate lossless generic refinement region:");
-		break;
-	case 48:
-		page_info = jbig2_read_page_info(ctx);
-		printf("page info:\n");
-		if (page_info) dump_page_info(page_info);
-		break;
-	case 49:
-		printf("end of page");
-		break;
-	case 50:
-		printf("end of stripe");
-		break;
-        case 51:
-            printf("end of file\n");
-            return TRUE;
-            break;
-	case 52:
-		printf("profiles:");
-		break;
-	case 53:
-		printf("tables:");
-		break;
-	case 62:
-		printf("extension:");
-		break;
-	default:
-		printf("UNKNOWN SEGMENT TYPE!!!");
-    }
-	printf("\tflags = %02x, page %d\n",
-	  sh->flags, sh->page_association);
-
-  ctx->offset += sh->data_length;
-  return FALSE;
-}
-
-#endif /* GILES */