From 6895d635acb37ba42e53ba95ca3eee2ddbbef24d Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Fri, 28 Nov 2014 21:19:14 +0000 Subject: Massive code cleanup and fixes for a lot of warnings reported in #837 git-svn-id: http://svn.miranda-ng.org/main/trunk@11136 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/AVS/src/options.cpp | 2 +- .../AdvaImg/src/FreeImageToolkit/Background.cpp | 2 +- plugins/AvatarHistory/src/AvatarDlg.cpp | 2 +- plugins/BossKeyPlus/src/BossKeyIdle.cpp | 2 +- .../ChangeKeyboardLayout/src/text_operations.cpp | 6 +- plugins/DbEditorPP/src/exportimport.cpp | 9 +- plugins/DbEditorPP/src/settinglist.cpp | 4 +- plugins/HistoryStats/src/bandctrlimpl.cpp | 2 +- plugins/HistoryStats/src/dlgfilterwords.cpp | 2 +- plugins/HistoryStats/src/dlgoption_subcolumns.cpp | 4 +- plugins/HistoryStats/src/dlgoption_subglobal.cpp | 2 +- plugins/HistoryStats/src/dlgoption_subinput.cpp | 2 +- plugins/IEView/src/IEView.cpp | 2 +- plugins/KeyboardNotify/src/main.cpp | 23 +-- plugins/KeyboardNotify/src/options.cpp | 80 +++++----- plugins/LotusNotify/src/LotusNotify.cpp | 134 ++++++++-------- plugins/MenuItemEx/src/main.cpp | 2 +- plugins/Msg_Export/src/FileViewer.cpp | 2 +- plugins/NewAwaySysMod/src/MsgTree.cpp | 2 +- plugins/NewAwaySysMod/src/SetAwayMsg.cpp | 2 +- plugins/OpenFolder/src/openFolder.cpp | 48 +++--- plugins/PluginUpdater/src/DlgUpdate.cpp | 1 - plugins/Popup/src/skin.cpp | 1 - plugins/Scriver/src/input.cpp | 2 +- plugins/Scriver/src/msglog.cpp | 1 - plugins/SimpleStatusMsg/src/main.cpp | 38 ++--- plugins/SimpleStatusMsg/src/msgbox.cpp | 2 +- plugins/Spamotron/src/utils.cpp | 15 +- plugins/TabSRMM/src/buttonsbar.cpp | 7 +- plugins/TabSRMM/src/container.cpp | 12 +- plugins/TabSRMM/src/controls.cpp | 2 +- plugins/TabSRMM/src/hotkeyhandler.cpp | 2 +- plugins/TabSRMM/src/msgdialog.cpp | 2 +- plugins/TabSRMM/src/msglog.cpp | 7 +- plugins/TabSRMM/src/sendqueue.cpp | 4 +- plugins/TabSRMM/src/templates.cpp | 3 +- plugins/TabSRMM/src/themes.cpp | 19 +-- plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp | 1 - plugins/Watrack_MPD/src/main.cpp | 8 +- plugins/Weather/src/weather_ini.cpp | 2 +- plugins/WebView/src/webview_alerts.cpp | 10 +- plugins/WinterSpeak/src/DialogConfigEngine.cpp | 8 +- plugins/YARelay/src/main.cpp | 2 +- protocols/IcqOscarJ/src/icq_proto.cpp | 4 +- protocols/IcqOscarJ/src/icq_servlist.cpp | 1 - protocols/JabberG/src/jabber_iqid_muc.cpp | 171 +++++++++++---------- protocols/JabberG/src/jabber_opt.cpp | 3 +- protocols/Sametime/src/files.cpp | 6 +- protocols/Sametime/src/sametime.cpp | 6 +- protocols/SkypeClassic/src/gchat.cpp | 9 +- protocols/SkypeClassic/src/skype.cpp | 9 +- protocols/Steam/src/steam_pooling.cpp | 8 +- protocols/Steam/src/steam_proto.cpp | 2 +- protocols/Steam/src/steam_queue.cpp | 4 +- protocols/Tlen/src/tlen_opt.cpp | 78 ++++++---- protocols/Tlen/src/tlen_voice.cpp | 79 ++++------ protocols/VKontakte/src/vk_proto.cpp | 4 +- protocols/Yahoo/src/libyahoo2/libyahoo2.cpp | 2 +- protocols/Yahoo/src/options.cpp | 47 +++--- src/modules/chat/tools.cpp | 2 +- src/modules/fonts/FontOptions.cpp | 6 +- src/modules/metacontacts/meta_edit.cpp | 2 +- src/modules/protocols/protoopts.cpp | 3 +- 63 files changed, 463 insertions(+), 466 deletions(-) diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp index 7f52dc1a75..d6b94ba9a7 100644 --- a/plugins/AVS/src/options.cpp +++ b/plugins/AVS/src/options.cpp @@ -75,7 +75,7 @@ static void RemoveProtoPic(const char *szProto) if (p.szProtoname == NULL) continue; - PROTOACCOUNT* pdescr = (PROTOACCOUNT*)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)p.szProtoname); + PROTOACCOUNT *pdescr = ProtoGetAccount(p.szProtoname); if (pdescr == NULL && lstrcmpA(p.szProtoname, szProto)) continue; diff --git a/plugins/AdvaImg/src/FreeImageToolkit/Background.cpp b/plugins/AdvaImg/src/FreeImageToolkit/Background.cpp index db481e7728..fc18667b21 100644 --- a/plugins/AdvaImg/src/FreeImageToolkit/Background.cpp +++ b/plugins/AdvaImg/src/FreeImageToolkit/Background.cpp @@ -222,6 +222,7 @@ FillBackgroundBitmap(FIBITMAP *dib, const RGBQUAD *color, int options) { return FALSE; } + RGBQUAD blend; const RGBQUAD *color_intl = color; unsigned bpp = FreeImage_GetBPP(dib); unsigned width = FreeImage_GetWidth(dib); @@ -264,7 +265,6 @@ FillBackgroundBitmap(FIBITMAP *dib, const RGBQUAD *color, int options) { bgcolor.rgbRed = src_bits[FI_RGBA_RED]; bgcolor.rgbReserved = 0xFF; } - RGBQUAD blend; GetAlphaBlendedColor(&bgcolor, color_intl, &blend); color_intl = &blend; } diff --git a/plugins/AvatarHistory/src/AvatarDlg.cpp b/plugins/AvatarHistory/src/AvatarDlg.cpp index 64ff1338c0..2c4f63afd4 100644 --- a/plugins/AvatarHistory/src/AvatarDlg.cpp +++ b/plugins/AvatarHistory/src/AvatarDlg.cpp @@ -557,9 +557,9 @@ int ShowSaveDialog(HWND hwnd, TCHAR* fn, MCONTACT hContact) ofn.lpstrFile = file; TCHAR *displayName = (TCHAR*) CallService(MS_CLIST_GETCONTACTDISPLAYNAME,hContact,GCDNF_TCHAR); + TCHAR title[MAX_PATH]; if (displayName) { - TCHAR title[MAX_PATH]; mir_sntprintf(title,sizeof(title),TranslateT("Save Avatar for %s"),displayName); ofn.lpstrTitle = title; } diff --git a/plugins/BossKeyPlus/src/BossKeyIdle.cpp b/plugins/BossKeyPlus/src/BossKeyIdle.cpp index bec29756f4..57a1044734 100644 --- a/plugins/BossKeyPlus/src/BossKeyIdle.cpp +++ b/plugins/BossKeyPlus/src/BossKeyIdle.cpp @@ -34,7 +34,7 @@ static bool IsUserIdle() { DWORD dwTick; if ( g_wMaskAdv & OPT_HIDEIFMIRIDLE ) { - CallService(MS_SYSTEM_GETIDLE, 0, (DWORD)&dwTick); + CallService(MS_SYSTEM_GETIDLE, 0, (LPARAM)&dwTick); return GetTickCount() - dwTick > (minutes * 60 * 1000); } diff --git a/plugins/ChangeKeyboardLayout/src/text_operations.cpp b/plugins/ChangeKeyboardLayout/src/text_operations.cpp index 0de0987572..b535100331 100644 --- a/plugins/ChangeKeyboardLayout/src/text_operations.cpp +++ b/plugins/ChangeKeyboardLayout/src/text_operations.cpp @@ -286,7 +286,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) if (WindowType == WTYPE_RichEdit) { EditStreamData esdData; EDITSTREAM esStream = { 0 }; - esStream.dwCookie = (DWORD)&esdData; + esStream.dwCookie = (DWORD_PTR)&esdData; esStream.pfnCallback = EditStreamOutRtf; if (SendMessage(hTextWnd, EM_STREAMOUT, SF_TEXT | SF_UNICODE | SFF_SELECTION, (LPARAM)&esStream) > 0) ptszInText = GeTStringFromStreamData(&esdData); @@ -324,7 +324,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) EditStreamData esdData; EDITSTREAM esStream = { 0 }; - esStream.dwCookie = (DWORD)&esdData; + esStream.dwCookie = (DWORD_PTR)&esdData; esStream.pfnCallback = EditStreamOutRtf; if (SendMessage(hTextWnd, EM_STREAMOUT, SF_TEXT | SF_UNICODE | SFF_SELECTION, (LPARAM)&esStream) != 0) ptszInText = GeTStringFromStreamData(&esdData); @@ -363,7 +363,7 @@ int ChangeLayout(HWND hTextWnd, BYTE TextOperation, BOOL CurrentWord) EditStreamData esdData; EDITSTREAM esStream = { 0 }; - esStream.dwCookie = (DWORD)&esdData; + esStream.dwCookie = (DWORD_PTR)&esdData; esStream.pfnCallback = EditStreamOutRtf; if (SendMessage(hTextWnd, EM_STREAMOUT, SF_TEXT | SF_UNICODE | SFF_SELECTION, (LPARAM)&esStream) != 0) ptszInText = GeTStringFromStreamData(&esdData); diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index 7bd1643e0c..2d452fac31 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -241,7 +241,8 @@ void exportDB(MCONTACT hContact, char *module) } else { - if (module == "") module = NULL; // reset module for all contacts export + if (*module = '\0') + module = NULL; // reset module for all contacts export } hContact = db_find_first(); @@ -422,7 +423,7 @@ void importSettings(MCONTACT hContact, char *importstring ) else if (importstring[i] == '[' && !strchr(&importstring[i+1],'='))// get the module { if (end = strpbrk(&importstring[i+1], "]")) { - if ((end+1) != '\0') *end = '\0'; + if (*(end+1) != '\0') *end = '\0'; strcpy(module, &importstring[i+1]); } } @@ -430,7 +431,7 @@ void importSettings(MCONTACT hContact, char *importstring ) !strchr(&importstring[i+2],'='))// get the module { if (end = strpbrk(&importstring[i+2], "]")) { - if ((end+1) != '\0') *end = '\0'; + if (*(end+1) != '\0') *end = '\0'; strcpy(module, &importstring[i+2]); deleteModule(module, hContact, 1); } @@ -438,7 +439,7 @@ void importSettings(MCONTACT hContact, char *importstring ) else if (strstr(&importstring[i], "=") && module[0]) // get the setting { if (end = strpbrk(&importstring[i+1], "=")) { - if ((end+1) != '\0') *end = '\0'; + if (*(end+1) != '\0') *end = '\0'; strcpy(setting, &importstring[i]); // get the type diff --git a/plugins/DbEditorPP/src/settinglist.cpp b/plugins/DbEditorPP/src/settinglist.cpp index 1cb5f3975f..c9d655c698 100644 --- a/plugins/DbEditorPP/src/settinglist.cpp +++ b/plugins/DbEditorPP/src/settinglist.cpp @@ -659,8 +659,8 @@ INT_PTR CALLBACK SettingsCompare(LPARAM lParam1, LPARAM lParam2, LPARAM myParam) const int maxSize = 1024; TCHAR text1[maxSize]; TCHAR text2[maxSize]; - ListView_GetItemText(params.hList, (int)lParam1, params.column, text1, maxSize); - ListView_GetItemText(params.hList, (int)lParam2, params.column, text2, maxSize); + ListView_GetItemText(params.hList, lParam1, params.column, text1, maxSize); + ListView_GetItemText(params.hList, lParam2, params.column, text2, maxSize); int res = _tcsicmp(text1, text2); res = (params.column == lastColumn) ? -res : res; diff --git a/plugins/HistoryStats/src/bandctrlimpl.cpp b/plugins/HistoryStats/src/bandctrlimpl.cpp index b68dadee1d..feeabb2eb1 100644 --- a/plugins/HistoryStats/src/bandctrlimpl.cpp +++ b/plugins/HistoryStats/src/bandctrlimpl.cpp @@ -124,7 +124,7 @@ LRESULT CALLBACK BandCtrlImpl::staticWndProc(HWND hWnd, UINT msg, WPARAM wParam, case BCM_SETBUTTONDATA: assert(wParam >= 1 && wParam <= pCtrl->m_Items.size()); - pCtrl->m_Items[wParam - 1].dwData = static_cast(lParam); + pCtrl->m_Items[wParam - 1].dwData = static_cast(lParam); return 0; case BCM_ISBUTTONVISIBLE: diff --git a/plugins/HistoryStats/src/dlgfilterwords.cpp b/plugins/HistoryStats/src/dlgfilterwords.cpp index cb5a0ff30d..be60d0bbf2 100644 --- a/plugins/HistoryStats/src/dlgfilterwords.cpp +++ b/plugins/HistoryStats/src/dlgfilterwords.cpp @@ -102,7 +102,7 @@ void DlgFilterWords::onWMInitDialog() { const Filter* pFilter = *i; - HANDLE hCheck = m_Sets.insertCheck(NULL, pFilter->getName().c_str(), 0, reinterpret_cast(pFilter)); + HANDLE hCheck = m_Sets.insertCheck(NULL, pFilter->getName().c_str(), 0, reinterpret_cast(pFilter)); if (m_bColProvided && m_ColFilters.find(pFilter->getID()) != m_ColFilters.end()) m_Sets.checkItem(hCheck, true); diff --git a/plugins/HistoryStats/src/dlgoption_subcolumns.cpp b/plugins/HistoryStats/src/dlgoption_subcolumns.cpp index 24cff27083..a11e1e0f52 100644 --- a/plugins/HistoryStats/src/dlgoption_subcolumns.cpp +++ b/plugins/HistoryStats/src/dlgoption_subcolumns.cpp @@ -238,7 +238,7 @@ void DlgOption::SubColumns::loadSettings() { Column* pCol = localS.getCol(j); ext::string colTitle = pCol->getTitleForOptions(); - OptionsCtrl::Check hColCheck = m_Columns.insertCheck(NULL, colTitle.c_str(), 0, reinterpret_cast(pCol)); + OptionsCtrl::Check hColCheck = m_Columns.insertCheck(NULL, colTitle.c_str(), 0, reinterpret_cast(pCol)); m_Columns.checkItem(hColCheck, pCol->isEnabled()); @@ -332,7 +332,7 @@ void DlgOption::SubColumns::addCol(int nCol) getParent()->getLocalSettings().addCol(pCol); - OptionsCtrl::Check hColCheck = m_Columns.insertCheck(NULL, pCol->getTitle(), 0, reinterpret_cast(pCol)); + OptionsCtrl::Check hColCheck = m_Columns.insertCheck(NULL, pCol->getTitle(), 0, reinterpret_cast(pCol)); m_Columns.checkItem(hColCheck, pCol->isEnabled()); diff --git a/plugins/HistoryStats/src/dlgoption_subglobal.cpp b/plugins/HistoryStats/src/dlgoption_subglobal.cpp index b89a9e1e0f..6ea0d7944c 100644 --- a/plugins/HistoryStats/src/dlgoption_subglobal.cpp +++ b/plugins/HistoryStats/src/dlgoption_subglobal.cpp @@ -249,7 +249,7 @@ void DlgOption::SubGlobal::onWMInitDialog() m_hProtocols, Protocol::getDisplayName(protoList[i]->szModuleName).c_str(), 0, - reinterpret_cast(protoList[i]->szModuleName))); + reinterpret_cast(protoList[i]->szModuleName))); } } diff --git a/plugins/HistoryStats/src/dlgoption_subinput.cpp b/plugins/HistoryStats/src/dlgoption_subinput.cpp index 7d61c56b63..d499f8d6de 100644 --- a/plugins/HistoryStats/src/dlgoption_subinput.cpp +++ b/plugins/HistoryStats/src/dlgoption_subinput.cpp @@ -111,7 +111,7 @@ void DlgOption::SubInput::onWMInitDialog() m_hProtocols, Protocol::getDisplayName(protoList[i]->szModuleName).c_str(), 0, - reinterpret_cast(protoList[i]->szModuleName))); + reinterpret_cast(protoList[i]->szModuleName))); } } diff --git a/plugins/IEView/src/IEView.cpp b/plugins/IEView/src/IEView.cpp index 07f071e3eb..a2a7a13721 100644 --- a/plugins/IEView/src/IEView.cpp +++ b/plugins/IEView/src/IEView.cpp @@ -1103,7 +1103,7 @@ BSTR IEView::getHrefFromAnchor(IHTMLElement *element) if (SUCCEEDED(element->QueryInterface(IID_IHTMLAnchorElement, (void**)&pAnchor)) && (pAnchor!=NULL)) { VARIANT variant; BSTR url; - if (SUCCEEDED(element->getAttribute(L"href", 2, &variant) && variant.vt == VT_BSTR)) { + if (SUCCEEDED(element->getAttribute(L"href", 2, &variant)) && (variant.vt == VT_BSTR)) { url = mir_tstrdup(variant.bstrVal); SysFreeString(variant.bstrVal); } diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp index 29d448d822..73ea6cf54b 100644 --- a/plugins/KeyboardNotify/src/main.cpp +++ b/plugins/KeyboardNotify/src/main.cpp @@ -452,13 +452,13 @@ static VOID CALLBACK ReminderTimer(HWND hwnd, UINT message, UINT_PTR idEvent, DW // Support for third-party plugins and mBot's scripts -static INT_PTR EnableService(WPARAM wParam, LPARAM lParam) +static INT_PTR EnableService(WPARAM, LPARAM) { bFlashingEnabled = TRUE; return 0; } -static INT_PTR DisableService(WPARAM wParam, LPARAM lParam) +static INT_PTR DisableService(WPARAM, LPARAM) { bFlashingEnabled = FALSE; return 0; @@ -487,12 +487,12 @@ static INT_PTR EventsWereOpenedService(WPARAM wParam, LPARAM lParam) } -static INT_PTR IsFlashingActiveService(WPARAM wParam, LPARAM lParam) +static INT_PTR IsFlashingActiveService(WPARAM, LPARAM) { if (!bReminderDisabled) return 0; - return (int)getCurrentSequenceString(); + return (INT_PTR)getCurrentSequenceString(); } @@ -508,10 +508,11 @@ INT_PTR NormalizeSequenceService(WPARAM wParam, LPARAM lParam) // Support for Trigger plugin -static void ForceEventsWereOpenedThread(void *eventMaxSeconds) +static DWORD WINAPI ForceEventsWereOpenedThread(void *eventMaxSeconds) { Sleep(((WORD)eventMaxSeconds) * 1000); CallService(MS_KBDNOTIFY_EVENTSOPENED, 1, 0); + return 0; } @@ -520,7 +521,7 @@ void StartBlinkAction(char *flashSequence, WORD eventMaxSeconds) DWORD threadID = 0; if (eventMaxSeconds) - CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ForceEventsWereOpenedThread, (void *)eventMaxSeconds, 0, &threadID); + CreateThread(NULL, 0, ForceEventsWereOpenedThread, (void *)eventMaxSeconds, 0, &threadID); CallService(MS_KBDNOTIFY_STARTBLINK, 1, (LPARAM)flashSequence); } @@ -540,7 +541,7 @@ void createProcessList(void) if (db_get_ts(NULL, KEYBDMODULE, fmtDBSettingName("process%d", i), &dbv)) ProcessList.szFileName[i] = NULL; else { - ProcessList.szFileName[i] = (TCHAR *)malloc(wcslen(dbv.ptszVal) + 1); + ProcessList.szFileName[i] = (TCHAR *)malloc((wcslen(dbv.ptszVal) + 1)*sizeof(TCHAR)); if (ProcessList.szFileName[i]) wcscpy(ProcessList.szFileName[i], dbv.ptszVal); db_free(&dbv); @@ -586,9 +587,9 @@ void LoadSettings(void) bMirandaOrWindows = db_get_b(NULL, KEYBDMODULE, "mirorwin", DEF_SETTING_MIRORWIN); wStatusMap = db_get_w(NULL, KEYBDMODULE, "status", DEF_SETTING_STATUS); wReminderCheck = db_get_w(NULL, KEYBDMODULE, "remcheck", DEF_SETTING_CHECKTIME); - bFlashLed[0] = !!db_get_b(NULL, KEYBDMODULE, "fnum", DEF_SETTING_FLASHNUM); - bFlashLed[1] = !!db_get_b(NULL, KEYBDMODULE, "fcaps", DEF_SETTING_FLASHCAPS); - bFlashLed[2] = !!db_get_b(NULL, KEYBDMODULE, "fscroll", DEF_SETTING_FLASHSCROLL); + bFlashLed[0] = db_get_b(NULL, KEYBDMODULE, "fnum", DEF_SETTING_FLASHNUM); + bFlashLed[1] = db_get_b(NULL, KEYBDMODULE, "fcaps", DEF_SETTING_FLASHCAPS); + bFlashLed[2] = db_get_b(NULL, KEYBDMODULE, "fscroll", DEF_SETTING_FLASHSCROLL); bFlashEffect = db_get_b(NULL, KEYBDMODULE, "feffect", DEF_SETTING_FLASHEFFECT); bSequenceOrder = db_get_b(NULL, KEYBDMODULE, "order", DEF_SETTING_SEQORDER); wCustomTheme = db_get_w(NULL, KEYBDMODULE, "custom", DEF_SETTING_CUSTOMTHEME); @@ -729,7 +730,7 @@ static int OnMetaChanged(WPARAM wParam, LPARAM) return 0; } -static int ModulesLoaded(WPARAM wParam, LPARAM lParam) +static int ModulesLoaded(WPARAM, LPARAM) { TCHAR eventPrefix[MAX_PATH+1], eventName[MAX_PATH+1]; diff --git a/plugins/KeyboardNotify/src/options.cpp b/plugins/KeyboardNotify/src/options.cpp index 99c459e453..63df423bd6 100644 --- a/plugins/KeyboardNotify/src/options.cpp +++ b/plugins/KeyboardNotify/src/options.cpp @@ -87,7 +87,7 @@ BYTE trillianLedsMsg, trillianLedsURL, trillianLedsFile, trillianLedsOther; // ** // ** Initialize the Miranda options page // ** -int InitializeOptions(WPARAM wParam,LPARAM lParam) +int InitializeOptions(WPARAM wParam,LPARAM) { OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.hInstance = hInst; @@ -654,17 +654,14 @@ INT_PTR CALLBACK DlgProcEffectOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPA if(IsDlgButtonChecked(hwndDlg, IDC_INTURN) == BST_CHECKED) db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_INTURN); + else if (IsDlgButtonChecked(hwndDlg, IDC_INSEQUENCE) == BST_CHECKED) + db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_INSEQUENCE); + else if (IsDlgButtonChecked(hwndDlg, IDC_CUSTOM) == BST_CHECKED) + db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_CUSTOM); + else if (IsDlgButtonChecked(hwndDlg, IDC_TRILLIAN) == BST_CHECKED) + db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_TRILLIAN); else - if (IsDlgButtonChecked(hwndDlg, IDC_INSEQUENCE) == BST_CHECKED) - db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_INSEQUENCE); - else - if (IsDlgButtonChecked(hwndDlg, IDC_CUSTOM) == BST_CHECKED) - db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_CUSTOM); - else - if (IsDlgButtonChecked(hwndDlg, IDC_TRILLIAN) == BST_CHECKED) - db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_TRILLIAN); - else - db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_SAMETIME); + db_set_b(NULL, KEYBDMODULE, "feffect", FLASH_SAMETIME); db_set_b(NULL, KEYBDMODULE, "order", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SEQORDER, CB_GETCURSEL, 0, 0), 0)); db_set_w(NULL, KEYBDMODULE, "custom", (WORD)SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_GETITEMDATA, (WPARAM)SendDlgItemMessage(hwndDlg, IDC_SCUSTOM, CB_GETCURSEL, 0, 0), 0)); @@ -715,7 +712,7 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR int index = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_INSERTSTRING, (WPARAM)-1, (LPARAM)dbv.ptszVal); db_free(&dbv); if (index != CB_ERR && index != CB_ERRSPACE) { - str = (TCHAR *)malloc(MAX_PATH+1); + str = (TCHAR *)malloc((MAX_PATH+1)*sizeof(TCHAR)); if (str) if (db_get_ts(NULL, KEYBDMODULE, fmtDBSettingName("custom%d", i), &dbv)) str[0] = _T('\0'); @@ -782,11 +779,11 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR return TRUE; case IDC_CUSTOMSTRING: if(HIWORD(wParam) == EN_CHANGE) { - int item; TCHAR theme[MAX_PATH+1], customAux[MAX_PATH+1]; GetDlgItemText(hwndDlg, IDC_THEME, theme, SIZEOF(theme)); - if ((item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme)) == CB_ERR) + int item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme); + if (item == CB_ERR) return TRUE; str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0); if (str) { @@ -809,14 +806,13 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR return TRUE; case IDC_ADD: { - int item; TCHAR theme[MAX_PATH+1]; GetDlgItemText(hwndDlg, IDC_THEME, theme, SIZEOF(theme)); if (!theme[0]) return TRUE; - item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_ADDSTRING, 0, (LPARAM)theme); - str = (TCHAR *)malloc(MAX_PATH+1); + int item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_ADDSTRING, 0, (LPARAM)theme); + str = (TCHAR *)malloc((MAX_PATH+1)*sizeof(TCHAR)); if (str) { GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str, MAX_PATH); SetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, normalizeCustomString(str)); @@ -830,11 +826,10 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR return TRUE; case IDC_UPDATE: { - int item; TCHAR theme[MAX_PATH+1]; GetDlgItemText(hwndDlg, IDC_THEME, theme, SIZEOF(theme)); - item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme); + int item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme); str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0); if (str) { GetDlgItemText(hwndDlg, IDC_CUSTOMSTRING, str, MAX_PATH); @@ -846,11 +841,10 @@ INT_PTR CALLBACK DlgProcThemeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR return TRUE; case IDC_DELETE: { - int item; TCHAR theme[MAX_PATH+1]; GetDlgItemText(hwndDlg, IDC_THEME, theme, SIZEOF(theme)); - item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme); + int item = SendDlgItemMessage(hwndDlg, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme); str = (TCHAR *)SendDlgItemMessage(hwndDlg, IDC_THEME, CB_GETITEMDATA, (WPARAM)item, 0); if (str) free(str); @@ -1033,14 +1027,14 @@ void exportThemes(const TCHAR *filename) void importThemes(const TCHAR *filename, BOOL overrideExisting) { - int status=0; - size_t i; FILE *fImport = _tfopen(filename, _T("rt")); - TCHAR buffer[MAX_PATH+1], theme[MAX_PATH+1], *str; - if (!fImport) return; + int status=0; + size_t i; + TCHAR buffer[MAX_PATH+1], theme[MAX_PATH+1], *str; + while (_fgetts(buffer, MAX_PATH, fImport) != NULL) { for (str=buffer; *str && isspace(*str); str++); //ltrim if (!*str || *str == ';') //empty line or comment @@ -1067,13 +1061,12 @@ void importThemes(const TCHAR *filename, BOOL overrideExisting) void writeThemeToCombo(const TCHAR *theme, const TCHAR *custom, BOOL overrideExisting) { - int item; TCHAR *str; - item = SendDlgItemMessage(hwndTheme, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme); + int item = SendDlgItemMessage(hwndTheme, IDC_THEME, CB_FINDSTRINGEXACT, -1, (LPARAM)theme); if (item == CB_ERR) { item = SendDlgItemMessage(hwndTheme, IDC_THEME, CB_ADDSTRING, 0, (LPARAM)theme); - str = (TCHAR *)malloc(MAX_PATH+1); + str = (TCHAR *)malloc((MAX_PATH+1)*sizeof(TCHAR)); if (str) _tcscpy(str, custom); SendDlgItemMessage(hwndTheme, IDC_THEME, CB_SETITEMDATA, (WPARAM)item, (LPARAM)str); @@ -1174,7 +1167,7 @@ INT_PTR CALLBACK DlgProcProcesses(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM TCHAR szFileNameAux[MAX_PATH+1]; SendDlgItemMessage(hwndDlg, IDC_PROGRAMS, CB_GETLBTEXT, (WPARAM)i, (LPARAM)szFileNameAux); - ProcessListAux.szFileName[i] = (TCHAR *)malloc(_tcslen(szFileNameAux) + 1); + ProcessListAux.szFileName[i] = (TCHAR *)malloc((_tcslen(szFileNameAux) + 1)*sizeof(TCHAR)); if (ProcessListAux.szFileName[i]) _tcscpy(ProcessListAux.szFileName[i], szFileNameAux); } @@ -1193,7 +1186,7 @@ INT_PTR CALLBACK DlgProcProcesses(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM void createProcessListAux(void) { ProcessListAux.count = ProcessList.count; - ProcessListAux.szFileName = (TCHAR **)malloc(ProcessListAux.count * sizeof(char *)); + ProcessListAux.szFileName = (TCHAR **)malloc(ProcessListAux.count * sizeof(TCHAR *)); if (!ProcessListAux.szFileName) ProcessListAux.count = 0; else @@ -1201,7 +1194,7 @@ void createProcessListAux(void) if (!ProcessList.szFileName[i]) ProcessListAux.szFileName[i] = NULL; else { - ProcessListAux.szFileName[i] = (TCHAR *)malloc(_tcslen(ProcessList.szFileName[i]) + 1); + ProcessListAux.szFileName[i] = (TCHAR *)malloc((_tcslen(ProcessList.szFileName[i]) + 1)*sizeof(TCHAR)); if (ProcessListAux.szFileName[i]) _tcscpy(ProcessListAux.szFileName[i], ProcessList.szFileName[i]); } @@ -1337,9 +1330,6 @@ INT_PTR CALLBACK DlgProcXstatusList(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA { WPARAM j; - int imageCount; - HICON hIconAux; - HIMAGELIST hImageList; TVINSERTSTRUCT tvis={0}; TVITEM tvi={0}; HTREEITEM hSectionItem, hItem; @@ -1351,16 +1341,19 @@ INT_PTR CALLBACK DlgProcXstatusList(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA if (!XstatusListAux) return TRUE; // Calculate hImageList size - imageCount=1; + int imageCount=1; for (int i = 0; i < ProtoList.protoCount; i++) if (ProtoList.protoInfo[i].enabled && XstatusListAux[i].count) imageCount += XstatusListAux[i].count; - hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, imageCount, imageCount); + HIMAGELIST hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, imageCount, imageCount); TreeView_SetImageList(hwndTree, hImageList, TVSIL_NORMAL); - ImageList_AddIcon(hImageList, hIconAux=(HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 0, 0, 0)); - if (hIconAux) DestroyIcon(hIconAux); + HICON hIconAux=(HICON)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_BLANK), IMAGE_ICON, 0, 0, 0); + if (hIconAux) { + ImageList_AddIcon(hImageList, hIconAux); + DestroyIcon(hIconAux); + } TreeView_SelectItem(hwndTree, NULL); ShowWindow(hwndTree, SW_HIDE); @@ -1368,9 +1361,8 @@ INT_PTR CALLBACK DlgProcXstatusList(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA for (int i = 0; i < ProtoList.protoCount; i++) if (ProtoList.protoInfo[i].enabled && XstatusListAux[i].count) { - HTREEITEM hParent; - - int count; PROTOACCOUNT** protos; + int count; + PROTOACCOUNT **protos; ProtoEnumAccounts( &count, &protos ); tvis.hParent = NULL; @@ -1382,7 +1374,7 @@ INT_PTR CALLBACK DlgProcXstatusList(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA tvis.item.state = TVIS_BOLD|TVIS_EXPANDED; tvis.item.iImage = tvis.item.iSelectedImage = ImageList_AddIcon(hImageList, hIconAux=(HICON)CallProtoService(ProtoList.protoInfo[i].szProto, PS_LOADICON, PLI_PROTOCOL, 0)); if (hIconAux) DestroyIcon(hIconAux); - hParent = TreeView_InsertItem(hwndTree, &tvis); + HTREEITEM hParent = TreeView_InsertItem(hwndTree, &tvis); for (j = 0; j < XstatusListAux[i].count; j++) { tvis.hParent = hParent; tvis.item.mask = TVIF_TEXT|TVIF_PARAM|TVIF_IMAGE|TVIF_SELECTEDIMAGE; @@ -1426,10 +1418,8 @@ INT_PTR CALLBACK DlgProcXstatusList(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA case WM_DESTROY: { - HIMAGELIST hImageList; - // Destroy tree view imagelist since it does not get destroyed automatically (see msdn docs) - hImageList = TreeView_GetImageList(GetDlgItem(hwndDlg, IDC_TREE_XSTATUS), TVSIL_STATE); + HIMAGELIST hImageList = TreeView_GetImageList(GetDlgItem(hwndDlg, IDC_TREE_XSTATUS), TVSIL_STATE); if (hImageList) { TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_TREE_XSTATUS), NULL, TVSIL_STATE); ImageList_Destroy(hImageList); diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index fd18559cf1..4898650d87 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -31,7 +31,7 @@ boolean volatile Plugin_Terminated = false; CRITICAL_SECTION checkthreadCS; HANDLE hMenuService = NULL; -HANDLE hMenuHandle = NULL; +HGENMENU hMenuHandle = NULL; HANDLE hCheckEvent = NULL; HANDLE hCheckHook = NULL; HANDLE hHookModulesLoaded = NULL; @@ -127,8 +127,7 @@ STATUS LNPUBLIC __stdcall EMCallBack (EMRECORD * pData) //It don't work (don't know why), and Mirandas Load function is called with value 1 or 0 as parameter... __declspec(dllexport)STATUS LNPUBLIC MainEntryPoint (void) { - STATUS rc; - rc = EMRegister1 (EM_GETPASSWORD, EM_REG_BEFORE | EM_REG_AFTER, EMCallBack, 0, &hLotusRegister); //Extension Manager must know that we are here + STATUS rc = EMRegister1 (EM_GETPASSWORD, EM_REG_BEFORE | EM_REG_AFTER, EMCallBack, 0, &hLotusRegister); //Extension Manager must know that we are here if(rc) { //Extension magager don't know who we are :( startuperror+=8; @@ -227,12 +226,12 @@ void init_pluginname() { char text[MAX_PATH], *p, *q; WIN32_FIND_DATAA ffd; - HANDLE hFind; // Try to find name of the file having original letter sizes GetModuleFileNameA(hInst, text, sizeof(text)); - if((hFind = FindFirstFileA(text, &ffd)) != INVALID_HANDLE_VALUE) { + HANDLE hFind = FindFirstFileA(text, &ffd); + if(hFind != INVALID_HANDLE_VALUE) { strncpy_s(text, SIZEOF(text), ffd.cFileName, strlen(ffd.cFileName)); FindClose(hFind); } @@ -319,8 +318,7 @@ BOOL checkFilters(TCHAR* str, int field) //subfunction called from popup plugin callback function void Click(HWND hWnd,BOOL execute) { - POPUPATT *pid=NULL; - pid = (POPUPATT*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd,(LPARAM)pid); + POPUPATT *pid = (POPUPATT*)PUGetPluginData(hWnd); if(settingOnceOnly&&settingNonClickedOnly) (getEl(pid->id))->clicked=TRUE;//add to msgs list @@ -370,8 +368,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA case UM_INITPOPUP: { - POPUPATT *pid=NULL; - pid = (POPUPATT*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd,(LPARAM)pid); + POPUPATT *pid = (POPUPATT*)PUGetPluginData(hWnd); addPopup(pid->id,hWnd); //PUDeletePopUp(hWnd); break; @@ -379,8 +376,7 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA case UM_FREEPLUGINDATA: { - POPUPATT * mpd = NULL; - mpd = (POPUPATT*)CallService(MS_POPUP_GETPLUGINDATA, (WPARAM)hWnd,(LPARAM)mpd); + POPUPATT *mpd = (POPUPATT*)PUGetPluginData(hWnd); if (mpd > 0) free(mpd); return TRUE; //TRUE or FALSE is the same, it gets ignored. } @@ -537,7 +533,7 @@ void ErMsgByLotusCode(STATUS erno) //set menu avainability -static void LNEnableMenuItem(HANDLE hMenuItem, BOOL bEnable) +static void LNEnableMenuItem(HGENMENU hMenuItem, BOOL bEnable) { log_p(L"LNEnableMenuItem: bEnable=%d", bEnable); CLISTMENUITEM clmi = {0}; @@ -546,7 +542,7 @@ static void LNEnableMenuItem(HANDLE hMenuItem, BOOL bEnable) if ( !bEnable ) clmi.flags |= CMIF_GRAYED; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)&clmi); + Menu_ModifyItem(hMenuItem, &clmi); } @@ -755,10 +751,9 @@ void checkthread(void*) field_copy_UNICODE[field_len] = '\0'; - WCHAR msgFrom[512]; - WCHAR msgSubject[512]; - ZeroMemory(msgFrom,512); - ZeroMemory(msgSubject,512); + WCHAR msgFrom[512], msgSubject[512]; + ZeroMemory(msgFrom,sizeof(msgFrom)); + ZeroMemory(msgSubject,sizeof(msgSubject)); if(wcslen(field_from_UNICODE) < 512 && wcslen(field_from_UNICODE) > 3 && wcsstr(field_from_UNICODE, L"CN=") == field_from_UNICODE) _tcsncpy_s(msgFrom, &(field_from_UNICODE[3]), wcscspn(field_from_UNICODE, L"/")-3 ); @@ -857,7 +852,7 @@ errorblock: //hooked notification from service that listning to check lotus -static int eventCheck(WPARAM wParam,LPARAM lParam) +static int eventCheck(WPARAM,LPARAM) { log(L"check event..."); check(); @@ -874,7 +869,7 @@ INT_PTR PluginMenuCommand(WPARAM wParam, LPARAM lParam) //window timer callback function, called on timer event -VOID CALLBACK atTime(HWND hWnd, UINT uMsg, UINT idEvent, DWORD dwTime) +void CALLBACK atTime(HWND hWnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime) { log(L"atTime: start"); BOOL b = KillTimer(hTimerWnd, idEvent); @@ -883,7 +878,7 @@ VOID CALLBACK atTime(HWND hWnd, UINT uMsg, UINT idEvent, DWORD dwTime) check(); if(settingInterval != 0){ log_p(L"atTime: SetTimer settingInterval=%d", settingInterval * 60000); - SetTimer(hTimerWnd, TID, settingInterval * 60000, (TIMERPROC)atTime); + SetTimer(hTimerWnd, TID, settingInterval * 60000, atTime); } } } @@ -965,44 +960,49 @@ void lookupLotusDefaultSettings(HWND hwndDlg) //get variables values stored in db. void LoadSettings() { - DBVARIANT dbv; - char buff[128]; - int i=0; - settingInterval = (INT)db_get_dw(NULL, PLUGINNAME, "LNInterval", 15); settingInterval1 = (INT)db_get_dw(NULL, PLUGINNAME, "LNInterval1", 0); //if(!db_get(NULL, PLUGINNAME, "LNInterval1",&dbv)) // settingInterval1 = int(dbv.lVal); //db_free(&dbv); //settingInterval=dbv.lVal; - if(!db_get_s(NULL, PLUGINNAME, "LNDatabase", &dbv)) + if(!db_get_s(NULL, PLUGINNAME, "LNDatabase", &dbv)){ strncpy_s(settingDatabase, _countof(settingDatabase), dbv.pszVal, SIZEOF(settingDatabase)); - db_free(&dbv); - if(!db_get_s(NULL, PLUGINNAME, "LNServer", &dbv)) + db_free(&dbv); + } + if(!db_get_s(NULL, PLUGINNAME, "LNServer", &dbv)) { strncpy_s(settingServer, _countof(settingServer), dbv.pszVal, SIZEOF(settingServer)); - db_free(&dbv); - if(!db_get_s(NULL, PLUGINNAME, "LNServerSec", &dbv)) + db_free(&dbv); + } + if(!db_get_s(NULL, PLUGINNAME, "LNServerSec", &dbv)) { strncpy_s(settingServerSec, _countof(settingServerSec), dbv.pszVal, SIZEOF(settingServerSec)); - db_free(&dbv); - if(!db_get(NULL, PLUGINNAME, "LNPassword", &dbv)) + db_free(&dbv); + } + if(!db_get(NULL, PLUGINNAME, "LNPassword", &dbv)) { strncpy_s(settingPassword, _countof(settingPassword), dbv.pszVal, SIZEOF(settingPassword)); - db_free(&dbv); - if(!db_get_s(NULL, PLUGINNAME, "LNCommand", &dbv, DBVT_ASCIIZ)) + db_free(&dbv); + } + if(!db_get_s(NULL, PLUGINNAME, "LNCommand", &dbv, DBVT_ASCIIZ)) { strncpy_s(settingCommand, _countof(settingCommand), dbv.pszVal, SIZEOF(settingCommand)); - db_free(&dbv); - if(!db_get_s(NULL, PLUGINNAME, "LNParameters", &dbv, DBVT_ASCIIZ)) + db_free(&dbv); + } + if(!db_get_s(NULL, PLUGINNAME, "LNParameters", &dbv, DBVT_ASCIIZ)) { strncpy_s(settingParameters, _countof(settingParameters), dbv.pszVal, SIZEOF(settingParameters)); - db_free(&dbv); + db_free(&dbv); + } - if(!db_get_ts(NULL, PLUGINNAME, "LNFilterSender",&dbv)) + if(!db_get_ts(NULL, PLUGINNAME, "LNFilterSender",&dbv)) { _tcsncpy_s(settingFilterSender, dbv.ptszVal, _TRUNCATE); - db_free(&dbv); - if(!db_get_ts(NULL, PLUGINNAME, "LNFilterSubject",&dbv)) + db_free(&dbv); + } + if(!db_get_ts(NULL, PLUGINNAME, "LNFilterSubject",&dbv)) { _tcsncpy_s(settingFilterSubject, dbv.ptszVal, _TRUNCATE); - db_free(&dbv); - if(!db_get_ts(NULL, PLUGINNAME, "LNFilterTo",&dbv)) + db_free(&dbv); + } + if(!db_get_ts(NULL, PLUGINNAME, "LNFilterTo",&dbv)) { _tcsncpy_s(settingFilterTo, dbv.ptszVal, _TRUNCATE); - db_free(&dbv); + db_free(&dbv); + } settingOnceOnly = db_get_b (NULL, PLUGINNAME, "LNOnceOnly",0); @@ -1015,8 +1015,10 @@ void LoadSettings() settingNewestID = (DWORD)db_get_dw(NULL, PLUGINNAME, "LNNewestID", 0); settingIniAnswer = db_get_b(NULL, PLUGINNAME, "LNIniAnswer", 0); settingIniCheck = db_get_b(NULL, PLUGINNAME, "LNIniCheck", 0); - - for(i = 0; i < STATUS_COUNT; i++) { + + DBVARIANT dbv; + for(int i = 0; i < STATUS_COUNT; i++) { + char buff[128]; mir_snprintf(buff, SIZEOF(buff), "LNStatus%d", i); settingStatus[i] = (db_get_b(0, PLUGINNAME, buff, 0) == 1); } @@ -1142,7 +1144,7 @@ INT_PTR CALLBACK DlgProcLotusNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L int i; char text[MAXENVVALUE]; i=SendDlgItemMessage(hwndDlg,IDC_SERVER,CB_GETCURSEL,0,0); - SendDlgItemMessageA(hwndDlg,IDC_SERVER,CB_GETLBTEXT,(WPARAM)i,(LONG)/* (LPSTR) */text); + SendDlgItemMessageA(hwndDlg,IDC_SERVER,CB_GETLBTEXT,(WPARAM)i,(LPARAM)text); SetDlgItemTextA(hwndDlg,IDC_SERVER,text); break; } @@ -1154,7 +1156,7 @@ INT_PTR CALLBACK DlgProcLotusNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L SendDlgItemMessage(hwndDlg, IDC_SERVER, CB_RESETCONTENT ,0, 0); fillServersList(hwndDlg); SendDlgItemMessageA(hwndDlg, IDC_SERVER, CB_ADDSTRING, 0, (LPARAM)settingServer); - SendDlgItemMessageA(hwndDlg, IDC_SERVER, CB_SELECTSTRING , -1, (LPARAM)(LPCSTR)settingServer); + SendDlgItemMessageA(hwndDlg, IDC_SERVER, CB_SELECTSTRING , -1, (LPARAM)settingServer); break; } } @@ -1263,7 +1265,6 @@ INT_PTR CALLBACK DlgProcLotusNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L { char buff[128]; - int i=0; GetDlgItemTextA(hwndDlg, IDC_SERVER, settingServer, sizeof(settingServer)); db_set_s(NULL, PLUGINNAME, "LNServer", settingServer ); db_set_s(NULL, PLUGINNAME, "LNServerSec", settingServerSec); @@ -1283,34 +1284,34 @@ INT_PTR CALLBACK DlgProcLotusNotifyOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L db_set_b(NULL, PLUGINNAME, "LNIniCheck", settingIniCheck); db_set_b(NULL, PLUGINNAME, "LNIniAnswer", settingIniAnswer); - for(i = 0; i < STATUS_COUNT ; i++){ + for(int i = 0; i < STATUS_COUNT ; i++){ mir_snprintf(buff, SIZEOF(buff), "LNStatus%d", i); settingStatus[i] = (ListView_GetCheckState(GetDlgItem(hwndDlg, IDC_STATUS), i) ? TRUE : FALSE); db_set_b(0, PLUGINNAME, buff, settingStatus[i] ? 1 : 0); } settingFilterSender[0] = 0; - for(i=0; ihItemToOrder(TreeView_GetNextItem(hTreeView, TreeItem ? TreeItem->hItem : NULL, TVFlag)); - if (Order =- -1) + if (Order == -1) return NULL; return (Order <= TREECTRL_ROOTORDEROFFS) ? (CBaseTreeItem*)&TreeCtrl->RootItems[ROOT_ORDER_TO_INDEX(Order)] : (CBaseTreeItem*)&TreeCtrl->Value[Order]; diff --git a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp index 8fbd79cd69..12cd708ddc 100644 --- a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp @@ -613,7 +613,7 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA ti.cbSize = sizeof(ti); ti.uFlags = TTF_IDISHWND | TTF_SUBCLASS; for (int i = 0; i < SIZEOF(Tooltips); i++) { - ti.uId = (UINT)GetDlgItem(hwndDlg, Tooltips[i].DlgItemID); + ti.uId = (UINT_PTR)GetDlgItem(hwndDlg, Tooltips[i].DlgItemID); ti.lpszText = TranslateTS(Tooltips[i].Text); SendMessage(hWndTooltips, TTM_ADDTOOL, 0, (LPARAM)&ti); } diff --git a/plugins/OpenFolder/src/openFolder.cpp b/plugins/OpenFolder/src/openFolder.cpp index 631102fd26..e8860cecd7 100644 --- a/plugins/OpenFolder/src/openFolder.cpp +++ b/plugins/OpenFolder/src/openFolder.cpp @@ -27,13 +27,13 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) return TRUE; } -static INT_PTR MenuCommand_OpenFolder(WPARAM wParam, LPARAM lParam) +static INT_PTR MenuCommand_OpenFolder(WPARAM, LPARAM) { TCHAR szMirandaPath[MAX_PATH]; GetModuleFileName( GetModuleHandle(NULL), szMirandaPath, SIZEOF(szMirandaPath)); TCHAR* p = _tcsrchr( szMirandaPath, '\\' ); - if ( p && p + 1 ) - *( p + 1 ) = 0; + if ( p && *(++p)) + *p = 0; if ( GetAsyncKeyState( VK_CONTROL ) & 0x8000 ) ShellExecute(0, _T("explore"), szMirandaPath, 0, 0, SW_SHOWNORMAL); @@ -44,7 +44,7 @@ static INT_PTR MenuCommand_OpenFolder(WPARAM wParam, LPARAM lParam) } // toptoolbar (if plugin is installed) -static int ToptoolBarHook(WPARAM wParam, LPARAM lParam) +static int ToptoolBarHook(WPARAM, LPARAM) { TTBButton ttb = { sizeof(ttb) }; ttb.hIconHandleUp = icon.hIcolib; @@ -55,28 +55,9 @@ static int ToptoolBarHook(WPARAM wParam, LPARAM lParam) return 0; } -static int ModulesLoaded(WPARAM wParam, LPARAM lParam) +static int ModulesLoaded(WPARAM, LPARAM) { HookEvent(ME_TTB_MODULELOADED, ToptoolBarHook); - - // hotkeys service (0.8+) - HOTKEYDESC hotkey = { 0 }; - hotkey.cbSize = sizeof(hotkey); - hotkey.dwFlags = HKD_TCHAR; - hotkey.pszName = "Open Folder"; - hotkey.ptszDescription = LPGENT("Open Folder"); - hotkey.ptszSection = LPGENT("Main"); - hotkey.pszService = MS_OPENFOLDER_OPEN; - hotkey.DefHotKey = MAKEWORD( 'O', HOTKEYF_SHIFT | HOTKEYF_ALT ); - Hotkey_Register(&hotkey); - - CLISTMENUITEM mi = { sizeof(mi) }; - mi.position = 0x7FFFFFFF; - mi.flags = CMIF_TCHAR; - mi.icolibItem = icon.hIcolib; - mi.ptszName = LPGENT("Open Folder"); - mi.pszService = MS_OPENFOLDER_OPEN; - Menu_AddMainMenuItem(&mi); return 0; } @@ -104,6 +85,25 @@ extern "C" int __declspec( dllexport ) Load() // icolib (0.7+) Icon_Register(hInst, LPGEN("Open Folder"), &icon, 1, OPENFOLDER_MODULE_NAME); + + // hotkeys service (0.8+) + HOTKEYDESC hotkey = { 0 }; + hotkey.cbSize = sizeof(hotkey); + hotkey.dwFlags = HKD_TCHAR; + hotkey.pszName = "Open Folder"; + hotkey.ptszDescription = LPGENT("Open Folder"); + hotkey.ptszSection = LPGENT("Main"); + hotkey.pszService = MS_OPENFOLDER_OPEN; + hotkey.DefHotKey = MAKEWORD( 'O', HOTKEYF_SHIFT | HOTKEYF_ALT ); + Hotkey_Register(&hotkey); + + CLISTMENUITEM mi = { sizeof(mi) }; + mi.position = 0x7FFFFFFF; + mi.flags = CMIF_TCHAR; + mi.icolibItem = icon.hIcolib; + mi.ptszName = LPGENT("Open Folder"); + mi.pszService = MS_OPENFOLDER_OPEN; + Menu_AddMainMenuItem(&mi); return 0; } diff --git a/plugins/PluginUpdater/src/DlgUpdate.cpp b/plugins/PluginUpdater/src/DlgUpdate.cpp index 30423de1e8..61332335ae 100644 --- a/plugins/PluginUpdater/src/DlgUpdate.cpp +++ b/plugins/PluginUpdater/src/DlgUpdate.cpp @@ -649,7 +649,6 @@ static int ScanFolder(const TCHAR *tszFolder, size_t cbBaseLen, int level, const } __except (EXCEPTION_EXECUTE_HANDLER) { - ZeroMemory(szMyHash, 0); // smth went wrong, reload a file from scratch } } diff --git a/plugins/Popup/src/skin.cpp b/plugins/Popup/src/skin.cpp index 1d775b8d95..fe16ce2fb4 100644 --- a/plugins/Popup/src/skin.cpp +++ b/plugins/Popup/src/skin.cpp @@ -804,7 +804,6 @@ bool PopupSkin::load(LPCTSTR dir) HANDLE hFind = FindFirstFile(_T("*.popupskin"), &ffd); while (hFind != INVALID_HANDLE_VALUE) { loadSkin(ffd.cFileName); - break; if (!FindNextFile(hFind, &ffd)) break; } diff --git a/plugins/Scriver/src/input.cpp b/plugins/Scriver/src/input.cpp index a200330596..41e2227a7a 100644 --- a/plugins/Scriver/src/input.cpp +++ b/plugins/Scriver/src/input.cpp @@ -384,7 +384,7 @@ BOOL HandleLinkClick(HINSTANCE hInstance, HWND hwndDlg, HWND hwndFocus, ENLINK * tr.lpstrText = (LPWSTR)mir_alloc(sizeof(TCHAR)*(tr.chrg.cpMax - tr.chrg.cpMin + 8)); SendMessage(lParam->nmhdr.hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)&tr); if (_tcschr(tr.lpstrText, _T('@')) != NULL && _tcschr(tr.lpstrText, _T(':')) == NULL && _tcschr(tr.lpstrText, _T('/')) == NULL) { - MoveMemory(tr.lpstrText + sizeof(TCHAR)* 7, tr.lpstrText, sizeof(TCHAR)*(tr.chrg.cpMax - tr.chrg.cpMin + 1)); + MoveMemory(tr.lpstrText + 7, tr.lpstrText, sizeof(TCHAR)*(tr.chrg.cpMax - tr.chrg.cpMin + 1)); CopyMemory(tr.lpstrText, _T("mailto:"), sizeof(TCHAR)* 7); } diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index 096e106ea1..e6a7d453d0 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -894,7 +894,6 @@ void StreamInEvents(HWND hwndDlg, HANDLE hDbEventFirst, int count, int fAppend) GETTEXTLENGTHEX gtxl = { 0 }; gtxl.flags = GTL_DEFAULT | GTL_PRECISE | GTL_NUMCHARS; gtxl.codepage = 1200; - gtxl.codepage = 1200; fi.chrg.cpMin = SendDlgItemMessage(hwndDlg, IDC_LOG, EM_GETTEXTLENGTHEX, (WPARAM)>xl, 0); sel.cpMin = sel.cpMax = GetRichTextLength(GetDlgItem(hwndDlg, IDC_LOG), dat->windowData.codePage, FALSE); SendDlgItemMessage(hwndDlg, IDC_LOG, EM_EXSETSEL, 0, (LPARAM)&sel); diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index cafd032c92..d514176267 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -1447,12 +1447,12 @@ static int ChangeStatusMsgPrebuild(WPARAM wParam, LPARAM lParam) log2file("ChangeStatusMsgPrebuild()"); #endif PROTOACCOUNT **pa; - int iStatusMenuItemCount = 0, count, i; + int iStatusMenuItemCount = 0, count; DWORD iStatusMsgFlags = 0; ProtoEnumAccounts(&count, &pa); hProtoStatusMenuItem = (HANDLE *)mir_realloc(hProtoStatusMenuItem, sizeof(HANDLE) * count); - for (i = 0; i < count; ++i) + for (int i = 0; i < count; ++i) { if (!IsAccountEnabled(pa[i])) continue; @@ -1482,11 +1482,8 @@ static int ChangeStatusMsgPrebuild(WPARAM wParam, LPARAM lParam) mi.popupPosition = 500084000; mi.position = 2000040000; - for (i = 0; i < count; ++i) + for (int i = 0; i < count; ++i) { - char szSetting[80]; - int iProtoFlags; - if (!IsAccountEnabled(pa[i])) continue; @@ -1499,18 +1496,20 @@ static int ChangeStatusMsgPrebuild(WPARAM wParam, LPARAM lParam) if (!pa[i]->bIsVisible) continue; + char szSetting[80]; mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sFlags", pa[i]->szModuleName); - iProtoFlags = db_get_b(NULL, "SimpleStatusMsg", szSetting, PROTO_DEFAULT); + int iProtoFlags = db_get_b(NULL, "SimpleStatusMsg", szSetting, PROTO_DEFAULT); if (iProtoFlags & PROTO_NO_MSG || iProtoFlags & PROTO_THIS_MSG) continue; + TCHAR szBuffer[256]; if (CallService(MS_PROTO_ISACCOUNTLOCKED,0,(LPARAM)pa[i]->szModuleName)) { - TCHAR szBuffer[256]; mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s (locked)"), pa[i]->tszAccountName); mi.ptszPopupName = szBuffer; } - else mi.ptszPopupName = pa[i]->tszAccountName; + else + mi.ptszPopupName = pa[i]->tszAccountName; hProtoStatusMenuItem[i] = Menu_AddStatusMenuItem(&mi); } @@ -1578,7 +1577,7 @@ static int OnIdleChanged(WPARAM, LPARAM lParam) static int CSStatusChange(WPARAM wParam, LPARAM lParam) { - PROTOCOLSETTINGEX** ps = *(PROTOCOLSETTINGEX***)wParam; + PROTOCOLSETTINGEX **ps = *(PROTOCOLSETTINGEX***)wParam; int status_mode, CSProtoCount; char szSetting[80]; TCHAR *msg = NULL; @@ -1657,13 +1656,11 @@ static int CSStatusChange(WPARAM wParam, LPARAM lParam) static TCHAR *ParseWinampSong(ARGUMENTSINFO *ai) { - TCHAR *ptszWinampTitle; - if (ai->argc != 1) return NULL; ai->flags |= AIF_DONTPARSE; - ptszWinampTitle = GetWinampSong(); + TCHAR *ptszWinampTitle = GetWinampSong(); if (ptszWinampTitle != NULL) { mir_free(g_ptszWinampSong); @@ -1677,11 +1674,10 @@ static TCHAR *ParseWinampSong(ARGUMENTSINFO *ai) static TCHAR *ParseDate(ARGUMENTSINFO *ai) { - TCHAR szStr[128] = {0}; - if (ai->argc != 1) return NULL; + TCHAR szStr[128] = {0}; ai->flags |= AIF_DONTPARSE; GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, szStr, SIZEOF(szStr)); @@ -1769,7 +1765,7 @@ static int OnAccListChanged(WPARAM wParam, LPARAM lParam) return 0; } -static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) +static int OnModulesLoaded(WPARAM, LPARAM) { #ifdef _DEBUG log2file("### Session started ###"); @@ -1822,7 +1818,7 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) g_ptszWinampSong = mir_tstrdup(_T("SimpleStatusMsg"));*/ if (db_get_b(NULL, "SimpleStatusMsg", "UpdateMsgOn", 1)) - g_uUpdateMsgTimer = SetTimer(NULL, 0, db_get_w(NULL, "SimpleStatusMsg", "UpdateMsgInt", 10) * 1000, (TIMERPROC)UpdateMsgTimerProc); + g_uUpdateMsgTimer = SetTimer(NULL, 0, db_get_w(NULL, "SimpleStatusMsg", "UpdateMsgInt", 10) * 1000, UpdateMsgTimerProc); if (ServiceExists(MS_CS_SETSTATUSEX)) HookEvent(ME_CS_STATUSCHANGEEX, CSStatusChange); @@ -1832,7 +1828,7 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) if (!ServiceExists(MS_SS_GETPROFILECOUNT)) { if (db_get_b(NULL, "SimpleStatusMsg", "GlobalStatusDelay", 1)) - SetTimer(NULL, 0, db_get_w(NULL, "SimpleStatusMsg", "SetStatusDelay", 300), (TIMERPROC)SetStartupStatusGlobal); + SetTimer(NULL, 0, db_get_w(NULL, "SimpleStatusMsg", "SetStatusDelay", 300), SetStartupStatusGlobal); else { g_uSetStatusTimer = (UINT_PTR *)mir_alloc(sizeof(UINT_PTR) * accounts->count); for (int i = 0; i < accounts->count; ++i) { @@ -1844,7 +1840,7 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) char szSetting[80]; mir_snprintf(szSetting, SIZEOF(szSetting), "Set%sStatusDelay", accounts->pa[i]->szModuleName); - g_uSetStatusTimer[i] = SetTimer(NULL, 0, db_get_w(NULL, "SimpleStatusMsg", szSetting, 300), (TIMERPROC)SetStartupStatusProc); + g_uSetStatusTimer[i] = SetTimer(NULL, 0, db_get_w(NULL, "SimpleStatusMsg", szSetting, 300), SetStartupStatusProc); } } } @@ -1852,7 +1848,7 @@ static int OnModulesLoaded(WPARAM wParam, LPARAM lParam) return 0; } -static int OnOkToExit(WPARAM wParam, LPARAM lParam) +static int OnOkToExit(WPARAM, LPARAM) { if (accounts->statusCount) { char szSetting[80]; @@ -1875,7 +1871,7 @@ static int OnOkToExit(WPARAM wParam, LPARAM lParam) return 0; } -static int OnPreShutdown(WPARAM wParam, LPARAM lParam) +static int OnPreShutdown(WPARAM, LPARAM) { if (!accounts->statusMsgFlags) return 0; diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp index d71d7aa763..dd2c06f3b1 100644 --- a/plugins/SimpleStatusMsg/src/msgbox.cpp +++ b/plugins/SimpleStatusMsg/src/msgbox.cpp @@ -244,7 +244,7 @@ HWND WINAPI CreateRecentComboBoxEx(HWND hwndDlg, struct MsgBoxData *data) mir_snprintf(buff, SIZEOF(buff), "SMsg%d", j); j--; if (!db_get_ts(NULL, "SimpleStatusMsg", buff, &dbv)) { - if (dbv.ptszVal != NULL && dbv.ptszVal != '\0') { + if (dbv.ptszVal != NULL && *dbv.ptszVal != '\0') { found = TRUE; cbei.iItem = -1; cbei.pszText = (LPTSTR)dbv.ptszVal; diff --git a/plugins/Spamotron/src/utils.cpp b/plugins/Spamotron/src/utils.cpp index ef78a9f29d..ce8730a7b9 100644 --- a/plugins/Spamotron/src/utils.cpp +++ b/plugins/Spamotron/src/utils.cpp @@ -206,25 +206,24 @@ int get_response_num(const TCHAR *str) return i; } -TCHAR* get_response(TCHAR* dst, unsigned int dstlen, int num) +TCHAR* get_response(TCHAR *dst, unsigned int dstlen, int num) { - int i = 0; - TCHAR *tmp, *src = NULL; if (num < 0) return dst; - src = (TCHAR*)malloc(MAX_BUFFER_LENGTH * sizeof(TCHAR)); + TCHAR *src = (TCHAR*)malloc(MAX_BUFFER_LENGTH * sizeof(TCHAR)); + int i = 0; if (src != NULL) { _getOptS(src, MAX_BUFFER_LENGTH, "Response", defaultResponse); - _tcscpy(src, src); - tmp = _tcstok(src, L"\r\n"); + _tcsncpy(dst, src, dstlen); + TCHAR *tmp = _tcstok(src, L"\r\n"); while (tmp) { if (i == num) { - _tcscpy(dst, tmp); + _tcsncpy(dst, tmp, dstlen); free(src); return dst; } i++; - tmp = _tcstok(NULL, L"\r\n"); + tmp = _tcstok(src, L"\r\n"); } free(src); } diff --git a/plugins/TabSRMM/src/buttonsbar.cpp b/plugins/TabSRMM/src/buttonsbar.cpp index 3d46372ed1..2f21dfed4e 100644 --- a/plugins/TabSRMM/src/buttonsbar.cpp +++ b/plugins/TabSRMM/src/buttonsbar.cpp @@ -414,6 +414,11 @@ void BB_UpdateIcons(HWND hdlg, TWindowData *dat) void TSAPI BB_InitDlgButtons(TWindowData *dat) { + if (dat == 0) + return; + HWND hdlg = dat->hwnd; + if (hdlg == 0) + return; RECT rect; int i; int lwidth = 0, rwidth = 0; @@ -425,9 +430,7 @@ void TSAPI BB_InitDlgButtons(TWindowData *dat) int cx = 0, cy = 0; int lcount = LButtonsList.getCount(); int rcount = RButtonsList.getCount(); - HWND hdlg = dat->hwnd; - if (dat == 0 || hdlg == 0) { return; } if (CSkin::m_skinEnabled && !SkinItems[ID_EXTBKBUTTONSNPRESSED].IGNORED && !SkinItems[ID_EXTBKBUTTONSPRESSED].IGNORED && !SkinItems[ID_EXTBKBUTTONSMOUSEOVER].IGNORED) { isThemed = FALSE; diff --git a/plugins/TabSRMM/src/container.cpp b/plugins/TabSRMM/src/container.cpp index 1962c1b8e1..5f74bbd09c 100644 --- a/plugins/TabSRMM/src/container.cpp +++ b/plugins/TabSRMM/src/container.cpp @@ -619,7 +619,7 @@ static INT_PTR CALLBACK DlgProcContainer(HWND hwndDlg, UINT msg, WPARAM wParam, LONG y_pad = M.GetByte("y-pad", 3) + ((pContainer->dwFlags & CNT_TABSBOTTOM) ? 1 : 0); if (pContainer->dwFlagsEx & TCF_FLAT) - y_pad += 1; //(pContainer->dwFlags & CNT_TABSBOTTOM ? 1 : 2); + y_pad++; //(pContainer->dwFlags & CNT_TABSBOTTOM ? 1 : 2); TabCtrl_SetPadding(GetDlgItem(hwndDlg, IDC_MSGTABS), x_pad, y_pad); @@ -838,14 +838,12 @@ panel_found: } else if (((LPNMHDR)lParam)->code == NM_RCLICK) { POINT pt; - MCONTACT hContact = 0; - HMENU hMenu; - GetCursorPos(&pt); + MCONTACT hContact = 0; SendMessage(pContainer->hwndActive, DM_QUERYHCONTACT, 0, (LPARAM)&hContact); if (hContact) { int iSel = 0; - hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0); + HMENU hMenu = (HMENU) CallService(MS_CLIST_MENUBUILDCONTACT, hContact, 0); iSel = TrackPopupMenu(hMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL); if (iSel) CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(iSel), MPCF_CONTACTMENU), hContact); @@ -1000,9 +998,7 @@ panel_found: { RECT rc; LONG dwNewLeft; - BOOL skinnedMode = bSkinned; - - skinnedMode |= (IsThemeActive() ? 1 : 0); + BOOL skinnedMode = bSkinned | (IsThemeActive() ? 1 : 0); GetWindowRect(hwndDlg, &rc); diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index f26f1e3990..b09bfdc44b 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -448,7 +448,7 @@ void CMenuBar::updateState(const HMENU hMenu) const if (dat) { ::CheckMenuItem(hMenu, ID_VIEW_SHOWMENUBAR, MF_BYCOMMAND | m_pContainer->dwFlags & CNT_NOMENUBAR ? MF_UNCHECKED : MF_CHECKED); ::CheckMenuItem(hMenu, ID_VIEW_SHOWSTATUSBAR, MF_BYCOMMAND | m_pContainer->dwFlags & CNT_NOSTATUSBAR ? MF_UNCHECKED : MF_CHECKED); - ::CheckMenuItem(hMenu, ID_VIEW_SHOWAVATAR, MF_BYCOMMAND | dat->bShowAvatar ? MF_CHECKED : MF_UNCHECKED); + ::CheckMenuItem(hMenu, ID_VIEW_SHOWAVATAR, MF_BYCOMMAND | (dat->bShowAvatar ? MF_CHECKED : MF_UNCHECKED)); ::CheckMenuItem(hMenu, ID_VIEW_SHOWTITLEBAR, MF_BYCOMMAND | m_pContainer->dwFlags & CNT_NOTITLE ? MF_UNCHECKED : MF_CHECKED); ::EnableMenuItem(hMenu, ID_VIEW_SHOWTITLEBAR, CSkin::m_skinEnabled && CSkin::m_frameSkins ? MF_GRAYED : MF_ENABLED); diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index c5fd0dc581..adeaedb97e 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -520,7 +520,7 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP ack.type = ACKTYPE_MESSAGE; ack.result = ACKRESULT_SUCCESS; - if (job->hContact && job->iAcksNeeded && job->hContact && job->iStatus == SendQueue::SQ_INPROGRESS) { + if (job->hContact && job->iAcksNeeded && job->iStatus == SendQueue::SQ_INPROGRESS) { if (IsWindow(job->hOwnerWnd)) ::SendMessage(job->hOwnerWnd, HM_EVENTSENT, (WPARAM)MAKELONG(wParam, 0), (LPARAM)&ack); else diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index ab677d6451..9b334fb22f 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -3231,7 +3231,7 @@ quote_from_last: } _dlgReturn(hwndDlg, TRUE); } - { + if(dat) { TContainerData *pContainer = dat->pContainer; if (dat->iOpenJobs > 0 && lParam != 2) { if (dat->dwFlags & MWF_ERRORSTATE) { diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index a448be6be0..e5299a53da 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -126,13 +126,12 @@ static void TrimMessage(TCHAR *msg) void TSAPI CacheLogFonts() { - int i; HDC hdc = GetDC(NULL); logPixelSY = GetDeviceCaps(hdc, LOGPIXELSY); ReleaseDC(NULL, hdc); - ZeroMemory(logfonts, sizeof(LOGFONTA) * MSGDLGFONTCOUNT + 2); - for (i = 0; i < MSGDLGFONTCOUNT; i++) { + ZeroMemory(logfonts, sizeof(LOGFONTA) * (MSGDLGFONTCOUNT + 2)); + for (int i = 0; i < MSGDLGFONTCOUNT; i++) { LoadLogfont(i, &logfonts[i], &fontcolors[i], FONTMODULE); mir_snprintf(rtfFontsGlobal[i], SIZEOF(rtfFontsGlobal[i]), "\\f%u\\cf%u\\b%d\\i%d\\ul%d\\fs%u", i, i, logfonts[i].lfWeight >= FW_BOLD ? 1 : 0, logfonts[i].lfItalic, logfonts[i].lfUnderline, 2 * abs(logfonts[i].lfHeight) * 74 / logPixelSY); } @@ -149,7 +148,7 @@ void TSAPI CacheLogFonts() COLORREF clr; LOGFONTA lf; - for (i = 0; i < IPFONTCOUNT; i++) { + for (int i = 0; i < IPFONTCOUNT; i++) { if (CInfoPanel::m_ipConfig.hFonts[i]) DeleteObject(CInfoPanel::m_ipConfig.hFonts[i]); LoadLogfont(i + 100, &lf, &clr, FONTMODULE); diff --git a/plugins/TabSRMM/src/sendqueue.cpp b/plugins/TabSRMM/src/sendqueue.cpp index fd5b0f1342..d9a47724af 100644 --- a/plugins/TabSRMM/src/sendqueue.cpp +++ b/plugins/TabSRMM/src/sendqueue.cpp @@ -580,7 +580,7 @@ void SendQueue::recallFailed(const TWindowData *dat, int iEntry) const void SendQueue::UpdateSaveAndSendButton(TWindowData *dat) { if (dat) { - HWND hwndDlg = dat->hwnd; + HWND hwndDlg = dat->hwnd; GETTEXTLENGTHEX gtxl = {0}; gtxl.codepage = CP_UTF8; @@ -829,7 +829,7 @@ int SendQueue::doSendLater(int iJobIndex, TWindowData *dat, MCONTACT hContact, b } if (iJobIndex >= 0 && iJobIndex < NR_SENDJOBS) { - SendJob* job = &m_jobs[iJobIndex]; + SendJob *job = &m_jobs[iJobIndex]; char szKeyName[20]; TCHAR tszHeader[150]; diff --git a/plugins/TabSRMM/src/templates.cpp b/plugins/TabSRMM/src/templates.cpp index 4bd8f52bae..d03e5c81f8 100644 --- a/plugins/TabSRMM/src/templates.cpp +++ b/plugins/TabSRMM/src/templates.cpp @@ -118,11 +118,10 @@ void LoadDefaultTemplates() INT_PTR CALLBACK DlgProcTemplateEditor(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { - TWindowData *dat; TemplateEditorInfo *teInfo = 0; TTemplateSet *tSet; int i; - dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); /* * since this dialog needs a MessageWindowData * but has no container, we can store * the extended info struct in pContainer *) diff --git a/plugins/TabSRMM/src/themes.cpp b/plugins/TabSRMM/src/themes.cpp index 44284695f3..7e2e4833ae 100644 --- a/plugins/TabSRMM/src/themes.cpp +++ b/plugins/TabSRMM/src/themes.cpp @@ -841,7 +841,6 @@ TCHAR* CImageItem::Read(const TCHAR *szFilename) m_dwFlags |= IMAGE_FLAG_DIVIDED; m_bf.BlendFlags = 0; m_bf.BlendOp = AC_SRC_OVER; - m_bf.AlphaFormat = 0; m_dwFlags |= IMAGE_PERPIXEL_ALPHA; m_bf.AlphaFormat = AC_SRC_ALPHA; if (m_inner_height <= 0 || m_inner_width <= 0) { @@ -1371,7 +1370,6 @@ void CSkin::Load(void) if (!m_tszFileName[0] || !::PathFileExists(m_tszFileName)) return; - TCHAR *p; TCHAR *szSections = (TCHAR*)mir_alloc(6004); int i = 1, j = 0; UINT data; @@ -1407,10 +1405,9 @@ void CSkin::Load(void) m_DisableScrollbars = M.GetByte("disableVScroll", 0) ? true : false; ZeroMemory(szSections, 6000); - p = szSections; GetPrivateProfileSectionNames(szSections, 3000, m_tszFileName); szSections[3001] = szSections[3000] = 0; - p = szSections; + TCHAR *p = szSections; while (lstrlen(p) > 1) { if (p[0] != '%') { p += (lstrlen(p) + 1); @@ -1719,19 +1716,19 @@ void CSkin::setupAeroSkins() float fmax = max(max(fr, fg), fb); if (fmax == fr) { - fr *= (alphafactor / 100 * 2.2); + fr *= (alphafactor / 100.0 * 2.2); fr = min(fr, 255); fb = min(fb * alphafactor / 100, 255); fg = min(fg * alphafactor / 100, 255); } else if (fmax == fg) { - fg *= (alphafactor / 100 * 2.2); + fg *= (alphafactor / 100.0 * 2.2); fg = min(fg, 255); fr = min(fr * alphafactor / 100, 255); fb = min(fb * alphafactor / 100, 255); } else { - fb *= (alphafactor / 100 * 2.2); + fb *= (alphafactor / 100.0 * 2.2); fb = min(fb, 255); fr = min(fr * alphafactor / 100, 255); fg = min(fg * alphafactor / 100, 255); @@ -1838,11 +1835,9 @@ void CSkin::setupAeroSkins() void CSkin::SkinCalcFrameWidth() { - int xBorder, yBorder, yCaption; - - xBorder = GetSystemMetrics(SM_CXSIZEFRAME); - yBorder = GetSystemMetrics(SM_CYSIZEFRAME); - yCaption = GetSystemMetrics(SM_CYCAPTION); + int xBorder = GetSystemMetrics(SM_CXSIZEFRAME); + int yBorder = GetSystemMetrics(SM_CYSIZEFRAME); + int yCaption = GetSystemMetrics(SM_CYCAPTION); m_realSkinnedFrame_left = m_SkinnedFrame_left - xBorder; m_realSkinnedFrame_right = m_SkinnedFrame_right - xBorder; diff --git a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp index bf0329ece7..6255e8cbad 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp @@ -261,7 +261,6 @@ static INT_PTR ServiceCreateMergedFlagIcon(WPARAM wParam,LPARAM lParam) hrgn=CreatePolygonRgn(aptTriangle,SIZEOF(aptTriangle),WINDING); if (hrgn!=NULL) { SelectClipRgn(hdc,hrgn); - DeleteObject(hrgn); hbmPrev=(HBITMAP)SelectObject(hdc,icoi.hbmColor); if (hbmPrev!=NULL) { /* error on select? */ if (DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,NULL,DI_NOMIRROR|DI_IMAGE)) { diff --git a/plugins/Watrack_MPD/src/main.cpp b/plugins/Watrack_MPD/src/main.cpp index 01496d9f06..171bcc853c 100755 --- a/plugins/Watrack_MPD/src/main.cpp +++ b/plugins/Watrack_MPD/src/main.cpp @@ -413,17 +413,17 @@ void RegisterPlayer() { PLAYERCELL player = {0}; player.Desc = "Music Player Daemon"; + player.Notes = _T("mpd is a nice music player for *nix which have not any gui, just daemon.\nuses very small amount of ram, cpu."); + player.URL = "http://www.musicpd.org"; player.Check = CheckPlayer; player.Init = Init; player.DeInit = DeInit; - player.GetStatus = GetStatus; player.Command = SendCommand; - player.flags = (WAT_OPT_HASURL|WAT_OPT_SINGLEINST|WAT_OPT_PLAYERINFO); + player.GetStatus = GetStatus; player.GetName = GetFileName; player.GetInfo = GetPlayerInfo; + player.flags = (WAT_OPT_HASURL|WAT_OPT_SINGLEINST|WAT_OPT_PLAYERINFO); // player.Icon = //TODO:implement icon support - player.Notes = _T("mpd is a nice music player for *nix which have not any gui, just daemon.\nuses very small amount of ram, cpu."); - player.URL = "http://www.musicpd.org"; CallService(MS_WAT_PLAYER, WAT_ACT_REGISTER, (LPARAM)&player); } } \ No newline at end of file diff --git a/plugins/Weather/src/weather_ini.cpp b/plugins/Weather/src/weather_ini.cpp index 59c618382b..066861beed 100644 --- a/plugins/Weather/src/weather_ini.cpp +++ b/plugins/Weather/src/weather_ini.cpp @@ -247,7 +247,7 @@ void LoadStationData(TCHAR *pszFile, TCHAR *pszShortFile, WIDATA *Data) }; // clean up old stuff - ZeroMemory(Data, sizeof(Data)); + ZeroMemory(Data, sizeof(*Data)); Data->Enabled = FALSE; // open the ini file diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp index d2aeef1329..35378816ba 100644 --- a/plugins/WebView/src/webview_alerts.cpp +++ b/plugins/WebView/src/webview_alerts.cpp @@ -132,15 +132,15 @@ int PopupAlert(WPARAM wParam, LPARAM lParam) if ( db_get_b(NULL, MODULENAME, POP_USECUSTCLRS_KEY, 0)) { ppd.colorBack = db_get_dw(NULL, MODULENAME, POP_BG_CLR_KEY, Def_color_bg); - ppd.colorBack = db_get_dw(NULL, MODULENAME, POP_TXT_CLR_KEY, Def_color_txt); + ppd.colorText = db_get_dw(NULL, MODULENAME, POP_TXT_CLR_KEY, Def_color_txt); } - if ( db_get_b(NULL, MODULENAME, POP_USEWINCLRS_KEY, 0)) { + else if ( db_get_b(NULL, MODULENAME, POP_USEWINCLRS_KEY, 0)) { ppd.colorBack = GetSysColor(COLOR_BTNFACE); - ppd.colorBack = GetSysColor(COLOR_WINDOWTEXT); + ppd.colorText = GetSysColor(COLOR_WINDOWTEXT); } - if ( db_get_b(NULL, MODULENAME, POP_USESAMECLRS_KEY, 1)) { + else if ( db_get_b(NULL, MODULENAME, POP_USESAMECLRS_KEY, 1)) { ppd.colorBack = BackgoundClr; - ppd.colorBack = TextClr; + ppd.colorText = TextClr; } ppd.PluginWindowProc = NULL; diff --git a/plugins/WinterSpeak/src/DialogConfigEngine.cpp b/plugins/WinterSpeak/src/DialogConfigEngine.cpp index 2375dedcc7..9c5be8dfe9 100644 --- a/plugins/WinterSpeak/src/DialogConfigEngine.cpp +++ b/plugins/WinterSpeak/src/DialogConfigEngine.cpp @@ -109,7 +109,7 @@ void DialogConfigEngine::load(HWND window) std::vector engines = si.getAvailableEngines(); for (unsigned int i = 0; i < engines.size(); ++i) { - SendDlgItemMessage(window, IDC_SELECT_ENGINE, CB_ADDSTRING, 0, (long)(engines[i].c_str())); + SendDlgItemMessage(window, IDC_SELECT_ENGINE, CB_ADDSTRING, 0, (LPARAM)(engines[i].c_str())); } VoiceDesc desc = m_db.getVoiceDesc(); @@ -120,7 +120,7 @@ void DialogConfigEngine::load(HWND window) SendDlgItemMessage(window, IDC_SLIDER_RATE, TBM_SETPOS, TRUE, desc.rate); // select the speech engine - SendDlgItemMessage(window, IDC_SELECT_ENGINE, CB_SELECTSTRING, 0, reinterpret_cast(desc.engine.c_str())); + SendDlgItemMessage(window, IDC_SELECT_ENGINE, CB_SELECTSTRING, 0, reinterpret_cast(desc.engine.c_str())); // initialise the welcome message box SetDlgItemText(window, IDC_WELCOME_MSG, m_db.getWelcomeMessage().c_str()); @@ -158,13 +158,13 @@ void DialogConfigEngine::updateVoices(HWND window) for (unsigned int i = 0; i < voices.size(); ++i) { SendDlgItemMessage(window, IDC_SELECT_VOICE, CB_ADDSTRING, 0, - (long)voices[i].c_str()); + (LPARAM)voices[i].c_str()); } // get the voice saved in the database std::wstring voice = m_db.getVoiceDesc().voice; - if (FAILED(SendDlgItemMessage(window, IDC_SELECT_VOICE, CB_FINDSTRINGEXACT, 0, (long)voice.c_str()))) + if (FAILED(SendDlgItemMessage(window, IDC_SELECT_VOICE, CB_FINDSTRINGEXACT, 0, (LPARAM)voice.c_str()))) { // select the first one SendDlgItemMessage(window, IDC_SELECT_VOICE, CB_SETCURSEL , 0, 0); diff --git a/plugins/YARelay/src/main.cpp b/plugins/YARelay/src/main.cpp index e41a97859c..eac2d93b3f 100644 --- a/plugins/YARelay/src/main.cpp +++ b/plugins/YARelay/src/main.cpp @@ -156,7 +156,7 @@ static int MessageEventAdded(WPARAM wParam, LPARAM lParam) // get sender's uin CONTACTINFO ci = { sizeof(ci) }; ci.dwFlag = CNF_UNIQUEID; - if (CallService(MS_CONTACT_GETCONTACTINFO, 0, (long)&ci) == 0){ + if (CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci) == 0){ if (ci.type == CNFT_ASCIIZ) _tcsncpy_s(buf, ci.pszVal, _TRUNCATE); else if (ci.type == CNFT_BYTE) diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index 3928a7c64d..c24ea8bfcf 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -1309,7 +1309,7 @@ HANDLE __cdecl CIcqProto::SendFile(MCONTACT hContact, const TCHAR* szDescription // Send file transfer request debugLogA("Init file send"); - char *pszFiles; + char *pszFiles, szFiles[64]; if (ft->dwFileCount == 1) { pszFiles = strchr(ft->pszFiles[0], '\\'); if (pszFiles) @@ -1318,7 +1318,7 @@ HANDLE __cdecl CIcqProto::SendFile(MCONTACT hContact, const TCHAR* szDescription pszFiles = ft->pszFiles[0]; } else { - char szFiles[64], tmp[64]; + char tmp[64]; mir_snprintf(szFiles, SIZEOF(szFiles), ICQTranslateUtfStatic("%d Files", tmp, SIZEOF(tmp)), ft->dwFileCount); pszFiles = szFiles; } diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp index ecf67683ed..233c0d07d8 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.cpp +++ b/protocols/IcqOscarJ/src/icq_servlist.cpp @@ -223,7 +223,6 @@ void __cdecl CIcqProto::servlistQueueThread(void *param) SAFE_FREE((void**)&((servlistgroupitemdouble*)(pItem->pItems[i]))->packet2.pData); } SAFE_FREE((void**)&pItem->pItems[i]); - break; } SAFE_FREE((void**)&pItem); // resize the queue diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp index 1e941ee9dc..91187d0715 100644 --- a/protocols/JabberG/src/jabber_iqid_muc.cpp +++ b/protocols/JabberG/src/jabber_iqid_muc.cpp @@ -37,22 +37,25 @@ void CJabberProto::SetMucConfig(HXML node, void *from) } } +// RECVED: room config form +// ACTION: show the form void CJabberProto::OnIqResultGetMuc(HXML iqNode, CJabberIqInfo *pInfo) { - HXML queryNode, xNode; - const TCHAR *type, *from, *str; - - // RECVED: room config form - // ACTION: show the form debugLogA(" iqIdGetMuc"); - if ((type = xmlGetAttrValue(iqNode, _T("type"))) == NULL) return; - if ((from = xmlGetAttrValue(iqNode, _T("from"))) == NULL) return; + LPCTSTR type = xmlGetAttrValue(iqNode, _T("type")); + if (type == NULL) + return; + LPCTSTR from = xmlGetAttrValue(iqNode, _T("from")); + if (from == NULL) + return; if (!_tcscmp(type, _T("result"))) { - if ((queryNode = xmlGetChild(iqNode , "query")) != NULL) { - str = xmlGetAttrValue(queryNode, _T("xmlns")); + HXML queryNode = xmlGetChild(iqNode , _T("query")); + if (queryNode != NULL) { + LPCTSTR str = xmlGetAttrValue(queryNode, _T("xmlns")); if (!lstrcmp(str, JABBER_FEAT_MUC_OWNER)) { - if ((xNode = xmlGetChild(queryNode , "x")) != NULL) { + HXML xNode = xmlGetChild(queryNode , _T("x")); + if (xNode != NULL) { str = xmlGetAttrValue(xNode, _T("xmlns")); if (!lstrcmp(str, JABBER_FEAT_DATA_FORMS)) //LaunchForm(xNode); @@ -65,13 +68,6 @@ void CJabberProto::OnIqResultGetMuc(HXML iqNode, CJabberIqInfo *pInfo) static void sttFillJidList(HWND hwndDlg) { - JABBER_MUC_JIDLIST_INFO *jidListInfo; - HXML iqNode, queryNode; - const TCHAR *from, *jid, *reason, *nick; - LVITEM lvi; - HWND hwndList; - int count, i; - TCHAR *filter = NULL; if (GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FILTER), GWLP_USERDATA)) { @@ -80,17 +76,18 @@ static void sttFillJidList(HWND hwndDlg) GetDlgItemText(hwndDlg, IDC_FILTER, filter, filterLength); } - jidListInfo = (JABBER_MUC_JIDLIST_INFO *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + JABBER_MUC_JIDLIST_INFO *jidListInfo = (JABBER_MUC_JIDLIST_INFO *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA); if (!jidListInfo) return; - hwndList = GetDlgItem(hwndDlg, IDC_LIST); + HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST); SendMessage(hwndList, WM_SETREDRAW, FALSE, 0); - count = ListView_GetItemCount(hwndList); + int count = ListView_GetItemCount(hwndList); + LVITEM lvi; lvi.mask = LVIF_PARAM; lvi.iSubItem = 0; - for (i=0; iiqNode) != NULL) { - if ((from = xmlGetAttrValue(iqNode, _T("from"))) != NULL) { - if ((queryNode = xmlGetChild(iqNode , "query")) != NULL) { + TCHAR tszItemText[ JABBER_MAX_JID_LEN + 256 ]; + HXML iqNode = jidListInfo->iqNode; + if (iqNode != NULL) { + LPCTSTR from = xmlGetAttrValue(iqNode, _T("from")); + if (from != NULL) { + HXML queryNode = xmlGetChild(iqNode , _T("query")); + if (queryNode != NULL) { lvi.mask = LVIF_TEXT | LVIF_PARAM; lvi.iSubItem = 0; lvi.iItem = 0; - for (i=0; ; i++) { + for (int i=0; ; i++) { HXML itemNode = xmlGetChild(queryNode ,i); if (!itemNode) break; - if ((jid = xmlGetAttrValue(itemNode, _T("jid"))) != NULL) { + LPCTSTR jid = xmlGetAttrValue(itemNode, _T("jid")); + if (jid != NULL) { lvi.pszText = (TCHAR*)jid; if (jidListInfo->type == MUC_BANLIST) { - if ((reason = xmlGetText(xmlGetChild(itemNode , "reason"))) != NULL) { - TCHAR jidreason[ JABBER_MAX_JID_LEN + 256 ]; - mir_sntprintf(jidreason, SIZEOF(jidreason), _T("%s (%s)") , jid, reason); - lvi.pszText = jidreason; - } } - - if (jidListInfo->type == MUC_VOICELIST || jidListInfo->type == MUC_MODERATORLIST) { - if ((nick = xmlGetAttrValue(itemNode, _T("nick"))) != NULL) { - TCHAR nickjid[ JABBER_MAX_JID_LEN + 256 ]; - mir_sntprintf(nickjid, SIZEOF(nickjid), _T("%s (%s)") , nick, jid); - lvi.pszText = nickjid; - } } + LPCTSTR reason = xmlGetText(xmlGetChild(itemNode , _T("reason"))); + if (reason != NULL) { + mir_sntprintf(tszItemText, SIZEOF(tszItemText), _T("%s (%s)") , jid, reason); + lvi.pszText = tszItemText; + } + } + else if (jidListInfo->type == MUC_VOICELIST || jidListInfo->type == MUC_MODERATORLIST) { + LPCTSTR nick = xmlGetAttrValue(itemNode, _T("nick")); + if (nick != NULL) { + mir_sntprintf(tszItemText, SIZEOF(tszItemText), _T("%s (%s)") , nick, jid); + lvi.pszText = tszItemText; + } + } if (filter && *filter && !JabberStrIStr(lvi.pszText, filter)) continue; @@ -135,7 +138,11 @@ static void sttFillJidList(HWND hwndDlg) ListView_InsertItem(hwndList, &lvi); lvi.iItem++; - } } } } } + } + } + } + } + } lvi.mask = LVIF_PARAM; lvi.lParam = (LPARAM)(-1); @@ -169,11 +176,10 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w { LVCOLUMN lvc; RECT rc; - HWND hwndList; TranslateDialogDefault(hwndDlg); - hwndList = GetDlgItem(hwndDlg, IDC_LIST); + HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST); ListView_SetExtendedListViewStyle(hwndList, LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES); GetClientRect(hwndList, &rc); //rc.right -= GetSystemMetrics(SM_CXVSCROLL); @@ -233,8 +239,6 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w case WM_JABBER_REFRESH: { // lParam is (JABBER_MUC_JIDLIST_INFO *) - HXML iqNode, queryNode; - const TCHAR *from; TCHAR title[256]; // Clear current GWL_USERDATA, if any @@ -248,11 +252,13 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w // Populate displayed list from iqNode lstrcpyn(title, TranslateT("JID List"), SIZEOF(title)); if ((dat=(JABBER_MUC_JIDLIST_INFO *) lParam) != NULL) { - if ((iqNode = dat->iqNode) != NULL) { - if ((from = xmlGetAttrValue(iqNode, _T("from"))) != NULL) { + HXML iqNode = dat->iqNode; + if (iqNode != NULL) { + LPCTSTR from = xmlGetAttrValue(iqNode, _T("from")); + if (from != NULL) { dat->roomJid = mir_tstrdup(from); - - if ((queryNode = xmlGetChild(iqNode , "query")) != NULL) { + HXML queryNode = xmlGetChild(iqNode , _T("query")); + if (queryNode != NULL) { TCHAR *localFrom = mir_tstrdup(from); mir_sntprintf(title, SIZEOF(title), TranslateT("%s, %d items (%s)"), (dat->type == MUC_VOICELIST) ? TranslateT("Voice List") : @@ -263,7 +269,10 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w (dat->type == MUC_OWNERLIST) ? TranslateT("Owner List") : TranslateT("JID List"), xmlGetChildCount(queryNode), localFrom); mir_free(localFrom); - } } } } + } + } + } + } SetWindowText(hwndDlg, title); SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_FILTER), GWLP_USERDATA, 0); @@ -285,10 +294,9 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w case CDDS_SUBITEM|CDDS_ITEMPREPAINT: { RECT rc; - HICON hIcon; - ListView_GetSubItemRect(nm->nmcd.hdr.hwndFrom, nm->nmcd.dwItemSpec, nm->iSubItem, LVIR_LABEL, &rc); if (nm->iSubItem == 1) { + HICON hIcon; if (nm->nmcd.lItemlParam == (LPARAM)(-1)) hIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_ADDCONTACT), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0); else @@ -297,7 +305,10 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w DestroyIcon(hIcon); SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, CDRF_SKIPDEFAULT); return TRUE; - } } } } + } + } + } + } break; case NM_CLICK: { @@ -376,16 +387,14 @@ static INT_PTR CALLBACK JabberMucJidListDlgProc(HWND hwndDlg, UINT msg, WPARAM w case WM_CLOSE: { - HWND hwndList; - int count, i; LVITEM lvi; // Free lParam of the displayed list items - hwndList = GetDlgItem(hwndDlg, IDC_LIST); - count = ListView_GetItemCount(hwndList); + HWND hwndList = GetDlgItem(hwndDlg, IDC_LIST); + int count = ListView_GetItemCount(hwndList); lvi.mask = LVIF_PARAM; lvi.iSubItem = 0; - for (i=0; iiqNode) == NULL) return; - if ((from = xmlGetAttrValue(iqNode, _T("from"))) == NULL) return; - if ((queryNode = xmlGetChild(iqNode , "query")) == NULL) return; + HXML iqNode = jidListInfo->iqNode; + if (iqNode == NULL) + return; + + LPCTSTR from = xmlGetAttrValue(iqNode, _T("from")); + if (from == NULL) + return; + + HXML queryNode = xmlGetChild(iqNode , _T("query")); + if (queryNode == NULL) + return; CJabberProto *ppro = jidListInfo->ppro; + HWND *pHwndJidList; switch (jidListInfo->type) { case MUC_VOICELIST: pHwndJidList = &ppro->m_hwndMucVoiceList; @@ -478,13 +494,13 @@ static void CALLBACK JabberMucJidListCreateDialogApcProc(void* param) void CJabberProto::OnIqResultMucGetJidList(HXML iqNode, JABBER_MUC_JIDLIST_TYPE listType) { - const TCHAR *type; - JABBER_MUC_JIDLIST_INFO *jidListInfo; - - if ((type = xmlGetAttrValue(iqNode, _T("type"))) == NULL) return; + LPCTSTR type = xmlGetAttrValue(iqNode, _T("type")); + if (type == NULL) + return; if (!lstrcmp(type, _T("result"))) { - if ((jidListInfo = new JABBER_MUC_JIDLIST_INFO) != NULL) { + JABBER_MUC_JIDLIST_INFO *jidListInfo = new JABBER_MUC_JIDLIST_INFO; + if (jidListInfo != NULL) { jidListInfo->type = listType; jidListInfo->ppro = this; jidListInfo->roomJid = NULL; // Set in the dialog procedure @@ -492,39 +508,41 @@ void CJabberProto::OnIqResultMucGetJidList(HXML iqNode, JABBER_MUC_JIDLIST_TYPE CallFunctionAsync(JabberMucJidListCreateDialogApcProc, jidListInfo); else mir_free(jidListInfo); -} } } + } + } +} -void CJabberProto::OnIqResultMucGetVoiceList(HXML iqNode, CJabberIqInfo *pInfo) +void CJabberProto::OnIqResultMucGetVoiceList(HXML iqNode, CJabberIqInfo *) { debugLogA(" iqResultMucGetVoiceList"); OnIqResultMucGetJidList(iqNode, MUC_VOICELIST); } -void CJabberProto::OnIqResultMucGetMemberList(HXML iqNode, CJabberIqInfo *pInfo) +void CJabberProto::OnIqResultMucGetMemberList(HXML iqNode, CJabberIqInfo *) { debugLogA(" iqResultMucGetMemberList"); OnIqResultMucGetJidList(iqNode, MUC_MEMBERLIST); } -void CJabberProto::OnIqResultMucGetModeratorList(HXML iqNode, CJabberIqInfo *pInfo) +void CJabberProto::OnIqResultMucGetModeratorList(HXML iqNode, CJabberIqInfo *) { debugLogA(" iqResultMucGetModeratorList"); OnIqResultMucGetJidList(iqNode, MUC_MODERATORLIST); } -void CJabberProto::OnIqResultMucGetBanList(HXML iqNode, CJabberIqInfo *pInfo) +void CJabberProto::OnIqResultMucGetBanList(HXML iqNode, CJabberIqInfo *) { debugLogA(" iqResultMucGetBanList"); OnIqResultMucGetJidList(iqNode, MUC_BANLIST); } -void CJabberProto::OnIqResultMucGetAdminList(HXML iqNode, CJabberIqInfo *pInfo) +void CJabberProto::OnIqResultMucGetAdminList(HXML iqNode, CJabberIqInfo *) { debugLogA(" iqResultMucGetAdminList"); OnIqResultMucGetJidList(iqNode, MUC_ADMINLIST); } -void CJabberProto::OnIqResultMucGetOwnerList(HXML iqNode, CJabberIqInfo *pInfo) +void CJabberProto::OnIqResultMucGetOwnerList(HXML iqNode, CJabberIqInfo *) { debugLogA(" iqResultMucGetOwnerList"); OnIqResultMucGetJidList(iqNode, MUC_OWNERLIST); @@ -547,7 +565,6 @@ TCHAR* JABBER_MUC_JIDLIST_INFO::type2str() const case MUC_BANLIST: return TranslateT("Ban List"); case MUC_ADMINLIST: return TranslateT("Admin List"); case MUC_OWNERLIST: return TranslateT("Owner List"); + default: return TranslateT("JID List"); } - - return TranslateT("JID List"); } diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index ce8ea900d9..9b225a91e5 100644 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -255,8 +255,7 @@ protected: else SetDlgItemText(m_hwnd, IDC_REG_STATUS, (TCHAR*)lParam); - if (wParam >= 0) - SendMessage(GetDlgItem(m_hwnd, IDC_PROGRESS_REG), PBM_SETPOS, wParam, 0); + SendMessage(GetDlgItem(m_hwnd, IDC_PROGRESS_REG), PBM_SETPOS, wParam, 0); if (wParam >= 100) m_btnOk.SetText(TranslateT("Close")); else diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp index cfbc52d824..29f3a0a077 100644 --- a/protocols/Sametime/src/files.cpp +++ b/protocols/Sametime/src/files.cpp @@ -358,7 +358,7 @@ HANDLE CSametimeProto::SendFilesToUser(MCONTACT hContact, PROTOCHAR** files, con HANDLE CSametimeProto::AcceptFileTransfer(MCONTACT hContact, HANDLE hFt, char* save_path) { - mwFileTransfer* ft = (mwFileTransfer*)(hFt); + mwFileTransfer* ft = (mwFileTransfer*)hFt; CSametimeProto* proto = getProtoFromMwFileTransfer(ft); debugLog(_T("CSametimeProto::AcceptFileTransfer() start")); @@ -366,7 +366,7 @@ HANDLE CSametimeProto::AcceptFileTransfer(MCONTACT hContact, HANDLE hFt, char* s memset((void*)ftcd, 0, sizeof(FileTransferClientData)); ftcd->ft = ft; ftcd->sending = false; - ftcd->hFt = (HANDLE)ft; + ftcd->hFt = hFt; if (save_path) // save path ftcd->save_path = _strdup(save_path); @@ -420,7 +420,7 @@ void CSametimeProto::CancelFileTransfer(HANDLE hFt) FileTransferClientData* ftcd = (FileTransferClientData*)mwFileTransfer_getClientData(ft); if (ftcd) { - while (mwFileTransfer_isDone(ftcd->ft) && ftcd) + while (ftcd && mwFileTransfer_isDone(ftcd->ft)) ftcd = ftcd->next; if (ftcd) mwFileTransfer_cancel(ftcd->ft); diff --git a/protocols/Sametime/src/sametime.cpp b/protocols/Sametime/src/sametime.cpp index b0b50a6e52..f8966db031 100644 --- a/protocols/Sametime/src/sametime.cpp +++ b/protocols/Sametime/src/sametime.cpp @@ -174,12 +174,12 @@ void __cdecl sttRecvAwayThread(void *param) int CSametimeProto::OnWindowEvent(WPARAM, LPARAM lParam) { - MessageWindowEventData* mwed = (MessageWindowEventData*)lParam; + MessageWindowEventData *mwed = (MessageWindowEventData*)lParam; - if (db_get_b(mwed->hContact, m_szModuleName, "ChatRoom", 0)) + if ((mwed == NULL) || db_get_b(mwed->hContact, m_szModuleName, "ChatRoom", 0)) return 0; - if (mwed && (mwed->uType == MSG_WINDOW_EVT_CLOSING || mwed->uType == MSG_WINDOW_EVT_CLOSE)) + if ((mwed->uType == MSG_WINDOW_EVT_CLOSING) || (mwed->uType == MSG_WINDOW_EVT_CLOSE)) CloseIm(mwed->hContact); return 0; diff --git a/protocols/SkypeClassic/src/gchat.cpp b/protocols/SkypeClassic/src/gchat.cpp index a36884bc11..02046beeca 100644 --- a/protocols/SkypeClassic/src/gchat.cpp +++ b/protocols/SkypeClassic/src/gchat.cpp @@ -595,9 +595,8 @@ void SetChatTopic(const TCHAR *szChatId, TCHAR *szTopic, BOOL bSet) int GCEventHook(WPARAM,LPARAM lParam) { GCHOOK *gch = (GCHOOK*) lParam; - gchat_contacts *gc = GetChat(gch->pDest->ptszID); - if(gch) { + gchat_contacts *gc = GetChat(gch->pDest->ptszID); if (!_stricmp(gch->pDest->pszModule, SKYPE_PROTONAME)) { switch (gch->pDest->iType) { @@ -847,8 +846,10 @@ void GCExit(void) { DeleteCriticalSection (&m_GCMutex); for (int i=0;iresultCode); + debugLog(_T("CSteamProto::PollingThread: %s (%d)"), error, response->resultCode); // token has expired if (response->resultCode == HTTP_STATUS_UNAUTHORIZED) @@ -250,7 +250,7 @@ void CSteamProto::PollingThread(void*) setDword("MessageID", messageId); m_hPollingThread = NULL; - debugLogA("CSteamProto::PollingThread: leaving"); + debugLog(_T("CSteamProto::PollingThread: leaving")); if (!isTerminated) { diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp index e6a72ca52a..8941a73f74 100644 --- a/protocols/Steam/src/steam_proto.cpp +++ b/protocols/Steam/src/steam_proto.cpp @@ -317,7 +317,7 @@ int CSteamProto::SetStatus(int new_status) if (new_status == m_iDesiredStatus) return 0; - debugLogA("CSteamProto::SetStatus: changing status from %i to %i", m_iStatus, new_status); + debugLog(_T("CSteamProto::SetStatus: changing status from %i to %i"), m_iStatus, new_status); int old_status = m_iStatus; m_iDesiredStatus = new_status; diff --git a/protocols/Steam/src/steam_queue.cpp b/protocols/Steam/src/steam_queue.cpp index d500ea708d..b0a7c959d9 100644 --- a/protocols/Steam/src/steam_queue.cpp +++ b/protocols/Steam/src/steam_queue.cpp @@ -117,7 +117,7 @@ void CSteamProto::ExecuteRequest(QueueItem *item) void CSteamProto::QueueThread(void*) { - debugLogA("CSteamProto::QueueThread: entering"); + debugLog(_T("CSteamProto::QueueThread: entering")); while (!isTerminated) { @@ -142,5 +142,5 @@ void CSteamProto::QueueThread(void*) } } - debugLogA("CSteamProto::QueueThread: leaving"); + debugLog(_T("CSteamProto::QueueThread: leaving")); } \ No newline at end of file diff --git a/protocols/Tlen/src/tlen_opt.cpp b/protocols/Tlen/src/tlen_opt.cpp index 110124bced..580de2c3cb 100644 --- a/protocols/Tlen/src/tlen_opt.cpp +++ b/protocols/Tlen/src/tlen_opt.cpp @@ -155,24 +155,30 @@ INT_PTR CALLBACK TlenAccMgrUIDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: { - BOOL reconnectRequired = FALSE; + bool reconnectRequired = false; DBVARIANT dbv; GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, sizeof(text)); - dbv.pszVal = NULL; - if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv) || lstrcmpA(text, dbv.pszVal)) - reconnectRequired = TRUE; - if (dbv.pszVal != NULL) + if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv)) { + reconnectRequired = true; + } + else { + if(lstrcmpA(text, dbv.pszVal)) + reconnectRequired = true; db_free(&dbv); + } db_set_s(NULL, proto->m_szModuleName, "LoginName", strlwr(text)); if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) { GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, sizeof(text)); - dbv.pszVal = NULL; - if (db_get(NULL, proto->m_szModuleName, "Password", &dbv) || lstrcmpA(text, dbv.pszVal)) - reconnectRequired = TRUE; - if (dbv.pszVal != NULL) + if (db_get(NULL, proto->m_szModuleName, "Password", &dbv)) { + reconnectRequired = true; + } + else { + if(lstrcmpA(text, dbv.pszVal)) + reconnectRequired = true; db_free(&dbv); + } db_set_s(NULL, proto->m_szModuleName, "Password", text); } else @@ -276,7 +282,7 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara MarkChanges(1, hwndDlg); break; case IDC_REGISTERACCOUNT: - CallService(MS_UTILS_OPENURL, (WPARAM) 1, (LPARAM) TLEN_REGISTER); + CallService(MS_UTILS_OPENURL, OUF_NEWWINDOW, (LPARAM) TLEN_REGISTER); break; case IDC_OFFLINE_MESSAGE_OPTION: case IDC_ALERT_POLICY: @@ -293,24 +299,30 @@ static INT_PTR CALLBACK TlenBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wPara switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: { - BOOL reconnectRequired = FALSE; + bool reconnectRequired = false; DBVARIANT dbv; GetDlgItemTextA(hwndDlg, IDC_EDIT_USERNAME, text, sizeof(text)); - dbv.pszVal = NULL; - if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv) || lstrcmpA(text, dbv.pszVal)) - reconnectRequired = TRUE; - if (dbv.pszVal != NULL) + if (db_get(NULL, proto->m_szModuleName, "LoginName", &dbv)) { + reconnectRequired = true; + } + else { + if(lstrcmpA(text, dbv.pszVal)) + reconnectRequired = true; db_free(&dbv); + } db_set_s(NULL, proto->m_szModuleName, "LoginName", strlwr(text)); if (IsDlgButtonChecked(hwndDlg, IDC_SAVEPASSWORD)) { GetDlgItemTextA(hwndDlg, IDC_EDIT_PASSWORD, text, sizeof(text)); - dbv.pszVal = NULL; - if (db_get(NULL, proto->m_szModuleName, "Password", &dbv) || lstrcmpA(text, dbv.pszVal)) - reconnectRequired = TRUE; - if (dbv.pszVal != NULL) + if (db_get(NULL, proto->m_szModuleName, "Password", &dbv)) { + reconnectRequired = true; + } + else { + if(lstrcmpA(text, dbv.pszVal)) + reconnectRequired = true; db_free(&dbv); + } db_set_s(NULL, proto->m_szModuleName, "Password", text); } else @@ -512,28 +524,34 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, case PSN_APPLY: WORD port; BOOL useEncryption; - BOOL reconnectRequired = FALSE; + bool reconnectRequired = false; DBVARIANT dbv; GetDlgItemTextA(hwndDlg, IDC_EDIT_LOGIN_SERVER, text, sizeof(text)); - dbv.pszVal = NULL; - if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv) || lstrcmpA(text, dbv.pszVal)) - reconnectRequired = TRUE; - if (dbv.pszVal != NULL) + if (db_get(NULL, proto->m_szModuleName, "LoginServer", &dbv)) { + reconnectRequired = true; + } + else { + if(lstrcmpA(text, dbv.pszVal)) + reconnectRequired = true; db_free(&dbv); + } db_set_s(NULL, proto->m_szModuleName, "LoginServer", strlwr(text)); GetDlgItemTextA(hwndDlg, IDC_HOST, text, sizeof(text)); - dbv.pszVal = NULL; - if (db_get(NULL, proto->m_szModuleName, "ManualHost", &dbv) || lstrcmpA(text, dbv.pszVal)) - reconnectRequired = TRUE; - if (dbv.pszVal != NULL) + if (db_get(NULL, proto->m_szModuleName, "ManualHost", &dbv)) { + reconnectRequired = true; + } + else { + if(lstrcmpA(text, dbv.pszVal)) + reconnectRequired = true; db_free(&dbv); + } db_set_s(NULL, proto->m_szModuleName, "ManualHost", text); port = (WORD) GetDlgItemInt(hwndDlg, IDC_HOSTPORT, NULL, FALSE); if (db_get_w(NULL, proto->m_szModuleName, "ManualPort", TLEN_DEFAULT_PORT) != port) - reconnectRequired = TRUE; + reconnectRequired = true; db_set_w(NULL, proto->m_szModuleName, "ManualPort", port); proto->tlenOptions.sendKeepAlive = IsDlgButtonChecked(hwndDlg, IDC_KEEPALIVE); @@ -541,7 +559,7 @@ static INT_PTR CALLBACK TlenAdvOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, useEncryption = IsDlgButtonChecked(hwndDlg, IDC_USE_SSL); if (db_get_b(NULL, proto->m_szModuleName, "UseEncryption", TRUE) != useEncryption) - reconnectRequired = TRUE; + reconnectRequired = true; db_set_b(NULL, proto->m_szModuleName, "UseEncryption", (BYTE) useEncryption); db_set_b(NULL, proto->m_szModuleName, "VisibilitySupport", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_VISIBILITY_SUPPORT)); diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp index ce97653f71..dff4305394 100644 --- a/protocols/Tlen/src/tlen_voice.cpp +++ b/protocols/Tlen/src/tlen_voice.cpp @@ -111,12 +111,11 @@ static DWORD WINAPI TlenVoiceRecordingThreadProc(TLEN_VOICE_CONTROL *control) static int TlenVoicePlaybackStart(TLEN_VOICE_CONTROL *control) { - WAVEFORMATEX wfm; - MMRESULT mmres; - int i, j; + int i; int iNumDevs, iSelDev; WAVEOUTCAPS wic; + WAVEFORMATEX wfm; memset(&wfm, 0, sizeof(wfm)); wfm.cbSize = sizeof(WAVEFORMATEX); wfm.nChannels = 1; @@ -131,7 +130,7 @@ static int TlenVoicePlaybackStart(TLEN_VOICE_CONTROL *control) control->waveHeadersPos = 0; control->waveHeadersNum = FRAMES_AVAILABLE_MAX_LIMIT + 2; - j = db_get_w(NULL, control->proto->m_szModuleName, "VoiceDeviceOut", 0); + int j = db_get_w(NULL, control->proto->m_szModuleName, "VoiceDeviceOut", 0); iSelDev = WAVE_MAPPER; if (j != 0) { iNumDevs = waveOutGetNumDevs(); @@ -151,7 +150,7 @@ static int TlenVoicePlaybackStart(TLEN_VOICE_CONTROL *control) control->proto->debugLogA("Playback device ID #%u: %s\r\n", iSelDev, wic.szPname); } - mmres = waveOutOpen(&control->hWaveOut, iSelDev, &wfm, (DWORD) &TlenVoicePlaybackCallback, (DWORD) control, CALLBACK_FUNCTION); + MMRESULT mmres = waveOutOpen(&control->hWaveOut, iSelDev, &wfm, (DWORD_PTR) &TlenVoicePlaybackCallback, (DWORD) control, CALLBACK_FUNCTION); if (mmres != MMSYSERR_NOERROR) { control->proto->debugLogA("TlenVoiceStart FAILED!"); return 1; @@ -167,7 +166,6 @@ static int TlenVoicePlaybackStart(TLEN_VOICE_CONTROL *control) static int TlenVoiceRecordingStart(TLEN_VOICE_CONTROL *control) { WAVEFORMATEX wfm; - MMRESULT mmres; int i, j; int iNumDevs, iSelDev; WAVEINCAPS wic; @@ -218,7 +216,7 @@ static int TlenVoiceRecordingStart(TLEN_VOICE_CONTROL *control) control->proto->debugLogA("Recording device ID #%u: %s\r\n", iSelDev, wic.szPname); } - mmres = waveInOpen(&control->hWaveIn, iSelDev, &wfm, (DWORD) control->threadID, 0, CALLBACK_THREAD); + MMRESULT mmres = waveInOpen(&control->hWaveIn, iSelDev, &wfm, control->threadID, 0, CALLBACK_THREAD); // mmres = waveInOpen(&control->hWaveIn, 3, &wfm, (DWORD) &TlenVoiceRecordingCallback, (DWORD) control, CALLBACK_FUNCTION); if (mmres != MMSYSERR_NOERROR) { PostThreadMessage(control->threadID, WIM_CLOSE, 0, 0); @@ -251,8 +249,7 @@ static int TlenVoiceRecordingStart(TLEN_VOICE_CONTROL *control) static TLEN_VOICE_CONTROL *TlenVoiceCreateVC(TlenProtocol *proto, int codec) { - TLEN_VOICE_CONTROL *vc; - vc = (TLEN_VOICE_CONTROL *) mir_alloc(sizeof (TLEN_VOICE_CONTROL)); + TLEN_VOICE_CONTROL *vc = (TLEN_VOICE_CONTROL *) mir_alloc(sizeof (TLEN_VOICE_CONTROL)); memset(vc, 0, sizeof(TLEN_VOICE_CONTROL)); vc->gsmstate = gsm_create(); vc->codec = codec; @@ -261,7 +258,6 @@ static TLEN_VOICE_CONTROL *TlenVoiceCreateVC(TlenProtocol *proto, int codec) } static void TlenVoiceFreeVc(TLEN_VOICE_CONTROL *vc) { - int i; vc->proto->debugLogA("-> TlenVoiceFreeVc"); vc->stopThread = 1; PostThreadMessage(vc->threadID, MM_WIM_CLOSE, 0, 0); @@ -270,7 +266,7 @@ static void TlenVoiceFreeVc(TLEN_VOICE_CONTROL *vc) } if (vc->hThread != NULL) CloseHandle(vc->hThread); if (vc->hWaveIn) { - for (i=0;iwaveHeadersNum;i++) { + for (int i=0;iwaveHeadersNum;i++) { while (waveInUnprepareHeader(vc->hWaveIn, &vc->waveHeaders[i], sizeof(WAVEHDR)) == WAVERR_STILLPLAYING) { Sleep(50); } @@ -280,7 +276,7 @@ static void TlenVoiceFreeVc(TLEN_VOICE_CONTROL *vc) } } if (vc->hWaveOut) { - for (i=0;iwaveHeadersNum;i++) { + for (int i=0;iwaveHeadersNum;i++) { while (waveOutUnprepareHeader(vc->hWaveOut, &vc->waveHeaders[i], sizeof(WAVEHDR)) == WAVERR_STILLPLAYING) { Sleep(50); } @@ -344,15 +340,13 @@ void __cdecl TlenVoiceReceiveThread(TLEN_FILE_TRANSFER *ft) ft->pfnNewConnectionV2 = TlenVoiceReceivingConnection; s = TlenP2PListen(ft); if (s != NULL) { - HANDLE hEvent; - char *nick; SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Waiting for connection...")); ft->s = s; - hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); ft->hFileEvent = hEvent; ft->currentFile = 0; ft->state = FT_CONNECTING; - nick = TlenNickFromJID(ft->jid); + char *nick = TlenNickFromJID(ft->jid); TlenSend(ft->proto, "", nick, ft->iqId, ft->localName, ft->wLocalPort); mir_free(nick); ft->proto->debugLogA("Waiting for the file to be received..."); @@ -385,10 +379,9 @@ void __cdecl TlenVoiceReceiveThread(TLEN_FILE_TRANSFER *ft) static void TlenVoiceReceivingConnection(HANDLE hConnection, DWORD dwRemoteIP, void * pExtra) { HANDLE slisten; - TLEN_FILE_TRANSFER *ft; TlenProtocol *proto = (TlenProtocol *)pExtra; - ft = TlenP2PEstablishIncomingConnection(proto, hConnection, LIST_VOICE, FALSE); + TLEN_FILE_TRANSFER *ft = TlenP2PEstablishIncomingConnection(proto, hConnection, LIST_VOICE, FALSE); if (ft != NULL) { slisten = ft->s; ft->s = hConnection; @@ -426,8 +419,7 @@ static void TlenVoiceReceiveParse(TLEN_FILE_TRANSFER *ft) int i, j; char *p; float val; - TLEN_FILE_PACKET *packet; - packet = TlenP2PPacketReceive(ft->s); + TLEN_FILE_PACKET *packet = TlenP2PPacketReceive(ft->s); if (packet != NULL) { statusTxt = " Unknown packet "; p = packet->packet; @@ -529,13 +521,11 @@ static void TlenVoiceReceiveParse(TLEN_FILE_TRANSFER *ft) void __cdecl TlenVoiceSendingThread(TLEN_FILE_TRANSFER *ft) { - HANDLE s = NULL; - HANDLE hEvent; char *nick; ft->proto->debugLogA("Thread started: type=voice_send"); ft->pfnNewConnectionV2 = TlenVoiceReceivingConnection; - s = TlenP2PListen(ft); + HANDLE s = TlenP2PListen(ft); if (s != NULL) { SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Waiting for connection...")); //ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0); @@ -543,7 +533,7 @@ void __cdecl TlenVoiceSendingThread(TLEN_FILE_TRANSFER *ft) //TlenLog("ft->s = %d", s); //TlenLog("fileCount = %d", ft->fileCount); - hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); + HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); ft->hFileEvent = hEvent; ft->currentFile = 0; ft->state = FT_CONNECTING; @@ -619,11 +609,11 @@ void __cdecl TlenVoiceSendingThread(TLEN_FILE_TRANSFER *ft) static void TlenVoiceSendParse(TLEN_FILE_TRANSFER *ft) { - int codec, i; - TLEN_FILE_PACKET *packet; + int i; - codec = ft->proto->recordingControl->codec; - if ((packet=TlenP2PPacketCreate(sizeof(DWORD)+MODE_FRAME_SIZE[codec]*33)) != NULL) { + int codec = ft->proto->recordingControl->codec; + TLEN_FILE_PACKET *packet = TlenP2PPacketCreate(sizeof(DWORD)+MODE_FRAME_SIZE[codec]*33); + if (packet != NULL) { short *in; float val; in = ft->proto->recordingControl->recordingData; @@ -658,12 +648,12 @@ static void TlenVoiceSendParse(TLEN_FILE_TRANSFER *ft) int TlenVoiceCancelAll(TlenProtocol *proto) { - TLEN_LIST_ITEM *item; HANDLE hEvent; int i = 0; while ((i=TlenListFindNext(proto, LIST_VOICE, 0)) >=0 ) { - if ((item=TlenListGetItemPtrFromIndex(proto, i)) != NULL) { + TLEN_LIST_ITEM *item = TlenListGetItemPtrFromIndex(proto, i); + if (item != NULL) { TLEN_FILE_TRANSFER *ft = item->ft; TlenListRemoveByIndex(proto, i); if (ft != NULL) { @@ -693,19 +683,18 @@ int TlenVoiceCancelAll(TlenProtocol *proto) INT_PTR TlenProtocol::VoiceContactMenuHandleVoice(WPARAM wParam, LPARAM lParam) { - MCONTACT hContact; - DBVARIANT dbv; - TLEN_LIST_ITEM *item; - TLEN_FILE_TRANSFER *ft; if (!isOnline) return 1; - if ((hContact=wParam) != NULL) { + MCONTACT hContact = (MCONTACT) wParam; + if (hContact != NULL) { + DBVARIANT dbv; if (!db_get(hContact, m_szModuleName, "jid", &dbv)) { char serialId[32]; mir_snprintf(serialId, SIZEOF(serialId), "%d", TlenSerialNext(this)); - if ((item = TlenListAdd(this, LIST_VOICE, serialId)) != NULL) { - ft = TlenFileCreateFT(this, dbv.pszVal); + TLEN_LIST_ITEM *item = TlenListAdd(this, LIST_VOICE, serialId); + if (item != NULL) { + TLEN_FILE_TRANSFER *ft = TlenFileCreateFT(this, dbv.pszVal); ft->iqId = mir_strdup(serialId); item->ft = ft; TlenVoiceStart(ft, 2); @@ -727,9 +716,7 @@ int TlenVoiceIsInUse(TlenProtocol *proto) { static HBITMAP TlenVoiceMakeBitmap(int w, int h, int bpp, void *ptr) { - BITMAPINFO bmih; - HBITMAP hbm; - HDC hdc; + BITMAPINFO bmih; bmih.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); bmih.bmiHeader.biWidth = w&0xFFFFFFFC; bmih.bmiHeader.biHeight = h;//&0xFFFFFFFC; @@ -741,8 +728,8 @@ static HBITMAP TlenVoiceMakeBitmap(int w, int h, int bpp, void *ptr) bmih.bmiHeader.biYPelsPerMeter = 0; bmih.bmiHeader.biClrUsed = 0; bmih.bmiHeader.biClrImportant = 0; - hdc = CreateDC(_T("DISPLAY"), NULL, NULL, NULL); - hbm = CreateDIBitmap(hdc, (PBITMAPINFOHEADER) &bmih, CBM_INIT, ptr, &bmih, DIB_RGB_COLORS); + HDC hdc = CreateDC(_T("DISPLAY"), NULL, NULL, NULL); + HBITMAP hbm = CreateDIBitmap(hdc, (PBITMAPINFOHEADER) &bmih, CBM_INIT, ptr, &bmih, DIB_RGB_COLORS); ReleaseDC(NULL,hdc); return hbm; } @@ -920,7 +907,7 @@ static void __cdecl TlenVoiceDlgThread(void *ptr) { TLEN_FILE_TRANSFER *ft = (TLEN_FILE_TRANSFER *)ptr; - TlenProtocol * proto = ft->proto; + TlenProtocol *proto = ft->proto; DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_VOICE), NULL, TlenVoiceDlgProc, (LPARAM) proto); TlenVoiceCancelAll(proto); } @@ -1073,7 +1060,8 @@ int TlenVoiceAccept(TlenProtocol *proto, const char *id, const char *from) } int TlenVoiceBuildInDeviceList(TlenProtocol *proto, HWND hWnd) -{ int i, j, iNumDevs; +{ + int i, j, iNumDevs; WAVEINCAPS wic; iNumDevs = waveInGetNumDevs(); SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)TranslateT("Default")); @@ -1092,7 +1080,8 @@ int TlenVoiceBuildInDeviceList(TlenProtocol *proto, HWND hWnd) } int TlenVoiceBuildOutDeviceList(TlenProtocol *proto, HWND hWnd) -{ int i, j, iNumDevs; +{ + int i, j, iNumDevs; WAVEOUTCAPS woc; iNumDevs = waveInGetNumDevs(); SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)TranslateT("Default")); diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index 91716d916e..9dc10e69ee 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -637,8 +637,8 @@ int CVkProto::AuthDeny(HANDLE hDbEvent, const PROTOCHAR *reason) return 1; MCONTACT hContact = MContactFromDbEvent(hDbEvent); if (hContact == -1) - return 1; - + return 1; + return SvcDeleteFriend(hContact,(LPARAM)true); } diff --git a/protocols/Yahoo/src/libyahoo2/libyahoo2.cpp b/protocols/Yahoo/src/libyahoo2/libyahoo2.cpp index 88bf217d28..1b178f580e 100644 --- a/protocols/Yahoo/src/libyahoo2/libyahoo2.cpp +++ b/protocols/Yahoo/src/libyahoo2/libyahoo2.cpp @@ -4484,7 +4484,7 @@ static void yahoo_process_search_connection(struct yahoo_input_data *yid, int ov yct->age = atoi(cp); break; case 5: - if (cp != "\005") + if (strcmp(cp,"\005")) yct->location = cp; k = 0; break; diff --git a/protocols/Yahoo/src/options.cpp b/protocols/Yahoo/src/options.cpp index 9ca0b249ba..237f5e49ce 100644 --- a/protocols/Yahoo/src/options.cpp +++ b/protocols/Yahoo/src/options.cpp @@ -98,22 +98,25 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, char str[128]; GetDlgItemTextA(hwndDlg, IDC_HANDLE, str, sizeof( str )); - dbv.pszVal = NULL; - - if ( ppro->getString( YAHOO_LOGINID, &dbv) || lstrcmpA( str, dbv.pszVal )) + if (ppro->getString(YAHOO_LOGINID, &dbv)) { reconnectRequired = true; - - if ( dbv.pszVal != NULL) + } + else { + if(lstrcmpA(str, dbv.pszVal)) + reconnectRequired = true; db_free(&dbv); - + } ppro->setString( YAHOO_LOGINID, str ); GetDlgItemTextA(hwndDlg, IDC_PASSWORD, str, sizeof( str )); - dbv.pszVal = NULL; - if ( ppro->getString( YAHOO_PASSWORD, &dbv) || lstrcmpA( str, dbv.pszVal )) + if (ppro->getString(YAHOO_PASSWORD, &dbv)) { reconnectRequired = true; - if ( dbv.pszVal != NULL) + } + else { + if(lstrcmpA(str, dbv.pszVal)) + reconnectRequired = true; db_free(&dbv); + } ppro->setString( YAHOO_PASSWORD, str ); GetDlgItemTextA(hwndDlg, IDC_NICK, str, sizeof( str )); @@ -133,11 +136,12 @@ static INT_PTR CALLBACK DlgProcYahooOpts(HWND hwndDlg, UINT msg, WPARAM wParam, ppro->setByte("DisableYahoomail", (BYTE)!IsDlgButtonChecked(hwndDlg, IDC_DISABLEYAHOOMAIL)); ppro->setByte("ShowErrors", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SHOW_ERRORS)); - if (reconnectRequired) + if (reconnectRequired) { ppro->delSetting(YAHOO_PWTOKEN); + if (ppro->m_bLoggedIn ) + MessageBox(hwndDlg, TranslateT("The changes you have made require you to reconnect to the Yahoo network before they take effect"), TranslateT("YAHOO Options"), MB_OK ); - if ( reconnectRequired && ppro->m_bLoggedIn ) - MessageBoxA(hwndDlg, Translate("The changes you have made require you to reconnect to the Yahoo network before they take effect"), Translate("YAHOO Options"), MB_OK ); + } return TRUE; } @@ -207,29 +211,32 @@ static INT_PTR CALLBACK DlgProcYahooOptsConn(HWND hwndDlg, UINT msg, WPARAM wPar case WM_NOTIFY: if (((LPNMHDR)lParam)->code == PSN_APPLY ) { - BOOL reconnectRequired = FALSE; + bool reconnectRequired = false; char str[128]; GetDlgItemTextA(hwndDlg, IDC_LOGINSERVER, str, sizeof( str )); DBVARIANT dbv; - dbv.pszVal = NULL; - if ( ppro->getString( YAHOO_LOGINSERVER, &dbv) || lstrcmpA( str, dbv.pszVal )) - reconnectRequired = TRUE; - if ( dbv.pszVal != NULL) + if (ppro->getString(YAHOO_LOGINSERVER, &dbv)) { + reconnectRequired = true; + } + else { + if(lstrcmpA(str, dbv.pszVal)) + reconnectRequired = true; db_free(&dbv); + } ppro->setString(YAHOO_LOGINSERVER, str); int port = GetDlgItemInt(hwndDlg, IDC_YAHOOPORT, NULL, FALSE ); if ( ppro->getWord(YAHOO_LOGINPORT, -1) != port) - reconnectRequired = TRUE; + reconnectRequired = true; ppro->setWord(YAHOO_LOGINPORT, port); ppro->setByte("YahooJapan", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_YAHOO_JAPAN )); if ( reconnectRequired && ppro->m_bLoggedIn ) - MessageBoxA(hwndDlg, Translate("The changes you have made require you to reconnect to the Yahoo network before they take effect"), Translate("YAHOO Options"), MB_OK ); + MessageBox(hwndDlg, TranslateT("The changes you have made require you to reconnect to the Yahoo network before they take effect"), TranslateT("YAHOO Options"), MB_OK ); return TRUE; } @@ -353,7 +360,7 @@ static INT_PTR CALLBACK DlgProcYahooOptsIgnore(HWND hwndDlg, UINT msg, WPARAM wP * YahooOptInit - initialize/register our Options w/ Miranda. */ -int __cdecl CYahooProto::OnOptionsInit(WPARAM wParam,LPARAM lParam) +int __cdecl CYahooProto::OnOptionsInit(WPARAM wParam,LPARAM) { OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = -790000000; diff --git a/src/modules/chat/tools.cpp b/src/modules/chat/tools.cpp index ae118c1cb2..527b6307ac 100644 --- a/src/modules/chat/tools.cpp +++ b/src/modules/chat/tools.cpp @@ -128,7 +128,7 @@ BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce) ///////////////////////////////////////////////////////////////////////////////////////// -static void __stdcall ShowRoomFromPopup(void * pi) +static void __stdcall ShowRoomFromPopup(void *pi) { SESSION_INFO *si = (SESSION_INFO*)pi; ci.ShowRoom(si, WINDOW_VISIBLE, TRUE); diff --git a/src/modules/fonts/FontOptions.cpp b/src/modules/fonts/FontOptions.cpp index 20fb53871a..4d72a7d8bb 100644 --- a/src/modules/fonts/FontOptions.cpp +++ b/src/modules/fonts/FontOptions.cpp @@ -176,14 +176,14 @@ BOOL ExportSettings(HWND hwndDlg, TCHAR *filename, OBJLIST& flist, SelectObject(hdc, hOldFont); DeleteObject(hFont); - strncat(buff, _itoa((BYTE)size.cy, abuff, 10), SIZEOF(buff)); + strncat(buff, _itoa((BYTE)size.cy, abuff, 10), sizeof(buff)); } else if (F.flags & FIDF_SAVEPOINTSIZE) { HDC hdc = GetDC(hwndDlg); - strncat(buff, _itoa((BYTE)-MulDiv(F.value.size, 72, GetDeviceCaps(hdc, LOGPIXELSY)), abuff, 10), SIZEOF(buff)); + strncat(buff, _itoa((BYTE)-MulDiv(F.value.size, 72, GetDeviceCaps(hdc, LOGPIXELSY)), abuff, 10), sizeof(buff)); ReleaseDC(hwndDlg, hdc); } - else strncat(buff, _itoa((BYTE)F.value.size, abuff, 10), SIZEOF(buff)); + else strncat(buff, _itoa((BYTE)F.value.size, abuff, 10), sizeof(buff)); WriteLine(fhand, buff); diff --git a/src/modules/metacontacts/meta_edit.cpp b/src/modules/metacontacts/meta_edit.cpp index 20bbf3680d..245ca22fde 100644 --- a/src/modules/metacontacts/meta_edit.cpp +++ b/src/modules/metacontacts/meta_edit.cpp @@ -293,7 +293,7 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara HWND hwndOffline = GetDlgItem(hwndDlg, IDC_BTN_SETOFFLINE); EnableWindow(hwndOffline, sel != -1); - SetWindowText(hwndOffline, TranslateTS((sel != -1 && g_data.hContact[sel] != g_data.hOfflineContact) ? LPGENT("Send &offline") : LPGENT("Send &online"))); + SetWindowText(hwndOffline, (sel != -1 && g_data.hContact[sel] != g_data.hOfflineContact) ? TranslateT("Send &offline") : TranslateT("Send &online")); } } break; diff --git a/src/modules/protocols/protoopts.cpp b/src/modules/protocols/protoopts.cpp index ce801ca8fe..4b5c6eba6d 100644 --- a/src/modules/protocols/protoopts.cpp +++ b/src/modules/protocols/protoopts.cpp @@ -851,8 +851,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM TCHAR buf[200]; mir_sntprintf(buf, SIZEOF(buf), TranslateT("Account %s is being deleted"), pa->tszAccountName); if (pa->bOldProto) { - MessageBox(hwndDlg, TranslateT("You need to disable plugin to delete this account"), buf, - MB_ICONERROR | MB_OK); + MessageBox(hwndDlg, TranslateT("You need to disable plugin to delete this account"), buf, MB_ICONERROR | MB_OK); break; } if (IDYES == MessageBox(hwndDlg, errMsg, buf, MB_ICONWARNING | MB_DEFBUTTON2 | MB_YESNO)) { -- cgit v1.2.3