shithub: jbig2

Download patch

ref: 73934fd922618a011046c6fcbd844b26854b584f
parent: c6d9d6dd41f859c4dd3fb53c4fccc0ca34ca6a87
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Thu Aug 15 10:54:45 EDT 2002

Remove //-style comments for the benifit of those not using gcc.


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

--- a/jbig2_image.c
+++ b/jbig2_image.c
@@ -8,7 +8,7 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    $Id: jbig2_image.c,v 1.19 2002/07/20 17:23:15 giles Exp $
+    $Id: jbig2_image.c,v 1.20 2002/08/15 14:54:45 giles Exp $
 */
 
 #ifdef HAVE_CONFIG_H
@@ -83,7 +83,7 @@
     w = src->width;
     h = src->height;
     ss = src->data;
-    // FIXME: this isn't sufficient for the < 0 cases
+    /* FIXME: this isn't sufficient for the < 0 cases */
     if (x < 0) { w += x; x = 0; }
     if (y < 0) { h += y; y = 0; } 
     w = (x + w < dst->width) ? w : dst->width - x;
--- a/jbig2_image_pbm.c
+++ b/jbig2_image_pbm.c
@@ -8,7 +8,7 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    $Id: jbig2_image_pbm.c,v 1.11 2002/08/14 11:44:53 giles Exp $
+    $Id: jbig2_image_pbm.c,v 1.12 2002/08/15 14:54:45 giles Exp $
 */
 
 #ifdef HAVE_CONFIG_H
@@ -72,7 +72,7 @@
     return (image);
 }
 
