Fixed an error and an off-by-one bug in DSA_SetItem(). This

eliminates some crashes with Win98 native SHELL32.
This commit is contained in:
Ian Schmidt 1999-06-12 06:48:49 +00:00 committed by Alexandre Julliard
parent 8c7266009c
commit 64eed99f8e
1 changed files with 2 additions and 1 deletions

View File

@ -659,7 +659,7 @@ DSA_SetItem (const HDSA hdsa, INT nIndex, LPVOID pSrc)
/* within the old array */ /* within the old array */
if (hdsa->nMaxCount > nIndex) { if (hdsa->nMaxCount > nIndex) {
/* within the allocated space, set a new boundary */ /* within the allocated space, set a new boundary */
hdsa->nItemCount = nIndex; hdsa->nItemCount = nIndex + 1;
} }
else { else {
/* resize the block of memory */ /* resize the block of memory */
@ -672,6 +672,7 @@ DSA_SetItem (const HDSA hdsa, INT nIndex, LPVOID pSrc)
return FALSE; return FALSE;
hdsa->nMaxCount = nNewItems; hdsa->nMaxCount = nNewItems;
hdsa->nItemCount = nIndex + 1;
hdsa->pData = lpTemp; hdsa->pData = lpTemp;
} }
} }