shithub: jbig2

Download patch

ref: 3a77ab1dd49743f0ed9cc0ad862671f462781bd1
parent: a2eca8001a79d7df3c848139519bf7b7b9778113
author: giles <giles@ded80894-8fb9-0310-811b-c03f3676ab4d>
date: Mon Feb 11 21:19:36 EST 2002

'normalize' formatting.


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

--- a/jbig2dec.c
+++ b/jbig2dec.c
@@ -1,7 +1,7 @@
 /*
     jbig2dec
     
-    Copyright (c) 2001 artofcode LLC.
+    Copyright (C) 2001 artofcode LLC.
     
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -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.11 2002/02/10 01:17:26 giles Exp $
+    $Id: jbig2dec.c,v 1.12 2002/02/12 02:19:36 giles Exp $
 */
 
 #include <stdio.h>
@@ -66,8 +66,8 @@
 {
   int n_bytes;
 
-  fseek (ctx->f, off, SEEK_SET);
-  n_bytes = fread (buf, 1, size, ctx->f);
+  fseek(ctx->f, off, SEEK_SET);
+  n_bytes = fread(buf, 1, size, ctx->f);
   if (n_bytes < size)
     ctx->eof = TRUE;
   return n_bytes;
@@ -78,7 +78,7 @@
 {
   byte buf[2];
 
-  get_bytes (ctx, buf, 2, off);
+  get_bytes(ctx, buf, 2, off);
   return (buf[0] << 8) | buf[1];
 }
 
@@ -87,7 +87,7 @@
 {
   byte buf;
   
-  get_bytes (ctx, &buf, 1, off);
+  get_bytes(ctx, &buf, 1, off);
   return buf;
 }
 
@@ -96,7 +96,7 @@
 {
   byte buf[4];
 
-  get_bytes (ctx, buf, 4, off);
+  get_bytes(ctx, buf, 4, off);
   return (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
 }
 
@@ -108,13 +108,13 @@
   Jbig2Ctx *ctx;
 
   /* Annex D.4 */
-  ctx = (Jbig2Ctx *)malloc (sizeof(Jbig2Ctx));
+  ctx = (Jbig2Ctx *)malloc(sizeof(Jbig2Ctx));
   ctx->f = f;
   ctx->eof = FALSE;
-  get_bytes (ctx, buf, 9, 0);
-  if (memcmp (buf, header, 8))
+  get_bytes(ctx, buf, 9, 0);
+  if (memcmp(buf, header, 8))
     {
-      printf ("not a JBIG2 file\n");
+      printf("not a JBIG2 file\n");
       return NULL;
     }
   ctx->flags = buf[8];
@@ -126,7 +126,7 @@
   else
     {
       ctx->offset = 13;
-      ctx->n_pages = get_int32 (ctx, 9);
+      ctx->n_pages = get_int32(ctx, 9);
     }
 
   if(!(ctx->flags & JBIG2_FILE_FLAGS_SEQUENTIAL_ACCESS)) {
@@ -144,7 +144,7 @@
 {
   Jbig2Ctx *ctx;
 
-  ctx = (Jbig2Ctx *)malloc (sizeof(Jbig2Ctx));
+  ctx = (Jbig2Ctx *)malloc(sizeof(Jbig2Ctx));
   ctx->f = f_globals;
   ctx->eof = 0;
   ctx->offset = 0;
@@ -161,19 +161,19 @@
   int	referred_to_segment_count;
 
   /* 7.2.2 */
-  result->segment_number = get_int32 (ctx, offset);
+  result->segment_number = get_int32(ctx, offset);
 
   if (ctx->eof)
     {
-      free (result);
+      free(result);
       return NULL;
     }
 
   /* 7.2.3 */
-  get_bytes (ctx, &result->flags, 1, offset + 4);
+  get_bytes(ctx, &result->flags, 1, offset + 4);
 
   /* 7.2.4 */
-  get_bytes (ctx, &rtscarf, 1, offset + 5);
+  get_bytes(ctx, &rtscarf, 1, offset + 5);
   if ((rtscarf & 0xe0) == 0xe0)
     {
 		/* FIXME: we break on non-seekable streams with this,
@@ -196,7 +196,7 @@
 	offset += 4;
   } else {
 	byte spa;
-	get_bytes (ctx, &spa, 1, offset);
+	get_bytes(ctx, &spa, 1, offset);
 	result->page_association = spa;
 	offset += 1;
   }
@@ -224,7 +224,7 @@
   int sdat_bytes;
 
   /* 7.4.2.1.1 */
-  result->flags = get_int16 (ctx, offset);
+  result->flags = get_int16(ctx, offset);
   offset += 2;
 
   SDHUFF = result->flags & 1;
@@ -251,22 +251,22 @@
     }
   else
     sdat_bytes = 0;
-  get_bytes (ctx, result->SDAT_flags, sdat_bytes, offset);
-  memset (&result->SDAT_flags + sdat_bytes, 0, 8 - sdat_bytes);
+  get_bytes(ctx, result->SDAT_flags, sdat_bytes, offset);
+  memset(&result->SDAT_flags + sdat_bytes, 0, 8 - sdat_bytes);
   offset += sdat_bytes;
 
   /* 7.4.2.1.3 - Symbol dictionary refinement AT flags */
   if (SDREFAGG && !SDRTEMPLATE)
     {
-      get_bytes (ctx, result->SDRAT_flags, 4, offset);
+      get_bytes(ctx, result->SDRAT_flags, 4, offset);
       offset += 4;
     }
 
   /* 7.4.2.1.4 */
-  result->SDNUMEXSYMS = get_int32 (ctx, offset);
+  result->SDNUMEXSYMS = get_int32(ctx, offset);
 
   /* 7.4.2.1.5 */
-  result->SDNUMNEWSYMS = get_int32 (ctx, offset + 4);
+  result->SDNUMNEWSYMS = get_int32(ctx, offset + 4);
   offset += 8;
 
   /* hardwire for the first annex-h example */
@@ -486,13 +486,13 @@
       ctx = jbig2_open (f);
       if (ctx != NULL)
 	dump_jbig2(ctx);
-      fclose (f);
+      fclose(f);
     }
   else if (argc == 3)
     {
       char *fn = argv[1], *fn_page = argv[2];
 
-      f = fopen (fn, "rb");
+      f = fopen(fn, "rb");
       if (f == NULL)
 	{
 	  fprintf(stderr, "error opening %s\n", fn);
@@ -502,7 +502,7 @@
       f_page = fopen(fn_page, "rb");
       if (f_page == NULL)
 	{
-	  fprintf (stderr, "error opening %s\n", fn_page);
+	  fprintf(stderr, "error opening %s\n", fn_page);
 	  return 1;
 	}
       ctx = jbig2_open_embedded(f, f_page);