diff options
-rw-r--r-- | include/m_utils.h | 7 | ||||
-rw-r--r-- | libs/win32/mir_core.lib | bin | 488910 -> 489232 bytes | |||
-rw-r--r-- | libs/win64/mir_core.lib | bin | 494082 -> 494428 bytes | |||
-rw-r--r-- | plugins/FTPFileYM/src/utils.cpp | 2 | ||||
-rw-r--r-- | plugins/HTTPServer/src/GuiElements.cpp | 2 | ||||
-rw-r--r-- | plugins/MirOTR/src/options.cpp | 2 | ||||
-rw-r--r-- | plugins/New_GPG/src/ui.cpp | 2 | ||||
-rw-r--r-- | plugins/ProxySwitch/src/main.cpp | 2 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_chat.cpp | 10 | ||||
-rw-r--r-- | protocols/JabberG/src/jabber_disco.cpp | 6 | ||||
-rw-r--r-- | protocols/JabberG/src/stdafx.h | 4 | ||||
-rw-r--r-- | src/mir_core/src/Windows/winutil.cpp | 24 | ||||
-rw-r--r-- | src/mir_core/src/mir_core.def | 3 | ||||
-rw-r--r-- | src/mir_core/src/mir_core64.def | 3 |
14 files changed, 45 insertions, 22 deletions
diff --git a/include/m_utils.h b/include/m_utils.h index 7f880efcdd..f9cb7e42cd 100644 --- a/include/m_utils.h +++ b/include/m_utils.h @@ -53,7 +53,12 @@ EXTERN_C MIR_CORE_DLL(void) Utils_OpenUrlW(const wchar_t *pszUrl, bool bOpenInNe /////////////////////////////////////////////////////////////////////////////////////////
// copies a string into clipboard
-EXTERN_C MIR_CORE_DLL(void) Utils_ClipboardCopy(const wchar_t *pszText);
+MIR_CORE_DLL(void) Utils_ClipboardCopy(const char *pszText);
+MIR_CORE_DLL(void) Utils_ClipboardCopy(const wchar_t *pszText);
+
+__forceinline void Utils_ClipboardCopyU(const char *p)
+{ Utils_ClipboardCopy(Utf2T(p));
+}
/////////////////////////////////////////////////////////////////////////////////////////
// Resizes a dialog by calling a custom routine to move the individual
diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib Binary files differindex eb41a61894..782e680b41 100644 --- a/libs/win32/mir_core.lib +++ b/libs/win32/mir_core.lib diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib Binary files differindex 4b08e98189..d21710594f 100644 --- a/libs/win64/mir_core.lib +++ b/libs/win64/mir_core.lib diff --git a/plugins/FTPFileYM/src/utils.cpp b/plugins/FTPFileYM/src/utils.cpp index f09f647a95..b38a095635 100644 --- a/plugins/FTPFileYM/src/utils.cpp +++ b/plugins/FTPFileYM/src/utils.cpp @@ -64,7 +64,7 @@ wchar_t* Utils::getFileNameFromPath(wchar_t *stzPath) void Utils::copyToClipboard(char *szText)
{
- Utils_ClipboardCopy(_A2T(szText));
+ Utils_ClipboardCopy(szText);
}
void Utils::curlSetOpt(CURL *hCurl, ServerList::FTP *ftp, char *url, struct curl_slist *headerList, char *errorBuff)
diff --git a/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index b0a8805461..268ff071cd 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -898,7 +898,7 @@ static INT_PTR CALLBACK DlgProcStatsticView(HWND hwndDlg, UINT msg, WPARAM wPara return TRUE;
if (LOWORD(wParam) == ID_SHARELIST_COPYLINK)
- Utils_ClipboardCopy(_A2T(sLink.c_str()));
+ Utils_ClipboardCopy(sLink.c_str());
else
Utils_OpenUrl(sLink.c_str());
}
diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp index 6236df3f6c..8ef718f6ae 100644 --- a/plugins/MirOTR/src/options.cpp +++ b/plugins/MirOTR/src/options.cpp @@ -410,7 +410,7 @@ public: if (proto) { char fprint[45]; if (otrl_privkey_fingerprint(otr_user_state, fprint, proto, proto)) - Utils_ClipboardCopy(_A2T(fprint)); + Utils_ClipboardCopy(fprint); } break; diff --git a/plugins/New_GPG/src/ui.cpp b/plugins/New_GPG/src/ui.cpp index 7ae95a8443..78ff38af92 100644 --- a/plugins/New_GPG/src/ui.cpp +++ b/plugins/New_GPG/src/ui.cpp @@ -551,7 +551,7 @@ public: return; params.out.Remove('\r'); - Utils_ClipboardCopy(_A2T(params.out)); + Utils_ClipboardCopy(params.out); } void onClick_EXPORT_PRIVATE(CCtrlButton *) diff --git a/plugins/ProxySwitch/src/main.cpp b/plugins/ProxySwitch/src/main.cpp index 470bb4ed80..3b08113a3a 100644 --- a/plugins/ProxySwitch/src/main.cpp +++ b/plugins/ProxySwitch/src/main.cpp @@ -105,7 +105,7 @@ static INT_PTR CopyIP2Clipboard(WPARAM, LPARAM, LPARAM idx) { mir_cslock lck(csNIF_List); if (g_arNIF[idx].IPcount != 0) - Utils_ClipboardCopy(_A2T(g_arNIF[idx].IPstr)); + Utils_ClipboardCopy(g_arNIF[idx].IPstr); return 0; } diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp index da93040fa9..550a81bc00 100644 --- a/protocols/JabberG/src/jabber_chat.cpp +++ b/protocols/JabberG/src/jabber_chat.cpp @@ -1129,16 +1129,16 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK* break;
case IDM_CPY_NICK:
- Utils_ClipboardCopy(him->m_szResourceName);
+ Utils_ClipboardCopyU(him->m_szResourceName);
break;
case IDM_RJID_COPY:
case IDM_CPY_RJID:
- Utils_ClipboardCopy(him->m_szRealJid);
+ Utils_ClipboardCopyU(him->m_szRealJid);
break;
case IDM_CPY_INROOMJID:
- Utils_ClipboardCopy(MakeJid(item->jid, him->m_szResourceName));
+ Utils_ClipboardCopyU(MakeJid(item->jid, him->m_szResourceName));
break;
case IDM_RJID_VCARD:
@@ -1303,11 +1303,11 @@ static void sttLogListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK *g break;
case IDM_CPY_RJID:
- Utils_ClipboardCopy(item->jid);
+ Utils_ClipboardCopyU(item->jid);
break;
case IDM_CPY_TOPIC:
- Utils_ClipboardCopy(item->getTemp()->m_szStatusMessage);
+ Utils_ClipboardCopyU(item->getTemp()->m_szStatusMessage);
break;
}
}
diff --git a/protocols/JabberG/src/jabber_disco.cpp b/protocols/JabberG/src/jabber_disco.cpp index 94168f47ff..cca24a8d29 100644 --- a/protocols/JabberG/src/jabber_disco.cpp +++ b/protocols/JabberG/src/jabber_disco.cpp @@ -1056,15 +1056,15 @@ public: break;
case SD_ACT_COPYJID:
- Utils_ClipboardCopy(pNode->GetJid());
+ Utils_ClipboardCopyU(pNode->GetJid());
break;
case SD_ACT_COPYNODE:
- Utils_ClipboardCopy(pNode->GetNode());
+ Utils_ClipboardCopyU(pNode->GetNode());
break;
case SD_ACT_COPYINFO:
- Utils_ClipboardCopy(pNode->GetTooltipText());
+ Utils_ClipboardCopyU(pNode->GetTooltipText());
break;
case SD_ACT_FAVORITE:
diff --git a/protocols/JabberG/src/stdafx.h b/protocols/JabberG/src/stdafx.h index 67eaad3244..985dbefefb 100644 --- a/protocols/JabberG/src/stdafx.h +++ b/protocols/JabberG/src/stdafx.h @@ -697,10 +697,6 @@ CMStringW JabberErrorMsg(const TiXmlElement *errorNode, int *errorCode = nullptr const wchar_t *JabberStrIStr(const wchar_t *str, const wchar_t *substr);
CJabberProto* JabberChooseInstance(bool bIsLink=false);
-__forceinline void Utils_ClipboardCopy(const char *p)
-{ Utils_ClipboardCopy(Utf2T(p));
-}
-
bool JabberReadXep203delay(const TiXmlElement *node, time_t &msgTime);
void SetWindowTextUtf(HWND hwndDlg, const char *szValue);
diff --git a/src/mir_core/src/Windows/winutil.cpp b/src/mir_core/src/Windows/winutil.cpp index f9c0fb18d6..7a25523482 100644 --- a/src/mir_core/src/Windows/winutil.cpp +++ b/src/mir_core/src/Windows/winutil.cpp @@ -136,18 +136,38 @@ MIR_CORE_DLL(int) Utils_CorrectFontSize(int size) ///////////////////////////////////////////////////////////////////////////////////////// +MIR_CORE_DLL(void) Utils_ClipboardCopy(const char *pszText) +{ + size_t cbLen = mir_strlen(pszText); + if (!cbLen) + return; + + if (!OpenClipboard(nullptr)) + return; + + EmptyClipboard(); + + HGLOBAL hData = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, cbLen); + if (hData) { + mir_strcpy((char *)GlobalLock(hData), pszText); + GlobalUnlock(hData); + SetClipboardData(CF_TEXT, hData); + } + CloseClipboard(); +} + MIR_CORE_DLL(void) Utils_ClipboardCopy(const wchar_t *pwszText) { size_t cbLen = mir_wstrlen(pwszText); if (!cbLen) return; - + if (!OpenClipboard(nullptr)) return; EmptyClipboard(); - HGLOBAL hData = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, (cbLen+1) * sizeof(wchar_t)); + HGLOBAL hData = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, (cbLen + 1) * sizeof(wchar_t)); if (hData) { mir_wstrcpy((wchar_t *)GlobalLock(hData), pwszText); GlobalUnlock(hData); diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index 2a7c92d1f5..51c2de344b 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -1543,4 +1543,5 @@ _Utils_CorrectFontSize@4 @1762 NONAME ?OnResize@CDlgBase@@MAEXXZ @1763 NONAME
??0MBinBuffer@@QAE@ABV0@@Z @1764 NONAME
??0MBinBuffer@@QAE@I@Z @1765 NONAME
-_Utils_ClipboardCopy@4 @1766 NONAME
+?Utils_ClipboardCopy@@YGXPBD@Z @1766 NONAME
+?Utils_ClipboardCopy@@YGXPB_W@Z @1767 NONAME
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 56c4c541d5..20ad714a5f 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -1543,4 +1543,5 @@ Utils_CorrectFontSize @1762 NONAME ?OnResize@CDlgBase@@MEAAXXZ @1763 NONAME
??0MBinBuffer@@QEAA@AEBV0@@Z @1764 NONAME
??0MBinBuffer@@QEAA@_K@Z @1765 NONAME
-Utils_ClipboardCopy @1766 NONAME
+?Utils_ClipboardCopy@@YAXPEBD@Z @1766 NONAME
+?Utils_ClipboardCopy@@YAXPEB_W@Z @1767 NONAME
|