include: Move some documented DPA definitions to public header, use PSDK names.

This commit is contained in:
Nikolay Sivov 2009-09-10 00:02:55 +04:00 committed by Alexandre Julliard
parent e7304066d1
commit 2c190ab438
4 changed files with 28 additions and 28 deletions

View File

@ -183,18 +183,6 @@ DWORD WINAPI GetSize (LPVOID);
INT WINAPI Str_GetPtrA (LPCSTR, LPSTR, INT); INT WINAPI Str_GetPtrA (LPCSTR, LPSTR, INT);
INT WINAPI Str_GetPtrW (LPCWSTR, LPWSTR, INT); INT WINAPI Str_GetPtrW (LPCWSTR, LPWSTR, INT);
INT WINAPI DPA_GetPtrIndex (HDPA, LPCVOID);
BOOL WINAPI DPA_Grow (HDPA, INT);
#define DPAM_NOSORT 0x0001
#define DPAM_INSERT 0x0004
#define DPAM_DELETE 0x0008
typedef PVOID (CALLBACK *PFNDPAMERGE)(DWORD,PVOID,PVOID,LPARAM);
BOOL WINAPI DPA_Merge (HDPA, HDPA, DWORD, PFNDPACOMPARE, PFNDPAMERGE, LPARAM);
#define DPA_GetPtrCount(hdpa) (*(INT*)(hdpa))
LRESULT WINAPI SetPathWordBreakProc(HWND hwnd, BOOL bSet); LRESULT WINAPI SetPathWordBreakProc(HWND hwnd, BOOL bSet);
BOOL WINAPI MirrorIcon(HICON *phicon1, HICON *phicon2); BOOL WINAPI MirrorIcon(HICON *phicon1, HICON *phicon2);

View File

