Fix nGrow initialization in DPA_CreateEx.

This commit is contained in:
Robert Shearman 2004-02-06 05:16:32 +00:00 committed by Alexandre Julliard
parent 163396b955
commit 436145e975
2 changed files with 13 additions and 1 deletions

View File

@ -2195,7 +2195,7 @@ DPA_CreateEx (INT nGrow, HANDLE hHeap)
hdpa = Alloc (sizeof(*hdpa));
if (hdpa) {
hdpa->nGrow = min(8, nGrow);
hdpa->nGrow = max(8, nGrow);
hdpa->hHeap = hHeap ? hHeap : GetProcessHeap();
hdpa->nMaxCount = hdpa->nGrow * 2;
hdpa->ptrs = HeapAlloc (hdpa->hHeap, HEAP_ZERO_MEMORY,

View File

@ -30,6 +30,9 @@
#include "wine/test.h"
static HDPA (WINAPI *pDPA_Create)(int);
static BOOL (WINAPI *pDPA_Grow)(const HDPA hdpa, INT nGrow);
static BOOL (WINAPI *pDPA_Destroy)(const HDPA hdpa);
static BOOL (WINAPI *pDPA_SetPtr)(const HDPA hdpa, INT i, LPVOID p);
static INT CALLBACK dpa_strcmp(LPVOID pvstr1, LPVOID pvstr2, LPARAM flags)
{
@ -56,6 +59,12 @@ void DPA_test()
ok((int_ret == 0), "DPA_Search proposed bad item\n");
int_ret = DPA_Search(dpa_ret,test_str0,0, dpa_strcmp,0, DPAS_SORTED|DPAS_INSERTAFTER);
ok((int_ret == 0), "DPA_Search proposed bad item\n");
int_ret = pDPA_Grow(dpa_ret,0);
ok(int_ret != 0, "DPA_Grow failed\n");
int_ret = pDPA_SetPtr(dpa_ret, 0, (void*)0xdeadbeef);
ok(int_ret != 0, "DPA_SetPtr failed\n");
int_ret = pDPA_Destroy(dpa_ret);
ok(int_ret != 0, "DPA_Destory failed\n");
}
START_TEST(dpa)
@ -64,6 +73,9 @@ START_TEST(dpa)
hdll=GetModuleHandleA("comctl32.dll");
pDPA_Create=(void*)GetProcAddress(hdll,(LPCSTR)328);
pDPA_Destroy=(void*)GetProcAddress(hdll,(LPCSTR)329);
pDPA_Grow=(void*)GetProcAddress(hdll,(LPCSTR)330);
pDPA_SetPtr=(void*)GetProcAddress(hdll,(LPCSTR)335);
DPA_test();
}