summaryrefslogtreecommitdiff
path: root/src/core/stdfile
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2015-02-28 00:26:43 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2015-02-28 00:26:43 +0000
commit4410284da77786594d7009b6c515176de0d5a51e (patch)
tree949362dafe500e6ef07006ade5a9920d72d2c55e /src/core/stdfile
parent2095a324e774565a588425ed4a4986063e3c08fa (diff)
Core:
-Some major and minor issues fixed git-svn-id: http://svn.miranda-ng.org/main/trunk@12280 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/core/stdfile')
-rw-r--r--src/core/stdfile/src/fileexistsdlg.cpp10
-rw-r--r--src/core/stdfile/src/fileopts.cpp4
-rw-r--r--src/core/stdfile/src/filerecvdlg.cpp16
-rw-r--r--src/core/stdfile/src/filexferdlg.cpp5
-rw-r--r--src/core/stdfile/src/ftmanager.cpp2
5 files changed, 22 insertions, 15 deletions
diff --git a/src/core/stdfile/src/fileexistsdlg.cpp b/src/core/stdfile/src/fileexistsdlg.cpp
index 2fbc9dce60..3c15484676 100644
--- a/src/core/stdfile/src/fileexistsdlg.cpp
+++ b/src/core/stdfile/src/fileexistsdlg.cpp
@@ -177,7 +177,13 @@ void __cdecl LoadIconsAndTypesThread(void* param)
if (szIconFile[0]) {
TCHAR *pszComma = _tcsrchr(szIconFile, ',');
- int iconIndex = (pszComma == NULL) ? 0 : _ttoi(pszComma + 1); *pszComma = '\0';
+ int iconIndex;
+ if (pszComma) {
+ iconIndex = _ttoi(pszComma + 1);
+ *pszComma = '\0';
+ }
+ else
+ iconIndex = 0;
HICON hIcon = ExtractIcon(hInst, szIconFile, iconIndex);
if (hIcon)
fileInfo.hIcon = hIcon;
@@ -281,7 +287,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
- _tcscpy(filter, TranslateT("All files"));
+ _tcsncpy(filter, TranslateT("All files"),SIZEOF(filter)-1);
_tcscat(filter, _T(" (*)"));
pfilter = filter + _tcslen(filter) + 1;
_tcscpy(pfilter, _T("*"));
diff --git a/src/core/stdfile/src/fileopts.cpp b/src/core/stdfile/src/fileopts.cpp
index 42903c987f..899eb224a6 100644
--- a/src/core/stdfile/src/fileopts.cpp
+++ b/src/core/stdfile/src/fileopts.cpp
@@ -34,9 +34,7 @@ struct virusscannerinfo {
const TCHAR *szExeRegPath;
const TCHAR *szExeRegValue;
const TCHAR *szCommandLine;
-};
-
-static const struct virusscannerinfo virusScanners[] = {
+} virusScanners[] = {
{_T("Network Associates/McAfee VirusScan"), _T("SOFTWARE\\McAfee\\VirusScan"), _T("Scan32EXE"), _T("\"%s\" %%f /nosplash /comp /autoscan /autoexit /noboot")},
{_T("Dr Solomon's VirusScan (Network Associates)"), _T("SOFTWARE\\Network Associates\\TVD\\VirusScan\\AVConsol\\General"), _T("szScannerExe"), _T("\"%s\" %%f /uinone /noboot /comp /prompt /autoexit")},
{_T("Norton AntiVirus"), _T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\Navw32.exe"), NULL, _T("\"%s\" %%f /b- /m- /s+ /noresults")},
diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp
index e1cff072ea..f28660dea0 100644
--- a/src/core/stdfile/src/filerecvdlg.cpp
+++ b/src/core/stdfile/src/filerecvdlg.cpp
@@ -54,8 +54,7 @@ void RemoveInvalidFilenameChars(TCHAR *tszString)
size_t i;
if (tszString) {
for (i = _tcscspn(tszString, InvalidFilenameChars); tszString[i]; i+=_tcscspn(tszString+i+1, InvalidFilenameChars)+1)
- if (tszString[i] >= 0)
- tszString[i] = _T('_');
+ tszString[i] = _T('_');
}
}
@@ -64,8 +63,7 @@ void RemoveInvalidPathChars(TCHAR *tszString)
{
if (tszString)
for (size_t i = _tcscspn(tszString, InvalidPathChars); tszString[i]; i += _tcscspn(tszString + i + 1, InvalidPathChars) + 1)
- if (tszString[i] >= 0)
- tszString[i] = _T('_');
+ tszString[i] = _T('_');
}
static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM pData)
@@ -317,7 +315,10 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
if (hIcon) {
DrawIconEx(dis->hDC, dis->rcItem.left, dis->rcItem.top, hIcon, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0, NULL, DI_NORMAL);
DestroyIcon(hIcon);
- } } } }
+ }
+ }
+ }
+ }
return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
case WM_COMMAND:
@@ -415,9 +416,8 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
case HM_RECVEVENT:
{
ACKDATA *ack = (ACKDATA*)lParam;
- if (ack->hProcess != dat->fs) break;
- if (ack->type != ACKTYPE_FILE) break;
- if (ack->hContact != dat->hContact) break;
+ if ((ack == NULL) || (ack->hProcess != dat->fs) || (ack->type != ACKTYPE_FILE) || (ack->hContact != dat->hContact))
+ break;
if (ack->result == ACKRESULT_DENIED || ack->result == ACKRESULT_FAILED) {
EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp
index e435e2627b..c89c518fa4 100644
--- a/src/core/stdfile/src/filexferdlg.cpp
+++ b/src/core/stdfile/src/filexferdlg.cpp
@@ -341,6 +341,9 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
break;
case WM_COMMAND:
+ if (!dat)
+ break;
+
if (CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM)dat->hContact))
break;
@@ -368,7 +371,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
}
case IDC_OPENFOLDER:
- if (dat) {
+ {
TCHAR *path = dat->transferStatus.tszWorkingDir;
if (!path || !path[0]) {
path = NEWTSTR_ALLOCA(dat->transferStatus.tszCurrentFile);
diff --git a/src/core/stdfile/src/ftmanager.cpp b/src/core/stdfile/src/ftmanager.cpp
index c99577b89f..a361dd7a30 100644
--- a/src/core/stdfile/src/ftmanager.cpp
+++ b/src/core/stdfile/src/ftmanager.cpp
@@ -177,7 +177,7 @@ static INT_PTR CALLBACK FtMgrPageDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
case WM_MOUSEWHEEL:
{
- int zDelta = GET_WHEEL_DELTA_WPARAM(wParam);
+ short zDelta = GET_WHEEL_DELTA_WPARAM(wParam);
if (zDelta) {
int nScrollLines = 0;
SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, (void*)&nScrollLines, 0);