about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2012-12-16 19:43:19 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2012-12-16 19:43:19 +0000
commita6d3046bf568f717dcd544c8fb4c0ea05ed72943 (patch)
tree8cd98029e252f8cceddf65e4078320dbabd14ba0
parentb12ffea72b2600ec640291b6876d161a65307e71 (diff)
downloadnetpbm-mirror-a6d3046bf568f717dcd544c8fb4c0ea05ed72943.tar.gz
netpbm-mirror-a6d3046bf568f717dcd544c8fb4c0ea05ed72943.tar.xz
netpbm-mirror-a6d3046bf568f717dcd544c8fb4c0ea05ed72943.zip
Fix 64 bit signed long problem, eliminate superfluous cmuwm.h file
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1814 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--converter/pbm/cmuwm.h17
-rw-r--r--converter/pbm/cmuwmtopbm.c13
-rw-r--r--converter/pbm/pbmtocmuwm.c6
-rw-r--r--doc/HISTORY5
4 files changed, 19 insertions, 22 deletions
diff --git a/converter/pbm/cmuwm.h b/converter/pbm/cmuwm.h
deleted file mode 100644
index e667f25e..00000000
--- a/converter/pbm/cmuwm.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* cmuwm.h - definitions for the CMU window manager format
-*/
-
-#ifndef CMUWM_H_INCLUDED
-#define CMUWM_H_INCLUDED
-
-struct cmuwm_header
-    {
-    long magic;
-    long width;
-    long height;
-    short depth;
-    };
-
-#define CMUWM_MAGIC 0xf10040bbL
-
-#endif
diff --git a/converter/pbm/cmuwmtopbm.c b/converter/pbm/cmuwmtopbm.c
index ce59491e..1f2d21f1 100644
--- a/converter/pbm/cmuwmtopbm.c
+++ b/converter/pbm/cmuwmtopbm.c
@@ -20,9 +20,17 @@
 
 
 #include "pbm.h"
-#include "cmuwm.h"
 
+/*--------------------------
+  CMUWN Header format:
 
+  32 bit const magic = 0xf10040bb ;
+  32 bit int   width;
+  32 bit int   height;
+  16 bit int   depth;
+
+  values are big-endian.
+--------------------------*/
 
 static void
 readCmuwmHeader(FILE *         const ifP,
@@ -32,6 +40,7 @@ readCmuwmHeader(FILE *         const ifP,
 
     const char * const initReadError =
         "CMU window manager header EOF / read error";
+    uint32_t const cmuwmMagic = 0xf10040bb;
 
     long l;
     short s;
@@ -40,7 +49,7 @@ readCmuwmHeader(FILE *         const ifP,
     rc = pm_readbiglong(ifP, &l);
     if (rc == -1 )
         pm_error(initReadError);
-    if (l != CMUWM_MAGIC)
+    if ((uint32_t)l != cmuwmMagic)
         pm_error("bad magic number in CMU window manager file");
     rc = pm_readbiglong(ifP, &l);
     if (rc == -1)
diff --git a/converter/pbm/pbmtocmuwm.c b/converter/pbm/pbmtocmuwm.c
index b384d941..983ea491 100644
--- a/converter/pbm/pbmtocmuwm.c
+++ b/converter/pbm/pbmtocmuwm.c
@@ -18,7 +18,8 @@
 */
 
 #include "pbm.h"
-#include "cmuwm.h"
+
+
 
 static void
 putinit(unsigned int const rows,
@@ -26,10 +27,11 @@ putinit(unsigned int const rows,
 
     const char initWriteError[] =
         "CMU window manager header write error";
+    uint32_t const cmuwmMagic = 0xf10040bb;
 
     int rc;
 
-    rc = pm_writebiglong(stdout, CMUWM_MAGIC);
+    rc = pm_writebiglong(stdout, cmuwmMagic);
     if (rc == -1)
         pm_error(initWriteError);
     rc = pm_writebiglong(stdout, cols);
diff --git a/doc/HISTORY b/doc/HISTORY
index 7d61c215..dcef4379 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -32,7 +32,10 @@ not yet  BJH  Release 10.61.00
               argument.  Always broken.
 
               leaftoppm: fix incorrect determination of whether input is
-              Interleaf on 64 bit systems.
+              Interleaf on 64 bit systems.  Always broken.
+
+              cmuwmtopbm: fix incorrect determination of whether input is
+              a CMU window manager bitmap on 64 bit systems.  Always broken.
 
               pnmmontage: fix totally wrong output.  Broken in 10.44
               (August 2008).