diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2009-07-08 01:51:38 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2009-07-08 01:51:38 +0000 |
commit | 44a771f059ed55401772d56c004a771516cddd59 (patch) | |
tree | d84eae6fb5408a8ffdc5269d4d5f4a2cdb65df40 /converter | |
parent | 86f0bc22ea104a5f4c6c080c01b0f4c58055a66b (diff) | |
download | netpbm-mirror-44a771f059ed55401772d56c004a771516cddd59.tar.gz netpbm-mirror-44a771f059ed55401772d56c004a771516cddd59.tar.xz netpbm-mirror-44a771f059ed55401772d56c004a771516cddd59.zip |
cleanup
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@948 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter')
-rw-r--r-- | converter/other/tifftopnm.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/converter/other/tifftopnm.c b/converter/other/tifftopnm.c index a8c0fe1d..e97c40e0 100644 --- a/converter/other/tifftopnm.c +++ b/converter/other/tifftopnm.c @@ -380,8 +380,8 @@ readscanline(TIFF * const tif, "TIFFReadScanline() failed.", row, plane); else if (bps == 8) { - int sample; - for (sample = 0; sample < cols*spp; sample++) + unsigned int sample; + for (sample = 0; sample < cols * spp; ++sample) samplebuf[sample] = scanbuf[sample]; } else if (bps < 8) { /* Note that in this format, samples do not span bytes. Rather, @@ -389,12 +389,12 @@ readscanline(TIFF * const tif, At least that's how I infer the format from reading pnmtotiff.c -Bryan 00.11.18 */ - int sample; - int bitsleft; + unsigned int sample; + unsigned int bitsleft; unsigned char * inP; - for (sample = 0, bitsleft=8, inP=scanbuf; - sample < cols*spp; + for (sample = 0, bitsleft = 8, inP = scanbuf; + sample < cols * spp; ++sample) { if (bitsleft == 0) { ++inP; @@ -411,6 +411,7 @@ readscanline(TIFF * const tif, pm_error("Internal error: invalid value for fillorder: %u", fillorder); } + assert(bitsleft >= bps); bitsleft -= bps; if (bitsleft < bps) /* Don't count dregs at end of byte */ @@ -432,10 +433,10 @@ readscanline(TIFF * const tif, for (sample = 0; sample < cols*spp; ++sample) samplebuf[sample] = scanbuf16[sample]; } else if (bps == 32) { - uint32 * const scanbuf32 = (uint32 *) scanbuf; + const uint32 * const scanbuf32 = (const uint32 *) scanbuf; unsigned int sample; - for (sample = 0; sample < cols*spp; ++sample) + for (sample = 0; sample < cols * spp; ++sample) samplebuf[sample] = scanbuf32[sample]; } else pm_error("Internal error: invalid bits per sample passed to " |