diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2022-03-30 02:51:51 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2022-03-30 02:51:51 +0000 |
commit | 7ef6b9c0996bf3d89755f87b2ba00ff6103dd7d0 (patch) | |
tree | 0d889962c2f4d816748ded5ae27279a01085aa88 | |
parent | 77abacaf76c18a57ff7cbf8d00cc021642704066 (diff) | |
download | netpbm-mirror-7ef6b9c0996bf3d89755f87b2ba00ff6103dd7d0.tar.gz netpbm-mirror-7ef6b9c0996bf3d89755f87b2ba00ff6103dd7d0.tar.xz netpbm-mirror-7ef6b9c0996bf3d89755f87b2ba00ff6103dd7d0.zip |
Clean up type coercions
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4321 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r-- | doc/HISTORY | 3 | ||||
-rw-r--r-- | lib/pmfileio.c | 24 |
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; |