diff options
author | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2013-05-11 21:17:25 +0000 |
---|---|---|
committer | giraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8> | 2013-05-11 21:17:25 +0000 |
commit | ddee347b0bc1fdb87b9bbbd4d5641b5880e88ea3 (patch) | |
tree | 80d1f5c74a3c3d7d814155b5cb4e67e73e2e5751 /converter/other/winicontopam.c | |
parent | 14dcfc9cb9a37078e7362699690188eed276e570 (diff) | |
download | netpbm-mirror-ddee347b0bc1fdb87b9bbbd4d5641b5880e88ea3.tar.gz netpbm-mirror-ddee347b0bc1fdb87b9bbbd4d5641b5880e88ea3.tar.xz netpbm-mirror-ddee347b0bc1fdb87b9bbbd4d5641b5880e88ea3.zip |
Fix miscellaneous bugs introduced a month ago (April 14)
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@1904 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'converter/other/winicontopam.c')
-rw-r--r-- | converter/other/winicontopam.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/converter/other/winicontopam.c b/converter/other/winicontopam.c index d846ad85..9bee8b3c 100644 --- a/converter/other/winicontopam.c +++ b/converter/other/winicontopam.c @@ -459,7 +459,7 @@ readXorPalette(struct BitmapInfoHeader * const hdrP, bool const needHeaderDump, uint32_t * const bytesConsumedP) { - uint32_t const paletteSize = hdrP->colors_in_palette * 4; + uint32_t paletteSize; int16_t row; const PaletteEntry * palette; @@ -509,6 +509,8 @@ readXorPalette(struct BitmapInfoHeader * const hdrP, sizeRemaining = maxSize; /* initial value */ bytesConsumed = 0; /* initial value */ + paletteSize = hdrP->colors_in_palette * 4; + if (sizeRemaining < paletteSize) pm_error("image %2u: " "reading palette: image truncated.", index); @@ -785,11 +787,9 @@ readAnd(struct BitmapInfoHeader * const hdrP, int16_t row; uint32_t bytesConsumed; uint32_t bytesPerRow; - const unsigned char * bitmapCursor; uint32_t sizeRemaining; uint32_t truncatedAndSize; - bitmapCursor = &bitmap[0]; /* initial value */ sizeRemaining = maxSize; /* initial value */ bytesConsumed = 0; /* initial value */ @@ -805,10 +805,6 @@ readAnd(struct BitmapInfoHeader * const hdrP, truncatedAndSize = sizeRemaining; } else truncatedAndSize = andSize; - - bitmapCursor += truncatedAndSize; - sizeRemaining -= truncatedAndSize; - bytesConsumed += truncatedAndSize; } bytesPerRow = ((1 * hdrP->bm_width + 31) / 32) * 4; @@ -833,6 +829,8 @@ readAnd(struct BitmapInfoHeader * const hdrP, } } } + sizeRemaining -= truncatedAndSize; + bytesConsumed += truncatedAndSize; } @@ -1153,6 +1151,7 @@ convertPng(const unsigned char * const image, imageBuffer.size = dirEntryP->size; imageBuffer.buffer = (unsigned char *)image; + fflush (stdout); pm_system(pm_feed_from_memory, &imageBuffer, NULL /* stdout accepter */, NULL, "pngtopam -alphapam"); |