Commit 2fbe9cf2 authored by Paul Rupe's avatar Paul Rupe Committed by Alexandre Julliard

Resize dynamic pointer array more carefully when adding new entries.

parent 80be53ef
......@@ -1957,11 +1957,7 @@ DPA_SetPtr (const HDPA hdpa, INT i, LPVOID p)
if (hdpa->nItemCount <= i) {
/* within the old array */
if (hdpa->nMaxCount > i) {
/* within the allocated space, set a new boundary */
hdpa->nItemCount = i+1;
}
else {
if (hdpa->nMaxCount <= i) {
/* resize the block of memory */
INT nNewItems =
hdpa->nGrow * ((INT)(((i+1) - 1) / hdpa->nGrow) + 1);
......@@ -1972,9 +1968,10 @@ DPA_SetPtr (const HDPA hdpa, INT i, LPVOID p)
if (!lpTemp)
return FALSE;
hdpa->nItemCount = nNewItems;
hdpa->nMaxCount = nNewItems;
hdpa->ptrs = lpTemp;
}
hdpa->nItemCount = i+1;
}
/* put the new entry in */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment