From b7f2ccb6b456583226462e514a9af8847c8837b0 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 9 Sep 2009 13:13:08 +0200 Subject: [PATCH] comctl32: Use explicit prototypes for function pointers. --- dlls/comctl32/comctl32undoc.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/dlls/comctl32/comctl32undoc.c b/dlls/comctl32/comctl32undoc.c index 194efe5e4f8..ee684c627d4 100644 --- a/dlls/comctl32/comctl32undoc.c +++ b/dlls/comctl32/comctl32undoc.c @@ -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; icursize; 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; }