summaryrefslogtreecommitdiff
path: root/protocols/Tox/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-07-27 14:23:31 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-07-27 14:23:31 +0000
commit2f261839b60692e33d0e160344d0d636d49c90ba (patch)
tree187921722698b681d29df3f6e60fb18394a5e9d5 /protocols/Tox/src
parent2e931a0b2780587d85f3902468c935f5adba70c8 (diff)
less TCHARs
git-svn-id: http://svn.miranda-ng.org/main/trunk@17138 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src')
-rw-r--r--protocols/Tox/src/tox_accounts.cpp8
-rw-r--r--protocols/Tox/src/tox_avatars.cpp26
-rw-r--r--protocols/Tox/src/tox_chatrooms.cpp4
-rw-r--r--protocols/Tox/src/tox_contacts.cpp16
-rw-r--r--protocols/Tox/src/tox_core.cpp8
-rw-r--r--protocols/Tox/src/tox_messages.cpp2
-rw-r--r--protocols/Tox/src/tox_multimedia.cpp20
-rw-r--r--protocols/Tox/src/tox_netlib.cpp2
-rw-r--r--protocols/Tox/src/tox_network.cpp2
-rw-r--r--protocols/Tox/src/tox_options.cpp58
-rw-r--r--protocols/Tox/src/tox_profile.cpp6
-rw-r--r--protocols/Tox/src/tox_proto.cpp2
-rw-r--r--protocols/Tox/src/tox_services.cpp2
-rw-r--r--protocols/Tox/src/tox_transfer.cpp10
-rw-r--r--protocols/Tox/src/tox_transfer.h4
-rw-r--r--protocols/Tox/src/tox_utils.cpp4
16 files changed, 87 insertions, 87 deletions
diff --git a/protocols/Tox/src/tox_accounts.cpp b/protocols/Tox/src/tox_accounts.cpp
index 0c4cea1a40..dfdca9e4f7 100644
--- a/protocols/Tox/src/tox_accounts.cpp
+++ b/protocols/Tox/src/tox_accounts.cpp
@@ -4,7 +4,7 @@ LIST<CToxProto> CToxProto::Accounts(1, CToxProto::CompareAccounts);
int CToxProto::CompareAccounts(const CToxProto *p1, const CToxProto *p2)
{
- return mir_tstrcmp(p1->m_tszUserName, p2->m_tszUserName);
+ return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName);
}
CToxProto* CToxProto::InitAccount(const char *protoName, const wchar_t *userName)
@@ -44,12 +44,12 @@ int CToxProto::OnAccountRenamed(WPARAM, LPARAM)
{
mir_cslock locker(profileLock);
- ptrT newPath(GetToxProfilePath());
+ ptrW newPath(GetToxProfilePath());
wchar_t oldPath[MAX_PATH];
- mir_sntprintf(oldPath, MAX_PATH, L"%s\\%s.tox", VARST(L"%miranda_userdata%"), accountName);
+ mir_snwprintf(oldPath, MAX_PATH, L"%s\\%s.tox", VARST(L"%miranda_userdata%"), accountName);
_wrename(oldPath, newPath);
mir_free(accountName);
- accountName = mir_tstrdup(m_tszUserName);
+ accountName = mir_wstrdup(m_tszUserName);
return 0;
}
diff --git a/protocols/Tox/src/tox_avatars.cpp b/protocols/Tox/src/tox_avatars.cpp
index 252f9f6a18..ed0c482cda 100644
--- a/protocols/Tox/src/tox_avatars.cpp
+++ b/protocols/Tox/src/tox_avatars.cpp
@@ -3,21 +3,21 @@
wchar_t* CToxProto::GetAvatarFilePath(MCONTACT hContact)
{
wchar_t *path = (wchar_t*)mir_calloc(MAX_PATH * sizeof(wchar_t) + 1);
- mir_sntprintf(path, MAX_PATH, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
+ mir_snwprintf(path, MAX_PATH, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
DWORD dwAttributes = GetFileAttributes(path);
if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
CreateDirectoryTreeT(path);
- ptrT address(getTStringA(hContact, TOX_SETTINGS_ID));
+ ptrW address(getTStringA(hContact, TOX_SETTINGS_ID));
if (address == NULL) {
mir_free(path);
- return mir_tstrdup(L"");
+ return mir_wstrdup(L"");
}
- if (hContact && mir_tstrlen(address) > TOX_PUBLIC_KEY_SIZE * 2)
+ if (hContact && mir_wstrlen(address) > TOX_PUBLIC_KEY_SIZE * 2)
address[TOX_PUBLIC_KEY_SIZE * 2] = 0;
- mir_sntprintf(path, MAX_PATH, L"%s\\%s.png", path, address);
+ mir_snwprintf(path, MAX_PATH, L"%s\\%s.png", path, address);
return path;
}
@@ -133,10 +133,10 @@ INT_PTR CToxProto::GetAvatarInfo(WPARAM, LPARAM lParam)
ptrA address(getStringA(pai->hContact, TOX_SETTINGS_ID));
if (address != NULL)
{
- ptrT path(GetAvatarFilePath(pai->hContact));
+ ptrW path(GetAvatarFilePath(pai->hContact));
if (IsFileExists(path))
{
- mir_tstrncpy(pai->filename, path, _countof(pai->filename));
+ mir_wstrncpy(pai->filename, path, _countof(pai->filename));
pai->format = PA_FORMAT_PNG;
return GAIR_SUCCESS;
@@ -148,9 +148,9 @@ INT_PTR CToxProto::GetAvatarInfo(WPARAM, LPARAM lParam)
INT_PTR CToxProto::GetMyAvatar(WPARAM wParam, LPARAM lParam)
{
- ptrT path(GetAvatarFilePath());
+ ptrW path(GetAvatarFilePath());
if (IsFileExists(path))
- mir_tstrncpy((wchar_t*)wParam, path, (int)lParam);
+ mir_wstrncpy((wchar_t*)wParam, path, (int)lParam);
return 0;
}
@@ -159,7 +159,7 @@ INT_PTR CToxProto::SetMyAvatar(WPARAM, LPARAM lParam)
{
debugLogA(__FUNCTION__": setting avatar");
wchar_t *path = (wchar_t*)lParam;
- ptrT avatarPath(GetAvatarFilePath());
+ ptrW avatarPath(GetAvatarFilePath());
if (path != NULL)
{
debugLogA(__FUNCTION__": copy new avatar");
@@ -208,7 +208,7 @@ void CToxProto::OnGotFriendAvatarInfo(AvatarTransferParam *transfer)
if (transfer->pfts.totalBytes == 0)
{
MCONTACT hConact = transfer->pfts.hContact;
- ptrT path(GetAvatarFilePath(hConact));
+ ptrW path(GetAvatarFilePath(hConact));
if (IsFileExists(path))
DeleteFile(path);
@@ -231,7 +231,7 @@ void CToxProto::OnGotFriendAvatarInfo(AvatarTransferParam *transfer)
}
wchar_t path[MAX_PATH];
- mir_sntprintf(path, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
+ mir_snwprintf(path, L"%s\\%S", VARST(L"%miranda_avatarcache%"), m_szModuleName);
OnFileAllow(transfer->pfts.hContact, transfer, path);
}
@@ -242,7 +242,7 @@ void CToxProto::OnGotFriendAvatarData(AvatarTransferParam *transfer)
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.format = PA_FORMAT_PNG;
ai.hContact = transfer->pfts.hContact;
- mir_tstrcpy(ai.filename, transfer->pfts.tszCurrentFile);
+ mir_wstrcpy(ai.filename, transfer->pfts.tszCurrentFile);
fclose(transfer->hFile);
transfer->hFile = NULL;
diff --git a/protocols/Tox/src/tox_chatrooms.cpp b/protocols/Tox/src/tox_chatrooms.cpp
index f0a538fb5c..fde562fe83 100644
--- a/protocols/Tox/src/tox_chatrooms.cpp
+++ b/protocols/Tox/src/tox_chatrooms.cpp
@@ -29,7 +29,7 @@ MCONTACT CToxProto::AddChatRoom(int groupNumber)
setWord(hContact, TOX_SETTINGS_CHAT_ID, groupNumber);
wchar_t title[MAX_PATH];
- mir_sntprintf(title, L"%s #%d", TranslateT("Group chat"), groupNumber);
+ mir_snwprintf(title, L"%s #%d", TranslateT("Group chat"), groupNumber);
setTString(hContact, "Nick", title);
DBVARIANT dbv;
@@ -67,7 +67,7 @@ void CToxProto::LoadChatRoomList(void*)
{
uint8_t title[TOX_MAX_NAME_LENGTH] = { 0 };
tox_group_get_title(toxThread->Tox(), groupNumber, title, TOX_MAX_NAME_LENGTH);
- setWString(hContact, "Nick", ptrT(mir_utf8decodeT((char*)title)));
+ setWString(hContact, "Nick", ptrW(mir_utf8decodeW((char*)title)));
}
}
mir_free(groupChats);
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp
index a78d6e3b39..d3e094e0db 100644
--- a/protocols/Tox/src/tox_contacts.cpp
+++ b/protocols/Tox/src/tox_contacts.cpp
@@ -91,10 +91,10 @@ MCONTACT CToxProto::AddContact(const char *address, const char *nick, const char
setString(hContact, TOX_SETTINGS_ID, address);
if (mir_strlen(nick))
- setTString(hContact, "Nick", ptrT(mir_utf8decodeT(nick)));
+ setTString(hContact, "Nick", ptrW(mir_utf8decodeW(nick)));
if (mir_strlen(dnsId))
- setTString(hContact, TOX_SETTINGS_DNS, ptrT(mir_utf8decodeT(dnsId)));
+ setTString(hContact, TOX_SETTINGS_DNS, ptrW(mir_utf8decodeW(dnsId)));
DBVARIANT dbv;
if (!getTString(TOX_SETTINGS_GROUP, &dbv))
@@ -149,7 +149,7 @@ void CToxProto::LoadFriendList(void*)
TOX_ERR_FRIEND_QUERY getNameResult;
uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 };
if (tox_friend_get_name(toxThread->Tox(), friendNumber, nick, &getNameResult))
- setTString(hContact, "Nick", ptrT(mir_utf8decodeT((char*)nick)));
+ setTString(hContact, "Nick", ptrW(mir_utf8decodeW((char*)nick)));
else
debugLogA(__FUNCTION__": failed to get friend name (%d)", getNameResult);
@@ -188,7 +188,7 @@ INT_PTR CToxProto::OnRequestAuth(WPARAM hContact, LPARAM lParam)
uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 };
TOX_ERR_FRIEND_QUERY errorFriendQuery;
if (tox_friend_get_name(toxThread->Tox(), friendNumber, nick, &errorFriendQuery))
- setTString(hContact, "Nick", ptrT(mir_utf8decodeT((char*)nick)));
+ setTString(hContact, "Nick", ptrW(mir_utf8decodeW((char*)nick)));
else
debugLogA(__FUNCTION__": failed to get friend name (%d)", errorFriendQuery);
@@ -291,7 +291,7 @@ void CToxProto::OnFriendNameChange(Tox*, uint32_t friendNumber, const uint8_t *n
memcpy(rawName, name, length);
rawName[length] = 0;
- ptrT nickname(mir_utf8decodeW(rawName));
+ ptrW nickname(mir_utf8decodeW(rawName));
proto->setTString(hContact, "Nick", nickname);
}
}
@@ -306,7 +306,7 @@ void CToxProto::OnStatusMessageChanged(Tox*, uint32_t friendNumber, const uint8_
memcpy(rawMessage, message, length);
rawMessage[length] = 0;
- ptrT statusMessage(mir_utf8decodeT(rawMessage));
+ ptrW statusMessage(mir_utf8decodeW(rawMessage));
db_set_ts(hContact, "CList", "StatusMsg", statusMessage);
}
}
@@ -340,7 +340,7 @@ void CToxProto::OnConnectionStatusChanged(Tox*, uint32_t friendNumber, TOX_CONNE
proto->ResumeIncomingTransfers(friendNumber);
// update avatar
- ptrT avatarPath(proto->GetAvatarFilePath());
+ ptrW avatarPath(proto->GetAvatarFilePath());
if (IsFileExists(avatarPath))
{
FILE *hFile = _wfopen(avatarPath, L"rb");
@@ -441,7 +441,7 @@ INT_PTR CToxProto::UserInfoProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar
break;
}
- SetDlgItemText(hwnd, IDC_DNS_ID, ptrT(proto->getTStringA(hContact, TOX_SETTINGS_DNS)));
+ SetDlgItemText(hwnd, IDC_DNS_ID, ptrW(proto->getTStringA(hContact, TOX_SETTINGS_DNS)));
}
break;
diff --git a/protocols/Tox/src/tox_core.cpp b/protocols/Tox/src/tox_core.cpp
index b535597a0e..108d9b0003 100644
--- a/protocols/Tox/src/tox_core.cpp
+++ b/protocols/Tox/src/tox_core.cpp
@@ -95,9 +95,9 @@ bool CToxProto::InitToxCore(CToxThread *toxThread)
/*uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 };
tox_self_get_name(toxThread->Tox(), nick);
- setTString("Nick", ptrT(Utf8DecodeT((char*)nick)));*/
+ setTString("Nick", ptrW(Utf8DecodeT((char*)nick)));*/
- ptrA nick(mir_utf8encodeT(ptrT(getTStringA("Nick"))));
+ ptrA nick(mir_utf8encodeW(ptrW(getTStringA("Nick"))));
tox_self_set_name(toxThread->Tox(), (uint8_t*)(char*)nick, mir_strlen(nick), &error);
if (error != TOX_ERR_SET_INFO_OK)
{
@@ -107,9 +107,9 @@ bool CToxProto::InitToxCore(CToxThread *toxThread)
/*uint8_t statusMessage[TOX_MAX_STATUS_MESSAGE_LENGTH] = { 0 };
tox_self_get_status_message(toxThread->Tox(), statusMessage);
- setTString("StatusMsg", ptrT(Utf8DecodeT((char*)statusMessage)));*/
+ setTString("StatusMsg", ptrW(Utf8DecodeT((char*)statusMessage)));*/
- ptrA statusMessage(mir_utf8encodeT(ptrT(getTStringA("StatusMsg"))));
+ ptrA statusMessage(mir_utf8encodeW(ptrW(getTStringA("StatusMsg"))));
tox_self_set_status_message(toxThread->Tox(), (uint8_t*)(char*)statusMessage, mir_strlen(statusMessage), &error);
if (error != TOX_ERR_SET_INFO_OK)
{
diff --git a/protocols/Tox/src/tox_messages.cpp b/protocols/Tox/src/tox_messages.cpp
index c2c409c3e2..b1c6ef7d3d 100644
--- a/protocols/Tox/src/tox_messages.cpp
+++ b/protocols/Tox/src/tox_messages.cpp
@@ -159,7 +159,7 @@ void CToxProto::GetStatusMessageAsync(void* arg)
return;
}
- ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)hContact, ptrT(mir_utf8decodeT(statusMessage)));
+ ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE)hContact, ptrW(mir_utf8decodeW(statusMessage)));
}
/* TYPING */
diff --git a/protocols/Tox/src/tox_multimedia.cpp b/protocols/Tox/src/tox_multimedia.cpp
index 1238ecfda7..0cf156dace 100644
--- a/protocols/Tox/src/tox_multimedia.cpp
+++ b/protocols/Tox/src/tox_multimedia.cpp
@@ -55,7 +55,7 @@ void CToxIncomingCall::OnInitDialog()
from.SetText(nick);
wchar_t title[MAX_PATH];
- mir_sntprintf(title, TranslateT("Incoming call from %s"), nick);
+ mir_snwprintf(title, TranslateT("Incoming call from %s"), nick);
SetTitle(title);
SetIcon("audio_ring");
}
@@ -109,7 +109,7 @@ void CToxOutgoingCall::OnInitDialog()
to.SetText(nick);
wchar_t title[MAX_PATH];
- mir_sntprintf(title, TranslateT("Outgoing call to %s"), nick);
+ mir_snwprintf(title, TranslateT("Outgoing call to %s"), nick);
SetTitle(title);
SetIcon("audio_end");
}
@@ -149,7 +149,7 @@ void CToxOutgoingCall::OnCall(CCtrlBase*)
char *message = NULL;
wchar_t title[MAX_PATH];
if (GetWindowText(m_hwnd, title, _countof(title)))
- message = mir_utf8encodeT(title);
+ message = mir_utf8encodeW(title);
else
message = mir_utf8encode("Outgoing call");
m_proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
@@ -316,7 +316,7 @@ void CToxProto::OnFriendCall(ToxAV *toxAV, uint32_t friend_number, bool audio_en
}
wchar_t message[MAX_PATH];
- mir_sntprintf(message, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(message, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
T2Utf szMessage(message);
PROTORECVEVENT recv = { 0 };
@@ -351,7 +351,7 @@ INT_PTR CToxProto::OnRecvAudioCall(WPARAM hContact, LPARAM lParam)
cle.hIcon = IcoLib_GetIconByHandle(GetIconHandle(IDI_AUDIO_RING));
wchar_t szTooltip[MAX_PATH];
- mir_sntprintf(szTooltip, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
+ mir_snwprintf(szTooltip, TranslateT("Incoming call from %s"), pcli->pfnGetContactDisplayName(hContact, 0));
cle.ptszTooltip = szTooltip;
char szService[MAX_PATH];
@@ -400,7 +400,7 @@ INT_PTR CToxProto::OnAudioRing(WPARAM, LPARAM lParam)
}
}
- char *message = mir_utf8encodeT(TranslateT("Call canceled"));
+ char *message = mir_utf8encodeW(TranslateT("Call canceled"));
proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
WindowList_Broadcast(proto->hAudioDialogs, WM_CALL_END, hContact, 0);
@@ -435,7 +435,7 @@ INT_PTR CToxProto::OnSendAudioCall(WPARAM hContact, LPARAM)
return;
}
- char *message = mir_utf8encodeT(TranslateT("Call canceled"));
+ char *message = mir_utf8encodeW(TranslateT("Call canceled"));
proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
WindowList_Broadcast(proto->hAudioDialogs, WM_CALL_END, hContact, 0);
@@ -459,7 +459,7 @@ void CToxProto::OnAvCallTimeout(void*, int32_t callId, void *arg)
return;
}
- char *message = mir_utf8encodeT(TranslateT("Call canceled"));
+ char *message = mir_utf8encodeW(TranslateT("Call canceled"));
proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
WindowList_Broadcast(proto->hAudioDialogs, WM_CALL_END, hContact, 0);
@@ -552,7 +552,7 @@ static void CALLBACK ToxShowDialogApcProc(void *arg)
return;
}
- char *message = mir_utf8encodeT(TranslateT("Call started"));
+ char *message = mir_utf8encodeW(TranslateT("Call started"));
proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
@@ -583,7 +583,7 @@ void CToxProto::OnAvEnd(void*, int32_t callId, void *arg)
return;
}
- char *message = mir_utf8encodeT(TranslateT("Call ended"));
+ char *message = mir_utf8encodeW(TranslateT("Call ended"));
proto->AddEventToDb(hContact, DB_EVENT_CALL, time(NULL), DBEF_UTF, (PBYTE)message, mir_strlen(message));
WindowList_Broadcast(proto->hAudioDialogs, WM_CALL_END, hContact, 0);
diff --git a/protocols/Tox/src/tox_netlib.cpp b/protocols/Tox/src/tox_netlib.cpp
index c32e8059c8..82153c743a 100644
--- a/protocols/Tox/src/tox_netlib.cpp
+++ b/protocols/Tox/src/tox_netlib.cpp
@@ -3,7 +3,7 @@
void CToxProto::InitNetlib()
{
wchar_t name[128];
- mir_sntprintf(name, TranslateT("%s connection"), m_tszUserName);
+ mir_snwprintf(name, TranslateT("%s connection"), m_tszUserName);
NETLIBUSER nlu = {0};
nlu.cbSize = sizeof(nlu);
diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp
index 2f5b3dcddb..580fa31622 100644
--- a/protocols/Tox/src/tox_network.cpp
+++ b/protocols/Tox/src/tox_network.cpp
@@ -157,7 +157,7 @@ void CToxProto::UpdateNodes()
if (lastUpdate <= getDword("NodesUpdate", 0))
return;
- ptrT path(mir_tstrdup((wchar_t*)VARST(_A2W(TOX_JSON_PATH))));
+ ptrW path(mir_wstrdup((wchar_t*)VARST(_A2W(TOX_JSON_PATH))));
if (!IsFileExists(path))
{
HANDLE hProfile = CreateFile(path, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp
index 4b31e1cf61..96564f432e 100644
--- a/protocols/Tox/src/tox_options.cpp
+++ b/protocols/Tox/src/tox_options.cpp
@@ -26,7 +26,7 @@ void CToxOptionsMain::OnInitDialog()
{
CToxDlgBase::OnInitDialog();
- ptrT profilePath(m_proto->GetToxProfilePath());
+ ptrW profilePath(m_proto->GetToxProfilePath());
if (CToxProto::IsFileExists(profilePath))
{
m_toxAddress.Enable();
@@ -67,7 +67,7 @@ void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*)
CToxThread toxThread(options);
tox_options_free(options);
- ptrT profilePath(m_proto->GetToxProfilePath());
+ ptrW profilePath(m_proto->GetToxProfilePath());
if (!m_proto->IsFileExists(profilePath))
{
HANDLE hProfile = CreateFile(profilePath, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -81,8 +81,8 @@ void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*)
if (m_proto->InitToxCore(&toxThread))
{
- ptrT group(m_group.GetText());
- if (mir_tstrlen(group) > 0 && Clist_GroupExists(group))
+ ptrW group(m_group.GetText());
+ if (mir_wstrlen(group) > 0 && Clist_GroupExists(group))
Clist_GroupCreate(0, group);
m_proto->UninitToxCore(&toxThread);
@@ -90,9 +90,9 @@ void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*)
m_toxAddress.Enable();
m_toxAddress.SetTextA(ptrA(m_proto->getStringA(TOX_SETTINGS_ID)));
- m_nickname.SetText(ptrT(m_proto->getTStringA("Nick")));
- m_password.SetText(ptrT(m_proto->getTStringA("Password")));
- m_group.SetText(ptrT(m_proto->getTStringA(TOX_SETTINGS_GROUP)));
+ m_nickname.SetText(ptrW(m_proto->getTStringA("Nick")));
+ m_password.SetText(ptrW(m_proto->getTStringA("Password")));
+ m_group.SetText(ptrW(m_proto->getTStringA(TOX_SETTINGS_GROUP)));
ShowWindow(m_profileCreate.GetHwnd(), FALSE);
ShowWindow(m_profileImport.GetHwnd(), FALSE);
@@ -105,7 +105,7 @@ void CToxOptionsMain::ProfileCreate_OnClick(CCtrlButton*)
void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*)
{
wchar_t filter[MAX_PATH];
- mir_sntprintf(filter, L"%s(*.tox)%c*.tox%c%s(*.*)%c*.*%c%c",
+ mir_snwprintf(filter, L"%s(*.tox)%c*.tox%c%s(*.*)%c*.*%c%c",
TranslateT("Tox profile"), 0, 0, TranslateT("All files"), 0, 0, 0);
wchar_t profilePath[MAX_PATH] = { 0 };
@@ -123,8 +123,8 @@ void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*)
if (!GetOpenFileName(&ofn))
return;
- ptrT defaultProfilePath(m_proto->GetToxProfilePath());
- if (mir_tstrcmpi(profilePath, defaultProfilePath) != 0)
+ ptrW defaultProfilePath(m_proto->GetToxProfilePath());
+ if (mir_wstrcmpi(profilePath, defaultProfilePath) != 0)
CopyFile(profilePath, defaultProfilePath, FALSE);
Tox_Options *options = NULL;
@@ -143,13 +143,13 @@ void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*)
uint8_t nick[TOX_MAX_NAME_LENGTH] = { 0 };
tox_self_get_name(toxThread.Tox(), nick);
- ptrT nickname(Utf8DecodeT((char*)nick));
+ ptrW nickname(Utf8DecodeT((char*)nick));
m_proto->setTString("Nick", nickname);
m_nickname.SetText(nickname);
uint8_t statusMessage[TOX_MAX_STATUS_MESSAGE_LENGTH] = { 0 };
tox_self_get_status_message(toxThread.Tox(), statusMessage);
- m_proto->setTString("StatusMsg", ptrT(Utf8DecodeT((char*)statusMessage)));
+ m_proto->setTString("StatusMsg", ptrW(Utf8DecodeT((char*)statusMessage)));
ShowWindow(m_profileCreate.GetHwnd(), FALSE);
ShowWindow(m_profileImport.GetHwnd(), FALSE);
@@ -163,11 +163,11 @@ void CToxOptionsMain::ProfileImport_OnClick(CCtrlButton*)
void CToxOptionsMain::ProfileExport_OnClick(CCtrlButton*)
{
wchar_t filter[MAX_PATH];
- mir_sntprintf(filter, L"%s(*.tox)%c*.tox%c%c",
+ mir_snwprintf(filter, L"%s(*.tox)%c*.tox%c%c",
TranslateT("Tox profile"), 0, 0, 0);
wchar_t profilePath[MAX_PATH];
- mir_tstrncpy(profilePath, L"tox_save.tox", _countof(profilePath));
+ mir_wstrncpy(profilePath, L"tox_save.tox", _countof(profilePath));
OPENFILENAME ofn = { sizeof(ofn) };
ofn.hwndOwner = m_hwnd;
@@ -182,20 +182,20 @@ void CToxOptionsMain::ProfileExport_OnClick(CCtrlButton*)
if (!GetSaveFileName(&ofn))
return;
- ptrT defaultProfilePath(m_proto->GetToxProfilePath());
- if (mir_tstrcmpi(profilePath, defaultProfilePath) != 0)
+ ptrW defaultProfilePath(m_proto->GetToxProfilePath());
+ if (mir_wstrcmpi(profilePath, defaultProfilePath) != 0)
CopyFile(defaultProfilePath, profilePath, FALSE);
}
void CToxOptionsMain::OnApply()
{
- ptrT group(m_group.GetText());
- if (mir_tstrlen(group) > 0 && Clist_GroupExists(group))
+ ptrW group(m_group.GetText());
+ if (mir_wstrlen(group) > 0 && Clist_GroupExists(group))
Clist_GroupCreate(0, group);
if (m_proto->IsOnline())
{
- CallProtoService(m_proto->m_szModuleName, PS_SETMYNICKNAME, SMNN_TCHAR, (LPARAM)ptrT(m_nickname.GetText()));
+ CallProtoService(m_proto->m_szModuleName, PS_SETMYNICKNAME, SMNN_TCHAR, (LPARAM)ptrW(m_nickname.GetText()));
// todo: add checkbox
m_proto->setTString("Password", pass_ptrT(m_password.GetText()));
@@ -361,21 +361,21 @@ void CToxNodeEditor::OnInitDialog()
void CToxNodeEditor::OnOk(CCtrlBase*)
{
- ptrT ipv4(m_ipv4.GetText());
+ ptrW ipv4(m_ipv4.GetText());
if (!ipv4)
{
MessageBox(m_hwnd, TranslateT("Enter IPv4"), TranslateT("Error"), MB_OK);
return;
}
- ptrT port(m_port.GetText());
+ ptrW port(m_port.GetText());
if (!port)
{
MessageBox(m_hwnd, TranslateT("Enter port"), TranslateT("Error"), MB_OK);
return;
}
- ptrT pubKey(m_pkey.GetText());
+ ptrW pubKey(m_pkey.GetText());
if (!pubKey)
{
MessageBox(m_hwnd, TranslateT("Enter public key"), TranslateT("Error"), MB_OK);
@@ -563,17 +563,17 @@ void CToxOptionsNodeList::ReloadNodeList()
{
JSONNode node = nodes[i];
- ptrT ipv4(mir_utf8decodeT(node.at("ipv4").as_string().c_str()));
+ ptrW ipv4(mir_utf8decodeW(node.at("ipv4").as_string().c_str()));
iItem = m_nodes.AddItem(ipv4, -1, NULL, 0);
- ptrT ipv6(mir_utf8decodeT(node.at("ipv6").as_string().c_str()));
- if (mir_tstrcmp(ipv6, L"-"))
+ ptrW ipv6(mir_utf8decodeW(node.at("ipv6").as_string().c_str()));
+ if (mir_wstrcmp(ipv6, L"-"))
m_nodes.SetItem(iItem, 1, ipv6);
- ptrT port(mir_utf8decodeT(node.at("port").as_string().c_str()));
+ ptrW port(mir_utf8decodeW(node.at("port").as_string().c_str()));
m_nodes.SetItem(iItem, 2, port);
- ptrT pubKey(mir_utf8decodeT(node.at("public_key").as_string().c_str()));
+ ptrW pubKey(mir_utf8decodeW(node.at("public_key").as_string().c_str()));
m_nodes.SetItem(iItem, 3, pubKey);
}
}
@@ -586,7 +586,7 @@ void CToxOptionsNodeList::ReloadNodeList()
for (int i = 0; i < nodeCount; i++)
{
mir_snprintf(setting, TOX_SETTINGS_NODE_IPV4, i);
- ptrT value(db_get_tsa(NULL, module, setting));
+ ptrW value(db_get_tsa(NULL, module, setting));
iItem = m_nodes.AddItem(value, -1, NULL, 1);
mir_snprintf(setting, TOX_SETTINGS_NODE_IPV6, i);
@@ -599,7 +599,7 @@ void CToxOptionsNodeList::ReloadNodeList()
{
char portNum[10];
itoa(port, portNum, 10);
- m_nodes.SetItem(iItem, 2, mir_a2t(portNum));
+ m_nodes.SetItem(iItem, 2, mir_a2u(portNum));
}
mir_snprintf(setting, TOX_SETTINGS_NODE_PKEY, i);
diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp
index 32a024480d..16658bc7c6 100644
--- a/protocols/Tox/src/tox_profile.cpp
+++ b/protocols/Tox/src/tox_profile.cpp
@@ -12,7 +12,7 @@ wchar_t* CToxProto::GetToxProfilePath(const wchar_t *accountName)
wchar_t *profilePath = (wchar_t*)mir_calloc(MAX_PATH * sizeof(wchar_t) + 1);
wchar_t profileRootPath[MAX_PATH];
FoldersGetCustomPathT(hProfileFolderPath, profileRootPath, _countof(profileRootPath), VARST(L"%miranda_userdata%"));
- mir_sntprintf(profilePath, MAX_PATH, L"%s\\%s.tox", profileRootPath, accountName);
+ mir_snwprintf(profilePath, MAX_PATH, L"%s\\%s.tox", profileRootPath, accountName);
return profilePath;
}
@@ -22,7 +22,7 @@ bool CToxProto::LoadToxProfile(Tox_Options *options)
mir_cslock locker(profileLock);
- ptrT profilePath(GetToxProfilePath());
+ ptrW profilePath(GetToxProfilePath());
if (!IsFileExists(profilePath))
return false;
@@ -121,7 +121,7 @@ void CToxProto::SaveToxProfile(CToxThread *toxThread)
size += TOX_PASS_ENCRYPTION_EXTRA_LENGTH;
}
- ptrT profilePath(GetToxProfilePath());
+ ptrW profilePath(GetToxProfilePath());
FILE *profile = _wfopen(profilePath, L"wb");
if (profile == NULL)
{
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp
index cf8987757d..9ae714bd31 100644
--- a/protocols/Tox/src/tox_proto.cpp
+++ b/protocols/Tox/src/tox_proto.cpp
@@ -7,7 +7,7 @@ CToxProto::CToxProto(const char* protoName, const wchar_t* userName)
{
InitNetlib();
- accountName = mir_tstrdup(userName);
+ accountName = mir_wstrdup(userName);
CreateProtoService(PS_CREATEACCMGRUI, &CToxProto::OnAccountManagerInit);
diff --git a/protocols/Tox/src/tox_services.cpp b/protocols/Tox/src/tox_services.cpp
index 1b5ab155a6..1651bbc597 100644
--- a/protocols/Tox/src/tox_services.cpp
+++ b/protocols/Tox/src/tox_services.cpp
@@ -2,7 +2,7 @@
INT_PTR CToxProto::SetMyNickname(WPARAM wParam, LPARAM lParam)
{
- ptrT nickname((wParam & SMNN_UNICODE) ? mir_u2t((wchar_t*)lParam) : mir_a2t((char*)lParam));
+ ptrW nickname((wParam & SMNN_UNICODE) ? mir_wstrdup((wchar_t*)lParam) : mir_a2u((char*)lParam));
setTString("Nick", nickname);
if (IsOnline())
diff --git a/protocols/Tox/src/tox_transfer.cpp b/protocols/Tox/src/tox_transfer.cpp
index d775117f70..5eaf69dffe 100644
--- a/protocols/Tox/src/tox_transfer.cpp
+++ b/protocols/Tox/src/tox_transfer.cpp
@@ -18,9 +18,9 @@ void CToxProto::OnFriendFile(Tox*, uint32_t friendNumber, uint32_t fileNumber, u
{
Netlib_Logf(proto->m_hNetlibUser, __FUNCTION__": incoming avatar (%d) from (%d)", fileNumber, friendNumber);
- ptrT address(proto->getTStringA(hContact, TOX_SETTINGS_ID));
+ ptrW address(proto->getTStringA(hContact, TOX_SETTINGS_ID));
wchar_t avatarName[MAX_PATH];
- mir_sntprintf(avatarName, MAX_PATH, L"%s.png", address);
+ mir_snwprintf(avatarName, MAX_PATH, L"%s.png", address);
AvatarTransferParam *transfer = new AvatarTransferParam(friendNumber, fileNumber, avatarName, fileSize);
transfer->pfts.flags |= PFTS_RECEIVING;
@@ -45,7 +45,7 @@ void CToxProto::OnFriendFile(Tox*, uint32_t friendNumber, uint32_t fileNumber, u
ptrA rawName((char*)mir_alloc(filenameLength + 1));
memcpy(rawName, fileName, filenameLength);
rawName[filenameLength] = 0;
- wchar_t *name = mir_utf8decodeT(rawName);
+ wchar_t *name = mir_utf8decodeW(rawName);
FileTransferParam *transfer = new FileTransferParam(friendNumber, fileNumber, name, fileSize);
transfer->pfts.flags |= PFTS_RECEIVING;
@@ -74,11 +74,11 @@ void CToxProto::OnFriendFile(Tox*, uint32_t friendNumber, uint32_t fileNumber, u
HANDLE CToxProto::OnFileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t *tszPath)
{
FileTransferParam *transfer = (FileTransferParam*)hTransfer;
- transfer->pfts.tszWorkingDir = mir_tstrdup(tszPath);
+ transfer->pfts.tszWorkingDir = mir_wstrdup(tszPath);
// stupid fix
wchar_t fullPath[MAX_PATH];
- mir_sntprintf(fullPath, L"%s\\%s", transfer->pfts.tszWorkingDir, transfer->pfts.tszCurrentFile);
+ mir_snwprintf(fullPath, L"%s\\%s", transfer->pfts.tszWorkingDir, transfer->pfts.tszCurrentFile);
transfer->ChangeName(fullPath);
if (!ProtoBroadcastAck(hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, (HANDLE)transfer, (LPARAM)&transfer->pfts))
diff --git a/protocols/Tox/src/tox_transfer.h b/protocols/Tox/src/tox_transfer.h
index 40f8faea75..af5b51d8cc 100644
--- a/protocols/Tox/src/tox_transfer.h
+++ b/protocols/Tox/src/tox_transfer.h
@@ -23,7 +23,7 @@ struct FileTransferParam
pfts.hContact = NULL;
pfts.totalFiles = 1;
pfts.ptszFiles = (wchar_t**)mir_alloc(sizeof(wchar_t*)*(pfts.totalFiles + 1));
- pfts.ptszFiles[0] = pfts.tszCurrentFile = mir_tstrdup(fileName);
+ pfts.ptszFiles[0] = pfts.tszCurrentFile = mir_wstrdup(fileName);
pfts.ptszFiles[pfts.totalFiles] = NULL;
pfts.totalBytes = pfts.currentFileSize = fileSize;
pfts.totalProgress = pfts.currentFileProgress = 0;
@@ -42,7 +42,7 @@ struct FileTransferParam
void ChangeName(const wchar_t *fileName)
{
- pfts.ptszFiles[0] = replaceStrT(pfts.tszCurrentFile, fileName);
+ pfts.ptszFiles[0] = replaceStrW(pfts.tszCurrentFile, fileName);
}
uint8_t GetDirection() const
diff --git a/protocols/Tox/src/tox_utils.cpp b/protocols/Tox/src/tox_utils.cpp
index a8e89ac51b..009c32b867 100644
--- a/protocols/Tox/src/tox_utils.cpp
+++ b/protocols/Tox/src/tox_utils.cpp
@@ -150,7 +150,7 @@ MEVENT CToxProto::AddEventToDb(MCONTACT hContact, WORD type, DWORD timestamp, DW
INT_PTR CToxProto::ParseToxUri(WPARAM, LPARAM lParam)
{
wchar_t *uri = (wchar_t*)lParam;
- if (mir_tstrlen(uri) <= 4)
+ if (mir_wstrlen(uri) <= 4)
return 1;
if (Accounts.getCount() == 0)
@@ -173,7 +173,7 @@ INT_PTR CToxProto::ParseToxUri(WPARAM, LPARAM lParam)
PROTOSEARCHRESULT psr = { sizeof(psr) };
psr.flags = PSR_UTF8;
- psr.id.a = mir_t2a(&uri[4]);
+ psr.id.a = mir_u2a(&uri[4]);
ADDCONTACTSTRUCT acs = { HANDLE_SEARCHRESULT };
acs.szProto = proto->m_szModuleName;