mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 12:19:49 +00:00
comctl32: Actually grow the array in DPA_Grow.
This commit is contained in:
parent
6bc1a359f8
commit
9e47c59427
2 changed files with 18 additions and 3 deletions
|
@ -426,12 +426,27 @@ BOOL WINAPI DPA_Destroy (const HDPA hdpa)
|
|||
*/
|
||||
BOOL WINAPI DPA_Grow (HDPA hdpa, INT nGrow)
|
||||
{
|
||||
INT items;
|
||||
TRACE("(%p %d)\n", hdpa, nGrow);
|
||||
|
||||
if (!hdpa)
|
||||
return FALSE;
|
||||
|
||||
hdpa->nGrow = max(8, nGrow);
|
||||
nGrow = max( 8, nGrow );
|
||||
items = nGrow * (((hdpa->nMaxCount - 1) / nGrow) + 1);
|
||||
if (items > hdpa->nMaxCount)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
if (hdpa->ptrs)
|
||||
ptr = HeapReAlloc( hdpa->hHeap, HEAP_ZERO_MEMORY, hdpa->ptrs, items * sizeof(LPVOID) );
|
||||
else
|
||||
ptr = HeapAlloc( hdpa->hHeap, HEAP_ZERO_MEMORY, items * sizeof(LPVOID) );
|
||||
if (!ptr) return FALSE;
|
||||
hdpa->nMaxCount = items;
|
||||
hdpa->ptrs = ptr;
|
||||
}
|
||||
hdpa->nGrow = nGrow;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -213,9 +213,9 @@ static void test_dpa(void)
|
|||
dpa3 = pDPA_CreateEx(0, hHeap);
|
||||
ok(dpa3 != NULL, "\n");
|
||||
ret = pDPA_Grow(dpa3, si.dwPageSize + 1);
|
||||
todo_wine ok(!ret && GetLastError() == ERROR_NOT_ENOUGH_MEMORY,
|
||||
ok(!ret && GetLastError() == ERROR_NOT_ENOUGH_MEMORY,
|
||||
"ret=%d error=%d\n", ret, GetLastError());
|
||||
|
||||
|
||||
dpa = pDPA_Create(0);
|
||||
ok(dpa != NULL, "\n");
|
||||
|
||||
|
|
Loading…
Reference in a new issue