comctl32: Use explicit prototypes for function pointers.

This commit is contained in:
Alexandre Julliard 2009-09-09 13:13:08 +02:00
parent b225082a71
commit b7f2ccb6b4
1 changed files with 20 additions and 9 deletions

View File

@ -206,6 +206,10 @@ DWORD WINAPI GetSize (LPVOID lpMem)
* - Free an MRU-list with FreeMRUList().
*/
typedef INT (CALLBACK *MRUStringCmpFnA)(LPCSTR lhs, LPCSTR rhs);
typedef INT (CALLBACK *MRUStringCmpFnW)(LPCWSTR lhs, LPCWSTR rhs);
typedef INT (CALLBACK *MRUBinaryCmpFn)(LPCVOID lhs, LPCVOID rhs, DWORD length);
typedef struct tagCREATEMRULISTA
{
DWORD cbSize;
@ -213,7 +217,11 @@ typedef struct tagCREATEMRULISTA
DWORD dwFlags;
HKEY hKey;
LPSTR lpszSubKey;
PROC lpfnCompare;
union
{
MRUStringCmpFnA string_cmpfn;
MRUBinaryCmpFn binary_cmpfn;
} u;
} CREATEMRULISTA, *LPCREATEMRULISTA;
typedef struct tagCREATEMRULISTW
@ -223,7 +231,11 @@ typedef struct tagCREATEMRULISTW
DWORD dwFlags;
HKEY hKey;
LPWSTR lpszSubKey;
PROC lpfnCompare;
union
{
MRUStringCmpFnW string_cmpfn;
MRUBinaryCmpFn binary_cmpfn;
} u;
} CREATEMRULISTW, *LPCREATEMRULISTW;
/* dwFlags */
@ -385,7 +397,7 @@ INT WINAPI FindMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData,
UINT i;
LPSTR dataA = NULL;
if (!mp || !mp->extview.lpfnCompare)
if (!mp || !mp->extview.u.string_cmpfn)
return -1;
if(!(mp->extview.dwFlags & MRUF_BINARY_LIST) && !mp->isUnicode) {
@ -397,13 +409,12 @@ INT WINAPI FindMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData,
for(i=0; i<mp->cursize; i++) {
if (mp->extview.dwFlags & MRUF_BINARY_LIST) {
if (!mp->extview.lpfnCompare(lpData, &mp->array[i]->datastart,
cbData))
if (!mp->extview.u.binary_cmpfn(lpData, &mp->array[i]->datastart, cbData))
break;
}
else {
if(mp->isUnicode) {
if (!mp->extview.lpfnCompare(lpData, &mp->array[i]->datastart))
if (!mp->extview.u.string_cmpfn(lpData, (LPWSTR)&mp->array[i]->datastart))
break;
} else {
DWORD len = WideCharToMultiByte(CP_ACP, 0,
@ -414,7 +425,7 @@ INT WINAPI FindMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData,
WideCharToMultiByte(CP_ACP, 0, (LPWSTR)&mp->array[i]->datastart, -1,
itemA, len, NULL, NULL);
cmp = mp->extview.lpfnCompare(dataA, itemA);
cmp = mp->extview.u.string_cmpfn((LPWSTR)dataA, (LPWSTR)itemA);
Free(itemA);
if(!cmp)
break;
@ -672,7 +683,7 @@ static HANDLE CreateMRUListLazy_common(LPWINEMRULIST mp)
ERR("(%u %u %x %p %s %p): Could not open key, error=%d\n",
mp->extview.cbSize, mp->extview.nMaxItems, mp->extview.dwFlags,
mp->extview.hKey, debugstr_w(mp->extview.lpszSubKey),
mp->extview.lpfnCompare, err);
mp->extview.u.string_cmpfn, err);
return 0;
}
@ -717,7 +728,7 @@ static HANDLE CreateMRUListLazy_common(LPWINEMRULIST mp)
TRACE("(%u %u %x %p %s %p): Current Size = %d\n",
mp->extview.cbSize, mp->extview.nMaxItems, mp->extview.dwFlags,
mp->extview.hKey, debugstr_w(mp->extview.lpszSubKey),
mp->extview.lpfnCompare, mp->cursize);
mp->extview.u.string_cmpfn, mp->cursize);
return mp;
}