From 3dbb31eea871f8aa8d11717d1b266a55d077a22c Mon Sep 17 00:00:00 2001 From: giraffedata Date: Sun, 26 Mar 2023 22:55:21 +0000 Subject: cleanup git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4541 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- other/pnmcolormap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'other') 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); -- cgit 1.4.1