about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/HISTORY3
-rw-r--r--lib/pmfileio.c24
2 files changed, 15 insertions, 12 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index 8932b20e..09fc7006 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -6,6 +6,9 @@ CHANGE HISTORY
 
 not yet  BJH  Release 10.99.00
 
+              libnetpbm: Stop bogus runtime error check failure in pmfileio.c
+              shifts.
+
 22.03.27 BJH  Release 10.98.00
 
               pamtopdbimg: Add -fixedtime.
diff --git a/lib/pmfileio.c b/lib/pmfileio.c
index 1ed71f18..1109f340 100644
--- a/lib/pmfileio.c
+++ b/lib/pmfileio.c
@@ -633,8 +633,8 @@ pm_readbigshort(FILE *  const ifP,
 
     unsigned short s;
 
-    s  = getcNofail(ifP) << 8;
-    s |= getcNofail(ifP) << 0;
+    s  = (unsigned short)getcNofail(ifP) << 8;
+    s |= (unsigned short)getcNofail(ifP) << 0;
 
     *sP = s;
 
@@ -661,10 +661,10 @@ pm_readbiglong(FILE * const ifP,
 
     unsigned long l;
 
-    l  = getcNofail(ifP) << 24;
-    l |= getcNofail(ifP) << 16;
-    l |= getcNofail(ifP) <<  8;
-    l |= getcNofail(ifP) <<  0;
+    l  = (unsigned long)getcNofail(ifP) << 24ul;
+    l |= (unsigned long)getcNofail(ifP) << 16ul;
+    l |= (unsigned long)getcNofail(ifP) <<  8ul;
+    l |= (unsigned long)getcNofail(ifP) <<  0ul;
 
     *lP = l;
 
@@ -709,8 +709,8 @@ pm_readlittleshort(FILE *  const ifP,
                    short * const sP) {
     unsigned short s;
 
-    s  = getcNofail(ifP) << 0;
-    s |= getcNofail(ifP) << 8;
+    s  = (unsigned short)getcNofail(ifP) << 0;
+    s |= (unsigned short)getcNofail(ifP) << 8;
 
     *sP = s;
 
@@ -736,10 +736,10 @@ pm_readlittlelong(FILE * const ifP,
                   long * const lP) {
     unsigned long l;
 
-    l  = getcNofail(ifP) <<  0;
-    l |= getcNofail(ifP) <<  8;
-    l |= getcNofail(ifP) << 16;
-    l |= getcNofail(ifP) << 24;
+    l  = (unsigned long)getcNofail(ifP) <<  0ul;
+    l |= (unsigned long)getcNofail(ifP) <<  8ul;
+    l |= (unsigned long)getcNofail(ifP) << 16ul;
+    l |= (unsigned long)getcNofail(ifP) << 24ul;
 
     *lP = l;