diff options
Diffstat (limited to 'protocols/Gadu-Gadu')
-rw-r--r-- | protocols/Gadu-Gadu/src/avatar.cpp | 24 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/core.cpp | 98 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/dialogs.cpp | 28 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/filetransfer.cpp | 12 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/gg.cpp | 10 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/gg_proto.cpp | 20 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/groupchat.cpp | 24 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/image.cpp | 52 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/import.cpp | 50 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/oauth.cpp | 12 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/ownerinfo.cpp | 2 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/popups.cpp | 8 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/services.cpp | 10 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/sessions.cpp | 14 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/token.cpp | 4 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/userutils.cpp | 8 |
16 files changed, 188 insertions, 188 deletions
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index f3c8a3cc05..764cc426ef 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -28,7 +28,7 @@ //
void GGPROTO::getAvatarFilename(MCONTACT hContact, wchar_t *pszDest, int cbLen)
{
- int tPathLen = mir_sntprintf(pszDest, cbLen, L"%s\\%S", VARST( L"%miranda_avatarcache%"), m_szModuleName);
+ int tPathLen = mir_snwprintf(pszDest, cbLen, L"%s\\%S", VARST( L"%miranda_avatarcache%"), m_szModuleName);
if (_waccess(pszDest, 0)) {
int ret = CreateDirectoryTreeT(pszDest);
@@ -37,7 +37,7 @@ void GGPROTO::getAvatarFilename(MCONTACT hContact, wchar_t *pszDest, int cbLen) else {
debugLog(L"getAvatarFilename(): Can not create directory for avatar cache: %s. errno=%d: %s", pszDest, errno, ws_strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot create avatars cache directory. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), pszDest);
+ mir_snwprintf(error, TranslateT("Cannot create avatars cache directory. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), pszDest);
showpopup(m_tszUserName, error, GG_POPUP_ERROR | GG_POPUP_ALLOW_MSGBOX | GG_POPUP_ONCE);
}
}
@@ -47,13 +47,13 @@ void GGPROTO::getAvatarFilename(MCONTACT hContact, wchar_t *pszDest, int cbLen) if (hContact != NULL) {
DBVARIANT dbv;
if (!getString(hContact, GG_KEY_AVATARHASH, &dbv)) {
- wchar_t* avatarHashT = mir_a2t(dbv.pszVal);
- mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s%s", avatarHashT, avatartype);
+ wchar_t* avatarHashT = mir_a2u(dbv.pszVal);
+ mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%s%s", avatarHashT, avatartype);
mir_free(avatarHashT);
db_free(&dbv);
}
}
- else mir_sntprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%S avatar%s", m_szModuleName, avatartype);
+ else mir_snwprintf(pszDest + tPathLen, cbLen - tPathLen, L"\\%S avatar%s", m_szModuleName, avatartype);
}
bool GGPROTO::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts)
@@ -83,19 +83,19 @@ bool GGPROTO::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts) if ((strncmp(resp->pData, "<result>", 8) == 0) || (strncmp(resp->pData, "<?xml", 5) == 0)){
//if this url returned xml data (before and after 11.2013 gg convention)
- wchar_t *xmlAction = mir_a2t(resp->pData);
+ wchar_t *xmlAction = mir_a2u(resp->pData);
HXML hXml = xmlParseString(xmlAction, 0, L"result");
if (hXml != NULL) {
HXML node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar", 0);
const wchar_t *blank = (node != NULL) ? xmlGetAttrValue(node, L"blank") : NULL;
- if (blank != NULL && mir_tstrcmp(blank, L"1")) {
+ if (blank != NULL && mir_wstrcmp(blank, L"1")) {
node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar/timestamp", 0);
- *avatarts = node != NULL ? mir_t2a(xmlGetText(node)) : NULL;
+ *avatarts = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar/bigavatar", 0); //new gg convention
if (node == NULL){
node = xmlGetChildByPath(hXml, L"users/user/avatars/avatar/originBigAvatar", 0); //old gg convention
}
- *avatarurl = node != NULL ? mir_t2a(xmlGetText(node)) : NULL;
+ *avatarurl = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
}
xmlDestroyNode(hXml);
}
@@ -271,7 +271,7 @@ void __cdecl GGPROTO::avatarrequestthread(void*) } else {
debugLog(L"avatarrequestthread(): _wopen file %s error. errno=%d: %s", ai.filename, errno, ws_strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot create avatar file. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), ai.filename);
+ mir_snwprintf(error, TranslateT("Cannot create avatar file. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), ai.filename);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
}
}
@@ -363,7 +363,7 @@ void __cdecl GGPROTO::setavatarthread(void *param) if (file_fd == -1) {
debugLog(L"setavatarthread(): Failed to open avatar file errno=%d: %s", errno, ws_strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot open avatar file. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), szFilename);
+ mir_snwprintf(error, TranslateT("Cannot open avatar file. ERROR: %d: %s\n%s"), errno, ws_strerror(errno), szFilename);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
mir_free(szFilename);
int prevType = getByte(GG_KEY_AVATARTYPEPREV, -1);
@@ -512,5 +512,5 @@ void GGPROTO::setAvatar(const wchar_t *szFilename) #ifdef DEBUGMODE
debugLogA("setAvatar(): ForkThread 3 GGPROTO::setavatarthread");
#endif
- ForkThread(&GGPROTO::setavatarthread, mir_tstrdup(szFilename));
+ ForkThread(&GGPROTO::setavatarthread, mir_wstrdup(szFilename));
}
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 692b36aef5..dec48051e4 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -67,58 +67,58 @@ void GGPROTO::disconnect() switch (getWord(GG_KEY_LEAVESTATUS, GG_KEYDEF_LEAVESTATUS)) {
case ID_STATUS_ONLINE:
gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 6, "modemsg_mutex", 1);
- szMsg = mir_utf8encodeT(modemsg.online);
+ szMsg = mir_utf8encodeW(modemsg.online);
gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 6, 1, "modemsg_mutex", 1);
if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_ONLINE, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
- szMsg = mir_utf8encodeT(dbv.ptszVal);
+ szMsg = mir_utf8encodeW(dbv.ptszVal);
db_free(&dbv);
}
break;
case ID_STATUS_AWAY:
gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 7, "modemsg_mutex", 1);
- szMsg = mir_utf8encodeT(modemsg.away);
+ szMsg = mir_utf8encodeW(modemsg.away);
gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 7, 1, "modemsg_mutex", 1);
if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_AWAY, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
- szMsg = mir_utf8encodeT(dbv.ptszVal);
+ szMsg = mir_utf8encodeW(dbv.ptszVal);
db_free(&dbv);
}
break;
case ID_STATUS_DND:
gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 8, "modemsg_mutex", 1);
- szMsg = mir_utf8encodeT(modemsg.dnd);
+ szMsg = mir_utf8encodeW(modemsg.dnd);
gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 8, 1, "modemsg_mutex", 1);
if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_DND, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
- szMsg = mir_utf8encodeT(dbv.ptszVal);
+ szMsg = mir_utf8encodeW(dbv.ptszVal);
db_free(&dbv);
}
break;
case ID_STATUS_FREECHAT:
gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 9, "modemsg_mutex", 1);
- szMsg = mir_utf8encodeT(modemsg.freechat);
+ szMsg = mir_utf8encodeW(modemsg.freechat);
gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 9, 1, "modemsg_mutex", 1);
if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_FREECHAT, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
- szMsg = mir_utf8encodeT(dbv.ptszVal);
+ szMsg = mir_utf8encodeW(dbv.ptszVal);
db_free(&dbv);
}
break;
case ID_STATUS_INVISIBLE:
gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 10, "modemsg_mutex", 1);
- szMsg = mir_utf8encodeT(modemsg.invisible);
+ szMsg = mir_utf8encodeW(modemsg.invisible);
gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 10, 1, "modemsg_mutex", 1);
if (!szMsg && !db_get_s(NULL, "SRAway", gg_status2db(ID_STATUS_INVISIBLE, "Default"), &dbv, DBVT_TCHAR)) {
if (dbv.ptszVal && *(dbv.ptszVal))
- szMsg = mir_utf8encodeT(dbv.ptszVal);
+ szMsg = mir_utf8encodeW(dbv.ptszVal);
db_free(&dbv);
}
break;
default:
// Set last status
gg_EnterCriticalSection(&modemsg_mutex, "disconnect", 11, "modemsg_mutex", 1);
- szMsg = mir_utf8encodeT(getstatusmsg(m_iStatus));
+ szMsg = mir_utf8encodeW(getstatusmsg(m_iStatus));
gg_LeaveCriticalSection(&modemsg_mutex, "disconnect", 11, 1, "modemsg_mutex", 1);
}
}
@@ -360,8 +360,8 @@ void __cdecl GGPROTO::mainthread(void *) if (!getString(GG_KEY_FORWARDHOST, &dbv)) {
if (!(p.external_addr = gg_dnslookup(this, dbv.pszVal))) {
wchar_t error[128];
- wchar_t* forwardHostT = mir_a2t(dbv.pszVal);
- mir_sntprintf(error, TranslateT("External direct connections hostname %s is invalid. Disabling external host forwarding."), forwardHostT);
+ wchar_t* forwardHostT = mir_a2u(dbv.pszVal);
+ mir_snwprintf(error, TranslateT("External direct connections hostname %s is invalid. Disabling external host forwarding."), forwardHostT);
mir_free(forwardHostT);
showpopup(m_tszUserName, error, GG_POPUP_WARNING | GG_POPUP_ALLOW_MSGBOX);
}
@@ -378,7 +378,7 @@ retry: // Loadup startup status & description
gg_EnterCriticalSection(&modemsg_mutex, "mainthread", 13, "modemsg_mutex", 1);
- p.status_descr = mir_utf8encodeT(getstatusmsg(m_iDesiredStatus));
+ p.status_descr = mir_utf8encodeW(getstatusmsg(m_iDesiredStatus));
p.status = status_m2gg(m_iDesiredStatus, p.status_descr != NULL);
debugLog(L"mainthread() (%x): Connecting with number %d, status %d and description \"%s\".", this, p.uin, m_iDesiredStatus,
@@ -391,8 +391,8 @@ retry: if (!(p.server_addr = gg_dnslookup(this, hosts[hostnum].hostname)))
{
wchar_t error[128];
- wchar_t* hostnameT = mir_a2t(hosts[hostnum].hostname);
- mir_sntprintf(error, TranslateT("Server hostname %s is invalid. Using default hostname provided by the network."), hostnameT);
+ wchar_t* hostnameT = mir_a2u(hosts[hostnum].hostname);
+ mir_snwprintf(error, TranslateT("Server hostname %s is invalid. Using default hostname provided by the network."), hostnameT);
mir_free(hostnameT);
showpopup(m_tszUserName, error, GG_POPUP_WARNING | GG_POPUP_ALLOW_MSGBOX);
}
@@ -423,7 +423,7 @@ retry: }
}
if (!perror) {
- mir_sntprintf(error, TranslateT("Connection cannot be established. errno=%d: %s"), errno, ws_strerror(errno));
+ mir_snwprintf(error, TranslateT("Connection cannot be established. errno=%d: %s"), errno, ws_strerror(errno));
perror = error;
}
debugLog(L"mainthread() (%x): %s", this, perror);
@@ -480,7 +480,7 @@ retry: {
broadcastnewstatus(m_iDesiredStatus);
// Change status of the contact with our own UIN (if got yourself added to the contact list)
- wchar_t *status_descr = mir_utf8decodeT(p.status_descr);
+ wchar_t *status_descr = mir_utf8decodeW(p.status_descr);
changecontactstatus(p.uin, p.status, status_descr, 0, 0, 0, 0);
mir_free(status_descr);
}
@@ -562,7 +562,7 @@ retry: for (; n->uin; n++)
{
- wchar_t *descrT = (e->type == GG_EVENT_NOTIFY_DESCR) ? mir_utf8decodeT(e->event.notify_descr.descr) : NULL;
+ wchar_t *descrT = (e->type == GG_EVENT_NOTIFY_DESCR) ? mir_utf8decodeW(e->event.notify_descr.descr) : NULL;
changecontactstatus(n->uin, n->status, descrT, 0, n->remote_ip, n->remote_port, n->version);
if (descrT) mir_free(descrT);
}
@@ -575,7 +575,7 @@ retry: int i;
for(i = 0; e->event.notify60[i].uin; i++) {
if (e->event.notify60[i].uin == uin) continue;
- wchar_t *descrT = mir_utf8decodeT(e->event.notify60[i].descr);
+ wchar_t *descrT = mir_utf8decodeW(e->event.notify60[i].descr);
changecontactstatus(e->event.notify60[i].uin, e->event.notify60[i].status, descrT,
e->event.notify60[i].time, e->event.notify60[i].remote_ip, e->event.notify60[i].remote_port,
e->event.notify60[i].version);
@@ -617,12 +617,12 @@ retry: {
// Loadup fields
const char *__fmnumber = gg_pubdir50_get(res, i, GG_PUBDIR50_UIN);
- wchar_t *__nickname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_NICKNAME));
- wchar_t *__firstname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_FIRSTNAME));
- wchar_t *__lastname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_LASTNAME));
- wchar_t *__familyname = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_FAMILYNAME));
- wchar_t *__city = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_CITY));
- wchar_t *__familycity = mir_utf8decodeT(gg_pubdir50_get(res, i, GG_PUBDIR50_FAMILYCITY));
+ wchar_t *__nickname = mir_utf8decodeW(gg_pubdir50_get(res, i, GG_PUBDIR50_NICKNAME));
+ wchar_t *__firstname = mir_utf8decodeW(gg_pubdir50_get(res, i, GG_PUBDIR50_FIRSTNAME));
+ wchar_t *__lastname = mir_utf8decodeW(gg_pubdir50_get(res, i, GG_PUBDIR50_LASTNAME));
+ wchar_t *__familyname = mir_utf8decodeW(gg_pubdir50_get(res, i, GG_PUBDIR50_FAMILYNAME));
+ wchar_t *__city = mir_utf8decodeW(gg_pubdir50_get(res, i, GG_PUBDIR50_CITY));
+ wchar_t *__familycity = mir_utf8decodeW(gg_pubdir50_get(res, i, GG_PUBDIR50_FAMILYCITY));
const char *__birthyear = gg_pubdir50_get(res, i, GG_PUBDIR50_BIRTHYEAR);
const char *__gender = gg_pubdir50_get(res, i, GG_PUBDIR50_GENDER);
const char *__status = gg_pubdir50_get(res, i, GG_PUBDIR50_STATUS);
@@ -637,8 +637,8 @@ retry: wcsncpy_s(strFmt2, pcli->pfnGetStatusModeDescription( status_gg2m(atoi(__status)), 0), _TRUNCATE);
if (__city) {
- mir_sntprintf(strFmt1, L", %s %s", TranslateT("City:"), __city);
- mir_tstrncat(strFmt2, strFmt1, _countof(strFmt2) - mir_tstrlen(strFmt2));
+ mir_snwprintf(strFmt1, L", %s %s", TranslateT("City:"), __city);
+ mir_wstrncat(strFmt2, strFmt1, _countof(strFmt2) - mir_wstrlen(strFmt2));
}
if (__birthyear) {
time_t t = time(NULL);
@@ -646,8 +646,8 @@ retry: int br = atoi(__birthyear);
if (br < (lt->tm_year + 1900) && br > 1900) {
- mir_sntprintf(strFmt1, L", %s %d", TranslateT("Age:"), (lt->tm_year + 1900) - br);
- mir_tstrncat(strFmt2, strFmt1, _countof(strFmt2) - mir_tstrlen(strFmt2));
+ mir_snwprintf(strFmt1, L", %s %d", TranslateT("Age:"), (lt->tm_year + 1900) - br);
+ mir_wstrncat(strFmt2, strFmt1, _countof(strFmt2) - mir_wstrlen(strFmt2));
}
}
@@ -757,7 +757,7 @@ retry: // Status (deprecated)
case GG_EVENT_STATUS:
{
- wchar_t *descrT = mir_utf8decodeT(e->event.status.descr);
+ wchar_t *descrT = mir_utf8decodeW(e->event.status.descr);
changecontactstatus(e->event.status.uin, e->event.status.status, descrT, 0, 0, 0, 0);
mir_free(descrT);
}
@@ -770,7 +770,7 @@ retry: int oldstatus = getWord(hContact, GG_KEY_STATUS, (WORD)ID_STATUS_OFFLINE);
uin_t uin = (uin_t)getDword(GG_KEY_UIN, 0);
- wchar_t *descrT = mir_utf8decodeT(e->event.status60.descr);
+ wchar_t *descrT = mir_utf8decodeW(e->event.status60.descr);
if (e->event.status60.uin == uin)
{
@@ -832,7 +832,7 @@ retry: GCEVENT gce = { sizeof(gce), &gcd };
time_t t = time(NULL);
gce.ptszUID = id;
- wchar_t* messageT = mir_utf8decodeT(e->event.msg.message);
+ wchar_t* messageT = mir_utf8decodeW(e->event.msg.message);
gce.ptszText = messageT;
gce.ptszNick = (wchar_t*) pcli->pfnGetContactDisplayName( getcontact(e->event.msg.sender, 1, 0, NULL), 0);
gce.time = (!(e->event.msg.msgclass & GG_CLASS_OFFLINE) || e->event.msg.time > (t - timeDeviation)) ? t : e->event.msg.time;
@@ -895,14 +895,14 @@ retry: GCDEST gcd = { m_szModuleName, chat, GC_EVENT_MESSAGE };
GCEVENT gce = { sizeof(gce), &gcd };
gce.ptszUID = id;
- wchar_t* messageT = mir_utf8decodeT(e->event.multilogon_msg.message);
+ wchar_t* messageT = mir_utf8decodeW(e->event.multilogon_msg.message);
gce.ptszText = messageT;
wchar_t* nickT;
if (!getTString(GG_KEY_NICK, &dbv)){
- nickT = mir_tstrdup(dbv.ptszVal);
+ nickT = mir_wstrdup(dbv.ptszVal);
db_free(&dbv);
}
- else nickT = mir_tstrdup(TranslateT("Me"));
+ else nickT = mir_wstrdup(TranslateT("Me"));
gce.ptszNick = nickT;
gce.time = e->event.multilogon_msg.time;
gce.bIsMe = 1;
@@ -974,7 +974,7 @@ retry: if (iIndexes && iIndexes[i])
continue;
- mir_sntprintf(szMsg, L"%s (%s)", szText,
+ mir_snwprintf(szMsg, L"%s (%s)", szText,
*e->event.multilogon_info.sessions[i].name != '\0' ?
_A2T(e->event.multilogon_info.sessions[i].name) : TranslateT("Unknown client"));
showpopup(m_tszUserName, szMsg, GG_POPUP_MULTILOGON);
@@ -1052,7 +1052,7 @@ retry: debugLogA("mainthread() (%x): Client: %d, File ack filename \"%s\" size %d.", this, dcc7->peer_uin,
dcc7->filename, dcc7->size);
- wchar_t* filenameT = mir_a2t((char*)dcc7->filename);
+ wchar_t* filenameT = mir_a2u((char*)dcc7->filename);
PROTORECVFILET pre = {0};
pre.dwFlags = PRFF_TCHAR;
@@ -1149,8 +1149,8 @@ retry: wchar_t *xmlAction;
wchar_t *tag;
- xmlAction = mir_a2t(e->event.xml_action.data);
- tag = mir_a2t("events");
+ xmlAction = mir_a2u(e->event.xml_action.data);
+ tag = mir_a2u("events");
hXml = xmlParseString(xmlAction, 0, tag);
if (hXml != NULL) {
@@ -1158,14 +1158,14 @@ retry: char *type, *sender;
mir_free(tag);
- tag = mir_a2t("event/type");
+ tag = mir_a2u("event/type");
node = xmlGetChildByPath(hXml, tag, 0);
- type = node != NULL ? mir_t2a(xmlGetText(node)) : NULL;
+ type = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
mir_free(tag);
- tag = mir_a2t("event/sender");
+ tag = mir_a2u("event/sender");
node = xmlGetChildByPath(hXml, tag, 0);
- sender = node != NULL ? mir_t2a(xmlGetText(node)) : NULL;
+ sender = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
debugLogA("mainthread() (%x): XML Action type: %s.", this, type != NULL ? type : "unknown");
// Avatar change notify
if (type != NULL && !mir_strcmp(type, "28")) {
@@ -1311,11 +1311,11 @@ static wchar_t* sttSettingToTchar( DBVARIANT* value ) {
switch(value->type) {
case DBVT_ASCIIZ:
- return mir_a2t(value->pszVal);
+ return mir_a2u(value->pszVal);
case DBVT_UTF8:
- return mir_utf8decodeT(value->pszVal);
+ return mir_utf8decodeW(value->pszVal);
case DBVT_WCHAR:
- return mir_u2t(value->pwszVal);
+ return mir_wstrdup(value->pwszVal);
}
return NULL;
}
@@ -1570,7 +1570,7 @@ MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, wchar_t *szNick) gg_pubdir50(sess, req);
gg_LeaveCriticalSection(&sess_mutex, "getcontact", 31, 1, "sess_mutex", 1);
gg_pubdir50_free(req);
- wchar_t* uinT = mir_a2t(ditoa(uin));
+ wchar_t* uinT = mir_a2u(ditoa(uin));
setTString(hContact, GG_KEY_NICK, uinT);
mir_free(uinT);
debugLogA("getcontact(): Search for nick on uin: %d", uin);
@@ -1591,7 +1591,7 @@ MCONTACT GGPROTO::getcontact(uin_t uin, int create, int inlist, wchar_t *szNick) // Change status of the contact with our own UIN (if got yourself added to the contact list)
if (getDword(GG_KEY_UIN, 0) == uin) {
gg_EnterCriticalSection(&modemsg_mutex, "getcontact", 33, "modemsg_mutex", 1);
- wchar_t *szMsg = mir_tstrdup(getstatusmsg(m_iStatus));
+ wchar_t *szMsg = mir_wstrdup(getstatusmsg(m_iStatus));
gg_LeaveCriticalSection(&modemsg_mutex, "getcontact", 33, 1, "modemsg_mutex", 1);
changecontactstatus(uin, status_m2gg(m_iStatus, szMsg != NULL), szMsg, 0, 0, 0, 0);
mir_free(szMsg);
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index e4a593496f..1aceff00a9 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -65,7 +65,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule if (dbv.cVal == -100) unspecified = 1; else { ptstr = str; - mir_sntprintf(str, dbv.cVal ? L"GMT%+d:%02d" : L"GMT", -dbv.cVal / 2, (dbv.cVal & 1) * 30); + mir_snwprintf(str, dbv.cVal ? L"GMT%+d:%02d" : L"GMT", -dbv.cVal / 2, (dbv.cVal & 1) * 30); } } else { unspecified = (special == SVS_ZEROISUNSPEC && dbv.bVal == 0); @@ -79,7 +79,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule unspecified = 1; } else { ptstr = str; - mir_sntprintf(str, L"%S", pstr); + mir_snwprintf(str, L"%S", pstr); } } else { @@ -97,12 +97,12 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule unspecified = 1; } else { ptstr = str; - mir_sntprintf(str, L"%S", pstr); + mir_snwprintf(str, L"%S", pstr); } if (dbv.dVal == 0) unspecified = 1; } else if (special == SVS_GGVERSION) { ptstr = str; - mir_sntprintf(str, L"%S", (char *)gg_version2string(dbv.dVal)); + mir_snwprintf(str, L"%S", (char *)gg_version2string(dbv.dVal)); } else { ptstr = _itow(special == SVS_SIGNED ? dbv.lVal : dbv.dVal, str, 10); } @@ -110,7 +110,7 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule case DBVT_ASCIIZ: unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0'); ptstr = str; - mir_sntprintf(str, L"%S", dbv.pszVal); + mir_snwprintf(str, L"%S", dbv.pszVal); break; case DBVT_TCHAR: unspecified = (special == SVS_ZEROISUNSPEC && dbv.ptszVal[0] == '\0'); @@ -118,14 +118,14 @@ static void SetValue(HWND hwndDlg, int idCtrl, MCONTACT hContact, char *szModule break; case DBVT_UTF8: unspecified = (special == SVS_ZEROISUNSPEC && dbv.pszVal[0] == '\0'); - valT = mir_utf8decodeT(dbv.pszVal); + valT = mir_utf8decodeW(dbv.pszVal); ptstr = str; wcscpy_s(str, _countof(str), valT); mir_free(valT); break; default: ptstr = str; - mir_tstrcpy(str, L"???"); + mir_wstrcpy(str, L"???"); break; } } @@ -803,19 +803,19 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, break; GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, _countof(text)); - if (mir_tstrlen(text)) + if (mir_wstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, T2Utf(text)); GetDlgItemText(hwndDlg, IDC_LASTNAME, text, _countof(text)); - if (mir_tstrlen(text)) + if (mir_wstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, T2Utf(text)); GetDlgItemText(hwndDlg, IDC_NICKNAME, text, _countof(text)); - if (mir_tstrlen(text)) + if (mir_wstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, T2Utf(text)); GetDlgItemText(hwndDlg, IDC_CITY, text, _countof(text)); - if (mir_tstrlen(text)) + if (mir_wstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_CITY, T2Utf(text)); // Gadu-Gadu Female <-> Male @@ -831,15 +831,15 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, } GetDlgItemText(hwndDlg, IDC_BIRTHYEAR, text, _countof(text)); - if (mir_tstrlen(text)) + if (mir_wstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_BIRTHYEAR, T2Utf(text)); GetDlgItemText(hwndDlg, IDC_FAMILYNAME, text, _countof(text)); - if (mir_tstrlen(text)) + if (mir_wstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_FAMILYNAME, T2Utf(text)); GetDlgItemText(hwndDlg, IDC_CITYORIGIN, text, _countof(text)); - if (mir_tstrlen(text)) + if (mir_wstrlen(text)) gg_pubdir50_add(req, GG_PUBDIR50_FAMILYCITY, T2Utf(text)); // Run update diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 14a82d4b58..38909300a0 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -381,7 +381,7 @@ void __cdecl GGPROTO::dccmainthread(void*) {
// Make new ggtransfer struct
local_dcc->contact = (void*)getcontact(local_dcc->peer_uin, 0, 0, NULL);
- wchar_t* filenameT = mir_utf8decodeT((char*)dcc->file_info.filename);
+ wchar_t* filenameT = mir_utf8decodeW((char*)dcc->file_info.filename);
PROTORECVFILET pre = {0};
pre.dwFlags = PRFF_TCHAR;
@@ -662,7 +662,7 @@ void __cdecl GGPROTO::dccmainthread(void*) HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const wchar_t* szPath)
{
struct gg_dcc *dcc = (struct gg_dcc *) hTransfer;
- char fileName[MAX_PATH], *path = mir_t2a(szPath);
+ char fileName[MAX_PATH], *path = mir_u2a(szPath);
mir_snprintf(fileName, "%s%s", path, dcc->file_info.filename);
dcc->folder = _strdup((char*)path);
dcc->tick = 0;
@@ -678,7 +678,7 @@ HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const wchar_t* szPath) {
debugLogA("dccfileallow(): Failed to create file \"%s\". errno=%d: %s", fileName, errno, strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc)\n%s"), errno, _tcserror(errno), szPath);
+ mir_snwprintf(error, TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc)\n%s"), errno, _tcserror(errno), szPath);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
ProtoBroadcastAck((UINT_PTR)dcc->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc, 0);
// Free transfer
@@ -702,7 +702,7 @@ HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const wchar_t* szPath) HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const wchar_t* szPath)
{
struct gg_dcc7 *dcc7 = (struct gg_dcc7 *) hTransfer;
- char fileName[MAX_PATH], *path = mir_t2a(szPath);
+ char fileName[MAX_PATH], *path = mir_u2a(szPath);
mir_snprintf(fileName, "%s%s", path, dcc7->filename);
dcc7->folder = _strdup((char*)path);
dcc7->tick = 0;
@@ -727,7 +727,7 @@ HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const wchar_t* szPath) {
debugLogA("dcc7fileallow(): Failed to create file \"%s\". errno=%d: %s", fileName, errno, strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc7)\n%s"), errno, _tcserror(errno), szPath);
+ mir_snwprintf(error, TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc7)\n%s"), errno, _tcserror(errno), szPath);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
gg_dcc7_reject(dcc7, GG_DCC7_REJECT_USER);
ProtoBroadcastAck((UINT_PTR)dcc7->contact, ACKTYPE_FILE, ACKRESULT_FAILED, dcc7, 0);
@@ -917,7 +917,7 @@ HANDLE GGPROTO::SendFile(MCONTACT hContact, const wchar_t *, wchar_t** ppszFiles if (!isonline())
return ftfail(this, hContact);
- filename = mir_t2a(ppszFiles[0]);
+ filename = mir_u2a(ppszFiles[0]);
// Read user IP and port
ip = swap32(getDword(hContact, GG_KEY_CLIENTIP, 0));
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index 11c44a47de..18e264e031 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -65,9 +65,9 @@ wchar_t* ws_strerror(int code) wchar_t buff[128];
int len = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, WSAGetLastError(), 0, buff, _countof(buff), NULL);
if (len == 0)
- mir_sntprintf(err_desc, L"WinSock %u: Unknown error.", WSAGetLastError());
+ mir_snwprintf(err_desc, L"WinSock %u: Unknown error.", WSAGetLastError());
else
- mir_sntprintf(err_desc, L"WinSock %d: %s", WSAGetLastError(), buff);
+ mir_snwprintf(err_desc, L"WinSock %d: %s", WSAGetLastError(), buff);
return err_desc;
}
@@ -174,18 +174,18 @@ void GGPROTO::cleanuplastplugin(DWORD version) debugLogA("cleanuplastplugin() 1: version=%d Cleaning junk avatar files from < 0.11.0.2", version);
wchar_t avatarsPath[MAX_PATH];
- mir_sntprintf(avatarsPath, L"%s\\%s", VARST( L"%miranda_avatarcache%"), m_tszUserName);
+ mir_snwprintf(avatarsPath, L"%s\\%s", VARST( L"%miranda_avatarcache%"), m_tszUserName);
debugLog(L"cleanuplastplugin() 1: miranda_avatarcache = %s", avatarsPath);
wchar_t spec[MAX_PATH + 10];
- mir_sntprintf(spec, L"%s\\*.(null)", avatarsPath);
+ mir_snwprintf(spec, L"%s\\*.(null)", avatarsPath);
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(spec, &ffd);
if (hFind != INVALID_HANDLE_VALUE) {
do {
wchar_t filePathT [2*MAX_PATH + 10];
- mir_sntprintf(filePathT, L"%s\\%s", avatarsPath, ffd.cFileName);
+ mir_snwprintf(filePathT, L"%s\\%s", avatarsPath, ffd.cFileName);
if (!_waccess(filePathT, 0)){
debugLog(L"cleanuplastplugin() 1: remove file = %s", filePathT);
_wremove(filePathT);
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 10ea01e41b..be0a8943fe 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -40,7 +40,7 @@ GGPROTO::GGPROTO(const char *pszProtoName, const wchar_t *tszUserName) : // Register m_hNetlibUser user
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);
@@ -68,7 +68,7 @@ GGPROTO::GGPROTO(const char *pszProtoName, const wchar_t *tszUserName) : db_set_resident(m_szModuleName, GG_KEY_AVATARREQUESTED);
wchar_t szPath[MAX_PATH];
- mir_sntprintf(szPath, L"%s\\%s\\ImageCache", (wchar_t*)VARST(L"%miranda_userdata%"), m_tszUserName);
+ mir_snwprintf(szPath, L"%s\\%s\\ImageCache", (wchar_t*)VARST(L"%miranda_userdata%"), m_tszUserName);
hImagesFolder = FoldersRegisterCustomPathT(LPGEN("Images"), m_szModuleName, szPath, m_tszUserName);
DWORD dwVersion;
@@ -379,7 +379,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) // Fetch search data
wchar_t text[64];
GetDlgItemText(hwndDlg, IDC_FIRSTNAME, text, _countof(text));
- if (mir_tstrlen(text)) {
+ if (mir_wstrlen(text)) {
T2Utf firstName_utf8(text);
gg_pubdir50_add(req, GG_PUBDIR50_FIRSTNAME, firstName_utf8);
szQuery.Append(firstName_utf8);
@@ -387,7 +387,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 1 */ szQuery.AppendChar('.');
GetDlgItemText(hwndDlg, IDC_LASTNAME, text, _countof(text));
- if (mir_tstrlen(text)) {
+ if (mir_wstrlen(text)) {
T2Utf lastName_utf8(text);
gg_pubdir50_add(req, GG_PUBDIR50_LASTNAME, lastName_utf8);
szQuery.Append(lastName_utf8);
@@ -395,7 +395,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 2 */ szQuery.AppendChar('.');
GetDlgItemText(hwndDlg, IDC_NICKNAME, text, _countof(text));
- if (mir_tstrlen(text)) {
+ if (mir_wstrlen(text)) {
T2Utf nickName_utf8(text);
gg_pubdir50_add(req, GG_PUBDIR50_NICKNAME, nickName_utf8);
szQuery.Append(nickName_utf8);
@@ -403,7 +403,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 3 */ szQuery.AppendChar('.');
GetDlgItemText(hwndDlg, IDC_CITY, text, _countof(text));
- if (mir_tstrlen(text)) {
+ if (mir_wstrlen(text)) {
T2Utf city_utf8(text);
gg_pubdir50_add(req, GG_PUBDIR50_CITY, city_utf8);
szQuery.Append(city_utf8);
@@ -411,7 +411,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) /* 4 */ szQuery.AppendChar('.');
GetDlgItemText(hwndDlg, IDC_AGEFROM, text, _countof(text));
- if (mir_tstrlen(text)) {
+ if (mir_wstrlen(text)) {
int yearTo = _tstoi(text);
int yearFrom;
time_t t = time(NULL);
@@ -431,7 +431,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) yearFrom = 0;
else
yearFrom = ay - yearFrom;
- mir_sntprintf(text, L"%d %d", yearFrom, yearTo);
+ mir_snwprintf(text, L"%d %d", yearFrom, yearTo);
T2Utf age_utf8(text);
gg_pubdir50_add(req, GG_PUBDIR50_BIRTHYEAR, age_utf8);
@@ -653,7 +653,7 @@ int GGPROTO::SetAwayMsg(int iStatus, const wchar_t *newMsg) }
// Check if we change status here somehow
- if (*msgPtr && newMsg && !mir_tstrcmp(*msgPtr, newMsg)
+ if (*msgPtr && newMsg && !mir_wstrcmp(*msgPtr, newMsg)
|| !*msgPtr && (!newMsg || !*newMsg)) {
if (status == m_iDesiredStatus && m_iDesiredStatus == m_iStatus) {
debugLogA("SetAwayMsg(): Message hasn't been changed, return.");
@@ -664,7 +664,7 @@ int GGPROTO::SetAwayMsg(int iStatus, const wchar_t *newMsg) else {
if (*msgPtr)
mir_free(*msgPtr);
- *msgPtr = newMsg && *newMsg ? mir_tstrdup(newMsg) : NULL;
+ *msgPtr = newMsg && *newMsg ? mir_wstrdup(newMsg) : NULL;
#ifdef DEBUGMODE
debugLogA("SetAwayMsg(): Message changed.");
#endif
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 85790434eb..52d5399ef8 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -102,7 +102,7 @@ GGGC* GGPROTO::gc_lookup(const wchar_t *id) for(l = chats; l; l = l->next)
{
chat = (GGGC *)l->data;
- if (chat && !mir_tstrcmp(chat->id, id))
+ if (chat && !mir_wstrcmp(chat->id, id))
return chat;
}
@@ -138,7 +138,7 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) MCONTACT hNext = db_find_next(hContact);
DBVARIANT dbv;
if (!getTString(hContact, "ChatRoomID", &dbv)) {
- if (dbv.ptszVal && !mir_tstrcmp(gch->pDest->ptszID, dbv.ptszVal))
+ if (dbv.ptszVal && !mir_wstrcmp(gch->pDest->ptszID, dbv.ptszVal))
CallService(MS_DB_CONTACT_DELETE, hContact, 0);
db_free(&dbv);
}
@@ -159,14 +159,14 @@ int GGPROTO::gc_event(WPARAM, LPARAM lParam) gce.ptszText = gch->ptszText;
wchar_t* nickT;
if (!getTString(GG_KEY_NICK, &dbv)){
- nickT = mir_tstrdup(dbv.ptszVal);
+ nickT = mir_wstrdup(dbv.ptszVal);
db_free(&dbv);
}
- else nickT = mir_tstrdup(TranslateT("Me"));
+ else nickT = mir_wstrdup(TranslateT("Me"));
gce.ptszNick = nickT;
// Get rid of CRLF at back
- int lc = (int)mir_tstrlen(gch->ptszText) - 1;
+ int lc = (int)mir_wstrlen(gch->ptszText) - 1;
while(lc >= 0 && (gch->ptszText[lc] == '\n' || gch->ptszText[lc] == '\r'))
gch->ptszText[lc --] = 0;
@@ -282,7 +282,7 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou wchar_t *senderName = unknownSender ?
TranslateT("Unknown") : pcli->pfnGetContactDisplayName(getcontact(sender, 0, 0, NULL), 0);
wchar_t error[256];
- mir_sntprintf(error, TranslateT("%s has initiated conference with %d participants (%d unknowns).\nDo you want to participate?"),
+ mir_snwprintf(error, TranslateT("%s has initiated conference with %d participants (%d unknowns).\nDo you want to participate?"),
senderName, recipients_count + 1, unknown);
chat->ignore = MessageBox(NULL, error, m_tszUserName, MB_OKCANCEL | MB_ICONEXCLAMATION) != IDOK;
}
@@ -307,12 +307,12 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou if (sender)
{
senderName = pcli->pfnGetContactDisplayName(getcontact(sender, 1, 0, NULL), 0);
- mir_sntprintf(status, TranslateT("%s initiated the conference.") , senderName);
+ mir_snwprintf(status, TranslateT("%s initiated the conference.") , senderName);
}
else
{
senderName = NULL;
- mir_sntprintf(status, TranslateT("This is my own conference."));
+ mir_snwprintf(status, TranslateT("This is my own conference."));
}
GCSESSION gcwindow = { sizeof(gcwindow) };
@@ -324,8 +324,8 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou gcwindow.ptszStatusbarText = status;
// Here we put nice new hash sign
- wchar_t *name = (wchar_t*)calloc(mir_tstrlen(gcwindow.ptszName) + 2, sizeof(wchar_t));
- *name = '#'; mir_tstrcpy(name + 1, gcwindow.ptszName);
+ wchar_t *name = (wchar_t*)calloc(mir_wstrlen(gcwindow.ptszName) + 2, sizeof(wchar_t));
+ *name = '#'; mir_wstrcpy(name + 1, gcwindow.ptszName);
gcwindow.ptszName = name;
// Create new room
@@ -354,10 +354,10 @@ wchar_t* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_cou wchar_t* nickT;
if (!getTString(GG_KEY_NICK, &dbv)) {
- nickT = mir_tstrdup(dbv.ptszVal);
+ nickT = mir_wstrdup(dbv.ptszVal);
db_free(&dbv);
} else {
- nickT = mir_tstrdup(TranslateT("Me"));
+ nickT = mir_wstrdup(TranslateT("Me"));
}
gce.ptszNick = nickT;
diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index a883917caf..106b8e2d5f 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -223,10 +223,10 @@ wchar_t *gg_img_getfilter(wchar_t *szFilter, int nSize) // Make up filter
wcsncpy(pFilter, szFilterName, nSize);
- pFilter += mir_tstrlen(pFilter) + 1;
+ pFilter += mir_wstrlen(pFilter) + 1;
if (pFilter >= szFilter + nSize) return NULL;
wcsncpy(pFilter, szFilterMask, nSize - (pFilter - szFilter));
- pFilter += mir_tstrlen(pFilter) + 1;
+ pFilter += mir_wstrlen(pFilter) + 1;
if (pFilter >= szFilter + nSize) return NULL;
*pFilter = 0;
@@ -420,9 +420,9 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP wchar_t *szName = pcli->pfnGetContactDisplayName(dat->hContact, 0), szTitle[128];
if (dat->bReceiving)
- mir_sntprintf(szTitle, TranslateT("Image from %s"), szName);
+ mir_snwprintf(szTitle, TranslateT("Image from %s"), szName);
else
- mir_sntprintf(szTitle, TranslateT("Image for %s"), szName);
+ mir_snwprintf(szTitle, TranslateT("Image for %s"), szName);
SetWindowText(hwndDlg, szTitle);
// Store client extents
@@ -495,7 +495,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (dat->bReceiving)
{
wchar_t szTitle[128];
- mir_sntprintf(szTitle, L"%s (%d / %d)", img->lpszFileName, dat->nImg, dat->nImgTotal);
+ mir_snwprintf(szTitle, L"%s (%d / %d)", img->lpszFileName, dat->nImg, dat->nImgTotal);
SetDlgItemText(hwndDlg, IDC_IMG_NAME, szTitle);
}
else
@@ -777,14 +777,14 @@ wchar_t *gg_img_hasextension(wchar_t *filename) wchar_t *imgtype = wcsrchr(filename, '.');
if (imgtype != NULL)
{
- size_t len = mir_tstrlen(imgtype);
+ size_t len = mir_wstrlen(imgtype);
imgtype++;
- if (len == 4 && (mir_tstrcmpi(imgtype, L"bmp") == 0 ||
- mir_tstrcmpi(imgtype, L"gif") == 0 ||
- mir_tstrcmpi(imgtype, L"jpg") == 0 ||
- mir_tstrcmpi(imgtype, L"png") == 0))
+ if (len == 4 && (mir_wstrcmpi(imgtype, L"bmp") == 0 ||
+ mir_wstrcmpi(imgtype, L"gif") == 0 ||
+ mir_wstrcmpi(imgtype, L"jpg") == 0 ||
+ mir_wstrcmpi(imgtype, L"png") == 0))
return --imgtype;
- if (len == 5 && mir_tstrcmpi(imgtype, L"jpeg") == 0)
+ if (len == 5 && mir_wstrcmpi(imgtype, L"jpeg") == 0)
return --imgtype;
}
}
@@ -803,12 +803,12 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) if (hImagesFolder == NULL || FoldersGetCustomPathT(hImagesFolder, path, MAX_PATH, L"")) {
wchar_t *tmpPath = Utils_ReplaceVarsT( L"%miranda_userdata%");
- tPathLen = mir_sntprintf(szPath, L"%s\\%s\\ImageCache", tmpPath, m_tszUserName);
+ tPathLen = mir_snwprintf(szPath, L"%s\\%s\\ImageCache", tmpPath, m_tszUserName);
mir_free(tmpPath);
}
else {
- mir_tstrcpy(szPath, path);
- tPathLen = mir_tstrlen(szPath);
+ mir_wstrcpy(szPath, path);
+ tPathLen = mir_wstrlen(szPath);
}
if ( _waccess(szPath, 0)){
@@ -818,19 +818,19 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) } else {
debugLog(L"img_displayasmsg(): Can not create directory for image cache: %s. errno=%d: %s", szPath, errno, strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot create image cache directory. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szPath);
+ mir_snwprintf(error, TranslateT("Cannot create image cache directory. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szPath);
showpopup(m_tszUserName, error, GG_POPUP_ERROR | GG_POPUP_ALLOW_MSGBOX | GG_POPUP_ONCE);
}
}
- mir_sntprintf(szPath + tPathLen, MAX_PATH - tPathLen, L"\\%s", dat->lpszFileName);
+ mir_snwprintf(szPath + tPathLen, MAX_PATH - tPathLen, L"\\%s", dat->lpszFileName);
if ((pImgext = gg_img_hasextension(szPath)) == NULL)
- pImgext = szPath + mir_tstrlen(szPath);
+ pImgext = szPath + mir_wstrlen(szPath);
wcsncpy_s(imgext, pImgext, _TRUNCATE);
for (i = 1; ; ++i)
{
if ((res = gg_img_isexists(szPath, dat)) != -1) break;
- mir_sntprintf(szPath, L"%.*s (%u)%s", pImgext - szPath, szPath, i, imgext);
+ mir_snwprintf(szPath, L"%.*s (%u)%s", pImgext - szPath, szPath, i, imgext);
}
if (res == 0) {
@@ -842,7 +842,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) } else {
debugLog(L"img_displayasmsg(): Cannot open file %s for write image. errno=%d: %s", szPath, errno, strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot save received image to file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szPath);
+ mir_snwprintf(error, TranslateT("Cannot save received image to file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szPath);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
return 0;
}
@@ -850,7 +850,7 @@ int GGPROTO::img_displayasmsg(MCONTACT hContact, void *img) if (res != 0) {
wchar_t image_msg[MAX_PATH + 11];
- mir_sntprintf(image_msg, L"[img]%s[/img]", szPath);
+ mir_snwprintf(image_msg, L"[img]%s[/img]", szPath);
T2Utf szMessage(image_msg);
PROTORECVEVENT pre = {0};
@@ -963,7 +963,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) free(dat);
debugLog(L"img_loadpicture(): fopen(\"%s\", \"rb\" failed. errno=%d: %s)", szFileName, errno, strerror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot open image file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szFileName);
+ mir_snwprintf(error, TranslateT("Cannot open image file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szFileName);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
return NULL;
}
@@ -1005,15 +1005,15 @@ void* GGPROTO::img_loadpicture(gg_event* e, wchar_t *szFileName) dat->lpData = (char*)malloc(dat->nSize);
memcpy(dat->lpData, e->event.image_reply.image, dat->nSize);
- ptrT tmpFileName( mir_a2t(e->event.image_reply.filename));
+ ptrW tmpFileName( mir_a2u(e->event.image_reply.filename));
if (!gg_img_hasextension(tmpFileName)) {
// Add missing file extension
const wchar_t *szImgType = gg_img_guessfileextension(dat->lpData);
if (*szImgType) {
- dat->lpszFileName = (wchar_t*)calloc(sizeof(wchar_t), mir_tstrlen(tmpFileName) + mir_tstrlen(szImgType) + 1);
+ dat->lpszFileName = (wchar_t*)calloc(sizeof(wchar_t), mir_wstrlen(tmpFileName) + mir_wstrlen(szImgType) + 1);
if (dat->lpszFileName != NULL) {
- mir_tstrcpy(dat->lpszFileName, tmpFileName);
- mir_tstrcat(dat->lpszFileName, szImgType);
+ mir_wstrcpy(dat->lpszFileName, tmpFileName);
+ mir_wstrcat(dat->lpszFileName, szImgType);
}
}
}
@@ -1143,7 +1143,7 @@ BOOL GGPROTO::img_sendonrequest(gg_event* e) if (!dat || !isonline())
return FALSE;
- char* lpszFileNameA = mir_t2a(dat->lpImages->lpszFileName);
+ char* lpszFileNameA = mir_u2a(dat->lpImages->lpszFileName);
gg_EnterCriticalSection(&sess_mutex, "img_sendonrequest", 63, "sess_mutex", 1);
gg_image_reply(sess, e->event.image_request.sender, lpszFileNameA, dat->lpImages->lpData, dat->lpImages->nSize);
gg_LeaveCriticalSection(&sess_mutex, "img_sendonrequest", 63, 1, "sess_mutex", 1);
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index 08a882079e..6e8e3f43f0 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -34,7 +34,7 @@ char *gg_makecontacts(GGPROTO *gg, int cr) DBVARIANT dbv;
if (!gg->getTString(hContact, GG_KEY_PD_FIRSTNAME, &dbv))
{
- char* pszValA = mir_t2a(dbv.ptszVal);
+ char* pszValA = mir_u2a(dbv.ptszVal);
string_append(s, dbv.pszVal);
mir_free(pszValA);
db_free(&dbv);
@@ -43,7 +43,7 @@ char *gg_makecontacts(GGPROTO *gg, int cr) // Readup LastName
if (!gg->getTString(hContact, GG_KEY_PD_LASTNAME, &dbv))
{
- char* pszValA = mir_t2a(dbv.ptszVal);
+ char* pszValA = mir_u2a(dbv.ptszVal);
string_append(s, dbv.pszVal);
mir_free(pszValA);
db_free(&dbv);
@@ -53,11 +53,11 @@ char *gg_makecontacts(GGPROTO *gg, int cr) // Readup Nick
if (!db_get_ts(hContact, "CList", "MyHandle", &dbv) || !gg->getTString(hContact, GG_KEY_NICK, &dbv))
{
- char* dbvA = mir_t2a(dbv.ptszVal);
+ char* dbvA = mir_u2a(dbv.ptszVal);
DBVARIANT dbv2;
if (!gg->getTString(hContact, GG_KEY_PD_NICKNAME, &dbv2))
{
- char* pszValA = mir_t2a(dbv2.ptszVal);
+ char* pszValA = mir_u2a(dbv2.ptszVal);
string_append(s, pszValA);
mir_free(pszValA);
db_free(&dbv2);
@@ -216,19 +216,19 @@ void GGPROTO::parsecontacts(char *contacts) #endif
// Write group
if (hContact && strGroup) {
- ptrT tszGrpName( mir_a2t(strGroup));
+ ptrW tszGrpName( mir_a2u(strGroup));
Clist_GroupCreate(0, tszGrpName);
db_set_ts(hContact, "CList", "Group", tszGrpName);
}
// Write misc data
if (hContact && strFirstName){
- wchar_t *tstrFirstName = mir_a2t(strFirstName);
+ wchar_t *tstrFirstName = mir_a2u(strFirstName);
setTString(hContact, GG_KEY_PD_FIRSTNAME, tstrFirstName);
mir_free(tstrFirstName);
}
if (hContact && strLastName){
- wchar_t *tstrLastName = mir_a2t(strLastName);
+ wchar_t *tstrLastName = mir_a2u(strLastName);
setTString(hContact, GG_KEY_PD_LASTNAME, tstrLastName);
mir_free(tstrLastName);
}
@@ -278,7 +278,7 @@ INT_PTR GGPROTO::import_server(WPARAM, LPARAM) {
wchar_t error[128];
gg_LeaveCriticalSection(&sess_mutex, "import_server", 65, 1, "sess_mutex", 1);
- mir_sntprintf(error, TranslateT("List cannot be imported because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno);
+ mir_snwprintf(error, TranslateT("List cannot be imported because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLog(L"import_server(): Cannot import list. errno:%d: %s", errno, ws_strerror(errno));
}
@@ -316,7 +316,7 @@ INT_PTR GGPROTO::remove_server(WPARAM, LPARAM) {
wchar_t error[128];
gg_LeaveCriticalSection(&sess_mutex, "remove_server", 66, 1, "sess_mutex", 1);
- mir_sntprintf(error, TranslateT("List cannot be removed because of error: %s (Error: %d)"), ws_strerror(errno), errno);
+ mir_snwprintf(error, TranslateT("List cannot be removed because of error: %s (Error: %d)"), ws_strerror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLog(L"remove_server(): Cannot remove list. errno=%d: %s", errno, ws_strerror(errno));
}
@@ -337,24 +337,24 @@ INT_PTR GGPROTO::import_text(WPARAM, LPARAM) OPENFILENAME ofn = {0};
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
wcsncpy(filter, TranslateT("Text files"), _countof(filter));
- mir_tstrncat(filter, L" (*.txt)", _countof(filter) - mir_tstrlen(filter));
- pfilter = filter + mir_tstrlen(filter) + 1;
+ mir_wstrncat(filter, L" (*.txt)", _countof(filter) - mir_wstrlen(filter));
+ pfilter = filter + mir_wstrlen(filter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
wcsncpy(pfilter, L"*.TXT", _countof(filter) - (pfilter - filter));
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
wcsncpy(pfilter, TranslateT("All Files"), _countof(filter) - (pfilter - filter));
- mir_tstrncat(pfilter, L" (*)", _countof(filter) - (pfilter - filter) - mir_tstrlen(pfilter));
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ mir_wstrncat(pfilter, L" (*)", _countof(filter) - (pfilter - filter) - mir_wstrlen(pfilter));
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
wcsncpy(pfilter, L"*", _countof(filter) - (pfilter - filter));
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
@@ -390,7 +390,7 @@ INT_PTR GGPROTO::import_text(WPARAM, LPARAM) else
{
wchar_t error[256];
- mir_sntprintf(error, TranslateT("List cannot be imported from file \"%s\" because of error:\n\t%s (Error: %d)"), str, _tcserror(errno), errno);
+ mir_snwprintf(error, TranslateT("List cannot be imported from file \"%s\" because of error:\n\t%s (Error: %d)"), str, _tcserror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLog(L"import_text(): Cannot import list from file \"%s\". errno=%d: %s", str, errno, _tcserror(errno));
if (f)
@@ -406,25 +406,25 @@ INT_PTR GGPROTO::export_text(WPARAM, LPARAM) wchar_t filter[512], *pfilter;
wcsncpy(str, TranslateT("contacts"), _countof(str));
- mir_tstrncat(str, L".txt", _countof(str) - mir_tstrlen(str));
+ mir_wstrncat(str, L".txt", _countof(str) - mir_wstrlen(str));
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
wcsncpy(filter, TranslateT("Text files"), _countof(filter));
- mir_tstrncat(filter, L" (*.txt)", _countof(filter) - mir_tstrlen(filter));
- pfilter = filter + mir_tstrlen(filter) + 1;
+ mir_wstrncat(filter, L" (*.txt)", _countof(filter) - mir_wstrlen(filter));
+ pfilter = filter + mir_wstrlen(filter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
wcsncpy(pfilter, L"*.TXT", _countof(filter) - (pfilter - filter));
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
wcsncpy(pfilter, TranslateT("All Files"), _countof(filter) - (pfilter - filter));
- mir_tstrncat(pfilter, L" (*)", _countof(filter) - (pfilter - filter) - mir_tstrlen(pfilter));
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ mir_wstrncat(pfilter, L" (*)", _countof(filter) - (pfilter - filter) - mir_wstrlen(pfilter));
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
wcsncpy(pfilter, L"*", _countof(filter) - (pfilter - filter));
- pfilter = pfilter + mir_tstrlen(pfilter) + 1;
+ pfilter = pfilter + mir_wstrlen(pfilter) + 1;
if (pfilter >= filter + _countof(filter))
return 0;
*pfilter = '\0';
@@ -452,7 +452,7 @@ INT_PTR GGPROTO::export_text(WPARAM, LPARAM) else
{
wchar_t error[128];
- mir_sntprintf(error, TranslateT("List cannot be exported to file \"%s\" because of error:\n\t%s (Error: %d)"), str, _tcserror(errno), errno);
+ mir_snwprintf(error, TranslateT("List cannot be exported to file \"%s\" because of error:\n\t%s (Error: %d)"), str, _tcserror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLog(L"export_text(): Cannot export list to file \"%s\". errno=%d: %s", str, errno, _tcserror(errno));
}
@@ -496,7 +496,7 @@ INT_PTR GGPROTO::export_server(WPARAM, LPARAM) {
wchar_t error[128];
gg_LeaveCriticalSection(&sess_mutex, "export_server", 67, 1, "sess_mutex", 1);
- mir_sntprintf(error, TranslateT("List cannot be exported because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno);
+ mir_snwprintf(error, TranslateT("List cannot be exported because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLog(L"export_server(): Cannot export list. errno=%d: %s", errno, ws_strerror(errno));
}
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp index 818daa2d8d..2a24e7e5c5 100644 --- a/protocols/Gadu-Gadu/src/oauth.cpp +++ b/protocols/Gadu-Gadu/src/oauth.cpp @@ -315,14 +315,14 @@ int GGPROTO::oauth_receivetoken() if (resp) {
nlc = resp->nlc;
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
- wchar_t *xmlAction = mir_a2t(resp->pData);
+ wchar_t *xmlAction = mir_a2u(resp->pData);
HXML hXml = xmlParseString(xmlAction, 0, L"result");
if (hXml != NULL) {
HXML node = xmlGetChildByPath(hXml, L"oauth_token", 0);
- token = node != NULL ? mir_t2a(xmlGetText(node)) : NULL;
+ token = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
node = xmlGetChildByPath(hXml, L"oauth_token_secret", 0);
- token_secret = node != NULL ? mir_t2a(xmlGetText(node)) : NULL;
+ token_secret = node != NULL ? mir_u2a(xmlGetText(node)) : NULL;
xmlDestroyNode(hXml);
}
@@ -384,14 +384,14 @@ int GGPROTO::oauth_receivetoken() resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
if (resp) {
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
- wchar_t *xmlAction = mir_a2t(resp->pData);
+ wchar_t *xmlAction = mir_a2u(resp->pData);
HXML hXml = xmlParseString(xmlAction, 0, L"result");
if (hXml != NULL) {
HXML node = xmlGetChildByPath(hXml, L"oauth_token", 0);
- token = mir_t2a(xmlGetText(node));
+ token = mir_u2a(xmlGetText(node));
node = xmlGetChildByPath(hXml, L"oauth_token_secret", 0);
- token_secret = mir_t2a(xmlGetText(node));
+ token_secret = mir_u2a(xmlGetText(node));
xmlDestroyNode(hXml);
}
diff --git a/protocols/Gadu-Gadu/src/ownerinfo.cpp b/protocols/Gadu-Gadu/src/ownerinfo.cpp index 7d7ebeb5cd..c89521354f 100644 --- a/protocols/Gadu-Gadu/src/ownerinfo.cpp +++ b/protocols/Gadu-Gadu/src/ownerinfo.cpp @@ -57,7 +57,7 @@ void __cdecl GGPROTO::remindpasswordthread(void *param) if (!(h = gg_remind_passwd3(rp->uin, rp->email, token.id, token.val, 0)))
{
wchar_t error[128];
- mir_sntprintf(error, TranslateT("Password could not be reminded because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno);
+ mir_snwprintf(error, TranslateT("Password could not be reminded because of error:\n\t%s (Error: %d)"), ws_strerror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
debugLog(L"remindpasswordthread(): Password could not be reminded. errno=%d: %s", errno, ws_strerror(errno));
}
diff --git a/protocols/Gadu-Gadu/src/popups.cpp b/protocols/Gadu-Gadu/src/popups.cpp index ca8ff1fa74..7712477bc2 100644 --- a/protocols/Gadu-Gadu/src/popups.cpp +++ b/protocols/Gadu-Gadu/src/popups.cpp @@ -87,7 +87,7 @@ void GGPROTO::initpopups() puc.hIcon = CopyIcon(LoadIconEx("main", FALSE));
ReleaseIconEx("main", FALSE);
puc.iSeconds = 4;
- mir_sntprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Notify"));
+ mir_snwprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Notify"));
mir_snprintf(szName, "%s_%s", m_szModuleName, "Notify");
hPopupNotify = Popup_RegisterClass(&puc);
@@ -95,7 +95,7 @@ void GGPROTO::initpopups() puc.colorText = RGB(255, 245, 225); // Yellow
puc.iSeconds = 60;
puc.hIcon = (HICON)LoadImage(NULL, IDI_WARNING, IMAGE_ICON, 0, 0, LR_SHARED);
- mir_sntprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Error"));
+ mir_snwprintf(szDescr, L"%s/%s", m_tszUserName, TranslateT("Error"));
mir_snprintf(szName, "%s_%s", m_szModuleName, "Error");
hPopupError = Popup_RegisterClass(&puc);
}
@@ -155,8 +155,8 @@ void GGPROTO::showpopup(const wchar_t* nickname, const wchar_t* msg, int flags) PopupData *puData = (PopupData*)mir_calloc(sizeof(PopupData));
puData->flags = flags;
- puData->title = mir_tstrdup(nickname);
- puData->text = mir_tstrdup(msg);
+ puData->title = mir_wstrdup(nickname);
+ puData->text = mir_wstrdup(msg);
puData->gg = this;
CallFunctionAsync(sttMainThreadCallback, puData);
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index f067ae87b7..e0fde48c40 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -189,7 +189,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) //directly check if contact has protected user avatar set by AVS, and if yes return it as protocol avatar
DBVARIANT dbv;
if (!db_get_ts(pai->hContact, "ContactPhoto", "Backup", &dbv)) {
- if ((mir_tstrlen(dbv.ptszVal)>0) && db_get_b(pai->hContact, "ContactPhoto", "Locked", 0)){
+ if ((mir_wstrlen(dbv.ptszVal)>0) && db_get_b(pai->hContact, "ContactPhoto", "Locked", 0)){
debugLogA("getavatarinfo(): Incoming request for avatar information. Contact has assigned Locked ContactPhoto. return GAIR_SUCCESS");
wcscpy_s(pai->filename, _countof(pai->filename) ,dbv.ptszVal);
pai->format = ProtoGetAvatarFormat(pai->filename);
@@ -242,7 +242,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) if (_wremove(pai->filename) != 0){
debugLog(L"getavatarinfo(): refresh. _wremove 1 file %s error. errno=%d: %s", pai->filename, errno, _tcserror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot remove old avatar file before refresh. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pai->filename);
+ mir_snwprintf(error, TranslateT("Cannot remove old avatar file before refresh. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pai->filename);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
}
setString(pai->hContact, GG_KEY_AVATARHASH, AvatarHash);
@@ -257,7 +257,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) if (_wremove(pai->filename) != 0){
debugLog(L"getavatarinfo(): delete. _wremove file %s error. errno=%d: %s", pai->filename, errno, _tcserror(errno));
wchar_t error[512];
- mir_sntprintf(error, TranslateT("Cannot remove old avatar file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pai->filename);
+ mir_snwprintf(error, TranslateT("Cannot remove old avatar file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pai->filename);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
}
delSetting(pai->hContact, GG_KEY_AVATARHASH);
@@ -337,7 +337,7 @@ INT_PTR GGPROTO::setmyavatar(WPARAM, LPARAM lParam) wchar_t szMyFilename[MAX_PATH];
getAvatarFilename(NULL, szMyFilename, _countof(szMyFilename));
- if ( mir_tstrcmp(szFilename, szMyFilename) && !CopyFile(szFilename, szMyFilename, FALSE)) {
+ if ( mir_wstrcmp(szFilename, szMyFilename) && !CopyFile(szFilename, szMyFilename, FALSE)) {
debugLogA("setmyavatar(): Failed to set user avatar. File with type %d could not be created/overwritten.", iAvType);
return -1;
}
@@ -357,7 +357,7 @@ INT_PTR GGPROTO::getmyawaymsg(WPARAM wParam, LPARAM lParam) gg_EnterCriticalSection(&modemsg_mutex, "refreshstatus", 72, "modemsg_mutex", 1);
wchar_t *szMsg = getstatusmsg(wParam ? gg_normalizestatus(wParam) : m_iStatus);
if (isonline() && szMsg)
- res = (lParam & SGMA_UNICODE) ? (INT_PTR)mir_t2u(szMsg) : (INT_PTR)mir_t2a(szMsg);
+ res = (lParam & SGMA_UNICODE) ? (INT_PTR)mir_wstrdup(szMsg) : (INT_PTR)mir_u2a(szMsg);
gg_LeaveCriticalSection(&modemsg_mutex, "refreshstatus", 72, 1, "modemsg_mutex", 1);
return res;
}
diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp index 13db5b1072..cd2225ddad 100644 --- a/protocols/Gadu-Gadu/src/sessions.cpp +++ b/protocols/Gadu-Gadu/src/sessions.cpp @@ -142,7 +142,7 @@ static BOOL IsOverAction(HWND hwndDlg) szText[0] = 0;
ListView_GetItemText(hList, hti.iItem, hti.iSubItem, szText, _countof(szText));
hdc = GetDC(hList);
- GetTextExtentPoint32(hdc, szText, (int)mir_tstrlen(szText), &textSize);
+ GetTextExtentPoint32(hdc, szText, (int)mir_wstrlen(szText), &textSize);
ReleaseDC(hList, hdc);
textPosX = rc.left + (((rc.right - rc.left) - textSize.cx) / 2);
return (hti.pt.x > textPosX && hti.pt.x < textPosX + textSize.cx);
@@ -168,7 +168,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w HANDLE hProtoAckEvent;
GetWindowText(hwndDlg, oldTitle, _countof(oldTitle));
- mir_sntprintf(newTitle, oldTitle, gg->m_tszUserName);
+ mir_snwprintf(newTitle, oldTitle, gg->m_tszUserName);
SetWindowText(hwndDlg, newTitle);
Window_SetIcon_IcoLib(hwndDlg, GetIconHandle(IDI_SESSIONS));
@@ -247,7 +247,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w GetClientRect(hwndHeader, &rcHeader);
rc.top += rcHeader.bottom;
}
- int cbLen = (int)mir_tstrlen(szText);
+ int cbLen = (int)mir_wstrlen(szText);
SIZE textSize;
GetTextExtentPoint32(nm->nmcd.hdc, szText, cbLen, &textSize);
int textPosX = rc.left + (((rc.right - rc.left) - textSize.cx) / 2);
@@ -330,10 +330,10 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w ListView_GetItemText(hList, lvhti.iItem, 0, szClientName, _countof(szClientName));
ListView_GetItemText(hList, lvhti.iItem, 1, szIP, _countof(szIP));
ListView_GetItemText(hList, lvhti.iItem, 2, szLoginTime, _countof(szLoginTime));
- mir_sntprintf(szText, L"%s\t%s\t%s", szClientName, szIP, szLoginTime);
- if ((hData = GlobalAlloc(GMEM_MOVEABLE, mir_tstrlen(szText) + 1)) != NULL)
+ mir_snwprintf(szText, L"%s\t%s\t%s", szClientName, szIP, szLoginTime);
+ if ((hData = GlobalAlloc(GMEM_MOVEABLE, mir_wstrlen(szText) + 1)) != NULL)
{
- mir_tstrcpy((wchar_t*)GlobalLock(hData), szText);
+ mir_wstrcpy((wchar_t*)GlobalLock(hData), szText);
GlobalUnlock(hData);
SetClipboardData(CF_TEXT, hData);
}
@@ -346,7 +346,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w wchar_t szUrl[256], szIP[64];
szIP[0] = 0;
ListView_GetItemText(hList, lvhti.iItem, 1, szIP, _countof(szIP));
- mir_sntprintf(szUrl, L"http://whois.domaintools.com/%s", szIP);
+ mir_snwprintf(szUrl, L"http://whois.domaintools.com/%s", szIP);
Utils_OpenUrlT(szUrl);
break;
}
diff --git a/protocols/Gadu-Gadu/src/token.cpp b/protocols/Gadu-Gadu/src/token.cpp index da89d11331..351b0df053 100644 --- a/protocols/Gadu-Gadu/src/token.cpp +++ b/protocols/Gadu-Gadu/src/token.cpp @@ -114,7 +114,7 @@ int GGPROTO::gettoken(GGTOKEN *token) struct gg_http *h = gg_token(0);
if (!h || gg_token_watch_fd(h) || h->state == GG_STATE_ERROR || h->state != GG_STATE_DONE) {
wchar_t error[128];
- mir_sntprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h ? h->error : 0));
+ mir_snwprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h ? h->error : 0));
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
gg_free_pubdir(h);
return FALSE;
@@ -123,7 +123,7 @@ int GGPROTO::gettoken(GGTOKEN *token) struct gg_token *t = (struct gg_token *)h->data;
if (!t || !h->body) {
wchar_t error[128];
- mir_sntprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h->error));
+ mir_snwprintf(error, TranslateT("Token retrieval failed because of error:\n\t%s"), http_error_string(h->error));
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
gg_free_pubdir(h);
return FALSE;
diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp index 0a2e424c2f..2b8be7fb7a 100644 --- a/protocols/Gadu-Gadu/src/userutils.cpp +++ b/protocols/Gadu-Gadu/src/userutils.cpp @@ -40,7 +40,7 @@ void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail) if (!(h = gg_register3(newEmail, newPass, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success || !s->uin) {
wchar_t error[128];
- mir_sntprintf(error, TranslateT("Cannot register new account because of error:\n\t%s"),
+ mir_snwprintf(error, TranslateT("Cannot register new account because of error:\n\t%s"),
(h && !s) ? http_error_string(h->error) :
(s ? TranslateT("Registration rejected") : ws_strerror(errno)));
MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
@@ -86,7 +86,7 @@ void *gg_dounregister(GGPROTO *gg, uin_t uin, char *password) if (!(h = gg_unregister3(uin, password, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success || s->uin != uin)
{
wchar_t error[128];
- mir_sntprintf(error, TranslateT("Your account cannot be removed because of error:\n\t%s"),
+ mir_snwprintf(error, TranslateT("Your account cannot be removed because of error:\n\t%s"),
(h && !s) ? http_error_string(h->error) :
(s ? TranslateT("Bad number or password") : ws_strerror(errno)));
MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
@@ -138,7 +138,7 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) if (!(h = gg_change_passwd4(uin, email, password, newPass, token.id, token.val, 0)) || !(s = (gg_pubdir*)h->data) || !s->success)
{
wchar_t error[128];
- mir_sntprintf(error, TranslateT("Your password cannot be changed because of error:\n\t%s"),
+ mir_snwprintf(error, TranslateT("Your password cannot be changed because of error:\n\t%s"),
(h && !s) ? http_error_string(h->error) :
(s ? TranslateT("Invalid data entered") : ws_strerror(errno)));
MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
@@ -180,7 +180,7 @@ void *gg_dochemail(GGPROTO *gg, uin_t uin, char *password, char *email, char *ne if (!h || !(s = (gg_pubdir*)h->data) || !s->success)
{
wchar_t error[128];
- mir_sntprintf(error, TranslateT("Your e-mail cannot be changed because of error:\n\t%s"),
+ mir_snwprintf(error, TranslateT("Your e-mail cannot be changed because of error:\n\t%s"),
(h && !s) ? http_error_string(h->error) : (s ? TranslateT("Bad old e-mail or password") : ws_strerror(errno)));
MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
gg->debugLog(L"gg_dochemail(): Cannot change e-mail. errno=%d: %s", errno, ws_strerror(errno));
|