about summary refs log tree commit diff
path: root/converter/other/bmptopnm.c
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2015-05-16 01:53:28 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2015-05-16 01:53:28 +0000
commit853d1761ee6b8796373a977603b31707b9c6459d (patch)
treef6868aaddee86c1a6894eb52532377ba288af252 /converter/other/bmptopnm.c
parent4c050566e208acbbc2ac94d21208a93637a815c0 (diff)
downloadnetpbm-mirror-853d1761ee6b8796373a977603b31707b9c6459d.tar.gz
netpbm-mirror-853d1761ee6b8796373a977603b31707b9c6459d.tar.xz
netpbm-mirror-853d1761ee6b8796373a977603b31707b9c6459d.zip
Add and use pbm_cleanrowend_packed
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2488 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other/bmptopnm.c')
-rw-r--r--converter/other/bmptopnm.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/converter/other/bmptopnm.c b/converter/other/bmptopnm.c
index 84d39989..a069092f 100644
--- a/converter/other/bmptopnm.c
+++ b/converter/other/bmptopnm.c
@@ -1442,8 +1442,6 @@ writeRasterPbm(unsigned char ** const bmpRaster,
   
   We destroy *bmpRaster as a side effect.
 -----------------------------------------------------------------------------*/
-    unsigned int const charBits = (sizeof(unsigned char) * 8);
-        /* Number of bits in a character */
     unsigned int const colChars = pbm_packed_bytes(cols);
     
     int row;
@@ -1463,13 +1461,8 @@ writeRasterPbm(unsigned char ** const bmpRaster,
             for (i = 0; i < colChars; ++i) 
                 bitrow[i] = ~bitrow[i]; /* flip all pixels */ 
         }   
-            
-        if (cols % 8 > 0) {
-            /* adjust final partial byte */
-            bitrow[colChars-1] >>= charBits - cols % charBits;
-            bitrow[colChars-1] <<= charBits - cols % charBits;
-        }
-        
+
+        pbm_cleanrowend_packed(bitrow, cols);
         pbm_writepbmrow_packed(stdout, bitrow, cols, FALSE);
     }
 }