Commit 2c190ab4 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

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

parent e7304066
......@@ -183,18 +183,6 @@ DWORD WINAPI GetSize (LPVOID);
INT WINAPI Str_GetPtrA (LPCSTR, LPSTR, 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);
BOOL WINAPI MirrorIcon(HICON *phicon1, HICON *phicon2);
......
......@@ -241,7 +241,7 @@ BOOL WINAPI DPA_Merge (HDPA hdpa1, HDPA hdpa2, DWORD dwFlags,
if (IsBadCodePtr ((FARPROC)pfnMerge))
return FALSE;
if (!(dwFlags & DPAM_NOSORT)) {
if (!(dwFlags & DPAM_SORTED)) {
TRACE("sorting dpa's!\n");
if (hdpa1->nItemCount > 0)
DPA_Sort (hdpa1, pfnCompare, lParam);
......@@ -269,14 +269,14 @@ BOOL WINAPI DPA_Merge (HDPA hdpa1, HDPA hdpa2, DWORD dwFlags,
do
{
if (nIndex < 0) {
if ((nCount >= 0) && (dwFlags & DPAM_INSERT)) {
if ((nCount >= 0) && (dwFlags & DPAM_UNION)) {
/* Now insert the remaining new items into DPA 1 */
TRACE("%d items to be inserted at start of DPA 1\n",
nCount+1);
for (i=nCount; i>=0; i--) {
PVOID ptr;
ptr = (pfnMerge)(3, *pWork2, NULL, lParam);
ptr = (pfnMerge)(DPAMM_INSERT, *pWork2, NULL, lParam);
if (!ptr)
return FALSE;
DPA_InsertPtr (hdpa1, 0, ptr);
......@@ -293,7 +293,7 @@ BOOL WINAPI DPA_Merge (HDPA hdpa1, HDPA hdpa2, DWORD dwFlags,
{
PVOID ptr;
ptr = (pfnMerge)(1, *pWork1, *pWork2, lParam);
ptr = (pfnMerge)(DPAMM_MERGE, *pWork1, *pWork2, lParam);
if (!ptr)
return FALSE;
......@@ -306,14 +306,14 @@ BOOL WINAPI DPA_Merge (HDPA hdpa1, HDPA hdpa2, DWORD dwFlags,
else if (nResult > 0)
{
/* item in DPA 1 missing from DPA 2 */
if (dwFlags & DPAM_DELETE)
if (dwFlags & DPAM_INTERSECT)
{
/* Now delete the extra item in DPA1 */
PVOID ptr;
ptr = DPA_DeletePtr (hdpa1, hdpa1->nItemCount - 1);
(pfnMerge)(2, ptr, NULL, lParam);
(pfnMerge)(DPAMM_DELETE, ptr, NULL, lParam);
}
nIndex--;
pWork1--;
......@@ -321,12 +321,12 @@ BOOL WINAPI DPA_Merge (HDPA hdpa1, HDPA hdpa2, DWORD dwFlags,
else
{
/* new item in DPA 2 */
if (dwFlags & DPAM_INSERT)
if (dwFlags & DPAM_UNION)
{
/* Now insert the new item in DPA 1 */
PVOID ptr;
ptr = (pfnMerge)(3, *pWork2, NULL, lParam);
ptr = (pfnMerge)(DPAMM_INSERT, *pWork2, NULL, lParam);
if (!ptr)
return FALSE;
DPA_InsertPtr (hdpa1, nIndex+1, ptr);
......
......@@ -31,17 +31,12 @@
#include "wine/test.h"
#define DPAM_NOSORT 0x1
#define DPAM_INSERT 0x4
#define DPAM_DELETE 0x8
typedef struct _ITEMDATA
{
INT iPos;
PVOID pvData;
} ITEMDATA, *LPITEMDATA;
typedef PVOID (CALLBACK *PFNDPAMERGE)(UINT,PVOID,PVOID,LPARAM);
typedef HRESULT (CALLBACK *PFNDPASTM)(LPITEMDATA,IStream*,LPARAM);
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);
/* Delete all odd entries from dpa2 */
pDPA_Merge(dpa2, dpa, DPAM_DELETE,
pDPA_Merge(dpa2, dpa, DPAM_INTERSECT,
CB_CmpLT, CB_MergeDeleteOddSrc, 0xdeadbeef);
todo_wine
{
......@@ -397,9 +392,9 @@ static void test_DPA_Merge(void)
}
/* 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);
pDPA_Merge(dpa2, dpa3, DPAM_INSERT|DPAM_NOSORT,
pDPA_Merge(dpa2, dpa3, DPAM_UNION|DPAM_SORTED,
CB_CmpLT, CB_MergeInsertSrc, 0xdeadbeef);
rc = CheckDPA(dpa, 0x123456, &dw);
......
......@@ -4979,8 +4979,22 @@ INT WINAPI DSA_InsertItem(HDSA, INT, LPVOID);
struct _DPA;
typedef struct _DPA *HDPA;
#define DPA_GetPtrCount(hdpa) (*(INT*)(hdpa))
typedef INT (CALLBACK *PFNDPAENUMCALLBACK)(LPVOID, LPVOID);
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);
BOOL WINAPI DPA_Destroy(HDPA);
......@@ -4988,11 +5002,14 @@ LPVOID WINAPI DPA_DeletePtr(HDPA, INT);
BOOL WINAPI DPA_DeleteAllPtrs(HDPA);
BOOL WINAPI DPA_SetPtr(HDPA, INT, LPVOID);
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);
BOOL WINAPI DPA_Sort(HDPA, PFNDPACOMPARE, LPARAM);
void WINAPI DPA_EnumCallback(HDPA, PFNDPAENUMCALLBACK, LPVOID);
void WINAPI DPA_DestroyCallback(HDPA, PFNDPAENUMCALLBACK, LPVOID);
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);
......
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