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(). * - 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 typedef struct tagCREATEMRULISTA
{ {
DWORD cbSize; DWORD cbSize;
@ -213,7 +217,11 @@ typedef struct tagCREATEMRULISTA
DWORD dwFlags; DWORD dwFlags;
HKEY hKey; HKEY hKey;
LPSTR lpszSubKey; LPSTR lpszSubKey;
PROC lpfnCompare; union
{
MRUStringCmpFnA string_cmpfn;
MRUBinaryCmpFn binary_cmpfn;
} u;
} CREATEMRULISTA, *LPCREATEMRULISTA; } CREATEMRULISTA, *LPCREATEMRULISTA;
typedef struct tagCREATEMRULISTW typedef struct tagCREATEMRULISTW
@ -223,7 +231,11 @@ typedef struct tagCREATEMRULISTW
DWORD dwFlags; DWORD dwFlags;
HKEY hKey; HKEY hKey;
LPWSTR lpszSubKey; LPWSTR lpszSubKey;
PROC lpfnCompare; union
{
MRUStringCmpFnW string_cmpfn;
MRUBinaryCmpFn binary_cmpfn;
} u;
} CREATEMRULISTW, *LPCREATEMRULISTW; } CREATEMRULISTW, *LPCREATEMRULISTW;
/* dwFlags */ /* dwFlags */
@ -385,7 +397,7 @@ INT WINAPI FindMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData,
UINT i; UINT i;
LPSTR dataA = NULL; LPSTR dataA = NULL;
if (!mp || !mp->extview.lpfnCompare) if (!mp || !mp->extview.u.string_cmpfn)
return -1; return -1;
if(!(mp->extview.dwFlags & MRUF_BINARY_LIST) && !mp->isUnicode) { 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++) { for(i=0; i<mp->cursize; i++) {
if (mp->extview.dwFlags & MRUF_BINARY_LIST) { if (mp->extview.dwFlags & MRUF_BINARY_LIST) {
if (!mp->extview.lpfnCompare(lpData, &mp->array[i]->datastart, if (!mp->extview.u.binary_cmpfn(lpData, &mp->array[i]->datastart, cbData))
cbData))
break; break;
} }
else { else {
if(mp->isUnicode) { 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; break;
} else { } else {
DWORD len = WideCharToMultiByte(CP_ACP, 0, 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, WideCharToMultiByte(CP_ACP, 0, (LPWSTR)&mp->array[i]->datastart, -1,
itemA, len, NULL, NULL); itemA, len, NULL, NULL);
cmp = mp->extview.lpfnCompare(dataA, itemA); cmp = mp->extview.u.string_cmpfn((LPWSTR)dataA, (LPWSTR)itemA);
Free(itemA); Free(itemA);
if(!cmp) if(!cmp)
break; 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", 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.cbSize, mp->extview.nMaxItems, mp->extview.dwFlags,
mp->extview.hKey, debugstr_w(mp->extview.lpszSubKey), mp->extview.hKey, debugstr_w(mp->extview.lpszSubKey),
mp->extview.lpfnCompare, err); mp->extview.u.string_cmpfn, err);
return 0; return 0;
} }
@ -717,7 +728,7 @@ static HANDLE CreateMRUListLazy_common(LPWINEMRULIST mp)
TRACE("(%u %u %x %p %s %p): Current Size = %d\n", TRACE("(%u %u %x %p %s %p): Current Size = %d\n",
mp->extview.cbSize, mp->extview.nMaxItems, mp->extview.dwFlags, mp->extview.cbSize, mp->extview.nMaxItems, mp->extview.dwFlags,
mp->extview.hKey, debugstr_w(mp->extview.lpszSubKey), mp->extview.hKey, debugstr_w(mp->extview.lpszSubKey),
mp->extview.lpfnCompare, mp->cursize); mp->extview.u.string_cmpfn, mp->cursize);
return mp; return mp;
} }