about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2024-09-10 23:46:41 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2024-09-10 23:46:41 +0000
commit32b514bbad010bc4eada866bf2935e477af0164e (patch)
tree3bf09445d3b59475ef2375b9eefaca7e305ef169 /lib
parent3edff148551c189eac2c83d47c4de16edf0d87bf (diff)
downloadnetpbm-mirror-32b514bbad010bc4eada866bf2935e477af0164e.tar.gz
netpbm-mirror-32b514bbad010bc4eada866bf2935e477af0164e.tar.xz
netpbm-mirror-32b514bbad010bc4eada866bf2935e477af0164e.zip
cleanup
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4938 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'lib')
-rw-r--r--lib/pm.h23
-rw-r--r--lib/util/bitio.c66
2 files changed, 33 insertions, 56 deletions
diff --git a/lib/pm.h b/lib/pm.h
index 62ad5355..c81a9f20 100644
--- a/lib/pm.h
+++ b/lib/pm.h
@@ -31,29 +31,6 @@ extern "C" {
 #endif
 
 
-/* Definitions to make Netpbm programs work with either ANSI C or C
-   Classic.
-
-   This is obsolete, as all compilers recognize the ANSI syntax now.
-
-   We are slowly removing all the ARGS invocations from the programs
-   (and replacing them with explicit ANSI syntax), but we have a lot
-   of programs where we have removed ARGS from the definition but not
-   the prototype, and we have discovered that the Sun compiler
-   considers the resulting mismatch between definition and prototype
-   to be an error.  So we make ARGS create the ANSI syntax
-   unconditionally to avoid having to fix all those mismatches.  */
-
-#if 0
-#if __STDC__
-#define ARGS(alist) alist
-#else /*__STDC__*/
-#define ARGS(alist) ()
-#define const
-#endif /*__STDC__*/
-#endif
-#define ARGS(alist) alist
-
 
 /* PM_GNU_PRINTF_ATTR lets the GNU compiler check pm_message() and pm_error()
    calls to be sure the arguments match the format string, thus preventing
diff --git a/lib/util/bitio.c b/lib/util/bitio.c
index 9d96892c..ca78ebcb 100644
--- a/lib/util/bitio.c
+++ b/lib/util/bitio.c
@@ -1,4 +1,4 @@
-/*\
+/*                                                      \
  * $Id: bitio.c,v 1.5 1992/11/24 19:36:46 dws Exp dws $
  *
  * bitio.c - bitstream I/O
@@ -36,16 +36,11 @@
 
 #include "bitio.h"
 
-struct bitstream
-{
-    FILE *
-        f;      /* bytestream */
-    unsigned long
-        bitbuf;     /* bit buffer */
-    int
-        nbitbuf;    /* number of bits in 'bitbuf' */
-    char
-        mode;
+struct bitstream {
+    FILE * f;                     /* bytestream */
+    unsigned long int bitbuf;     /* bit buffer */
+    int nbitbuf;                  /* number of bits in 'bitbuf' */
+    char mode;                    /* read or write */
 };
 
 #define Mask(n)     ((1<<(n))-1)
@@ -67,7 +62,8 @@ struct bitstream
  */
 
 struct bitstream *
-pm_bitinit(FILE * const f, const char * const mode) {
+pm_bitinit(FILE       * const f,
+           const char * const mode) {
 
     struct bitstream * ans;
 
@@ -85,6 +81,8 @@ pm_bitinit(FILE * const f, const char * const mode) {
     return ans;
 }
 
+
+
 /*
  * pm_bitfini() - deallocate the given struct bitstream *.
  *
@@ -96,9 +94,8 @@ pm_bitinit(FILE * const f, const char * const mode) {
  */
 
 int
-pm_bitfini(b)
-    struct bitstream *b;
-{
+pm_bitfini(struct bitstream * const b) {
+
     int     nbyte = 0;
 
     if(!b)
@@ -121,8 +118,8 @@ pm_bitfini(b)
         {
             char    c;
 
-            BitPut(b, 0, (long)8-(b->nbitbuf));
-            c = (char) BitGet(b, (long)8);
+            BitPut(b, 0, (long int)8-(b->nbitbuf));
+            c = (char) BitGet(b, (long int)8);
             if(putc(c, b->f) == EOF)
             {
                 return -1;
@@ -135,6 +132,8 @@ pm_bitfini(b)
     return nbyte;
 }
 
+
+
 /*
  * pm_bitread() - read the next nbits into *val from the given file.
  *
@@ -144,11 +143,10 @@ pm_bitfini(b)
  */
 
 int
-pm_bitread(b, nbits, val)
-    struct bitstream *b;
-    unsigned long   nbits;
-    unsigned long  *val;
-{
+pm_bitread(struct bitstream  * const b,
+           unsigned long int   const nbits,
+           unsigned long int * const val) {
+
     int     nbyte = 0;
     int     c;
 
@@ -163,13 +161,15 @@ pm_bitread(b, nbits, val)
         }
         nbyte++;
 
-        BitPut(b, c, (long) 8);
+        BitPut(b, c, (long int) 8);
     }
 
     *val = BitGet(b, nbits);
     return nbyte;
 }
 
+
+
 /*
  * pm_bitwrite() - write the low nbits of val to the given file.
  *
@@ -179,11 +179,10 @@ pm_bitread(b, nbits, val)
  */
 
 int
-pm_bitwrite(b, nbits, val)
-    struct bitstream *b;
-    unsigned long   nbits;
-    unsigned long   val;
-{
+pm_bitwrite(struct bitstream * const b,
+            unsigned long int  const nbits,
+            unsigned long int  const val) {
+
     int     nbyte = 0;
     char        c;
 
@@ -192,12 +191,10 @@ pm_bitwrite(b, nbits, val)
 
     BitPut(b, val, nbits);
 
-    while (b->nbitbuf >= 8)
-    {
-        c = (char) BitGet(b, (long)8);
+    while (b->nbitbuf >= 8) {
+        c = (char) BitGet(b, (long int)8);
 
-        if(putc(c, b->f) == EOF)
-        {
+        if(putc(c, b->f) == EOF) {
             return -1;
         }
         nbyte++;
@@ -205,3 +202,6 @@ pm_bitwrite(b, nbits, val)
 
     return nbyte;
 }
+
+
+