From 4a6b3a2acf91421a958b9946e15a149cac29e7b5 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 17 Aug 2015 19:39:01 +0000 Subject: warning fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@14980 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/DbEditorPP/src/copymodule.cpp | 53 ++++++++++++++++----------------- plugins/DbEditorPP/src/exportimport.cpp | 42 ++++++++++---------------- plugins/DbEditorPP/src/renamemodule.cpp | 10 +++---- 3 files changed, 45 insertions(+), 60 deletions(-) (limited to 'plugins/DbEditorPP/src') diff --git a/plugins/DbEditorPP/src/copymodule.cpp b/plugins/DbEditorPP/src/copymodule.cpp index 8e13789c0a..424b43837f 100644 --- a/plugins/DbEditorPP/src/copymodule.cpp +++ b/plugins/DbEditorPP/src/copymodule.cpp @@ -8,7 +8,7 @@ void copyModule(const char *module, MCONTACT hContactFrom, MCONTACT hContactTo) return; DBVARIANT dbv; - for(ModSetLinkLinkItem *setting = msll.first; setting; setting = setting->next) { + for (ModSetLinkLinkItem *setting = msll.first; setting; setting = setting->next) { if (!db_get_s(hContactFrom, module, setting->name, &dbv, 0)) { db_set(hContactTo, module, setting->name, &dbv); db_free(&dbv); @@ -17,47 +17,45 @@ void copyModule(const char *module, MCONTACT hContactFrom, MCONTACT hContactTo) FreeModuleSettingLL(&msll); } -INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - switch (msg) { + ModuleAndContact *mac = (ModuleAndContact *)GetWindowLongPtr(hwnd, GWLP_USERDATA); + + switch (uMsg) { case WM_INITDIALOG: - { TranslateDialogDefault(hwnd); SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); - ModuleAndContact *mac = (ModuleAndContact *)lParam; - TCHAR name[NAME_SIZE], msg[MSG_SIZE]; + { + mac = (ModuleAndContact *)lParam; + TCHAR name[NAME_SIZE], msg[MSG_SIZE]; - mir_sntprintf(msg, TranslateT("Copy module \"%s\""), _A2T(mac->module)); - SetWindowText(hwnd, msg); + mir_sntprintf(msg, TranslateT("Copy module \"%s\""), _A2T(mac->module)); + SetWindowText(hwnd, msg); - for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) - { - if (ApplyProtoFilter(hContact)) - continue; + for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + if (ApplyProtoFilter(hContact)) + continue; - GetContactName(hContact, NULL, name, _countof(name)); - - int index = SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_ADDSTRING, 0, (LPARAM)name); - SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETITEMDATA, index, hContact); - } + GetContactName(hContact, NULL, name, _countof(name)); + + int index = SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_ADDSTRING, 0, (LPARAM)name); + SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETITEMDATA, index, hContact); + } - GetContactName(NULL, NULL, name, _countof(name)); - int index = (int)SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_INSERTSTRING, 0, (LPARAM)name); - SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETITEMDATA, index, 0); - SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETCURSEL, index, 0); + GetContactName(NULL, NULL, name, _countof(name)); + int index = (int)SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_INSERTSTRING, 0, (LPARAM)name); + SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETITEMDATA, index, 0); + SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_SETCURSEL, index, 0); + } break; - } - case WM_COMMAND: - { - ModuleAndContact *mac = (ModuleAndContact *)GetWindowLongPtr(hwnd, GWLP_USERDATA); + case WM_COMMAND: switch (LOWORD(wParam)) { case CHK_COPY2ALL: EnableWindow(GetDlgItem(hwnd, IDC_CONTACTS), BST_UNCHECKED == IsDlgButtonChecked(hwnd, CHK_COPY2ALL)); break; case IDOK: - if (BST_UNCHECKED == IsDlgButtonChecked(hwnd, CHK_COPY2ALL)) { MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_GETITEMDATA, SendDlgItemMessage(hwnd, IDC_CONTACTS, CB_GETCURSEL, 0, 0), 0); copyModule(mac->module, mac->hContact, hContact); @@ -70,7 +68,7 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara SetCursor(LoadCursor(NULL, IDC_ARROW)); } refreshTree(1); - // fall through + // fall through case IDCANCEL: mir_free(mac); DestroyWindow(hwnd); @@ -78,7 +76,6 @@ INT_PTR CALLBACK copyModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara } break; } - } //switch return 0; } diff --git a/plugins/DbEditorPP/src/exportimport.cpp b/plugins/DbEditorPP/src/exportimport.cpp index f543a32f28..5f118fd7a6 100644 --- a/plugins/DbEditorPP/src/exportimport.cpp +++ b/plugins/DbEditorPP/src/exportimport.cpp @@ -1,6 +1,5 @@ #include "stdafx.h" - TCHAR *GetFilter() { static TCHAR filter[MAX_PATH]; @@ -8,10 +7,8 @@ TCHAR *GetFilter() return filter; } - int Openfile(TCHAR *outputFile, const char *module, int maxlen) { - OPENFILENAME ofn = { 0 }; TCHAR filename[MAX_PATH]; if (module) { @@ -31,11 +28,10 @@ int Openfile(TCHAR *outputFile, const char *module, int maxlen) } n++; } - } - else - filename[0] = 0; - + } + else filename[0] = 0; + OPENFILENAME ofn = { 0 }; ofn.lStructSize = sizeof(ofn); ofn.lpstrFile = filename; ofn.lpstrFilter = GetFilter(); @@ -118,13 +114,13 @@ char* NickFromHContact(MCONTACT hContact) if (!db_get_static(hContact, "Protocol", "p", szProto, _countof(szProto))) loaded = Proto_GetAccount(szProto) ? 1 : 0; - if (!szProto[0] || db_get_static(hContact, szProto, "Nick", name, _countof(name))) + if (!szProto[0] || db_get_static(hContact, szProto, "Nick", name, _countof(name))) mir_strncpy(name, "(UNKNOWN)", _countof(name)); - + if (!loaded) { if (szProto[0]) mir_snprintf(nick, _countof(nick), "%s (%s)", name, szProto); - else + else mir_strncpy(nick, name, _countof(nick)); } else { @@ -134,8 +130,7 @@ char* NickFromHContact(MCONTACT hContact) GetValueA(hContact, szProto, uid, szUID, _countof(szUID)); mir_snprintf(nick, _countof(nick), "%s *(%s)*<%s>*{%s}*", name, szProto, uid, szUID); } - else - mir_snprintf(nick, _countof(nick), "%s (%s)", name, szProto); + else mir_snprintf(nick, _countof(nick), "%s (%s)", name, szProto); } } @@ -192,7 +187,7 @@ void exportDB(MCONTACT hContact, const char *module) fprintf(file, "\n\n"); while (hContact) { - + if (ApplyProtoFilter(hContact)) { hContact = db_find_next(hContact); continue; @@ -400,10 +395,10 @@ void importSettings(MCONTACT hContact, char *utf8) for (char *pstr = end + 2; *pstr; pstr++) { if (*pstr == '\\') { switch (pstr[1]) { - case 'n': *pstr = '\n'; break; - case 't': *pstr = '\t'; break; - case 'r': *pstr = '\r'; break; - default: *pstr = pstr[1]; break; + case 'n': *pstr = '\n'; break; + case 't': *pstr = '\t'; break; + case 'r': *pstr = '\r'; break; + default: *pstr = pstr[1]; break; } memmove(pstr + 1, pstr + 2, mir_strlen(pstr + 2) + 1); } @@ -430,10 +425,9 @@ void importSettings(MCONTACT hContact, char *utf8) SetCursor(LoadCursor(NULL, IDC_ARROW)); } - -INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - switch (msg) { + switch (uMsg) { case WM_INITDIALOG: SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); TranslateDialogDefault(hwnd); @@ -450,7 +444,6 @@ INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam case WM_COMMAND: switch (LOWORD(wParam)) { - case IDCANCEL: DestroyWindow(hwnd); break; @@ -471,16 +464,13 @@ INT_PTR CALLBACK ImportDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam return 0; } - void ImportSettingsMenuItem(MCONTACT hContact) { CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_IMPORT), hwnd2mainWindow, ImportDlgProc, hContact); } - int Openfile2Import(TCHAR *outputFiles, int maxlen) { - OPENFILENAME ofn = { 0 }; ofn.lStructSize = sizeof(ofn); ofn.lpstrFilter = GetFilter(); @@ -508,12 +498,12 @@ void ImportSettingsFromFileMenuItem(MCONTACT hContact, const char *FilePath) DWORD offset = 0; - mir_tstrcpy(szFileNames, _T("")); + mir_tstrcpy(szFileNames, _T("")); if (!FilePath) offset = Openfile2Import(szFileNames, _countof(szFileNames)); else { - _A2T tmp(FilePath); + _A2T tmp(FilePath); if (GetFileAttributes(tmp) != INVALID_FILE_ATTRIBUTES) mir_tstrncpy(szFileNames, tmp, _countof(szFileNames)); } diff --git a/plugins/DbEditorPP/src/renamemodule.cpp b/plugins/DbEditorPP/src/renamemodule.cpp index 42a4bc69a1..d2addc9fc3 100644 --- a/plugins/DbEditorPP/src/renamemodule.cpp +++ b/plugins/DbEditorPP/src/renamemodule.cpp @@ -23,9 +23,9 @@ int renameModule(MCONTACT hContact, const char *oldName, const char *newName) return cnt; } -INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) +INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - switch (msg) { + switch (uMsg) { case WM_INITDIALOG: SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); TranslateDialogDefault(hwnd); @@ -35,8 +35,8 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam mir_sntprintf(msg, TranslateT("Add module to \"%s\""), name); SetWindowText(hwnd, msg); + break; - break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: @@ -49,8 +49,7 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) db_set_b(hContact, modulename, "(Default)", 0); } - else - db_set_b((MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA), modulename, "(Default)", 0); + else db_set_b((MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA), modulename, "(Default)", 0); refreshTree(1); } @@ -63,7 +62,6 @@ INT_PTR CALLBACK AddModDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam return 0; } - void addModuleDlg(MCONTACT hContact) { CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ADD_MODULE), hwnd2mainWindow, AddModDlgProc, hContact); -- cgit v1.2.3