-// FIXME: should handle multi-image files
+/* FIXME: should handle multi-image files */
 Jbig2Image *jbig2_image_read_pbm(Jbig2Ctx *ctx, FILE *in)
 {
     int i, dim[2];
--- a/jbig2_mmr.c
+++ b/jbig2_mmr.c
@@ -736,7 +736,7 @@
   while (1)
     {
       uint32_t word = mmr->word;
-      //printf ("%08x\n", word);
+      /* printf ("%08x\n", word); */
       if ((word >> (32 - 3)) == 1)
 	{
 	  int white_run, black_run;
@@ -744,46 +744,46 @@
 	  jbig2_decode_mmr_consume(mmr, 3);
 	  white_run = jbig2_decode_get_run(mmr, cf_white_decode, 8);
 	  black_run = jbig2_decode_get_run(mmr, cf_black_decode, 7);
-	  //printf ("H %d %d\n", white_run, black_run);
+	  /* printf ("H %d %d\n", white_run, black_run); */
 	}
       else if ((word >> (32 - 4)) == 1)
 	{
-	  //printf ("P\n");
+	  /* printf ("P\n"); */
 	  jbig2_decode_mmr_consume(mmr, 3);
 	}
       else if ((word >> (32 - 1)) == 1)
 	{
-	  //printf ("V(0)\n");
+	  /* printf ("V(0)\n"); */
 	  jbig2_decode_mmr_consume(mmr, 1);
 	}
       else if ((word >> (32 - 3)) == 3)
 	{
-	  //printf ("VR(1)\n");
+	  /* printf ("VR(1)\n"); */
 	  jbig2_decode_mmr_consume(mmr, 3);
 	}
       else if ((word >> (32 - 6)) == 3)
 	{
-	  //printf ("VR(2)\n");
+	  /* printf ("VR(2)\n"); */
 	  jbig2_decode_mmr_consume(mmr, 6);
 	}
       else if ((word >> (32 - 7)) == 3)
 	{
-	  //printf ("VR(3)\n");
+	  /* printf ("VR(3)\n"); */
 	  jbig2_decode_mmr_consume(mmr, 7);
 	}
       else if ((word >> (32 - 3)) == 2)
 	{
-	  //printf ("VL(1)\n");
+	  /* printf ("VL(1)\n"); */
 	  jbig2_decode_mmr_consume(mmr, 3);
 	}
       else if ((word >> (32 - 6)) == 2)
 	{
-	  //printf ("VL(2)\n");
+	  /* printf ("VL(2)\n"); */
 	  jbig2_decode_mmr_consume(mmr, 6);
 	}
       else if ((word >> (32 - 7)) == 2)
 	{
-	  //printf ("VL(3)\n");
+	  /* printf ("VL(3)\n"); */
 	  jbig2_decode_mmr_consume(mmr, 7);
 	}
       else
--- a/jbig2_page.c
+++ b/jbig2_page.c
@@ -8,7 +8,7 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    $Id: jbig2_page.c,v 1.14 2002/08/05 22:46:00 giles Exp $
+    $Id: jbig2_page.c,v 1.15 2002/08/15 14:54:45 giles Exp $
 */
 
 #ifdef HAVE_CONFIG_H
@@ -77,7 +77,7 @@
         index = ctx->current_page;
         while (ctx->pages[index].state != JBIG2_PAGE_FREE) {
             index++;
-            if (index >= ctx->max_page_index) { // FIXME: should also look for freed pages?
+            if (index >= ctx->max_page_index) { /* FIXME: should also look for freed pages? */
                 /* grow the list */
                 jbig2_realloc(ctx->allocator, ctx->pages, (ctx->max_page_index <<= 2) * sizeof(Jbig2Page));
                 for (j=index; j < ctx->max_page_index; j++) {
@@ -95,7 +95,7 @@
         page->number = segment->page_association;
     }
     
-    // FIXME: would be nice if we tried to work around this
+    /* FIXME: would be nice if we tried to work around this */
     if (segment->data_length < 19) {
         return jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number,
             "segment too short");
--- a/jbig2_symbol_dict.c
+++ b/jbig2_symbol_dict.c
@@ -8,7 +8,7 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    $Id: jbig2_symbol_dict.c,v 1.18 2002/07/20 17:23:15 giles Exp $
+    $Id: jbig2_symbol_dict.c,v 1.19 2002/08/15 14:54:45 giles Exp $
     
     symbol dictionary segment decode and support
 */
@@ -47,7 +47,7 @@
   /* SDHUFFBMSIZE */
   /* SDHUFFAGGINST */
   int SDTEMPLATE;
-  int8_t sdat[8]; 	// FIXME: do these need to be explicitly signed?
+  int8_t sdat[8];
   bool SDRTEMPLATE;
   int8_t sdrat[4];
 } Jbig2SymbolDictParams;
@@ -62,7 +62,11 @@
     fprintf(stderr, "dumping symbol dict as %d individual png files\n", dict->n_symbols);
     for (index = 0; index < dict->n_symbols; index++) {
         snprintf(filename, sizeof(filename), "symbol_%04d.png", index);
+#ifdef HAVE_LIBPNG
         jbig2_image_write_png_file(dict->glyphs[index], filename);
+#else
+        jbig2_image_write_pbm_file(dict->glyphs[index], filename);
+#endif
     }
 }
 #endif /* HAVE_LIBPNG */
@@ -296,8 +300,8 @@
 				  segment_data + offset,
 				  segment->data_length - offset,
 				  GB_stats);
-#ifdef HAVE_LIBPNG
-//  jbig2_dump_symbol_dict(segment->result);
+#ifdef DEBUG
+  jbig2_dump_symbol_dict(segment->result);
 #endif
 
   return 0;
--- a/jbig2_text.c
+++ b/jbig2_text.c
@@ -8,7 +8,7 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    $Id: jbig2_text.c,v 1.19 2002/08/10 10:39:20 giles Exp $
+    $Id: jbig2_text.c,v 1.20 2002/08/15 14:54:45 giles Exp $
 */
 
 #ifdef HAVE_CONFIG_H
@@ -233,7 +233,7 @@
         
 	    /* (3c.viii) */
 	    if (!params->TRANSPOSED) {
-		switch (params->REFCORNER) {  // FIXME: double check offsets
+		switch (params->REFCORNER) {  /* FIXME: double check offsets */
 		case JBIG2_CORNER_TOPLEFT: x = S; y = T; break;
 		case JBIG2_CORNER_TOPRIGHT: x = S - IB->width + 1; y = T; break;
 		case JBIG2_CORNER_BOTTOMLEFT: x = S; y = T - IB->height + 1; break;
@@ -280,7 +280,7 @@
 {
     int index, index_max = ctx->segment_index;
     
-    // FIXME: binary search would be better?
+    /* FIXME: binary search would be better? */
     for (index = index_max; index >= 0; index--)
         if (ctx->segments[index]->number == number)
             return (ctx->segments[index]);
--- a/jbig2dec.c
+++ b/jbig2dec.c
@@ -8,7 +8,7 @@
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    $Id: jbig2dec.c,v 1.40 2002/08/15 13:52:28 giles Exp $
+    $Id: jbig2dec.c,v 1.41 2002/08/15 14:54:45 giles Exp $
 */
 
 #ifdef HAVE_CONFIG_H
@@ -111,9 +111,8 @@
 			"Vh?qvdo:t:", long_options, &option_idx);
 		if (option == -1) break;
 
-		//fprintf(stderr, "option '%c' value '%s'\n", option, optarg);
 		switch (option) {
-			case 0:	// unknown long option
+			case 0:	/* unknown long option */
 				if (!params->verbose) fprintf(stdout,
 					"unrecognized option: --%s\n",
 					long_options[option_idx].name);
@@ -324,7 +323,7 @@
   jbig2dec_params_t params;
   int filearg;
   
-  // set defaults
+  /* set defaults */
   params.mode = render;
   params.verbose = 1;
   params.hash = 0;
@@ -345,7 +344,7 @@
     case render:
     
   if ((argc - filearg) == 1)
-  // only one argument--open as a jbig2 file
+  /* only one argument--open as a jbig2 file */
     {
       char *fn = argv[filearg];
 
@@ -357,7 +356,7 @@
 	}
     }
   else if ((argc - filearg) == 2)
-  // two arguments open as separate global and page streams
+  /* two arguments open as separate global and page streams */
     {
       char *fn = argv[filearg];
       char *fn_page = argv[filearg+1];
@@ -377,7 +376,7 @@
 	}
     }
   else
-  // any other number of arguments
+  /* any other number of arguments */
     return print_usage();
     
   ctx = jbig2_ctx_new(NULL, f_page != NULL ? JBIG2_OPTIONS_EMBEDDED : 0,
@@ -384,7 +383,7 @@
 		      NULL,
 		      error_callback, &params);
 
-  // pull the whole file/global stream into memory
+  /* pull the whole file/global stream into memory */
   for (;;)
     {
       int n_bytes = fread(buf, 1, sizeof(buf), f);
@@ -394,7 +393,7 @@
     }
   fclose(f);
 
-  // if there's a local page stream read that in its entirety
+  /* if there's a local page stream read that in its entirety */
   if (f_page != NULL)
     {
       Jbig2GlobalCtx *global_ctx = jbig2_make_global_ctx(ctx);
@@ -411,7 +410,7 @@
       jbig2_global_ctx_free(global_ctx);
     }
 
-  // retrieve and output the returned pages
+  /* retrieve and output the returned pages */
   {
     Jbig2Image *image;
 
@@ -443,6 +442,6 @@
 
   if (params.hash) hash_free(&params);
   
-  // fin
+  /* fin */
   return 0;
 }