@ -241,7 +241,7 @@ BOOL WINAPI DPA_Merge (HDPA hdpa1, HDPA hdpa2, DWORD dwFlags,
if (IsBadCodePtr ((FARPROC)pfnMerge)) if (IsBadCodePtr ((FARPROC)pfnMerge))
return FALSE; return FALSE;
if (!(dwFlags & DPAM_NOSORT)) { if (!(dwFlags & DPAM_SORTED)) {
TRACE("sorting dpa's!\n"); TRACE("sorting dpa's!\n");
if (hdpa1->nItemCount > 0) if (hdpa1->nItemCount > 0)
DPA_Sort (hdpa1, pfnCompare, lParam); DPA_Sort (hdpa1, pfnCompare, lParam);
@ -269,14 +269,14 @@ BOOL WINAPI DPA_Merge (HDPA hdpa1, HDPA hdpa2, DWORD dwFlags,
do do
{ {
if (nIndex < 0) { if (nIndex < 0) {
if ((nCount >= 0) && (dwFlags & DPAM_INSERT)) { if ((nCount >= 0) && (dwFlags & DPAM_UNION)) {
/* Now insert the remaining new items into DPA 1 */ /* Now insert the remaining new items into DPA 1 */
TRACE("%d items to be inserted at start of DPA 1\n", TRACE("%d items to be inserted at start of DPA 1\n",
nCount+1); nCount+1);
for (i=nCount; i>=0; i--) { for (i=nCount; i>=0; i--) {
PVOID ptr; PVOID ptr;
ptr = (pfnMerge)(3, *pWork2, NULL, lParam); ptr = (pfnMerge)(DPAMM_INSERT, *pWork2, NULL, lParam);
if (!ptr) if (!ptr)
return FALSE; return FALSE;
DPA_InsertPtr (hdpa1, 0, ptr); DPA_InsertPtr (hdpa1, 0, ptr);
@ -293,7 +293,7 @@ BOOL WINAPI DPA_Merge (HDPA hdpa1, HDPA hdpa2, DWORD dwFlags,
{ {
PVOID ptr; PVOID ptr;
ptr = (pfnMerge)(1, *pWork1, *pWork2, lParam); ptr = (pfnMerge)(DPAMM_MERGE, *pWork1, *pWork2, lParam);
if (!ptr) if (!ptr)
return FALSE; return FALSE;
@ -306,14 +306,14 @@ BOOL WINAPI DPA_Merge (HDPA hdpa1, HDPA hdpa2, DWORD dwFlags,
else if (nResult > 0) else if (nResult > 0)
{ {
/* item in DPA 1 missing from DPA 2 */ /* item in DPA 1 missing from DPA 2 */
if (dwFlags & DPAM_DELETE) if (dwFlags & DPAM_INTERSECT)
{ {
/* Now delete the extra item in DPA1 */ /* Now delete the extra item in DPA1 */
PVOID ptr; PVOID ptr;
ptr = DPA_DeletePtr (hdpa1, hdpa1->nItemCount - 1); ptr = DPA_DeletePtr (hdpa1, hdpa1->nItemCount - 1);
(pfnMerge)(2, ptr, NULL, lParam); (pfnMerge)(DPAMM_DELETE, ptr, NULL, lParam);
} }
nIndex--; nIndex--;
pWork1--; pWork1--;
@ -321,12 +321,12 @@ BOOL WINAPI DPA_Merge (HDPA hdpa1, HDPA hdpa2, DWORD dwFlags,
else else
{ {
/* new item in DPA 2 */ /* new item in DPA 2 */
if (dwFlags & DPAM_INSERT) if (dwFlags & DPAM_UNION)
{ {
/* Now insert the new item in DPA 1 */ /* Now insert the new item in DPA 1 */
PVOID ptr; PVOID ptr;
ptr = (pfnMerge)(3, *pWork2, NULL, lParam); ptr = (pfnMerge)(DPAMM_INSERT, *pWork2, NULL, lParam);
if (!ptr) if (!ptr)
return FALSE; return FALSE;
DPA_InsertPtr (hdpa1, nIndex+1, ptr); DPA_InsertPtr (hdpa1, nIndex+1, ptr);

View File

@ -31,17 +31,12 @@
#include "wine/test.h" #include "wine/test.h"
#define DPAM_NOSORT 0x1
#define DPAM_INSERT 0x4
#define DPAM_DELETE 0x8
typedef struct _ITEMDATA typedef struct _ITEMDATA
{ {
INT iPos; INT iPos;
PVOID pvData; PVOID pvData;
} ITEMDATA, *LPITEMDATA; } ITEMDATA, *LPITEMDATA;
typedef PVOID (CALLBACK *PFNDPAMERGE)(UINT,PVOID,PVOID,LPARAM);
typedef HRESULT (CALLBACK *PFNDPASTM)(LPITEMDATA,IStream*,LPARAM); typedef HRESULT (CALLBACK *PFNDPASTM)(LPITEMDATA,IStream*,LPARAM);
static HDPA (WINAPI *pDPA_Clone)(const HDPA,const HDPA); static HDPA (WINAPI *pDPA_Clone)(const HDPA,const HDPA);
@ -388,7 +383,7 @@ static void test_DPA_Merge(void)
ok(rc, "dw=0x%x\n", dw); ok(rc, "dw=0x%x\n", dw);
/* Delete all odd entries from dpa2 */ /* Delete all odd entries from dpa2 */
pDPA_Merge(dpa2, dpa, DPAM_DELETE, pDPA_Merge(dpa2, dpa, DPAM_INTERSECT,
CB_CmpLT, CB_MergeDeleteOddSrc, 0xdeadbeef); CB_CmpLT, CB_MergeDeleteOddSrc, 0xdeadbeef);
todo_wine todo_wine
{ {
@ -397,9 +392,9 @@ static void test_DPA_Merge(void)
} }
/* Merge dpa3 into dpa2 and dpa */ /* Merge dpa3 into dpa2 and dpa */
pDPA_Merge(dpa, dpa3, DPAM_INSERT|DPAM_NOSORT, pDPA_Merge(dpa, dpa3, DPAM_UNION|DPAM_SORTED,
CB_CmpLT, CB_MergeInsertSrc, 0xdeadbeef); CB_CmpLT, CB_MergeInsertSrc, 0xdeadbeef);
pDPA_Merge(dpa2, dpa3, DPAM_INSERT|DPAM_NOSORT, pDPA_Merge(dpa2, dpa3, DPAM_UNION|DPAM_SORTED,
CB_CmpLT, CB_MergeInsertSrc, 0xdeadbeef); CB_CmpLT, CB_MergeInsertSrc, 0xdeadbeef);
rc = CheckDPA(dpa, 0x123456, &dw); rc = CheckDPA(dpa, 0x123456, &dw);

View File

@ -4979,8 +4979,22 @@ INT WINAPI DSA_InsertItem(HDSA, INT, LPVOID);
struct _DPA; struct _DPA;
typedef struct _DPA *HDPA; typedef struct _DPA *HDPA;
#define DPA_GetPtrCount(hdpa) (*(INT*)(hdpa))
typedef INT (CALLBACK *PFNDPAENUMCALLBACK)(LPVOID, LPVOID); typedef INT (CALLBACK *PFNDPAENUMCALLBACK)(LPVOID, LPVOID);
typedef INT (CALLBACK *PFNDPACOMPARE)(LPVOID, LPVOID, LPARAM); typedef INT (CALLBACK *PFNDPACOMPARE)(LPVOID, LPVOID, LPARAM);
typedef PVOID (CALLBACK *PFNDPAMERGE)(UINT,PVOID,PVOID,LPARAM);
/* merge callback codes */
#define DPAMM_MERGE 1
#define DPAMM_DELETE 2
#define DPAMM_INSERT 3
/* merge options */
#define DPAM_SORTED 0x00000001
#define DPAM_NORMAL 0x00000002
#define DPAM_UNION 0x00000004
#define DPAM_INTERSECT 0x00000008
HDPA WINAPI DPA_Create(INT); HDPA WINAPI DPA_Create(INT);
BOOL WINAPI DPA_Destroy(HDPA); BOOL WINAPI DPA_Destroy(HDPA);
@ -4988,11 +5002,14 @@ LPVOID WINAPI DPA_DeletePtr(HDPA, INT);
BOOL WINAPI DPA_DeleteAllPtrs(HDPA); BOOL WINAPI DPA_DeleteAllPtrs(HDPA);
BOOL WINAPI DPA_SetPtr(HDPA, INT, LPVOID); BOOL WINAPI DPA_SetPtr(HDPA, INT, LPVOID);
LPVOID WINAPI DPA_GetPtr(HDPA, INT); LPVOID WINAPI DPA_GetPtr(HDPA, INT);
INT WINAPI DPA_GetPtrIndex(HDPA, LPCVOID);
BOOL WINAPI DPA_Grow(HDPA, INT);
INT WINAPI DPA_InsertPtr(HDPA, INT, LPVOID); INT WINAPI DPA_InsertPtr(HDPA, INT, LPVOID);
BOOL WINAPI DPA_Sort(HDPA, PFNDPACOMPARE, LPARAM); BOOL WINAPI DPA_Sort(HDPA, PFNDPACOMPARE, LPARAM);
void WINAPI DPA_EnumCallback(HDPA, PFNDPAENUMCALLBACK, LPVOID); void WINAPI DPA_EnumCallback(HDPA, PFNDPAENUMCALLBACK, LPVOID);
void WINAPI DPA_DestroyCallback(HDPA, PFNDPAENUMCALLBACK, LPVOID); void WINAPI DPA_DestroyCallback(HDPA, PFNDPAENUMCALLBACK, LPVOID);
INT WINAPI DPA_Search(HDPA, LPVOID, INT, PFNDPACOMPARE, LPARAM, UINT); INT WINAPI DPA_Search(HDPA, LPVOID, INT, PFNDPACOMPARE, LPARAM, UINT);
BOOL WINAPI DPA_Merge(HDPA, HDPA, DWORD, PFNDPACOMPARE, PFNDPAMERGE, LPARAM);
BOOL WINAPI Str_SetPtrW (LPWSTR *, LPCWSTR); BOOL WINAPI Str_SetPtrW (LPWSTR *, LPCWSTR);