diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2015-05-17 23:09:18 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2015-05-17 23:09:18 +0000 |
commit | 276cb1cf47a5d16376d07b936cc804f283cc8910 (patch) | |
tree | 6e9a1ffaa328bb4d4c623a82ef73dfbe53aa30a4 | |
parent | 7debec7589678df1d134152af5d09488275dc626 (diff) | |
download | netpbm-mirror-276cb1cf47a5d16376d07b936cc804f283cc8910.tar.gz netpbm-mirror-276cb1cf47a5d16376d07b936cc804f283cc8910.tar.xz netpbm-mirror-276cb1cf47a5d16376d07b936cc804f283cc8910.zip |
Make pbm_cleanrowend_packed() work with zero-width images
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2490 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r-- | lib/libpbm2.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/libpbm2.c b/lib/libpbm2.c index e12b1e33..503fd6c9 100644 --- a/lib/libpbm2.c +++ b/lib/libpbm2.c @@ -268,15 +268,16 @@ pbm_cleanrowend_packed(unsigned char * const packedBits, /*---------------------------------------------------------------------------- Set fractional "don't care" bits at end of row to zero. ----------------------------------------------------------------------------*/ - unsigned int const last = pbm_packed_bytes(cols) - 1; unsigned int const bitsPerChar = 8; - assert(cols > 0); - if (cols % bitsPerChar > 0) { - packedBits[last] >>= bitsPerChar - cols % bitsPerChar; - packedBits[last] <<= bitsPerChar - cols % bitsPerChar; - } + unsigned int const last = pbm_packed_bytes(cols) - 1; + + assert(pbm_packed_bytes(cols) > 0); + + packedBits[last] >>= bitsPerChar - cols % bitsPerChar; + packedBits[last] <<= bitsPerChar - cols % bitsPerChar; + } } |