From ad9ea188764830dad666490867c07a9891b7e854 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sun, 14 Dec 2014 14:52:25 +0000 Subject: CrashDumper: changed warning lavel to w4 git-svn-id: http://svn.miranda-ng.org/main/trunk@11410 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/CrashDumper/crshdmp_12.vcxproj | 8 +-- plugins/CrashDumper/src/crshdmp.cpp | 10 ++-- plugins/CrashDumper/src/crshdmp_icons.cpp | 14 +++--- plugins/CrashDumper/src/dumper.cpp | 10 ++-- plugins/CrashDumper/src/exhndlr.cpp | 2 +- plugins/CrashDumper/src/ui.cpp | 84 +++++++++++++++---------------- plugins/CrashDumper/src/upload.cpp | 6 ++- plugins/CrashDumper/src/utils.cpp | 2 +- plugins/CrashDumper/src/utils.h | 6 +-- 9 files changed, 70 insertions(+), 72 deletions(-) (limited to 'plugins') diff --git a/plugins/CrashDumper/crshdmp_12.vcxproj b/plugins/CrashDumper/crshdmp_12.vcxproj index 895acadfe6..25b860eef5 100644 --- a/plugins/CrashDumper/crshdmp_12.vcxproj +++ b/plugins/CrashDumper/crshdmp_12.vcxproj @@ -85,7 +85,7 @@ false false Fast - Level3 + Level4 OnlyExplicitInline Use utils.h @@ -118,7 +118,7 @@ false false Fast - Level3 + Level4 OnlyExplicitInline Use utils.h @@ -148,7 +148,7 @@ EnableFastChecks MultiThreadedDebugDLL Fast - Level3 + Level4 EditAndContinue false Use @@ -178,7 +178,7 @@ EnableFastChecks MultiThreadedDebugDLL Fast - Level3 + Level4 false Use utils.h diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index e517913700..e66d7796ae 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -191,8 +191,8 @@ static int FoldersPathChanged(WPARAM, LPARAM) fgd.cbSize = sizeof(FOLDERSGETDATA); fgd.nMaxPathSize = MAX_PATH; fgd.flags = FF_TCHAR; -// fgd.szPathT = CrashLogFolder; -// CallService(MS_FOLDERS_GET_PATH, (WPARAM)hCrashLogFolder, (LPARAM)&fgd); + // fgd.szPathT = CrashLogFolder; + // CallService(MS_FOLDERS_GET_PATH, (WPARAM)hCrashLogFolder, (LPARAM)&fgd); fgd.szPathT = VersionInfoFolder; CallService(MS_FOLDERS_GET_PATH, (WPARAM)hVerInfoFolder, (LPARAM)&fgd); @@ -250,7 +250,7 @@ static int ModulesLoaded(WPARAM, LPARAM) replaceStrT(profpath, _T("%miranda_userdata%")); // Removed because it isn't available on Load() -// hCrashLogFolder = FoldersRegisterCustomPathT(PluginName, LPGEN("Crash Reports"), CrashLogFolder); + // hCrashLogFolder = FoldersRegisterCustomPathT(PluginName, LPGEN("Crash Reports"), CrashLogFolder); hVerInfoFolder = FoldersRegisterCustomPathT(PluginName, LPGEN("Version Information"), VersionInfoFolder); HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersPathChanged); @@ -337,7 +337,7 @@ static int ModulesLoaded(WPARAM, LPARAM) hk.pszName = "ShowVerInfo"; hk.pszService = MS_CRASHDUMPER_VIEWINFO; Hotkey_Register(&hk); - + UploadInit(); if (catchcrashes && !needrestart) @@ -413,7 +413,7 @@ extern "C" int __declspec(dllexport) Unload(void) return 0; } -extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID /*lpvReserved*/) +extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) { hInst = hinstDLL; return TRUE; diff --git a/plugins/CrashDumper/src/crshdmp_icons.cpp b/plugins/CrashDumper/src/crshdmp_icons.cpp index ff6f23520a..faf7298705 100644 --- a/plugins/CrashDumper/src/crshdmp_icons.cpp +++ b/plugins/CrashDumper/src/crshdmp_icons.cpp @@ -20,12 +20,12 @@ along with this program. If not, see . static IconItem iconList[] = { - { LPGEN("Version Information"), "versionInfo", IDI_VI }, - { LPGEN("Copy To Clipboard"), "storeToClip", IDI_VITOCLIP }, - { LPGEN("Store to file"), "storeToFile", IDI_VITOFILE }, - { LPGEN("Show"), "showInfo", IDI_VISHOW }, - { LPGEN("Upload"), "uploadInfo", IDI_VIUPLOAD }, - { LPGEN("Copy link to clipboard"), "linkToClip", IDI_LINKTOCLIP}, + { LPGEN("Version Information"), "versionInfo", IDI_VI }, + { LPGEN("Copy To Clipboard"), "storeToClip", IDI_VITOCLIP }, + { LPGEN("Store to file"), "storeToFile", IDI_VITOFILE }, + { LPGEN("Show"), "showInfo", IDI_VISHOW }, + { LPGEN("Upload"), "uploadInfo", IDI_VIUPLOAD }, + { LPGEN("Copy link to clipboard"), "linkToClip", IDI_LINKTOCLIP }, }; void InitIcons(void) @@ -37,7 +37,7 @@ HICON LoadIconEx(int iconId, bool big) { for (int i = 0; i < SIZEOF(iconList); i++) if (iconList[i].defIconID == iconId) - return Skin_GetIconByHandle(iconList[i].hIcolib); + return Skin_GetIconByHandle(iconList[i].hIcolib, big); return NULL; } diff --git a/plugins/CrashDumper/src/dumper.cpp b/plugins/CrashDumper/src/dumper.cpp index 4418b40111..99317570b1 100644 --- a/plugins/CrashDumper/src/dumper.cpp +++ b/plugins/CrashDumper/src/dumper.cpp @@ -250,7 +250,6 @@ static void GetPluginsString(CMString& buffer, unsigned& flags) ListItem* lsttmp = dlllist; ListItem* lsttmppv = NULL; while (lsttmp != NULL) { - size_t sz = min(lsttmp->str.GetLength(), lst->str.GetLength()) - 2; if (lsttmp->str.CompareNoCase(lst->str) > 0) break; lsttmppv = lsttmp; @@ -268,8 +267,7 @@ static void GetPluginsString(CMString& buffer, unsigned& flags) ++count; } if (loaded) FreeLibrary(hModule); - } - while (FindNextFile(hFind, &FindFileData)); + } while (FindNextFile(hFind, &FindFileData)); FindClose(hFind); buffer.AppendFormat(TEXT("\r\n%sActive Plugins (%u):%s\r\n"), @@ -411,8 +409,7 @@ static void GetWeatherStrings(CMString& buffer, unsigned flags) timebuf, id); CloseHandle(hDumpFile); } - } - while (FindNextFile(hFind, &FindFileData)); + } while (FindNextFile(hFind, &FindFileData)); FindClose(hFind); } @@ -437,8 +434,7 @@ static void GetIconStrings(CMString& buffer) GetLastWriteTime(&FindFileData.ftLastWriteTime, timebuf, 30); buffer.AppendFormat(TEXT(" %s [%s]\r\n"), FindFileData.cFileName, timebuf); - } - while (FindNextFile(hFind, &FindFileData)); + } while (FindNextFile(hFind, &FindFileData)); FindClose(hFind); } diff --git a/plugins/CrashDumper/src/exhndlr.cpp b/plugins/CrashDumper/src/exhndlr.cpp index eee0478be5..e44f72c5ed 100644 --- a/plugins/CrashDumper/src/exhndlr.cpp +++ b/plugins/CrashDumper/src/exhndlr.cpp @@ -1,7 +1,7 @@ #include "utils.h" #ifndef FACILITY_VISUALCPP - #define FACILITY_VISUALCPP ((LONG)0x6d) +#define FACILITY_VISUALCPP ((LONG)0x6d) #endif static PVOID exchndlr, exchndlrv; diff --git a/plugins/CrashDumper/src/ui.cpp b/plugins/CrashDumper/src/ui.cpp index a34c128bdb..546c94cab6 100644 --- a/plugins/CrashDumper/src/ui.cpp +++ b/plugins/CrashDumper/src/ui.cpp @@ -100,12 +100,12 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break; case WM_GETMINMAXINFO: - { - LPMINMAXINFO mmi = (LPMINMAXINFO)lParam; - mmi->ptMinTrackSize.x = 400; // The minimum width in points - mmi->ptMinTrackSize.y = 300; // The minimum height in points - } - break; + { + LPMINMAXINFO mmi = (LPMINMAXINFO)lParam; + mmi->ptMinTrackSize.x = 400; // The minimum width in points + mmi->ptMinTrackSize.y = 300; // The minimum height in points + } + break; case WM_COMMAND: switch (LOWORD(wParam)) { @@ -124,44 +124,44 @@ INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break; case WM_CONTEXTMENU: - { - HWND hView = GetDlgItem(hwndDlg, IDC_VIEWVERSIONINFO); - GetWindowRect(hView, &rc); - - POINT pt; - pt.x = LOWORD(lParam); - pt.y = HIWORD(lParam); - if (PtInRect(&rc, pt)) { - static const CHARRANGE all = { 0, -1 }; - - HMENU hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT)); - HMENU hSubMenu = GetSubMenu(hMenu, 0); - TranslateMenu(hSubMenu); - - CHARRANGE sel; - SendMessage(hView, EM_EXGETSEL, 0, (LPARAM)&sel); - if (sel.cpMin == sel.cpMax) - EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED); - - switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) { - case IDM_COPY: - SendMessage(hView, WM_COPY, 0, 0); - break; - - case IDM_COPYALL: - SendMessage(hView, EM_EXSETSEL, 0, (LPARAM)&all); - SendMessage(hView, WM_COPY, 0, 0); - SendMessage(hView, EM_EXSETSEL, 0, (LPARAM)&sel); - break; - - case IDM_SELECTALL: - SendMessage(hView, EM_EXSETSEL, 0, (LPARAM)&all); - break; - } - DestroyMenu(hMenu); + { + HWND hView = GetDlgItem(hwndDlg, IDC_VIEWVERSIONINFO); + GetWindowRect(hView, &rc); + + POINT pt; + pt.x = LOWORD(lParam); + pt.y = HIWORD(lParam); + if (PtInRect(&rc, pt)) { + static const CHARRANGE all = { 0, -1 }; + + HMENU hMenu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_CONTEXT)); + HMENU hSubMenu = GetSubMenu(hMenu, 0); + TranslateMenu(hSubMenu); + + CHARRANGE sel; + SendMessage(hView, EM_EXGETSEL, 0, (LPARAM)&sel); + if (sel.cpMin == sel.cpMax) + EnableMenuItem(hSubMenu, IDM_COPY, MF_BYCOMMAND | MF_GRAYED); + + switch (TrackPopupMenu(hSubMenu, TPM_RETURNCMD, pt.x, pt.y, 0, hwndDlg, NULL)) { + case IDM_COPY: + SendMessage(hView, WM_COPY, 0, 0); + break; + + case IDM_COPYALL: + SendMessage(hView, EM_EXSETSEL, 0, (LPARAM)&all); + SendMessage(hView, WM_COPY, 0, 0); + SendMessage(hView, EM_EXSETSEL, 0, (LPARAM)&sel); + break; + + case IDM_SELECTALL: + SendMessage(hView, EM_EXSETSEL, 0, (LPARAM)&all); + break; } + DestroyMenu(hMenu); } - break; + } + break; case WM_DESTROY: hViewWnd = NULL; diff --git a/plugins/CrashDumper/src/upload.cpp b/plugins/CrashDumper/src/upload.cpp index fccdc858ce..f3a70a2cae 100644 --- a/plugins/CrashDumper/src/upload.cpp +++ b/plugins/CrashDumper/src/upload.cpp @@ -42,7 +42,8 @@ void GetLoginStr(char* user, size_t szuser, char* pass) if (db_get_s(NULL, PluginName, "Username", &dbv) == 0) { strncpy_s(user, szuser, dbv.pszVal, _TRUNCATE); db_free(&dbv); - } else + } + else user[0] = 0; if (db_get_s(NULL, PluginName, "Password", &dbv) == 0) { @@ -56,7 +57,8 @@ void GetLoginStr(char* user, size_t szuser, char* pass) arrayToHex(hash, sizeof(hash), pass); db_free(&dbv); - } else + } + else pass[0] = 0; } diff --git a/plugins/CrashDumper/src/utils.cpp b/plugins/CrashDumper/src/utils.cpp index 9092f3e543..44dbff6fde 100644 --- a/plugins/CrashDumper/src/utils.cpp +++ b/plugins/CrashDumper/src/utils.cpp @@ -20,7 +20,7 @@ along with this program. If not, see . static HINSTANCE hKernel = GetModuleHandleA("kernel32.dll"); -typedef BOOL (WINAPI *tGetProductInfo)(DWORD, DWORD, DWORD, DWORD, PDWORD); +typedef BOOL(WINAPI *tGetProductInfo)(DWORD, DWORD, DWORD, DWORD, PDWORD); tGetProductInfo pGetProductInfo = (tGetProductInfo)GetProcAddress(hKernel, "GetProductInfo"); void GetOSDisplayString(CMString &buffer) diff --git a/plugins/CrashDumper/src/utils.h b/plugins/CrashDumper/src/utils.h index 8eac8158c4..70d49006de 100644 --- a/plugins/CrashDumper/src/utils.h +++ b/plugins/CrashDumper/src/utils.h @@ -127,7 +127,7 @@ bool IsPluginEnabled(TCHAR* filename); PLUGININFOEX* GetMirInfo(HMODULE hModule); const PLUGININFOEX* GetPluginInfoEx(void); -void CreateMiniDump (HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr); +void CreateMiniDump(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr); void CreateCrashReport(HANDLE hDumpFile, PEXCEPTION_POINTERS exc_ptr, const TCHAR* msg); void PrintVersionInfo(CMString& buffer, unsigned flags = VI_FLAG_PRNVAR); bool ProcessVIHash(bool store); @@ -141,8 +141,8 @@ INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP INT_PTR CALLBACK DlgProcView(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); void DestroyAllWindows(void); -void UploadInit(void); -void UploadClose(void); +void UploadInit(void); +void UploadClose(void); void OpenAuthUrl(const char* url); void __cdecl VersionInfoUploadThread(void* arg); -- cgit v1.2.3