From 95807393b69d3d3ae9ec3256bdff2824999cff5d Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Mon, 15 Dec 2014 16:00:05 +0000 Subject: Folders: changed warning lavel to w4 git-svn-id: http://svn.miranda-ng.org/main/trunk@11436 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Folders/folders_12.vcxproj | 9 ++++--- plugins/Folders/folders_12.vcxproj.filters | 3 --- plugins/Folders/src/dlg_handlers.cpp | 28 +++++++++++----------- plugins/Folders/src/folderItem.cpp | 8 +++---- plugins/Folders/src/folderItem.h | 38 +++++++++++++++--------------- plugins/Folders/src/folders.cpp | 6 ++--- plugins/Folders/src/hooked_events.cpp | 22 ----------------- plugins/Folders/src/services.cpp | 20 ++++++++-------- plugins/Folders/src/utils.cpp | 12 +++++----- 9 files changed, 60 insertions(+), 86 deletions(-) delete mode 100644 plugins/Folders/src/hooked_events.cpp (limited to 'plugins/Folders') diff --git a/plugins/Folders/folders_12.vcxproj b/plugins/Folders/folders_12.vcxproj index 9ac65f86f1..4c1e0666f4 100644 --- a/plugins/Folders/folders_12.vcxproj +++ b/plugins/Folders/folders_12.vcxproj @@ -81,7 +81,7 @@ true EnableFastChecks MultiThreadedDebugDLL - Level3 + Level4 EditAndContinue false Use @@ -109,7 +109,7 @@ true EnableFastChecks MultiThreadedDebugDLL - Level3 + Level4 false Use commonheaders.h @@ -133,7 +133,7 @@ Size ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - Level3 + Level4 OnlyExplicitInline false Use @@ -160,7 +160,7 @@ Size ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - Level3 + Level4 OnlyExplicitInline false Use @@ -186,7 +186,6 @@ - Create diff --git a/plugins/Folders/folders_12.vcxproj.filters b/plugins/Folders/folders_12.vcxproj.filters index b448912cca..3edd8ab47b 100644 --- a/plugins/Folders/folders_12.vcxproj.filters +++ b/plugins/Folders/folders_12.vcxproj.filters @@ -27,9 +27,6 @@ Source Files - - Source Files - Source Files diff --git a/plugins/Folders/src/dlg_handlers.cpp b/plugins/Folders/src/dlg_handlers.cpp index 2b09a442aa..d63123d627 100644 --- a/plugins/Folders/src/dlg_handlers.cpp +++ b/plugins/Folders/src/dlg_handlers.cpp @@ -9,13 +9,13 @@ static PFolderItem GetSelectedItem(HWND hWnd) int index = SendDlgItemMessage(hWnd, IDC_FOLDERS_ITEMS_LIST, LB_GETCURSEL, 0, 0); if (index == LB_ERR) return NULL; - + return (PFolderItem)SendDlgItemMessage(hWnd, IDC_FOLDERS_ITEMS_LIST, LB_GETITEMDATA, index, 0); } static void GetEditText(HWND hWnd, TCHAR *buffer, int size) { - GetWindowText( GetDlgItem(hWnd, IDC_FOLDER_EDIT), buffer, size); + GetWindowText(GetDlgItem(hWnd, IDC_FOLDER_EDIT), buffer, size); } static void SetEditText(HWND hWnd, const TCHAR *buffer) @@ -35,10 +35,10 @@ static void LoadRegisteredFolderSections(HWND hWnd) { HWND hwndList = GetDlgItem(hWnd, IDC_FOLDERS_SECTIONS_LIST); - for (int i=0; i < lstRegisteredFolders.getCount(); i++) { + for (int i = 0; i < lstRegisteredFolders.getCount(); i++) { CFolderItem &tmp = lstRegisteredFolders[i]; - TCHAR *translated = mir_a2t( tmp.GetSection()); - if ( !ContainsSection(hWnd, TranslateTS(translated))) { + TCHAR *translated = mir_a2t(tmp.GetSection()); + if (!ContainsSection(hWnd, TranslateTS(translated))) { int idx = SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)TranslateTS(translated)); SendMessage(hwndList, LB_SETITEMDATA, idx, (LPARAM)tmp.GetSection()); } @@ -58,9 +58,9 @@ static void LoadRegisteredFolderItems(HWND hWnd) HWND hwndItems = GetDlgItem(hWnd, IDC_FOLDERS_ITEMS_LIST); SendMessage(hwndItems, LB_RESETCONTENT, 0, 0); - for (int i=0; i < lstRegisteredFolders.getCount(); i++) { + for (int i = 0; i < lstRegisteredFolders.getCount(); i++) { CFolderItem &item = lstRegisteredFolders[i]; - if ( !strcmp(szSection, item.GetSection())) { + if (!strcmp(szSection, item.GetSection())) { idx = SendMessage(hwndItems, LB_ADDSTRING, 0, (LPARAM)TranslateTS(item.GetUserName())); SendMessage(hwndItems, LB_SETITEMDATA, idx, (LPARAM)&item); } @@ -103,7 +103,7 @@ static int ChangesNotSaved(HWND hWnd, PFolderItem item) { if (!item) return 0; - + TCHAR buffer[MAX_FOLDER_SIZE]; GetEditText(hWnd, buffer, MAX_FOLDER_SIZE); return _tcscmp(item->GetFormat(), buffer) != 0; @@ -118,12 +118,12 @@ static void CheckForChanges(HWND hWnd, int bNeedConfirmation = 1) /************************************** DIALOG HANDLERS *************************************/ -static INT_PTR CALLBACK DlgProcVariables(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK DlgProcVariables(HWND hWnd, UINT msg, WPARAM wParam, LPARAM) { TCHAR tszMessage[2048]; switch (msg) { - case WM_INITDIALOG: + case WM_INITDIALOG: mir_sntprintf(tszMessage, SIZEOF(tszMessage), _T("%s\r\n%s\r\n\r\n%s\t\t%s\r\n%%miranda_path%%\t\t%s\r\n%%profile_path%%\t\t%s\r\n\t\t\t%s\r\n%%current_profile%%\t\t%s\r\n\t\t\t%s\r\n\r\n\r\n%s\r\n%s\r\n%s\r\n%s\r\n%s\r\n%s\r\n\r\n%s\r\n%s\r\n%s\r\n%%miranda_path%%\t\t\t%s\r\n%%profile_path%%\t\t\t%s\r\n%%current_profile%%\t\t\t%s\r\n%%temp%%\t\t\t\t%s\r\n%%profile_path%%\\%%current_profile%%\t%s\r\n%%miranda_path%%\\plugins\\config\t%s\r\n' %%miranda_path%%\\\\\\\\ '\t\t%s\r\n\r\n%s"), TranslateT("Don't forget to click on Apply to save the changes. If you don't then the changes won't"), TranslateT("be saved to the database, they will only be valid for this session."), @@ -197,7 +197,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l break; case IDC_HELP_BUTTON: - ShowWindow( CreateDialog(hInstance, MAKEINTRESOURCE(IDD_VARIABLES_HELP), hWnd, DlgProcVariables), SW_SHOW); + ShowWindow(CreateDialog(hInstance, MAKEINTRESOURCE(IDD_VARIABLES_HELP), hWnd, DlgProcVariables), SW_SHOW); break; case IDC_FOLDERS_SECTIONS_LIST: @@ -225,7 +225,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l break; case WM_NOTIFY: - switch(((LPNMHDR)lParam)->idFrom) { + switch (((LPNMHDR)lParam)->idFrom) { case 0: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: @@ -235,7 +235,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l LoadItem(hWnd, item); } - for (int i=0; i < lstRegisteredFolders.getCount(); i++) + for (int i = 0; i < lstRegisteredFolders.getCount(); i++) lstRegisteredFolders[i].Save(); CallPathChangedEvents(); } @@ -246,7 +246,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM l return 0; } -static int OnOptionsInitialize(WPARAM wParam, LPARAM lParam) +static int OnOptionsInitialize(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 100000000; diff --git a/plugins/Folders/src/folderItem.cpp b/plugins/Folders/src/folderItem.cpp index f89f001619..c00ef0cef6 100644 --- a/plugins/Folders/src/folderItem.cpp +++ b/plugins/Folders/src/folderItem.cpp @@ -47,7 +47,7 @@ void CFolderItem::SetFormat(const TCHAR *newFormat) { mir_free(m_tszOldFormat); m_tszOldFormat = m_tszFormat; - m_tszFormat = mir_tstrdup( *newFormat ? newFormat : MIRANDA_PATHT); + m_tszFormat = mir_tstrdup(*newFormat ? newFormat : MIRANDA_PATHT); } int CFolderItem::IsEqual(const CFolderItem *other) @@ -62,7 +62,7 @@ int CFolderItem::IsEqual(const char *section, const TCHAR *name) int CFolderItem::IsEqualTranslated(const char *trSection, const TCHAR *trName) { - return !_tcscmp( TranslateTS(m_tszUserName), trName) && !strcmp(Translate(m_szSection), trSection); + return !_tcscmp(TranslateTS(m_tszUserName), trName) && !strcmp(Translate(m_szSection), trSection); } int CFolderItem::operator ==(const CFolderItem *other) @@ -98,10 +98,10 @@ int CFolderItem::FolderCreateDirectory(int showFolder) int CFolderItem::FolderDeleteOldDirectory(int showFolder) { - if ( !m_tszOldFormat) + if (!m_tszOldFormat) return FOLDER_SUCCESS; - if ( !_tcscmp(m_tszFormat, m_tszOldFormat)) //format wasn't changed + if (!_tcscmp(m_tszFormat, m_tszOldFormat)) //format wasn't changed return FOLDER_SUCCESS; TCHAR buffer[MAX_FOLDER_SIZE]; diff --git a/plugins/Folders/src/folderItem.h b/plugins/Folders/src/folderItem.h index 385d7ae4a6..166017b476 100644 --- a/plugins/Folders/src/folderItem.h +++ b/plugins/Folders/src/folderItem.h @@ -37,31 +37,31 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. class CFolderItem { - char *m_szSection, *m_szName; - TCHAR *m_tszFormat, *m_tszOldFormat, *m_tszUserName; - - void GetDataFromDatabase(const TCHAR *szNotFound); - void WriteDataToDatabase(); - - int FolderCreateDirectory(int showFolder = 0); - int FolderDeleteOldDirectory(int showFolder = 0); + char *m_szSection, *m_szName; + TCHAR *m_tszFormat, *m_tszOldFormat, *m_tszUserName; + + void GetDataFromDatabase(const TCHAR *szNotFound); + void WriteDataToDatabase(); + + int FolderCreateDirectory(int showFolder = 0); + int FolderDeleteOldDirectory(int showFolder = 0); public: - CFolderItem(const char *sectionName, const char *name, const TCHAR *format, const TCHAR *userName); - virtual ~CFolderItem(); - - void Expand(TCHAR *buffer, int size); - void Save(); - - int IsEqual(const CFolderItem *other); - int IsEqual(const char *section, const TCHAR *name); - int IsEqualTranslated(const char *trSection, const TCHAR *trName); - int operator ==(const CFolderItem *other); + CFolderItem(const char *sectionName, const char *name, const TCHAR *format, const TCHAR *userName); + virtual ~CFolderItem(); + + void Expand(TCHAR *buffer, int size); + void Save(); + + int IsEqual(const CFolderItem *other); + int IsEqual(const char *section, const TCHAR *name); + int IsEqualTranslated(const char *trSection, const TCHAR *trName); + int operator ==(const CFolderItem *other); __inline const char* GetSection() const { return m_szSection; } __inline const char* GetName() const { return m_szName; } __inline const TCHAR* GetUserName() const { return m_tszUserName; } __inline const TCHAR* GetFormat() const { return m_tszFormat; } - void SetFormat(const TCHAR *newFormat); + void SetFormat(const TCHAR *newFormat); }; typedef CFolderItem *PFolderItem; diff --git a/plugins/Folders/src/folders.cpp b/plugins/Folders/src/folders.cpp index 3abfef1f55..8cc718db4f 100644 --- a/plugins/Folders/src/folders.cpp +++ b/plugins/Folders/src/folders.cpp @@ -37,10 +37,10 @@ PLUGININFOEX pluginInfo = { __AUTHORWEB, UNICODE_AWARE, // {2F129563-2C7D-4A9A-B948-97DFCC0AFDD7} - {0x2f129563, 0x2c7d, 0x4a9a, {0xb9, 0x48, 0x97, 0xdf, 0xcc, 0x0a, 0xfd, 0xd7}} + { 0x2f129563, 0x2c7d, 0x4a9a, { 0xb9, 0x48, 0x97, 0xdf, 0xcc, 0x0a, 0xfd, 0xd7 } } }; -extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD mirandaVersion) +extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD) { return &pluginInfo; } @@ -61,7 +61,7 @@ extern "C" __declspec(dllexport) int Unload() return 0; } -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) { hInstance = hinstDLL; return TRUE; diff --git a/plugins/Folders/src/hooked_events.cpp b/plugins/Folders/src/hooked_events.cpp deleted file mode 100644 index caeeb697ff..0000000000 --- a/plugins/Folders/src/hooked_events.cpp +++ /dev/null @@ -1,22 +0,0 @@ -/* -Custom profile folders plugin for Miranda IM - -Copyright © 2005 Cristian Libotean - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ - -#include "commonheaders.h" - diff --git a/plugins/Folders/src/services.cpp b/plugins/Folders/src/services.cpp index 2323946056..af435d7fdd 100644 --- a/plugins/Folders/src/services.cpp +++ b/plugins/Folders/src/services.cpp @@ -32,7 +32,7 @@ INT_PTR ExpandPath(TCHAR *szResult, TCHAR *format, int size) szResult[0] = '\0'; TCHAR *input = NULL; - if ( ServiceExists(MS_VARS_FORMATSTRING)) + if (ServiceExists(MS_VARS_FORMATSTRING)) input = variables_parse(format, NULL, NULL); if (input == NULL) @@ -40,12 +40,12 @@ INT_PTR ExpandPath(TCHAR *szResult, TCHAR *format, int size) TCHAR *core_result = Utils_ReplaceVarsT(input); _tcsncpy(szResult, core_result, size); - + mir_free(core_result); - StrReplace(szResult, PROFILE_PATHT, szCurrentProfilePath); - StrReplace(szResult, CURRENT_PROFILET, szCurrentProfile); - StrReplace(szResult, MIRANDA_PATHT, szMirandaPath); + StrReplace(szResult, PROFILE_PATHT, szCurrentProfilePath); + StrReplace(szResult, CURRENT_PROFILET, szCurrentProfile); + StrReplace(szResult, MIRANDA_PATHT, szMirandaPath); StrReplace(szResult, MIRANDA_USERDATAT, szUserDataPath); StrTrim(szResult, _T("\t \\")); @@ -55,7 +55,7 @@ INT_PTR ExpandPath(TCHAR *szResult, TCHAR *format, int size) return _tcslen(szResult); } -INT_PTR RegisterPathService(WPARAM wParam, LPARAM lParam) +INT_PTR RegisterPathService(WPARAM, LPARAM lParam) { FOLDERSDATA *data = (FOLDERSDATA*)lParam; if (data == NULL) @@ -79,7 +79,7 @@ INT_PTR GetPathSizeService(WPARAM wParam, LPARAM lParam) size_t len; CFolderItem *p = (CFolderItem*)wParam; - if ( lstRegisteredFolders.getIndex(p) != -1) { + if (lstRegisteredFolders.getIndex(p) != -1) { TCHAR tmp[MAX_FOLDER_SIZE]; p->Expand(tmp, SIZEOF(tmp)); len = _tcslen(tmp); @@ -95,7 +95,7 @@ INT_PTR GetPathSizeService(WPARAM wParam, LPARAM lParam) INT_PTR GetPathService(WPARAM wParam, LPARAM lParam) { CFolderItem *p = (CFolderItem*)wParam; - if ( lstRegisteredFolders.getIndex(p) == -1) + if (lstRegisteredFolders.getIndex(p) == -1) return 1; FOLDERSGETDATA* data = (FOLDERSGETDATA*)lParam; @@ -121,10 +121,10 @@ int InitServices() CallService(MS_DB_GETPROFILENAMET, SIZEOF(szCurrentProfile), (LPARAM)szCurrentProfile); TCHAR *pos = _tcsrchr(szCurrentProfile, '.'); if (pos) *pos = 0; - GetModuleFileName( GetModuleHandle(NULL), szMirandaPath, SIZEOF(szMirandaPath)); + GetModuleFileName(GetModuleHandle(NULL), szMirandaPath, SIZEOF(szMirandaPath)); pos = _tcsrchr(szMirandaPath, '\\'); if (pos) *pos = 0; - TCHAR *szTemp = Utils_ReplaceVarsT( _T("%miranda_userdata%")); + TCHAR *szTemp = Utils_ReplaceVarsT(_T("%miranda_userdata%")); mir_sntprintf(szUserDataPath, SIZEOF(szUserDataPath), szTemp); mir_free(szTemp); diff --git a/plugins/Folders/src/utils.cpp b/plugins/Folders/src/utils.cpp index a2ba6668d7..748da0d592 100644 --- a/plugins/Folders/src/utils.cpp +++ b/plugins/Folders/src/utils.cpp @@ -89,11 +89,11 @@ char *StrReplace(char *source, const char *what, const char *withWhat) { size_t whatLen = strlen(what); size_t withWhatLen = strlen(withWhat); - + char *pos; while ((pos = strstr(source, what))) { size_t minLen = min(whatLen, withWhatLen); - StrCopy(source, pos - source, withWhat, minLen); + StrCopy(source, pos - source, withWhat, minLen); size_t index = pos - source + minLen; if (whatLen > withWhatLen) StrDelete(source, index, whatLen - withWhatLen); @@ -113,7 +113,7 @@ wchar_t *StrReplace(wchar_t *source, const wchar_t *what, const wchar_t *withWha wchar_t *pos; while ((pos = wcsstr(source, what))) { size_t minLen = min(whatLen, withWhatLen); - StrCopy(source, pos - source, withWhat, minLen); + StrCopy(source, pos - source, withWhat, minLen); size_t index = pos - source + minLen; if (whatLen > withWhatLen) StrDelete(source, index, whatLen - withWhatLen); @@ -162,7 +162,7 @@ void RemoveDirectories(TCHAR *path) TCHAR *pos; TCHAR *buffer = NEWWSTR_ALLOCA(path); if (!(GetFileAttributes(buffer) & FILE_ATTRIBUTE_REPARSE_POINT)) - RemoveDirectory(buffer); + RemoveDirectory(buffer); while (pos = _tcsrchr(buffer, '\\')) { pos[0] = '\0'; if (!(GetFileAttributes(buffer) & FILE_ATTRIBUTE_REPARSE_POINT)) @@ -173,7 +173,7 @@ void RemoveDirectories(TCHAR *path) int DirectoryExists(TCHAR *path) { TCHAR buffer[4096]; - GetCurrentDirectory( SIZEOF(buffer), buffer); + GetCurrentDirectory(SIZEOF(buffer), buffer); int res = SetCurrentDirectory(path); SetCurrentDirectory(buffer); return res; @@ -183,7 +183,7 @@ int GetStringFromDatabase(char *szSettingName, const wchar_t *szError, TCHAR *sz { size_t len; DBVARIANT dbv; - if ( db_get_ws(NULL, ModuleName, szSettingName, &dbv) == 0) { + if (db_get_ws(NULL, ModuleName, szSettingName, &dbv) == 0) { size_t tmp = _tcslen(dbv.ptszVal); len = (tmp < size - 1) ? tmp : size - 1; _tcsncpy(szResult, dbv.ptszVal, len); -- cgit v1.2.3