summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/stdfile/src/fileexistsdlg.cpp23
-rw-r--r--src/core/stdfile/src/filexferdlg.cpp5
-rw-r--r--src/mir_app/src/mir_app.def2
-rw-r--r--src/mir_app/src/mir_app64.def2
-rw-r--r--src/mir_app/src/proto_internal.cpp7
-rw-r--r--src/mir_app/src/proto_utils.cpp2
-rw-r--r--src/mir_app/src/protocols.cpp2
7 files changed, 17 insertions, 26 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);
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 01161746cd..be7e00c7d1 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -45,7 +45,7 @@ Button_SetSkin_IcoLib @24
?FileAllow@PROTO_INTERFACE@@UAEPAXIPAXPB_W@Z @44 NONAME
?FileCancel@PROTO_INTERFACE@@UAEHIPAX@Z @45 NONAME
?FileDeny@PROTO_INTERFACE@@UAEHIPAXPB_W@Z @46 NONAME
-?FileResume@PROTO_INTERFACE@@UAEHPAXPAHPAPB_W@Z @47 NONAME
+?FileResume@PROTO_INTERFACE@@UAEHPAXHPB_W@Z @47 NONAME
?GetAwayMsg@PROTO_INTERFACE@@UAEPAXI@Z @48 NONAME
?GetCaps@PROTO_INTERFACE@@UAEHHI@Z @49 NONAME
?GetInfo@PROTO_INTERFACE@@UAEHIH@Z @50 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 9ef8a4097a..765d46b37b 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -45,7 +45,7 @@ Button_SetSkin_IcoLib @24
?FileAllow@PROTO_INTERFACE@@UEAAPEAXIPEAXPEB_W@Z @44 NONAME
?FileCancel@PROTO_INTERFACE@@UEAAHIPEAX@Z @45 NONAME
?FileDeny@PROTO_INTERFACE@@UEAAHIPEAXPEB_W@Z @46 NONAME
-?FileResume@PROTO_INTERFACE@@UEAAHPEAXPEAHPEAPEB_W@Z @47 NONAME
+?FileResume@PROTO_INTERFACE@@UEAAHPEAXHPEB_W@Z @47 NONAME
?GetAwayMsg@PROTO_INTERFACE@@UEAAPEAXI@Z @48 NONAME
?GetCaps@PROTO_INTERFACE@@UEAA_JHI@Z @49 NONAME
?GetInfo@PROTO_INTERFACE@@UEAAHIH@Z @50 NONAME
diff --git a/src/mir_app/src/proto_internal.cpp b/src/mir_app/src/proto_internal.cpp
index 0437a44222..4a9b28a65b 100644
--- a/src/mir_app/src/proto_internal.cpp
+++ b/src/mir_app/src/proto_internal.cpp
@@ -123,16 +123,15 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
return res;
}
- virtual int FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename) override
+ virtual int FileResume(HANDLE hTransfer, int action, const wchar_t *szFilename) override
{
- PROTOFILERESUME pfr = { *action, *szFilename };
+ PROTOFILERESUME pfr = { action, szFilename };
if (m_iVersion > 1)
return (int)ProtoCallService(m_szModuleName, PS_FILERESUME, (WPARAM)hTransfer, (LPARAM)&pfr);
pfr.szFilename = (wchar_t*)mir_u2a(pfr.szFilename);
int res = (int)ProtoCallService(m_szModuleName, PS_FILERESUME, (WPARAM)hTransfer, (LPARAM)&pfr);
- mir_free((wchar_t*)*szFilename);
- *action = pfr.action; *szFilename = (wchar_t*)pfr.szFilename;
+ mir_free((wchar_t*)pfr.szFilename);
return res;
}
diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp
index f6330ae487..ea34ddbed2 100644
--- a/src/mir_app/src/proto_utils.cpp
+++ b/src/mir_app/src/proto_utils.cpp
@@ -465,7 +465,7 @@ int PROTO_INTERFACE::FileDeny(MCONTACT, HANDLE, const wchar_t*)
return 1; // error
}
-int PROTO_INTERFACE::FileResume(HANDLE, int*, const wchar_t**)
+int PROTO_INTERFACE::FileResume(HANDLE, int, const wchar_t*)
{
return 1; // error
}
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp
index 0d90b0cae1..2578c0ef81 100644
--- a/src/mir_app/src/protocols.cpp
+++ b/src/mir_app/src/protocols.cpp
@@ -407,7 +407,7 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char
case 10: return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, (wchar_t*)lParam);
case 11: {
PROTOFILERESUME *pfr = (PROTOFILERESUME*)lParam;
- return (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action, (const wchar_t**)&pfr->szFilename);
+ return (INT_PTR)ppi->FileResume((HANDLE)wParam, pfr->action, (const wchar_t*)pfr->szFilename);
}
case 12: return (INT_PTR)ppi->GetCaps(wParam, lParam);