From 1a5efa05af37e5e5eda82d0bf12e1354c9e9deec Mon Sep 17 00:00:00 2001 From: Goraf Date: Sun, 7 Feb 2016 18:01:06 +0000 Subject: ContextHelp: x64 fixes (patch by Wishmaster) git-svn-id: http://svn.miranda-ng.org/main/trunk@16241 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/ContextHelp/src/datastore.cpp | 5 +---- plugins/ContextHelp/src/dlgboxsubclass.cpp | 31 ++++++++++++------------------ plugins/ContextHelp/src/helpdlg.cpp | 24 +++++++++-------------- plugins/ContextHelp/src/helppack.cpp | 10 +++------- plugins/ContextHelp/src/options.cpp | 4 +--- plugins/ContextHelp/src/streaminout.cpp | 4 +--- plugins/ContextHelp/src/utils.cpp | 4 ++-- 7 files changed, 29 insertions(+), 53 deletions(-) (limited to 'plugins/ContextHelp') diff --git a/plugins/ContextHelp/src/datastore.cpp b/plugins/ContextHelp/src/datastore.cpp index 2e63343a96..ca04665acf 100644 --- a/plugins/ContextHelp/src/datastore.cpp +++ b/plugins/ContextHelp/src/datastore.cpp @@ -47,10 +47,8 @@ static HANDLE hServiceFileChange, hFileChange; #define DIALOGCACHEEXPIRY 10*60*1000 // delete from cache after those milliseconds -static INT_PTR ServiceFileChanged(WPARAM wParam, LPARAM lParam) +static INT_PTR ServiceFileChanged(WPARAM wParam, LPARAM) { - UNREFERENCED_PARAMETER(lParam); - EnterCriticalSection(&csDialogCache); for (int i = 0; i < dialogCacheCount; i++) dialogCache[i].timeLastUsed = 0; @@ -542,7 +540,6 @@ void SetControlHelp(const char *pszDlgId, const char *pszModule, int ctrlId, TCH static void DialogCacheSaveThread(void *unused) { int success = 0; - UNREFERENCED_PARAMETER(unused); // TODO: port the following code to write to the helppack file instead // (netlib code already removed) diff --git a/plugins/ContextHelp/src/dlgboxsubclass.cpp b/plugins/ContextHelp/src/dlgboxsubclass.cpp index ebbef31a82..27a01630e1 100644 --- a/plugins/ContextHelp/src/dlgboxsubclass.cpp +++ b/plugins/ContextHelp/src/dlgboxsubclass.cpp @@ -52,7 +52,7 @@ struct FindChildAtPointData { }; // ChildWindowFromPoint() messes up with group boxes -static INT_PTR CALLBACK FindChildAtPointEnumProc(HWND hwnd, LPARAM lParam) +static BOOL CALLBACK FindChildAtPointEnumProc(HWND hwnd, LPARAM lParam) { if (IsWindowVisible(hwnd)) { struct FindChildAtPointData *fcap = (struct FindChildAtPointData*)lParam; @@ -97,13 +97,11 @@ static UINT idMouseMoveTimer = 0; static LONG cursorPos = MAKELONG(-1, -1); static int openedAutoTip = 0; -static void CALLBACK NoMouseMoveForDelayTimerProc(HWND hwnd, UINT msg, UINT idTimer, DWORD time) +static void CALLBACK NoMouseMoveForDelayTimerProc(HWND hwnd, UINT, UINT_PTR idTimer, DWORD) { POINT pt; HWND hwndCtl; struct FindChildAtPointData fcap; - UNREFERENCED_PARAMETER(msg); - UNREFERENCED_PARAMETER(time); KillTimer(hwnd, idTimer); if (idMouseMoveTimer != idTimer) @@ -118,7 +116,7 @@ static void CALLBACK NoMouseMoveForDelayTimerProc(HWND hwnd, UINT msg, UINT idTi // ChildWindowFromPoint() messes up with group boxes fcap.hwnd = NULL; fcap.pt = pt; - EnumChildWindows(hwndMouseMoveDlg, (WNDENUMPROC)FindChildAtPointEnumProc, (LPARAM)&fcap); + EnumChildWindows(hwndMouseMoveDlg, FindChildAtPointEnumProc, (LPARAM)&fcap); hwndCtl = fcap.hwnd; if (hwndCtl == NULL) { ScreenToClient(hwndMouseMoveDlg, &pt); @@ -127,7 +125,7 @@ static void CALLBACK NoMouseMoveForDelayTimerProc(HWND hwnd, UINT msg, UINT idTi return; } - LONG flags = (LONG)GetProp(hwndCtl, PROP_CONTEXTSTATE); + LONG_PTR flags = (LONG_PTR)GetProp(hwndCtl, PROP_CONTEXTSTATE); if (flags&PROPF_AUTOTIPDISABLED) return; flags = SendMessage(hwndCtl, WM_GETDLGCODE, (WPARAM)VK_RETURN, (LPARAM)NULL); @@ -173,8 +171,6 @@ static LRESULT CALLBACK EatNextMouseButtonUpHookProc(int code, WPARAM wParam, LP static LRESULT CALLBACK DialogBoxSubclassProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - WNDPROC pfnWndProc; - DWORD flags; int i; EnterCriticalSection(&csDlgBoxSubclass); @@ -185,8 +181,8 @@ static LRESULT CALLBACK DialogBoxSubclassProc(HWND hwndDlg, UINT msg, WPARAM wPa LeaveCriticalSection(&csDlgBoxSubclass); return 0; } - pfnWndProc = dlgBoxSubclass[i].pfnOldWndProc; - flags = dlgBoxSubclass[i].flags; + WNDPROC pfnWndProc = dlgBoxSubclass[i].pfnOldWndProc; + DWORD flags = dlgBoxSubclass[i].flags; if (msg == WM_NCDESTROY) { struct DlgBoxSubclassData *buf; MoveMemory(dlgBoxSubclass + i, dlgBoxSubclass + i + 1, sizeof(struct DlgBoxSubclassData)*(dlgBoxSubclassCount - i - 1)); @@ -231,7 +227,7 @@ static LRESULT CALLBACK DialogBoxSubclassProc(HWND hwndDlg, UINT msg, WPARAM wPa openedAutoTip = 0; hwndMouseMoveDlg = hwndDlg; if (hwndHelpDlg == NULL) - idMouseMoveTimer = SetTimer(NULL, idMouseMoveTimer, settingAutoTipDelay, (TIMERPROC)NoMouseMoveForDelayTimerProc); + idMouseMoveTimer = SetTimer(NULL, idMouseMoveTimer, settingAutoTipDelay, NoMouseMoveForDelayTimerProc); break; case WM_CAPTURECHANGED: if ((HWND)lParam == hwndDlg) @@ -266,7 +262,6 @@ static LRESULT CALLBACK DialogBoxSubclassProc(HWND hwndDlg, UINT msg, WPARAM wPa case WM_CONTEXTMENU: { POINT pt; - HWND hwndCtl; struct FindChildAtPointData fcap; // workaround for badly coded plugins that do display a context menu @@ -283,8 +278,8 @@ static LRESULT CALLBACK DialogBoxSubclassProc(HWND hwndDlg, UINT msg, WPARAM wPa // ChildWindowFromPoint() messes up with group boxes fcap.hwnd = NULL; fcap.pt = pt; - EnumChildWindows(hwndDlg, (WNDENUMPROC)FindChildAtPointEnumProc, (LPARAM)&fcap); - hwndCtl = fcap.hwnd; + EnumChildWindows(hwndDlg, FindChildAtPointEnumProc, (LPARAM)&fcap); + HWND hwndCtl = fcap.hwnd; if (hwndCtl == NULL) { ScreenToClient(hwndDlg, &pt); hwndCtl = ChildWindowFromPointEx(hwndDlg, pt, CWP_SKIPINVISIBLE); @@ -293,7 +288,7 @@ static LRESULT CALLBACK DialogBoxSubclassProc(HWND hwndDlg, UINT msg, WPARAM wPa POINTSTOPOINT(pt, MAKEPOINTS(lParam)); } { - LONG flags = (LONG)GetProp(hwndCtl, PROP_CONTEXTSTATE); + LONG_PTR flags = (LONG_PTR)GetProp(hwndCtl, PROP_CONTEXTSTATE); if (flags&PROPF_MENUDISABLED) break; else if (!(flags&PROPF_MENUFORCED)) { @@ -407,8 +402,7 @@ static LRESULT CALLBACK HelpSendMessageHookProc(int code, WPARAM wParam, LPARAM LeaveCriticalSection(&csDlgBoxSubclass); } { - HMENU hMenu; - hMenu = GetSystemMenu(msg->hwnd, FALSE); + HMENU hMenu = GetSystemMenu(msg->hwnd, FALSE); if (hMenu != NULL && AppendMenu(hMenu, MF_SEPARATOR, SC_CONTEXTHELP_SEPARATOR, NULL)) { AppendMenu(hMenu, MF_STRING, SC_CONTEXTHELP, TranslateT("&What's this?")); AppendMenu(hMenu, MF_STRING, SC_CONTEXTHELP_DIALOG, TranslateT("&What's this dialog?")); @@ -425,9 +419,8 @@ static LRESULT CALLBACK HelpSendMessageHookProc(int code, WPARAM wParam, LPARAM return CallNextHookEx(hMessageHook, code, wParam, lParam); } -static INT_PTR ServiceShowHelp(WPARAM wParam, LPARAM lParam) +static INT_PTR ServiceShowHelp(WPARAM wParam, LPARAM) { - UNREFERENCED_PARAMETER(lParam); if (!IsWindow((HWND)wParam)) return 1; if (idMouseMoveTimer) diff --git a/plugins/ContextHelp/src/helpdlg.cpp b/plugins/ContextHelp/src/helpdlg.cpp index 82266f1773..8bfe64d8f5 100644 --- a/plugins/ContextHelp/src/helpdlg.cpp +++ b/plugins/ContextHelp/src/helpdlg.cpp @@ -22,10 +22,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern HINSTANCE hInst; HWND hwndHelpDlg; -static int HelpDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc) +static int HelpDialogResize(HWND, LPARAM, UTILRESIZECONTROL *urc) { - UNREFERENCED_PARAMETER(hwndDlg); - UNREFERENCED_PARAMETER(lParam); switch (urc->wId) { case IDC_CTLTEXT: #ifdef EDITOR @@ -40,9 +38,8 @@ static int HelpDialogResize(HWND hwndDlg, LPARAM lParam, UTILRESIZECONTROL *urc) } #ifndef EDITOR -INT_PTR CALLBACK ShadowDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK ShadowDlgProc(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) { - UNREFERENCED_PARAMETER(wParam); switch (msg) { case WM_INITDIALOG: { @@ -186,12 +183,12 @@ INT_PTR CALLBACK HelpDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara rc.right = rcBuf.right; SendDlgItemMessage(hwndDlg, IDC_TEXT, EM_SETRECTNP, 0, (LPARAM)&rc); } - SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CTLTEXT), GWLP_USERDATA, SetWindowLong(GetDlgItem(hwndDlg, IDC_CTLTEXT), GWLP_WNDPROC, (LONG)HelpSubclassProc)); - SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CARETSUCKER), GWLP_USERDATA, SetWindowLong(GetDlgItem(hwndDlg, IDC_CARETSUCKER), GWLP_WNDPROC, (LONG)HelpSubclassProc)); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CTLTEXT), GWLP_USERDATA, SetWindowLong(GetDlgItem(hwndDlg, IDC_CTLTEXT), GWLP_WNDPROC, (LONG_PTR)HelpSubclassProc)); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CARETSUCKER), GWLP_USERDATA, SetWindowLong(GetDlgItem(hwndDlg, IDC_CARETSUCKER), GWLP_WNDPROC, (LONG_PTR)HelpSubclassProc)); SendDlgItemMessage(hwndDlg, IDC_TEXT, EM_SETEVENTMASK, 0, ENM_KEYEVENTS | ENM_MOUSEEVENTS | ENM_REQUESTRESIZE); SendDlgItemMessage(hwndDlg, IDC_TEXT, EM_SETBKGNDCOLOR, 0, GetSysColor(COLOR_INFOBK)); SendDlgItemMessage(hwndDlg, IDC_TEXT, EM_SETEDITSTYLE, SES_EXTENDBACKCOLOR, SES_EXTENDBACKCOLOR); - SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TEXT), GWLP_USERDATA, SetWindowLong(GetDlgItem(hwndDlg, IDC_TEXT), GWLP_WNDPROC, (LONG)HelpSubclassProc)); + SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_TEXT), GWLP_USERDATA, SetWindowLong(GetDlgItem(hwndDlg, IDC_TEXT), GWLP_WNDPROC, (LONG_PTR)HelpSubclassProc)); hwndShadowDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_SHADOW), hwndDlg, ShadowDlgProc, (LPARAM)&hwndShadowDlg); hwndToolTip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_ALWAYSTIP | TTS_NOPREFIX, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hwndDlg, NULL, hInst, NULL); if (hwndToolTip != NULL) { @@ -248,10 +245,9 @@ INT_PTR CALLBACK HelpDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break; case WM_CONTEXTMENU: { - HMENU hMenu; POINT pt; POINTSTOPOINT(pt, MAKEPOINTS(lParam)); - hMenu = CreatePopupMenu(); + HMENU hMenu = CreatePopupMenu(); AppendMenu(hMenu, MF_STRING, WM_COPY, TranslateT("&Copy")); if (TrackPopupMenuEx(hMenu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_HORPOSANIMATION | TPM_VERPOSANIMATION | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_NONOTIFY, pt.x, pt.y, hwndDlg, NULL)) SendMessage(hwndDlg, M_CLIPBOARDCOPY, 0, 0); @@ -314,7 +310,7 @@ INT_PTR CALLBACK HelpDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara case WM_CTLCOLORSTATIC: SetTextColor((HDC)wParam, GetSysColor(COLOR_INFOTEXT)); SetBkColor((HDC)wParam, GetSysColor(COLOR_INFOBK)); - return (BOOL)GetSysColorBrush(COLOR_INFOBK); + return GetSysColorBrush(COLOR_INFOBK) != 0; case WM_ACTIVATE: if (LOWORD(wParam) != WA_INACTIVE) break; @@ -404,10 +400,8 @@ INT_PTR CALLBACK HelpDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara #ifndef EDITOR // show id string instead of help text when 'ctrl' key pressed if (msg == M_LOADHELP && GetAsyncKeyState(VK_CONTROL) & 0x8000) { - char *buf; - HWND hwnd; - buf = CreateControlIdentifier(szDlgId ? szDlgId : "unknown", szModule ? szModule : "unknown", id, hwndCtl); - hwnd = GetDlgItem(hwndDlg, IDC_CTLTEXT); + char *buf = CreateControlIdentifier(szDlgId ? szDlgId : "unknown", szModule ? szModule : "unknown", id, hwndCtl); + HWND hwnd = GetDlgItem(hwndDlg, IDC_CTLTEXT); SetWindowTextA(hwnd, buf); // accepts NULL SetDlgItemText(hwndDlg, IDC_TEXT, NULL); mir_free(buf); // does NULL check diff --git a/plugins/ContextHelp/src/helppack.cpp b/plugins/ContextHelp/src/helppack.cpp index b5897cbe0d..3592cf6a3f 100644 --- a/plugins/ContextHelp/src/helppack.cpp +++ b/plugins/ContextHelp/src/helppack.cpp @@ -157,7 +157,6 @@ static void CleanupLastModifiedUsing(char *szLastModifiedUsing, int nSize) // pack->szFileName needs to be filled in before call static BOOL LoadPackData(HELPPACK_INFO *pack, BOOL fEnabledPacks, const char *pszFileVersionHeader) { - FILE *fp; TCHAR szFileName[MAX_PATH]; char line[4096], *pszColon, *buf; char szLanguageA[64]; /* same size as pack->szLanguage */ @@ -175,7 +174,7 @@ static BOOL LoadPackData(HELPPACK_INFO *pack, BOOL fEnabledPacks, const char *ps */ if (!GetPackPath(szFileName, sizeof(szFileName), fEnabledPacks, pack->szFileName)) return FALSE; - fp = _tfopen(szFileName, _T("rt")); + FILE *fp = _tfopen(szFileName, _T("rt")); if (fp == NULL) return FALSE; fgets(line, sizeof(line), fp); @@ -376,8 +375,6 @@ BOOL IsPluginIncluded(const HELPPACK_INFO *pack, char *pszFileBaseName) else p += lstrlenA(pszFileBaseName) + 1; } - - return FALSE; } /**************************** SWITCH PACKS ************************/ @@ -424,8 +421,6 @@ void CorrectPacks(const TCHAR *pszFilePattern, const TCHAR *pszDefaultFile, BOOL { TCHAR szFrom[MAX_PATH], szDest[MAX_PATH], szDir[MAX_PATH], *pszFile; BOOL fDirCreated = FALSE, fOneEnabled = FALSE; - HANDLE hFind; - WIN32_FIND_DATA wfd; /* main path */ if (!GetModuleFileName(NULL, szDir, sizeof(szDir))) @@ -436,7 +431,8 @@ void CorrectPacks(const TCHAR *pszFilePattern, const TCHAR *pszDefaultFile, BOOL /* move wrongly placed packs from 'Plugins' to 'Language' */ mir_sntprintf(szFrom, sizeof(szFrom), _T("%s\\Plugins\\%s"), szDir, pszFilePattern); - hFind = FindFirstFile(szFrom, &wfd); + WIN32_FIND_DATA wfd; + HANDLE hFind = FindFirstFile(szFrom, &wfd); if (hFind != INVALID_HANDLE_VALUE) { do { if (wfd.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) diff --git a/plugins/ContextHelp/src/options.cpp b/plugins/ContextHelp/src/options.cpp index 175b2731f9..81d5fd6164 100644 --- a/plugins/ContextHelp/src/options.cpp +++ b/plugins/ContextHelp/src/options.cpp @@ -355,8 +355,6 @@ static void DeletePackFile(HWND hwndDlg, HWND hwndList, int iItem, HELPPACK_INFO static INT_PTR CALLBACK InsertPackItemEnumProc(HELPPACK_INFO *pack, WPARAM wParam, LPARAM lParam) { - UNREFERENCED_PARAMETER(lParam); - HELPPACK_INFO *pack2 = (HELPPACK_INFO*)mir_alloc(sizeof(HELPPACK_INFO)); if (pack2 == NULL) return FALSE; @@ -760,7 +758,7 @@ static int HelpOptInit(WPARAM wParam, LPARAM) #ifdef EDITOR odp.ptszTab = _T("Help editor"); /* autotranslated */ #else - odp.ptszTab = _T("Advanced"); /* autotranslated */ + odp.ptszTab = LPGENT("Advanced"); /* autotranslated */ #endif odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_ADV); odp.pfnDlgProc = AdvOptDlgProc; diff --git a/plugins/ContextHelp/src/streaminout.cpp b/plugins/ContextHelp/src/streaminout.cpp index 4d390c3d0a..6962dce293 100644 --- a/plugins/ContextHelp/src/streaminout.cpp +++ b/plugins/ContextHelp/src/streaminout.cpp @@ -273,8 +273,6 @@ void StreamInHtml(HWND hwndEdit, const char *szHtml, UINT codepage, COLORREF clr mir_free(szColour); #ifndef EDITOR if (colour != clrBkgrnd) { // ensure color is visible -#else - UNREFERENCED_PARAMETER(clrBkgrnd); #endif // !defined EDITOR for (i = 0; i < colourTblCount; i++) if (colourTbl[i] == colour) @@ -362,7 +360,7 @@ void StreamInHtml(HWND hwndEdit, const char *szHtml, UINT codepage, COLORREF clr AppendToCharBuffer(&header, "%s}", body.sz ? body.sz : ""); esd.pbBuff = (PBYTE)header.sz; esd.cbBuff = header.iEnd; - stream.dwCookie = (DWORD)&esd; + stream.dwCookie = (DWORD_PTR)&esd; stream.pfnCallback = (EDITSTREAMCALLBACK)EditStreamInRtf; SendMessage(hwndEdit, EM_STREAMIN, SF_RTF, (LPARAM)&stream); mir_free(header.sz); diff --git a/plugins/ContextHelp/src/utils.cpp b/plugins/ContextHelp/src/utils.cpp index 51d643c774..84e78fcc7d 100644 --- a/plugins/ContextHelp/src/utils.cpp +++ b/plugins/ContextHelp/src/utils.cpp @@ -341,7 +341,7 @@ struct CreateDialogIdBinaryData { HWND hwndParent; }; -static INT_PTR CALLBACK CreateDlgIdBinEnumProc(HWND hwnd, LPARAM lParam) +static BOOL CALLBACK CreateDlgIdBinEnumProc(HWND hwnd, LPARAM lParam) { struct CreateDialogIdBinaryData *cdib = (struct CreateDialogIdBinaryData*)lParam; int type; @@ -376,7 +376,7 @@ char *CreateDialogIdString(HWND hwndDlg) if (hwndDlg == NULL) return NULL; cdib.hwndParent = hwndDlg; - EnumChildWindows(hwndDlg, (WNDENUMPROC)CreateDlgIdBinEnumProc, (LPARAM)&cdib); + EnumChildWindows(hwndDlg, CreateDlgIdBinEnumProc, (LPARAM)&cdib); if (cdib.buf == NULL) return NULL; szRet = Base64Encode(cdib.buf, cdib.count); -- cgit v1.2.3