about summary refs log tree commit diff
path: root/other
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-03-26 22:55:21 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2023-03-26 22:55:21 +0000
commit3dbb31eea871f8aa8d11717d1b266a55d077a22c (patch)
tree3d91a88c60bb477c7d16c737d276397fc65cf89f /other
parente6cccbb0c33bcd27b73adb1dfc94375f40b17ffc (diff)
downloadnetpbm-mirror-3dbb31eea871f8aa8d11717d1b266a55d077a22c.tar.gz
netpbm-mirror-3dbb31eea871f8aa8d11717d1b266a55d077a22c.tar.xz
netpbm-mirror-3dbb31eea871f8aa8d11717d1b266a55d077a22c.zip
cleanup
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4541 9d0c8265-081b-0410-96cb-a4ca84ce46f8
Diffstat (limited to 'other')
-rw-r--r--other/pnmcolormap.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/other/pnmcolormap.c b/other/pnmcolormap.c
index fbe85d4e..a1cb7a8c 100644
--- a/other/pnmcolormap.c
+++ b/other/pnmcolormap.c
@@ -731,7 +731,9 @@ splitBox(struct BoxVector *    const boxVectorP,
                          &oldBoxP->maxdim, &oldBoxP->spread);
     }
     {
-        struct Box * const newBoxP = &boxVectorP->box[boxVectorP->boxCt];
+        struct Box * const newBoxP = &boxVectorP->box[boxVectorP->boxCt++];
+
+        assert(boxVectorP->boxCt <= boxVectorP->capacity);
 
         newBoxP->startIndex = boxStart + medianIndex;
         newBoxP->colorCt    = boxSize - medianIndex;
@@ -739,7 +741,6 @@ splitBox(struct BoxVector *    const boxVectorP,
         computeBoxSpread(newBoxP, boxVectorP->colorFreqTable,
                          boxVectorP->colorDepth, methodForLargest,
                          &newBoxP->maxdim, &newBoxP->spread);
-        ++boxVectorP->boxCt;
     }
 
     sortBoxes(boxVectorP, methodForSplit);