diff options
author | George Hazan <ghazan@miranda.im> | 2020-05-07 17:08:24 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-05-07 17:08:24 +0300 |
commit | c970f5a11e85c4efe5a27783c7c8d994c55daf8b (patch) | |
tree | fa8c6aa5c7de40f9066ea022bb136e96e262daae /src/core | |
parent | b13f39a263e1969ec35006daf8f1f5cb4fb924b3 (diff) |
fix for old PROTO_INTERFACE::FileResume interface error
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/stdfile/src/fileexistsdlg.cpp | 23 | ||||
-rw-r--r-- | src/core/stdfile/src/filexferdlg.cpp | 5 |
2 files changed, 10 insertions, 18 deletions
diff --git a/src/core/stdfile/src/fileexistsdlg.cpp b/src/core/stdfile/src/fileexistsdlg.cpp index c10a9148e0..c5be954f79 100644 --- a/src/core/stdfile/src/fileexistsdlg.cpp +++ b/src/core/stdfile/src/fileexistsdlg.cpp @@ -241,7 +241,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_COMMAND:
{
- PROTOFILERESUME pfr = { 0 };
+ PROTOFILERESUME pfr = {};
switch (LOWORD(wParam)) {
case IDC_OPENFILE:
ShellExecute(hwndDlg, NULL, fts->szCurrentFile.w, NULL, NULL, SW_SHOW);
@@ -278,21 +278,16 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break;
case IDC_SAVEAS:
- {
- OPENFILENAME ofn = { 0 };
- wchar_t filter[512], *pfilter;
- wchar_t str[MAX_PATH];
+ wchar_t str[MAX_PATH];
+ mir_wstrncpy(str, fts->szCurrentFile.w, _countof(str));
- mir_wstrncpy(str, fts->szCurrentFile.w, _countof(str));
+ wchar_t filter[512];
+ mir_snwprintf(filter, L"%s (*)%c*%c", TranslateT("All files"), 0, 0);
+ {
+ OPENFILENAME ofn = {};
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hwndDlg;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY;
- wcsncpy(filter, TranslateT("All files"),_countof(filter)-1);
- mir_wstrcat(filter, L" (*)");
- pfilter = filter + mir_wstrlen(filter) + 1;
- mir_wstrcpy(pfilter, L"*");
- pfilter = pfilter + mir_wstrlen(pfilter) + 1;
- *pfilter = '\0';
ofn.lpstrFilter = filter;
ofn.lpstrFile = str;
ofn.nMaxFile = _countof(str);
@@ -317,9 +312,7 @@ INT_PTR CALLBACK DlgProcFileExists(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM return FALSE;
}
- PROTOFILERESUME *pfrCopy = (PROTOFILERESUME*)mir_alloc(sizeof(pfr));
- memcpy(pfrCopy, &pfr, sizeof(pfr));
- PostMessage((HWND)GetPropA(hwndDlg, "Miranda.ParentWnd"), M_FILEEXISTSDLGREPLY, (WPARAM)mir_wstrdup(fts->szCurrentFile.w), (LPARAM)pfrCopy);
+ PostMessage((HWND)GetPropA(hwndDlg, "Miranda.ParentWnd"), M_FILEEXISTSDLGREPLY, (WPARAM)mir_wstrdup(fts->szCurrentFile.w), (LPARAM)new PROTOFILERESUME(pfr));
DestroyWindow(hwndDlg);
}
break;
diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp index d969e68478..c652c6b480 100644 --- a/src/core/stdfile/src/filexferdlg.cpp +++ b/src/core/stdfile/src/filexferdlg.cpp @@ -501,8 +501,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR } mir_free(szOriginalFilename); CallProtoService(szProto, PS_FILERESUME, (WPARAM)dat->fs, (LPARAM)pfr); - if (pfr->szFilename) mir_free((char*)pfr->szFilename); - mir_free(pfr); + delete pfr; } break; @@ -559,7 +558,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR EnableWindow(hwndDlg, FALSE); } else { - PROTOFILERESUME *pfr = (PROTOFILERESUME*)mir_alloc(sizeof(PROTOFILERESUME)); + PROTOFILERESUME *pfr = new PROTOFILERESUME(); pfr->action = dat->resumeBehaviour; pfr->szFilename = nullptr; PostMessage(hwndDlg, M_FILEEXISTSDLGREPLY, (WPARAM)mir_wstrdup(fts->szCurrentFile.w), (LPARAM)pfr); |