summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin10/lib/mir_core.libbin28294 -> 28388 bytes
-rw-r--r--bin10/lib/mir_core64.libbin25852 -> 25928 bytes
-rw-r--r--include/m_core.h10
-rw-r--r--plugins/Clist_modern/modern_newrowopts.cpp2
-rw-r--r--plugins/TopToolBar/common.h12
-rw-r--r--plugins/TopToolBar/toolbar.cpp61
-rw-r--r--plugins/TopToolBar/topbutton.cpp54
-rw-r--r--plugins/TopToolBar/ttbopt.cpp22
-rw-r--r--protocols/JabberG/jabber.h2
-rw-r--r--protocols/JabberG/jabber_bookmarks.cpp10
-rw-r--r--protocols/JabberG/jabber_disco.h22
-rw-r--r--protocols/JabberG/jabber_file.cpp2
-rw-r--r--protocols/JabberG/jabber_ft.cpp2
-rw-r--r--protocols/JabberG/jabber_groupchat.cpp18
-rw-r--r--protocols/JabberG/jabber_iq.h9
-rw-r--r--protocols/JabberG/jabber_iq_handlers.cpp4
-rw-r--r--protocols/JabberG/jabber_iqid.cpp6
-rw-r--r--protocols/JabberG/jabber_libstr.cpp16
-rw-r--r--protocols/JabberG/jabber_list.cpp4
-rw-r--r--protocols/JabberG/jabber_message_manager.h7
-rw-r--r--protocols/JabberG/jabber_privacy.h6
-rw-r--r--protocols/JabberG/jabber_proto.cpp2
-rw-r--r--protocols/JabberG/jabber_rc.h6
-rw-r--r--protocols/JabberG/jabber_thread.cpp16
-rw-r--r--protocols/JabberG/jabber_xstatus.cpp8
-rw-r--r--protocols/MSN/msn_global.h2
-rw-r--r--protocols/MSN/msn_libstr.cpp18
-rw-r--r--protocols/MSN/msn_misc.cpp2
-rw-r--r--protocols/MSN/msn_proto.cpp4
-rw-r--r--src/mir_core/mir_core.def2
-rw-r--r--src/mir_core/mir_core_10.vcxproj2
-rw-r--r--src/mir_core/utils.cpp16
32 files changed, 161 insertions, 186 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib
index f9f2d7d584..ad2dc04458 100644
--- a/bin10/lib/mir_core.lib
+++ b/bin10/lib/mir_core.lib
Binary files differ
diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib
index 534cab6c51..cf9301875b 100644
--- a/bin10/lib/mir_core64.lib
+++ b/bin10/lib/mir_core64.lib
Binary files differ
diff --git a/include/m_core.h b/include/m_core.h
index 732e60af2b..43cc67a417 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -369,6 +369,14 @@ MIR_CORE_DLL(int) wildcmp(char *name, char *mask);
__forceinline char* lrtrim(char* str) { return ltrim(rtrim(str)); };
__forceinline char* lrtrimp(char* str) { return ltrimp(rtrim(str)); };
+#if defined( __cplusplus )
+ MIR_CORE_DLL(char*) replaceStr( char* &dest, const char *src );
+ MIR_CORE_DLL(WCHAR*) replaceStrW( WCHAR* &dest, const WCHAR *src );
+#else
+ MIR_CORE_DLL(char*) replaceStr( char **dest, const char *src );
+ MIR_CORE_DLL(WCHAR*) replaceStrW( WCHAR **dest, const WCHAR *src );
+#endif
+
///////////////////////////////////////////////////////////////////////////////
// text conversion functions
@@ -384,6 +392,7 @@ __forceinline char* lrtrimp(char* str) { return ltrimp(rtrim(str)); };
#define mir_u2t_cp(s,c) mir_wstrdup(s)
#define mir_tstrdup mir_wstrdup
+ #define replaceStrT replaceStrW
#else
#define mir_t2a(s) mir_strdup(s)
#define mir_a2t(s) mir_strdup(s)
@@ -396,6 +405,7 @@ __forceinline char* lrtrimp(char* str) { return ltrimp(rtrim(str)); };
#define mir_u2t_cp(s,c) mir_u2a_cp(s,c)
#define mir_tstrdup mir_strdup
+ #define replaceStrT replaceStr
#endif
MIR_CORE_DLL(WCHAR*) mir_a2u_cp(const char* src, int codepage);
diff --git a/plugins/Clist_modern/modern_newrowopts.cpp b/plugins/Clist_modern/modern_newrowopts.cpp
index fabbbf6adb..b44ea0dbe3 100644
--- a/plugins/Clist_modern/modern_newrowopts.cpp
+++ b/plugins/Clist_modern/modern_newrowopts.cpp
@@ -74,7 +74,7 @@ BOOL RemoveChildNode(NodeList * FromList, DWORD index)
NodeList *work = &(FromList->childNodes[index]);
for (size_t i=0; i < work->AllocatedChilds; i++)
if (work->childNodes[i].AllocatedChilds)
- RemoveChildNode(work->childNodes,i);
+ RemoveChildNode(work->childNodes, (DWORD)i);
if (work->AllocatedChilds) {
mir_free_and_nil(work->childNodes);
diff --git a/plugins/TopToolBar/common.h b/plugins/TopToolBar/common.h
index 82060ac458..82fad3485f 100644
--- a/plugins/TopToolBar/common.h
+++ b/plugins/TopToolBar/common.h
@@ -69,18 +69,18 @@ struct TopButtonInt
HICON hIconUp, hIconDn;
HANDLE hIconHandleUp, hIconHandleDn;
- char *pszService;
- TCHAR *program;
- char *name;
- TCHAR *tooltip;
+ char *pszService;
+ TCHAR *ptszProgram;
+ char *pszName;
+ TCHAR *ptszTooltip;
LPARAM lParamUp;
WPARAM wParamUp;
LPARAM lParamDown;
WPARAM wParamDown;
- int hLangpack;
- char *szTooltipUp, *szTooltipDn;
+ int hLangpack;
+ TCHAR *ptszTooltipUp, *ptszTooltipDn;
};
///////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/TopToolBar/toolbar.cpp b/plugins/TopToolBar/toolbar.cpp
index 5e0e2a02f7..48957e9171 100644
--- a/plugins/TopToolBar/toolbar.cpp
+++ b/plugins/TopToolBar/toolbar.cpp
@@ -77,7 +77,7 @@ INT_PTR LaunchService(WPARAM wParam, LPARAM lParam)
STARTUPINFO si = {0};
si.cb = sizeof(si);
- if ( CreateProcess(NULL, Buttons[lParam]->program, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
+ if ( CreateProcess(NULL, Buttons[lParam]->ptszProgram, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) {
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
@@ -188,7 +188,7 @@ static bool nameexists(const char *name)
return false;
for (int i = 0; i < Buttons.getCount(); i++)
- if ( !lstrcmpA(Buttons[i]->name, name))
+ if ( !lstrcmpA(Buttons[i]->pszName, name))
return true;
return false;
@@ -219,11 +219,11 @@ static void ReloadIcons()
char buf[256];
if (b->hIconHandleUp) {
- sprintf(buf, "%s_up", b->name);
+ sprintf(buf, "%s_up", b->pszName);
b->hIconUp = LoadIconFromLibrary(buf, b->hIconUp, b->hIconHandleUp);
}
if (b->hIconHandleDn) {
- sprintf(buf, "%s_dn", b->name);
+ sprintf(buf, "%s_dn", b->pszName);
b->hIconDn = LoadIconFromLibrary(buf, b->hIconDn, b->hIconHandleDn);
}
}
@@ -245,22 +245,15 @@ TopButtonInt* CreateButton(TTBButton* but)
b->bPushed = (but->dwFlags & TTBBF_PUSHED) ? TRUE : FALSE;
if (but->dwFlags & TTBBF_ISLBUTTON) {
- if (but->program != NULL)
- b->program = _tcsdup(but->program);
- b->pszService = _strdup(TTB_LAUNCHSERVICE);
+ b->ptszProgram = mir_tstrdup(but->program);
+ b->pszService = mir_strdup(TTB_LAUNCHSERVICE);
}
else {
- b->program = NULL;
- if (but->pszService != NULL)
- b->pszService = _strdup(but->pszService);
- else
- b->pszService = NULL;
+ b->ptszProgram = NULL;
+ b->pszService = mir_strdup(but->pszService);
}
- if (but->name != NULL)
- b->name = _strdup(but->name);
- else
- b->name = NULL;
+ b->pszName = mir_strdup(but->name);
if (b->dwFlags & TTBBF_ICONBYHANDLE) {
b->hIconUp = Skin_GetIconByHandle(b->hIconHandleUp = but->hIconHandleUp);
@@ -271,17 +264,17 @@ TopButtonInt* CreateButton(TTBButton* but)
}
else {
char buf[256];
- mir_snprintf(buf, SIZEOF(buf), (b->hIconDn) ? "%s_up" : "%s", b->name);
+ mir_snprintf(buf, SIZEOF(buf), (b->hIconDn) ? "%s_up" : "%s", b->pszName);
b->hIconUp = LoadIconFromLibrary(buf, but->hIconUp, b->hIconHandleUp);
if (b->hIconDn) {
- mir_snprintf(buf, SIZEOF(buf), "%s_dn", b->name);
+ mir_snprintf(buf, SIZEOF(buf), "%s_dn", b->pszName);
b->hIconDn = LoadIconFromLibrary(buf, but->hIconDn, b->hIconHandleDn);
}
}
if (but->cbSize > OLD_TBBUTTON_SIZE) {
- b->szTooltipUp = but->pszTooltipUp;
- b->szTooltipDn = but->pszTooltipDn;
+ b->ptszTooltipUp = mir_a2t(but->pszTooltipUp);
+ b->ptszTooltipDn = mir_a2t(but->pszTooltipDn);
}
}
return b;
@@ -418,7 +411,7 @@ INT_PTR TTBGetOptions(WPARAM wParam, LPARAM lParam)
break;
case TTBO_TIPNAME:
- retval = (INT_PTR)b->tooltip;
+ retval = (INT_PTR)b->ptszTooltip;
break;
case TTBO_ALLDATA:
@@ -440,9 +433,9 @@ INT_PTR TTBGetOptions(WPARAM wParam, LPARAM lParam)
lpTTB->wParamDown = b->wParamDown;
if (b->dwFlags & TTBBF_ISLBUTTON)
- lpTTB->program = _tcsdup(b->program);
+ replaceStrT(lpTTB->program, b->ptszProgram);
else
- lpTTB->pszService = _strdup(b->pszService);
+ replaceStr(lpTTB->pszService, b->pszService);
retval = ( INT_PTR )lpTTB;
}
@@ -486,10 +479,8 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam)
if (lParam == 0)
break;
- if (b->tooltip != NULL)
- free(b->tooltip);
- b->tooltip = _tcsdup( TranslateTS( _A2T((LPCSTR)lParam)));
- SendMessage(b->hwnd,BUTTONADDTOOLTIP,(WPARAM)b->tooltip,BATF_UNICODE);
+ replaceStrT(b->ptszTooltip, TranslateTS( _A2T((LPCSTR)lParam)));
+ SendMessage(b->hwnd,BUTTONADDTOOLTIP,(WPARAM)b->ptszTooltip,BATF_UNICODE);
retval = 1;
break;
@@ -518,18 +509,10 @@ INT_PTR TTBSetOptions(WPARAM wParam, LPARAM lParam)
b->SaveSettings(0,0);
}
- if (b->dwFlags & TTBBF_ISLBUTTON) {
- if (b->program != NULL)
- free(b->program);
- b->program = _tcsdup(lpTTB->program);
-// don't save program changing in use buttons
-// changed = 1; // for launch buttons from user, not options (options don't share handles)
- }
- else {
- if (b->pszService != NULL)
- free(b->pszService);
- b->pszService = _strdup(lpTTB->pszService);
- }
+ if (b->dwFlags & TTBBF_ISLBUTTON)
+ replaceStrT(b->ptszProgram, lpTTB->program);
+ else
+ replaceStr(b->pszService, lpTTB->pszService);
b->lParamUp = lpTTB->lParamUp;
b->wParamUp = lpTTB->wParamUp;
diff --git a/plugins/TopToolBar/topbutton.cpp b/plugins/TopToolBar/topbutton.cpp
index 9a1cbe0200..5bcab82017 100644
--- a/plugins/TopToolBar/topbutton.cpp
+++ b/plugins/TopToolBar/topbutton.cpp
@@ -8,16 +8,15 @@ static int maxid = 10000;
TopButtonInt::~TopButtonInt()
{
if (dwFlags & TTBBF_ISLBUTTON) {
- if (program != NULL)
- free(program);
+ mir_free(ptszProgram);
}
else if (pszService != NULL)
- free(pszService);
+ mir_free(pszService);
- if (name != NULL)
- free(name);
- if (tooltip != NULL)
- free(tooltip);
+ mir_free(pszName);
+ mir_free(ptszTooltip);
+ mir_free(ptszTooltipDn);
+ mir_free(ptszTooltipUp);
}
DWORD TopButtonInt::CheckFlags(DWORD Flags)
@@ -34,7 +33,7 @@ DWORD TopButtonInt::CheckFlags(DWORD Flags)
if ( BitChanged(TTBBF_SHOWTOOLTIP)) {
dwFlags ^= TTBBF_SHOWTOOLTIP;
SendMessage(hwnd,BUTTONADDTOOLTIP,
- (WPARAM)((dwFlags & TTBBF_SHOWTOOLTIP)?tooltip:L""),BATF_UNICODE);
+ (WPARAM)((dwFlags & TTBBF_SHOWTOOLTIP) ? ptszTooltip : _T("")), BATF_TCHAR);
}
// next settings changing visual side, requires additional actions
if ( BitChanged(TTBBF_VISIBLE)) {
@@ -96,18 +95,19 @@ void TopButtonInt::LoadSettings()
char buf2[20];
AS(buf2, "Launch", buf1);
- if (name != NULL) free(name);
- name = DBGetString(0, TTB_OPTDIR, AS(buf, buf2, "_name"));
- if (program != NULL) free(program);
- program = DBGetStringT(0, TTB_OPTDIR, AS(buf, buf2, "_lpath"));
+ mir_free(pszName);
+ pszName = DBGetString(0, TTB_OPTDIR, AS(buf, buf2, "_name"));
+
+ mir_free(ptszProgram);
+ ptszProgram = DBGetStringT(0, TTB_OPTDIR, AS(buf, buf2, "_lpath"));
arrangedpos = DBGetContactSettingByte(0, TTB_OPTDIR, AS(buf, buf2, "_Position"), Buttons.getCount());
if ( DBGetContactSettingByte(0, TTB_OPTDIR, AS(buf, buf2, "_Visible"), oldv) > 0 )
dwFlags |= TTBBF_VISIBLE;
}
else {
- arrangedpos = DBGetContactSettingByte(0, TTB_OPTDIR, AS(buf, name, "_Position"), Buttons.getCount());
- if ( DBGetContactSettingByte(0, TTB_OPTDIR, AS(buf, name, "_Visible"), oldv) > 0 )
+ arrangedpos = DBGetContactSettingByte(0, TTB_OPTDIR, AS(buf, pszName, "_Position"), Buttons.getCount());
+ if ( DBGetContactSettingByte(0, TTB_OPTDIR, AS(buf, pszName, "_Visible"), oldv) > 0 )
dwFlags |= TTBBF_VISIBLE;
}
@@ -134,14 +134,14 @@ void TopButtonInt::SaveSettings(int *SepCnt, int *LaunchCnt)
char buf2[20];
AS(buf2, "Launch", buf1);
- DBWriteContactSettingString(0, TTB_OPTDIR, AS(buf, buf2, "_name"), name);
- DBWriteContactSettingTString(0, TTB_OPTDIR, AS(buf, buf2, "_lpath"), program);
+ DBWriteContactSettingString(0, TTB_OPTDIR, AS(buf, buf2, "_name"), pszName);
+ DBWriteContactSettingTString(0, TTB_OPTDIR, AS(buf, buf2, "_lpath"), ptszProgram);
DBWriteContactSettingByte(0, TTB_OPTDIR, AS(buf, buf2, "_Position"), arrangedpos);
DBWriteContactSettingByte(0, TTB_OPTDIR, AS(buf, buf2, "_Visible"), dwFlags & TTBBF_VISIBLE);
}
else {
- DBWriteContactSettingByte(0, TTB_OPTDIR, AS(buf, name, "_Position"), arrangedpos);
- DBWriteContactSettingByte(0, TTB_OPTDIR, AS(buf, name, "_Visible"), dwFlags & TTBBF_VISIBLE);
+ DBWriteContactSettingByte(0, TTB_OPTDIR, AS(buf, pszName, "_Position"), arrangedpos);
+ DBWriteContactSettingByte(0, TTB_OPTDIR, AS(buf, pszName, "_Visible"), dwFlags & TTBBF_VISIBLE);
}
}
@@ -160,9 +160,19 @@ void TopButtonInt::SetBitmap()
if (GetWindowLongPtr(hwnd, GWL_STYLE) & SS_ICON)
SetWindowLongPtr(hwnd, GWL_STYLE, curstyle | SS_ICON);
- HICON bicon = (hIconDn)?hIconDn:hIconUp;
-
- SendMessage(hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)((bPushed)?(bicon):(hIconUp)));
- SendMessage(hwnd, BM_SETCHECK, bPushed?BST_CHECKED:BST_UNCHECKED ,0);
+ TCHAR* pTooltip;
+ if (bPushed) {
+ SendMessage(hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)((hIconDn) ? hIconDn : hIconUp));
+ SendMessage(hwnd, BM_SETCHECK, BST_CHECKED, 0);
+
+ pTooltip = (ptszTooltipDn) ? ptszTooltipDn : ptszTooltipUp;
+ }
+ else {
+ SendMessage(hwnd, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIconUp);
+ SendMessage(hwnd, BM_SETCHECK, BST_UNCHECKED, 0);
+ pTooltip = ptszTooltipUp;
+ }
+ if (pTooltip)
+ SendMessage(hwnd, BUTTONADDTOOLTIP, (WPARAM)TranslateTH(hLangpack, pTooltip), BATF_TCHAR);
}
}
diff --git a/plugins/TopToolBar/ttbopt.cpp b/plugins/TopToolBar/ttbopt.cpp
index 2662a44eef..5fd2edef80 100644
--- a/plugins/TopToolBar/ttbopt.cpp
+++ b/plugins/TopToolBar/ttbopt.cpp
@@ -32,7 +32,7 @@ static HTREEITEM AddLine(HWND hTree,TopButtonInt *b, HTREEITEM hItem, HIMAGELIST
}
else index = ImageList_AddIcon(il, b->hIconUp);
- tmp = mir_a2t( b->name );
+ tmp = mir_a2t( b->pszName );
tvis.item.pszText = TranslateTS(tmp);
}
tvis.item.iImage = tvis.item.iSelectedImage = index;
@@ -273,17 +273,15 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
TreeView_SetItem(hTree, &tvi);
}
- if (btn->name) free(btn->name);
GetDlgItemText(hwndDlg, IDC_ENAME, buf, 255);
- btn->name = _strdup( _T2A(buf));
-
- if (btn->program) free(btn->program);
- GetDlgItemText(hwndDlg, IDC_EPATH, buf, 255);
- btn->program = _tcsdup(buf);
+ replaceStr(btn->pszName, _T2A(buf));
tvi.mask = TVIF_TEXT;
- tvi.pszText = mir_a2t( btn->name );
+ tvi.pszText = buf;
TreeView_SetItem(hTree, &tvi);
+
+ GetDlgItemText(hwndDlg, IDC_EPATH, buf, 255);
+ replaceStrT(btn->ptszProgram, buf);
}
break;
}
@@ -415,13 +413,13 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
EnableWindow(GetDlgItem(hwndDlg, IDC_EPATH), enable);
EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVEBUTTON), enable);
EnableWindow(GetDlgItem(hwndDlg, IDC_LBUTTONSET), enable);
- if (btn->name != NULL)
- SetDlgItemTextA(hwndDlg, IDC_ENAME, btn->name);
+ if (btn->pszName != NULL)
+ SetDlgItemTextA(hwndDlg, IDC_ENAME, btn->pszName);
else
SetDlgItemTextA(hwndDlg, IDC_ENAME, "");
- if (btn->program != NULL)
- SetDlgItemText(hwndDlg, IDC_EPATH, btn->program);
+ if (btn->ptszProgram != NULL)
+ SetDlgItemText(hwndDlg, IDC_EPATH, btn->ptszProgram);
else
SetDlgItemTextA(hwndDlg, IDC_EPATH, "");
}
diff --git a/protocols/JabberG/jabber.h b/protocols/JabberG/jabber.h
index 745650b8ce..124e99a2d2 100644
--- a/protocols/JabberG/jabber.h
+++ b/protocols/JabberG/jabber.h
@@ -645,8 +645,6 @@ int ReloadIconsEventHook(WPARAM wParam, LPARAM lParam);
//---- jabber_libstr.c ----------------------------------------------
-void __stdcall replaceStr( char*& dest, const char* src );
-void __stdcall replaceStr( WCHAR*& dest, const WCHAR* src );
int lstrcmp_null(const TCHAR *s1, const TCHAR *s2);
//---- jabber_menu.c ------------------------------------------------
diff --git a/protocols/JabberG/jabber_bookmarks.cpp b/protocols/JabberG/jabber_bookmarks.cpp
index f3923e04de..9ad9baf91a 100644
--- a/protocols/JabberG/jabber_bookmarks.cpp
+++ b/protocols/JabberG/jabber_bookmarks.cpp
@@ -117,18 +117,18 @@ static INT_PTR CALLBACK JabberAddBookmarkDlgProc( HWND hwndDlg, UINT msg, WPARAM
item->bUseResource = TRUE;
if ( SendDlgItemMessage(hwndDlg, IDC_URL_RADIO, BM_GETCHECK,0, 0) == BST_CHECKED )
- replaceStr( item->type, _T( "url" ));
+ replaceStrT( item->type, _T( "url" ));
else
- replaceStr( item->type, _T( "conference" ));
+ replaceStrT( item->type, _T( "conference" ));
GetDlgItemText( hwndDlg, IDC_NICK, text, SIZEOF( text ));
- replaceStr( item->nick, text );
+ replaceStrT( item->nick, text );
GetDlgItemText( hwndDlg, IDC_PASSWORD, text, SIZEOF( text ));
- replaceStr( item->password, text );
+ replaceStrT( item->password, text );
GetDlgItemText( hwndDlg, IDC_NAME, text, SIZEOF( text ));
- replaceStr( item->name, ( text[0] == 0 ) ? roomJID : text );
+ replaceStrT( item->name, ( text[0] == 0 ) ? roomJID : text );
item->bAutoJoin = (SendDlgItemMessage(hwndDlg, IDC_CHECK_BM_AUTOJOIN, BM_GETCHECK,0, 0) == BST_CHECKED );
{
diff --git a/protocols/JabberG/jabber_disco.h b/protocols/JabberG/jabber_disco.h
index 583bc61f4c..79df12781e 100644
--- a/protocols/JabberG/jabber_disco.h
+++ b/protocols/JabberG/jabber_disco.h
@@ -155,11 +155,11 @@ public:
}
BOOL RemoveAll()
{
- replaceStr( m_szJid, NULL );
- replaceStr( m_szNode, NULL );
- replaceStr( m_szName, NULL );
- replaceStr( m_szInfoError, NULL );
- replaceStr( m_szItemsError, NULL );
+ replaceStrT( m_szJid, NULL );
+ replaceStrT( m_szNode, NULL );
+ replaceStrT( m_szName, NULL );
+ replaceStrT( m_szInfoError, NULL );
+ replaceStrT( m_szItemsError, NULL );
if ( m_pIdentities )
delete m_pIdentities;
m_pIdentities = NULL;
@@ -181,8 +181,8 @@ public:
}
BOOL ResetInfo()
{
- replaceStr( m_szInfoError, NULL );
- replaceStr( m_szItemsError, NULL );
+ replaceStrT( m_szInfoError, NULL );
+ replaceStrT( m_szItemsError, NULL );
if ( m_pIdentities )
delete m_pIdentities;
m_pIdentities = NULL;
@@ -229,7 +229,7 @@ public:
}
BOOL SetJid(TCHAR *szJid)
{
- replaceStr(m_szJid, szJid);
+ replaceStrT(m_szJid, szJid);
return TRUE;
}
TCHAR* GetJid()
@@ -238,7 +238,7 @@ public:
}
BOOL SetNode(TCHAR *szNode)
{
- replaceStr(m_szNode, szNode);
+ replaceStrT(m_szNode, szNode);
return TRUE;
}
TCHAR* GetNode()
@@ -347,12 +347,12 @@ public:
}
BOOL SetItemsRequestErrorText(TCHAR *szError)
{
- replaceStr(m_szItemsError, szError);
+ replaceStrT(m_szItemsError, szError);
return TRUE;
}
BOOL SetInfoRequestErrorText(TCHAR *szError)
{
- replaceStr(m_szInfoError, szError);
+ replaceStrT(m_szInfoError, szError);
return TRUE;
}
BOOL GetTooltipText(TCHAR *szText, int nMaxLength)
diff --git a/protocols/JabberG/jabber_file.cpp b/protocols/JabberG/jabber_file.cpp
index 716e108caf..c445e1f4b0 100644
--- a/protocols/JabberG/jabber_file.cpp
+++ b/protocols/JabberG/jabber_file.cpp
@@ -529,7 +529,7 @@ int filetransfer::create()
TCHAR filefull[ MAX_PATH ];
mir_sntprintf( filefull, SIZEOF(filefull), _T("%s\\%s"), std.tszWorkingDir, std.tszCurrentFile );
- replaceStr( std.tszCurrentFile, filefull );
+ replaceStrT( std.tszCurrentFile, filefull );
if ( hWaitEvent != INVALID_HANDLE_VALUE )
CloseHandle( hWaitEvent );
diff --git a/protocols/JabberG/jabber_ft.cpp b/protocols/JabberG/jabber_ft.cpp
index ac011392f6..906b5b3562 100644
--- a/protocols/JabberG/jabber_ft.cpp
+++ b/protocols/JabberG/jabber_ft.cpp
@@ -280,7 +280,7 @@ void CJabberProto::FtSendFinal( BOOL success, filetransfer* ft )
else {
if ( ft->std.currentFileNumber < ft->std.totalFiles-1 ) {
ft->std.currentFileNumber++;
- replaceStr( ft->std.tszCurrentFile, ft->std.ptszFiles[ ft->std.currentFileNumber ] );
+ replaceStrT( ft->std.tszCurrentFile, ft->std.ptszFiles[ ft->std.currentFileNumber ] );
JSendBroadcast( ft->std.hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, ft, 0 );
FtInitiate( ft->jid, ft );
return;
diff --git a/protocols/JabberG/jabber_groupchat.cpp b/protocols/JabberG/jabber_groupchat.cpp
index 3f535352d8..b442588fc0 100644
--- a/protocols/JabberG/jabber_groupchat.cpp
+++ b/protocols/JabberG/jabber_groupchat.cpp
@@ -308,8 +308,8 @@ void CJabberProto::GroupchatJoinRoom( const TCHAR* server, const TCHAR* room, co
JABBER_LIST_ITEM* item = ListAdd( LIST_CHATROOM, text );
item->bAutoJoin = autojoin;
- replaceStr( item->nick, nick );
- replaceStr( item->password, info.password );
+ replaceStrT( item->nick, nick );
+ replaceStrT( item->password, info.password );
int status = ( m_iStatus == ID_STATUS_INVISIBLE ) ? ID_STATUS_ONLINE : m_iStatus;
XmlNode x( _T("x")); x << XATTR( _T("xmlns"), _T(JABBER_FEAT_MUC));
@@ -867,7 +867,7 @@ static VOID CALLBACK JabberGroupchatChangeNickname( void* arg )
if ( param->ppro->EnterString( szBuffer, SIZEOF(szBuffer), szCaption, JES_COMBO, "gcNick_" )) {
TCHAR text[ 1024 ];
- replaceStr( item->nick, szBuffer );
+ replaceStrT( item->nick, szBuffer );
mir_sntprintf( text, SIZEOF( text ), _T("%s/%s"), item->jid, szBuffer );
param->ppro->SendPresenceTo( param->ppro->m_iStatus, text, NULL );
} }
@@ -898,10 +898,10 @@ void CJabberProto::RenameParticipantNick( JABBER_LIST_ITEM* item, const TCHAR* o
for ( int i=0; i < item->resourceCount; i++ ) {
JABBER_RESOURCE_STATUS& RS = item->resource[i];
if ( !lstrcmp( RS.resourceName, oldNick )) {
- replaceStr( RS.resourceName, newNick );
+ replaceStrT( RS.resourceName, newNick );
if ( !lstrcmp( item->nick, oldNick )) {
- replaceStr( item->nick, newNick );
+ replaceStrT( item->nick, newNick );
HANDLE hContact = HContactFromJID( item->jid );
if ( hContact != NULL )
@@ -960,7 +960,7 @@ void CJabberProto::GroupchatProcessPresence( HXML node )
// process custom nick change
if ( cnick && r && r->nick && _tcscmp( cnick, r->nick ))
- replaceStr( r->nick, cnick );
+ replaceStrT( r->nick, cnick );
HXML xNode = xmlGetChildByTag( node, "x", "xmlns", _T(JABBER_FEAT_MUC_USER));
HXML xUserNode = xmlGetChildByTag( node, "user:x", "xmlns:user", _T(JABBER_FEAT_MUC_USER));
@@ -1050,7 +1050,7 @@ void CJabberProto::GroupchatProcessPresence( HXML node )
}
if ( str = xmlGetAttrValue( itemNode, _T("jid")))
- replaceStr( r->szRealJid, str );
+ replaceStrT( r->szRealJid, str );
}
}
@@ -1151,7 +1151,7 @@ void CJabberProto::GroupchatProcessPresence( HXML node )
JGetStringT(NULL, "GcAltNick", newNick, SIZEOF(newNick)) != NULL &&
newNick[0] != _T('\0'))
{
- replaceStr(item->nick, newNick);
+ replaceStrT(item->nick, newNick);
TCHAR text[1024] = { 0 };
mir_sntprintf(text, SIZEOF(text), _T("%s/%s"), item->jid, newNick);
SendPresenceTo(m_iStatus, text, NULL);
@@ -1214,7 +1214,7 @@ void CJabberProto::GroupchatProcessMessage( HXML node )
*(TCHAR*)(--tmptr) = 0;
resource = tmpnick;
} }
- replaceStr( item->itemResource.statusMessage, msgText );
+ replaceStrT( item->itemResource.statusMessage, msgText );
}
else {
if (( n = xmlGetChildByTag( node , "body", "xml:lang", m_tszSelectedLang )) == NULL )
diff --git a/protocols/JabberG/jabber_iq.h b/protocols/JabberG/jabber_iq.h
index 85da7e5195..6e145e7db0 100644
--- a/protocols/JabberG/jabber_iq.h
+++ b/protocols/JabberG/jabber_iq.h
@@ -56,9 +56,6 @@ typedef struct {
BOOL allowSubNs; // e.g. #info in disco#info
} JABBER_IQ_XMLNS_FUNC;
-void __stdcall replaceStr( char*& dest, const char* src );
-void __stdcall replaceStr( WCHAR*& dest, const WCHAR* src );
-
// 2 minutes, milliseconds
#define JABBER_DEFAULT_IQ_REQUEST_TIMEOUT 120000
@@ -111,7 +108,7 @@ public:
}
void SetReceiver(const TCHAR *szReceiver)
{
- replaceStr(m_szReceiver, szReceiver);
+ replaceStrT(m_szReceiver, szReceiver);
}
TCHAR* GetReceiver()
{
@@ -379,9 +376,9 @@ public:
pInfo->m_pHandler = pHandler;
pInfo->m_nIqTypes = nIqTypes ? nIqTypes : JABBER_IQ_TYPE_ANY;
- replaceStr( pInfo->m_szXmlns, szXmlns );
+ replaceStrT( pInfo->m_szXmlns, szXmlns );
pInfo->m_bAllowPartialNs = bAllowPartialNs;
- replaceStr( pInfo->m_szTag, szTag );
+ replaceStrT( pInfo->m_szTag, szTag );
pInfo->m_dwParamsToParse = dwParamsToParse;
pInfo->m_pUserData = pUserData;
pInfo->m_pUserDataFree = pUserDataFree;
diff --git a/protocols/JabberG/jabber_iq_handlers.cpp b/protocols/JabberG/jabber_iq_handlers.cpp
index 4a77b5847d..28effcdff7 100644
--- a/protocols/JabberG/jabber_iq_handlers.cpp
+++ b/protocols/JabberG/jabber_iq_handlers.cpp
@@ -516,10 +516,10 @@ BOOL CJabberProto::OnRosterPushRequest( HXML, CJabberIqInfo *pInfo )
if ( nick != NULL ) {
if (( item=ListAdd( LIST_ROSTER, jid )) != NULL ) {
- replaceStr( item->nick, nick );
+ replaceStrT( item->nick, nick );
HXML groupNode = xmlGetChild( itemNode , "group" );
- replaceStr( item->group, ( groupNode ) ? xmlGetText( groupNode ) : NULL );
+ replaceStrT( item->group, ( groupNode ) ? xmlGetText( groupNode ) : NULL );
if (( hContact=HContactFromJID( jid, 0 )) == NULL ) {
// Received roster has a new JID.
diff --git a/protocols/JabberG/jabber_iqid.cpp b/protocols/JabberG/jabber_iqid.cpp
index e90fdfcbc6..dcc7f9c6ee 100644
--- a/protocols/JabberG/jabber_iqid.cpp
+++ b/protocols/JabberG/jabber_iqid.cpp
@@ -428,7 +428,7 @@ void CJabberProto::OnIqResultGetRoster( HXML iqNode, CJabberIqInfo* pInfo )
mir_free( item->nick ); item->nick = nick;
HXML groupNode = xmlGetChild( itemNode , "group" );
- replaceStr( item->group, ( groupNode ) ? xmlGetText( groupNode ) : NULL );
+ replaceStrT( item->group, ( groupNode ) ? xmlGetText( groupNode ) : NULL );
// check group delimiters:
if ( item->group && szGroupDelimeter ) {
@@ -710,7 +710,7 @@ LBL_Ret:
hasPhoto = TRUE;
if ( item->photoFileName )
DeleteFile( item->photoFileName );
- replaceStr( item->photoFileName, szAvatarFileName );
+ replaceStrT( item->photoFileName, szAvatarFileName );
Log( "Contact's picture saved to " TCHAR_STR_PARAM, szAvatarFileName );
if (JGetWord( hContact, "Status", ID_STATUS_OFFLINE ) == ID_STATUS_OFFLINE) {
@@ -1696,7 +1696,7 @@ void CJabberProto::OnIqResultLastActivity( HXML iqNode, CJabberIqInfo* pInfo )
LPCTSTR szLastStatusMessage = XPathT( iqNode, "query[@xmlns='jabber:iq:last']" );
if ( szLastStatusMessage ) // replace only if it exists
- replaceStr( r->statusMessage, szLastStatusMessage );
+ replaceStrT( r->statusMessage, szLastStatusMessage );
}
r->idleStartTime = lastActivity;
diff --git a/protocols/JabberG/jabber_libstr.cpp b/protocols/JabberG/jabber_libstr.cpp
index b628c88348..4517d77272 100644
--- a/protocols/JabberG/jabber_libstr.cpp
+++ b/protocols/JabberG/jabber_libstr.cpp
@@ -22,22 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "jabber.h"
-void __stdcall replaceStr( char*& dest, const char* src )
-{
- if ( dest != NULL )
- mir_free( dest );
-
- dest = ( src != NULL ) ? mir_strdup( src ) : NULL;
-}
-
-void __stdcall replaceStr( WCHAR*& dest, const WCHAR* src )
-{
- if ( dest != NULL )
- mir_free( dest );
-
- dest = ( src != NULL ) ? mir_wstrdup( src ) : NULL;
-}
-
int lstrcmp_null(const TCHAR *s1, const TCHAR *s2)
{
if (!s1 && !s2) return 0;
diff --git a/protocols/JabberG/jabber_list.cpp b/protocols/JabberG/jabber_list.cpp
index 3721b00c7e..8a956ebc47 100644
--- a/protocols/JabberG/jabber_list.cpp
+++ b/protocols/JabberG/jabber_list.cpp
@@ -249,7 +249,7 @@ int CJabberProto::ListAddResource( JABBER_LIST list, const TCHAR* jid, int statu
if ( !_tcscmp( r->resourceName, resource )) {
// Already exist, update status and statusMessage
r->status = status;
- replaceStr( r->statusMessage, statusMessage );
+ replaceStrT( r->statusMessage, statusMessage );
r->priority = priority;
break;
} }
@@ -273,7 +273,7 @@ int CJabberProto::ListAddResource( JABBER_LIST list, const TCHAR* jid, int statu
// No resource, update the main statusMessage
else {
LI->itemResource.status = status;
- replaceStr( LI->itemResource.statusMessage, statusMessage );
+ replaceStrT( LI->itemResource.statusMessage, statusMessage );
}
LeaveCriticalSection( &m_csLists );
diff --git a/protocols/JabberG/jabber_message_manager.h b/protocols/JabberG/jabber_message_manager.h
index 5265056bca..dd52b50683 100644
--- a/protocols/JabberG/jabber_message_manager.h
+++ b/protocols/JabberG/jabber_message_manager.h
@@ -31,9 +31,6 @@ struct CJabberProto;
typedef void ( CJabberProto::*JABBER_MESSAGE_PFUNC )( HXML messageNode, void *usedata );
typedef void ( *MESSAGE_USER_DATA_FREE_FUNC )( void *pUserData );
-void __stdcall replaceStr( char*& dest, const char* src );
-void __stdcall replaceStr( WCHAR*& dest, const WCHAR* src );
-
class CJabberMessageInfo;
typedef BOOL ( CJabberProto::*JABBER_PERMANENT_MESSAGE_HANDLER )( HXML messageNode, ThreadData *pThreadData, CJabberMessageInfo* pInfo );
@@ -185,9 +182,9 @@ public:
pInfo->m_pHandler = pHandler;
pInfo->m_nMessageTypes = nMessageTypes ? nMessageTypes : JABBER_MESSAGE_TYPE_ANY;
- replaceStr( pInfo->m_szXmlns, szXmlns );
+ replaceStrT( pInfo->m_szXmlns, szXmlns );
pInfo->m_bAllowPartialNs = bAllowPartialNs;
- replaceStr( pInfo->m_szTag, szTag );
+ replaceStrT( pInfo->m_szTag, szTag );
pInfo->m_dwParamsToParse = dwParamsToParse;
pInfo->m_pUserData = pUserData;
pInfo->m_pUserDataFree = pUserDataFree;
diff --git a/protocols/JabberG/jabber_privacy.h b/protocols/JabberG/jabber_privacy.h
index a6fe82e725..4a2cfd8f2f 100644
--- a/protocols/JabberG/jabber_privacy.h
+++ b/protocols/JabberG/jabber_privacy.h
@@ -109,7 +109,7 @@ public:
}
__inline BOOL SetValue( TCHAR *szValue )
{
- replaceStr( m_szValue, szValue );
+ replaceStrT( m_szValue, szValue );
return TRUE;
}
__inline DWORD GetPackets()
@@ -359,11 +359,11 @@ public:
}
void SetActiveListName(const TCHAR *szListName)
{
- replaceStr(m_szActiveListName, szListName);
+ replaceStrT(m_szActiveListName, szListName);
}
void SetDefaultListName(const TCHAR *szListName)
{
- replaceStr(m_szDefaultListName, szListName);
+ replaceStrT(m_szDefaultListName, szListName);
}
TCHAR* GetDefaultListName()
{
diff --git a/protocols/JabberG/jabber_proto.cpp b/protocols/JabberG/jabber_proto.cpp
index 8e6bc32294..8369570506 100644
--- a/protocols/JabberG/jabber_proto.cpp
+++ b/protocols/JabberG/jabber_proto.cpp
@@ -682,7 +682,7 @@ int __cdecl CJabberProto::FileResume( HANDLE hTransfer, int* action, const TCHAR
return 1;
if ( *action == FILERESUME_RENAME )
- replaceStr( ft->std.tszCurrentFile, *szFilename );
+ replaceStrT( ft->std.tszCurrentFile, *szFilename );
SetEvent( ft->hWaitEvent );
return 0;
diff --git a/protocols/JabberG/jabber_rc.h b/protocols/JabberG/jabber_rc.h
index 763743a28e..cb3bf1b9cc 100644
--- a/protocols/JabberG/jabber_rc.h
+++ b/protocols/JabberG/jabber_rc.h
@@ -110,9 +110,9 @@ public:
CJabberAdhocNode( CJabberProto* pProto, TCHAR* szJid, TCHAR* szNode, TCHAR* szName, JABBER_ADHOC_HANDLER pHandler )
{
ZeroMemory( this, sizeof( CJabberAdhocNode ));
- replaceStr( m_szJid, szJid );
- replaceStr( m_szNode, szNode );
- replaceStr( m_szName, szName );
+ replaceStrT( m_szJid, szJid );
+ replaceStrT( m_szNode, szNode );
+ replaceStrT( m_szName, szName );
m_pHandler = pHandler;
m_pProto = pProto;
}
diff --git a/protocols/JabberG/jabber_thread.cpp b/protocols/JabberG/jabber_thread.cpp
index 740c9c4c91..b93b1127d8 100644
--- a/protocols/JabberG/jabber_thread.cpp
+++ b/protocols/JabberG/jabber_thread.cpp
@@ -1542,9 +1542,9 @@ void CJabberProto::OnProcessPresenceCapabilites( HXML node )
const TCHAR *szVer = xmlGetAttrValue( n, _T("ver"));
const TCHAR *szExt = xmlGetAttrValue( n, _T("ext"));
if ( szNode && szVer ) {
- replaceStr( r->szCapsNode, szNode );
- replaceStr( r->szCapsVer, szVer );
- replaceStr( r->szCapsExt, szExt );
+ replaceStrT( r->szCapsNode, szNode );
+ replaceStrT( r->szCapsVer, szVer );
+ replaceStrT( r->szCapsExt, szExt );
HANDLE hContact = HContactFromJID( from );
if ( hContact )
UpdateMirVer( hContact, r );
@@ -1769,9 +1769,9 @@ void CJabberProto::OnProcessPresence( HXML node, ThreadData* info )
{
item->itemResource.status = ID_STATUS_OFFLINE;
if ((( statusNode = xmlGetChild( node , "status" )) != NULL ) && xmlGetText( statusNode ))
- replaceStr( item->itemResource.statusMessage, xmlGetText( statusNode ));
+ replaceStrT( item->itemResource.statusMessage, xmlGetText( statusNode ));
else
- replaceStr( item->itemResource.statusMessage, NULL );
+ replaceStrT( item->itemResource.statusMessage, NULL );
}
}
else Log( "SKIP Receive presence offline from " TCHAR_STR_PARAM " ( who is not in my roster )", from );
@@ -1856,9 +1856,9 @@ void CJabberProto::OnIqResultVersion( HXML /*node*/, CJabberIqInfo *pInfo )
r->dwVersionRequestTime = -1;
- replaceStr( r->software, NULL );
- replaceStr( r->version, NULL );
- replaceStr( r->system, NULL );
+ replaceStrT( r->software, NULL );
+ replaceStrT( r->version, NULL );
+ replaceStrT( r->system, NULL );
HXML queryNode = pInfo->GetChildNode();
diff --git a/protocols/JabberG/jabber_xstatus.cpp b/protocols/JabberG/jabber_xstatus.cpp
index cd1f5c9a50..07ee610a80 100644
--- a/protocols/JabberG/jabber_xstatus.cpp
+++ b/protocols/JabberG/jabber_xstatus.cpp
@@ -750,7 +750,7 @@ void CPepMood::SetMood(HANDLE hContact, const TCHAR *szMood, const TCHAR *szText
if (!hContact)
{
m_mode = mood;
- replaceStr(m_text, szText);
+ replaceStrT(m_text, szText);
HANDLE hIcon = (mood >= 0) ? m_icons.GetIcolibHandle(g_arrMoods[mood].szTag) : LoadSkinnedIconHandle(SKINICON_OTHER_SMALLDOT);
TCHAR title[128];
@@ -805,7 +805,7 @@ void CPepMood::ShowSetDialog(BYTE bQuiet)
return;
m_mode = dlg.GetStatusMode();
- replaceStr(m_text, dlg.GetStatusText());
+ replaceStrT(m_text, dlg.GetStatusText());
}
if (m_mode >= 0)
@@ -1177,7 +1177,7 @@ void CPepActivity::SetActivity(HANDLE hContact, LPCTSTR szFirst, LPCTSTR szSecon
if (!hContact)
{
m_mode = activity;
- replaceStr(m_text, szText);
+ replaceStrT(m_text, szText);
HANDLE hIcon = (activity >= 0) ? m_icons.GetIcolibHandle(returnActivity(activity)) : LoadSkinnedIconHandle(SKINICON_OTHER_SMALLDOT);
TCHAR title[128];
@@ -1222,7 +1222,7 @@ void CPepActivity::ShowSetDialog(BYTE bQuiet)
m_mode = dlg.GetStatusMode();
if (m_mode >= 0)
{
- replaceStr(m_text, dlg.GetStatusText());
+ replaceStrT(m_text, dlg.GetStatusText());
Publish();
UpdateMenuItem(m_icons.GetIcolibHandle(returnActivity(m_mode)), g_arrActivities[m_mode].szTitle);
diff --git a/protocols/MSN/msn_global.h b/protocols/MSN/msn_global.h
index 1c446112f6..955c3123db 100644
--- a/protocols/MSN/msn_global.h
+++ b/protocols/MSN/msn_global.h
@@ -206,8 +206,6 @@ TCHAR* EscapeChatTags(const TCHAR* pszText);
TCHAR* UnEscapeChatTags(TCHAR* str_in);
void overrideStr(TCHAR*& dest, const TCHAR* src, bool unicode, const TCHAR* def = NULL);
-void replaceStr(char*& dest, const char* src);
-void replaceStr(wchar_t*& dest, const wchar_t* src);
char* arrayToHex(BYTE* data, size_t datasz);
diff --git a/protocols/MSN/msn_libstr.cpp b/protocols/MSN/msn_libstr.cpp
index 9cb83bbb63..4eb7a1c220 100644
--- a/protocols/MSN/msn_libstr.cpp
+++ b/protocols/MSN/msn_libstr.cpp
@@ -20,24 +20,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "msn_global.h"
-void replaceStr(char*& dest, const char* src)
-{
- if (src != NULL)
- {
- mir_free(dest);
- dest = mir_strdup(src);
- }
-}
-
-void replaceStr(wchar_t*& dest, const wchar_t* src)
-{
- if (src != NULL)
- {
- mir_free(dest);
- dest = mir_wstrdup(src);
- }
-}
-
static TCHAR* a2tf(const TCHAR* str, bool unicode)
{
if (str == NULL)
diff --git a/protocols/MSN/msn_misc.cpp b/protocols/MSN/msn_misc.cpp
index 6a81bdedae..c3f53dc5e1 100644
--- a/protocols/MSN/msn_misc.cpp
+++ b/protocols/MSN/msn_misc.cpp
@@ -1217,7 +1217,7 @@ int filetransfer::openNext(void)
if (std.ptszFiles && std.ptszFiles[cf])
{
bCompleted = false;
- replaceStr(std.tszCurrentFile, std.ptszFiles[cf]);
+ replaceStrT(std.tszCurrentFile, std.ptszFiles[cf]);
fileId = _topen(std.tszCurrentFile, _O_BINARY | _O_RDONLY, _S_IREAD);
if (fileId != -1)
{
diff --git a/protocols/MSN/msn_proto.cpp b/protocols/MSN/msn_proto.cpp
index d10a5b2905..db417d84d0 100644
--- a/protocols/MSN/msn_proto.cpp
+++ b/protocols/MSN/msn_proto.cpp
@@ -545,7 +545,7 @@ void __cdecl CMsnProto::MsnFileAckThread(void* arg)
TCHAR filefull[MAX_PATH];
mir_sntprintf(filefull, SIZEOF(filefull), _T("%s\\%s"), ft->std.tszWorkingDir, ft->std.tszCurrentFile);
- replaceStr(ft->std.tszCurrentFile, filefull);
+ replaceStrT(ft->std.tszCurrentFile, filefull);
if (SendBroadcast(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, ft, (LPARAM)&ft->std))
return;
@@ -669,7 +669,7 @@ int __cdecl CMsnProto::FileResume(HANDLE hTransfer, int* action, const PROTOCHAR
break;
case FILERESUME_RENAME:
- replaceStr(ft->std.tszCurrentFile, *szFilename);
+ replaceStrT(ft->std.tszCurrentFile, *szFilename);
default:
bool fcrt = ft->create() != -1;
diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def
index 43dd94d7ac..2939f2feda 100644
--- a/src/mir_core/mir_core.def
+++ b/src/mir_core/mir_core.def
@@ -124,3 +124,5 @@ db_set_w @121
db_set_ws @122
UnloadCoreModule @123
Thread_SetName @124
+replaceStr @125
+replaceStrW @126 \ No newline at end of file
diff --git a/src/mir_core/mir_core_10.vcxproj b/src/mir_core/mir_core_10.vcxproj
index 03ea9c52e1..e5f452eb61 100644
--- a/src/mir_core/mir_core_10.vcxproj
+++ b/src/mir_core/mir_core_10.vcxproj
@@ -48,7 +48,7 @@
<ClCompile Include="utils.cpp" />
</ItemGroup>
<PropertyGroup Label="Globals">
- <ProjectName>Mir_core</ProjectName>
+ <ProjectName>mir_core</ProjectName>
<ProjectGuid>{D9EFEA4B-B817-4DE1-BD62-68A5DB8F5F60}</ProjectGuid>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
diff --git a/src/mir_core/utils.cpp b/src/mir_core/utils.cpp
index 4ebba2f293..12aad9d8a9 100644
--- a/src/mir_core/utils.cpp
+++ b/src/mir_core/utils.cpp
@@ -23,6 +23,22 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "commonheaders.h"
+MIR_CORE_DLL(char*) replaceStr( char* &dest, const char *src )
+{
+ if ( dest != NULL )
+ mir_free( dest );
+
+ return dest = ( src != NULL ) ? mir_strdup( src ) : NULL;
+}
+
+MIR_CORE_DLL(WCHAR*) replaceStrW( WCHAR* &dest, const WCHAR *src )
+{
+ if ( dest != NULL )
+ mir_free( dest );
+
+ return dest = ( src != NULL ) ? mir_wstrdup( src ) : NULL;
+}
+
MIR_CORE_DLL(char*) rtrim(char* str)
{
if (str == NULL)