summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/BaseExtraIcon.cpp6
-rw-r--r--src/mir_app/src/CallbackExtraIcon.cpp2
-rw-r--r--src/mir_app/src/ExtraIcon.h14
-rw-r--r--src/mir_app/src/ExtraIconGroup.cpp2
-rw-r--r--src/mir_app/src/FontOptions.cpp44
-rw-r--r--src/mir_app/src/FontService.cpp8
-rw-r--r--src/mir_app/src/FontService.h10
-rw-r--r--src/mir_app/src/IcoLib.h10
-rw-r--r--src/mir_app/src/IcolibExtraIcon.cpp2
-rw-r--r--src/mir_app/src/addcontact.cpp6
-rw-r--r--src/mir_app/src/button.cpp6
-rw-r--r--src/mir_app/src/chat.h30
-rw-r--r--src/mir_app/src/chat_clist.cpp16
-rw-r--r--src/mir_app/src/chat_log.cpp28
-rw-r--r--src/mir_app/src/chat_manager.cpp80
-rw-r--r--src/mir_app/src/chat_opts.cpp64
-rw-r--r--src/mir_app/src/chat_rtf.cpp70
-rw-r--r--src/mir_app/src/chat_svc.cpp4
-rw-r--r--src/mir_app/src/chat_tools.cpp130
-rw-r--r--src/mir_app/src/clc.cpp8
-rw-r--r--src/mir_app/src/clc.h18
-rw-r--r--src/mir_app/src/clcfiledrop.cpp14
-rw-r--r--src/mir_app/src/clcitems.cpp34
-rw-r--r--src/mir_app/src/clcmsgs.cpp8
-rw-r--r--src/mir_app/src/clcutils.cpp24
-rw-r--r--src/mir_app/src/clistcore.cpp2
-rw-r--r--src/mir_app/src/clistgroups.cpp60
-rw-r--r--src/mir_app/src/clistmod.cpp32
-rw-r--r--src/mir_app/src/clistsettings.cpp6
-rw-r--r--src/mir_app/src/clisttray.cpp24
-rw-r--r--src/mir_app/src/clui.cpp24
-rw-r--r--src/mir_app/src/cluiservices.cpp8
-rw-r--r--src/mir_app/src/contacts.cpp38
-rw-r--r--src/mir_app/src/database.cpp144
-rw-r--r--src/mir_app/src/dbini.cpp50
-rw-r--r--src/mir_app/src/dbintf.cpp2
-rw-r--r--src/mir_app/src/dbutils.cpp6
-rw-r--r--src/mir_app/src/descbutton.cpp4
-rw-r--r--src/mir_app/src/dll_sniffer.cpp2
-rw-r--r--src/mir_app/src/enterstring.cpp10
-rw-r--r--src/mir_app/src/extraicons.cpp4
-rw-r--r--src/mir_app/src/filter.cpp12
-rw-r--r--src/mir_app/src/filter.h20
-rw-r--r--src/mir_app/src/findadd.cpp52
-rw-r--r--src/mir_app/src/genmenu.h4
-rw-r--r--src/mir_app/src/headerbar.cpp4
-rw-r--r--src/mir_app/src/hotkey_opts.cpp26
-rw-r--r--src/mir_app/src/hotkeys.cpp2
-rw-r--r--src/mir_app/src/icolib.cpp26
-rw-r--r--src/mir_app/src/keyboard.cpp10
-rw-r--r--src/mir_app/src/langpack.cpp4
-rw-r--r--src/mir_app/src/langpack.h6
-rw-r--r--src/mir_app/src/lpopts.cpp14
-rw-r--r--src/mir_app/src/menu_clist.cpp44
-rw-r--r--src/mir_app/src/menu_options.cpp12
-rw-r--r--src/mir_app/src/menu_utils.cpp70
-rw-r--r--src/mir_app/src/meta_addto.cpp14
-rw-r--r--src/mir_app/src/meta_edit.cpp24
-rw-r--r--src/mir_app/src/meta_menu.cpp14
-rw-r--r--src/mir_app/src/meta_services.cpp6
-rw-r--r--src/mir_app/src/meta_utils.cpp6
-rw-r--r--src/mir_app/src/metacontacts.h2
-rw-r--r--src/mir_app/src/miranda.cpp8
-rw-r--r--src/mir_app/src/miranda.h8
-rw-r--r--src/mir_app/src/movetogroup.cpp16
-rw-r--r--src/mir_app/src/netlib.h4
-rw-r--r--src/mir_app/src/netliblog.cpp24
-rw-r--r--src/mir_app/src/netlibopts.cpp4
-rw-r--r--src/mir_app/src/netlibsecurity.cpp22
-rw-r--r--src/mir_app/src/newplugins.cpp52
-rw-r--r--src/mir_app/src/options.cpp96
-rw-r--r--src/mir_app/src/options_ei.cpp2
-rw-r--r--src/mir_app/src/path.cpp70
-rw-r--r--src/mir_app/src/pluginopts.cpp24
-rw-r--r--src/mir_app/src/plugins.h16
-rw-r--r--src/mir_app/src/profilemanager.cpp62
-rw-r--r--src/mir_app/src/profilemanager.h18
-rw-r--r--src/mir_app/src/proto_internal.cpp40
-rw-r--r--src/mir_app/src/proto_opts.cpp24
-rw-r--r--src/mir_app/src/proto_ui.cpp18
-rw-r--r--src/mir_app/src/proto_utils.cpp28
-rw-r--r--src/mir_app/src/protocols.cpp24
-rw-r--r--src/mir_app/src/searchresults.cpp28
-rw-r--r--src/mir_app/src/services.cpp10
-rw-r--r--src/mir_app/src/skin.h6
-rw-r--r--src/mir_app/src/skin2opts.cpp54
-rw-r--r--src/mir_app/src/skinicons.cpp22
-rw-r--r--src/mir_app/src/sounds.cpp30
-rw-r--r--src/mir_app/src/srmm_statusicon.cpp2
-rw-r--r--src/mir_app/src/xmlApi.cpp4
-rw-r--r--src/mir_app/src/xmlParser.cpp6
-rw-r--r--src/mir_app/src/xmlParser.h4
92 files changed, 1074 insertions, 1078 deletions
diff --git a/src/mir_app/src/BaseExtraIcon.cpp b/src/mir_app/src/BaseExtraIcon.cpp
index 2ff3beaf3f..1aa6b40057 100644
--- a/src/mir_app/src/BaseExtraIcon.cpp
+++ b/src/mir_app/src/BaseExtraIcon.cpp
@@ -23,7 +23,7 @@ Boston, MA 02111-1307, USA.
#include "extraicons.h"
-BaseExtraIcon::BaseExtraIcon(int id, const char *name, const TCHAR *description, const char *descIcon, MIRANDAHOOKPARAM OnClick, LPARAM param) :
+BaseExtraIcon::BaseExtraIcon(int id, const char *name, const wchar_t *description, const char *descIcon, MIRANDAHOOKPARAM OnClick, LPARAM param) :
ExtraIcon(name),
m_id(id),
m_OnClick(OnClick),
@@ -48,12 +48,12 @@ int BaseExtraIcon::getID() const
return m_id;
}
-const TCHAR* BaseExtraIcon::getDescription() const
+const wchar_t* BaseExtraIcon::getDescription() const
{
return m_tszDescription;
}
-void BaseExtraIcon::setDescription(const TCHAR *desc)
+void BaseExtraIcon::setDescription(const wchar_t *desc)
{
m_tszDescription = mir_tstrdup(desc);
}
diff --git a/src/mir_app/src/CallbackExtraIcon.cpp b/src/mir_app/src/CallbackExtraIcon.cpp
index bad538c5ab..ddf8fbffa7 100644
--- a/src/mir_app/src/CallbackExtraIcon.cpp
+++ b/src/mir_app/src/CallbackExtraIcon.cpp
@@ -23,7 +23,7 @@ Boston, MA 02111-1307, USA.
#include "extraicons.h"
-CallbackExtraIcon::CallbackExtraIcon(int _id, const char *_name, const TCHAR *_description, const char *_descIcon,
+CallbackExtraIcon::CallbackExtraIcon(int _id, const char *_name, const wchar_t *_description, const char *_descIcon,
MIRANDAHOOK _RebuildIcons, MIRANDAHOOK _ApplyIcon, MIRANDAHOOKPARAM _OnClick, LPARAM _param) :
BaseExtraIcon(_id, _name, _description, _descIcon, _OnClick, _param),
m_pfnRebuildIcons(_RebuildIcons), m_pfnApplyIcon(_ApplyIcon), m_needToRebuild(true)
diff --git a/src/mir_app/src/ExtraIcon.h b/src/mir_app/src/ExtraIcon.h
index 3d00bf5a04..7b701c11c9 100644
--- a/src/mir_app/src/ExtraIcon.h
+++ b/src/mir_app/src/ExtraIcon.h
@@ -43,7 +43,7 @@ public:
virtual void storeIcon(MCONTACT, void*) {};
virtual const char *getName() const;
- virtual const TCHAR *getDescription() const = 0;
+ virtual const wchar_t *getDescription() const = 0;
virtual const char *getDescIcon() const = 0;
virtual int getType() const = 0;
@@ -72,12 +72,12 @@ protected:
class BaseExtraIcon : public ExtraIcon
{
public:
- BaseExtraIcon(int id, const char *name, const TCHAR *description, const char *descIcon, MIRANDAHOOKPARAM OnClick, LPARAM param);
+ BaseExtraIcon(int id, const char *name, const wchar_t *description, const char *descIcon, MIRANDAHOOKPARAM OnClick, LPARAM param);
virtual ~BaseExtraIcon();
virtual int getID() const;
- virtual const TCHAR *getDescription() const;
- virtual void setDescription(const TCHAR *desc);
+ virtual const wchar_t *getDescription() const;
+ virtual void setDescription(const wchar_t *desc);
virtual const char *getDescIcon() const;
virtual void setDescIcon(const char *icon);
virtual int getType() const =0;
@@ -101,7 +101,7 @@ protected:
class CallbackExtraIcon : public BaseExtraIcon
{
public:
- CallbackExtraIcon(int id, const char *name, const TCHAR *description, const char *descIcon,
+ CallbackExtraIcon(int id, const char *name, const wchar_t *description, const char *descIcon,
MIRANDAHOOK RebuildIcons, MIRANDAHOOK ApplyIcon, MIRANDAHOOKPARAM OnClick, LPARAM param);
virtual ~CallbackExtraIcon();
@@ -126,7 +126,7 @@ private:
class IcolibExtraIcon : public BaseExtraIcon
{
public:
- IcolibExtraIcon(int id, const char *name, const TCHAR *description, const char *descIcon, MIRANDAHOOKPARAM OnClick, LPARAM param);
+ IcolibExtraIcon(int id, const char *name, const wchar_t *description, const char *descIcon, MIRANDAHOOKPARAM OnClick, LPARAM param);
virtual ~IcolibExtraIcon();
virtual int getType() const;
@@ -158,7 +158,7 @@ public:
virtual int setIcon(int id, MCONTACT hContact, HANDLE icon);
virtual int setIconByName(int id, MCONTACT hContact, const char *icon);
- virtual const TCHAR* getDescription() const;
+ virtual const wchar_t* getDescription() const;
virtual const char* getDescIcon() const;
virtual int getType() const;
diff --git a/src/mir_app/src/ExtraIconGroup.cpp b/src/mir_app/src/ExtraIconGroup.cpp
index 5031889689..6ed364f50b 100644
--- a/src/mir_app/src/ExtraIconGroup.cpp
+++ b/src/mir_app/src/ExtraIconGroup.cpp
@@ -188,7 +188,7 @@ int ExtraIconGroup::internalSetIcon(int id, MCONTACT hContact, void *value, bool
return ret;
}
-const TCHAR* ExtraIconGroup::getDescription() const
+const wchar_t* ExtraIconGroup::getDescription() const
{
return m_tszDescription;
}
diff --git a/src/mir_app/src/FontOptions.cpp b/src/mir_app/src/FontOptions.cpp
index 55653f7dbc..ef20702b7a 100644
--- a/src/mir_app/src/FontOptions.cpp
+++ b/src/mir_app/src/FontOptions.cpp
@@ -131,9 +131,9 @@ static void WriteLine(FILE *out, const char pszText[])
fputc('\n', out);
}
-static BOOL ExportSettings(HWND hwndDlg, const TCHAR *filename, OBJLIST<FontInternal>& flist, OBJLIST<ColourInternal>& clist, OBJLIST<EffectInternal>& elist)
+static BOOL ExportSettings(HWND hwndDlg, const wchar_t *filename, OBJLIST<FontInternal>& flist, OBJLIST<ColourInternal>& clist, OBJLIST<EffectInternal>& elist)
{
- FILE *out = _tfopen(filename, L"w");
+ FILE *out = _wfopen(filename, L"w");
if (out == NULL) {
MessageBox(hwndDlg, filename, TranslateT("Failed to create file"), MB_ICONWARNING | MB_OK);
return FALSE;
@@ -253,7 +253,7 @@ struct FSUIListItemData
int effect_id;
};
-static BOOL sttFsuiBindColourIdToFonts(HWND hwndList, const TCHAR *name, const TCHAR *backgroundGroup, const TCHAR *backgroundName, int colourId)
+static BOOL sttFsuiBindColourIdToFonts(HWND hwndList, const wchar_t *name, const wchar_t *backgroundGroup, const wchar_t *backgroundName, int colourId)
{
BOOL res = FALSE;
for (int i = SendMessage(hwndList, LB_GETCOUNT, 0, 0); i--;) {
@@ -276,7 +276,7 @@ static BOOL sttFsuiBindColourIdToFonts(HWND hwndList, const TCHAR *name, const T
return res;
}
-static bool sttFsuiBindEffectIdToFonts(HWND hwndList, const TCHAR *name, int effectId)
+static bool sttFsuiBindEffectIdToFonts(HWND hwndList, const wchar_t *name, int effectId)
{
for (int i = SendMessage(hwndList, LB_GETCOUNT, 0, 0); i--;) {
FSUIListItemData *itemData = (FSUIListItemData *)SendMessage(hwndList, LB_GETITEMDATA, i, 0);
@@ -293,10 +293,10 @@ static bool sttFsuiBindEffectIdToFonts(HWND hwndList, const TCHAR *name, int eff
return false;
}
-static HTREEITEM sttFindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHAR *name)
+static HTREEITEM sttFindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const wchar_t *name)
{
TVITEM tvi = { 0 };
- TCHAR str[MAX_PATH];
+ wchar_t str[MAX_PATH];
if (hItem)
tvi.hItem = TreeView_GetChild(hwndTree, hItem);
@@ -321,10 +321,10 @@ static HTREEITEM sttFindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TC
return NULL;
}
-static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const TCHAR *groupName, int _hLang)
+static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const wchar_t *groupName, int _hLang)
{
- TCHAR itemName[1024];
- TCHAR* sectionName;
+ wchar_t itemName[1024];
+ wchar_t* sectionName;
int sectionLevel = 0;
HTREEITEM hSection = NULL;
@@ -333,11 +333,11 @@ static void sttFsuiCreateSettingsTreeNode(HWND hwndTree, const TCHAR *groupName,
while (sectionName) {
// allow multi-level tree
- TCHAR* pItemName = sectionName;
+ wchar_t* pItemName = sectionName;
HTREEITEM hItem;
// one level deeper
- if (sectionName = _tcschr(sectionName, '/'))
+ if (sectionName = wcschr(sectionName, '/'))
*sectionName = 0;
pItemName = TranslateTH(_hLang, pItemName);
@@ -436,7 +436,7 @@ static void ShowEffectButton(HWND hwndDlg, BOOL bShow)
ShowWindow(GetDlgItem(hwndDlg, IDC_EFFECT_STATIC), bShow ? SW_SHOW : SW_HIDE);
}
-TCHAR* ModernEffectNames[] = { LPGENT("<none>"), LPGENT("Shadow at left"), LPGENT("Shadow at right"), LPGENT("Outline"), LPGENT("Outline smooth"), LPGENT("Smooth bump"), LPGENT("Contour thin"), LPGENT("Contour heavy") };
+wchar_t* ModernEffectNames[] = { LPGENW("<none>"), LPGENW("Shadow at left"), LPGENW("Shadow at right"), LPGENW("Outline"), LPGENW("Outline smooth"), LPGENW("Smooth bump"), LPGENW("Contour thin"), LPGENW("Contour heavy") };
static INT_PTR CALLBACK ChooseEffectDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
@@ -600,7 +600,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
TreeView_GetItem(GetDlgItem(hwndDlg, IDC_FONTGROUP), &tvi);
treeItem = (TreeItem *)tvi.lParam;
- TCHAR *group_buff = treeItem->groupName;
+ wchar_t *group_buff = treeItem->groupName;
sttFreeListItems(GetDlgItem(hwndDlg, IDC_FONTLIST));
SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_RESETCONTENT, 0, 0);
@@ -612,7 +612,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
for (int fontId = 0; fontId < font_id_list_w2.getCount(); fontId++) {
FontInternal &F = font_id_list_w2[fontId];
- if (!_tcsncmp(F.group, group_buff, 64)) {
+ if (!wcsncmp(F.group, group_buff, 64)) {
FSUIListItemData *itemData = (FSUIListItemData*)mir_alloc(sizeof(FSUIListItemData));
itemData->colour_id = -1;
itemData->effect_id = -1;
@@ -629,7 +629,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
for (int colourId = 0; colourId < colour_id_list_w2.getCount(); colourId++) {
ColourInternal &C = colour_id_list_w2[colourId];
- if (!_tcsncmp(C.group, group_buff, 64)) {
+ if (!wcsncmp(C.group, group_buff, 64)) {
if (!sttFsuiBindColourIdToFonts(GetDlgItem(hwndDlg, IDC_FONTLIST), C.name, C.group, C.name, colourId)) {
FSUIListItemData *itemData = (FSUIListItemData*)mir_alloc(sizeof(FSUIListItemData));
itemData->colour_id = colourId;
@@ -649,7 +649,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
for (int effectId = 0; effectId < effect_id_list_w2.getCount(); effectId++) {
EffectInternal& E = effect_id_list_w2[effectId];
- if (!_tcsncmp(E.group, group_buff, 64)) {
+ if (!wcsncmp(E.group, group_buff, 64)) {
if (!sttFsuiBindEffectIdToFonts(GetDlgItem(hwndDlg, IDC_FONTLIST), E.name, effectId)) {
FSUIListItemData *itemData = (FSUIListItemData*)mir_alloc(sizeof(FSUIListItemData));
itemData->effect_id = effectId;
@@ -689,7 +689,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
HFONT hFont = NULL, hoFont = NULL;
BOOL bIsFont = FALSE;
- TCHAR *itemName = NULL;
+ wchar_t *itemName = NULL;
if (itemData->font_id >= 0) {
int iItem = itemData->font_id;
bIsFont = TRUE;
@@ -728,7 +728,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
COLORREF clBack = (COLORREF)-1;
COLORREF clText = GetSysColor(COLOR_WINDOWTEXT);
BOOL bIsFont = FALSE;
- TCHAR *itemName = NULL;
+ wchar_t *itemName = NULL;
FSUIListItemData *itemData = (FSUIListItemData *)dis->itemData;
FONTEFFECT * pEffect = NULL;
@@ -960,7 +960,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
F1.value.size = (char)lf.lfHeight;
F1.value.style = (lf.lfWeight >= FW_BOLD ? DBFONTF_BOLD : 0) | (lf.lfItalic ? DBFONTF_ITALIC : 0) | (lf.lfUnderline ? DBFONTF_UNDERLINE : 0) | (lf.lfStrikeOut ? DBFONTF_STRIKEOUT : 0);
F1.value.charset = lf.lfCharSet;
- _tcsncpy_s(F1.value.szFace, lf.lfFaceName, _TRUNCATE);
+ wcsncpy_s(F1.value.szFace, lf.lfFaceName, _TRUNCATE);
MEASUREITEMSTRUCT mis = { 0 };
mis.CtlID = IDC_FONTLIST;
@@ -1074,7 +1074,7 @@ static INT_PTR CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam,
case IDC_BTN_EXPORT:
{
- TCHAR fname_buff[MAX_PATH], filter[MAX_PATH];
+ wchar_t fname_buff[MAX_PATH], filter[MAX_PATH];
mir_sntprintf(filter, L"%s (*.ini)%c*.ini%c%s (*.txt)%c*.TXT%c%s (*.*)%c*.*%c", TranslateT("Configuration files"), 0, 0, TranslateT("Text files"), 0, 0, TranslateT("All files"), 0, 0);
OPENFILENAME ofn = { 0 };
@@ -1298,7 +1298,7 @@ static INT_PTR CALLBACK DlgProcModernOptions(HWND hwndDlg, UINT msg, WPARAM wPar
pf->value.size = (char)lf.lfHeight;
pf->value.style = (lf.lfWeight >= FW_BOLD ? DBFONTF_BOLD : 0) | (lf.lfItalic ? DBFONTF_ITALIC : 0) | (lf.lfUnderline ? DBFONTF_UNDERLINE : 0) | (lf.lfStrikeOut ? DBFONTF_STRIKEOUT : 0);
pf->value.charset = lf.lfCharSet;
- _tcsncpy_s(pf->value.szFace, lf.lfFaceName, _TRUNCATE);
+ wcsncpy_s(pf->value.szFace, lf.lfFaceName, _TRUNCATE);
InvalidateRect(GetDlgItem(hwndDlg, IDC_PREVIEWHEADER), NULL, TRUE);
InvalidateRect(GetDlgItem(hwndDlg, IDC_PREVIEWGENERAL), NULL, TRUE);
@@ -1355,7 +1355,7 @@ int FontsModernOptInit(WPARAM wParam, LPARAM)
obj.iSection = MODERNOPT_PAGE_SKINS;
obj.iType = MODERNOPT_TYPE_SUBSECTIONPAGE;
obj.iBoldControls = iBoldControls;
- obj.lptzSubsection = LPGENT("Fonts");
+ obj.lptzSubsection = LPGENW("Fonts");
obj.lpzClassicGroup = "Customize";
obj.lpzClassicPage = "Fonts";
obj.lpzHelpUrl = "http://wiki.miranda-ng.org/";
diff --git a/src/mir_app/src/FontService.cpp b/src/mir_app/src/FontService.cpp
index 21790e4369..6e1d678965 100644
--- a/src/mir_app/src/FontService.cpp
+++ b/src/mir_app/src/FontService.cpp
@@ -97,19 +97,19 @@ int LoadFontserviceModule(void)
// create generic fonts
FontIDT fontid = { sizeof(fontid) };
strncpy(fontid.dbSettingsGroup, "Fonts", sizeof(fontid.dbSettingsGroup));
- _tcsncpy_s(fontid.group, LPGENT("General"), _TRUNCATE);
+ wcsncpy_s(fontid.group, LPGENW("General"), _TRUNCATE);
- _tcsncpy_s(fontid.name, LPGENT("Headers"), _TRUNCATE);
+ wcsncpy_s(fontid.name, LPGENW("Headers"), _TRUNCATE);
fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSHEADER;
strncpy(fontid.prefix, "Header", _countof(fontid.prefix));
FontRegisterT(&fontid);
- _tcsncpy_s(fontid.name, LPGENT("Generic text"), _TRUNCATE);
+ wcsncpy_s(fontid.name, LPGENW("Generic text"), _TRUNCATE);
fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSGENERAL;
strncpy(fontid.prefix, "Generic", _countof(fontid.prefix));
FontRegisterT(&fontid);
- _tcsncpy_s(fontid.name, LPGENT("Small text"), _TRUNCATE);
+ wcsncpy_s(fontid.name, LPGENW("Small text"), _TRUNCATE);
fontid.flags = FIDF_APPENDNAME | FIDF_NOAS | FIDF_SAVEPOINTSIZE | FIDF_ALLOWEFFECTS | FIDF_CLASSSMALL;
strncpy(fontid.prefix, "Small", _countof(fontid.prefix));
FontRegisterT(&fontid);
diff --git a/src/mir_app/src/FontService.h b/src/mir_app/src/FontService.h
index d530c311d7..9a1ea0c9d0 100644
--- a/src/mir_app/src/FontService.h
+++ b/src/mir_app/src/FontService.h
@@ -31,7 +31,7 @@ struct FontInternal : public FontIDT
FontSettingsT value;
int hLangpack;
- __inline TCHAR* getName() const { return TranslateTH(hLangpack, name); }
+ __inline wchar_t* getName() const { return TranslateTH(hLangpack, name); }
__inline bool isHeader() const
{
@@ -39,7 +39,7 @@ struct FontInternal : public FontIDT
return true;
if ((flags & FIDF_CLASSMASK) == 0)
- if (_tcsstr(name, L"Incoming nick") || _tcsstr(name, L"Outgoing nick") || _tcsstr(name, L"Incoming timestamp") || _tcsstr(name, L"Outgoing timestamp"))
+ if (wcsstr(name, L"Incoming nick") || wcsstr(name, L"Outgoing nick") || wcsstr(name, L"Incoming timestamp") || wcsstr(name, L"Outgoing timestamp"))
return true;
return false;
}
@@ -47,7 +47,7 @@ struct FontInternal : public FontIDT
struct ColourInternal : public ColourIDT
{
- __inline TCHAR* getName() const { return TranslateTH(hLangpack, name); }
+ __inline wchar_t* getName() const { return TranslateTH(hLangpack, name); }
COLORREF value;
int hLangpack;
@@ -55,7 +55,7 @@ struct ColourInternal : public ColourIDT
struct EffectInternal : public EffectIDT
{
- __inline TCHAR* getName() const { return TranslateTH(hLangpack, name); }
+ __inline wchar_t* getName() const { return TranslateTH(hLangpack, name); }
int hLangpack;
};
@@ -66,7 +66,7 @@ struct EffectInternal : public EffectIDT
typedef struct
{
char *paramName;
- TCHAR *groupName;
+ wchar_t *groupName;
}
TreeItem;
diff --git a/src/mir_app/src/IcoLib.h b/src/mir_app/src/IcoLib.h
index 67e1ea779c..2d8932e406 100644
--- a/src/mir_app/src/IcoLib.h
+++ b/src/mir_app/src/IcoLib.h
@@ -37,7 +37,7 @@ struct SectionItem : public MZeroedObject
struct IconSourceFile
{
int ref_count;
- TCHAR file[MAX_PATH];
+ wchar_t file[MAX_PATH];
};
struct IconSourceItemKey
@@ -78,7 +78,7 @@ struct IcolibItem : public MZeroedObject
char* name;
SectionItem* section;
int orderID;
- TCHAR* description;
+ wchar_t* description;
IconSourceFile* default_file;
int default_indx;
int cx, cy;
@@ -88,12 +88,12 @@ struct IcolibItem : public MZeroedObject
IconSourceItem* source_big;
IconSourceItem* default_icon;
- TCHAR* temp_file;
+ wchar_t* temp_file;
HICON temp_icon;
BOOL temp_reset;
__inline ~IcolibItem() { clear(); }
- __inline TCHAR* getDescr() const { return TranslateTH(hLangpack, description); }
+ __inline wchar_t* getDescr() const { return TranslateTH(hLangpack, description); }
void clear();
};
@@ -104,7 +104,7 @@ UINT _ExtractIconEx(LPCTSTR lpszFile, int iconIndex, int cxIcon, int cyIcon, HIC
void __fastcall SafeDestroyIcon(HICON &icon);
-IconSourceItem* GetIconSourceItem(const TCHAR* file, int indx, int cxIcon, int cyIcon);
+IconSourceItem* GetIconSourceItem(const wchar_t* file, int indx, int cxIcon, int cyIcon);
IcolibItem* IcoLib_FindHIcon(HICON hIcon, bool &big);
IcolibItem* IcoLib_FindIcon(const char* pszIconName);
diff --git a/src/mir_app/src/IcolibExtraIcon.cpp b/src/mir_app/src/IcolibExtraIcon.cpp
index 2ee93720e4..3ce8671e50 100644
--- a/src/mir_app/src/IcolibExtraIcon.cpp
+++ b/src/mir_app/src/IcolibExtraIcon.cpp
@@ -26,7 +26,7 @@ Boston, MA 02111-1307, USA.
#include "IcoLib.h"
-IcolibExtraIcon::IcolibExtraIcon(int _id, const char *_name, const TCHAR *_description, const char *_descIcon,
+IcolibExtraIcon::IcolibExtraIcon(int _id, const char *_name, const wchar_t *_description, const char *_descIcon,
MIRANDAHOOKPARAM _OnClick, LPARAM _param) :
BaseExtraIcon(_id, _name, _description, _descIcon, _OnClick, _param)
{
diff --git a/src/mir_app/src/addcontact.cpp b/src/mir_app/src/addcontact.cpp
index 34d314ef62..e9a729541f 100644
--- a/src/mir_app/src/addcontact.cpp
+++ b/src/mir_app/src/addcontact.cpp
@@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-static TCHAR* sttDecodeString(DWORD dwFlags, MAllStrings &src)
+static wchar_t* sttDecodeString(DWORD dwFlags, MAllStrings &src)
{
if (dwFlags & PSR_UNICODE)
return mir_u2t(src.w);
@@ -77,7 +77,7 @@ public:
}
MCONTACT hContact;
- TCHAR *szName = NULL, *tmpStr = NULL;
+ wchar_t *szName = NULL, *tmpStr = NULL;
if (m_acs.handleType == HANDLE_CONTACT)
szName = cli.pfnGetContactDisplayName(hContact = m_acs.hContact, 0);
else {
@@ -121,7 +121,7 @@ public:
int groupSel = 0;
ptrT tszGroup(db_get_tsa(hContact, "CList", "Group"));
- TCHAR *grpName;
+ wchar_t *grpName;
for (int groupId = 1; (grpName = Clist_GroupGetName(groupId, NULL)) != NULL; groupId++) {
int id = m_group.AddString(grpName, groupId);
if (!mir_tstrcmpi(tszGroup, grpName))
diff --git a/src/mir_app/src/button.cpp b/src/mir_app/src/button.cpp
index d831d1b4d3..f687df9c8b 100644
--- a/src/mir_app/src/button.cpp
+++ b/src/mir_app/src/button.cpp
@@ -203,7 +203,7 @@ static void PaintWorker(MButtonCtrl *ctl, HDC hdcPaint)
HFONT hOldFont = (HFONT)SelectObject(hdcMem, ctl->hFont);
SIZE sz;
- TCHAR szText[MAX_PATH];
+ wchar_t szText[MAX_PATH];
GetWindowText(ctl->hwnd, szText, _countof(szText));
GetTextExtentPoint32(hdcMem, szText, (int)mir_tstrlen(szText), &sz);
int xOffset = (rcClient.right - rcClient.left - sz.cx)/2;
@@ -307,7 +307,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
case WM_SETTEXT:
bct->cHot = 0;
if (lParam != 0) {
- TCHAR *tmp = (TCHAR*)lParam;
+ wchar_t *tmp = (wchar_t*)lParam;
while (*tmp) {
if (*tmp == '&' && *(tmp+1)) {
bct->cHot = _tolower(*(tmp+1));
@@ -486,7 +486,7 @@ static LRESULT CALLBACK MButtonWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
ti.uFlags = TTF_IDISHWND|TTF_SUBCLASS;
ti.uId = (UINT_PTR)bct->hwnd;
if (lParam & BATF_UNICODE)
- ti.lpszText = mir_wstrdup(TranslateW((WCHAR*)wParam));
+ ti.lpszText = mir_wstrdup(TranslateTS((WCHAR*)wParam));
else
ti.lpszText = Langpack_PcharToTchar((char*)wParam);
if (bct->pAccPropServices) {
diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h
index 26bd0710de..7f493c3bcf 100644
--- a/src/mir_app/src/chat.h
+++ b/src/mir_app/src/chat.h
@@ -38,7 +38,7 @@ struct GCPTRS
extern HGENMENU hJoinMenuItem, hLeaveMenuItem;
extern GlobalLogSettingsBase *g_Settings;
extern int g_cbSession, g_cbModuleInfo, g_iFontMode, g_iChatLang;
-extern TCHAR *g_szFontGroup;
+extern wchar_t *g_szFontGroup;
extern mir_cs cs;
extern char* pLogIconBmpBits[14];
@@ -47,17 +47,17 @@ extern size_t logIconBmpSize[14];
// log.c
void LoadMsgLogBitmaps(void);
void FreeMsgLogBitmaps(void);
-void ValidateFilename (TCHAR *filename);
-TCHAR* MakeTimeStamp(TCHAR *pszStamp, time_t time);
-TCHAR* GetChatLogsFilename(SESSION_INFO *si, time_t tTime);
+void ValidateFilename (wchar_t *filename);
+wchar_t* MakeTimeStamp(wchar_t *pszStamp, time_t time);
+wchar_t* GetChatLogsFilename(SESSION_INFO *si, time_t tTime);
char* Log_CreateRtfHeader(MODULEINFO *mi);
char* Log_CreateRTF(LOGSTREAMDATA *streamData);
char* Log_SetStyle(int style);
// clist.c
-BOOL AddEvent(MCONTACT hContact, HICON hIcon, MEVENT hEvent, int type, TCHAR* fmt, ...);
-MCONTACT AddRoom(const char *pszModule, const TCHAR *pszRoom, const TCHAR *pszDisplayName, int iType);
-MCONTACT FindRoom(const char *pszModule, const TCHAR *pszRoom);
+BOOL AddEvent(MCONTACT hContact, HICON hIcon, MEVENT hEvent, int type, wchar_t* fmt, ...);
+MCONTACT AddRoom(const char *pszModule, const wchar_t *pszRoom, const wchar_t *pszDisplayName, int iType);
+MCONTACT FindRoom(const char *pszModule, const wchar_t *pszRoom);
BOOL SetAllOffline(BOOL bHide, const char *pszModule);
BOOL SetOffline(MCONTACT hContact, BOOL bHide);
@@ -87,24 +87,24 @@ int LoadChatModule(void);
void UnloadChatModule(void);
// tools.c
-int DoRtfToTags(CMString &pszText, int iNumColors, COLORREF *pColors);
-int GetTextPixelSize(TCHAR* pszText, HFONT hFont, BOOL bWidth);
-TCHAR *RemoveFormatting(const TCHAR* pszText);
+int DoRtfToTags(CMString &pszText, int iNumColors, COLORREF *pColors);
+int GetTextPixelSize(wchar_t* pszText, HFONT hFont, BOOL bWidth);
+wchar_t *RemoveFormatting(const wchar_t* pszText);
BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight, int bManyFix);
int GetColorIndex(const char *pszModule, COLORREF cr);
void CheckColorsInModule(const char *pszModule);
int GetRichTextLength(HWND hwnd);
BOOL IsHighlighted(SESSION_INFO *si, GCEVENT *pszText);
-UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, TCHAR* pszUID, TCHAR* pszWordText);
+UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, wchar_t* pszUID, wchar_t* pszWordText);
void DestroyGCMenu(HMENU *hMenu, int iIndex);
-BOOL DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char *pszModule, int iType, const TCHAR* pszUID, const TCHAR* pszText, INT_PTR dwItem);
-BOOL DoEventHook(const TCHAR *pszID, const char *pszModule, int iType, const TCHAR *pszUID, const TCHAR* pszText, INT_PTR dwItem);
+BOOL DoEventHookAsync(HWND hwnd, const wchar_t *pszID, const char *pszModule, int iType, const wchar_t* pszUID, const wchar_t* pszText, INT_PTR dwItem);
+BOOL DoEventHook(const wchar_t *pszID, const char *pszModule, int iType, const wchar_t *pszUID, const wchar_t* pszText, INT_PTR dwItem);
BOOL IsEventSupported(int eventType);
BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce);
BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce);
BOOL DoPopup(SESSION_INFO *si, GCEVENT *gce);
-int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, TCHAR* pszRoomName, COLORREF crBkg, const TCHAR* fmt, ...);
+int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char* pszProtoName, wchar_t* pszRoomName, COLORREF crBkg, const wchar_t* fmt, ...);
-const TCHAR* my_strstri(const TCHAR* s1, const TCHAR* s2);
+const wchar_t* my_strstri(const wchar_t* s1, const wchar_t* s2);
#pragma comment(lib,"comctl32.lib")
diff --git a/src/mir_app/src/chat_clist.cpp b/src/mir_app/src/chat_clist.cpp
index 1c47006d0b..755904e390 100644
--- a/src/mir_app/src/chat_clist.cpp
+++ b/src/mir_app/src/chat_clist.cpp
@@ -22,12 +22,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "chat.h"
-MCONTACT AddRoom(const char *pszModule, const TCHAR *pszRoom, const TCHAR *pszDisplayName, int iType)
+MCONTACT AddRoom(const char *pszModule, const wchar_t *pszRoom, const wchar_t *pszDisplayName, int iType)
{
- TCHAR pszGroup[50]; *pszGroup = '\0';
+ wchar_t pszGroup[50]; *pszGroup = '\0';
ptrT groupName(db_get_tsa(NULL, CHAT_MODULE, "AddToGroup"));
if (groupName)
- _tcsncpy_s(pszGroup, groupName, _TRUNCATE);
+ wcsncpy_s(pszGroup, groupName, _TRUNCATE);
else
mir_tstrcpy(pszGroup, L"Chat rooms");
@@ -176,12 +176,12 @@ int PrebuildContactMenu(WPARAM hContact, LPARAM)
if (db_get_w(hContact, szProto, "Status", 0) == ID_STATUS_OFFLINE) {
if (ProtoServiceExists(szProto, PS_JOINCHAT)) {
bEnabledJoin = true;
- Menu_ModifyItem(hJoinMenuItem, LPGENT("&Join chat"));
+ Menu_ModifyItem(hJoinMenuItem, LPGENW("&Join chat"));
}
}
else {
bEnabledJoin = true;
- Menu_ModifyItem(hJoinMenuItem, LPGENT("&Open chat window"));
+ Menu_ModifyItem(hJoinMenuItem, LPGENW("&Open chat window"));
}
}
bEnabledLeave = ProtoServiceExists(szProto, PS_LEAVECHAT) != 0;
@@ -198,9 +198,9 @@ INT_PTR PrebuildContactMenuSvc(WPARAM wParam, LPARAM lParam)
return PrebuildContactMenu(wParam, lParam);
}
-BOOL AddEvent(MCONTACT hContact, HICON hIcon, MEVENT hEvent, int type, TCHAR* fmt, ...)
+BOOL AddEvent(MCONTACT hContact, HICON hIcon, MEVENT hEvent, int type, wchar_t* fmt, ...)
{
- TCHAR szBuf[4096];
+ wchar_t szBuf[4096];
if (!fmt || !fmt[0] || mir_tstrlen(fmt) > 2000)
return FALSE;
@@ -229,7 +229,7 @@ BOOL AddEvent(MCONTACT hContact, HICON hIcon, MEVENT hEvent, int type, TCHAR* fm
return TRUE;
}
-MCONTACT FindRoom(const char *pszModule, const TCHAR *pszRoom)
+MCONTACT FindRoom(const char *pszModule, const wchar_t *pszRoom)
{
for (MCONTACT hContact = db_find_first(pszModule); hContact; hContact = db_find_next(hContact, pszModule)) {
if (!db_get_b(hContact, pszModule, "ChatRoom", 0))
diff --git a/src/mir_app/src/chat_log.cpp b/src/mir_app/src/chat_log.cpp
index ac2a9ba75e..590ceb0f9d 100644
--- a/src/mir_app/src/chat_log.cpp
+++ b/src/mir_app/src/chat_log.cpp
@@ -104,11 +104,11 @@ static void Log_Append(char *&buffer, size_t &cbBufferEnd, size_t &cbBufferAlloc
cbBufferEnd += charsDone;
}
-static int Log_AppendRTF(LOGSTREAMDATA *streamData, BOOL simpleMode, char *&buffer, size_t &cbBufferEnd, size_t &cbBufferAlloced, const TCHAR *fmt, ...)
+static int Log_AppendRTF(LOGSTREAMDATA *streamData, BOOL simpleMode, char *&buffer, size_t &cbBufferEnd, size_t &cbBufferAlloced, const wchar_t *fmt, ...)
{
va_list va;
int lineLen, textCharsCount = 0;
- TCHAR* line = (TCHAR*)alloca(8001 * sizeof(TCHAR));
+ wchar_t* line = (wchar_t*)alloca(8001 * sizeof(wchar_t));
va_start(va, fmt);
lineLen = mir_vsntprintf(line, 8000, fmt, va);
@@ -150,14 +150,14 @@ static int Log_AppendRTF(LOGSTREAMDATA *streamData, BOOL simpleMode, char *&buff
line += 2;
else if (line[1] != '\0' && line[2] != '\0') {
- TCHAR szTemp3[3], c = *line;
+ wchar_t szTemp3[3], c = *line;
int col;
szTemp3[0] = line[1];
szTemp3[1] = line[2];
szTemp3[2] = '\0';
line += 2;
- col = _ttoi(szTemp3);
+ col = _wtoi(szTemp3);
col += (OPTIONS_FONTCOUNT + 1);
mir_snprintf(szTemp, (c == 'c') ? "\\cf%u " : "\\highlight%u ", col);
}
@@ -222,8 +222,8 @@ static int Log_AppendRTF(LOGSTREAMDATA *streamData, BOOL simpleMode, char *&buff
static void AddEventToBuffer(char *&buffer, size_t &bufferEnd, size_t &bufferAlloced, LOGSTREAMDATA *streamData)
{
- TCHAR szTemp[512], szTemp2[512];
- TCHAR* pszNick = NULL;
+ wchar_t szTemp[512], szTemp2[512];
+ wchar_t* pszNick = NULL;
if (streamData->lin->ptszNick) {
if (g_Settings->bLogLimitNames && mir_tstrlen(streamData->lin->ptszNick) > 20) {
mir_tstrncpy(szTemp2, streamData->lin->ptszNick, 20);
@@ -234,7 +234,7 @@ static void AddEventToBuffer(char *&buffer, size_t &bufferEnd, size_t &bufferAll
if (streamData->lin->ptszUserInfo)
mir_sntprintf(szTemp, L"%s (%s)", szTemp2, streamData->lin->ptszUserInfo);
else
- _tcsncpy_s(szTemp, szTemp2, _TRUNCATE);
+ wcsncpy_s(szTemp, szTemp2, _TRUNCATE);
pszNick = szTemp;
}
@@ -312,11 +312,11 @@ static void AddEventToBuffer(char *&buffer, size_t &bufferEnd, size_t &bufferAll
}
}
-TCHAR* MakeTimeStamp(TCHAR *pszStamp, time_t time)
+wchar_t* MakeTimeStamp(wchar_t *pszStamp, time_t time)
{
- static TCHAR szTime[30];
- if (!_tcsftime(szTime, _countof(szTime)-1, pszStamp, localtime(&time)))
- _tcsncpy_s(szTime, TranslateT("<invalid>"), _TRUNCATE);
+ static wchar_t szTime[30];
+ if (!wcsftime(szTime, _countof(szTime)-1, pszStamp, localtime(&time)))
+ wcsncpy_s(szTime, TranslateT("<invalid>"), _TRUNCATE);
return szTime;
}
@@ -380,7 +380,7 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
//insert timestamp
if (g_Settings->bShowTime) {
- TCHAR szTimeStamp[30], szOldTimeStamp[30];
+ wchar_t szTimeStamp[30], szOldTimeStamp[30];
mir_tstrncpy(szTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, lin->time), 30);
mir_tstrncpy(szOldTimeStamp, MakeTimeStamp(g_Settings->pszTimeStamp, streamData->si->LastTime), 30);
@@ -393,11 +393,11 @@ char* Log_CreateRTF(LOGSTREAMDATA *streamData)
// Insert the nick
if (lin->ptszNick && lin->iType == GC_EVENT_MESSAGE) {
- TCHAR pszTemp[300], *p1;
+ wchar_t pszTemp[300], *p1;
Log_Append(buffer, bufferEnd, bufferAlloced, "%s ", Log_SetStyle(lin->bIsMe ? 2 : 1));
mir_tstrncpy(pszTemp, lin->bIsMe ? g_Settings->pszOutgoingNick : g_Settings->pszIncomingNick, 299);
- p1 = _tcsstr(pszTemp, L"%n");
+ p1 = wcsstr(pszTemp, L"%n");
if (p1)
p1[1] = 's';
diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp
index c2bc66db1a..0e3a3bf276 100644
--- a/src/mir_app/src/chat_manager.cpp
+++ b/src/mir_app/src/chat_manager.cpp
@@ -38,7 +38,7 @@ static void SetActiveSessionEx(SESSION_INFO *si)
}
}
-static void SetActiveSession(const TCHAR *pszID, const char *pszModule)
+static void SetActiveSession(const wchar_t *pszID, const char *pszModule)
{
SESSION_INFO *si = chatApi.SM_FindSession(pszID, pszModule);
if (si)
@@ -60,7 +60,7 @@ static SESSION_INFO* GetActiveSession(void)
// Keeps track of all sessions and its windows
//---------------------------------------------------
-static SESSION_INFO* SM_AddSession(const TCHAR *pszID, const char *pszModule)
+static SESSION_INFO* SM_AddSession(const wchar_t *pszID, const char *pszModule)
{
if (!pszID || !pszModule)
return NULL;
@@ -114,7 +114,7 @@ static void SM_FreeSession(SESSION_INFO *si)
mir_free(si);
}
-static int SM_RemoveSession(const TCHAR *pszID, const char *pszModule, BOOL removeContact)
+static int SM_RemoveSession(const wchar_t *pszID, const char *pszModule, BOOL removeContact)
{
if (!pszModule)
return FALSE;
@@ -156,7 +156,7 @@ static int SM_RemoveSession(const TCHAR *pszID, const char *pszModule, BOOL remo
return FALSE;
}
-static SESSION_INFO* SM_FindSession(const TCHAR *pszID, const char *pszModule)
+static SESSION_INFO* SM_FindSession(const wchar_t *pszID, const char *pszModule)
{
if (!pszID || !pszModule)
return NULL;
@@ -168,7 +168,7 @@ static SESSION_INFO* SM_FindSession(const TCHAR *pszID, const char *pszModule)
return NULL;
}
-static BOOL SM_SetOffline(const TCHAR *pszID, const char *pszModule)
+static BOOL SM_SetOffline(const wchar_t *pszID, const char *pszModule)
{
if (!pszModule)
return FALSE;
@@ -190,7 +190,7 @@ static BOOL SM_SetOffline(const TCHAR *pszID, const char *pszModule)
return TRUE;
}
-static BOOL SM_SetStatusEx(const TCHAR *pszID, const char *pszModule, const TCHAR* pszText, int flags)
+static BOOL SM_SetStatusEx(const wchar_t *pszID, const char *pszModule, const wchar_t* pszText, int flags)
{
if (!pszModule)
return FALSE;
@@ -248,7 +248,7 @@ static BOOL SM_AddEventToAllMatchingUID(GCEVENT *gce)
return 0;
}
-static BOOL SM_AddEvent(const TCHAR *pszID, const char *pszModule, GCEVENT *gce, BOOL bIsHighlighted)
+static BOOL SM_AddEvent(const wchar_t *pszID, const char *pszModule, GCEVENT *gce, BOOL bIsHighlighted)
{
SESSION_INFO *p = SM_FindSession(pszID, pszModule);
if (p == NULL)
@@ -276,7 +276,7 @@ static BOOL SM_AddEvent(const TCHAR *pszID, const char *pszModule, GCEVENT *gce,
return TRUE;
}
-static USERINFO* SM_AddUser(const TCHAR *pszID, const char *pszModule, const TCHAR *pszUID, const TCHAR *pszNick, WORD wStatus)
+static USERINFO* SM_AddUser(const wchar_t *pszID, const char *pszModule, const wchar_t *pszUID, const wchar_t *pszNick, WORD wStatus)
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
if (si == NULL)
@@ -289,7 +289,7 @@ static USERINFO* SM_AddUser(const TCHAR *pszID, const char *pszModule, const TCH
return p;
}
-static BOOL SM_MoveUser(const TCHAR *pszID, const char *pszModule, const TCHAR *pszUID)
+static BOOL SM_MoveUser(const wchar_t *pszID, const char *pszModule, const wchar_t *pszUID)
{
if (!pszUID)
return FALSE;
@@ -302,7 +302,7 @@ static BOOL SM_MoveUser(const TCHAR *pszID, const char *pszModule, const TCHAR *
return TRUE;
}
-static BOOL SM_RemoveUser(const TCHAR *pszID, const char *pszModule, const TCHAR *pszUID)
+static BOOL SM_RemoveUser(const wchar_t *pszID, const char *pszModule, const wchar_t *pszUID)
{
if (!pszModule || !pszUID)
return FALSE;
@@ -332,13 +332,13 @@ static BOOL SM_RemoveUser(const TCHAR *pszID, const char *pszModule, const TCHAR
return 0;
}
-static USERINFO* SM_GetUserFromIndex(const TCHAR *pszID, const char *pszModule, int index)
+static USERINFO* SM_GetUserFromIndex(const wchar_t *pszID, const char *pszModule, int index)
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
return (si == NULL) ? NULL : chatApi.UM_FindUserFromIndex(si->pUsers, index);
}
-STATUSINFO* SM_AddStatus(const TCHAR *pszID, const char *pszModule, const TCHAR *pszStatus)
+STATUSINFO* SM_AddStatus(const wchar_t *pszID, const char *pszModule, const wchar_t *pszStatus)
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
if (si == NULL)
@@ -352,7 +352,7 @@ STATUSINFO* SM_AddStatus(const TCHAR *pszID, const char *pszModule, const TCHAR
return ti;
}
-static BOOL SM_GiveStatus(const TCHAR *pszID, const char *pszModule, const TCHAR *pszUID, const TCHAR *pszStatus)
+static BOOL SM_GiveStatus(const wchar_t *pszID, const char *pszModule, const wchar_t *pszUID, const wchar_t *pszStatus)
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
if (si == NULL)
@@ -367,7 +367,7 @@ static BOOL SM_GiveStatus(const TCHAR *pszID, const char *pszModule, const TCHAR
return TRUE;
}
-static BOOL SM_SetContactStatus(const TCHAR *pszID, const char *pszModule, const TCHAR *pszUID, WORD wStatus)
+static BOOL SM_SetContactStatus(const wchar_t *pszID, const char *pszModule, const wchar_t *pszUID, WORD wStatus)
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
if (si == NULL)
@@ -382,7 +382,7 @@ static BOOL SM_SetContactStatus(const TCHAR *pszID, const char *pszModule, const
return TRUE;
}
-static BOOL SM_TakeStatus(const TCHAR *pszID, const char *pszModule, const TCHAR *pszUID, const TCHAR *pszStatus)
+static BOOL SM_TakeStatus(const wchar_t *pszID, const char *pszModule, const wchar_t *pszUID, const wchar_t *pszStatus)
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
if (si == NULL)
@@ -397,7 +397,7 @@ static BOOL SM_TakeStatus(const TCHAR *pszID, const char *pszModule, const TCHAR
return TRUE;
}
-static LRESULT SM_SendMessage(const TCHAR *pszID, const char *pszModule, UINT msg, WPARAM wParam, LPARAM lParam)
+static LRESULT SM_SendMessage(const wchar_t *pszID, const char *pszModule, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (pszModule == NULL)
return 0;
@@ -417,7 +417,7 @@ static LRESULT SM_SendMessage(const TCHAR *pszID, const char *pszModule, UINT ms
return 0;
}
-static BOOL SM_PostMessage(const TCHAR *pszID, const char *pszModule, UINT msg, WPARAM wParam, LPARAM lParam)
+static BOOL SM_PostMessage(const wchar_t *pszID, const char *pszModule, UINT msg, WPARAM wParam, LPARAM lParam)
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
if (si == NULL)
@@ -444,7 +444,7 @@ static BOOL SM_BroadcastMessage(const char *pszModule, UINT msg, WPARAM wParam,
return TRUE;
}
-static BOOL SM_SetStatus(const TCHAR *pszID, const char *pszModule, int wStatus)
+static BOOL SM_SetStatus(const wchar_t *pszID, const char *pszModule, int wStatus)
{
if (!pszModule)
return FALSE;
@@ -470,7 +470,7 @@ static BOOL SM_SetStatus(const TCHAR *pszID, const char *pszModule, int wStatus)
return TRUE;
}
-static BOOL SM_SendUserMessage(const TCHAR *pszID, const char *pszModule, const TCHAR* pszText)
+static BOOL SM_SendUserMessage(const wchar_t *pszID, const char *pszModule, const wchar_t* pszText)
{
if (!pszModule || !pszText)
return FALSE;
@@ -487,7 +487,7 @@ static BOOL SM_SendUserMessage(const TCHAR *pszID, const char *pszModule, const
return TRUE;
}
-static BOOL SM_ChangeUID(const TCHAR *pszID, const char *pszModule, const TCHAR *pszUID, const TCHAR* pszNewUID)
+static BOOL SM_ChangeUID(const wchar_t *pszID, const char *pszModule, const wchar_t *pszUID, const wchar_t* pszNewUID)
{
if (!pszModule)
return FALSE;
@@ -505,7 +505,7 @@ static BOOL SM_ChangeUID(const TCHAR *pszID, const char *pszModule, const TCHAR
return TRUE;
}
-static BOOL SM_ChangeNick(const TCHAR *pszID, const char *pszModule, GCEVENT *gce)
+static BOOL SM_ChangeNick(const wchar_t *pszID, const char *pszModule, GCEVENT *gce)
{
if (!pszModule)
return FALSE;
@@ -556,7 +556,7 @@ static BOOL SM_RemoveAll(void)
return TRUE;
}
-static void SM_AddCommand(const TCHAR *pszID, const char *pszModule, const char* lpNewCommand)
+static void SM_AddCommand(const wchar_t *pszID, const char *pszModule, const char* lpNewCommand)
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
if (si == NULL)
@@ -591,7 +591,7 @@ static void SM_AddCommand(const TCHAR *pszID, const char *pszModule, const char*
}
}
-static char* SM_GetPrevCommand(const TCHAR *pszID, const char *pszModule) // get previous command. returns NULL if previous command does not exist. current command remains as it was.
+static char* SM_GetPrevCommand(const wchar_t *pszID, const char *pszModule) // get previous command. returns NULL if previous command does not exist. current command remains as it was.
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
if (si == NULL)
@@ -610,7 +610,7 @@ static char* SM_GetPrevCommand(const TCHAR *pszID, const char *pszModule) // get
return (pPrevCmd) ? pPrevCmd->lpCommand : NULL;
}
-static char* SM_GetNextCommand(const TCHAR *pszID, const char *pszModule) // get next command. returns NULL if next command does not exist. current command becomes NULL (a prev command after this one will get you the last command)
+static char* SM_GetNextCommand(const wchar_t *pszID, const char *pszModule) // get next command. returns NULL if next command does not exist. current command becomes NULL (a prev command after this one will get you the last command)
{
SESSION_INFO *si = SM_FindSession(pszID, pszModule);
if (si == NULL)
@@ -787,7 +787,7 @@ static BOOL MM_RemoveAll(void)
// per window nicklist that is available
//---------------------------------------------------
-static STATUSINFO* TM_AddStatus(STATUSINFO **ppStatusList, const TCHAR *pszStatus, int *iCount)
+static STATUSINFO* TM_AddStatus(STATUSINFO **ppStatusList, const wchar_t *pszStatus, int *iCount)
{
if (!ppStatusList || !pszStatus)
return NULL;
@@ -816,7 +816,7 @@ static STATUSINFO* TM_AddStatus(STATUSINFO **ppStatusList, const TCHAR *pszStatu
return FALSE;
}
-static STATUSINFO* TM_FindStatus(STATUSINFO *pStatusList, const TCHAR *pszStatus)
+static STATUSINFO* TM_FindStatus(STATUSINFO *pStatusList, const wchar_t *pszStatus)
{
if (!pStatusList || !pszStatus)
return NULL;
@@ -828,7 +828,7 @@ static STATUSINFO* TM_FindStatus(STATUSINFO *pStatusList, const TCHAR *pszStatus
return 0;
}
-static WORD TM_StringToWord(STATUSINFO *pStatusList, const TCHAR *pszStatus)
+static WORD TM_StringToWord(STATUSINFO *pStatusList, const wchar_t *pszStatus)
{
if (!pStatusList || !pszStatus)
return 0;
@@ -843,7 +843,7 @@ static WORD TM_StringToWord(STATUSINFO *pStatusList, const TCHAR *pszStatus)
return 0;
}
-static TCHAR* TM_WordToString(STATUSINFO *pStatusList, WORD Status)
+static wchar_t* TM_WordToString(STATUSINFO *pStatusList, WORD Status)
{
if (!pStatusList)
return NULL;
@@ -882,7 +882,7 @@ static BOOL TM_RemoveAll(STATUSINFO **ppStatusList)
// in a window nicklist
//---------------------------------------------------
-static int UM_CompareItem(USERINFO *u1, const TCHAR *pszNick, WORD wStatus)
+static int UM_CompareItem(USERINFO *u1, const wchar_t *pszNick, WORD wStatus)
{
WORD dw1 = u1->Status;
WORD dw2 = wStatus;
@@ -901,7 +901,7 @@ static int UM_CompareItem(USERINFO *u1, const TCHAR *pszNick, WORD wStatus)
return mir_tstrcmpi(u1->pszNick, pszNick);
}
-static USERINFO* UM_SortUser(USERINFO **ppUserList, const TCHAR *pszUID)
+static USERINFO* UM_SortUser(USERINFO **ppUserList, const wchar_t *pszUID)
{
USERINFO *ui = *ppUserList, *pLast = NULL;
if (!ui || !pszUID)
@@ -947,7 +947,7 @@ static USERINFO* UM_SortUser(USERINFO **ppUserList, const TCHAR *pszUID)
return node;
}
-USERINFO* UM_AddUser(STATUSINFO *pStatusList, USERINFO **ppUserList, const TCHAR *pszUID, const TCHAR *pszNick, WORD wStatus)
+USERINFO* UM_AddUser(STATUSINFO *pStatusList, USERINFO **ppUserList, const wchar_t *pszUID, const wchar_t *pszNick, WORD wStatus)
{
if (pStatusList == NULL || ppUserList == NULL || pszNick == NULL)
return NULL;
@@ -980,7 +980,7 @@ USERINFO* UM_AddUser(STATUSINFO *pStatusList, USERINFO **ppUserList, const TCHAR
return node;
}
-static USERINFO* UM_FindUser(USERINFO *pUserList, const TCHAR *pszUID)
+static USERINFO* UM_FindUser(USERINFO *pUserList, const wchar_t *pszUID)
{
if (!pUserList || !pszUID)
return NULL;
@@ -1006,7 +1006,7 @@ static USERINFO* UM_FindUserFromIndex(USERINFO *pUserList, int index)
return NULL;
}
-static USERINFO* UM_GiveStatus(USERINFO *pUserList, const TCHAR *pszUID, WORD status)
+static USERINFO* UM_GiveStatus(USERINFO *pUserList, const wchar_t *pszUID, WORD status)
{
USERINFO *ui = UM_FindUser(pUserList, pszUID);
if (ui == NULL)
@@ -1016,7 +1016,7 @@ static USERINFO* UM_GiveStatus(USERINFO *pUserList, const TCHAR *pszUID, WORD st
return ui;
}
-static USERINFO* UM_SetContactStatus(USERINFO *pUserList, const TCHAR *pszUID, WORD status)
+static USERINFO* UM_SetContactStatus(USERINFO *pUserList, const wchar_t *pszUID, WORD status)
{
USERINFO *ui = UM_FindUser(pUserList, pszUID);
if (ui == NULL)
@@ -1026,7 +1026,7 @@ static USERINFO* UM_SetContactStatus(USERINFO *pUserList, const TCHAR *pszUID, W
return ui;
}
-static BOOL UM_SetStatusEx(USERINFO *pUserList, const TCHAR* pszText, int flags)
+static BOOL UM_SetStatusEx(USERINFO *pUserList, const wchar_t* pszText, int flags)
{
int bOnlyMe = (flags & GC_SSE_ONLYLISTED) != 0, bSetStatus = (flags & GC_SSE_ONLINE) != 0;
char cDelimiter = (flags & GC_SSE_TABDELIMITED) ? '\t' : ' ';
@@ -1036,7 +1036,7 @@ static BOOL UM_SetStatusEx(USERINFO *pUserList, const TCHAR* pszText, int flags)
ui->iStatusEx = 0;
if (pszText != NULL) {
- TCHAR *s = (TCHAR *)_tcsstr(pszText, ui->pszUID);
+ wchar_t *s = (wchar_t *)wcsstr(pszText, ui->pszUID);
if (s) {
ui->iStatusEx = 0;
if (s == pszText || s[-1] == cDelimiter) {
@@ -1050,7 +1050,7 @@ static BOOL UM_SetStatusEx(USERINFO *pUserList, const TCHAR* pszText, int flags)
return TRUE;
}
-static USERINFO* UM_TakeStatus(USERINFO *pUserList, const TCHAR *pszUID, WORD status)
+static USERINFO* UM_TakeStatus(USERINFO *pUserList, const wchar_t *pszUID, WORD status)
{
USERINFO *ui = UM_FindUser(pUserList, pszUID);
if (ui == NULL)
@@ -1060,12 +1060,12 @@ static USERINFO* UM_TakeStatus(USERINFO *pUserList, const TCHAR *pszUID, WORD st
return ui;
}
-static TCHAR* UM_FindUserAutoComplete(USERINFO *pUserList, const TCHAR* pszOriginal, const TCHAR* pszCurrent)
+static wchar_t* UM_FindUserAutoComplete(USERINFO *pUserList, const wchar_t* pszOriginal, const wchar_t* pszCurrent)
{
if (!pUserList || !pszOriginal || !pszCurrent)
return NULL;
- TCHAR *pszName = NULL;
+ wchar_t *pszName = NULL;
for (USERINFO *ui = pUserList; ui != NULL; ui = ui->next)
if (ui->pszNick && my_strstri(ui->pszNick, pszOriginal) == ui->pszNick)
if (mir_tstrcmpi(ui->pszNick, pszCurrent) > 0 && (!pszName || mir_tstrcmpi(ui->pszNick, pszName) < 0))
@@ -1074,7 +1074,7 @@ static TCHAR* UM_FindUserAutoComplete(USERINFO *pUserList, const TCHAR* pszOrigi
return pszName;
}
-static BOOL UM_RemoveUser(USERINFO **ppUserList, const TCHAR *pszUID)
+static BOOL UM_RemoveUser(USERINFO **ppUserList, const wchar_t *pszUID)
{
if (!ppUserList || !pszUID)
return FALSE;
diff --git a/src/mir_app/src/chat_opts.cpp b/src/mir_app/src/chat_opts.cpp
index 238cc43008..0acccfbd2c 100644
--- a/src/mir_app/src/chat_opts.cpp
+++ b/src/mir_app/src/chat_opts.cpp
@@ -28,7 +28,7 @@ extern SESSION_INFO g_TabSession;
GlobalLogSettingsBase *g_Settings;
int g_cbSession, g_cbModuleInfo, g_iFontMode, g_iChatLang;
-TCHAR *g_szFontGroup;
+wchar_t *g_szFontGroup;
#define FONTF_BOLD 1
#define FONTF_ITALIC 2
@@ -47,26 +47,26 @@ static LOGFONT lfDefault;
static FontOptionsList fontOptionsList[] =
{
- { LPGENT("Timestamp"), RGB(50, 50, 240), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
- { LPGENT("Others nicknames"), RGB(0, 0, 192), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12 },
- { LPGENT("Your nickname"), RGB(0, 0, 192), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12 },
- { LPGENT("User has joined"), RGB(90, 160, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
- { LPGENT("User has left"), RGB(160, 160, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
- { LPGENT("User has disconnected"), RGB(160, 90, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
- { LPGENT("User kicked ..."), RGB(100, 100, 100), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
- { LPGENT("User is now known as ..."), RGB(90, 90, 160), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
- { LPGENT("Notice from user"), RGB(160, 130, 60), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
- { LPGENT("Incoming message"), RGB(90, 90, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
- { LPGENT("Outgoing message"), RGB(90, 90, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
- { LPGENT("The topic is ..."), RGB(70, 70, 160), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
- { LPGENT("Information messages"), RGB(130, 130, 195), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
- { LPGENT("User enables status for ..."), RGB(70, 150, 70), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
- { LPGENT("User disables status for ..."), RGB(150, 70, 70), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
- { LPGENT("Action message"), RGB(160, 90, 160), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
- { LPGENT("Highlighted message"), RGB(180, 150, 80), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENW("Timestamp"), RGB(50, 50, 240), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENW("Others nicknames"), RGB(0, 0, 192), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12 },
+ { LPGENW("Your nickname"), RGB(0, 0, 192), lfDefault.lfFaceName, DEFAULT_CHARSET, FONTF_BOLD, -12 },
+ { LPGENW("User has joined"), RGB(90, 160, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENW("User has left"), RGB(160, 160, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENW("User has disconnected"), RGB(160, 90, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENW("User kicked ..."), RGB(100, 100, 100), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENW("User is now known as ..."), RGB(90, 90, 160), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENW("Notice from user"), RGB(160, 130, 60), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENW("Incoming message"), RGB(90, 90, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENW("Outgoing message"), RGB(90, 90, 90), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENW("The topic is ..."), RGB(70, 70, 160), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENW("Information messages"), RGB(130, 130, 195), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENW("User enables status for ..."), RGB(70, 150, 70), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENW("User disables status for ..."), RGB(150, 70, 70), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENW("Action message"), RGB(160, 90, 160), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENW("Highlighted message"), RGB(180, 150, 80), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
{ L"", 0, lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
- { LPGENT("Nick list members (online)"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
- { LPGENT("Nick list members (away)"), RGB(170, 170, 170), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 }
+ { LPGENW("Nick list members (online)"), RGB(0, 0, 0), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 },
+ { LPGENW("Nick list members (away)"), RGB(170, 170, 170), lfDefault.lfFaceName, DEFAULT_CHARSET, 0, -12 }
};
static void LoadColors()
@@ -124,7 +124,7 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour)
if (tszFace == NULL)
mir_tstrcpy(lf->lfFaceName, FO.szDefFace);
else
- _tcsncpy_s(lf->lfFaceName, tszFace, _TRUNCATE);
+ wcsncpy_s(lf->lfFaceName, tszFace, _TRUNCATE);
}
}
@@ -136,13 +136,13 @@ void RegisterFonts(void)
FontIDT fontid = { sizeof(fontid) };
fontid.flags = FIDF_ALLOWREREGISTER | FIDF_DEFAULTVALID | FIDF_NEEDRESTART;
- _tcsncpy_s(fontid.backgroundGroup, g_szFontGroup, _TRUNCATE);
- _tcsncpy_s(fontid.group, g_szFontGroup, _TRUNCATE);
+ wcsncpy_s(fontid.backgroundGroup, g_szFontGroup, _TRUNCATE);
+ wcsncpy_s(fontid.group, g_szFontGroup, _TRUNCATE);
for (int i = 0; i < _countof(fontOptionsList); i++, index++) {
FontOptionsList &FO = fontOptionsList[i];
strncpy_s(fontid.dbSettingsGroup, CHATFONT_MODULE, _TRUNCATE);
- _tcsncpy_s(fontid.name, FO.szDescr, _TRUNCATE);
+ wcsncpy_s(fontid.name, FO.szDescr, _TRUNCATE);
mir_snprintf(fontid.prefix, "Font%d", index);
fontid.order = index;
@@ -150,28 +150,28 @@ void RegisterFonts(void)
switch (i) {
case 18:
case 19:
- _tcsncpy_s(fontid.backgroundName, LPGENT("Nick list background"), _TRUNCATE);
+ wcsncpy_s(fontid.backgroundName, LPGENW("Nick list background"), _TRUNCATE);
break;
case 17:
if (g_iFontMode == FONTMODE_SKIP)
continue;
if (g_iFontMode == FONTMODE_USE) {
- _tcsncpy_s(fontid.name, LPGENT("Message typing area"), _TRUNCATE);
- _tcsncpy_s(fontid.backgroundName, LPGENT("Message background"), _TRUNCATE);
+ wcsncpy_s(fontid.name, LPGENW("Message typing area"), _TRUNCATE);
+ wcsncpy_s(fontid.backgroundName, LPGENW("Message background"), _TRUNCATE);
FO.defColour = RGB(0, 0, 40);
break;
}
- _tcsncpy_s(fontid.name, LPGENT("Chat log symbols (Webdings)"), _TRUNCATE);
+ wcsncpy_s(fontid.name, LPGENW("Chat log symbols (Webdings)"), _TRUNCATE);
FO.szDefFace = L"Webdings";
FO.defColour = RGB(170, 170, 170);
FO.defCharset = SYMBOL_CHARSET;
// fall through
default:
- _tcsncpy_s(fontid.backgroundName, LPGENT("Group chat log background"), _TRUNCATE);
+ wcsncpy_s(fontid.backgroundName, LPGENW("Group chat log background"), _TRUNCATE);
break;
}
- _tcsncpy_s(fontid.deffontsettings.szFace, FO.szDefFace, _TRUNCATE);
+ wcsncpy_s(fontid.deffontsettings.szFace, FO.szDefFace, _TRUNCATE);
fontid.deffontsettings.charset = FO.defCharset;
fontid.deffontsettings.colour = FO.defColour;
fontid.deffontsettings.size = FO.defSize;
@@ -189,7 +189,7 @@ HICON LoadIconEx(char* pszIcoLibName, bool big)
return IcoLib_GetIcon(szTemp, big);
}
-static void InitSetting(TCHAR** ppPointer, char* pszSetting, TCHAR* pszDefault)
+static void InitSetting(wchar_t** ppPointer, char* pszSetting, wchar_t* pszDefault)
{
DBVARIANT dbv;
if (!db_get_ts(NULL, CHAT_MODULE, pszSetting, &dbv)) {
@@ -292,7 +292,7 @@ void SetIndentSize()
else g_Settings->LogTextIndent = 0;
}
-int GetTextPixelSize(TCHAR* pszText, HFONT hFont, BOOL bWidth)
+int GetTextPixelSize(wchar_t* pszText, HFONT hFont, BOOL bWidth)
{
if (!pszText || !hFont)
return 0;
diff --git a/src/mir_app/src/chat_rtf.cpp b/src/mir_app/src/chat_rtf.cpp
index d4382834b0..e2cf0addef 100644
--- a/src/mir_app/src/chat_rtf.cpp
+++ b/src/mir_app/src/chat_rtf.cpp
@@ -28,31 +28,31 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// convert rich edit code to bbcode (if wanted). Otherwise, strip all RTF formatting
// tags and return plain text
-static TCHAR tszRtfBreaks[] = L" \\\n\r";
+static wchar_t tszRtfBreaks[] = L" \\\n\r";
static void CreateColorMap(CMString &Text, int iCount, COLORREF *pSrc, int *pDst)
{
- const TCHAR *pszText = Text;
+ const wchar_t *pszText = Text;
int iIndex = 1;
- static const TCHAR *lpszFmt = L"\\red%[^ \x5b\\]\\green%[^ \x5b\\]\\blue%[^ \x5b;];";
- TCHAR szRed[10], szGreen[10], szBlue[10];
+ static const wchar_t *lpszFmt = L"\\red%[^ \x5b\\]\\green%[^ \x5b\\]\\blue%[^ \x5b;];";
+ wchar_t szRed[10], szGreen[10], szBlue[10];
- const TCHAR *p1 = _tcsstr(pszText, L"\\colortbl");
+ const wchar_t *p1 = wcsstr(pszText, L"\\colortbl");
if (!p1)
return;
- const TCHAR *pEnd = _tcschr(p1, '}');
+ const wchar_t *pEnd = wcschr(p1, '}');
- const TCHAR *p2 = _tcsstr(p1, L"\\red");
+ const wchar_t *p2 = wcsstr(p1, L"\\red");
for (int i = 0; i < iCount; i++)
pDst[i] = -1;
while (p2 && p2 < pEnd) {
- if (_stscanf(p2, lpszFmt, &szRed, &szGreen, &szBlue) > 0) {
+ if (swscanf(p2, lpszFmt, &szRed, &szGreen, &szBlue) > 0) {
for (int i = 0; i < iCount; i++) {
- if (pSrc[i] == RGB(_ttoi(szRed), _ttoi(szGreen), _ttoi(szBlue)))
+ if (pSrc[i] == RGB(_wtoi(szRed), _wtoi(szGreen), _wtoi(szBlue)))
pDst[i] = iIndex;
}
}
@@ -60,7 +60,7 @@ static void CreateColorMap(CMString &Text, int iCount, COLORREF *pSrc, int *pDst
p1 = p2;
p1++;
- p2 = _tcsstr(p1, L"\\red");
+ p2 = wcsstr(p1, L"\\red");
}
}
@@ -96,7 +96,7 @@ int DoRtfToTags(CMString &pszText, int iNumColors, COLORREF *pColors)
CMString res;
// iterate through all characters, if rtf control character found then take action
- for (const TCHAR *p = pszText.GetString() + idx; *p;) {
+ for (const wchar_t *p = pszText.GetString() + idx; *p;) {
switch (*p) {
case '\\':
if (p[1] == '\\' || p[1] == '{' || p[1] == '}') { // escaped characters
@@ -108,79 +108,79 @@ int DoRtfToTags(CMString &pszText, int iNumColors, COLORREF *pColors)
p += 2; break;
}
- if (!_tcsncmp(p, L"\\cf", 3)) { // foreground color
- int iCol = _ttoi(p + 3);
+ if (!wcsncmp(p, L"\\cf", 3)) { // foreground color
+ int iCol = _wtoi(p + 3);
int iInd = GetRtfIndex(iCol, iNumColors, pIndex);
bInsideColor = iInd > 0;
}
- else if (!_tcsncmp(p, L"\\highlight", 10)) { //background color
- TCHAR szTemp[20];
- int iCol = _ttoi(p + 10);
+ else if (!wcsncmp(p, L"\\highlight", 10)) { //background color
+ wchar_t szTemp[20];
+ int iCol = _wtoi(p + 10);
mir_sntprintf(szTemp, L"%d", iCol);
}
- else if (!_tcsncmp(p, L"\\line", 5)) { // soft line break;
+ else if (!wcsncmp(p, L"\\line", 5)) { // soft line break;
res.AppendChar('\n');
}
- else if (!_tcsncmp(p, L"\\endash", 7)) {
+ else if (!wcsncmp(p, L"\\endash", 7)) {
res.AppendChar(0x2013);
}
- else if (!_tcsncmp(p, L"\\emdash", 7)) {
+ else if (!wcsncmp(p, L"\\emdash", 7)) {
res.AppendChar(0x2014);
}
- else if (!_tcsncmp(p, L"\\bullet", 7)) {
+ else if (!wcsncmp(p, L"\\bullet", 7)) {
res.AppendChar(0x2022);
}
- else if (!_tcsncmp(p, L"\\ldblquote", 10)) {
+ else if (!wcsncmp(p, L"\\ldblquote", 10)) {
res.AppendChar(0x201C);
}
- else if (!_tcsncmp(p, L"\\rdblquote", 10)) {
+ else if (!wcsncmp(p, L"\\rdblquote", 10)) {
res.AppendChar(0x201D);
}
- else if (!_tcsncmp(p, L"\\lquote", 7)) {
+ else if (!wcsncmp(p, L"\\lquote", 7)) {
res.AppendChar(0x2018);
}
- else if (!_tcsncmp(p, L"\\rquote", 7)) {
+ else if (!wcsncmp(p, L"\\rquote", 7)) {
res.AppendChar(0x2019);
}
- else if (!_tcsncmp(p, L"\\b", 2)) { //bold
+ else if (!wcsncmp(p, L"\\b", 2)) { //bold
res.Append((p[2] != '0') ? L"[b]" : L"[/b]");
}
- else if (!_tcsncmp(p, L"\\i", 2)) { // italics
+ else if (!wcsncmp(p, L"\\i", 2)) { // italics
res.Append((p[2] != '0') ? L"[i]" : L"[/i]");
}
- else if (!_tcsncmp(p, L"\\strike", 7)) { // strike-out
+ else if (!wcsncmp(p, L"\\strike", 7)) { // strike-out
res.Append((p[7] != '0') ? L"[s]" : L"[/s]");
}
- else if (!_tcsncmp(p, L"\\ul", 3)) { // underlined
- if (p[3] == 0 || _tcschr(tszRtfBreaks, p[3])) {
+ else if (!wcsncmp(p, L"\\ul", 3)) { // underlined
+ if (p[3] == 0 || wcschr(tszRtfBreaks, p[3])) {
res.Append(L"[u]");
bInsideUl = true;
}
- else if (!_tcsnccmp(p + 3, L"none", 4)) {
+ else if (!wcsncmp(p + 3, L"none", 4)) {
if (bInsideUl)
res.Append(L"[/u]");
bInsideUl = false;
}
}
- else if (!_tcsncmp(p, L"\\tab", 4)) { // tab
+ else if (!wcsncmp(p, L"\\tab", 4)) { // tab
res.AppendChar('\t');
}
else if (p[1] == '\'') { // special character
if (p[2] != ' ' && p[2] != '\\') {
- TCHAR tmp[10], *t = tmp;
+ wchar_t tmp[10], *t = tmp;
*t++ = p[2];
if (p[3] != ' ' && p[3] != '\\')
*t++ = p[3];
*t = 0;
// convert string containing char in hex format to int.
- TCHAR *stoppedHere;
- res.AppendChar(_tcstol(tmp, &stoppedHere, 16));
+ wchar_t *stoppedHere;
+ res.AppendChar(wcstol(tmp, &stoppedHere, 16));
}
}
p++; // skip initial slash
- p += _tcscspn(p, tszRtfBreaks);
+ p += wcscspn(p, tszRtfBreaks);
if (*p == ' ')
p++;
break;
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 3d50d2c559..6a00cde117 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -248,11 +248,11 @@ static INT_PTR Service_NewChat(WPARAM, LPARAM lParam)
si->bBGSet = TRUE;
}
- TCHAR szTemp[256];
+ wchar_t szTemp[256];
if (si->iType == GCW_SERVER)
mir_sntprintf(szTemp, L"Server: %s", si->ptszName);
else
- _tcsncpy_s(szTemp, si->ptszName, _TRUNCATE);
+ wcsncpy_s(szTemp, si->ptszName, _TRUNCATE);
si->hContact = chatApi.AddRoom(gcw->pszModule, gcw->ptszID, szTemp, si->iType);
db_set_s(si->hContact, si->pszModule, "Topic", "");
db_unset(si->hContact, "CList", "StatusMsg");
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index 4f822f1779..3e18186f85 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -36,14 +36,14 @@ int GetRichTextLength(HWND hwnd)
/////////////////////////////////////////////////////////////////////////////////////////
-TCHAR* RemoveFormatting(const TCHAR *pszWord)
+wchar_t* RemoveFormatting(const wchar_t *pszWord)
{
- static TCHAR szTemp[10000];
+ static wchar_t szTemp[10000];
if (pszWord == NULL)
return NULL;
- TCHAR *d = szTemp;
+ wchar_t *d = szTemp;
size_t cbLen = mir_tstrlen(pszWord);
if (cbLen > _countof(szTemp))
cbLen = _countof(szTemp)-1;
@@ -163,9 +163,9 @@ static LRESULT CALLBACK PopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA
return DefWindowProc(hWnd, message, wParam, lParam);
}
-int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char *pszProtoName, TCHAR*, COLORREF crBkg, const TCHAR *fmt, ...)
+int ShowPopup(MCONTACT hContact, SESSION_INFO *si, HICON hIcon, char *pszProtoName, wchar_t*, COLORREF crBkg, const wchar_t *fmt, ...)
{
- static TCHAR szBuf[4 * 1024];
+ static wchar_t szBuf[4 * 1024];
if (!fmt || fmt[0] == 0 || mir_tstrlen(fmt) > 2000)
return 0;
@@ -400,18 +400,18 @@ void CheckColorsInModule(const char *pszModule)
}
}
-const TCHAR* my_strstri(const TCHAR* s1, const TCHAR* s2)
+const wchar_t* my_strstri(const wchar_t* s1, const wchar_t* s2)
{
int i, j, k;
for (i = 0; s1[i]; i++)
- for (j = i, k = 0; _totlower(s1[j]) == _totlower(s2[k]); j++, k++)
+ for (j = i, k = 0; towlower(s1[j]) == towlower(s2[k]); j++, k++)
if (!s2[k + 1])
return s1 + i;
return NULL;
}
-static TCHAR szTrimString[] = L":,.!?;\'>)";
+static wchar_t szTrimString[] = L":,.!?;\'>)";
BOOL IsHighlighted(SESSION_INFO *si, GCEVENT *gce)
{
@@ -421,7 +421,7 @@ BOOL IsHighlighted(SESSION_INFO *si, GCEVENT *gce)
if (gce->ptszText == NULL)
return FALSE;
- TCHAR *buf = RemoveFormatting(NEWTSTR_ALLOCA(gce->ptszText));
+ wchar_t *buf = RemoveFormatting(NEWWSTR_ALLOCA(gce->ptszText));
int iStart = 0;
CMString tszHighlightWords(g_Settings->pszHighlightWords);
@@ -439,7 +439,7 @@ BOOL IsHighlighted(SESSION_INFO *si, GCEVENT *gce)
tszToken = '*' + tszToken + '*';
// time to get the next/first word in the incoming text string
- for (const TCHAR *p = buf; *p != '\0'; p += _tcscspn(p, L" ")) {
+ for (const wchar_t *p = buf; *p != '\0'; p += wcscspn(p, L" ")) {
p += _tcsspn(p, L" ");
// compare the words, using wildcards
@@ -453,29 +453,29 @@ BOOL IsHighlighted(SESSION_INFO *si, GCEVENT *gce)
BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
{
- TCHAR szBuffer[4096];
- TCHAR szLine[4096];
- TCHAR p = '\0';
+ wchar_t szBuffer[4096];
+ wchar_t szLine[4096];
+ wchar_t p = '\0';
szBuffer[0] = '\0';
GetChatLogsFilename(si, gce->time);
BOOL bFileJustCreated = !PathFileExists(si->pszLogFileName);
- TCHAR tszFolder[MAX_PATH];
- _tcsncpy_s(tszFolder, si->pszLogFileName, _TRUNCATE);
+ wchar_t tszFolder[MAX_PATH];
+ wcsncpy_s(tszFolder, si->pszLogFileName, _TRUNCATE);
PathRemoveFileSpec(tszFolder);
if (!PathIsDirectory(tszFolder))
CreateDirectoryTreeT(tszFolder);
- TCHAR szTime[100];
+ wchar_t szTime[100];
mir_tstrncpy(szTime, chatApi.MakeTimeStamp(g_Settings->pszTimeStampLog, gce->time), 99);
- FILE *hFile = _tfopen(si->pszLogFileName, L"ab+");
+ FILE *hFile = _wfopen(si->pszLogFileName, L"ab+");
if (hFile == NULL)
return FALSE;
- TCHAR szTemp[512], szTemp2[512];
- TCHAR* pszNick = NULL;
+ wchar_t szTemp[512], szTemp2[512];
+ wchar_t* pszNick = NULL;
if (bFileJustCreated)
fputws((const wchar_t*)"\377\376", hFile); //UTF-16 LE BOM == FF FE
if (gce->ptszNick) {
@@ -488,7 +488,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
if (gce->ptszUserInfo)
mir_sntprintf(szTemp, L"%s (%s)", szTemp2, gce->ptszUserInfo);
else
- _tcsncpy_s(szTemp, szTemp2, _TRUNCATE);
+ wcsncpy_s(szTemp, szTemp2, _TRUNCATE);
pszNick = szTemp;
}
@@ -545,7 +545,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
break;
case GC_EVENT_INFORMATION:
p = '!';
- _tcsncpy_s(szBuffer, chatApi.RemoveFormatting(gce->ptszText), _TRUNCATE);
+ wcsncpy_s(szBuffer, chatApi.RemoveFormatting(gce->ptszText), _TRUNCATE);
break;
case GC_EVENT_ADDSTATUS:
p = '+';
@@ -565,7 +565,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
mir_sntprintf(szLine, L"%s %s\r\n", szTime, szBuffer);
if (szLine[0]) {
- _fputts(szLine, hFile);
+ fputws(szLine, hFile);
if (g_Settings->LoggingLimit > 0) {
fseek(hFile, 0, SEEK_END);
@@ -576,21 +576,21 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
if (dwSize > trimlimit) {
time_t now = time(0);
- TCHAR tszTimestamp[20];
- _tcsftime(tszTimestamp, 20, L"%Y%m%d-%H%M%S", _localtime32((__time32_t *)&now));
+ wchar_t tszTimestamp[20];
+ wcsftime(tszTimestamp, 20, L"%Y%m%d-%H%M%S", _localtime32((__time32_t *)&now));
tszTimestamp[19] = 0;
// max size reached, rotate the log
// move old logs to /archived sub folder just inside the log root folder.
// add a time stamp to the file name.
- TCHAR tszDrive[_MAX_DRIVE], tszDir[_MAX_DIR], tszName[_MAX_FNAME], tszExt[_MAX_EXT];
- _tsplitpath(si->pszLogFileName, tszDrive, tszDir, tszName, tszExt);
+ wchar_t tszDrive[_MAX_DRIVE], tszDir[_MAX_DIR], tszName[_MAX_FNAME], tszExt[_MAX_EXT];
+ _wsplitpath(si->pszLogFileName, tszDrive, tszDir, tszName, tszExt);
- TCHAR tszNewPath[_MAX_DRIVE + _MAX_DIR + _MAX_FNAME + _MAX_EXT + 20];
+ wchar_t tszNewPath[_MAX_DRIVE + _MAX_DIR + _MAX_FNAME + _MAX_EXT + 20];
mir_sntprintf(tszNewPath, L"%s%sarchived\\", tszDrive, tszDir);
CreateDirectoryTreeT(tszNewPath);
- TCHAR tszNewName[_MAX_DRIVE + _MAX_DIR + _MAX_FNAME + _MAX_EXT + 20];
+ wchar_t tszNewName[_MAX_DRIVE + _MAX_DIR + _MAX_FNAME + _MAX_EXT + 20];
mir_sntprintf(tszNewName, L"%s%s-%s%s", tszNewPath, tszName, tszTimestamp, tszExt);
fclose(hFile);
hFile = 0;
@@ -606,7 +606,7 @@ BOOL LogToFile(SESSION_INFO *si, GCEVENT *gce)
return TRUE;
}
-BOOL DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char *pszModule, int iType, const TCHAR* pszUID, const TCHAR* pszText, INT_PTR dwItem)
+BOOL DoEventHookAsync(HWND hwnd, const wchar_t *pszID, const char *pszModule, int iType, const wchar_t* pszUID, const wchar_t* pszText, INT_PTR dwItem)
{
SESSION_INFO *si = chatApi.SM_FindSession(pszID, pszModule);
if (si == NULL)
@@ -626,7 +626,7 @@ BOOL DoEventHookAsync(HWND hwnd, const TCHAR *pszID, const char *pszModule, int
return TRUE;
}
-BOOL DoEventHook(const TCHAR *pszID, const char *pszModule, int iType, const TCHAR *pszUID, const TCHAR* pszText, INT_PTR dwItem)
+BOOL DoEventHook(const wchar_t *pszID, const char *pszModule, int iType, const wchar_t *pszUID, const wchar_t* pszText, INT_PTR dwItem)
{
SESSION_INFO *si = chatApi.SM_FindSession(pszID, pszModule);
if (si == NULL)
@@ -676,75 +676,75 @@ BOOL IsEventSupported(int eventType)
return FALSE;
}
-void ValidateFilename(TCHAR *filename)
+void ValidateFilename(wchar_t *filename)
{
- TCHAR *p1 = filename;
- TCHAR szForbidden[] = L"\\/:*?\"<>|";
+ wchar_t *p1 = filename;
+ wchar_t szForbidden[] = L"\\/:*?\"<>|";
while (*p1 != '\0') {
- if (_tcschr(szForbidden, *p1))
+ if (wcschr(szForbidden, *p1))
*p1 = '_';
p1 += 1;
}
}
-static TCHAR tszOldTimeStamp[30];
+static wchar_t tszOldTimeStamp[30];
-TCHAR* GetChatLogsFilename(SESSION_INFO *si, time_t tTime)
+wchar_t* GetChatLogsFilename(SESSION_INFO *si, time_t tTime)
{
if (!tTime)
time(&tTime);
// check whether relevant parts of the timestamp have changed and
// we have to reparse the filename
- TCHAR *tszNow = chatApi.MakeTimeStamp(L"%a%d%m%Y", tTime); // once a day
+ wchar_t *tszNow = chatApi.MakeTimeStamp(L"%a%d%m%Y", tTime); // once a day
if (mir_tstrcmp(tszOldTimeStamp, tszNow)) {
- _tcsncpy_s(tszOldTimeStamp, tszNow, _TRUNCATE);
+ wcsncpy_s(tszOldTimeStamp, tszNow, _TRUNCATE);
*si->pszLogFileName = 0;
}
if (si->pszLogFileName[0] == 0) {
REPLACEVARSARRAY rva[11];
- rva[0].key.t = L"d";
- rva[0].value.t = mir_tstrdup(chatApi.MakeTimeStamp(L"%#d", tTime));
+ rva[0].key.w = L"d";
+ rva[0].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%#d", tTime));
// day 01-31
- rva[1].key.t = L"dd";
- rva[1].value.t = mir_tstrdup(chatApi.MakeTimeStamp(L"%d", tTime));
+ rva[1].key.w = L"dd";
+ rva[1].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%d", tTime));
// month 1-12
- rva[2].key.t = L"m";
- rva[2].value.t = mir_tstrdup(chatApi.MakeTimeStamp(L"%#m", tTime));
+ rva[2].key.w = L"m";
+ rva[2].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%#m", tTime));
// month 01-12
- rva[3].key.t = L"mm";
- rva[3].value.t = mir_tstrdup(chatApi.MakeTimeStamp(L"%m", tTime));
+ rva[3].key.w = L"mm";
+ rva[3].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%m", tTime));
// month text short
- rva[4].key.t = L"mon";
- rva[4].value.t = mir_tstrdup(chatApi.MakeTimeStamp(L"%b", tTime));
+ rva[4].key.w = L"mon";
+ rva[4].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%b", tTime));
// month text
- rva[5].key.t = L"month";
- rva[5].value.t = mir_tstrdup(chatApi.MakeTimeStamp(L"%B", tTime));
+ rva[5].key.w = L"month";
+ rva[5].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%B", tTime));
// year 01-99
- rva[6].key.t = L"yy";
- rva[6].value.t = mir_tstrdup(chatApi.MakeTimeStamp(L"%y", tTime));
+ rva[6].key.w = L"yy";
+ rva[6].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%y", tTime));
// year 1901-9999
- rva[7].key.t = L"yyyy";
- rva[7].value.t = mir_tstrdup(chatApi.MakeTimeStamp(L"%Y", tTime));
+ rva[7].key.w = L"yyyy";
+ rva[7].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%Y", tTime));
// weekday short
- rva[8].key.t = L"wday";
- rva[8].value.t = mir_tstrdup(chatApi.MakeTimeStamp(L"%a", tTime));
+ rva[8].key.w = L"wday";
+ rva[8].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%a", tTime));
// weekday
- rva[9].key.t = L"weekday";
- rva[9].value.t = mir_tstrdup(chatApi.MakeTimeStamp(L"%A", tTime));
+ rva[9].key.w = L"weekday";
+ rva[9].value.w = mir_tstrdup(chatApi.MakeTimeStamp(L"%A", tTime));
// end of array
- rva[10].key.t = NULL;
- rva[10].value.t = NULL;
+ rva[10].key.w = NULL;
+ rva[10].value.w = NULL;
- TCHAR tszTemp[MAX_PATH], *ptszVarPath;
+ wchar_t tszTemp[MAX_PATH], *ptszVarPath;
if (g_Settings->pszLogDir[mir_tstrlen(g_Settings->pszLogDir) - 1] == '\\') {
mir_sntprintf(tszTemp, L"%s%s", g_Settings->pszLogDir, L"%userid%.log");
ptszVarPath = tszTemp;
}
else ptszVarPath = g_Settings->pszLogDir;
- TCHAR *tszParsedName = Utils_ReplaceVarsT(ptszVarPath, si->hContact, rva);
+ wchar_t *tszParsedName = Utils_ReplaceVarsT(ptszVarPath, si->hContact, rva);
if (chatApi.OnGetLogName)
chatApi.OnGetLogName(si, tszParsedName);
else
@@ -752,11 +752,11 @@ TCHAR* GetChatLogsFilename(SESSION_INFO *si, time_t tTime)
mir_free(tszParsedName);
for (int i = 0; i < _countof(rva); i++)
- mir_free(rva[i].value.t);
+ mir_free(rva[i].value.w);
- for (TCHAR *p = si->pszLogFileName + 2; *p; ++p)
+ for (wchar_t *p = si->pszLogFileName + 2; *p; ++p)
if (*p == ':' || *p == '*' || *p == '?' || *p == '"' || *p == '<' || *p == '>' || *p == '|')
- *p = _T('_');
+ *p = '_';
}
return si->pszLogFileName;
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp
index e4ef46e543..dbc1974660 100644
--- a/src/mir_app/src/clc.cpp
+++ b/src/mir_app/src/clc.cpp
@@ -781,8 +781,8 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
SendMessage(GetParent(hwnd), WM_NOTIFY, 0, (LPARAM)& nm);
}
else {
- TCHAR szNew[2];
- szNew[0] = (TCHAR)wParam;
+ wchar_t szNew[2];
+ szNew[0] = (wchar_t)wParam;
szNew[1] = '\0';
if (mir_tstrlen(dat->szQuickSearch) >= _countof(dat->szQuickSearch) - 1) {
MessageBeep(MB_OK);
@@ -1110,7 +1110,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
if (contacto->type == CLCIT_CONTACT) //dropee is a contact
CallService(MS_CLIST_CONTACTCHANGEGROUP, (WPARAM)contacto->hContact, contactn->groupId);
else if (contacto->type == CLCIT_GROUP) { //dropee is a group
- TCHAR szNewName[120];
+ wchar_t szNewName[120];
mir_sntprintf(szNewName, L"%s\\%s", Clist_GroupGetName(contactn->groupId, NULL), contacto->szText);
Clist_GroupRename(contacto->groupId, szNewName);
}
@@ -1149,7 +1149,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam
if (!group->parent)
break;
if (contact->type == CLCIT_GROUP) { //dropee is a group
- TCHAR szNewName[120];
+ wchar_t szNewName[120];
mir_tstrncpy(szNewName, contact->szText, _countof(szNewName));
Clist_GroupRename(contact->groupId, szNewName);
}
diff --git a/src/mir_app/src/clc.h b/src/mir_app/src/clc.h
index 4695cd9b58..3783f8ba2f 100644
--- a/src/mir_app/src/clc.h
+++ b/src/mir_app/src/clc.h
@@ -50,10 +50,10 @@ int fnFindItem(HWND hwnd, struct ClcData *dat, DWORD dwItem, ClcContact **contac
int fnGetRowByIndex(struct ClcData *dat, int testindex, ClcContact **contact, ClcGroup **subgroup);
/* clcitems.c */
-ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers);
+ClcGroup* fnAddGroup(HWND hwnd, struct ClcData *dat, const wchar_t *szName, DWORD flags, int groupId, int calcTotalMembers);
ClcGroup* fnRemoveItemFromGroup(HWND hwnd, ClcGroup *group, ClcContact *contact, int updateTotalCount);
-ClcContact* fnAddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText);
+ClcContact* fnAddInfoItemToGroup(ClcGroup *group, int flags, const wchar_t *pszText);
ClcContact* fnAddItemToGroup(ClcGroup *group, int iAboveItem);
ClcContact* fnAddContactToGroup(struct ClcData *dat, ClcGroup *group, MCONTACT hContact);
@@ -72,14 +72,14 @@ int fnGetContactHiddenStatus(MCONTACT hContact, char *szProto, ClcData *dat);
LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPARAM wParam, LPARAM lParam);
/* clcutils.c */
-TCHAR* fnGetGroupCountsText(struct ClcData *dat, ClcContact *contact);
+wchar_t* fnGetGroupCountsText(struct ClcData *dat, ClcContact *contact);
int fnHitTest(HWND hwnd, struct ClcData *dat, int testx, int testy, ClcContact **contact, ClcGroup **group, DWORD * flags);
void fnScrollTo(HWND hwnd, struct ClcData *dat, int desty, int noSmooth);
void fnEnsureVisible(HWND hwnd, struct ClcData *dat, int iItem, int partialOk);
void fnRecalcScrollBar(HWND hwnd, struct ClcData *dat);
void fnSetGroupExpand(HWND hwnd, struct ClcData *dat, ClcGroup *group, int newState);
void fnDoSelectionDefaultAction(HWND hwnd, struct ClcData *dat);
-int fnFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefixOk);
+int fnFindRowByText(HWND hwnd, struct ClcData *dat, const wchar_t *text, int prefixOk);
void fnEndRename(HWND hwnd, struct ClcData *dat, int save);
void fnDeleteFromContactList(HWND hwnd, struct ClcData *dat);
void fnBeginRenameSelection(HWND hwnd, struct ClcData *dat);
@@ -122,7 +122,7 @@ void RebuildMenuOrder(void);
INT_PTR MenuProcessCommand(WPARAM wParam, LPARAM lParam);
/* clistsettings.c */
-TCHAR* fnGetContactDisplayName(MCONTACT hContact, int mode);
+wchar_t* fnGetContactDisplayName(MCONTACT hContact, int mode);
void fnGetDefaultFontSetting(int i, LOGFONT* lf, COLORREF * colour);
void fnInvalidateDisplayNameCacheEntry(MCONTACT hContact);
@@ -151,7 +151,7 @@ int fnGetContactIcon(MCONTACT hContact);
int fnIconFromStatusMode(const char *szProto, int status, MCONTACT hContact);
int fnShowHide(WPARAM wParam, LPARAM lParam);
HICON fnGetIconFromStatusMode(MCONTACT hContact, const char *szProto, int status);
-TCHAR* fnGetStatusModeDescription(int wParam, int lParam);
+wchar_t* fnGetStatusModeDescription(int wParam, int lParam);
int fnGetWindowVisibleState(HWND hWnd, int iStepX, int iStepY);
/* clisttray.c */
@@ -164,17 +164,17 @@ int fnTrayIconAdd(HWND hwnd, const char *szProto, const char *szIconProto, in
int fnTrayIconDestroy(HWND hwnd);
void fnTrayIconIconsChanged(void);
int fnTrayIconInit(HWND hwnd);
-TCHAR* fnTrayIconMakeTooltip(const TCHAR *szPrefix, const char *szProto);
+wchar_t* fnTrayIconMakeTooltip(const wchar_t *szPrefix, const char *szProto);
int fnTrayIconPauseAutoHide(WPARAM wParam, LPARAM lParam);
INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam);
void fnTrayIconRemove(HWND hwnd, const char *szProto);
int fnTrayIconSetBaseInfo(HICON hIcon, const char *szPreferredProto);
void fnTrayIconSetToBase(char *szPreferredProto);
void fnTrayIconTaskbarCreated(HWND hwnd);
-int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPreferredProto, int isBase);
+int fnTrayIconUpdate(HICON hNewIcon, const wchar_t *szNewTip, const char *szPreferredProto, int isBase);
void fnTrayIconUpdateBase(const char *szChangedProto);
int fnTrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoCount);
-void fnTrayIconUpdateWithImageList(int iImage, const TCHAR *szNewTip, char *szPreferredProto);
+void fnTrayIconUpdateWithImageList(int iImage, const wchar_t *szNewTip, char *szPreferredProto);
VOID CALLBACK fnTrayCycleTimerProc(HWND hwnd, UINT message, UINT_PTR idEvent, DWORD dwTime);
diff --git a/src/mir_app/src/clcfiledrop.cpp b/src/mir_app/src/clcfiledrop.cpp
index 382512016c..8739ae5b86 100644
--- a/src/mir_app/src/clcfiledrop.cpp
+++ b/src/mir_app/src/clcfiledrop.cpp
@@ -140,14 +140,14 @@ HRESULT CDropTarget::DragOver(DWORD /*grfKeyState*/, POINTL pt, DWORD * pdwEffec
HRESULT CDropTarget::DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
{
HWND hwnd;
- TCHAR szWindowClass[64];
+ wchar_t szWindowClass[64];
POINT shortPt;
shortPt.x = pt.x;
shortPt.y = pt.y;
hwnd = WindowFromPoint(shortPt);
GetClassName(hwnd, szWindowClass, _countof(szWindowClass));
- if (!mir_tstrcmp(szWindowClass, _T(CLISTCONTROL_CLASS))) {
+ if (!mir_tstrcmp(szWindowClass, CLISTCONTROL_CLASSW)) {
hwndCurrentDrag = hwnd;
ClcData *dat = (ClcData *) GetWindowLongPtr(hwndCurrentDrag, 0);
originalSelection = dat->selection;
@@ -172,15 +172,15 @@ HRESULT CDropTarget::DragLeave(void)
return S_OK;
}
-static void AddToFileList(TCHAR ***pppFiles, int *totalCount, const TCHAR *szFilename)
+static void AddToFileList(wchar_t ***pppFiles, int *totalCount, const wchar_t *szFilename)
{
- *pppFiles = (TCHAR **) mir_realloc(*pppFiles, (++*totalCount + 1) * sizeof(TCHAR *));
+ *pppFiles = (wchar_t **) mir_realloc(*pppFiles, (++*totalCount + 1) * sizeof(wchar_t *));
(*pppFiles)[*totalCount] = NULL;
(*pppFiles)[*totalCount - 1] = mir_tstrdup(szFilename);
if (GetFileAttributes(szFilename) & FILE_ATTRIBUTE_DIRECTORY) {
WIN32_FIND_DATA fd;
HANDLE hFind;
- TCHAR szPath[MAX_PATH];
+ wchar_t szPath[MAX_PATH];
mir_tstrcpy(szPath, szFilename);
mir_tstrcat(szPath, L"\\*");
if (hFind = FindFirstFile(szPath, &fd)) {
@@ -218,8 +218,8 @@ HRESULT CDropTarget::Drop(IDataObject * pDataObj, DWORD /*fKeyState*/, POINTL pt
ScreenToClient(hwndCurrentDrag, &shortPt);
MCONTACT hContact = HContactFromPoint(hwndCurrentDrag, dat, shortPt.x, shortPt.y, NULL);
if (hContact != NULL) {
- TCHAR **ppFiles = NULL;
- TCHAR szFilename[MAX_PATH];
+ wchar_t **ppFiles = NULL;
+ wchar_t szFilename[MAX_PATH];
int fileCount, totalCount = 0, i;
fileCount = DragQueryFile(hDrop, -1, NULL, 0);
diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp
index c53da45fbe..f21811c4f6 100644
--- a/src/mir_app/src/clcitems.cpp
+++ b/src/mir_app/src/clcitems.cpp
@@ -38,16 +38,16 @@ ClcContact* fnAddItemToGroup(ClcGroup *group, int iAboveItem)
return newItem;
}
-ClcGroup* fnAddGroup(HWND hwnd, ClcData *dat, const TCHAR *szName, DWORD flags, int groupId, int calcTotalMembers)
+ClcGroup* fnAddGroup(HWND hwnd, ClcData *dat, const wchar_t *szName, DWORD flags, int groupId, int calcTotalMembers)
{
dat->bNeedsResort = true;
if (!(GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_USEGROUPS))
return &dat->list;
ClcGroup *group = &dat->list;
- TCHAR *pNextField = NEWTSTR_ALLOCA(szName);
+ wchar_t *pNextField = NEWWSTR_ALLOCA(szName);
do {
- TCHAR *pBackslash = _tcschr(pNextField, '\\'), *pThisField = pNextField;
+ wchar_t *pBackslash = wcschr(pNextField, '\\'), *pThisField = pNextField;
if (pBackslash == NULL) {
pNextField = NULL;
}
@@ -137,7 +137,7 @@ void fnFreeGroup(ClcGroup *group)
}
static int iInfoItemUniqueHandle = 0;
-ClcContact* fnAddInfoItemToGroup(ClcGroup *group, int flags, const TCHAR *pszText)
+ClcContact* fnAddInfoItemToGroup(ClcGroup *group, int flags, const wchar_t *pszText)
{
int i = 0;
@@ -235,7 +235,7 @@ void fnAddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTo
if (checkHideOffline && cli.pfnIsHiddenMode(dat, status)) {
for (i = 1;; i++) {
- TCHAR *szGroupName = Clist_GroupGetName(i, &groupFlags);
+ wchar_t *szGroupName = Clist_GroupGetName(i, &groupFlags);
if (szGroupName == NULL)
return;
@@ -246,7 +246,7 @@ void fnAddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTo
return;
}
for (i = 1;; i++) {
- TCHAR *szGroupName = Clist_GroupGetName(i, &groupFlags);
+ wchar_t *szGroupName = Clist_GroupGetName(i, &groupFlags);
if (szGroupName == NULL)
return;
@@ -254,7 +254,7 @@ void fnAddContactToTree(HWND hwnd, ClcData *dat, MCONTACT hContact, int updateTo
break;
size_t len = mir_tstrlen(szGroupName);
- if (!_tcsncmp(szGroupName, tszGroup, len) && tszGroup[len] == '\\')
+ if (!wcsncmp(szGroupName, tszGroup, len) && tszGroup[len] == '\\')
cli.pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 1);
}
group = cli.pfnAddGroup(hwnd, dat, tszGroup, groupFlags, i, 1);
@@ -323,7 +323,7 @@ void fnDeleteItemFromTree(HWND hwnd, MCONTACT hItem)
ClcContact *cc = group->cl[i];
if (cc->type == CLCIT_GROUP) {
size_t len = mir_tstrlen(cc->szText);
- if (!_tcsncmp(cc->szText, dbv.ptszVal + nameOffset, len) &&
+ if (!wcsncmp(cc->szText, dbv.ptszVal + nameOffset, len) &&
(dbv.ptszVal[nameOffset + len] == '\\' || dbv.ptszVal[nameOffset + len] == '\0')) {
group->totalMembers--;
if (dbv.ptszVal[nameOffset + len] == '\0')
@@ -336,10 +336,10 @@ void fnDeleteItemFromTree(HWND hwnd, MCONTACT hItem)
else cli.pfnRemoveItemFromGroup(hwnd, group, contact, 1);
}
-int fnGetContactHiddenStatus(MCONTACT hContact, char*, ClcData*)
-{
- return db_get_b(hContact, "CList", "Hidden", 0);
-}
+int fnGetContactHiddenStatus(MCONTACT hContact, char*, ClcData*)
+{
+ return db_get_b(hContact, "CList", "Hidden", 0);
+}
void fnRebuildEntireList(HWND hwnd, ClcData *dat)
{
@@ -353,7 +353,7 @@ void fnRebuildEntireList(HWND hwnd, ClcData *dat)
for (int i = 1;; i++) {
DWORD groupFlags;
- TCHAR *szGroupName = Clist_GroupGetName(i, &groupFlags);
+ wchar_t *szGroupName = Clist_GroupGetName(i, &groupFlags);
if (szGroupName == NULL)
break;
cli.pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 0);
@@ -378,11 +378,11 @@ void fnRebuildEntireList(HWND hwnd, ClcData *dat)
group->totalMembers++;
if (dat->bFilterSearch && dat->szQuickSearch[0] != '\0') {
- TCHAR *name = cli.pfnGetContactDisplayName(hContact, 0);
- TCHAR *lowered_name = CharLowerW(NEWTSTR_ALLOCA(name));
- TCHAR *lowered_search = CharLowerW(NEWTSTR_ALLOCA(dat->szQuickSearch));
+ wchar_t *name = cli.pfnGetContactDisplayName(hContact, 0);
+ wchar_t *lowered_name = CharLowerW(NEWWSTR_ALLOCA(name));
+ wchar_t *lowered_search = CharLowerW(NEWWSTR_ALLOCA(dat->szQuickSearch));
- if (_tcsstr(lowered_name, lowered_search))
+ if (wcsstr(lowered_name, lowered_search))
cli.pfnAddContactToGroup(dat, group, hContact);
}
else if (!(style & CLS_NOHIDEOFFLINE) && (style & CLS_HIDEOFFLINE || group->hideOffline)) {
diff --git a/src/mir_app/src/clcmsgs.cpp b/src/mir_app/src/clcmsgs.cpp
index bd9bd1a4b7..8859699db4 100644
--- a/src/mir_app/src/clcmsgs.cpp
+++ b/src/mir_app/src/clcmsgs.cpp
@@ -43,7 +43,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
case CLM_ADDGROUP:
{
DWORD groupFlags;
- TCHAR *szName = Clist_GroupGetName(wParam, &groupFlags);
+ wchar_t *szName = Clist_GroupGetName(wParam, &groupFlags);
if (szName == NULL)
break;
cli.pfnAddGroup(hwnd, dat, szName, groupFlags, wParam, 0);
@@ -171,13 +171,13 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
return dat->groupIndent;
case CLM_GETISEARCHSTRING:
- mir_tstrcpy((TCHAR*)lParam, dat->szQuickSearch);
+ mir_tstrcpy((wchar_t*)lParam, dat->szQuickSearch);
return mir_tstrlen(dat->szQuickSearch);
case CLM_GETITEMTEXT:
if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
return 0;
- mir_tstrcpy((TCHAR*)lParam, contact->szText);
+ mir_tstrcpy((wchar_t*)lParam, contact->szText);
return mir_tstrlen(contact->szText);
case CLM_GETITEMTYPE:
@@ -398,7 +398,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar
case CLM_SETITEMTEXT:
if (!cli.pfnFindItem(hwnd, dat, wParam, &contact, NULL, NULL))
break;
- mir_tstrncpy(contact->szText, (TCHAR*)lParam, _countof(contact->szText));
+ mir_tstrncpy(contact->szText, (wchar_t*)lParam, _countof(contact->szText));
cli.pfnSortCLC(hwnd, dat, 1);
cli.pfnInvalidateRect(hwnd, NULL, FALSE);
break;
diff --git a/src/mir_app/src/clcutils.cpp b/src/mir_app/src/clcutils.cpp
index fdeae935e2..a01f99e3d0 100644
--- a/src/mir_app/src/clcutils.cpp
+++ b/src/mir_app/src/clcutils.cpp
@@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
extern HANDLE hHideInfoTipEvent;
-TCHAR* fnGetGroupCountsText(ClcData *dat, ClcContact *contact)
+wchar_t* fnGetGroupCountsText(ClcData *dat, ClcContact *contact)
{
if (contact->type != CLCIT_GROUP || !(dat->exStyle & CLS_EX_SHOWGROUPCOUNTS))
return L"";
@@ -62,7 +62,7 @@ TCHAR* fnGetGroupCountsText(ClcData *dat, ClcContact *contact)
if (onlineCount == 0 && dat->exStyle & CLS_EX_HIDECOUNTSWHENEMPTY)
return L"";
- static TCHAR szName[32];
+ static wchar_t szName[32];
mir_sntprintf(szName, L"(%u/%u)", onlineCount, totalCount);
return szName;
}
@@ -171,7 +171,7 @@ int fnHitTest(HWND hwnd, ClcData *dat, int testx, int testy, ClcContact **contac
GetTextExtentPoint32(hdc, hitcontact->szText, (int)mir_tstrlen(hitcontact->szText), &textSize);
int width = textSize.cx;
if (hitcontact->type == CLCIT_GROUP) {
- TCHAR *szCounts;
+ wchar_t *szCounts;
szCounts = cli.pfnGetGroupCountsText(dat, hitcontact);
if (szCounts[0]) {
GetTextExtentPoint32(hdc, L" ", 1, &textSize);
@@ -360,7 +360,7 @@ void fnDoSelectionDefaultAction(HWND hwnd, ClcData *dat)
CallService(MS_CLIST_CONTACTDOUBLECLICKED, (WPARAM)contact->hContact, 0);
}
-int fnFindRowByText(HWND hwnd, ClcData *dat, const TCHAR *text, int prefixOk)
+int fnFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk)
{
ClcGroup *group = &dat->list;
size_t testlen = mir_tstrlen(text);
@@ -378,11 +378,11 @@ int fnFindRowByText(HWND hwnd, ClcData *dat, const TCHAR *text, int prefixOk)
if (cc->type != CLCIT_DIVIDER) {
bool show;
if (dat->bFilterSearch) {
- TCHAR *lowered_szText = CharLowerW(NEWTSTR_ALLOCA(cc->szText));
- TCHAR *lowered_text = CharLowerW(NEWTSTR_ALLOCA(text));
- show = _tcsstr(lowered_szText, lowered_text) != NULL;
+ wchar_t *lowered_szText = CharLowerW(NEWWSTR_ALLOCA(cc->szText));
+ wchar_t *lowered_text = CharLowerW(NEWWSTR_ALLOCA(text));
+ show = wcsstr(lowered_szText, lowered_text) != NULL;
}
- else show = ((prefixOk && !_tcsnicmp(text, cc->szText, testlen)) || (!prefixOk && !mir_tstrcmpi(text, cc->szText)));
+ else show = ((prefixOk && !wcsnicmp(text, cc->szText, testlen)) || (!prefixOk && !mir_tstrcmpi(text, cc->szText)));
if (show) {
ClcGroup *contactGroup = group;
@@ -412,15 +412,15 @@ void fnEndRename(HWND, ClcData *dat, int save)
dat->hwndRenameEdit = NULL;
if (save) {
- TCHAR text[120]; text[0] = 0;
+ wchar_t text[120]; text[0] = 0;
GetWindowText(hwndEdit, text, _countof(text));
ClcContact *contact;
if (cli.pfnGetRowByIndex(dat, dat->selection, &contact, NULL) != -1) {
- if (mir_tstrcmp(contact->szText, text) && !_tcsstr(text, L"\\")) {
+ if (mir_tstrcmp(contact->szText, text) && !wcsstr(text, L"\\")) {
if (contact->type == CLCIT_GROUP) {
if (contact->group->parent && contact->group->parent->parent) {
- TCHAR szFullName[256];
+ wchar_t szFullName[256];
mir_sntprintf(szFullName, L"%s\\%s",
Clist_GroupGetName(contact->group->parent->groupId, NULL), text);
Clist_GroupRename(contact->groupId, szFullName);
@@ -430,7 +430,7 @@ void fnEndRename(HWND, ClcData *dat, int save)
}
else if (contact->type == CLCIT_CONTACT) {
cli.pfnInvalidateDisplayNameCacheEntry(contact->hContact);
- TCHAR* otherName = cli.pfnGetContactDisplayName(contact->hContact, GCDNF_NOMYHANDLE);
+ wchar_t* otherName = cli.pfnGetContactDisplayName(contact->hContact, GCDNF_NOMYHANDLE);
if (!text[0] || !mir_tstrcmp(otherName, text))
db_unset(contact->hContact, "CList", "MyHandle");
else
diff --git a/src/mir_app/src/clistcore.cpp b/src/mir_app/src/clistcore.cpp
index 9d9607e7c8..ed68859386 100644
--- a/src/mir_app/src/clistcore.cpp
+++ b/src/mir_app/src/clistcore.cpp
@@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
CLIST_INTERFACE cli = { 0 };
-static TCHAR szTip[MAX_TIP_SIZE+1];
+static wchar_t szTip[MAX_TIP_SIZE+1];
int LoadContactListModule2(void);
int LoadCLCModule(void);
diff --git a/src/mir_app/src/clistgroups.cpp b/src/mir_app/src/clistgroups.cpp
index 720c4d0001..2a5e5194ca 100644
--- a/src/mir_app/src/clistgroups.cpp
+++ b/src/mir_app/src/clistgroups.cpp
@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
struct CGroupInternal
{
- CGroupInternal(int _id, const TCHAR *_name) :
+ CGroupInternal(int _id, const wchar_t *_name) :
groupId(_id),
groupName(mir_tstrdup(_name))
{}
@@ -37,7 +37,7 @@ struct CGroupInternal
}
int groupId;
- TCHAR *groupName;
+ wchar_t *groupName;
void save()
{
@@ -79,16 +79,16 @@ static mir_cs csGroups;
/////////////////////////////////////////////////////////////////////////////////////////
-static int GroupNameExists(const TCHAR *ptszGroupName, int skipGroup)
+static int GroupNameExists(const wchar_t *ptszGroupName, int skipGroup)
{
if (ptszGroupName == 0)
return 0;
- TCHAR str[256];
- _tcsncpy_s(str + 1, _countof(str) - 1, ptszGroupName, _TRUNCATE);
+ wchar_t str[256];
+ wcsncpy_s(str + 1, _countof(str) - 1, ptszGroupName, _TRUNCATE);
CGroupInternal *tmp = (CGroupInternal*)_alloca(sizeof(CGroupInternal));
- tmp->groupName = (TCHAR*)str;
+ tmp->groupName = (wchar_t*)str;
if (tmp = arByName.find(tmp))
return (skipGroup == tmp->groupId) ? 0 : tmp->groupId + 1;
return 0;
@@ -101,11 +101,11 @@ MIR_APP_DLL(MGROUP) Clist_GroupExists(LPCTSTR ptszGroupName)
/////////////////////////////////////////////////////////////////////////////////////////
-static INT_PTR CreateGroupInternal(MGROUP hParent, const TCHAR *ptszName)
+static INT_PTR CreateGroupInternal(MGROUP hParent, const wchar_t *ptszName)
{
- TCHAR newBaseName[127], newName[128];
+ wchar_t newBaseName[127], newName[128];
- const TCHAR *grpName = ptszName ? ptszName : TranslateT("New group");
+ const wchar_t *grpName = ptszName ? ptszName : TranslateT("New group");
if (hParent) {
CGroupInternal *tmp = arByIds.find(hParent-1);
if (tmp == NULL)
@@ -113,7 +113,7 @@ static INT_PTR CreateGroupInternal(MGROUP hParent, const TCHAR *ptszName)
mir_sntprintf(newBaseName, L"%s\\%s", tmp->groupName+1, grpName);
}
- else _tcsncpy_s(newBaseName, grpName, _TRUNCATE);
+ else wcsncpy_s(newBaseName, grpName, _TRUNCATE);
mir_tstrncpy(newName + 1, newBaseName, _countof(newName) - 1);
if (ptszName) {
@@ -150,8 +150,8 @@ MIR_APP_DLL(MGROUP) Clist_GroupCreate(MGROUP hParent, LPCTSTR ptszGroupName)
if (ptszGroupName == NULL || ptszGroupName[0] == '\0' || ptszGroupName[0] == '\\')
return 0;
- TCHAR *tszName = NEWTSTR_ALLOCA(ptszGroupName);
- for (TCHAR *p = tszName; *p; p++) {
+ wchar_t *tszName = NEWWSTR_ALLOCA(ptszGroupName);
+ for (wchar_t *p = tszName; *p; p++) {
if (*p == '\\') {
*p = '\0';
CreateGroupInternal(hParent, tszName);
@@ -163,7 +163,7 @@ MIR_APP_DLL(MGROUP) Clist_GroupCreate(MGROUP hParent, LPCTSTR ptszGroupName)
/////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(TCHAR*) Clist_GroupGetName(MGROUP hGroup, DWORD *pdwFlags)
+MIR_APP_DLL(wchar_t*) Clist_GroupGetName(MGROUP hGroup, DWORD *pdwFlags)
{
CGroupInternal *p = arByIds.find(hGroup-1);
if (p == NULL)
@@ -184,7 +184,7 @@ MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup)
return 1;
if (db_get_b(NULL, "CList", "ConfirmDelete", SETTING_CONFIRMDELETE_DEFAULT)) {
- TCHAR szQuestion[256 + 100];
+ wchar_t szQuestion[256 + 100];
mir_sntprintf(szQuestion, TranslateT("Are you sure you want to delete group '%s'? This operation cannot be undone."), pGroup->groupName+1);
if (MessageBox(cli.hwndContactList, szQuestion, TranslateT("Delete group"), MB_YESNO | MB_ICONQUESTION) == IDNO)
return 1;
@@ -194,9 +194,9 @@ MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup)
// must remove setting from all child contacts too
// children are demoted to the next group up, not deleted.
- TCHAR *szNewParent = NEWTSTR_ALLOCA(pGroup->groupName+1);
+ wchar_t *szNewParent = NEWWSTR_ALLOCA(pGroup->groupName+1);
{
- TCHAR *pszLastBackslash = _tcsrchr(szNewParent, '\\');
+ wchar_t *pszLastBackslash = wcsrchr(szNewParent, '\\');
if (pszLastBackslash)
pszLastBackslash[0] = '\0';
else
@@ -237,12 +237,12 @@ MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup)
db_unset(NULL, "CListGroups", idstr);
// rename subgroups
- TCHAR szNewName[256];
+ wchar_t szNewName[256];
size_t len = mir_tstrlen(pGroup->groupName+1);
for (int i = 0; i < arByIds.getCount(); i++) {
CGroupInternal *p = arByIds[i];
- if (!_tcsncmp(pGroup->groupName+1, p->groupName+1, len) && p->groupName[len+1] == '\\' && _tcschr(p->groupName + len + 2, '\\') == NULL) {
+ if (!wcsncmp(pGroup->groupName+1, p->groupName+1, len) && p->groupName[len+1] == '\\' && wcschr(p->groupName + len + 2, '\\') == NULL) {
if (szNewParent[0])
mir_sntprintf(szNewName, L"%s\\%s", szNewParent, p->groupName + len + 2);
else
@@ -315,7 +315,7 @@ MIR_APP_DLL(int) Clist_GroupMoveBefore(MGROUP hGroup, MGROUP hGroupBefore)
/////////////////////////////////////////////////////////////////////////////////////////
-static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move)
+static int RenameGroupWithMove(int groupId, const wchar_t *szName, int move)
{
if (GroupNameExists(szName, groupId)) {
MessageBox(NULL, TranslateT("You already have a group with that name. Please enter a unique name for the group."), TranslateT("Rename group"), MB_ICONERROR | MB_OK);
@@ -327,9 +327,9 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move)
return 0;
// do the change
- TCHAR *oldName = NEWTSTR_ALLOCA(pGroup->groupName+1);
+ wchar_t *oldName = NEWWSTR_ALLOCA(pGroup->groupName+1);
- TCHAR str[256];
+ wchar_t str[256];
str[0] = pGroup->groupName[0];
mir_tstrncpy(str + 1, szName, _countof(str) - 1);
@@ -352,8 +352,8 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move)
continue;
CGroupInternal *p = arByIds[i];
- if (!_tcsncmp(p->groupName+1, oldName, len) && p->groupName[len+1] == '\\' && _tcschr(p->groupName + len + 2, '\\') == NULL) {
- TCHAR szNewName[256];
+ if (!wcsncmp(p->groupName+1, oldName, len) && p->groupName[len+1] == '\\' && wcschr(p->groupName + len + 2, '\\') == NULL) {
+ wchar_t szNewName[256];
mir_sntprintf(szNewName, L"%s\\%s", szName, p->groupName + len + 2);
RenameGroupWithMove(i, szNewName, 0); // luckily, child groups will never need reordering
}
@@ -361,8 +361,8 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move)
// finally must make sure it's after any parent items
if (move) {
- _tcsncpy_s(str, szName, _TRUNCATE);
- TCHAR *pszLastBackslash = _tcsrchr(str, '\\');
+ wcsncpy_s(str, szName, _TRUNCATE);
+ wchar_t *pszLastBackslash = wcsrchr(str, '\\');
if (pszLastBackslash != NULL) {
*pszLastBackslash = '\0';
for (int i = 0; i < arByIds.getCount(); i++) {
@@ -377,12 +377,12 @@ static int RenameGroupWithMove(int groupId, const TCHAR *szName, int move)
Clist_BroadcastAsync(CLM_AUTOREBUILD, 0, 0);
}
- const CLISTGROUPCHANGE grpChg = { sizeof(grpChg), oldName, (TCHAR*)szName };
+ const CLISTGROUPCHANGE grpChg = { sizeof(grpChg), oldName, (wchar_t*)szName };
NotifyEventHooks(hGroupChangeEvent, 0, (LPARAM)&grpChg);
return 0;
}
-MIR_APP_DLL(int) Clist_GroupRename(MGROUP hGroup, const TCHAR *ptszNewName)
+MIR_APP_DLL(int) Clist_GroupRename(MGROUP hGroup, const wchar_t *ptszNewName)
{
return 0 != RenameGroupWithMove(hGroup-1, ptszNewName, 1);
}
@@ -432,15 +432,15 @@ MIR_APP_DLL(HMENU) Clist_GroupBuildMenu()
HMENU hRootMenu = CreateMenu();
for (int i = 0; i < arByIds.getCount(); i++) {
- const TCHAR *pNextField = arByIds[i]->groupName + 1;
+ const wchar_t *pNextField = arByIds[i]->groupName + 1;
HMENU hThisMenu = hRootMenu;
MENUITEMINFO mii = { 0 };
mii.cbSize = sizeof(mii);
- TCHAR szThisField[128], szThisMenuItem[128];
+ wchar_t szThisField[128], szThisMenuItem[128];
do {
- const TCHAR *pBackslash = _tcschr(pNextField, '\\');
+ const wchar_t *pBackslash = wcschr(pNextField, '\\');
if (pBackslash == NULL) {
mir_tstrncpy(szThisField, pNextField, _countof(szThisField));
pNextField = NULL;
diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp
index 1e39d397c6..894ef43e35 100644
--- a/src/mir_app/src/clistmod.cpp
+++ b/src/mir_app/src/clistmod.cpp
@@ -53,54 +53,54 @@ struct ProtoIconIndex
OBJLIST<ProtoIconIndex> protoIconIndex(5);
-TCHAR* fnGetStatusModeDescription(int mode, int flags)
+wchar_t* fnGetStatusModeDescription(int mode, int flags)
{
- static TCHAR szMode[64];
- TCHAR* descr;
+ static wchar_t szMode[64];
+ wchar_t* descr;
int noPrefixReqd = 0;
switch (mode) {
case ID_STATUS_OFFLINE:
- descr = LPGENT("Offline");
+ descr = LPGENW("Offline");
noPrefixReqd = 1;
break;
case ID_STATUS_CONNECTING:
- descr = LPGENT("Connecting");
+ descr = LPGENW("Connecting");
noPrefixReqd = 1;
break;
case ID_STATUS_ONLINE:
- descr = LPGENT("Online");
+ descr = LPGENW("Online");
noPrefixReqd = 1;
break;
case ID_STATUS_AWAY:
- descr = LPGENT("Away");
+ descr = LPGENW("Away");
break;
case ID_STATUS_DND:
- descr = LPGENT("Do not disturb");
+ descr = LPGENW("Do not disturb");
break;
case ID_STATUS_NA:
- descr = LPGENT("Not available");
+ descr = LPGENW("Not available");
break;
case ID_STATUS_OCCUPIED:
- descr = LPGENT("Occupied");
+ descr = LPGENW("Occupied");
break;
case ID_STATUS_FREECHAT:
- descr = LPGENT("Free for chat");
+ descr = LPGENW("Free for chat");
break;
case ID_STATUS_INVISIBLE:
- descr = LPGENT("Invisible");
+ descr = LPGENW("Invisible");
break;
case ID_STATUS_OUTTOLUNCH:
- descr = LPGENT("Out to lunch");
+ descr = LPGENW("Out to lunch");
break;
case ID_STATUS_ONTHEPHONE:
- descr = LPGENT("On the phone");
+ descr = LPGENW("On the phone");
break;
case ID_STATUS_IDLE:
- descr = LPGENT("Idle");
+ descr = LPGENW("Idle");
break;
default:
if (IsStatusConnecting(mode)) {
- const TCHAR* connFmt = LPGENT("Connecting (attempt %d)");
+ const wchar_t* connFmt = LPGENW("Connecting (attempt %d)");
mir_sntprintf(szMode, (flags & GSMDF_UNTRANSLATED) ? connFmt : TranslateTS(connFmt), mode - ID_STATUS_CONNECTING + 1);
return szMode;
}
diff --git a/src/mir_app/src/clistsettings.cpp b/src/mir_app/src/clistsettings.cpp
index 1732c9943a..2130672307 100644
--- a/src/mir_app/src/clistsettings.cpp
+++ b/src/mir_app/src/clistsettings.cpp
@@ -100,7 +100,7 @@ void fnInvalidateDisplayNameCacheEntry(MCONTACT hContact)
}
}
-TCHAR* fnGetContactDisplayName(MCONTACT hContact, int mode)
+wchar_t* fnGetContactDisplayName(MCONTACT hContact, int mode)
{
if (hContact == NULL)
return TranslateT("(Unknown contact)");
@@ -123,7 +123,7 @@ TCHAR* fnGetContactDisplayName(MCONTACT hContact, int mode)
ProtoChainSend(hContact, PSS_GETINFO, SGIF_MINIMAL, 0);
- TCHAR *buffer = TranslateT("(Unknown contact)");
+ wchar_t *buffer = TranslateT("(Unknown contact)");
return (cacheEntry == NULL) ? mir_tstrdup(buffer) : buffer;
}
@@ -146,7 +146,7 @@ int ContactDeleted(WPARAM hContact, LPARAM)
/////////////////////////////////////////////////////////////////////////////////////////
-static void Dbwcs2tstr(DBCONTACTWRITESETTING *cws, TCHAR* &pStr)
+static void Dbwcs2tstr(DBCONTACTWRITESETTING *cws, wchar_t* &pStr)
{
mir_free(pStr);
diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp
index abb54f5c9b..dd6ea4cc32 100644
--- a/src/mir_app/src/clisttray.cpp
+++ b/src/mir_app/src/clisttray.cpp
@@ -44,10 +44,10 @@ static bool hasTips()
static bool fTrayInited;
-static TCHAR* sttGetXStatus(const char *szProto)
+static wchar_t* sttGetXStatus(const char *szProto)
{
if (CallProtoServiceInt(NULL, szProto, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE) {
- TCHAR tszStatus[512];
+ wchar_t tszStatus[512];
CUSTOM_STATUS cs = { sizeof(cs) };
cs.flags = CSSF_MASK_MESSAGE | CSSF_TCHAR;
cs.ptszMessage = tszStatus;
@@ -59,7 +59,7 @@ static TCHAR* sttGetXStatus(const char *szProto)
}
static HICON lastTaskBarIcon;
-static void SetTaskBarIcon(const HICON hIcon, const TCHAR *szNewTip)
+static void SetTaskBarIcon(const HICON hIcon, const wchar_t *szNewTip)
{
if (pTaskbarInterface) {
pTaskbarInterface->SetOverlayIcon(cli.hwndContactList, hIcon, szNewTip);
@@ -67,12 +67,12 @@ static void SetTaskBarIcon(const HICON hIcon, const TCHAR *szNewTip)
}
}
-TCHAR* fnTrayIconMakeTooltip(const TCHAR *szPrefix, const char *szProto)
+wchar_t* fnTrayIconMakeTooltip(const wchar_t *szPrefix, const char *szProto)
{
initcheck NULL;
mir_cslock lck(trayLockCS);
- TCHAR *szSeparator = L"\n";
+ wchar_t *szSeparator = L"\n";
if (szProto == NULL) {
if (accounts.getCount() == 0)
@@ -85,7 +85,7 @@ TCHAR* fnTrayIconMakeTooltip(const TCHAR *szPrefix, const char *szProto)
if (szPrefix && szPrefix[0]) {
if (!db_get_b(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT)) {
- _tcsncpy_s(cli.szTip, MAX_TIP_SIZE, szPrefix, _TRUNCATE);
+ wcsncpy_s(cli.szTip, MAX_TIP_SIZE, szPrefix, _TRUNCATE);
return cli.szTip;
}
tszTip.Append(szPrefix);
@@ -100,7 +100,7 @@ TCHAR* fnTrayIconMakeTooltip(const TCHAR *szPrefix, const char *szProto)
if (!cli.pfnGetProtocolVisibility(pa->szModuleName))
continue;
- TCHAR *szStatus = cli.pfnGetStatusModeDescription(CallProtoServiceInt(NULL, pa->szModuleName, PS_GETSTATUS, 0, 0), 0);
+ wchar_t *szStatus = cli.pfnGetStatusModeDescription(CallProtoServiceInt(NULL, pa->szModuleName, PS_GETSTATUS, 0, 0), 0);
if (!szStatus)
continue;
@@ -119,13 +119,13 @@ TCHAR* fnTrayIconMakeTooltip(const TCHAR *szPrefix, const char *szProto)
else tszTip.AppendFormat(L"%s %s", pa->tszAccountName, szStatus);
}
- _tcsncpy_s(cli.szTip, MAX_TIP_SIZE, tszTip, _TRUNCATE);
+ wcsncpy_s(cli.szTip, MAX_TIP_SIZE, tszTip, _TRUNCATE);
}
else {
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
if (pa != NULL) {
ptrT ProtoXStatus(sttGetXStatus(szProto));
- TCHAR *szStatus = cli.pfnGetStatusModeDescription(CallProtoServiceInt(NULL, szProto, PS_GETSTATUS, 0, 0), 0);
+ wchar_t *szStatus = cli.pfnGetStatusModeDescription(CallProtoServiceInt(NULL, szProto, PS_GETSTATUS, 0, 0), 0);
if (szPrefix && szPrefix[0]) {
if (db_get_b(NULL, "CList", "AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT)) {
if (hasTips()) {
@@ -314,7 +314,7 @@ static VOID CALLBACK RefreshTimerProc(HWND, UINT, UINT_PTR, DWORD)
cli.pfnTrayIconUpdateBase(accounts[i]->szModuleName);
}
-int fnTrayIconUpdate(HICON hNewIcon, const TCHAR *szNewTip, const char *szPreferredProto, int isBase)
+int fnTrayIconUpdate(HICON hNewIcon, const wchar_t *szNewTip, const char *szPreferredProto, int isBase)
{
initcheck - 1;
mir_cslock lck(trayLockCS);
@@ -426,7 +426,7 @@ int fnTrayIconSetBaseInfo(HICON hIcon, const char *szPreferredProto)
goto LBL_Error;
}
-void fnTrayIconUpdateWithImageList(int iImage, const TCHAR *szNewTip, char *szPreferredProto)
+void fnTrayIconUpdateWithImageList(int iImage, const wchar_t *szNewTip, char *szPreferredProto)
{
HICON hIcon = ImageList_GetIcon(hCListImages, iImage, ILD_NORMAL);
cli.pfnTrayIconUpdate(hIcon, szNewTip, szPreferredProto, 0);
@@ -616,7 +616,7 @@ static void CALLBACK TrayToolTipTimerProc(HWND hwnd, UINT, UINT_PTR id, DWORD)
POINT pt;
GetCursorPos(&pt);
if (abs(pt.x - tray_hover_pos.x) <= TOOLTIP_TOLERANCE && abs(pt.y - tray_hover_pos.y) <= TOOLTIP_TOLERANCE) {
- TCHAR* szTipCur = cli.szTip;
+ wchar_t* szTipCur = cli.szTip;
{
int n = s_LastHoverIconID - 100;
if (n >= 0 && n < cli.trayIconCount)
diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp
index 3ba4cbc915..717849c38e 100644
--- a/src/mir_app/src/clui.cpp
+++ b/src/mir_app/src/clui.cpp
@@ -89,10 +89,10 @@ static HGENMENU hRenameMenuItem;
static int MenuItem_PreBuild(WPARAM, LPARAM)
{
- TCHAR cls[128];
+ wchar_t cls[128];
HWND hwndClist = GetFocus();
GetClassName(hwndClist, cls, _countof(cls));
- hwndClist = (!mir_tstrcmp(_T(CLISTCONTROL_CLASS), cls)) ? hwndClist : cli.hwndContactList;
+ hwndClist = (!mir_tstrcmp(CLISTCONTROL_CLASSW, cls)) ? hwndClist : cli.hwndContactList;
HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_GETSELECTION, 0, 0);
Menu_ShowItem(hRenameMenuItem, hItem != 0);
return 0;
@@ -100,11 +100,11 @@ static int MenuItem_PreBuild(WPARAM, LPARAM)
static INT_PTR MenuItem_RenameContact(WPARAM, LPARAM)
{
- TCHAR cls[128];
+ wchar_t cls[128];
HWND hwndClist = GetFocus();
GetClassName(hwndClist, cls, _countof(cls));
// worst case scenario, the rename is sent to the main contact list
- hwndClist = (!mir_tstrcmp(_T(CLISTCONTROL_CLASS), cls)) ? hwndClist : cli.hwndContactList;
+ hwndClist = (!mir_tstrcmp(CLISTCONTROL_CLASSW, cls)) ? hwndClist : cli.hwndContactList;
HANDLE hItem = (HANDLE)SendMessage(hwndClist, CLM_GETSELECTION, 0, 0);
if (hItem) {
SetFocus(hwndClist);
@@ -125,7 +125,7 @@ static INT_PTR CALLBACK AskForConfirmationDlgProc(HWND hWnd, UINT msg, WPARAM wP
lf.lfWeight = FW_BOLD;
SendDlgItemMessage(hWnd, IDC_TOPLINE, WM_SETFONT, (WPARAM)CreateFontIndirect(&lf), 0);
- TCHAR szFormat[256], szFinal[256];
+ wchar_t szFormat[256], szFinal[256];
GetDlgItemText(hWnd, IDC_TOPLINE, szFormat, _countof(szFormat));
mir_sntprintf(szFinal, szFormat, cli.pfnGetContactDisplayName(lParam, 0));
SetDlgItemText(hWnd, IDC_TOPLINE, szFinal);
@@ -240,7 +240,7 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l
int LoadCLUIModule(void)
{
DBVARIANT dbv;
- TCHAR titleText[256];
+ wchar_t titleText[256];
uMsgProcessProfile = RegisterWindowMessage(L"Miranda::ProcessProfile");
cli.pfnLoadCluiGlobalOpts();
@@ -259,7 +259,7 @@ int LoadCLUIModule(void)
wndclass.cbWndExtra = sizeof(void *);
wndclass.hInstance = cli.hInst;
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
- wndclass.lpszClassName = _T(CLISTCONTROL_CLASS);
+ wndclass.lpszClassName = CLISTCONTROL_CLASSW;
RegisterClassEx(&wndclass);
memset(&wndclass, 0, sizeof(wndclass));
@@ -410,7 +410,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
static int noRecurse = 0;
if (msg == uMsgProcessProfile) {
- TCHAR profile[MAX_PATH];
+ wchar_t profile[MAX_PATH];
if (GlobalGetAtomName((ATOM)wParam, profile, _countof(profile))) {
int rc = mir_tstrcmpi(profile, VARST(L"%miranda_userdata%\\%miranda_profilename%.dat")) == 0;
ReplyMessage(rc);
@@ -460,7 +460,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
return FALSE;
case M_CREATECLC:
- cli.hwndContactTree = CreateWindow(_T(CLISTCONTROL_CLASS), L"",
+ cli.hwndContactTree = CreateWindow(CLISTCONTROL_CLASSW, L"",
WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN
| CLS_CONTACTLIST
| (db_get_b(NULL, "CList", "UseGroups", SETTING_USEGROUPS_DEFAULT) ? CLS_USEGROUPS : 0)
@@ -764,7 +764,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
NMCLISTCONTROL *nmc = (NMCLISTCONTROL*)lParam;
switch (((LPNMHDR)lParam)->code) {
case CLN_EXPANDED:
- Clist_GroupSetExpanded((MGROUP)nmc->hItem, nmc->action);
+ Clist_GroupSetExpanded(UINT_PTR(nmc->hItem), nmc->action);
return FALSE;
case CLN_DRAGGING:
@@ -992,7 +992,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
x += 2;
if (showOpts & 2) {
PROTOACCOUNT *pa;
- TCHAR tszName[64];
+ wchar_t tszName[64];
if ((pa = Proto_GetAccount(szProto)) != NULL)
mir_sntprintf(tszName, L"%s ", pa->tszAccountName);
else
@@ -1003,7 +1003,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
x += textSize.cx;
}
if (showOpts & 4) {
- TCHAR* szStatus = cli.pfnGetStatusModeDescription(status, 0);
+ wchar_t* szStatus = cli.pfnGetStatusModeDescription(status, 0);
if (!szStatus)
szStatus = L"";
GetTextExtentPoint32(dis->hDC, szStatus, (int)mir_tstrlen(szStatus), &textSize);
diff --git a/src/mir_app/src/cluiservices.cpp b/src/mir_app/src/cluiservices.cpp
index 8163c22124..148a9bd5e7 100644
--- a/src/mir_app/src/cluiservices.cpp
+++ b/src/mir_app/src/cluiservices.cpp
@@ -30,9 +30,9 @@ EXTERN_C MIR_APP_DLL(void) Clist_GroupAdded(MGROUP hGroup)
// CLC does this automatically unless it's a new group
HWND hwndFocus = GetFocus();
- TCHAR szFocusClass[64];
+ wchar_t szFocusClass[64];
GetClassName(hwndFocus, szFocusClass, _countof(szFocusClass));
- if (!mir_tstrcmp(szFocusClass, _T(CLISTCONTROL_CLASS))) {
+ if (!mir_tstrcmp(szFocusClass, CLISTCONTROL_CLASSW)) {
HANDLE hItem = (HANDLE)SendMessage(hwndFocus, CLM_FINDGROUP, hGroup, 0);
if (hItem)
SendMessage(hwndFocus, CLM_EDITLABEL, (WPARAM)hItem, 0);
@@ -111,7 +111,7 @@ void fnCluiProtocolStatusChanged(int, const char*)
if (showOpts & 1)
x += g_IconWidth;
if (showOpts & 2) {
- TCHAR tszName[64];
+ wchar_t tszName[64];
PROTOACCOUNT *pa = Proto_GetAccount(cli.menuProtos[i].szProto);
if (pa)
mir_sntprintf(tszName, L"%s ", pa->tszAccountName);
@@ -125,7 +125,7 @@ void fnCluiProtocolStatusChanged(int, const char*)
x += GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
}
if (showOpts & 4) {
- TCHAR* modeDescr = cli.pfnGetStatusModeDescription(CallProtoServiceInt(NULL, cli.menuProtos[i].szProto, PS_GETSTATUS, 0, 0), 0);
+ wchar_t* modeDescr = cli.pfnGetStatusModeDescription(CallProtoServiceInt(NULL, cli.menuProtos[i].szProto, PS_GETSTATUS, 0, 0), 0);
GetTextExtentPoint32(hdc, modeDescr, (int)mir_tstrlen(modeDescr), &textSize);
x += textSize.cx;
x += GetSystemMetrics(SM_CXBORDER) * 4; // The SB panel doesnt allocate enough room
diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp
index 5e6a6bc52b..07d319dd2d 100644
--- a/src/mir_app/src/contacts.cpp
+++ b/src/mir_app/src/contacts.cpp
@@ -25,17 +25,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
#define NAMEORDERCOUNT 9
-static TCHAR* nameOrderDescr[ NAMEORDERCOUNT ] =
+static wchar_t* nameOrderDescr[ NAMEORDERCOUNT ] =
{
- LPGENT("My custom name (not movable)"),
- LPGENT("Nick"),
- LPGENT("FirstName"),
- LPGENT("E-mail"),
- LPGENT("LastName"),
- LPGENT("Username"),
- LPGENT("FirstName LastName"),
- LPGENT("LastName FirstName"),
- LPGENT("'(Unknown contact)' (not movable)")
+ LPGENW("My custom name (not movable)"),
+ LPGENW("Nick"),
+ LPGENW("FirstName"),
+ LPGENW("E-mail"),
+ LPGENW("LastName"),
+ LPGENW("Username"),
+ LPGENW("FirstName LastName"),
+ LPGENW("LastName FirstName"),
+ LPGENW("'(Unknown contact)' (not movable)")
};
BYTE nameOrder[NAMEORDERCOUNT];
@@ -54,7 +54,7 @@ static int GetDatabaseString(MCONTACT hContact, const char *szProto, const char
return db_get_ws(hContact, szProto, szSetting, dbv);
}
-static TCHAR* ProcessDatabaseValueDefault(MCONTACT hContact, const char *szProto, const char *szSetting)
+static wchar_t* ProcessDatabaseValueDefault(MCONTACT hContact, const char *szProto, const char *szSetting)
{
DBVARIANT dbv;
if (!GetDatabaseString(hContact, szProto, szSetting, &dbv)) {
@@ -71,21 +71,21 @@ static TCHAR* ProcessDatabaseValueDefault(MCONTACT hContact, const char *szProto
if (db_get(hContact, szProto, szSetting, &dbv))
return NULL;
- TCHAR buf[40];
+ wchar_t buf[40];
switch (dbv.type) {
case DBVT_BYTE:
- return mir_tstrdup(_itot(dbv.bVal, buf, 10));
+ return mir_tstrdup(_itow(dbv.bVal, buf, 10));
case DBVT_WORD:
- return mir_tstrdup(_itot(dbv.wVal, buf, 10));
+ return mir_tstrdup(_itow(dbv.wVal, buf, 10));
case DBVT_DWORD:
- return mir_tstrdup(_itot(dbv.dVal, buf, 10));
+ return mir_tstrdup(_itow(dbv.dVal, buf, 10));
}
db_free(&dbv);
return NULL;
}
-MIR_APP_DLL(TCHAR*) Contact_GetInfo(int type, MCONTACT hContact, const char *szProto)
+MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *szProto)
{
if (hContact == NULL && szProto == NULL)
return NULL;
@@ -96,7 +96,7 @@ MIR_APP_DLL(TCHAR*) Contact_GetInfo(int type, MCONTACT hContact, const char *szP
return NULL;
char *uid;
- TCHAR *res;
+ wchar_t *res;
DBVARIANT dbv;
switch (type) {
case CNF_FIRSTNAME: return ProcessDatabaseValueDefault(hContact, szProto, "FirstName");
@@ -179,8 +179,8 @@ MIR_APP_DLL(TCHAR*) Contact_GetInfo(int type, MCONTACT hContact, const char *szP
case CNF_UNIQUEID:
if (db_mc_isMeta(hContact)) {
- TCHAR buf[40];
- _itot(hContact, buf, 10);
+ wchar_t buf[40];
+ _itow(hContact, buf, 10);
return mir_tstrdup(buf);
}
diff --git a/src/mir_app/src/database.cpp b/src/mir_app/src/database.cpp
index 6fa2ae5bf0..a0a9257b87 100644
--- a/src/mir_app/src/database.cpp
+++ b/src/mir_app/src/database.cpp
@@ -27,52 +27,52 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// contains the location of mirandaboot.ini
bool g_bDbCreated;
-TCHAR g_profileDir[MAX_PATH], g_profileName[MAX_PATH], g_shortProfileName[MAX_PATH];
-TCHAR* g_defaultProfile;
+wchar_t g_profileDir[MAX_PATH], g_profileName[MAX_PATH], g_shortProfileName[MAX_PATH];
+wchar_t* g_defaultProfile;
void EnsureCheckerLoaded(bool);
void LoadDatabaseServices();
-bool fileExist(const TCHAR *fname)
+bool fileExist(const wchar_t *fname)
{
if (*fname == 0)
return false;
- FILE *fp = _tfopen(fname, L"r+");
+ FILE *fp = _wfopen(fname, L"r+");
bool res = (fp != NULL);
if (fp) fclose(fp);
return res;
}
-static void fillProfileName(const TCHAR* ptszFileName)
+static void fillProfileName(const wchar_t* ptszFileName)
{
- const TCHAR* p = _tcsrchr(ptszFileName, '\\');
+ const wchar_t* p = wcsrchr(ptszFileName, '\\');
if (p == NULL)
p = ptszFileName;
else
p++;
- _tcsncpy_s(g_profileName, p, _TRUNCATE);
+ wcsncpy_s(g_profileName, p, _TRUNCATE);
- _tcsncpy_s(g_shortProfileName, p, _TRUNCATE);
- TCHAR *pos = _tcsrchr(g_shortProfileName, '.');
+ wcsncpy_s(g_shortProfileName, p, _TRUNCATE);
+ wchar_t *pos = wcsrchr(g_shortProfileName, '.');
if (mir_tstrcmpi(pos, L".dat") == 0)
*pos = 0;
}
-bool IsInsideRootDir(TCHAR* profiledir, bool exact)
+bool IsInsideRootDir(wchar_t* profiledir, bool exact)
{
VARST pfd(L"%miranda_path%");
if (exact)
return mir_tstrcmpi(profiledir, pfd) == 0;
- return _tcsnicmp(profiledir, pfd, mir_tstrlen(pfd)) == 0;
+ return wcsnicmp(profiledir, pfd, mir_tstrlen(pfd)) == 0;
}
// returns 1 if the profile path was returned, without trailing slash
-int getProfilePath(TCHAR *buf, size_t)
+int getProfilePath(wchar_t *buf, size_t)
{
- TCHAR profiledir[MAX_PATH];
+ wchar_t profiledir[MAX_PATH];
GetPrivateProfileString(L"Database", L"ProfileDir", L"", profiledir, _countof(profiledir), mirandabootini);
if (profiledir[0] == 0)
@@ -87,7 +87,7 @@ int getProfilePath(TCHAR *buf, size_t)
}
// returns 1 if *.dat spec is matched
-int isValidProfileName(const TCHAR *name)
+int isValidProfileName(const wchar_t *name)
{
size_t len = mir_tstrlen(name) - 4;
return len > 0 && mir_tstrcmpi(&name[len], L".dat") == 0;
@@ -96,7 +96,7 @@ int isValidProfileName(const TCHAR *name)
// returns 1 if the profile manager should be shown
static bool showProfileManager(void)
{
- TCHAR Mgr[32];
+ wchar_t Mgr[32];
// is control pressed?
if (GetAsyncKeyState(VK_CONTROL) & 0x8000)
return 1;
@@ -106,19 +106,19 @@ static bool showProfileManager(void)
return (mir_tstrcmpi(Mgr, L"yes") == 0);
}
-bool shouldAutoCreate(TCHAR *szProfile)
+bool shouldAutoCreate(wchar_t *szProfile)
{
if (szProfile[0] == 0)
return false;
- TCHAR ac[32];
+ wchar_t ac[32];
GetPrivateProfileString(L"Database", L"AutoCreate", L"", ac, _countof(ac), mirandabootini);
return mir_tstrcmpi(ac, L"yes") == 0;
}
-static void getDefaultProfile(TCHAR *szProfile, size_t cch)
+static void getDefaultProfile(wchar_t *szProfile, size_t cch)
{
- TCHAR defaultProfile[MAX_PATH];
+ wchar_t defaultProfile[MAX_PATH];
GetPrivateProfileString(L"Database", L"DefaultProfile", L"", defaultProfile, _countof(defaultProfile), mirandabootini);
if (defaultProfile[0] == 0)
@@ -126,37 +126,37 @@ static void getDefaultProfile(TCHAR *szProfile, size_t cch)
VARST res(defaultProfile);
if (res)
- mir_sntprintf(szProfile, cch, L"%s\\%s\\%s%s", g_profileDir, (TCHAR*)res, (TCHAR*)res, isValidProfileName(res) ? L"" : L".dat");
+ mir_sntprintf(szProfile, cch, L"%s\\%s\\%s%s", g_profileDir, (wchar_t*)res, (wchar_t*)res, isValidProfileName(res) ? L"" : L".dat");
else
szProfile[0] = 0;
}
// returns 1 if something that looks like a profile is there
-static void loadProfileByShortName(const TCHAR* src, TCHAR *szProfile, size_t cch)
+static void loadProfileByShortName(const wchar_t* src, wchar_t *szProfile, size_t cch)
{
- TCHAR buf[MAX_PATH];
- _tcsncpy_s(buf, src, _TRUNCATE);
+ wchar_t buf[MAX_PATH];
+ wcsncpy_s(buf, src, _TRUNCATE);
- TCHAR *p = _tcsrchr(buf, '\\'); if (p) ++p; else p = buf;
+ wchar_t *p = wcsrchr(buf, '\\'); if (p) ++p; else p = buf;
if (!isValidProfileName(buf) && *p)
mir_tstrcat(buf, L".dat");
- TCHAR profileName[MAX_PATH], newProfileDir[MAX_PATH];
- _tcsncpy_s(profileName, p, _TRUNCATE);
+ wchar_t profileName[MAX_PATH], newProfileDir[MAX_PATH];
+ wcsncpy_s(profileName, p, _TRUNCATE);
if (!isValidProfileName(profileName) && *p)
mir_tstrcat(profileName, L".dat");
- _tcsncpy_s(profileName, p, _TRUNCATE);
- p = _tcsrchr(profileName, '.'); if (p) *p = 0;
+ wcsncpy_s(profileName, p, _TRUNCATE);
+ p = wcsrchr(profileName, '.'); if (p) *p = 0;
mir_sntprintf(newProfileDir, cch, L"%s\\%s\\", g_profileDir, profileName);
PathToAbsoluteT(buf, szProfile, newProfileDir);
- if (_tcschr(buf, '\\')) {
- _tcsncpy_s(g_profileDir, szProfile, _TRUNCATE);
+ if (wcschr(buf, '\\')) {
+ wcsncpy_s(g_profileDir, szProfile, _TRUNCATE);
if (profileName[0]) {
- p = _tcsrchr(g_profileDir, '\\'); *p = 0;
- p = _tcsrchr(g_profileDir, '\\');
+ p = wcsrchr(g_profileDir, '\\'); *p = 0;
+ p = wcsrchr(g_profileDir, '\\');
if (p && mir_tstrcmpi(p + 1, profileName) == 0)
*p = 0;
}
@@ -164,14 +164,14 @@ static void loadProfileByShortName(const TCHAR* src, TCHAR *szProfile, size_t cc
}
}
-void getProfileCmdLine(TCHAR *szProfile, size_t cch)
+void getProfileCmdLine(wchar_t *szProfile, size_t cch)
{
LPCTSTR ptszProfileName = CmdLine_GetOption(L"profile");
if (ptszProfileName != NULL)
loadProfileByShortName(ptszProfileName, szProfile, cch);
}
-void getProfileDefault(TCHAR *szProfile, size_t cch)
+void getProfileDefault(wchar_t *szProfile, size_t cch)
{
if (g_defaultProfile != NULL) {
loadProfileByShortName(g_defaultProfile, szProfile, cch);
@@ -180,35 +180,35 @@ void getProfileDefault(TCHAR *szProfile, size_t cch)
}
// move profile from profile subdir
-static void moveProfileDirProfiles(TCHAR *profiledir, BOOL isRootDir = TRUE)
+static void moveProfileDirProfiles(wchar_t *profiledir, BOOL isRootDir = TRUE)
{
- TCHAR pfd[MAX_PATH];
+ wchar_t pfd[MAX_PATH];
if (isRootDir)
- _tcsncpy_s(pfd, VARST(L"%miranda_path%\\*.dat"), _TRUNCATE);
+ wcsncpy_s(pfd, VARST(L"%miranda_path%\\*.dat"), _TRUNCATE);
else
mir_sntprintf(pfd, L"%s\\*.dat", profiledir);
WIN32_FIND_DATA ffd;
HANDLE hFind = FindFirstFile(pfd, &ffd);
if (hFind != INVALID_HANDLE_VALUE) {
- TCHAR *c = _tcsrchr(pfd, '\\'); if (c) *c = 0;
+ wchar_t *c = wcsrchr(pfd, '\\'); if (c) *c = 0;
do {
- TCHAR path[MAX_PATH], path2[MAX_PATH];
- TCHAR* profile = mir_tstrdup(ffd.cFileName);
- c = _tcsrchr(profile, '.'); if (c) *c = 0;
+ wchar_t path[MAX_PATH], path2[MAX_PATH];
+ wchar_t* profile = mir_tstrdup(ffd.cFileName);
+ c = wcsrchr(profile, '.'); if (c) *c = 0;
mir_sntprintf(path, L"%s\\%s", pfd, ffd.cFileName);
mir_sntprintf(path2, L"%s\\%s", profiledir, profile);
CreateDirectoryTreeT(path2);
mir_sntprintf(path2, L"%s\\%s\\%s", profiledir, profile, ffd.cFileName);
- if (_taccess(path2, 0) == 0) {
- TCHAR buf[512];
+ if (_waccess(path2, 0) == 0) {
+ wchar_t buf[512];
mir_sntprintf(buf,
TranslateT("Miranda is trying to upgrade your profile structure.\nIt cannot move profile %s to the new location %s\nBecause profile with this name already exists. Please resolve the issue manually."),
path, path2);
MessageBox(NULL, buf, L"Miranda NG", MB_ICONERROR | MB_OK);
}
else if (MoveFile(path, path2) == 0) {
- TCHAR buf[512];
+ wchar_t buf[512];
mir_sntprintf(buf,
TranslateT("Miranda is trying to upgrade your profile structure.\nIt cannot move profile %s to the new location %s automatically\nMost likely this is due to insufficient privileges. Please move profile manually."),
path, path2);
@@ -223,7 +223,7 @@ static void moveProfileDirProfiles(TCHAR *profiledir, BOOL isRootDir = TRUE)
}
// returns 1 if a single profile (full path) is found within the profile dir
-static int getProfile1(TCHAR *szProfile, size_t cch, TCHAR *profiledir, BOOL * noProfiles)
+static int getProfile1(wchar_t *szProfile, size_t cch, wchar_t *profiledir, BOOL * noProfiles)
{
int found = 0;
@@ -232,14 +232,14 @@ static int getProfile1(TCHAR *szProfile, size_t cch, TCHAR *profiledir, BOOL * n
moveProfileDirProfiles(profiledir, FALSE);
bool bNoDefaultProfile = (*szProfile == 0);
- bool reqfd = !bNoDefaultProfile && (_taccess(szProfile, 0) == 0 || shouldAutoCreate(szProfile));
+ bool reqfd = !bNoDefaultProfile && (_waccess(szProfile, 0) == 0 || shouldAutoCreate(szProfile));
bool bShowProfileManager = showProfileManager();
if (reqfd)
found++;
if (bShowProfileManager || !reqfd) {
- TCHAR searchspec[MAX_PATH];
+ wchar_t searchspec[MAX_PATH];
mir_sntprintf(searchspec, L"%s\\*.*", profiledir);
WIN32_FIND_DATA ffd;
@@ -250,16 +250,16 @@ static int getProfile1(TCHAR *szProfile, size_t cch, TCHAR *profiledir, BOOL * n
if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) || !mir_tstrcmp(ffd.cFileName, L".") || !mir_tstrcmp(ffd.cFileName, L".."))
continue;
- TCHAR newProfile[MAX_PATH];
+ wchar_t newProfile[MAX_PATH];
mir_sntprintf(newProfile, L"%s\\%s\\%s.dat", profiledir, ffd.cFileName, ffd.cFileName);
- if (_taccess(newProfile, 0) != 0)
+ if (_waccess(newProfile, 0) != 0)
continue;
switch (touchDatabase(newProfile, NULL)) {
case 0:
case EGROKPRF_OBSOLETE:
if (++found == 1 && bNoDefaultProfile)
- _tcsncpy_s(szProfile, cch, newProfile, _TRUNCATE);
+ wcsncpy_s(szProfile, cch, newProfile, _TRUNCATE);
break;
}
} while (FindNextFile(hFind, &ffd));
@@ -279,12 +279,12 @@ static int getProfile1(TCHAR *szProfile, size_t cch, TCHAR *profiledir, BOOL * n
}
// returns 1 if a default profile should be selected instead of showing the manager.
-static int getProfileAutoRun(TCHAR *szProfile)
+static int getProfileAutoRun(wchar_t *szProfile)
{
if (*szProfile == 0)
return false;
- TCHAR Mgr[32];
+ wchar_t Mgr[32];
GetPrivateProfileString(L"Database", L"ShowProfileMgr", L"", Mgr, _countof(Mgr), mirandabootini);
if (mir_tstrcmpi(Mgr, L"never"))
return 0;
@@ -293,7 +293,7 @@ static int getProfileAutoRun(TCHAR *szProfile)
}
// returns 1 if a profile was selected
-static int getProfile(TCHAR *szProfile, size_t cch)
+static int getProfile(wchar_t *szProfile, size_t cch)
{
getProfilePath(g_profileDir, _countof(g_profileDir));
if (IsInsideRootDir(g_profileDir, true))
@@ -307,7 +307,7 @@ static int getProfile(TCHAR *szProfile, size_t cch)
if (IsInsideRootDir(g_profileDir, true)) {
MessageBox(NULL,
TranslateT("Profile cannot be placed into Miranda root folder.\nPlease move Miranda profile to some other location."),
- LPGENT("Miranda NG"), MB_ICONERROR | MB_OK);
+ LPGENW("Miranda NG"), MB_ICONERROR | MB_OK);
return 0;
}
@@ -334,14 +334,14 @@ LBL_Show:
goto LBL_Show;
}
-// carefully converts a file name from TCHAR* to char*
-char* makeFileName(const TCHAR* tszOriginalName)
+// carefully converts a file name from wchar_t* to char*
+char* makeFileName(const wchar_t* tszOriginalName)
{
char *szResult = NULL;
char *szFileName = mir_t2a(tszOriginalName);
- TCHAR *tszFileName = mir_a2t(szFileName);
+ wchar_t *tszFileName = mir_a2t(szFileName);
if (mir_tstrcmp(tszOriginalName, tszFileName)) {
- TCHAR tszProfile[MAX_PATH];
+ wchar_t tszProfile[MAX_PATH];
if (GetShortPathName(tszOriginalName, tszProfile, MAX_PATH) != 0)
szResult = mir_t2a(tszProfile);
}
@@ -355,7 +355,7 @@ char* makeFileName(const TCHAR* tszOriginalName)
return szResult;
}
-int touchDatabase(const TCHAR *tszProfile, DATABASELINK **dblink)
+int touchDatabase(const wchar_t *tszProfile, DATABASELINK **dblink)
{
for (int i = arDbPlugins.getCount() - 1; i >= 0; i--) {
DATABASELINK *p = arDbPlugins[i];
@@ -378,7 +378,7 @@ int touchDatabase(const TCHAR *tszProfile, DATABASELINK **dblink)
}
// enumerate all plugins that had valid DatabasePluginInfo()
-int tryOpenDatabase(const TCHAR *tszProfile)
+int tryOpenDatabase(const wchar_t *tszProfile)
{
for (int i = arDbPlugins.getCount() - 1; i >= 0; i--) {
DATABASELINK *p = arDbPlugins[i];
@@ -417,9 +417,9 @@ int tryOpenDatabase(const TCHAR *tszProfile)
}
// enumerate all plugins that had valid DatabasePluginInfo()
-static int tryCreateDatabase(const TCHAR *ptszProfile)
+static int tryCreateDatabase(const wchar_t *ptszProfile)
{
- TCHAR *tszProfile = NEWTSTR_ALLOCA(ptszProfile);
+ wchar_t *tszProfile = NEWWSTR_ALLOCA(ptszProfile);
CreatePathToFileT(tszProfile);
for (int i = 0; i < arDbPlugins.getCount(); i++) {
@@ -443,7 +443,7 @@ static int tryCreateDatabase(const TCHAR *ptszProfile)
typedef struct
{
- TCHAR *profile;
+ wchar_t *profile;
UINT msg;
ATOM aPath;
int found;
@@ -451,7 +451,7 @@ typedef struct
static BOOL CALLBACK EnumMirandaWindows(HWND hwnd, LPARAM lParam)
{
- TCHAR classname[256];
+ wchar_t classname[256];
ENUMMIRANDAWINDOW *x = (ENUMMIRANDAWINDOW *)lParam;
DWORD_PTR res = 0;
if (GetClassName(hwnd, classname, _countof(classname)) && mir_tstrcmp(L"Miranda", classname) == 0) {
@@ -463,7 +463,7 @@ static BOOL CALLBACK EnumMirandaWindows(HWND hwnd, LPARAM lParam)
return TRUE;
}
-static int FindMirandaForProfile(TCHAR *szProfile)
+static int FindMirandaForProfile(wchar_t *szProfile)
{
ENUMMIRANDAWINDOW x = { 0 };
x.profile = szProfile;
@@ -474,14 +474,14 @@ static int FindMirandaForProfile(TCHAR *szProfile)
return x.found;
}
-static TCHAR tszNoDrivers[] = LPGENT("Miranda is unable to open '%s' because you do not have any profile plugins installed.\nYou need to install dbx_mmap.dll");
-static TCHAR tszUnknownFormat[] = LPGENT("Miranda was unable to open '%s', it's in an unknown format.\nThis profile might also be damaged, please run DbChecker which should be installed.");
-static TCHAR tszProfileLocked[] = LPGENT("Miranda was unable to open '%s'\nIt's inaccessible or used by other application or Miranda instance");
-static TCHAR tszNoSuitableDriver[] = LPGENT("Miranda was unable to open '%s'\nThere is no suitable database driver installed");
+static wchar_t tszNoDrivers[] = LPGENW("Miranda is unable to open '%s' because you do not have any profile plugins installed.\nYou need to install dbx_mmap.dll");
+static wchar_t tszUnknownFormat[] = LPGENW("Miranda was unable to open '%s', it's in an unknown format.\nThis profile might also be damaged, please run DbChecker which should be installed.");
+static wchar_t tszProfileLocked[] = LPGENW("Miranda was unable to open '%s'\nIt's inaccessible or used by other application or Miranda instance");
+static wchar_t tszNoSuitableDriver[] = LPGENW("Miranda was unable to open '%s'\nThere is no suitable database driver installed");
int LoadDatabaseModule(void)
{
- TCHAR szProfile[MAX_PATH];
+ wchar_t szProfile[MAX_PATH];
PathToAbsoluteT(L".", szProfile);
_tchdir(szProfile);
szProfile[0] = 0;
@@ -492,7 +492,7 @@ int LoadDatabaseModule(void)
if (!getProfile(szProfile, _countof(szProfile)))
return 1;
- TCHAR *ptszFileName = _tcsrchr(szProfile, '\\');
+ wchar_t *ptszFileName = wcsrchr(szProfile, '\\');
ptszFileName = (ptszFileName) ? ptszFileName + 1 : szProfile;
if (arDbPlugins.getCount() == 0) {
@@ -507,7 +507,7 @@ int LoadDatabaseModule(void)
int rc;
do {
retry = false;
- if (_taccess(szProfile, 0) && shouldAutoCreate(szProfile))
+ if (_waccess(szProfile, 0) && shouldAutoCreate(szProfile))
rc = tryCreateDatabase(szProfile);
else
rc = tryOpenDatabase(szProfile);
diff --git a/src/mir_app/src/dbini.cpp b/src/mir_app/src/dbini.cpp
index 855c624fce..77a42d8db6 100644
--- a/src/mir_app/src/dbini.cpp
+++ b/src/mir_app/src/dbini.cpp
@@ -33,18 +33,18 @@ static INT_PTR CALLBACK InstallIniDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
switch (message) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- SetDlgItemText(hwndDlg, IDC_ININAME, (TCHAR*)lParam);
+ SetDlgItemText(hwndDlg, IDC_ININAME, (wchar_t*)lParam);
{
- TCHAR szSecurity[11];
- const TCHAR *pszSecurityInfo;
+ wchar_t szSecurity[11];
+ const wchar_t *pszSecurityInfo;
GetPrivateProfileString(L"AutoExec", L"Warn", L"notsafe", szSecurity, _countof(szSecurity), mirandabootini);
if (!mir_tstrcmpi(szSecurity, L"all"))
- pszSecurityInfo = LPGENT("Security systems to prevent malicious changes are in place and you will be warned before every change that is made.");
+ pszSecurityInfo = LPGENW("Security systems to prevent malicious changes are in place and you will be warned before every change that is made.");
else if (!mir_tstrcmpi(szSecurity, L"onlyunsafe"))
- pszSecurityInfo = LPGENT("Security systems to prevent malicious changes are in place and you will be warned before changes that are known to be unsafe.");
+ pszSecurityInfo = LPGENW("Security systems to prevent malicious changes are in place and you will be warned before changes that are known to be unsafe.");
else if (!mir_tstrcmpi(szSecurity, L"none"))
- pszSecurityInfo = LPGENT("Security systems to prevent malicious changes have been disabled. You will receive no further warnings.");
+ pszSecurityInfo = LPGENW("Security systems to prevent malicious changes have been disabled. You will receive no further warnings.");
else pszSecurityInfo = NULL;
if (pszSecurityInfo) SetDlgItemText(hwndDlg, IDC_SECURITYINFO, TranslateTS(pszSecurityInfo));
}
@@ -54,7 +54,7 @@ static INT_PTR CALLBACK InstallIniDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
switch (LOWORD(wParam)) {
case IDC_VIEWINI:
{
- TCHAR szPath[MAX_PATH];
+ wchar_t szPath[MAX_PATH];
GetDlgItemText(hwndDlg, IDC_ININAME, szPath, _countof(szPath));
ShellExecute(hwndDlg, L"open", szPath, NULL, NULL, SW_SHOW);
}
@@ -90,7 +90,7 @@ static bool IsInSpaceSeparatedList(const char *szWord, const char *szList)
}
struct warnSettingChangeInfo_t {
- TCHAR *szIniPath;
+ wchar_t *szIniPath;
char *szSection;
char *szSafeSections;
char *szUnsafeSections;
@@ -107,7 +107,7 @@ static INT_PTR CALLBACK WarnIniChangeDlgProc(HWND hwndDlg, UINT message, WPARAM
case WM_INITDIALOG:
{
char szSettingName[256];
- const TCHAR *pszSecurityInfo;
+ const wchar_t *pszSecurityInfo;
warnInfo = (warnSettingChangeInfo_t*)lParam;
TranslateDialogDefault(hwndDlg);
SetDlgItemText(hwndDlg, IDC_ININAME, warnInfo->szIniPath);
@@ -117,11 +117,11 @@ static INT_PTR CALLBACK WarnIniChangeDlgProc(HWND hwndDlg, UINT message, WPARAM
SetDlgItemTextA(hwndDlg, IDC_SETTINGNAME, szSettingName);
SetDlgItemTextA(hwndDlg, IDC_NEWVALUE, warnInfo->szValue);
if (IsInSpaceSeparatedList(warnInfo->szSection, warnInfo->szSafeSections))
- pszSecurityInfo = LPGENT("This change is known to be safe.");
+ pszSecurityInfo = LPGENW("This change is known to be safe.");
else if (IsInSpaceSeparatedList(warnInfo->szSection, warnInfo->szUnsafeSections))
- pszSecurityInfo = LPGENT("This change is known to be potentially hazardous.");
+ pszSecurityInfo = LPGENW("This change is known to be potentially hazardous.");
else
- pszSecurityInfo = LPGENT("This change is not known to be safe.");
+ pszSecurityInfo = LPGENW("This change is not known to be safe.");
SetDlgItemText(hwndDlg, IDC_SECURITYINFO, TranslateTS(pszSecurityInfo));
}
return TRUE;
@@ -144,13 +144,13 @@ static INT_PTR CALLBACK WarnIniChangeDlgProc(HWND hwndDlg, UINT message, WPARAM
static INT_PTR CALLBACK IniImportDoneDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
- TCHAR szIniPath[MAX_PATH];
+ wchar_t szIniPath[MAX_PATH];
switch (message) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- SetDlgItemText(hwndDlg, IDC_ININAME, (TCHAR*)lParam);
- SetDlgItemText(hwndDlg, IDC_NEWNAME, (TCHAR*)lParam);
+ SetDlgItemText(hwndDlg, IDC_ININAME, (wchar_t*)lParam);
+ SetDlgItemText(hwndDlg, IDC_NEWNAME, (wchar_t*)lParam);
return TRUE;
case WM_COMMAND:
@@ -173,7 +173,7 @@ static INT_PTR CALLBACK IniImportDoneDlgProc(HWND hwndDlg, UINT message, WPARAM
EndDialog(hwndDlg, LOWORD(wParam));
break;
case IDC_MOVE:
- TCHAR szNewPath[MAX_PATH];
+ wchar_t szNewPath[MAX_PATH];
GetDlgItemText(hwndDlg, IDC_NEWNAME, szNewPath, _countof(szNewPath));
MoveFile(szIniPath, szNewPath);
EndDialog(hwndDlg, LOWORD(wParam));
@@ -230,9 +230,9 @@ static int EnumSettingsForDeletion(const char *szSetting, LPARAM param)
return 0;
}
-static void ProcessIniFile(TCHAR* szIniPath, char *szSafeSections, char *szUnsafeSections, int secur, bool secFN)
+static void ProcessIniFile(wchar_t* szIniPath, char *szSafeSections, char *szUnsafeSections, int secur, bool secFN)
{
- FILE *fp = _tfopen(szIniPath, L"rt");
+ FILE *fp = _wfopen(szIniPath, L"rt");
if (fp == NULL)
return;
@@ -423,7 +423,7 @@ LBL_NewLine:
}
break;
default:
- TCHAR buf[250];
+ wchar_t buf[250];
mir_sntprintf(buf, TranslateT("Invalid setting type for '%s'. The first character of every value must be b, w, d, l, s, e, u, g, h or n."), _A2T(szName));
MessageBox(NULL, buf, TranslateT("Install database settings"), MB_ICONWARNING | MB_OK);
break;
@@ -434,8 +434,8 @@ LBL_NewLine:
static void DoAutoExec(void)
{
- TCHAR szUse[7], szIniPath[MAX_PATH], szFindPath[MAX_PATH];
- TCHAR buf[2048], szSecurity[11], szOverrideSecurityFilename[MAX_PATH], szOnCreateFilename[MAX_PATH];
+ wchar_t szUse[7], szIniPath[MAX_PATH], szFindPath[MAX_PATH];
+ wchar_t buf[2048], szSecurity[11], szOverrideSecurityFilename[MAX_PATH], szOnCreateFilename[MAX_PATH];
GetPrivateProfileString(L"AutoExec", L"Use", L"prompt", szUse, _countof(szUse), mirandabootini);
if (!mir_tstrcmpi(szUse, L"no")) return;
@@ -466,7 +466,7 @@ static void DoAutoExec(void)
if (hFind == INVALID_HANDLE_VALUE)
return;
- TCHAR *str2 = _tcsrchr(szFindPath, '\\');
+ wchar_t *str2 = wcsrchr(szFindPath, '\\');
if (str2 == NULL)
szFindPath[0] = 0;
else
@@ -487,7 +487,7 @@ static void DoAutoExec(void)
if (secFN)
DeleteFile(szIniPath);
else {
- TCHAR szOnCompletion[8];
+ wchar_t szOnCompletion[8];
GetPrivateProfileString(L"AutoExec", L"OnCompletion", L"recycle", szOnCompletion, _countof(szOnCompletion), mirandabootini);
if (!mir_tstrcmpi(szOnCompletion, L"delete"))
DeleteFile(szIniPath);
@@ -500,7 +500,7 @@ static void DoAutoExec(void)
SHFileOperation(&shfo);
}
else if (!mir_tstrcmpi(szOnCompletion, L"rename")) {
- TCHAR szRenamePrefix[MAX_PATH], szNewPath[MAX_PATH];
+ wchar_t szRenamePrefix[MAX_PATH], szNewPath[MAX_PATH];
GetPrivateProfileString(L"AutoExec", L"RenamePrefix", L"done_", szRenamePrefix, _countof(szRenamePrefix), mirandabootini);
mir_tstrcpy(szNewPath, szFindPath);
mir_tstrcat(szNewPath, szRenamePrefix);
@@ -536,7 +536,7 @@ int InitIni(void)
CreateServiceFunction("DB/Ini/ImportFile", ImportINI);
DoAutoExec();
- TCHAR szMirandaDir[MAX_PATH];
+ wchar_t szMirandaDir[MAX_PATH];
PathToAbsoluteT(L".", szMirandaDir);
hIniChangeNotification = FindFirstChangeNotification(szMirandaDir, 0, FILE_NOTIFY_CHANGE_FILE_NAME);
if (hIniChangeNotification != INVALID_HANDLE_VALUE) {
diff --git a/src/mir_app/src/dbintf.cpp b/src/mir_app/src/dbintf.cpp
index 5a95326330..dca13b96f3 100644
--- a/src/mir_app/src/dbintf.cpp
+++ b/src/mir_app/src/dbintf.cpp
@@ -106,7 +106,7 @@ static INT_PTR srvRegisterPlugin(WPARAM, LPARAM lParam)
static INT_PTR srvFindPlugin(WPARAM, LPARAM lParam)
{
for (int i = arDbPlugins.getCount() - 1; i >= 0; i--) {
- int error = arDbPlugins[i]->grokHeader((TCHAR*)lParam);
+ int error = arDbPlugins[i]->grokHeader((wchar_t*)lParam);
if (error == ERROR_SUCCESS || error == EGROKPRF_OBSOLETE)
return (INT_PTR)arDbPlugins[i];
}
diff --git a/src/mir_app/src/dbutils.cpp b/src/mir_app/src/dbutils.cpp
index d7a958004f..8408eaf2b8 100644
--- a/src/mir_app/src/dbutils.cpp
+++ b/src/mir_app/src/dbutils.cpp
@@ -83,7 +83,7 @@ static INT_PTR DbEventTypeGet(WPARAM wParam, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
-static TCHAR* getEventString(DBEVENTINFO *dbei, LPSTR &buf)
+static wchar_t* getEventString(DBEVENTINFO *dbei, LPSTR &buf)
{
LPSTR in = buf;
buf += mir_strlen(buf) + 1;
@@ -323,8 +323,8 @@ static INT_PTR GetProfileNameW(WPARAM wParam, LPARAM lParam)
static INT_PTR SetDefaultProfile(WPARAM wParam, LPARAM)
{
- extern TCHAR* g_defaultProfile;
- replaceStrT(g_defaultProfile, (TCHAR*)wParam);
+ extern wchar_t* g_defaultProfile;
+ replaceStrT(g_defaultProfile, (wchar_t*)wParam);
return 0;
}
diff --git a/src/mir_app/src/descbutton.cpp b/src/mir_app/src/descbutton.cpp
index 332a2f064f..c45e5fc226 100644
--- a/src/mir_app/src/descbutton.cpp
+++ b/src/mir_app/src/descbutton.cpp
@@ -43,8 +43,8 @@ struct MDescButtonCtrl
HWND hwnd;
BOOL bSharedIcon;
HICON hIcon;
- TCHAR *lpzTitle;
- TCHAR *lpzDescription;
+ wchar_t *lpzTitle;
+ wchar_t *lpzDescription;
// UI info
BOOL bMouseInside;
diff --git a/src/mir_app/src/dll_sniffer.cpp b/src/mir_app/src/dll_sniffer.cpp
index b68b3101d1..e32cbcce07 100644
--- a/src/mir_app/src/dll_sniffer.cpp
+++ b/src/mir_app/src/dll_sniffer.cpp
@@ -34,7 +34,7 @@ static IMAGE_SECTION_HEADER *getSectionByRVA(IMAGE_SECTION_HEADER *pISH, int nSe
return NULL;
}
-MUUID* GetPluginInterfaces(const TCHAR* ptszFileName, bool& bIsPlugin)
+MUUID* GetPluginInterfaces(const wchar_t* ptszFileName, bool& bIsPlugin)
{
bIsPlugin = false;
diff --git a/src/mir_app/src/enterstring.cpp b/src/mir_app/src/enterstring.cpp
index 09503a08d8..884166c7a9 100644
--- a/src/mir_app/src/enterstring.cpp
+++ b/src/mir_app/src/enterstring.cpp
@@ -68,7 +68,7 @@ static void ComboLoadRecentStrings(HWND hwndDlg, EnterStringFormParam *pForm)
static void ComboAddRecentString(HWND hwndDlg, EnterStringFormParam *pForm)
{
- TCHAR *string = pForm->ptszResult;
+ wchar_t *string = pForm->ptszResult;
if (!string || !*string)
return;
@@ -141,7 +141,7 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
if (params->timeout > 0) {
SetTimer(hwndDlg, 1001, 1000, NULL);
- TCHAR buf[128];
+ wchar_t buf[128];
mir_sntprintf(buf, TranslateT("OK (%d)"), params->timeout);
SetDlgItemText(hwndDlg, IDOK, buf);
}
@@ -160,7 +160,7 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
break;
case 1001:
- TCHAR buf[128];
+ wchar_t buf[128];
mir_sntprintf(buf, TranslateT("OK (%d)"), --params->timeout);
SetDlgItemText(hwndDlg, IDOK, buf);
@@ -196,7 +196,7 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
TEXTRANGE tr;
tr.chrg = param->chrg;
- tr.lpstrText = (TCHAR *)mir_alloc(sizeof(TCHAR)*(tr.chrg.cpMax - tr.chrg.cpMin + 2));
+ tr.lpstrText = (wchar_t *)mir_alloc(sizeof(wchar_t)*(tr.chrg.cpMax - tr.chrg.cpMin + 2));
SendMessage(param->nmhdr.hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
Utils_OpenUrlT(tr.lpstrText);
@@ -231,7 +231,7 @@ static INT_PTR CALLBACK sttEnterStringDlgProc(HWND hwndDlg, UINT msg, WPARAM wPa
case IDOK:
HWND hWnd = GetDlgItem(hwndDlg, params->idcControl);
int len = GetWindowTextLength(hWnd)+1;
- params->ptszResult = (LPTSTR)mir_alloc(sizeof(TCHAR)*len);
+ params->ptszResult = (LPTSTR)mir_alloc(sizeof(wchar_t)*len);
GetWindowText(hWnd, params->ptszResult, len);
if ((params->type == ESF_COMBO) && params->szDataPrefix && params->recentCount)
diff --git a/src/mir_app/src/extraicons.cpp b/src/mir_app/src/extraicons.cpp
index 03efd88a84..6acbca19fc 100644
--- a/src/mir_app/src/extraicons.cpp
+++ b/src/mir_app/src/extraicons.cpp
@@ -395,7 +395,7 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterCallback(const char *name, const
return 0;
ptrT tszDesc(mir_a2t(description));
- TCHAR *desc = TranslateTH(_hLang, tszDesc);
+ wchar_t *desc = TranslateTH(_hLang, tszDesc);
int id = registeredExtraIcons.getCount() + 1;
BaseExtraIcon *extra = new CallbackExtraIcon(id, name, desc, descIcon == NULL ? "" : descIcon, RebuildIcons, ApplyIcon, OnClick, onClickParam);
@@ -410,7 +410,7 @@ EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const ch
return 0;
ptrT tszDesc(mir_a2t(description));
- TCHAR *desc = TranslateTH(_hLang, tszDesc);
+ wchar_t *desc = TranslateTH(_hLang, tszDesc);
BaseExtraIcon *extra = GetExtraIconByName(name);
if (extra != NULL) {
diff --git a/src/mir_app/src/filter.cpp b/src/mir_app/src/filter.cpp
index 1470314864..f6d685fca3 100644
--- a/src/mir_app/src/filter.cpp
+++ b/src/mir_app/src/filter.cpp
@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
CPageList filterStrings(1);
-void AddFilterString(const PageHash key, TCHAR *data)
+void AddFilterString(const PageHash key, wchar_t *data)
{
if (ContainsFilterString(key, data)) return;
@@ -44,7 +44,7 @@ void ClearFilterStrings()
filterStrings.destroy();
}
-BOOL ContainsFilterString(const PageHash key, TCHAR *data)
+BOOL ContainsFilterString(const PageHash key, wchar_t *data)
{
CPageKeywords* values = filterStrings[key];
return (values) ? values->ContainsString(data) : FALSE;
@@ -53,7 +53,7 @@ BOOL ContainsFilterString(const PageHash key, TCHAR *data)
void AddTreeViewNodes(HWND hWndDlg, PageHash key, HTREEITEM root)
{
if (root) {
- TCHAR title[2048] = {0};
+ wchar_t title[2048] = {0};
TVITEM item = {0};
item.mask = TVIF_TEXT;
@@ -77,12 +77,12 @@ void AddTreeViewNodes(HWND hWndDlg, PageHash key, HTREEITEM root)
void AddDialogString(HWND hWndDlg, const PageHash key)
{
- TCHAR title[2048];
+ wchar_t title[2048];
GetWindowText(hWndDlg, title, _countof(title));
if (mir_tstrlen(title) > 0)
AddFilterString(key, title);
- TCHAR szClass[64];
+ wchar_t szClass[64];
GetClassName(hWndDlg, szClass, _countof(szClass));
if (mir_tstrcmpi(szClass, L"SysTreeView32") == 0) {
@@ -143,7 +143,7 @@ static BOOL CALLBACK GetDialogStringsCallback(HWND hWnd, LPARAM lParam)
return TRUE;
}
-void GetDialogStrings(int enableKeywordFiltering, const PageHash key, TCHAR *pluginName, HWND hWnd, TCHAR *group, TCHAR *title, TCHAR *tab, TCHAR *name)
+void GetDialogStrings(int enableKeywordFiltering, const PageHash key, wchar_t *pluginName, HWND hWnd, wchar_t *group, wchar_t *title, wchar_t *tab, wchar_t *name)
{
AddFilterString(key, pluginName); //add the plugin name as keyword
if (group) AddFilterString(key, group);
diff --git a/src/mir_app/src/filter.h b/src/mir_app/src/filter.h
index bb35912a40..3c20fcfc69 100644
--- a/src/mir_app/src/filter.h
+++ b/src/mir_app/src/filter.h
@@ -29,23 +29,23 @@ extern HANDLE hOptionsInitialize;
typedef DWORD PageHash;
-void AddFilterString(const PageHash key, const TCHAR *data);
-BOOL ContainsFilterString(const PageHash key, TCHAR *data);
+void AddFilterString(const PageHash key, const wchar_t *data);
+BOOL ContainsFilterString(const PageHash key, wchar_t *data);
void ClearFilterStrings();
-void GetDialogStrings(int enableKeywordFiltering, const PageHash key, TCHAR *pluginName, HWND hWnd, TCHAR *group, TCHAR *title, TCHAR *tab, TCHAR *name);
+void GetDialogStrings(int enableKeywordFiltering, const PageHash key, wchar_t *pluginName, HWND hWnd, wchar_t *group, wchar_t *title, wchar_t *tab, wchar_t *name);
-_inline TCHAR *_tcslwr_locale(TCHAR *buf)
+_inline wchar_t *_tcslwr_locale(wchar_t *buf)
{
LCMapString(Langpack_GetDefaultLocale() , LCMAP_LOWERCASE, buf, (int)mir_tstrlen(buf), buf, (int)mir_tstrlen(buf));
return buf;
}
-typedef LIST<TCHAR> KeywordList;
+typedef LIST<wchar_t> KeywordList;
class CPageKeywords
{
PageHash _pageHashKey;
KeywordList _pageKeyWords;
- static int _KeyWordsSortFunc(const TCHAR* p1, const TCHAR* p2) { return mir_tstrcmp(p1, p2); };
+ static int _KeyWordsSortFunc(const wchar_t* p1, const wchar_t* p2) { return mir_tstrcmp(p1, p2); };
public:
CPageKeywords(PageHash pageHashKey) : _pageHashKey(pageHashKey), _pageKeyWords(1, _KeyWordsSortFunc) {};
@@ -55,19 +55,19 @@ public:
mir_free(_pageKeyWords[j]);
};
- void AddKeyWord(TCHAR *ptKeyWord)
+ void AddKeyWord(wchar_t *ptKeyWord)
{
- TCHAR *plwrWord = _tcslwr_locale(mir_tstrdup(ptKeyWord));
+ wchar_t *plwrWord = _tcslwr_locale(mir_tstrdup(ptKeyWord));
if (_pageKeyWords.getIndex(plwrWord) == -1)
_pageKeyWords.insert(plwrWord);
else
mir_free(plwrWord);
};
- BOOL ContainsString(TCHAR *data)
+ BOOL ContainsString(wchar_t *data)
{
for (int i=0; i < _pageKeyWords.getCount(); i++)
- if (_tcsstr(_pageKeyWords[i], data))
+ if (wcsstr(_pageKeyWords[i], data))
return TRUE;
return FALSE;
}
diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp
index 0cad9fcd93..a6c1f98520 100644
--- a/src/mir_app/src/findadd.cpp
+++ b/src/mir_app/src/findadd.cpp
@@ -291,7 +291,7 @@ static void CheckSearchTypeRadioButton(HWND hwndDlg, int idControl)
#define sttErrMsg TranslateT("You haven't filled in the search field. Please enter a search term and try again.")
#define sttErrTitle TranslateT("Search")
-static void SetListItemText(HWND hwndList, int idx, int col, TCHAR *szText)
+static void SetListItemText(HWND hwndList, int idx, int col, wchar_t *szText)
{
if (szText == NULL || *szText == 0)
szText = TranslateT("<not specified>");
@@ -299,7 +299,7 @@ static void SetListItemText(HWND hwndList, int idx, int col, TCHAR *szText)
ListView_SetItemText(hwndList, idx, col, szText);
}
-static TCHAR* sttDecodeString(DWORD dwFlags, MAllStrings &src)
+static wchar_t* sttDecodeString(DWORD dwFlags, MAllStrings &src)
{
if (dwFlags & PSR_UNICODE)
return mir_u2t(src.w);
@@ -326,7 +326,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
dat->iLastColumnSortIndex = 1;
dat->bSortAscending = 1;
SendDlgItemMessage(hwndDlg, IDC_MOREOPTIONS, BUTTONSETARROW, 1, 0);
- SendDlgItemMessage(hwndDlg, IDOK, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Ctrl+Search add contact"), BATF_TCHAR);
+ SendDlgItemMessage(hwndDlg, IDOK, BUTTONADDTOOLTIP, (WPARAM)LPGENW("Ctrl+Search add contact"), BATF_TCHAR);
ListView_SetExtendedListViewStyle(hwndList, LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP);
@@ -363,10 +363,10 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
SendDlgItemMessage(hwndDlg, IDC_STATUSBAR, SB_SETTEXT, 1 | SBT_OWNERDRAW, 0);
SetStatusBarSearchInfo(GetDlgItem(hwndDlg, IDC_STATUSBAR), dat);
- TCHAR *szProto = NULL;
+ wchar_t *szProto = NULL;
ptrT tszLast(db_get_tsa(NULL, "FindAdd", "LastSearched"));
if (tszLast)
- szProto = NEWTSTR_ALLOCA(tszLast);
+ szProto = NEWWSTR_ALLOCA(tszLast);
int i, index = 0, cbwidth = 0, netProtoCount = 0;
for (i = 0; i < accounts.getCount(); i++) {
@@ -687,7 +687,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (IsDlgButtonChecked(hwndDlg, IDC_BYCUSTOM))
BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYADVANCED, PF1_EXTSEARCHUI, dat->hwndTinySearch);
else if (IsDlgButtonChecked(hwndDlg, IDC_BYPROTOID)) {
- TCHAR str[256];
+ wchar_t str[256];
GetDlgItemText(hwndDlg, IDC_PROTOID, str, _countof(str));
rtrimt(str);
if (str[0] == 0)
@@ -696,7 +696,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
BeginSearch(hwndDlg, dat, szProto, PS_BASICSEARCH, PF1_BASICSEARCH, str);
}
else if (IsDlgButtonChecked(hwndDlg, IDC_BYEMAIL)) {
- TCHAR str[256];
+ wchar_t str[256];
GetDlgItemText(hwndDlg, IDC_EMAIL, str, _countof(str));
rtrimt(str);
if (str[0] == 0)
@@ -705,7 +705,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYEMAIL, PF1_SEARCHBYEMAIL, str);
}
else if (IsDlgButtonChecked(hwndDlg, IDC_BYNAME)) {
- TCHAR nick[256], first[256], last[256];
+ wchar_t nick[256], first[256], last[256];
PROTOSEARCHBYNAME psbn;
GetDlgItemText(hwndDlg, IDC_NAMENICK, nick, _countof(nick));
GetDlgItemText(hwndDlg, IDC_NAMEFIRST, first, _countof(first));
@@ -758,7 +758,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
acs.psr = &lsr->psr;
}
else {
- TCHAR str[256];
+ wchar_t str[256];
GetDlgItemText(hwndDlg, IDC_PROTOID, str, _countof(str));
if (*rtrimt(str) == 0)
break;
@@ -766,7 +766,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
PROTOSEARCHRESULT psr = { 0 };
psr.cbSize = sizeof(psr);
psr.flags = PSR_TCHAR;
- psr.id.t = str;
+ psr.id.w = str;
acs.psr = &psr;
acs.szProto = (char*)SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETITEMDATA,
@@ -864,11 +864,11 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
memcpy(&lsr->psr, psr, psr->cbSize);
/* Next block is not needed but behavior will be kept */
- lsr->psr.id.t = sttDecodeString(psr->flags, psr->id);
- lsr->psr.nick.t = sttDecodeString(psr->flags, psr->nick);
- lsr->psr.firstName.t = sttDecodeString(psr->flags, psr->firstName);
- lsr->psr.lastName.t = sttDecodeString(psr->flags, psr->lastName);
- lsr->psr.email.t = sttDecodeString(psr->flags, psr->email);
+ lsr->psr.id.w = sttDecodeString(psr->flags, psr->id);
+ lsr->psr.nick.w = sttDecodeString(psr->flags, psr->nick);
+ lsr->psr.firstName.w = sttDecodeString(psr->flags, psr->firstName);
+ lsr->psr.lastName.w = sttDecodeString(psr->flags, psr->lastName);
+ lsr->psr.email.w = sttDecodeString(psr->flags, psr->email);
lsr->psr.flags = psr->flags & ~PSR_UNICODE | PSR_TCHAR;
LVITEM lvi = { 0 };
@@ -904,11 +904,11 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
dat->bFlexSearchResult = FALSE;
memcpy(&lsr->psr, psr, psr->cbSize);
- lsr->psr.nick.t = sttDecodeString(psr->flags, psr->nick);
- lsr->psr.firstName.t = sttDecodeString(psr->flags, psr->firstName);
- lsr->psr.lastName.t = sttDecodeString(psr->flags, psr->lastName);
- lsr->psr.email.t = sttDecodeString(psr->flags, psr->email);
- lsr->psr.id.t = sttDecodeString(psr->flags, psr->id);
+ lsr->psr.nick.w = sttDecodeString(psr->flags, psr->nick);
+ lsr->psr.firstName.w = sttDecodeString(psr->flags, psr->firstName);
+ lsr->psr.lastName.w = sttDecodeString(psr->flags, psr->lastName);
+ lsr->psr.email.w = sttDecodeString(psr->flags, psr->email);
+ lsr->psr.id.w = sttDecodeString(psr->flags, psr->id);
lsr->psr.flags = psr->flags & ~PSR_UNICODE | PSR_TCHAR;
LVITEM lvi = { 0 };
@@ -928,11 +928,11 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
}
int iItem = ListView_InsertItem(hwndList, &lvi);
- SetListItemText(hwndList, iItem, 1, lsr->psr.id.t);
- SetListItemText(hwndList, iItem, 2, lsr->psr.nick.t);
- SetListItemText(hwndList, iItem, 3, lsr->psr.firstName.t);
- SetListItemText(hwndList, iItem, 4, lsr->psr.lastName.t);
- SetListItemText(hwndList, iItem, 5, lsr->psr.email.t);
+ SetListItemText(hwndList, iItem, 1, lsr->psr.id.w);
+ SetListItemText(hwndList, iItem, 2, lsr->psr.nick.w);
+ SetListItemText(hwndList, iItem, 3, lsr->psr.firstName.w);
+ SetListItemText(hwndList, iItem, 4, lsr->psr.lastName.w);
+ SetListItemText(hwndList, iItem, 5, lsr->psr.email.w);
SetStatusBarResultInfo(hwndDlg);
}
}
@@ -944,7 +944,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
case WM_DESTROY:
int len = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETLBTEXTLEN, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), 0);
- TCHAR *szProto = (TCHAR*)alloca(sizeof(TCHAR)*(len + 1));
+ wchar_t *szProto = (wchar_t*)alloca(sizeof(wchar_t)*(len + 1));
if (szProto != NULL) {
*szProto = '\0';
SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETLBTEXT, SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, CB_GETCURSEL, 0, 0), (LPARAM)szProto);
diff --git a/src/mir_app/src/genmenu.h b/src/mir_app/src/genmenu.h
index 2baed199d1..da3dc168c4 100644
--- a/src/mir_app/src/genmenu.h
+++ b/src/mir_app/src/genmenu.h
@@ -49,7 +49,7 @@ struct TMO_IntMenuItem
int iconId; // icon index in the section's image list
TMO_MenuItem mi; // user-defined data
char* pszUniqName; // unique name
- TCHAR* ptszCustomName;
+ wchar_t* ptszCustomName;
HANDLE hIcolibItem; // handle of iconlib item
HBITMAP hBmp;
int originalPosition; // !!!!!!!!!!!!!!!!!!!!!!!!
@@ -72,7 +72,7 @@ struct TIntMenuObject : public MZeroedObject
int id;
char *pszName;
- TCHAR *ptszDisplayName;
+ wchar_t *ptszDisplayName;
//ExecService
//LPARAM lParam;//owner data
diff --git a/src/mir_app/src/headerbar.cpp b/src/mir_app/src/headerbar.cpp
index 1230ca922f..b8c8651ff2 100644
--- a/src/mir_app/src/headerbar.cpp
+++ b/src/mir_app/src/headerbar.cpp
@@ -132,10 +132,10 @@ static LRESULT MHeaderbar_OnPaint(HWND hwndDlg, MHeaderbarCtrl *mit)
PAINTSTRUCT ps;
int titleLength = GetWindowTextLength(hwndDlg) + 1;
- TCHAR *szTitle = (TCHAR *)mir_alloc(sizeof(TCHAR) * titleLength);
+ wchar_t *szTitle = (wchar_t *)mir_alloc(sizeof(wchar_t) * titleLength);
GetWindowText(hwndDlg, szTitle, titleLength);
- TCHAR *szSubTitle = _tcschr(szTitle, _T('\n'));
+ wchar_t *szSubTitle = wcschr(szTitle, '\n');
if (szSubTitle)
*szSubTitle++ = 0;
diff --git a/src/mir_app/src/hotkey_opts.cpp b/src/mir_app/src/hotkey_opts.cpp
index cec2a06d5f..22e7443376 100644
--- a/src/mir_app/src/hotkey_opts.cpp
+++ b/src/mir_app/src/hotkey_opts.cpp
@@ -26,9 +26,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_hotkeys.h>
#include "skin.h"
-static TCHAR* sttHokeyVkToName(WORD vkKey)
+static wchar_t* sttHokeyVkToName(WORD vkKey)
{
- static TCHAR buf[256] = { 0 };
+ static wchar_t buf[256] = { 0 };
DWORD code = MapVirtualKey(vkKey, 0) << 16;
switch (vkKey) {
@@ -99,7 +99,7 @@ static TCHAR* sttHokeyVkToName(WORD vkKey)
return buf;
}
-void HotkeyToName(TCHAR *buf, int size, BYTE shift, BYTE key)
+void HotkeyToName(wchar_t *buf, int size, BYTE shift, BYTE key)
{
mir_sntprintf(buf, size, L"%s%s%s%s%s",
(shift & HOTKEYF_CONTROL) ? TranslateT("Ctrl + ") : L"",
@@ -124,7 +124,7 @@ static LRESULT CALLBACK sttHotkeyEditProc(HWND hwnd, UINT msg, WPARAM wParam, LP
case HKM_SETHOTKEY:
{
- TCHAR buf[256] = { 0 };
+ wchar_t buf[256] = { 0 };
data->key = (BYTE)LOWORD(wParam);
data->shift = (BYTE)HIWORD(wParam);
HotkeyToName(buf, _countof(buf), data->shift, data->key);
@@ -151,11 +151,11 @@ static LRESULT CALLBACK sttHotkeyEditProc(HWND hwnd, UINT msg, WPARAM wParam, LP
case WM_KEYUP:
case WM_SYSKEYUP:
{
- TCHAR buf[256] = { 0 };
+ wchar_t buf[256] = { 0 };
BYTE shift = 0;
BYTE key = wParam;
- TCHAR *name = sttHokeyVkToName(key);
+ wchar_t *name = sttHokeyVkToName(key);
if (!*name || !bKeyDown)
key = 0;
@@ -206,7 +206,7 @@ enum { COL_NAME, COL_TYPE, COL_KEY, COL_RESET, COL_ADDREMOVE };
static void sttOptionsSetupItem(HWND hwndList, int idx, THotkeyItem *item)
{
- TCHAR buf[256];
+ wchar_t buf[256];
LVITEM lvi = { 0 };
lvi.iItem = idx;
@@ -261,7 +261,7 @@ static void sttOptionsDeleteHotkey(HWND hwndList, int idx, THotkeyItem *item)
static int CALLBACK sttOptionsSortList(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
- TCHAR title1[256] = { 0 }, title2[256] = { 0 };
+ wchar_t title1[256] = { 0 }, title2[256] = { 0 };
THotkeyItem *item1 = NULL, *item2 = NULL;
LVITEM lvi = { 0 };
int res;
@@ -447,7 +447,7 @@ static void sttOptionsStartEdit(HWND hwndDlg, HWND hwndHotkey)
}
}
-static void sttOptionsDrawTextChunk(HDC hdc, TCHAR *text, RECT *rc)
+static void sttOptionsDrawTextChunk(HDC hdc, wchar_t *text, RECT *rc)
{
DrawText(hdc, text, -1, rc, DT_LEFT | DT_NOPREFIX | DT_SINGLELINE | DT_VCENTER | DT_WORD_ELLIPSIS);
@@ -520,7 +520,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
{
/* load group states */
int count = ListView_GetItemCount(hwndHotkey);
- TCHAR buf[128];
+ wchar_t buf[128];
LVITEM lvi = { 0 };
lvi.pszText = buf;
lvi.cchTextMax = _countof(buf);
@@ -891,7 +891,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
else if (!item) {
- TCHAR buf[256];
+ wchar_t buf[256];
LVITEM lvi = { 0 };
lvi.mask = LVIF_TEXT;
lvi.iItem = param->iItem;
@@ -949,7 +949,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
case CDDS_SUBITEM | CDDS_ITEMPREPAINT:
{
THotkeyItem *item;
- TCHAR buf[256];
+ wchar_t buf[256];
LVITEM lvi = { 0 };
lvi.mask = LVIF_TEXT | LVIF_PARAM;
lvi.iItem = param->nmcd.dwItemSpec;
@@ -1008,7 +1008,7 @@ static INT_PTR CALLBACK sttOptionsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam,
KillTimer(hwndDlg, 1024);
- TCHAR buf[128];
+ wchar_t buf[128];
LVITEM lvi = { 0 };
lvi.pszText = buf;
lvi.cchTextMax = _countof(buf);
diff --git a/src/mir_app/src/hotkeys.cpp b/src/mir_app/src/hotkeys.cpp
index 6d3946840d..9a1a844f89 100644
--- a/src/mir_app/src/hotkeys.cpp
+++ b/src/mir_app/src/hotkeys.cpp
@@ -250,7 +250,7 @@ static INT_PTR svcHotkeyUnregister(WPARAM, LPARAM lParam)
static INT_PTR svcHotkeyCheck(WPARAM wParam, LPARAM lParam)
{
MSG *msg = (MSG *)wParam;
- TCHAR *pszSection = mir_a2t((char *)lParam);
+ wchar_t *pszSection = mir_a2t((char *)lParam);
if ((msg->message == WM_KEYDOWN) || (msg->message == WM_SYSKEYDOWN)) {
int i;
diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp
index ec21467e84..45c2e33b27 100644
--- a/src/mir_app/src/icolib.cpp
+++ b/src/mir_app/src/icolib.cpp
@@ -74,7 +74,7 @@ void __fastcall SafeDestroyIcon(HICON &hIcon)
// Helper functions to manage Icon resources
-static IconSourceFile* IconSourceFile_Get(const TCHAR *file, bool isPath)
+static IconSourceFile* IconSourceFile_Get(const wchar_t *file, bool isPath)
{
if (!file)
return NULL;
@@ -83,7 +83,7 @@ static IconSourceFile* IconSourceFile_Get(const TCHAR *file, bool isPath)
if (isPath)
PathToAbsoluteT(file, key.file); /// TODO: convert path to long - eliminate duplicate items
else
- _tcsncpy_s(key.file, file, _TRUNCATE);
+ wcsncpy_s(key.file, file, _TRUNCATE);
IconSourceFile *p = iconSourceFileList.find(&key);
if (p != NULL) {
@@ -92,10 +92,10 @@ static IconSourceFile* IconSourceFile_Get(const TCHAR *file, bool isPath)
}
// store only needed number of chars
- size_t cbLen = _tcslen(key.file) + 1;
- p = (IconSourceFile*)mir_alloc(sizeof(int) + sizeof(TCHAR)*cbLen);
+ size_t cbLen = wcslen(key.file) + 1;
+ p = (IconSourceFile*)mir_alloc(sizeof(int) + sizeof(wchar_t)*cbLen);
p->ref_count = 1;
- _tcsncpy_s(p->file, cbLen, key.file, _TRUNCATE);
+ wcsncpy_s(p->file, cbLen, key.file, _TRUNCATE);
iconSourceFileList.insert(p);
return p;
}
@@ -311,7 +311,7 @@ int IconSourceItem::compare(const IconSourceItem *p1, const IconSourceItem *p2)
return (p1->key.file > p2->key.file) ? 1 : -1;
}
-IconSourceItem* GetIconSourceItem(const TCHAR *file, int indx, int cxIcon, int cyIcon)
+IconSourceItem* GetIconSourceItem(const wchar_t *file, int indx, int cxIcon, int cyIcon)
{
if (!file)
return NULL;
@@ -330,20 +330,20 @@ IconSourceItem* GetIconSourceItem(const TCHAR *file, int indx, int cxIcon, int c
return newItem;
}
-IconSourceItem* GetIconSourceItemFromPath(const TCHAR *path, int cxIcon, int cyIcon)
+IconSourceItem* GetIconSourceItemFromPath(const wchar_t *path, int cxIcon, int cyIcon)
{
if (!path)
return NULL;
- TCHAR file[MAX_PATH];
+ wchar_t file[MAX_PATH];
mir_tstrncpy(file, path, _countof(file));
- TCHAR *comma = _tcsrchr(file, ',');
+ wchar_t *comma = wcsrchr(file, ',');
int n;
if (!comma)
n = 0;
else {
- n = _ttoi(comma + 1);
+ n = _wtoi(comma + 1);
*comma = 0;
}
return GetIconSourceItem(file, n, cxIcon, cyIcon);
@@ -351,7 +351,7 @@ IconSourceItem* GetIconSourceItemFromPath(const TCHAR *path, int cxIcon, int cyI
IconSourceItem* CreateStaticIconSourceItem(int cxIcon, int cyIcon)
{
- TCHAR tszName[100];
+ wchar_t tszName[100];
mir_sntprintf(tszName, L"*StaticIcon_%d", iStaticCount++);
IconSourceItemKey key = { IconSourceFile_Get(tszName, false), 0, cxIcon, cyIcon };
@@ -379,7 +379,7 @@ int IconSourceItem::release()
/////////////////////////////////////////////////////////////////////////////////////////
// Service functions
-static SectionItem* IcoLib_AddSection(TCHAR *sectionName, BOOL create_new)
+static SectionItem* IcoLib_AddSection(wchar_t *sectionName, BOOL create_new)
{
if (!sectionName)
return NULL;
@@ -669,7 +669,7 @@ HICON IconItem_GetIcon(HANDLE hIcoLib, bool big)
if (source == NULL) {
ptrT tszCustomPath(db_get_tsa(NULL, "SkinIcons", item->name));
if (tszCustomPath != NULL) {
- TCHAR tszFullPath[MAX_PATH];
+ wchar_t tszFullPath[MAX_PATH];
PathToAbsoluteT(tszCustomPath, tszFullPath);
int cx = item->cx ? item->cx : (big ? g_iIconX : g_iIconSX);
int cy = item->cy ? item->cy : (big ? g_iIconY : g_iIconSY);
diff --git a/src/mir_app/src/keyboard.cpp b/src/mir_app/src/keyboard.cpp
index 576e239747..e71b72c9c9 100644
--- a/src/mir_app/src/keyboard.cpp
+++ b/src/mir_app/src/keyboard.cpp
@@ -54,35 +54,35 @@ int InitClistHotKeys(void)
HOTKEYDESC shk = { sizeof(shk) };
shk.dwFlags = HKD_TCHAR;
- shk.ptszDescription = LPGENT("Show/Hide contact list");
+ shk.ptszDescription = LPGENW("Show/Hide contact list");
shk.pszName = "ShowHide";
shk.ptszSection = L"Main";
shk.pszService = "CLIST/HK/SHOWHIDE";
shk.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'A');
Hotkey_Register(&shk);
- shk.ptszDescription = LPGENT("Read message");
+ shk.ptszDescription = LPGENW("Read message");
shk.pszName = "ReadMessage";
shk.ptszSection = L"Main";
shk.pszService = "CLIST/HK/Read";
shk.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'I');
Hotkey_Register(&shk);
- shk.ptszDescription = LPGENT("Open Options page");
+ shk.ptszDescription = LPGENW("Open Options page");
shk.pszName = "ShowOptions";
shk.ptszSection = L"Main";
shk.pszService = "CLIST/HK/Opts";
shk.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, 'O') | HKF_MIRANDA_LOCAL;
Hotkey_Register(&shk);
- shk.ptszDescription = LPGENT("Open logging options");
+ shk.ptszDescription = LPGENW("Open logging options");
shk.pszName = "ShowLogOptions";
shk.ptszSection = L"Main";
shk.pszService = "Netlib/Log/Win";
shk.DefHotKey = 0;
Hotkey_Register(&shk);
- shk.ptszDescription = LPGENT("Open 'Find user' dialog");
+ shk.ptszDescription = LPGENW("Open 'Find user' dialog");
shk.pszName = "FindUsers";
shk.ptszSection = L"Main";
shk.pszService = "FindAdd/FindAddCommand";
diff --git a/src/mir_app/src/langpack.cpp b/src/mir_app/src/langpack.cpp
index c418707a34..020bc0e46f 100644
--- a/src/mir_app/src/langpack.cpp
+++ b/src/mir_app/src/langpack.cpp
@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
#include "langpack.h"
-MIR_CORE_DLL(int) LoadLangPackDescr(const TCHAR *szLangPack, LANGPACK_INFO *lpInfo);
+MIR_CORE_DLL(int) LoadLangPackDescr(const wchar_t *szLangPack, LANGPACK_INFO *lpInfo);
BOOL EnumLangpacks(ENUM_PACKS_CALLBACK callback, WPARAM wParam, LPARAM lParam)
{
@@ -36,7 +36,7 @@ BOOL EnumLangpacks(ENUM_PACKS_CALLBACK callback, WPARAM wParam, LPARAM lParam)
/* language folder */
ptrT langpack(db_get_tsa(NULL, "Langpack", "Current"));
- TCHAR tszFullPath[MAX_PATH];
+ wchar_t tszFullPath[MAX_PATH];
PathToAbsoluteT(L"\\Languages\\langpack_*.txt", tszFullPath);
BOOL fPackFound = FALSE;
diff --git a/src/mir_app/src/langpack.h b/src/mir_app/src/langpack.h
index 1d9c226ce5..ddc1cb904d 100644
--- a/src/mir_app/src/langpack.h
+++ b/src/mir_app/src/langpack.h
@@ -42,13 +42,13 @@ static INT_PTR srvGetPluginLangpack(WPARAM wParam, LPARAM lParam);
/* Langpack Info */
struct LANGPACK_INFO
{
- TCHAR tszLanguage[64];
+ wchar_t tszLanguage[64];
LCID Locale;
WORD codepage;
CMStringA szAuthors, szAuthorEmail, szLastModifiedUsing;
FILETIME ftFileDate;
- TCHAR tszFileName[MAX_PATH]; /* just the file name itself */
- TCHAR tszFullPath[MAX_PATH]; /* full path to the langpack */
+ wchar_t tszFileName[MAX_PATH]; /* just the file name itself */
+ wchar_t tszFullPath[MAX_PATH]; /* full path to the langpack */
BYTE flags; /* see LPIF_* flags */
};
diff --git a/src/mir_app/src/lpopts.cpp b/src/mir_app/src/lpopts.cpp
index d34dc23152..6166ec692a 100644
--- a/src/mir_app/src/lpopts.cpp
+++ b/src/mir_app/src/lpopts.cpp
@@ -34,18 +34,18 @@ static void DisplayPackInfo(HWND hwndDlg, const LANGPACK_INFO *pack)
{
/* locale string */
if (!(pack->flags & LPF_NOLOCALE)) {
- TCHAR szLocaleName[256], szLanguageName[128], szContryName[128];
+ wchar_t szLocaleName[256], szLanguageName[128], szContryName[128];
if (!GetLocaleInfo(pack->Locale, WINVER >= _WIN32_WINNT_WIN7 ? LOCALE_SENGLISHLANGUAGENAME : LOCALE_SENGLANGUAGE, szLanguageName, _countof(szLanguageName)))
- szLanguageName[0] = _T('\0');
+ szLanguageName[0] = '\0';
if (!GetLocaleInfo(pack->Locale, WINVER >= _WIN32_WINNT_WIN7 ? LOCALE_SENGLISHCOUNTRYNAME : LOCALE_SENGCOUNTRY, szContryName, _countof(szContryName)))
- szContryName[0] = _T('\0');
+ szContryName[0] = '\0';
/* add some note if its incompatible */
if (szLanguageName[0] && szContryName[0]) {
mir_sntprintf(szLocaleName, L"%s (%s)", TranslateTS(szLanguageName), TranslateTS(szContryName));
if (!IsValidLocale(pack->Locale, LCID_INSTALLED)) {
- TCHAR *pszIncompat;
+ wchar_t *pszIncompat;
pszIncompat = TranslateT("(incompatible)");
szLocaleName[_countof(szLocaleName) - mir_tstrlen(pszIncompat) - 1] = 0;
mir_tstrcat(mir_tstrcat(szLocaleName, L" "), pszIncompat);
@@ -58,7 +58,7 @@ static void DisplayPackInfo(HWND hwndDlg, const LANGPACK_INFO *pack)
/* file date */
SYSTEMTIME stFileDate;
- TCHAR szDate[128]; szDate[0] = 0;
+ wchar_t szDate[128]; szDate[0] = 0;
if (FileTimeToSystemTime(&pack->ftFileDate, &stFileDate))
GetDateFormat(Langpack_GetDefaultLocale(), DATE_SHORTDATE, &stFileDate, NULL, szDate, _countof(szDate));
SetDlgItemText(hwndDlg, IDC_LANGDATE, szDate);
@@ -76,7 +76,7 @@ static BOOL InsertPackItemEnumProc(LANGPACK_INFO *pack, WPARAM wParam, LPARAM)
*pack2 = *pack;
/* insert */
- TCHAR tszName[512];
+ wchar_t tszName[512];
mir_sntprintf(tszName, L"%s [%s]",
TranslateTS(pack->tszLanguage),
pack->flags & LPF_DEFAULT ? TranslateT("built-in") : pack->tszFileName);
@@ -160,7 +160,7 @@ INT_PTR CALLBACK DlgLangpackOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
case WM_NOTIFY:
if (LPNMHDR(lParam)->code == PSN_APPLY) {
- TCHAR tszPath[MAX_PATH]; tszPath[0] = 0;
+ wchar_t tszPath[MAX_PATH]; tszPath[0] = 0;
int idx = ComboBox_GetCurSel(hwndList);
int count = ComboBox_GetCount(hwndList);
for (int i = 0; i < count; i++) {
diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp
index cfd1447b66..9d2109c4d3 100644
--- a/src/mir_app/src/menu_clist.cpp
+++ b/src/mir_app/src/menu_clist.cpp
@@ -153,7 +153,7 @@ static int RecursiveDeleteMenu(HMENU hMenu)
struct MainMenuExecParam
{
char *szServiceName;
- TCHAR *szMenuName;
+ wchar_t *szMenuName;
TMO_IntMenuItem *pimi;
};
@@ -176,7 +176,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddMainMenuItem(TMO_MenuItem *pmi)
//we need just one parametr.
mmep->szServiceName = mir_strdup(pmi->pszService);
- mmep->szMenuName = pmi->name.t;
+ mmep->szMenuName = pmi->name.w;
TMO_IntMenuItem *pimi = Menu_AddItem(hMainMenuObject, pmi, mmep);
if (pimi == NULL)
@@ -190,7 +190,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddMainMenuItem(TMO_MenuItem *pmi)
if (pmi->pszService)
name = pmi->pszService;
else if (pmi->flags & CMIF_UNICODE) {
- name = mir_t2a(pmi->name.t);
+ name = mir_t2a(pmi->name.w);
needFree = true;
}
else name = pmi->name.a;
@@ -259,9 +259,9 @@ MIR_APP_DLL(HGENMENU) Menu_AddContactMenuItem(TMO_MenuItem *pmi, const char *psz
mir_snprintf(buf, "%s/%s", pszProto, (pmi->pszService) ? pmi->pszService : "");
Menu_ConfigureItem(pimi, MCI_OPT_UNIQUENAME, buf);
}
- else if (pmi->name.t) {
+ else if (pmi->name.w) {
if (pmi->flags & CMIF_UNICODE)
- mir_snprintf(buf, "%s/NoService/%S", pszProto, pmi->name.t);
+ mir_snprintf(buf, "%s/NoService/%S", pszProto, pmi->name.w);
else
mir_snprintf(buf, "%s/NoService/%s", pszProto, pmi->name.a);
Menu_ConfigureItem(pimi, MCI_OPT_UNIQUENAME, buf);
@@ -381,7 +381,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddStatusMenuItem(TMO_MenuItem *pmi, const char *pszP
smep->hMenuItem = pimi;
char buf[MAX_PATH + 64];
- char *p = (pRoot) ? mir_t2a(pRoot->mi.name.t) : NULL;
+ char *p = (pRoot) ? mir_t2a(pRoot->mi.name.w) : NULL;
mir_snprintf(buf, "%s/%s", (p) ? p : "", pmi->pszService ? pmi->pszService : "");
mir_free(p);
@@ -467,13 +467,13 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM)
if (reset || check) {
TMO_IntMenuItem *timiParent = MO_GetIntMenuItem(pimi->mi.root);
if (timiParent) {
- LPTSTR ptszName = TranslateTH(pimi->mi.hLangpack, pimi->mi.hIcolibItem ? pimi->mi.name.t : LPGENT("Custom status"));
+ LPTSTR ptszName = TranslateTH(pimi->mi.hLangpack, pimi->mi.hIcolibItem ? pimi->mi.name.w : LPGENW("Custom status"));
timiParent = MO_GetIntMenuItem(pimi->mi.root);
MenuItemData it = {};
if (FindMenuHandleByGlobalID(hStatusMenu, timiParent, &it)) {
- TCHAR d[100];
+ wchar_t d[100];
GetMenuString(it.OwnerMenu, it.position, d, _countof(d), MF_BYPOSITION);
MENUITEMINFO mii = {};
@@ -517,7 +517,7 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM)
if (smep)
prot = smep->szProto;
else {
- char *prn = mir_u2a(pimi->mi.name.t);
+ char *prn = mir_u2a(pimi->mi.name.w);
prot = NEWSTR_ALLOCA(prn);
if (prn) mir_free(prn);
}
@@ -580,7 +580,7 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM)
return 0;
TMO_IntMenuItem *root = (TMO_IntMenuItem*)pimi->mi.root;
- TCHAR buf[256], *ptszName;
+ wchar_t buf[256], *ptszName;
if (bIsLocked) {
pimi->mi.flags |= CMIF_CHECKED;
if (cli.bDisplayLocked) {
@@ -593,8 +593,8 @@ INT_PTR StatusMenuExecService(WPARAM wParam, LPARAM)
ptszName = acc->tszAccountName;
pimi->mi.flags &= ~CMIF_CHECKED;
}
- replaceStrT(pimi->mi.name.t, ptszName);
- replaceStrT(root->mi.name.t, ptszName);
+ replaceStrT(pimi->mi.name.w, ptszName);
+ replaceStrT(root->mi.name.w, ptszName);
if (cli.hwndStatus)
InvalidateRect(cli.hwndStatus, NULL, TRUE);
@@ -812,7 +812,7 @@ void RebuildMenuOrder(void)
DWORD flags = pa->ppro->GetCaps(PFLAGNUM_2, 0) & ~pa->ppro->GetCaps(PFLAGNUM_5, 0);
HICON ic;
- TCHAR tbuf[256];
+ wchar_t tbuf[256];
// adding root
CMenuItem mi;
@@ -822,9 +822,9 @@ void RebuildMenuOrder(void)
if (Proto_IsAccountLocked(pa) && cli.bDisplayLocked) {
mir_sntprintf(tbuf, TranslateT("%s (locked)"), pa->tszAccountName);
- mi.name.t = tbuf;
+ mi.name.w = tbuf;
}
- else mi.name.t = pa->tszAccountName;
+ else mi.name.w = pa->tszAccountName;
// owner data
StatusMenuExecParam *smep = (StatusMenuExecParam*)mir_calloc(sizeof(StatusMenuExecParam));
@@ -846,13 +846,13 @@ void RebuildMenuOrder(void)
if ((mi.flags & CMIF_CHECKED) && cli.bDisplayLocked) {
mir_sntprintf(tbuf, TranslateT("%s (locked)"), pa->tszAccountName);
- mi.name.t = tbuf;
+ mi.name.w = tbuf;
}
- else mi.name.t = pa->tszAccountName;
+ else mi.name.w = pa->tszAccountName;
TMO_IntMenuItem *pimi = Menu_AddItem(hStatusMenuObject, &mi, smep);
smep->pimi = pimi;
- Menu_ModifyItem(pimi, mi.name.t, mi.hIcon, mi.flags);
+ Menu_ModifyItem(pimi, mi.name.w, mi.hIcon, mi.flags);
cli.menuProtos = (MenuProto*)mir_realloc(cli.menuProtos, sizeof(MenuProto)*(cli.menuProtoCount + 1));
memset(&(cli.menuProtos[cli.menuProtoCount]), 0, sizeof(MenuProto));
@@ -878,7 +878,7 @@ void RebuildMenuOrder(void)
mi.flags |= CMIF_CHECKED;
mi.root = rootmenu;
mi.position = pos++;
- mi.name.t = cli.pfnGetStatusModeDescription(statusModeList[j], GSMDF_UNTRANSLATED);
+ mi.name.w = cli.pfnGetStatusModeDescription(statusModeList[j], GSMDF_UNTRANSLATED);
mi.hIcon = Skin_LoadProtoIcon(pa->szModuleName, statusModeList[j]);
// owner data
@@ -925,11 +925,11 @@ void RebuildMenuOrder(void)
StatusMenuExecParam *smep = (StatusMenuExecParam*)mir_calloc(sizeof(StatusMenuExecParam));
smep->status = statusModeList[j];
{
- TCHAR buf[256], hotkeyName[100];
+ wchar_t buf[256], hotkeyName[100];
WORD hotKey = GetHotkeyValue(statusHotkeys[j]);
HotkeyToName(hotkeyName, _countof(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
mir_sntprintf(buf, L"%s\t%s", cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName);
- mi.name.t = buf;
+ mi.name.w = buf;
hStatusMainMenuHandles[j] = Menu_AddItem(hStatusMenuObject, &mi, smep);
hStatusMainMenuHandles[j]->hotKey = hotKey;
@@ -955,7 +955,7 @@ static int sttRebuildHotkeys(WPARAM, LPARAM)
if (hStatusMainMenuHandles[j] == NULL)
continue;
- TCHAR buf[256], hotkeyName[100];
+ wchar_t buf[256], hotkeyName[100];
WORD hotKey = GetHotkeyValue(statusHotkeys[j]);
HotkeyToName(hotkeyName, _countof(hotkeyName), HIBYTE(hotKey), LOBYTE(hotKey));
mir_sntprintf(buf, L"%s\t%s", cli.pfnGetStatusModeDescription(statusModeList[j], 0), hotkeyName);
diff --git a/src/mir_app/src/menu_options.cpp b/src/mir_app/src/menu_options.cpp
index 6245ae2a13..6d7ba2bc0f 100644
--- a/src/mir_app/src/menu_options.cpp
+++ b/src/mir_app/src/menu_options.cpp
@@ -62,7 +62,7 @@ class CGenMenuOptionsPage : public CDlgBase
{
int iInitMenuValue;
- TCHAR idstr[100];
+ wchar_t idstr[100];
void SaveTreeInternal(MenuItemOptData *pParent, HTREEITEM hRootItem, const char *szModule)
{
@@ -90,7 +90,7 @@ class CGenMenuOptionsPage : public CDlgBase
bin2hex(&pimi->mi.uid, sizeof(pimi->mi.uid), menuItemName);
int visible = tvi.iImage != 0;
- TCHAR *ptszCustomName;
+ wchar_t *ptszCustomName;
if (iod->name != NULL && iod->defname != NULL && mir_tstrcmp(iod->name, iod->defname) != 0)
ptszCustomName = iod->name;
else
@@ -401,7 +401,7 @@ public:
MenuItemOptData *PD = new MenuItemOptData();
PD->id = -1;
- PD->name = mir_tstrdup(pimi->mi.name.t);
+ PD->name = mir_tstrdup(pimi->mi.name.w);
PD->pos = pimi->mi.position;
PD->pimi = pimi;
@@ -437,7 +437,7 @@ public:
m_menuItems.GetItem(&tvi);
MenuItemOptData *iod = (MenuItemOptData *)tvi.lParam;
- if (iod->name && _tcsstr(iod->name, STR_SEPARATOR))
+ if (iod->name && wcsstr(iod->name, STR_SEPARATOR))
return;
iod->name = mir_tstrdup(iod->defname);
@@ -461,7 +461,7 @@ public:
m_menuItems.GetItem(&tvi);
MenuItemOptData *iod = (MenuItemOptData *)tvi.lParam;
- if (iod->name && _tcsstr(iod->name, STR_SEPARATOR))
+ if (iod->name && wcsstr(iod->name, STR_SEPARATOR))
return;
iod->name = m_customName.GetText();
@@ -501,7 +501,7 @@ public:
return;
MenuItemOptData *iod = (MenuItemOptData *)tvi.lParam;
- if (iod->name && _tcsstr(iod->name, STR_SEPARATOR))
+ if (iod->name && wcsstr(iod->name, STR_SEPARATOR))
return;
m_customName.SetText(iod->name);
diff --git a/src/mir_app/src/menu_utils.cpp b/src/mir_app/src/menu_utils.cpp
index b03cec352a..91cb530e13 100644
--- a/src/mir_app/src/menu_utils.cpp
+++ b/src/mir_app/src/menu_utils.cpp
@@ -40,7 +40,7 @@ static void DumpMenuItem(TMO_IntMenuItem* pParent, int level = 0)
temp[level] = 0;
for (TMO_IntMenuItem *pimi = pParent; pimi != NULL; pimi = pimi->next) {
- Netlib_Logf(NULL, "%sMenu item %08p [%08p]: %S", temp, pimi, pimi->mi.root, pimi->mi.name.t);
+ Netlib_Logf(NULL, "%sMenu item %08p [%08p]: %S", temp, pimi, pimi->mi.root, pimi->mi.name.w);
TMO_IntMenuItem *submenu = pimi->submenu.first;
if (submenu)
@@ -76,9 +76,9 @@ TIntMenuObject* GetMenuObjbyId(int id)
LPTSTR GetMenuItemText(TMO_IntMenuItem *pimi)
{
if (pimi->mi.flags & CMIF_KEEPUNTRANSLATED)
- return pimi->mi.name.t;
+ return pimi->mi.name.w;
- return TranslateTH(pimi->mi.hLangpack, pimi->mi.name.t);
+ return TranslateTH(pimi->mi.hLangpack, pimi->mi.name.w);
}
///////////////////////////////////////////////////////////////////////////////
@@ -239,7 +239,7 @@ MIR_APP_DLL(HGENMENU) Menu_GetProtocolRoot(PROTO_INTERFACE *pThis)
// create protocol root in the main menu
CMenuItem mi;
- mi.name.t = pThis->m_tszUserName;
+ mi.name.w = pThis->m_tszUserName;
mi.position = 500090000;
mi.flags = CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
mi.hIcolibItem = pThis->m_hProtoIcon;
@@ -331,7 +331,7 @@ MIR_APP_DLL(void) Menu_SetChecked(HGENMENU hMenuItem, bool bSet)
/////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const TCHAR *ptszName, HANDLE hIcolib, int iFlags)
+MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const wchar_t *ptszName, HANDLE hIcolib, int iFlags)
{
if (!bIsGenMenuInited)
return -1;
@@ -343,7 +343,7 @@ MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const TCHAR *ptszName, HAND
return -1;
if (ptszName != NULL)
- replaceStrT(pimi->mi.name.t, ptszName);
+ replaceStrT(pimi->mi.name.w, ptszName);
if (iFlags != -1) {
Menu_SetItemFlags(hMenuItem, true, iFlags);
@@ -666,8 +666,8 @@ static int GetNextObjectMenuItemId()
static int FindRoot(TMO_IntMenuItem *pimi, void *param)
{
- if (pimi->mi.name.t != NULL)
- if (pimi->submenu.first && !mir_tstrcmp(pimi->mi.name.t, (TCHAR*)param))
+ if (pimi->mi.name.w != NULL)
+ if (pimi->submenu.first && !mir_tstrcmp(pimi->mi.name.w, (wchar_t*)param))
return TRUE;
return FALSE;
@@ -688,7 +688,7 @@ MIR_APP_DLL(HGENMENU) Menu_CreateRoot(int hMenuObject, LPCTSTR ptszName, int pos
mi.flags = CMIF_TCHAR;
mi.hIcolibItem = hIcoLib;
mi.hLangpack = _hLang;
- mi.name.t = (TCHAR*)ptszName;
+ mi.name.w = (wchar_t*)ptszName;
mi.position = position;
return Menu_AddItem(hMenuObject, &mi, NULL);
}
@@ -718,9 +718,9 @@ MIR_APP_DLL(HGENMENU) Menu_AddItem(int hMenuObject, TMO_MenuItem *pmi, void *pUs
p->pUserData = pUserData;
if (pmi->flags & CMIF_UNICODE)
- p->mi.name.t = mir_tstrdup(pmi->name.t);
+ p->mi.name.w = mir_tstrdup(pmi->name.w);
else
- p->mi.name.t = mir_a2u(pmi->name.a);
+ p->mi.name.w = mir_a2u(pmi->name.a);
if (pmi->hIcon != NULL && !bIconsDisabled) {
HANDLE hIcolibItem = IcoLib_IsManaged(pmi->hIcon);
@@ -861,9 +861,9 @@ static int sttReadOldItem(TMO_IntMenuItem *pmi, void *szModule)
if (pmi->pszUniqName)
mir_snprintf(menuItemName, "{%s}", pmi->pszUniqName);
else if (pmi->mi.flags & CMIF_UNICODE)
- mir_snprintf(menuItemName, "{%s}", (char*)_T2A(pmi->mi.name.t));
+ mir_snprintf(menuItemName, "{%s}", (char*)_T2A(pmi->mi.name.w));
else
- mir_snprintf(menuItemName, "{%s}", pmi->mi.name.t);
+ mir_snprintf(menuItemName, "{%s}", pmi->mi.name.w);
// check if it visible
mir_snprintf(szSetting, "%s_visible", menuItemName);
@@ -873,9 +873,9 @@ static int sttReadOldItem(TMO_IntMenuItem *pmi, void *szModule)
else
pmi->mi.flags |= CMIF_HIDDEN;
- // mi.name.t
+ // mi.name.w
mir_snprintf(szSetting, "%s_name", menuItemName);
- TCHAR *tszCustomName = db_get_tsa(NULL, (char*)szModule, szSetting);
+ wchar_t *tszCustomName = db_get_tsa(NULL, (char*)szModule, szSetting);
if (tszCustomName != NULL) {
mir_free(pmi->ptszCustomName);
pmi->ptszCustomName = tszCustomName;
@@ -898,7 +898,7 @@ static int sttDumpItem(TMO_IntMenuItem *pmi, void *szModule)
bin2hex(&pmi->mi.uid, sizeof(pmi->mi.uid), menuItemName);
int bVisible = (pmi->mi.flags & CMIF_HIDDEN) == 0;
- const TCHAR *ptszName = (pmi->ptszCustomName != NULL) ? pmi->ptszCustomName : L"";
+ const wchar_t *ptszName = (pmi->ptszCustomName != NULL) ? pmi->ptszCustomName : L"";
char szRootUid[33];
if (pmi->mi.root == NULL)
@@ -993,17 +993,17 @@ int Menu_LoadFromDatabase(TMO_IntMenuItem *pimi, void *szModule)
if (szValue == NULL)
return 0;
- TCHAR *ptszToken = szValue, *pDelim = _tcschr(szValue, ';');
+ wchar_t *ptszToken = szValue, *pDelim = wcschr(szValue, ';');
int bVisible = true, pos = 0;
- TCHAR tszCustomName[201]; tszCustomName[0] = 0;
+ wchar_t tszCustomName[201]; tszCustomName[0] = 0;
MUUID customRoot = {};
for (int i = 0; i < 4; i++) {
if (pDelim)
*pDelim = 0;
switch (i) {
- case 0: bVisible = _ttoi(ptszToken); break;
- case 1: pos = _ttoi(ptszToken); break;
+ case 0: bVisible = _wtoi(ptszToken); break;
+ case 1: pos = _wtoi(ptszToken); break;
case 2:
hex2binT(ptszToken, &customRoot, sizeof(customRoot));
if (customRoot == pimi->mi.uid) // prevent a loop
@@ -1012,9 +1012,9 @@ int Menu_LoadFromDatabase(TMO_IntMenuItem *pimi, void *szModule)
}
ptszToken = pDelim + 1;
- if ((pDelim = _tcschr(ptszToken, ';')) == NULL) {
+ if ((pDelim = wcschr(ptszToken, ';')) == NULL) {
if (i == 2 && *ptszToken != 0)
- _tcsncpy_s(tszCustomName, ptszToken, _TRUNCATE);
+ wcsncpy_s(tszCustomName, ptszToken, _TRUNCATE);
break;
}
}
@@ -1118,7 +1118,7 @@ static HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, WPARAM
if (pmi->mi.flags & CMIF_DEFAULT)
mii.fState |= MFS_DEFAULT;
- mii.dwTypeData = (pmi->ptszCustomName) ? pmi->ptszCustomName : mi->name.t;
+ mii.dwTypeData = (pmi->ptszCustomName) ? pmi->ptszCustomName : mi->name.w;
// it's a submenu
if (pmi->submenu.first) {
@@ -1127,7 +1127,7 @@ static HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, WPARAM
#ifdef PUTPOSITIONSONMENU
if (GetKeyState(VK_CONTROL) & 0x8000) {
- TCHAR str[256];
+ wchar_t str[256];
mir_sntprintf(str, L"%s (%d, id %x)", mi->name.a, mi->position, mii.dwItemData);
mii.dwTypeData = str;
}
@@ -1141,7 +1141,7 @@ static HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, WPARAM
#ifdef PUTPOSITIONSONMENU
if (GetKeyState(VK_CONTROL) & 0x8000) {
- TCHAR str[256];
+ wchar_t str[256];
mir_sntprintf(str, L"%s (%d, id %x)", mi->name.a, mi->position, mii.dwItemData);
mii.dwTypeData = str;
}
@@ -1214,14 +1214,14 @@ int OnIconLibChanges(WPARAM, LPARAM)
static int MO_RegisterIcon(TMO_IntMenuItem *pmi, void*)
{
- TCHAR *descr = GetMenuItemText(pmi);
+ wchar_t *descr = GetMenuItemText(pmi);
if (!descr || pmi->hIcolibItem != NULL || pmi->mi.uid == miid_last)
return FALSE;
HICON hIcon = ImageList_GetIcon(pmi->parent->m_hMenuIcons, pmi->iconId, 0);
- TCHAR sectionName[256];
- mir_sntprintf(sectionName, LPGENT("Menu icons") L"/%s", TranslateTS(pmi->parent->ptszDisplayName));
+ wchar_t sectionName[256];
+ mir_sntprintf(sectionName, LPGENW("Menu icons") L"/%s", TranslateTS(pmi->parent->ptszDisplayName));
char iconame[256], uname[100];
bin2hex(&pmi->mi.uid, sizeof(pmi->mi.uid), uname);
@@ -1229,13 +1229,13 @@ static int MO_RegisterIcon(TMO_IntMenuItem *pmi, void*)
// remove '&'
if (descr) {
- descr = NEWTSTR_ALLOCA(descr);
+ descr = NEWWSTR_ALLOCA(descr);
- for (TCHAR *p = descr; *p; p++) {
- if ((p = _tcschr(p, '&')) == NULL)
+ for (wchar_t *p = descr; *p; p++) {
+ if ((p = wcschr(p, '&')) == NULL)
break;
- memmove(p, p + 1, sizeof(TCHAR)*(mir_tstrlen(p + 1) + 1));
+ memmove(p, p + 1, sizeof(wchar_t)*(mir_tstrlen(p + 1) + 1));
if (*p == '\0')
p++;
}
@@ -1243,9 +1243,9 @@ static int MO_RegisterIcon(TMO_IntMenuItem *pmi, void*)
SKINICONDESC sid = { 0 };
sid.flags = SIDF_TCHAR;
- sid.section.t = sectionName;
+ sid.section.w = sectionName;
sid.pszName = iconame;
- sid.description.t = descr;
+ sid.description.w = descr;
sid.hDefaultIcon = hIcon;
pmi->hIcolibItem = IcoLib_AddIcon(&sid, 0);
@@ -1351,7 +1351,7 @@ void TIntMenuObject::freeItem(TMO_IntMenuItem *p)
CallService(FreeService, (WPARAM)p, (LPARAM)p->pUserData);
p->signature = 0;
- mir_free(p->mi.name.t);
+ mir_free(p->mi.name.w);
mir_free(p->pszUniqName);
mir_free(p->ptszCustomName);
if (p->hBmp) DeleteObject(p->hBmp);
diff --git a/src/mir_app/src/meta_addto.cpp b/src/mir_app/src/meta_addto.cpp
index e51af79104..19a59644f5 100644
--- a/src/mir_app/src/meta_addto.cpp
+++ b/src/mir_app/src/meta_addto.cpp
@@ -50,7 +50,7 @@ static int FillList(HWND list, BOOL sort)
continue;
// get contact display name from clist
- TCHAR *swzContactDisplayName = cli.pfnGetContactDisplayName(hMetaUser, 0);
+ wchar_t *swzContactDisplayName = cli.pfnGetContactDisplayName(hMetaUser, 0);
// don't insert huge strings that we have to compare with later
if (mir_tstrlen(swzContactDisplayName) > 1023)
swzContactDisplayName[1024] = 0;
@@ -58,7 +58,7 @@ static int FillList(HWND list, BOOL sort)
int pos = -1;
if (sort) {
for (pos = 0; pos < i; pos++) {
- TCHAR buff[1024];
+ wchar_t buff[1024];
SendMessage(list, LB_GETTEXT, pos, (LPARAM)buff);
if (mir_tstrcmp(buff, swzContactDisplayName) > 0)
break;
@@ -100,7 +100,7 @@ static int BuildList(HWND list, BOOL sort)
* @return TRUE if the dialog processed the message, FALSE if it did not.
*/
-#define szConvMsg LPGEN("Either there is no metacontact in the database (in this case you should first convert a contact into one)\n\
+#define szConvMsg LPGENW("Either there is no metacontact in the database (in this case you should first convert a contact into one)\n\
or there is none that can host this contact.\n\
Another solution could be to convert this contact into a new metacontact.\n\nConvert this contact into a new metacontact?")
@@ -141,19 +141,19 @@ static INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wPa
CheckDlgButton(hwndDlg, IDC_ONLYAVAIL, BST_CHECKED); // Initially checked; display all metacontacts is only an option
// Besides, we can check if there is at least one metacontact to add the contact to.
if (BuildList(GetDlgItem(hwndDlg, IDC_METALIST), FALSE) <= 0) {
- if (MessageBox(hwndDlg, TranslateT(szConvMsg), TranslateT("No suitable metacontact found"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1) == IDYES)
+ if (MessageBox(hwndDlg, TranslateTS(szConvMsg), TranslateT("No suitable metacontact found"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1) == IDYES)
Meta_Convert(lParam, 0);
DestroyWindow(hwndDlg);
return TRUE;
}
else {
// get contact display name from clist
- TCHAR *ptszCDN = cli.pfnGetContactDisplayName(lParam, 0);
+ wchar_t *ptszCDN = cli.pfnGetContactDisplayName(lParam, 0);
if (!ptszCDN)
ptszCDN = TranslateT("a contact");
// ... and set it to the Window title.
- TCHAR buf[256];
+ wchar_t buf[256];
mir_sntprintf(buf, TranslateT("Adding %s..."), ptszCDN);
SetWindowText(hwndDlg, buf);
}
@@ -187,7 +187,7 @@ static INT_PTR CALLBACK Meta_SelectDialogProc(HWND hwndDlg, UINT msg, WPARAM wPa
case IDC_CHK_SRT:
SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_METALIST), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_METALIST), GWL_STYLE) ^ LBS_SORT);
if (BuildList(GetDlgItem(hwndDlg, IDC_METALIST), IsDlgButtonChecked(hwndDlg, IDC_CHK_SRT) ? TRUE : FALSE) <= 0) {
- if (MessageBox(hwndDlg, TranslateT(szConvMsg), TranslateT("No suitable metacontact found"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1) == IDYES)
+ if (MessageBox(hwndDlg, TranslateTS(szConvMsg), TranslateT("No suitable metacontact found"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1) == IDYES)
Meta_Convert(lParam, 0);
DestroyWindow(hwndDlg);
return TRUE;
diff --git a/src/mir_app/src/meta_edit.cpp b/src/mir_app/src/meta_edit.cpp
index 376c431a73..ecb690d268 100644
--- a/src/mir_app/src/meta_edit.cpp
+++ b/src/mir_app/src/meta_edit.cpp
@@ -42,7 +42,7 @@ static g_data; // global CHANGES structure
static void FillContactList(HWND hList)
{
- TCHAR buff[256];
+ wchar_t buff[256];
SendMessage(hList, LVM_DELETEALLITEMS, 0, 0);
@@ -52,7 +52,7 @@ static void FillContactList(HWND hList)
for (int i = 0; i < g_data.num_contacts; i++) {
LvItem.iItem = i;
- TCHAR *ptszCDN = cli.pfnGetContactDisplayName(g_data.hContact[i], 0);
+ wchar_t *ptszCDN = cli.pfnGetContactDisplayName(g_data.hContact[i], 0);
if (ptszCDN == NULL)
ptszCDN = TranslateT("(Unknown contact)");
@@ -71,19 +71,19 @@ static void FillContactList(HWND hList)
if (!db_get(g_data.hContact[i], szProto, szField, &dbv)) {
switch (dbv.type) {
case DBVT_ASCIIZ:
- _tcsncpy_s(buff, _A2T(dbv.pszVal), _TRUNCATE);
+ wcsncpy_s(buff, _A2T(dbv.pszVal), _TRUNCATE);
break;
case DBVT_WCHAR:
- _tcsncpy_s(buff, dbv.ptszVal, _TRUNCATE);
+ wcsncpy_s(buff, dbv.ptszVal, _TRUNCATE);
break;
case DBVT_BYTE:
- _itot(dbv.bVal, buff, 10);
+ _itow(dbv.bVal, buff, 10);
break;
case DBVT_WORD:
- _itot(dbv.wVal, buff, 10);
+ _itow(dbv.wVal, buff, 10);
break;
case DBVT_DWORD:
- _itot(dbv.dVal, buff, 10);
+ _itow(dbv.dVal, buff, 10);
break;
default:
buff[0] = 0;
@@ -96,7 +96,7 @@ static void FillContactList(HWND hList)
SendMessage(hList, LVM_SETITEM, 0, (LPARAM)&LvItem); // Enter text to SubItems
LvItem.iSubItem = 2; // protocol
- _tcsncpy_s(buff, (pa == NULL) ? _A2T(szProto) : pa->tszAccountName, _TRUNCATE);
+ wcsncpy_s(buff, (pa == NULL) ? _A2T(szProto) : pa->tszAccountName, _TRUNCATE);
ListView_SetItem(hList, &LvItem);
}
else {
@@ -167,7 +167,7 @@ static void ApplyChanges()
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.hContact = g_data.hMeta;
ai.format = PA_FORMAT_UNKNOWN;
- _tcsncpy_s(ai.filename, L"X", _TRUNCATE);
+ wcsncpy_s(ai.filename, L"X", _TRUNCATE);
if (CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&ai) == GAIR_SUCCESS)
db_set_ts(g_data.hMeta, "ContactPhoto", "File", ai.filename);
}
@@ -270,7 +270,7 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara
case WMU_SETTITLE:
{
- TCHAR *ptszCDN = cli.pfnGetContactDisplayName(lParam, 0);
+ wchar_t *ptszCDN = cli.pfnGetContactDisplayName(lParam, 0);
if (ptszCDN == NULL)
ptszCDN = TranslateT("(Unknown contact)");
@@ -304,7 +304,7 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara
switch (LOWORD(wParam)) {
case IDC_VALIDATE: // Apply changes, if there is still one contact attached to the metacontact.
if (g_data.num_contacts == 0) { // Otherwise, delete the metacontact.
- if (IDYES == MessageBox(hwndDlg, TranslateT(szDelMsg), TranslateT("Delete metacontact?"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1)) {
+ if (IDYES == MessageBox(hwndDlg, TranslateTS(szDelMsg), TranslateT("Delete metacontact?"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1)) {
Meta_Delete(g_data.hMeta, 0);
DestroyWindow(hwndDlg);
}
@@ -319,7 +319,7 @@ static INT_PTR CALLBACK Meta_EditDialogProc(HWND hwndDlg, UINT msg, WPARAM wPara
case IDOK:
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_VALIDATE))) { // If there are changes that could be made,
if (g_data.num_contacts == 0) { // do the work that would have be done if the 'Apply' button was clicked.
- if (IDYES == MessageBox(hwndDlg, TranslateT(szDelMsg), TranslateT("Delete metacontact?"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1)) {
+ if (IDYES == MessageBox(hwndDlg, TranslateTS(szDelMsg), TranslateT("Delete metacontact?"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1)) {
Meta_Delete(g_data.hMeta, 0);
DestroyWindow(hwndDlg);
}
diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp
index 54f41af521..2f7693ae90 100644
--- a/src/mir_app/src/meta_menu.cpp
+++ b/src/mir_app/src/meta_menu.cpp
@@ -164,7 +164,7 @@ void Meta_RemoveContactNumber(DBCachedContact *ccMeta, int number, bool bUpdateI
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.hContact = ccMeta->contactID;
ai.format = PA_FORMAT_UNKNOWN;
- _tcsncpy_s(ai.filename, L"X", _TRUNCATE);
+ wcsncpy_s(ai.filename, L"X", _TRUNCATE);
if (CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&ai) == GAIR_SUCCESS)
db_set_ts(ccMeta->contactID, "ContactPhoto", "File", ai.filename);
@@ -207,7 +207,7 @@ INT_PTR Meta_Delete(WPARAM hContact, LPARAM bSkipQuestion)
return 2;
if (cc->nSubs == 1) {
- if (IDYES == MessageBox(0, TranslateT(szDelMsg), TranslateT("Delete metacontact?"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1))
+ if (IDYES == MessageBox(0, TranslateTS(szDelMsg), TranslateT("Delete metacontact?"), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON1))
Meta_Delete(cc->contactID, 1);
return 0;
@@ -263,7 +263,7 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM)
Menu_ShowItem(hMenuDefault, false);
Menu_ShowItem(hMenuDelete, false);
- Menu_ModifyItem(hMenuDelete, LPGENT("Remove from metacontact"));
+ Menu_ModifyItem(hMenuDelete, LPGENW("Remove from metacontact"));
// show subcontact menu items
CMString tszNick;
@@ -311,7 +311,7 @@ int Meta_ModifyMenu(WPARAM hMeta, LPARAM)
if (cc->IsSub()) {
Menu_ShowItem(hMenuDefault, true);
- Menu_ModifyItem(hMenuDelete, LPGENT("Remove from metacontact"));
+ Menu_ModifyItem(hMenuDelete, LPGENW("Remove from metacontact"));
Menu_ShowItem(hMenuDelete, true);
Menu_ShowItem(hMenuAdd, false);
@@ -342,9 +342,9 @@ INT_PTR Meta_OnOff(WPARAM, LPARAM)
bool bToggled = !db_mc_isEnabled();
db_set_b(0, META_PROTO, "Enabled", bToggled);
if (bToggled)
- Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts off"), Meta_GetIconHandle(I_MENU));
+ Menu_ModifyItem(hMenuOnOff, LPGENW("Toggle metacontacts off"), Meta_GetIconHandle(I_MENU));
else
- Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts on"), Meta_GetIconHandle(I_MENUOFF));
+ Menu_ModifyItem(hMenuOnOff, LPGENW("Toggle metacontacts on"), Meta_GetIconHandle(I_MENUOFF));
db_mc_enable(bToggled);
Meta_HideMetaContacts(!bToggled);
@@ -427,7 +427,7 @@ void InitMenus()
if (!db_mc_isEnabled()) {
// modify main menu item
- Menu_ModifyItem(hMenuOnOff, LPGENT("Toggle metacontacts on"), Meta_GetIconHandle(I_MENUOFF));
+ Menu_ModifyItem(hMenuOnOff, LPGENW("Toggle metacontacts on"), Meta_GetIconHandle(I_MENUOFF));
Meta_HideMetaContacts(true);
}
else {
diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp
index 4961d73f12..99d31ad899 100644
--- a/src/mir_app/src/meta_services.cpp
+++ b/src/mir_app/src/meta_services.cpp
@@ -446,7 +446,7 @@ int Meta_SettingChanged(WPARAM hContact, LPARAM lParam)
PROTO_AVATAR_INFORMATION ai = { 0 };
ai.hContact = ccMeta->contactID;
ai.format = PA_FORMAT_UNKNOWN;
- _tcsncpy_s(ai.filename, L"X", _TRUNCATE);
+ wcsncpy_s(ai.filename, L"X", _TRUNCATE);
if (CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&ai) == GAIR_SUCCESS)
db_set_ts(ccMeta->contactID, "ContactPhoto", "File", ai.filename);
}
@@ -654,7 +654,7 @@ int Meta_ModulesLoaded(WPARAM, LPARAM)
StatusIconData sid = { sizeof(sid) };
sid.szModule = META_PROTO;
sid.flags = MBF_TCHAR;
- sid.tszTooltip = LPGENT("Select metacontact");
+ sid.tszTooltip = LPGENW("Select metacontact");
sid.hIcon = Skin_LoadProtoIcon(META_PROTO, ID_STATUS_ONLINE);
Srmm_AddIcon(&sid);
return 0;
@@ -796,7 +796,7 @@ INT_PTR Meta_GetInfo(WPARAM, LPARAM lParam)
PROTO_AVATAR_INFORMATION ai;
ai.hContact = ccs->hContact;
ai.format = PA_FORMAT_UNKNOWN;
- _tcsncpy_s(ai.filename, L"X", _TRUNCATE);
+ wcsncpy_s(ai.filename, L"X", _TRUNCATE);
if (CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&ai) == GAIR_SUCCESS)
db_set_ts(ccs->hContact, "ContactPhoto", "File", ai.filename);
diff --git a/src/mir_app/src/meta_utils.cpp b/src/mir_app/src/meta_utils.cpp
index 99e307af66..ddf0937972 100644
--- a/src/mir_app/src/meta_utils.cpp
+++ b/src/mir_app/src/meta_utils.cpp
@@ -140,7 +140,7 @@ BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default)
// write status string
mir_snprintf(buffer, "StatusString%d", ccDest->nSubs);
- TCHAR *szStatus = cli.pfnGetStatusModeDescription(status, 0);
+ wchar_t *szStatus = cli.pfnGetStatusModeDescription(status, 0);
db_set_ts(hMeta, META_PROTO, buffer, szStatus);
// Write the link in the contact
@@ -170,7 +170,7 @@ BOOL Meta_Assign(MCONTACT hSub, MCONTACT hMeta, BOOL set_as_default)
PROTO_AVATAR_INFORMATION ai;
ai.hContact = hMeta;
ai.format = PA_FORMAT_UNKNOWN;
- _tcsncpy_s(ai.filename, L"X", _TRUNCATE);
+ wcsncpy_s(ai.filename, L"X", _TRUNCATE);
if (CallProtoService(META_PROTO, PS_GETAVATARINFO, 0, (LPARAM)&ai) == GAIR_SUCCESS)
db_set_ts(hMeta, "ContactPhoto", "File", ai.filename);
@@ -438,7 +438,7 @@ int Meta_CopyContactNick(DBCachedContact *ccMeta, MCONTACT hContact)
}
}
else if (options.clist_contact_name == CNNT_DISPLAYNAME) {
- TCHAR *name = cli.pfnGetContactDisplayName(hContact, 0);
+ wchar_t *name = cli.pfnGetContactDisplayName(hContact, 0);
if (name && mir_tstrcmp(name, TranslateT("(Unknown contact)")) != 0) {
db_set_ts(ccMeta->contactID, META_PROTO, "Nick", name);
return 0;
diff --git a/src/mir_app/src/metacontacts.h b/src/mir_app/src/metacontacts.h
index e0a3210c2e..c47b419729 100644
--- a/src/mir_app/src/metacontacts.h
+++ b/src/mir_app/src/metacontacts.h
@@ -124,6 +124,6 @@ extern POINT menuMousePoint;
#ifndef MS_CLUI_GETVERSION
#define MS_CLUI_GETVERSION "CLUI/GetVersion"
-#define szDelMsg LPGEN("You are going to remove all the contacts associated with this metacontact.\nThis will delete the metacontact.\n\nProceed anyway?")
+#define szDelMsg LPGENW("You are going to remove all the contacts associated with this metacontact.\nThis will delete the metacontact.\n\nProceed anyway?")
#endif
diff --git a/src/mir_app/src/miranda.cpp b/src/mir_app/src/miranda.cpp
index 12886122d8..f09b54e83c 100644
--- a/src/mir_app/src/miranda.cpp
+++ b/src/mir_app/src/miranda.cpp
@@ -179,7 +179,7 @@ INT_PTR CheckRestart()
{
LPCTSTR tszPID = CmdLine_GetOption(L"restart");
if (tszPID) {
- HANDLE hProcess = OpenProcess(SYNCHRONIZE, FALSE, _ttol(tszPID));
+ HANDLE hProcess = OpenProcess(SYNCHRONIZE, FALSE, _wtol(tszPID));
if (hProcess) {
INT_PTR result = DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_WAITRESTART), NULL, WaitForProcessDlgProc, (LPARAM)hProcess);
CloseHandle(hProcess);
@@ -324,7 +324,7 @@ static INT_PTR OkToExit(WPARAM, LPARAM)
static INT_PTR GetMirandaVersion(WPARAM, LPARAM)
{
- TCHAR filename[MAX_PATH];
+ wchar_t filename[MAX_PATH];
GetModuleFileName(g_hInst, filename, _countof(filename));
DWORD unused, verInfoSize = GetFileVersionInfoSize(filename, &unused);
@@ -343,7 +343,7 @@ static INT_PTR GetMirandaVersion(WPARAM, LPARAM)
static INT_PTR GetMirandaFileVersion(WPARAM, LPARAM lParam)
{
- TCHAR filename[MAX_PATH];
+ wchar_t filename[MAX_PATH];
GetModuleFileName(g_hInst, filename, _countof(filename));
DWORD unused, verInfoSize = GetFileVersionInfoSize(filename, &unused);
@@ -364,7 +364,7 @@ static INT_PTR GetMirandaFileVersion(WPARAM, LPARAM lParam)
static INT_PTR GetMirandaVersionText(WPARAM wParam, LPARAM lParam)
{
- TCHAR filename[MAX_PATH], *productVersion;
+ wchar_t filename[MAX_PATH], *productVersion;
GetModuleFileName(g_hInst, filename, _countof(filename));
DWORD unused, verInfoSize = GetFileVersionInfoSize(filename, &unused);
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h
index 0a46080262..c83fa8e4bf 100644
--- a/src/mir_app/src/miranda.h
+++ b/src/mir_app/src/miranda.h
@@ -64,7 +64,7 @@ void UninitIni(void);
extern HINSTANCE g_hInst;
extern DWORD hMainThreadId;
extern HANDLE hOkToExitEvent, hModulesLoadedEvent, hevLoadModule, hevUnloadModule;
-extern TCHAR mirandabootini[MAX_PATH];
+extern wchar_t mirandabootini[MAX_PATH];
/**** newplugins.cpp *******************************************************************/
@@ -92,7 +92,7 @@ __forceinline char* Utf8DecodeA(const char* src)
/**** options.cpp **********************************************************************/
-HTREEITEM FindNamedTreeItemAtRoot(HWND hwndTree, const TCHAR* name);
+HTREEITEM FindNamedTreeItemAtRoot(HWND hwndTree, const wchar_t* name);
/**** skinicons.cpp ********************************************************************/
@@ -137,7 +137,7 @@ extern LIST<PROTOCOLDESCRIPTOR> protos;
INT_PTR ProtoCallService(LPCSTR szModule, const char *szService, WPARAM wParam, LPARAM lParam);
-PROTOACCOUNT* Proto_CreateAccount(const char *szModuleName, const char *szBaseProto, const TCHAR *tszAccountName);
+PROTOACCOUNT* Proto_CreateAccount(const char *szModuleName, const char *szBaseProto, const wchar_t *tszAccountName);
PROTOACCOUNT* __fastcall Proto_GetAccount(MCONTACT hContact);
@@ -160,7 +160,7 @@ INT_PTR stubChainRecv(WPARAM, LPARAM);
/**** utils.cpp ************************************************************************/
-void HotkeyToName(TCHAR *buf, int size, BYTE shift, BYTE key);
+void HotkeyToName(wchar_t *buf, int size, BYTE shift, BYTE key);
WORD GetHotkeyValue(INT_PTR idHotkey);
HBITMAP ConvertIconToBitmap(HIMAGELIST hIml, int iconId);
diff --git a/src/mir_app/src/movetogroup.cpp b/src/mir_app/src/movetogroup.cpp
index 59f34959ee..318be7e4d9 100644
--- a/src/mir_app/src/movetogroup.cpp
+++ b/src/mir_app/src/movetogroup.cpp
@@ -31,10 +31,10 @@ static LIST<HANDLE> lphGroupsItems(5);
struct GroupItemSort
{
- TCHAR* name;
+ wchar_t* name;
int position;
- GroupItemSort(TCHAR* pname, int pos)
+ GroupItemSort(wchar_t* pname, int pos)
: name(mir_tstrdup(pname)), position(pos)
{
}
@@ -47,13 +47,13 @@ struct GroupItemSort
}
};
-static TCHAR* PrepareGroupName(TCHAR* str)
+static wchar_t* PrepareGroupName(wchar_t* str)
{
- TCHAR* p = _tcschr(str, '&'), *d;
+ wchar_t* p = wcschr(str, '&'), *d;
if (p == NULL)
return mir_tstrdup(str);
- d = p = (TCHAR*)mir_alloc(sizeof(TCHAR)*(2 * mir_tstrlen(str) + 1));
+ d = p = (wchar_t*)mir_alloc(sizeof(wchar_t)*(2 * mir_tstrlen(str) + 1));
while (*str) {
if (*str == '&')
*d++ = '&';
@@ -64,12 +64,12 @@ static TCHAR* PrepareGroupName(TCHAR* str)
return p;
}
-static void AddGroupItem(HGENMENU hRoot, TCHAR* name, int pos, WPARAM param, bool checked)
+static void AddGroupItem(HGENMENU hRoot, wchar_t* name, int pos, WPARAM param, bool checked)
{
CMenuItem mi;
mi.root = hRoot;
mi.position = pos;
- mi.name.t = PrepareGroupName(name);
+ mi.name.w = PrepareGroupName(name);
mi.flags = CMIF_SYSTEM | CMIF_TCHAR | CMIF_KEEPUNTRANSLATED;
if (checked)
mi.flags |= CMIF_CHECKED;
@@ -78,7 +78,7 @@ static void AddGroupItem(HGENMENU hRoot, TCHAR* name, int pos, WPARAM param, boo
Menu_ConfigureItem(result, MCI_OPT_EXECPARAM, param);
lphGroupsItems.insert((HANDLE*)result);
- mir_free(mi.name.t);
+ mir_free(mi.name.w);
}
// service
diff --git a/src/mir_app/src/netlib.h b/src/mir_app/src/netlib.h
index f653de6f8f..0332a61a2a 100644
--- a/src/mir_app/src/netlib.h
+++ b/src/mir_app/src/netlib.h
@@ -283,9 +283,9 @@ void NetlibUPnPDestroy(void);
//netlibsecurity.c
void NetlibSecurityInit(void);
void NetlibDestroySecurityProvider(HANDLE hSecurity);
-HANDLE NetlibInitSecurityProvider(const TCHAR* szProvider, const TCHAR* szPrincipal);
+HANDLE NetlibInitSecurityProvider(const wchar_t* szProvider, const wchar_t* szPrincipal);
HANDLE NetlibInitSecurityProvider(const char* szProvider, const char* szPrincipal);
-char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, const TCHAR* login, const TCHAR* psw,
+char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, const wchar_t* login, const wchar_t* psw,
bool http, unsigned& complete);
static __inline INT_PTR NLSend(NetlibConnection *nlc, const char *buf, int len, int flags) {
diff --git a/src/mir_app/src/netliblog.cpp b/src/mir_app/src/netliblog.cpp
index b65e7f1d0a..7afeb86917 100644
--- a/src/mir_app/src/netliblog.cpp
+++ b/src/mir_app/src/netliblog.cpp
@@ -68,7 +68,7 @@ static void InitLog()
if (mir_tstrlen(szBuf)) {
logOptions.tszUserFile = szBuf.get();
- TCHAR path[MAX_PATH];
+ wchar_t path[MAX_PATH];
PathToAbsoluteT(VARST(szBuf), path);
logOptions.tszFile = path;
}
@@ -78,20 +78,20 @@ static void InitLog()
}
if (logOptions.toFile)
- hLogger = mir_createLog("Netlib", LPGENT("Standard Netlib log"), logOptions.tszFile, 0);
+ hLogger = mir_createLog("Netlib", LPGENW("Standard Netlib log"), logOptions.tszFile, 0);
}
-static const TCHAR* szTimeFormats[] =
+static const wchar_t* szTimeFormats[] =
{
- LPGENT("No times"),
- LPGENT("Standard hh:mm:ss times"),
- LPGENT("Times in milliseconds"),
- LPGENT("Times in microseconds")
+ LPGENW("No times"),
+ LPGENW("Standard hh:mm:ss times"),
+ LPGENW("Times in milliseconds"),
+ LPGENW("Times in microseconds")
};
static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
- TCHAR str[MAX_PATH];
+ wchar_t str[MAX_PATH];
switch (message) {
case WM_INITDIALOG:
@@ -147,7 +147,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
if ((HWND)lParam == GetFocus())
CheckDlgButton(hwndDlg, IDC_TOFILE, BST_CHECKED);
- TCHAR path[MAX_PATH];
+ wchar_t path[MAX_PATH];
GetWindowText((HWND)lParam, path, _countof(path));
PathToAbsoluteT(VARST(path), path);
@@ -159,7 +159,7 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
case IDC_RUNATSTARTBROWSE:
GetWindowText(GetWindow((HWND)lParam, GW_HWNDPREV), str, _countof(str));
{
- TCHAR filter[200];
+ wchar_t filter[200];
mir_sntprintf(filter, L"%s (*)%c*%c", TranslateT("All files"), 0, 0);
OPENFILENAME ofn = { 0 };
@@ -182,8 +182,8 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa
else if (!GetOpenFileName(&ofn))
return 1;
- if (LOWORD(wParam) == IDC_RUNATSTARTBROWSE && _tcschr(str, ' ') != NULL) {
- memmove(str + 1, str, ((_countof(str) - 2) * sizeof(TCHAR)));
+ if (LOWORD(wParam) == IDC_RUNATSTARTBROWSE && wcschr(str, ' ') != NULL) {
+ memmove(str + 1, str, ((_countof(str) - 2) * sizeof(wchar_t)));
str[0] = '"';
mir_tstrcat(str, L"\"");
}
diff --git a/src/mir_app/src/netlibopts.cpp b/src/mir_app/src/netlibopts.cpp
index 1423761260..ffdde641fd 100644
--- a/src/mir_app/src/netlibopts.cpp
+++ b/src/mir_app/src/netlibopts.cpp
@@ -67,7 +67,7 @@ static const UINT specifyPortsControls[] = {
IDC_PORTSRANGE,
IDC_STATIC52};
-static const TCHAR* szProxyTypes[] = {LPGENT("<mixed>"), L"SOCKS4", L"SOCKS5", L"HTTP", L"HTTPS", L"Internet Explorer"};
+static const wchar_t* szProxyTypes[] = {LPGENW("<mixed>"), L"SOCKS4", L"SOCKS5", L"HTTP", L"HTTPS", L"Internet Explorer"};
static const WORD oftenProxyPorts[] = {1080, 1080, 1080, 8080, 8080, 8080};
#define M_REFRESHALL (WM_USER+100)
@@ -338,7 +338,7 @@ static INT_PTR CALLBACK DlgProcNetlibOpts(HWND hwndDlg, UINT msg, WPARAM wParam,
break;
case M_REFRESHENABLING:
- TCHAR str[80];
+ wchar_t str[80];
{
int selectedProxyType = SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_GETCURSEL, 0, 0), 0);
mir_sntprintf(str, TranslateT("(often %d)"), oftenProxyPorts[selectedProxyType]);
diff --git a/src/mir_app/src/netlibsecurity.cpp b/src/mir_app/src/netlibsecurity.cpp
index 24d095ec00..981a2b4dcd 100644
--- a/src/mir_app/src/netlibsecurity.cpp
+++ b/src/mir_app/src/netlibsecurity.cpp
@@ -35,8 +35,8 @@ struct NtlmHandleType
{
CtxtHandle hClientContext;
CredHandle hClientCredential;
- TCHAR* szProvider;
- TCHAR* szPrincipal;
+ wchar_t* szProvider;
+ wchar_t* szPrincipal;
unsigned cbMaxToken;
bool hasDomain;
};
@@ -73,7 +73,7 @@ static void ReportSecError(SECURITY_STATUS scRet, int line)
NetlibLogf(NULL, "Security error 0x%x on line %u (%s)", scRet, line, szMsgBuf);
}
-HANDLE NetlibInitSecurityProvider(const TCHAR* szProvider, const TCHAR* szPrincipal)
+HANDLE NetlibInitSecurityProvider(const wchar_t* szProvider, const wchar_t* szPrincipal)
{
HANDLE hSecurity = NULL;
@@ -91,7 +91,7 @@ HANDLE NetlibInitSecurityProvider(const TCHAR* szProvider, const TCHAR* szPrinci
PSecPkgInfo ntlmSecurityPackageInfo;
bool isGSSAPI = mir_tstrcmpi(szProvider, L"GSSAPI") == 0;
- const TCHAR *szProviderC = isGSSAPI ? L"Kerberos" : szProvider;
+ const wchar_t *szProviderC = isGSSAPI ? L"Kerberos" : szProvider;
SECURITY_STATUS sc = QuerySecurityPackageInfo((LPTSTR)szProviderC, &ntlmSecurityPackageInfo);
if (sc == SEC_E_OK) {
NtlmHandleType* hNtlm;
@@ -201,7 +201,7 @@ char* CompleteGssapi(HANDLE hSecurity, unsigned char *szChallenge, unsigned chls
return mir_base64_encode(response, ressz);
}
-char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, const TCHAR* login, const TCHAR* psw, bool http, unsigned& complete)
+char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge, const wchar_t* login, const wchar_t* psw, bool http, unsigned& complete)
{
if (hSecurity == NULL || ntlmCnt == 0)
return NULL;
@@ -215,7 +215,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
NtlmHandleType* hNtlm = (NtlmHandleType*)hSecurity;
if (mir_tstrcmpi(hNtlm->szProvider, L"Basic")) {
bool isGSSAPI = mir_tstrcmpi(hNtlm->szProvider, L"GSSAPI") == 0;
- TCHAR *szProvider = isGSSAPI ? (TCHAR*)L"Kerberos" : hNtlm->szProvider;
+ wchar_t *szProvider = isGSSAPI ? (wchar_t*)L"Kerberos" : hNtlm->szProvider;
bool hasChallenge = szChallenge != NULL && szChallenge[0] != '\0';
if (hasChallenge) {
unsigned tokenLen;
@@ -252,9 +252,9 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
if (domainLen) {
size_t newLoginLen = mir_tstrlen(login) + domainLen + 1;
- TCHAR *newLogin = (TCHAR*)alloca(newLoginLen * sizeof(TCHAR));
+ wchar_t *newLogin = (wchar_t*)alloca(newLoginLen * sizeof(wchar_t));
- _tcsncpy(newLogin, domainName, domainLen);
+ wcsncpy(newLogin, domainName, domainLen);
newLogin[domainLen] = '\\';
mir_tstrcpy(newLogin + domainLen + 1, login);
@@ -277,8 +277,8 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
NetlibLogf(NULL, "Security login requested, user: %S pssw: %s", login, psw ? "(exist)" : "(no psw)");
- const TCHAR* loginName = login;
- const TCHAR* domainName = _tcschr(login, '\\');
+ const wchar_t* loginName = login;
+ const wchar_t* domainName = wcschr(login, '\\');
size_t domainLen = 0;
size_t loginLen = mir_tstrlen(loginName);
if (domainName != NULL) {
@@ -287,7 +287,7 @@ char* NtlmCreateResponseFromChallenge(HANDLE hSecurity, const char *szChallenge,
domainLen = domainName - login;
domainName = login;
}
- else if ((domainName = _tcschr(login, '@')) != NULL) {
+ else if ((domainName = wcschr(login, '@')) != NULL) {
loginName = login;
loginLen = domainName - login;
domainLen = mir_tstrlen(++domainName);
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp
index 6b187cc73f..1e1bb4c995 100644
--- a/src/mir_app/src/newplugins.cpp
+++ b/src/mir_app/src/newplugins.cpp
@@ -61,7 +61,7 @@ MUUID miid_ssl = MIID_SSL;
static BOOL bModuleInitialized = FALSE;
-TCHAR mirandabootini[MAX_PATH];
+wchar_t mirandabootini[MAX_PATH];
static DWORD mirandaVersion;
static int sttFakeID = -100;
static HANDLE hPluginListHeap = NULL;
@@ -256,7 +256,7 @@ static int checkPI(BASIC_PLUGIN_INFO* bpi, PLUGININFOEX* pi)
return TRUE;
}
-int checkAPI(TCHAR* plugin, BASIC_PLUGIN_INFO* bpi, DWORD dwMirVer, int checkTypeAPI)
+int checkAPI(wchar_t* plugin, BASIC_PLUGIN_INFO* bpi, DWORD dwMirVer, int checkTypeAPI)
{
HINSTANCE h = LoadLibrary(plugin);
if (h == NULL)
@@ -370,9 +370,9 @@ int Plugin_UnloadDyn(pluginEntry *p)
}
// returns true if the given file is <anything>.dll exactly
-static int valid_library_name(TCHAR *name)
+static int valid_library_name(wchar_t *name)
{
- TCHAR *dot = _tcsrchr(name, '.');
+ wchar_t *dot = wcsrchr(name, '.');
if (dot != NULL && mir_tstrcmpi(dot + 1, L"dll") == 0)
if (dot[4] == 0)
return 1;
@@ -383,12 +383,12 @@ static int valid_library_name(TCHAR *name)
void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam)
{
// get miranda's exe path
- TCHAR exe[MAX_PATH];
+ wchar_t exe[MAX_PATH];
GetModuleFileName(NULL, exe, _countof(exe));
- TCHAR *p = _tcsrchr(exe, '\\'); if (p) *p = 0;
+ wchar_t *p = wcsrchr(exe, '\\'); if (p) *p = 0;
// create the search filter
- TCHAR search[MAX_PATH];
+ wchar_t search[MAX_PATH];
mir_sntprintf(search, L"%s\\Plugins\\*.dll", exe);
// FFFN will return filenames for things like dot dll+ or dot dllx
@@ -404,15 +404,15 @@ void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam)
FindClose(hFind);
}
-pluginEntry* OpenPlugin(TCHAR *tszFileName, TCHAR *dir, TCHAR *path)
+pluginEntry* OpenPlugin(wchar_t *tszFileName, wchar_t *dir, wchar_t *path)
{
pluginEntry *p = (pluginEntry*)HeapAlloc(hPluginListHeap, HEAP_NO_SERIALIZE | HEAP_ZERO_MEMORY, sizeof(pluginEntry));
- _tcsncpy_s(p->pluginname, tszFileName, _TRUNCATE);
+ wcsncpy_s(p->pluginname, tszFileName, _TRUNCATE);
// add it to the list anyway
pluginList.insert(p);
- TCHAR tszFullPath[MAX_PATH];
+ wchar_t tszFullPath[MAX_PATH];
mir_sntprintf(tszFullPath, L"%s\\%s\\%s", path, dir, tszFileName);
// map dll into the memory and check its exports
@@ -471,17 +471,17 @@ pluginEntry* OpenPlugin(TCHAR *tszFileName, TCHAR *dir, TCHAR *path)
return p;
}
-void SetPluginOnWhiteList(const TCHAR* pluginname, int allow)
+void SetPluginOnWhiteList(const wchar_t* pluginname, int allow)
{
db_set_b(NULL, PLUGINDISABLELIST, _strlwr(_T2A(pluginname)), allow == 0);
}
// returns 1 if the plugin should be enabled within this profile, filename is always lower case
-int isPluginOnWhiteList(const TCHAR* pluginname)
+int isPluginOnWhiteList(const wchar_t* pluginname)
{
int rc = db_get_b(NULL, PLUGINDISABLELIST, _strlwr(_T2A(pluginname)), 0);
if (rc != 0 && askAboutIgnoredPlugins) {
- TCHAR buf[256];
+ wchar_t buf[256];
mir_sntprintf(buf, TranslateT("'%s' is disabled, re-enable?"), pluginname);
if (MessageBox(NULL, buf, TranslateT("Re-enable Miranda plugin?"), MB_YESNO | MB_ICONQUESTION) == IDYES) {
SetPluginOnWhiteList(pluginname, 1);
@@ -494,9 +494,9 @@ int isPluginOnWhiteList(const TCHAR* pluginname)
bool TryLoadPlugin(pluginEntry *p, bool bDynamic)
{
- TCHAR exe[MAX_PATH], tszFullPath[MAX_PATH];
+ wchar_t exe[MAX_PATH], tszFullPath[MAX_PATH];
GetModuleFileName(NULL, exe, _countof(exe));
- TCHAR* slice = _tcsrchr(exe, '\\');
+ wchar_t* slice = wcsrchr(exe, '\\');
if (slice)
*slice = 0;
@@ -557,13 +557,13 @@ bool TryLoadPlugin(pluginEntry *p, bool bDynamic)
/////////////////////////////////////////////////////////////////////////////////////////
// Core plugins support
-static TCHAR tszCoreErr[] = LPGENT("Core plugin '%s' cannot be loaded or missing. Miranda will exit now");
+static wchar_t tszCoreErr[] = LPGENW("Core plugin '%s' cannot be loaded or missing. Miranda will exit now");
bool LoadCorePlugin(MuuidReplacement &mr)
{
- TCHAR exe[MAX_PATH], tszPlugName[MAX_PATH];
+ wchar_t exe[MAX_PATH], tszPlugName[MAX_PATH];
GetModuleFileName(NULL, exe, _countof(exe));
- TCHAR *p = _tcsrchr(exe, '\\'); if (p) *p = 0;
+ wchar_t *p = wcsrchr(exe, '\\'); if (p) *p = 0;
mir_sntprintf(tszPlugName, L"%s.dll", mr.stdplugname);
pluginEntry* pPlug = OpenPlugin(tszPlugName, L"Core", exe);
@@ -594,7 +594,7 @@ LBL_Error:
/////////////////////////////////////////////////////////////////////////////////////////
// Contact list plugins support
-static bool loadClistModule(TCHAR* exe, pluginEntry *p)
+static bool loadClistModule(wchar_t* exe, pluginEntry *p)
{
BASIC_PLUGIN_INFO bpi;
if (checkAPI(exe, &bpi, mirandaVersion, CHECKAPI_CLIST)) {
@@ -614,9 +614,9 @@ static bool loadClistModule(TCHAR* exe, pluginEntry *p)
return false;
}
-static pluginEntry* getCListModule(TCHAR *exe)
+static pluginEntry* getCListModule(wchar_t *exe)
{
- TCHAR tszFullPath[MAX_PATH];
+ wchar_t tszFullPath[MAX_PATH];
for (int i = 0; i < clistPlugins.getCount(); i++) {
pluginEntry *p = clistPlugins[i];
@@ -638,7 +638,7 @@ static pluginEntry* getCListModule(TCHAR *exe)
return NULL;
}
-int UnloadPlugin(TCHAR* buf, int bufLen)
+int UnloadPlugin(wchar_t* buf, int bufLen)
{
for (int i = pluginList.getCount() - 1; i >= 0; i--) {
pluginEntry *p = pluginList[i];
@@ -689,7 +689,7 @@ int LoadDefaultServiceModePlugin()
size_t cbLen = mir_tstrlen(param);
for (int i = 0; i < servicePlugins.getCount(); i++) {
pluginEntry *p = servicePlugins[i];
- if (!_tcsnicmp(p->pluginname, param, cbLen)) {
+ if (!wcsnicmp(p->pluginname, param, cbLen)) {
int res = LaunchServicePlugin(p);
if (res == SERVICE_ONLYDB) // load it later
serviceModePlugin = p;
@@ -772,9 +772,9 @@ void UnloadNewPlugins(void)
int LoadNewPluginsModule(void)
{
// make full path to the plugin
- TCHAR exe[MAX_PATH], fullPath[MAX_PATH];
+ wchar_t exe[MAX_PATH], fullPath[MAX_PATH];
GetModuleFileName(NULL, exe, _countof(exe));
- TCHAR *slice = _tcsrchr(exe, '\\');
+ wchar_t *slice = wcsrchr(exe, '\\');
if (slice)
*slice = 0;
@@ -834,7 +834,7 @@ int LoadNewPluginsModule(void)
// Plugins module initialization
// called before anything real is loaded, incl. database
-static BOOL scanPluginsDir(WIN32_FIND_DATA *fd, TCHAR *path, WPARAM, LPARAM)
+static BOOL scanPluginsDir(WIN32_FIND_DATA *fd, wchar_t *path, WPARAM, LPARAM)
{
pluginEntry *p = OpenPlugin(fd->cFileName, L"Plugins", path);
if (!(p->pclass & PCLASS_FAILED)) {
diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp
index 61d1d81b16..f26424a933 100644
--- a/src/mir_app/src/options.cpp
+++ b/src/mir_app/src/options.cpp
@@ -28,8 +28,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define FILTER_TIMEOUT_TIMER 10012
-#define ALL_MODULES_FILTER LPGEN("<all modules>")
-#define CORE_MODULES_FILTER LPGEN("<core modules>")
+#define ALL_MODULES_FILTER LPGENW("<all modules>")
+#define CORE_MODULES_FILTER LPGENW("<core modules>")
int LangpackOptionsInit(WPARAM, LPARAM);
@@ -92,17 +92,17 @@ struct OptionsPageData : public MZeroedObject
hLangpack = src->hLangpack;
if (src->flags & ODPF_UNICODE)
- ptszTitle = mir_tstrdup(src->ptszTitle);
+ ptszTitle = mir_tstrdup(src->pwszTitle);
else
ptszTitle = mir_a2t(src->pszTitle);
if (src->flags & ODPF_UNICODE)
- ptszGroup = mir_tstrdup(src->ptszGroup);
+ ptszGroup = mir_tstrdup(src->pwszGroup);
else
ptszGroup = mir_a2t(src->pszGroup);
if (src->flags & ODPF_UNICODE)
- ptszTab = mir_tstrdup(src->ptszTab);
+ ptszTab = mir_tstrdup(src->pwszTab);
else
ptszTab = mir_a2t(src->pszTab);
}
@@ -115,7 +115,7 @@ struct OptionsPageData : public MZeroedObject
CDlgBase *pDialog;
int hLangpack;
- ptrT ptszTitle, ptszGroup, ptszTab;
+ ptrW ptszTitle, ptszGroup, ptszTab;
HTREEITEM hTreeItem;
int changed;
int height;
@@ -126,7 +126,7 @@ struct OptionsPageData : public MZeroedObject
__forceinline HWND getHwnd() const { return pDialog->GetHwnd(); }
__forceinline HINSTANCE getInst() const { return pDialog->GetInst(); }
- __forceinline TCHAR* getString(TCHAR *ptszStr)
+ __forceinline wchar_t* getString(wchar_t *ptszStr)
{
if (flags & ODPF_DONTTRANSLATE)
return ptszStr;
@@ -146,7 +146,7 @@ struct OptionsDlgData : public MZeroedObject
RECT rcDisplay;
RECT rcTab;
HFONT hBoldFont;
- TCHAR szFilterString[1024];
+ wchar_t szFilterString[1024];
HANDLE hPluginLoad, hPluginUnload;
OptionsPageData* getCurrent() const
@@ -154,9 +154,9 @@ struct OptionsDlgData : public MZeroedObject
}
};
-HTREEITEM FindNamedTreeItemAtRoot(HWND hwndTree, const TCHAR* name)
+HTREEITEM FindNamedTreeItemAtRoot(HWND hwndTree, const wchar_t* name)
{
- TCHAR str[128];
+ wchar_t str[128];
TVITEM tvi;
tvi.mask = TVIF_TEXT;
tvi.pszText = str;
@@ -172,9 +172,9 @@ HTREEITEM FindNamedTreeItemAtRoot(HWND hwndTree, const TCHAR* name)
return NULL;
}
-static HTREEITEM FindNamedTreeItemAtChildren(HWND hwndTree, HTREEITEM hItem, const TCHAR* name)
+static HTREEITEM FindNamedTreeItemAtChildren(HWND hwndTree, HTREEITEM hItem, const wchar_t* name)
{
- TCHAR str[128];
+ wchar_t str[128];
TVITEM tvi;
tvi.mask = TVIF_TEXT;
tvi.pszText = str;
@@ -192,7 +192,7 @@ static HTREEITEM FindNamedTreeItemAtChildren(HWND hwndTree, HTREEITEM hItem, con
static BOOL CALLBACK BoldGroupTitlesEnumChildren(HWND hwnd, LPARAM lParam)
{
- TCHAR szClass[64];
+ wchar_t szClass[64];
GetClassName(hwnd, szClass, _countof(szClass));
if (!mir_tstrcmp(szClass, L"Button") && (GetWindowLongPtr(hwnd, GWL_STYLE) & 0x0F) == BS_GROUPBOX)
@@ -230,17 +230,17 @@ static void ThemeDialogBackground(HWND hwnd, BOOL tabbed)
EnableThemeDialogTexture(hwnd, (tabbed ? ETDT_ENABLE : ETDT_DISABLE) | ETDT_USETABTEXTURE);
}
-static TCHAR* GetPluginName(HINSTANCE hInstance, TCHAR *buffer, int size)
+static wchar_t* GetPluginName(HINSTANCE hInstance, wchar_t *buffer, int size)
{
- TCHAR tszModuleName[MAX_PATH];
+ wchar_t tszModuleName[MAX_PATH];
GetModuleFileName(hInstance, tszModuleName, _countof(tszModuleName));
- TCHAR *dllName = _tcsrchr(tszModuleName, '\\');
+ wchar_t *dllName = wcsrchr(tszModuleName, '\\');
if (!dllName)
dllName = tszModuleName;
else
dllName++;
- _tcsncpy_s(buffer, size, dllName, _TRUNCATE);
+ wcsncpy_s(buffer, size, dllName, _TRUNCATE);
return buffer;
}
@@ -270,7 +270,7 @@ static void FindFilterStrings(int enableKeywordFiltering, int current, HWND hWnd
DWORD key = GetPluginPageHash(page); // get the plugin page hash
- TCHAR pluginName[MAX_PATH];
+ wchar_t pluginName[MAX_PATH];
char *temp = GetPluginNameByInstance(page->getInst());
GetDialogStrings(enableKeywordFiltering, key, GetPluginName(page->getInst(), pluginName, _countof(pluginName)), hWnd, page->ptszGroup, page->ptszTitle, page->ptszTab, _A2T(temp));
@@ -278,7 +278,7 @@ static void FindFilterStrings(int enableKeywordFiltering, int current, HWND hWnd
DestroyWindow(hWnd); // destroy the page, we're done with it
}
-static int MatchesFilter(const OptionsPageData *page, TCHAR *szFilterString)
+static int MatchesFilter(const OptionsPageData *page, wchar_t *szFilterString)
{
return ContainsFilterString(GetPluginPageHash(page), szFilterString);
}
@@ -297,7 +297,7 @@ static LRESULT CALLBACK OptionsFilterSubclassProc(HWND hWnd, UINT message, WPARA
PAINTSTRUCT paint;
HDC hdc = (message == WM_PAINT) ? BeginPaint(hWnd, &paint) : (HDC)wParam;
- TCHAR buf[255];
+ wchar_t buf[255];
if (bSearchState == 1 && FilterLoadProgress < 100 && FilterLoadProgress > 0)
mir_sntprintf(buf, TranslateT("Loading... %d%%"), FilterLoadProgress);
else
@@ -481,9 +481,9 @@ static void FillFilterCombo(HWND hDlg, OptionsDlgData* dat)
HINSTANCE *KnownInstances = (HINSTANCE*)alloca(sizeof(HINSTANCE)*dat->arOpd.getCount());
int countKnownInst = 0;
SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT)CB_RESETCONTENT, 0, 0);
- int index = SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT)CB_ADDSTRING, 0, (LPARAM)TranslateT(ALL_MODULES_FILTER));
+ int index = SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT)CB_ADDSTRING, 0, (LPARAM)ALL_MODULES_FILTER);
SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT)CB_SETITEMDATA, (WPARAM)index, 0);
- index = SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT)CB_ADDSTRING, 0, (LPARAM)TranslateT(CORE_MODULES_FILTER));
+ index = SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT)CB_ADDSTRING, 0, (LPARAM)CORE_MODULES_FILTER);
SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT)CB_SETITEMDATA, (WPARAM)index, (LPARAM)g_hInst);
for (int i = 0; i < dat->arOpd.getCount(); i++) {
@@ -504,11 +504,11 @@ static void FillFilterCombo(HWND hDlg, OptionsDlgData* dat)
KnownInstances[countKnownInst] = inst;
countKnownInst++;
- TCHAR tszModuleName[MAX_PATH];
+ wchar_t tszModuleName[MAX_PATH];
GetModuleFileName(inst, tszModuleName, _countof(tszModuleName));
- TCHAR *dllName = mir_a2t(GetPluginNameByInstance(inst));
- if (!dllName) dllName = mir_tstrdup(_tcsrchr(tszModuleName, _T('\\')));
+ wchar_t *dllName = mir_a2t(GetPluginNameByInstance(inst));
+ if (!dllName) dllName = mir_tstrdup(wcsrchr(tszModuleName, '\\'));
if (!dllName) dllName = mir_tstrdup(tszModuleName);
if (dllName) {
index = SendDlgItemMessage(hDlg, IDC_KEYWORD_FILTER, (UINT)CB_ADDSTRING, 0, (LPARAM)dllName);
@@ -527,33 +527,33 @@ static void RebuildPageTree(HWND hdlg, OptionsDlgData *dat)
// if filter string is set to all modules then make the filter string empty (this will return all modules)
BOOL bRemoveFocusFromFilter = FALSE;
- if (mir_tstrcmp(dat->szFilterString, TranslateT(ALL_MODULES_FILTER)) == 0) {
+ if (mir_tstrcmp(dat->szFilterString, ALL_MODULES_FILTER) == 0) {
dat->szFilterString[0] = 0;
bRemoveFocusFromFilter = TRUE;
}
// if filter string is set to core modules replace it with the name of the executable (this will return all core modules)
- else if (mir_tstrcmp(dat->szFilterString, TranslateT(CORE_MODULES_FILTER)) == 0) {
+ else if (mir_tstrcmp(dat->szFilterString, CORE_MODULES_FILTER) == 0) {
// replace string with process name - that will show core settings
- TCHAR szFileName[300];
+ wchar_t szFileName[300];
GetModuleFileName(g_hInst, szFileName, _countof(szFileName));
- TCHAR *pos = _tcsrchr(szFileName, _T('\\'));
+ wchar_t *pos = wcsrchr(szFileName, '\\');
if (pos)
pos++;
else
pos = szFileName;
- _tcsncpy_s(dat->szFilterString, pos, _TRUNCATE);
+ wcsncpy_s(dat->szFilterString, pos, _TRUNCATE);
}
else {
int sel = SendDlgItemMessage(hdlg, IDC_KEYWORD_FILTER, (UINT)CB_GETCURSEL, 0, 0);
if (sel != -1) {
HINSTANCE hinst = (HINSTANCE)SendDlgItemMessage(hdlg, IDC_KEYWORD_FILTER, (UINT)CB_GETITEMDATA, sel, 0);
- TCHAR szFileName[300];
+ wchar_t szFileName[300];
GetModuleFileName(hinst, szFileName, _countof(szFileName));
- TCHAR *pos = _tcsrchr(szFileName, _T('\\'));
+ wchar_t *pos = wcsrchr(szFileName, '\\');
if (pos) pos++;
else pos = szFileName;
- _tcsncpy_s(dat->szFilterString, pos, _TRUNCATE);
+ wcsncpy_s(dat->szFilterString, pos, _TRUNCATE);
}
}
@@ -588,9 +588,9 @@ static void RebuildPageTree(HWND hdlg, OptionsDlgData *dat)
continue;
opd = dat->arOpd[i];
- TCHAR *ptszGroup = TranslateTH(opd->hLangpack, opd->ptszGroup);
- TCHAR *ptszTitle = opd->getString(opd->ptszTitle), *useTitle;
- TCHAR *ptszTab = TranslateTH(opd->hLangpack, opd->ptszTab);
+ wchar_t *ptszGroup = TranslateTH(opd->hLangpack, opd->ptszGroup);
+ wchar_t *ptszTitle = opd->getString(opd->ptszTitle), *useTitle;
+ wchar_t *ptszTab = TranslateTH(opd->hLangpack, opd->ptszTab);
tvis.hParent = NULL;
useTitle = ptszTitle;
@@ -823,8 +823,8 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L
else
dat->arOpd.insert(opd);
- if (!mir_tstrcmp(lastPage, odp->ptszTitle) && !mir_tstrcmp(lastGroup, odp->ptszGroup))
- if ((ood->pszTab == NULL && dat->currentPage == -1) || !mir_tstrcmp(lastTab, odp->ptszTab))
+ if (!mir_tstrcmp(lastPage, odp->pwszTitle) && !mir_tstrcmp(lastGroup, odp->pwszGroup))
+ if ((ood->pszTab == NULL && dat->currentPage == -1) || !mir_tstrcmp(lastTab, odp->pwszTab))
dat->currentPage = (int)i;
}
@@ -1147,7 +1147,7 @@ void OpenAccountOptions(PROTOACCOUNT *pa)
if (opi.pageCount == 0)
return;
- TCHAR tszTitle[100];
+ wchar_t tszTitle[100];
mir_sntprintf(tszTitle, TranslateT("%s options"), pa->tszAccountName);
OPENOPTIONSDIALOG ood = { sizeof(ood) };
@@ -1254,29 +1254,29 @@ static INT_PTR AddOptionsPage(WPARAM wParam, LPARAM lParam)
dst = opi->odp + opi->pageCount;
memcpy(dst, odp, sizeof(OPTIONSDIALOGPAGE));
- if (odp->ptszTitle != NULL) {
+ if (odp->pwszTitle != NULL) {
if (odp->flags & ODPF_UNICODE)
- dst->ptszTitle = mir_wstrdup(odp->ptszTitle);
+ dst->pwszTitle = mir_wstrdup(odp->pwszTitle);
else {
- dst->ptszTitle = mir_a2u(odp->pszTitle);
+ dst->pwszTitle = mir_a2u(odp->pszTitle);
dst->flags |= ODPF_UNICODE;
}
}
- if (odp->ptszGroup != NULL) {
+ if (odp->pwszGroup != NULL) {
if (odp->flags & ODPF_UNICODE)
- dst->ptszGroup = mir_wstrdup(odp->ptszGroup);
+ dst->pwszGroup = mir_wstrdup(odp->pwszGroup);
else {
- dst->ptszGroup = mir_a2t(odp->pszGroup);
+ dst->pwszGroup = mir_a2t(odp->pszGroup);
dst->flags |= ODPF_UNICODE;
}
}
- if (odp->ptszTab != NULL) {
+ if (odp->pwszTab != NULL) {
if (odp->flags & ODPF_UNICODE)
- dst->ptszTab = mir_wstrdup(odp->ptszTab);
+ dst->pwszTab = mir_wstrdup(odp->pwszTab);
else {
- dst->ptszTab = mir_a2t(odp->pszTab);
+ dst->pwszTab = mir_a2t(odp->pszTab);
dst->flags |= ODPF_UNICODE;
}
}
diff --git a/src/mir_app/src/options_ei.cpp b/src/mir_app/src/options_ei.cpp
index ff8d2861c1..fb6f3778dd 100644
--- a/src/mir_app/src/options_ei.cpp
+++ b/src/mir_app/src/options_ei.cpp
@@ -131,7 +131,7 @@ class CExtraIconOptsDlg : public CDlgBase
tvis.item.stateMask = TVIS_STATEIMAGEMASK;
tvis.item.iSelectedImage = tvis.item.iImage = img;
tvis.item.lParam = (LPARAM)ids;
- tvis.item.pszText = (TCHAR*)desc.c_str();
+ tvis.item.pszText = (wchar_t*)desc.c_str();
tvis.item.state = INDEXTOSTATEIMAGEMASK(selected ? 2 : 1);
return m_tree.InsertItem(&tvis);
}
diff --git a/src/mir_app/src/path.cpp b/src/mir_app/src/path.cpp
index 96cc60358a..2dc0860a35 100644
--- a/src/mir_app/src/path.cpp
+++ b/src/mir_app/src/path.cpp
@@ -27,12 +27,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "../../../plugins/ExternalAPI/m_folders.h"
-extern TCHAR g_profileDir[MAX_PATH], g_shortProfileName[MAX_PATH];
+extern wchar_t g_profileDir[MAX_PATH], g_shortProfileName[MAX_PATH];
static HANDLE hAvatarFolder;
-static TCHAR tszAvatarRoot[MAX_PATH];
+static wchar_t tszAvatarRoot[MAX_PATH];
-TCHAR* GetContactID(MCONTACT hContact)
+wchar_t* GetContactID(MCONTACT hContact)
{
char *szProto = GetContactProto(hContact);
if (db_get_b(hContact, szProto, "ChatRoom", 0) == 1)
@@ -51,7 +51,7 @@ static __forceinline int _xcsncmp(const char *s1, const char *s2, size_t n) { re
static __forceinline size_t _xcslen(const char *s1) { return strlen(s1); }
static __forceinline char *_xcscpy(char *s1, const char *s2) { return strcpy(s1, s2); }
static __forceinline char *_xcsncpy(char *s1, const char *s2, size_t n) { return strncpy(s1, s2, n); }
-static __forceinline const char *_xstrselect(const char*, const char *s1, TCHAR*) { return s1; }
+static __forceinline const char *_xstrselect(const char*, const char *s1, wchar_t*) { return s1; }
static __forceinline char *_itox(char*, int a) { return itoa(a, (char *)mir_alloc(sizeof(char)*20), 10); }
static __forceinline char *mir_a2x(const char*, const char *s) { return mir_strdup(s); }
@@ -62,7 +62,7 @@ static __forceinline char *GetContactNickX(const char*, MCONTACT hContact)
static __forceinline char *GetContactIDX(const char*, MCONTACT hContact)
{
- TCHAR *id = GetContactID(hContact);
+ wchar_t *id = GetContactID(hContact);
char* res = mir_t2a(id);
mir_free(id);
return res;
@@ -114,12 +114,12 @@ static __forceinline char *GetProfileNameX(const char*)
static __forceinline char* GetPathVarX(const char*, int code)
{
- TCHAR szFullPath[MAX_PATH];
+ wchar_t szFullPath[MAX_PATH];
switch(code) {
case 1:
if (hAvatarFolder != NULL)
- _tcsncpy_s(szFullPath, tszAvatarRoot, _TRUNCATE);
+ wcsncpy_s(szFullPath, tszAvatarRoot, _TRUNCATE);
else
mir_sntprintf(szFullPath, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
break;
@@ -133,77 +133,77 @@ static __forceinline char* GetPathVarX(const char*, int code)
return makeFileName(szFullPath);
}
-static __forceinline int _xcscmp(const TCHAR *s1, const TCHAR *s2) { return _tcscmp(s1, s2); }
-static __forceinline int _xcsncmp(const TCHAR *s1, const TCHAR *s2, size_t n) { return _tcsncmp(s1, s2, n); }
-static __forceinline size_t _xcslen(const TCHAR *s1) { return _tcslen(s1); }
-static __forceinline TCHAR* _xcscpy(TCHAR *s1, const TCHAR *s2) { return _tcscpy(s1, s2); }
-static __forceinline TCHAR* _xcsncpy(TCHAR *s1, const TCHAR *s2, size_t n) { return _tcsncpy(s1, s2, n); }
-static __forceinline const TCHAR* _xstrselect(const TCHAR*, const char*, const TCHAR *s2) { return s2; }
-static __forceinline TCHAR* _itox(TCHAR *, int a) { return _itot(a, (TCHAR *)mir_alloc(sizeof(TCHAR)*20), 10); }
-static __forceinline TCHAR* mir_a2x(const TCHAR *, const char *s) { return mir_a2t(s); }
+static __forceinline int _xcscmp(const wchar_t *s1, const wchar_t *s2) { return _tcscmp(s1, s2); }
+static __forceinline int _xcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n) { return wcsncmp(s1, s2, n); }
+static __forceinline size_t _xcslen(const wchar_t *s1) { return wcslen(s1); }
+static __forceinline wchar_t* _xcscpy(wchar_t *s1, const wchar_t *s2) { return wcscpy(s1, s2); }
+static __forceinline wchar_t* _xcsncpy(wchar_t *s1, const wchar_t *s2, size_t n) { return wcsncpy(s1, s2, n); }
+static __forceinline const wchar_t* _xstrselect(const wchar_t*, const char*, const wchar_t *s2) { return s2; }
+static __forceinline wchar_t* _itox(wchar_t *, int a) { return _itow(a, (wchar_t *)mir_alloc(sizeof(wchar_t)*20), 10); }
+static __forceinline wchar_t* mir_a2x(const wchar_t *, const char *s) { return mir_a2t(s); }
-static __forceinline TCHAR* GetContactNickX(const TCHAR*, MCONTACT hContact)
+static __forceinline wchar_t* GetContactNickX(const wchar_t*, MCONTACT hContact)
{
return mir_tstrdup(cli.pfnGetContactDisplayName(hContact, 0));
}
-static __forceinline TCHAR* GetContactIDX(const TCHAR*, MCONTACT hContact)
+static __forceinline wchar_t* GetContactIDX(const wchar_t*, MCONTACT hContact)
{
return GetContactID(hContact);
}
-static __forceinline TCHAR* GetEnvironmentVariableX(const TCHAR *variable)
+static __forceinline wchar_t* GetEnvironmentVariableX(const wchar_t *variable)
{
- TCHAR result[512];
+ wchar_t result[512];
if (GetEnvironmentVariable(variable, result, _countof(result)))
return mir_tstrdup(result);
return NULL;
}
-static __forceinline TCHAR* SHGetSpecialFolderPathX(int iCSIDL, TCHAR*)
+static __forceinline wchar_t* SHGetSpecialFolderPathX(int iCSIDL, wchar_t*)
{
- TCHAR result[512];
+ wchar_t result[512];
if (SHGetSpecialFolderPath(NULL, result, iCSIDL, FALSE))
return mir_tstrdup(result);
return NULL;
}
-static __forceinline TCHAR* GetProfileDirX(const TCHAR*)
+static __forceinline wchar_t* GetProfileDirX(const wchar_t*)
{
return mir_tstrdup(g_profileDir);
}
-static __forceinline TCHAR* GetModulePathX(const TCHAR*, HMODULE hModule)
+static __forceinline wchar_t* GetModulePathX(const wchar_t*, HMODULE hModule)
{
- TCHAR result[MAX_PATH];
+ wchar_t result[MAX_PATH];
GetModuleFileName(hModule, result, _countof(result));
- TCHAR* str = _tcsrchr(result, '\\');
+ wchar_t* str = wcsrchr(result, '\\');
if (str) *str = 0;
return mir_tstrdup(result);
}
-static __forceinline TCHAR* GetUserNameX(const TCHAR*)
+static __forceinline wchar_t* GetUserNameX(const wchar_t*)
{
- TCHAR result[128];
+ wchar_t result[128];
DWORD size = _countof(result);
if (GetUserName(result, &size))
return mir_tstrdup(result);
return NULL;
}
-static __forceinline TCHAR* GetProfileNameX(const TCHAR*)
+static __forceinline wchar_t* GetProfileNameX(const wchar_t*)
{
return mir_tstrdup(g_shortProfileName);
}
-static __forceinline TCHAR* GetPathVarX(const TCHAR*, int code)
+static __forceinline wchar_t* GetPathVarX(const wchar_t*, int code)
{
- TCHAR szFullPath[MAX_PATH];
+ wchar_t szFullPath[MAX_PATH];
switch(code) {
case 1:
if (hAvatarFolder != NULL)
- _tcsncpy_s(szFullPath, tszAvatarRoot, _TRUNCATE);
+ wcsncpy_s(szFullPath, tszAvatarRoot, _TRUNCATE);
else
mir_sntprintf(szFullPath, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
break;
@@ -366,9 +366,9 @@ static int OnFoldersChanged(WPARAM, LPARAM)
{
mir_sntprintf(tszAvatarRoot, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
- TCHAR tmpVar[MAX_PATH];
+ wchar_t tmpVar[MAX_PATH];
if (!FoldersGetCustomPathT(hAvatarFolder, tmpVar, _countof(tmpVar), tszAvatarRoot))
- _tcsncpy_s(tszAvatarRoot, tmpVar, _TRUNCATE);
+ wcsncpy_s(tszAvatarRoot, tmpVar, _TRUNCATE);
return 0;
}
@@ -376,9 +376,9 @@ void InitPathVar()
{
mir_sntprintf(tszAvatarRoot, L"%s\\%s\\AvatarCache", g_profileDir, g_shortProfileName);
if (hAvatarFolder = FoldersRegisterCustomPathT( LPGEN("Avatars"), LPGEN("Avatars root folder"), tszAvatarRoot)) {
- TCHAR tmpVar[MAX_PATH];
+ wchar_t tmpVar[MAX_PATH];
if (!FoldersGetCustomPathT(hAvatarFolder, tmpVar, _countof(tmpVar), tszAvatarRoot))
- _tcsncpy_s(tszAvatarRoot, tmpVar, _TRUNCATE);
+ wcsncpy_s(tszAvatarRoot, tmpVar, _TRUNCATE);
HookEvent(ME_FOLDERS_PATH_CHANGED, OnFoldersChanged);
}
}
diff --git a/src/mir_app/src/pluginopts.cpp b/src/mir_app/src/pluginopts.cpp
index eda32700e3..757a0318c1 100644
--- a/src/mir_app/src/pluginopts.cpp
+++ b/src/mir_app/src/pluginopts.cpp
@@ -40,7 +40,7 @@ static UINT_PTR timerID;
struct PluginListItemData
{
- TCHAR fileName[MAX_PATH];
+ wchar_t fileName[MAX_PATH];
HINSTANCE hInst;
int flags, stdPlugin;
char* author;
@@ -58,9 +58,9 @@ static int sttSortPlugins(const PluginListItemData *p1, const PluginListItemData
static LIST<PluginListItemData> arPluginList(10, sttSortPlugins);
-static BOOL dialogListPlugins(WIN32_FIND_DATA *fd, TCHAR *path, WPARAM, LPARAM lParam)
+static BOOL dialogListPlugins(WIN32_FIND_DATA *fd, wchar_t *path, WPARAM, LPARAM lParam)
{
- TCHAR buf[MAX_PATH];
+ wchar_t buf[MAX_PATH];
mir_sntprintf(buf, L"%s\\Plugins\\%s", path, fd->cFileName);
HINSTANCE hInst = GetModuleHandle(buf);
@@ -85,7 +85,7 @@ static BOOL dialogListPlugins(WIN32_FIND_DATA *fd, TCHAR *path, WPARAM, LPARAM l
}
CharLower(fd->cFileName);
- _tcsncpy_s(dat->fileName, fd->cFileName, _TRUNCATE);
+ wcsncpy_s(dat->fileName, fd->cFileName, _TRUNCATE);
HWND hwndList = (HWND)lParam;
@@ -121,7 +121,7 @@ static BOOL dialogListPlugins(WIN32_FIND_DATA *fd, TCHAR *path, WPARAM, LPARAM l
else
memset(&dat->uuid, 0, sizeof(dat->uuid));
- TCHAR *shortNameT = mir_a2t(pi.pluginInfo->shortName);
+ wchar_t *shortNameT = mir_a2t(pi.pluginInfo->shortName);
// column 3: plugin short name
if (shortNameT) {
ListView_SetItemText(hwndList, iRow, 2, shortNameT);
@@ -183,9 +183,9 @@ static void RemoveAllItems(HWND hwnd)
static bool LoadPluginDynamically(PluginListItemData *dat)
{
- TCHAR exe[MAX_PATH];
+ wchar_t exe[MAX_PATH];
GetModuleFileName(NULL, exe, _countof(exe));
- TCHAR *p = _tcsrchr(exe, '\\'); if (p) *p = 0;
+ wchar_t *p = wcsrchr(exe, '\\'); if (p) *p = 0;
pluginEntry* pPlug = OpenPlugin(dat->fileName, L"Plugins", exe);
if (pPlug->pclass & PCLASS_FAILED) {
@@ -230,7 +230,7 @@ static LRESULT CALLBACK PluginListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LP
for (int i = 0; i < arPluginList.getCount(); i++) {
PluginListItemData *p = arPluginList[i];
- if (!_tcsnicmp(szFilter, p->fileName, szFilter.GetLength())) {
+ if (!wcsnicmp(szFilter, p->fileName, szFilter.GetLength())) {
LVFINDINFO lvfi;
lvfi.flags = LVFI_PARAM;
lvfi.lParam = (LPARAM)p;
@@ -302,7 +302,7 @@ static int CALLBACK SortPlugins(WPARAM i1, LPARAM i2, LPARAM)
return mir_tstrcmp(p1->fileName, p2->fileName);
}
-static TCHAR *latin2t(const char *p)
+static wchar_t *latin2t(const char *p)
{
if (p == NULL)
return mir_tstrdup(L"");
@@ -423,7 +423,7 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
if (ListView_GetItem(hwndList, &lvi)) {
PluginListItemData *dat = (PluginListItemData*)lvi.lParam;
- TCHAR buf[1024];
+ wchar_t buf[1024];
ListView_GetItemText(hwndList, hdr->iItem, 2, buf, _countof(buf));
SetDlgItemText(hwndDlg, IDC_PLUGININFOFRAME, sel ? buf : L"");
@@ -454,12 +454,12 @@ INT_PTR CALLBACK DlgPluginOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar
if (hdr->hdr.code == PSN_APPLY) {
bool needRestart = false;
- TCHAR bufRestart[1024];
+ wchar_t bufRestart[1024];
int bufLen = mir_sntprintf(bufRestart, L"%s\n", TranslateT("Miranda NG must be restarted to apply changes for these plugins:"));
HWND hwndList = GetDlgItem(hwndDlg, IDC_PLUGLIST);
for (int iRow = 0; iRow != -1;) {
- TCHAR buf[1024];
+ wchar_t buf[1024];
ListView_GetItemText(hwndList, iRow, 1, buf, _countof(buf));
int iState = ListView_GetItemState(hwndList, iRow, LVIS_STATEIMAGEMASK);
SetPluginOnWhiteList(buf, (iState & 0x2000) ? 1 : 0);
diff --git a/src/mir_app/src/plugins.h b/src/mir_app/src/plugins.h
index 44d7a18ddd..89f26a67f1 100644
--- a/src/mir_app/src/plugins.h
+++ b/src/mir_app/src/plugins.h
@@ -41,7 +41,7 @@ struct BASIC_PLUGIN_INFO
struct pluginEntry
{
- TCHAR pluginname[64];
+ wchar_t pluginname[64];
unsigned int pclass; // PCLASS_*
int hLangpack;
BASIC_PLUGIN_INFO bpi;
@@ -54,30 +54,30 @@ int PluginOptionsInit(WPARAM, LPARAM);
void LoadPluginOptions();
void UnloadPluginOptions();
-int isPluginOnWhiteList(const TCHAR* pluginname);
-void SetPluginOnWhiteList(const TCHAR* pluginname, int allow);
+int isPluginOnWhiteList(const wchar_t* pluginname);
+void SetPluginOnWhiteList(const wchar_t* pluginname, int allow);
int getDefaultPluginIdx(const MUUID& muuid);
bool hasMuuid(const BASIC_PLUGIN_INFO&, const MUUID&);
bool hasMuuid(const MUUID* pFirst, const MUUID&);
-int checkAPI(TCHAR* plugin, BASIC_PLUGIN_INFO* bpi, DWORD mirandaVersion, int checkTypeAPI);
+int checkAPI(wchar_t* plugin, BASIC_PLUGIN_INFO* bpi, DWORD mirandaVersion, int checkTypeAPI);
-pluginEntry* OpenPlugin(TCHAR *tszFileName, TCHAR *dir, TCHAR *path);
+pluginEntry* OpenPlugin(wchar_t *tszFileName, wchar_t *dir, wchar_t *path);
bool TryLoadPlugin(pluginEntry *p, bool bDynamic);
void Plugin_Uninit(pluginEntry *p);
int Plugin_UnloadDyn(pluginEntry *p);
-typedef BOOL (*SCAN_PLUGINS_CALLBACK) (WIN32_FIND_DATA * fd, TCHAR *path, WPARAM wParam, LPARAM lParam);
+typedef BOOL (*SCAN_PLUGINS_CALLBACK) (WIN32_FIND_DATA * fd, wchar_t *path, WPARAM wParam, LPARAM lParam);
void enumPlugins(SCAN_PLUGINS_CALLBACK cb, WPARAM wParam, LPARAM lParam);
struct MuuidReplacement
{
MUUID uuid; // default interface plugin
- TCHAR* stdplugname;
+ wchar_t* stdplugname;
pluginEntry* pImpl; // replacement plugin
};
bool LoadCorePlugin( MuuidReplacement& );
-MUUID* GetPluginInterfaces(const TCHAR* ptszFileName, bool& bIsPlugin); \ No newline at end of file
+MUUID* GetPluginInterfaces(const wchar_t* ptszFileName, bool& bIsPlugin);
diff --git a/src/mir_app/src/profilemanager.cpp b/src/mir_app/src/profilemanager.cpp
index 9ab844d821..38465b5165 100644
--- a/src/mir_app/src/profilemanager.cpp
+++ b/src/mir_app/src/profilemanager.cpp
@@ -35,17 +35,17 @@ void EnsureCheckerLoaded(bool);
#define WM_INPUTCHANGED (WM_USER + 0x3000)
#define WM_FOCUSTEXTBOX (WM_USER + 0x3001)
-typedef BOOL (__cdecl *ENUMPROFILECALLBACK) (TCHAR *tszFullPath, TCHAR *profile, LPARAM lParam);
+typedef BOOL (__cdecl *ENUMPROFILECALLBACK) (wchar_t *tszFullPath, wchar_t *profile, LPARAM lParam);
void SetServiceModePlugin(pluginEntry *p);
/////////////////////////////////////////////////////////////////////////////////////////
// Profile creator
-static int findProfiles(TCHAR *szProfileDir, ENUMPROFILECALLBACK callback, LPARAM lParam)
+static int findProfiles(wchar_t *szProfileDir, ENUMPROFILECALLBACK callback, LPARAM lParam)
{
// find in Miranda NG profile subfolders
- TCHAR searchspec[MAX_PATH];
+ wchar_t searchspec[MAX_PATH];
mir_sntprintf(searchspec, L"%s\\*.*", szProfileDir);
WIN32_FIND_DATA ffd;
@@ -56,9 +56,9 @@ static int findProfiles(TCHAR *szProfileDir, ENUMPROFILECALLBACK callback, LPARA
do {
// find all subfolders except "." and ".."
if ((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && mir_tstrcmp(ffd.cFileName, L".") && mir_tstrcmp(ffd.cFileName, L"..")) {
- TCHAR buf[MAX_PATH], profile[MAX_PATH];
+ wchar_t buf[MAX_PATH], profile[MAX_PATH];
mir_sntprintf(buf, L"%s\\%s\\%s.dat", szProfileDir, ffd.cFileName, ffd.cFileName);
- if (_taccess(buf, 0) == 0) {
+ if (_waccess(buf, 0) == 0) {
mir_sntprintf(profile, L"%s.dat", ffd.cFileName);
if (!callback(buf, profile, lParam))
break;
@@ -74,7 +74,7 @@ static int findProfiles(TCHAR *szProfileDir, ENUMPROFILECALLBACK callback, LPARA
static LRESULT CALLBACK ProfileNameValidate(HWND edit, UINT msg, WPARAM wParam, LPARAM lParam)
{
if (msg == WM_CHAR) {
- if (_tcschr(L".?/\\#' ", (TCHAR)wParam) != 0)
+ if (wcschr(L".?/\\#' ", (wchar_t)wParam) != 0)
return 0;
PostMessage(GetParent(edit), WM_INPUTCHANGED, 0, 0);
}
@@ -86,14 +86,14 @@ class CCreateProfileDlg : public CDlgBase
CCtrlButton &m_btnOk;
PROFILEMANAGERDATA *m_pd;
- int CreateProfile(TCHAR *profile, DATABASELINK *link)
+ int CreateProfile(wchar_t *profile, DATABASELINK *link)
{
- TCHAR buf[256];
+ wchar_t buf[256];
int err = 0;
// check if the file already exists
- TCHAR *file = _tcsrchr(profile, '\\');
+ wchar_t *file = wcsrchr(profile, '\\');
if (file) file++;
- if (_taccess(profile, 0) == 0) {
+ if (_waccess(profile, 0) == 0) {
// file already exists!
mir_sntprintf(buf,
TranslateT("The profile '%s' already exists. Do you want to move it to the Recycle Bin?\n\nWARNING: The profile will be deleted if Recycle Bin is disabled.\nWARNING: A profile may contain confidential information and should be properly deleted."),
@@ -165,13 +165,13 @@ public:
mir_subclassWindow(m_profileName.GetHwnd(), ProfileNameValidate);
// decide if there is a default profile name given in the INI and if it should be used
- if (m_pd->noProfiles || (shouldAutoCreate(m_pd->ptszProfile) && _taccess(m_pd->ptszProfile, 0))) {
- TCHAR *profile = _tcsrchr(m_pd->ptszProfile, '\\');
+ if (m_pd->noProfiles || (shouldAutoCreate(m_pd->ptszProfile) && _waccess(m_pd->ptszProfile, 0))) {
+ wchar_t *profile = wcsrchr(m_pd->ptszProfile, '\\');
if (profile) ++profile;
else profile = m_pd->ptszProfile;
- TCHAR *p = _tcsrchr(profile, '.');
- TCHAR c = 0;
+ wchar_t *p = wcsrchr(profile, '.');
+ wchar_t c = 0;
if (p) { c = *p; *p = 0; }
m_profileName.SetText(profile);
@@ -239,24 +239,24 @@ class CChooseProfileDlg : public CDlgBase
struct ProfileEnumData
{
- ProfileEnumData(CCtrlListView &_list, TCHAR *_profile) :
+ ProfileEnumData(CCtrlListView &_list, wchar_t *_profile) :
list(_list),
szProfile(_profile)
{}
CCtrlListView &list;
- TCHAR* szProfile;
+ wchar_t* szProfile;
};
- static BOOL EnumProfilesForList(TCHAR *tszFullPath, TCHAR *profile, LPARAM lParam)
+ static BOOL EnumProfilesForList(wchar_t *tszFullPath, wchar_t *profile, LPARAM lParam)
{
ProfileEnumData *ped = (ProfileEnumData*)lParam;
CCtrlListView &list = ped->list;
- TCHAR sizeBuf[64];
+ wchar_t sizeBuf[64];
bool bFileLocked = true;
- TCHAR *p = _tcsrchr(profile, '.');
+ wchar_t *p = wcsrchr(profile, '.');
mir_tstrcpy(sizeBuf, L"0 KB");
if (p != NULL) *p = 0;
@@ -266,7 +266,7 @@ class CChooseProfileDlg : public CDlgBase
item.iItem = 0;
struct _stat statbuf;
- if (_tstat(tszFullPath, &statbuf) == 0) {
+ if (_wstat(tszFullPath, &statbuf) == 0) {
if (statbuf.st_size > 1000000) {
mir_sntprintf(sizeBuf, L"%.3lf", (double)statbuf.st_size / 1048576.0);
mir_tstrcpy(sizeBuf + 5, L" MB");
@@ -314,7 +314,7 @@ class CChooseProfileDlg : public CDlgBase
if (iItem < 0)
return;
- TCHAR profile[MAX_PATH], fullName[MAX_PATH];
+ wchar_t profile[MAX_PATH], fullName[MAX_PATH];
LVITEM item = { 0 };
item.mask = LVIF_TEXT | LVIF_IMAGE;
item.iItem = iItem;
@@ -332,7 +332,7 @@ class CChooseProfileDlg : public CDlgBase
if (iItem < 0)
return;
- TCHAR profile[MAX_PATH], profilef[MAX_PATH * 2];
+ wchar_t profile[MAX_PATH], profilef[MAX_PATH * 2];
LVITEM item = { 0 };
item.mask = LVIF_TEXT;
@@ -360,7 +360,7 @@ class CChooseProfileDlg : public CDlgBase
{
m_btnOk.Enable(m_profileList.GetSelectedCount() == 1);
- TCHAR profile[MAX_PATH];
+ wchar_t profile[MAX_PATH];
LVITEM item = { 0 };
item.mask = LVIF_TEXT | LVIF_IMAGE;
item.iItem = m_profileList.GetNextItem(-1, LVNI_SELECTED | LVNI_ALL);
@@ -386,12 +386,12 @@ class CChooseProfileDlg : public CDlgBase
// profile is placed in "profile_name" subfolder
- TCHAR tmpPath[MAX_PATH];
+ wchar_t tmpPath[MAX_PATH];
mir_sntprintf(tmpPath, L"%s\\%s.dat", m_pd->ptszProfileDir, profile);
- if (_taccess(tmpPath, 2))
+ if (_waccess(tmpPath, 2))
mir_sntprintf(m_pd->ptszProfile, MAX_PATH, L"%s\\%s\\%s.dat", m_pd->ptszProfileDir, profile, profile);
else
- _tcsncpy_s(m_pd->ptszProfile, MAX_PATH, tmpPath, _TRUNCATE);
+ wcsncpy_s(m_pd->ptszProfile, MAX_PATH, tmpPath, _TRUNCATE);
}
void ExecuteMenu(LPARAM lParam)
@@ -521,12 +521,12 @@ public:
void list_OnGetTip(CCtrlListView::TEventInfo *evt)
{
if (auto pTip = evt->nmlvit) {
- TCHAR profilename[MAX_PATH], tszFullPath[MAX_PATH];
+ wchar_t profilename[MAX_PATH], tszFullPath[MAX_PATH];
struct _stat statbuf;
m_profileList.GetItemText(pTip->iItem, 0, profilename, _countof(profilename));
mir_sntprintf(tszFullPath, L"%s\\%s\\%s.dat", m_pd->ptszProfileDir, profilename, profilename);
- _tstat(tszFullPath, &statbuf);
- mir_sntprintf(pTip->pszText, pTip->cchTextMax, L"%s\n%s: %s\n%s: %s", tszFullPath, TranslateT("Created"), rtrimt(NEWTSTR_ALLOCA(_tctime(&statbuf.st_ctime))), TranslateT("Modified"), rtrimt(NEWTSTR_ALLOCA(_tctime(&statbuf.st_mtime))));
+ _wstat(tszFullPath, &statbuf);
+ mir_sntprintf(pTip->pszText, pTip->cchTextMax, L"%s\n%s: %s\n%s: %s", tszFullPath, TranslateT("Created"), rtrimt(NEWWSTR_ALLOCA(_wctime(&statbuf.st_ctime))), TranslateT("Modified"), rtrimt(NEWWSTR_ALLOCA(_wctime(&statbuf.st_mtime))));
}
}
@@ -591,8 +591,8 @@ public:
{
m_btnOk.OnClick = Callback(this, &CProfileManager::onOk);
- m_tab.AddPage(LPGENT("My profiles"), NULL, new CChooseProfileDlg(m_btnOk, m_pd));
- m_tab.AddPage(LPGENT("New profile"), NULL, new CCreateProfileDlg(m_btnOk, m_pd));
+ m_tab.AddPage(LPGENW("My profiles"), NULL, new CChooseProfileDlg(m_btnOk, m_pd));
+ m_tab.AddPage(LPGENW("New profile"), NULL, new CCreateProfileDlg(m_btnOk, m_pd));
}
virtual void OnInitDialog()
diff --git a/src/mir_app/src/profilemanager.h b/src/mir_app/src/profilemanager.h
index 63b521c1b3..5ec6e9fcd1 100644
--- a/src/mir_app/src/profilemanager.h
+++ b/src/mir_app/src/profilemanager.h
@@ -24,8 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
struct PROFILEMANAGERDATA
{
- TCHAR *ptszProfile; // in/out
- TCHAR *ptszProfileDir; // in/out
+ wchar_t *ptszProfile; // in/out
+ wchar_t *ptszProfileDir; // in/out
BOOL noProfiles; // in
BOOL bRun; // out
@@ -33,13 +33,13 @@ struct PROFILEMANAGERDATA
DATABASELINK *dblink; // out
};
-char* makeFileName(const TCHAR *tszOriginalName);
-int touchDatabase(const TCHAR *tszProfile, DATABASELINK **pDblink);
+char* makeFileName(const wchar_t *tszOriginalName);
+int touchDatabase(const wchar_t *tszProfile, DATABASELINK **pDblink);
int getProfileManager(PROFILEMANAGERDATA *pd);
-int getProfilePath(TCHAR *buf, size_t cch);
-int isValidProfileName(const TCHAR *name);
-bool fileExist(const TCHAR *fname);
-bool shouldAutoCreate(TCHAR *szProfile);
+int getProfilePath(wchar_t *buf, size_t cch);
+int isValidProfileName(const wchar_t *name);
+bool fileExist(const wchar_t *fname);
+bool shouldAutoCreate(wchar_t *szProfile);
-extern TCHAR g_profileDir[MAX_PATH], g_profileName[MAX_PATH], g_shortProfileName[MAX_PATH];
+extern wchar_t g_profileDir[MAX_PATH], g_profileName[MAX_PATH], g_shortProfileName[MAX_PATH];
extern bool g_bDbCreated;
diff --git a/src/mir_app/src/proto_internal.cpp b/src/mir_app/src/proto_internal.cpp
index cf885f54f3..d64e64bd97 100644
--- a/src/mir_app/src/proto_internal.cpp
+++ b/src/mir_app/src/proto_internal.cpp
@@ -24,15 +24,15 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "stdafx.h"
-char** __fastcall Proto_FilesMatrixA(TCHAR **files);
+char** __fastcall Proto_FilesMatrixA(wchar_t **files);
-void FreeFilesMatrix(TCHAR ***files)
+void FreeFilesMatrix(wchar_t ***files)
{
if (*files == NULL)
return;
// Free each filename in the pointer array
- TCHAR **pFile = *files;
+ wchar_t **pFile = *files;
while (*pFile != NULL) {
mir_free(*pFile);
*pFile = NULL;
@@ -61,7 +61,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
return (int)ProtoCallService(m_szModuleName, PS_AUTHALLOW, (WPARAM)hDbEvent, 0);
}
- int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR *szReason)
+ int __cdecl AuthDeny(MEVENT hDbEvent, const wchar_t *szReason)
{
if (m_iVersion > 1)
return (int)ProtoCallService(m_szModuleName, PS_AUTHDENY, hDbEvent, (LPARAM)szReason);
@@ -75,7 +75,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
return (int)ProtoCallService(m_szModuleName, PSR_AUTH, 0, (LPARAM)&ccs);
}
- int __cdecl AuthRequest(MCONTACT hContact, const TCHAR *szMessage)
+ int __cdecl AuthRequest(MCONTACT hContact, const wchar_t *szMessage)
{
CCSDATA ccs = { hContact, PSS_AUTHREQUEST, 0, (LPARAM)szMessage };
if (m_iVersion > 1)
@@ -87,7 +87,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
return res;
}
- HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szPath)
+ HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath)
{
CCSDATA ccs = { hContact, PSS_FILEALLOW, (WPARAM)hTransfer, (LPARAM)szPath };
if (m_iVersion > 1)
@@ -105,7 +105,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
return (int)ProtoCallService(m_szModuleName, PSS_FILECANCEL, 0, (LPARAM)&ccs);
}
- int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason)
+ int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szReason)
{
CCSDATA ccs = { hContact, PSS_FILEDENY, (WPARAM)hTransfer, (LPARAM)szReason };
if (m_iVersion > 1)
@@ -117,16 +117,16 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
return res;
}
- int __cdecl FileResume(HANDLE hTransfer, int* action, const TCHAR** szFilename)
+ int __cdecl FileResume(HANDLE hTransfer, int* action, const wchar_t** szFilename)
{
PROTOFILERESUME pfr = { *action, *szFilename };
if (m_iVersion > 1)
return (int)ProtoCallService(m_szModuleName, PS_FILERESUME, (WPARAM)hTransfer, (LPARAM)&pfr);
- pfr.szFilename = (TCHAR*)mir_t2a(pfr.szFilename);
+ pfr.szFilename = (wchar_t*)mir_t2a(pfr.szFilename);
int res = (int)ProtoCallService(m_szModuleName, PS_FILERESUME, (WPARAM)hTransfer, (LPARAM)&pfr);
- mir_free((TCHAR*)*szFilename);
- *action = pfr.action; *szFilename = (TCHAR*)pfr.szFilename;
+ mir_free((wchar_t*)*szFilename);
+ *action = pfr.action; *szFilename = (wchar_t*)pfr.szFilename;
return res;
}
@@ -147,7 +147,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
return ProtoCallService(m_szModuleName, PSS_GETINFO, 0, (LPARAM)&ccs);
}
- HANDLE __cdecl SearchBasic(const TCHAR* id)
+ HANDLE __cdecl SearchBasic(const wchar_t* id)
{
if (m_iVersion > 1)
return (HANDLE)ProtoCallService(m_szModuleName, PS_BASICSEARCH, 0, (LPARAM)id);
@@ -155,19 +155,19 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
return (HANDLE)ProtoCallService(m_szModuleName, PS_BASICSEARCH, 0, _T2A(id));
}
- HANDLE __cdecl SearchByEmail(const TCHAR* email)
+ HANDLE __cdecl SearchByEmail(const wchar_t* email)
{
if (m_iVersion > 1)
return (HANDLE)ProtoCallService(m_szModuleName, PS_SEARCHBYEMAIL, 0, (LPARAM)email);
return (HANDLE)ProtoCallService(m_szModuleName, PS_SEARCHBYEMAIL, 0, _T2A(email));
}
- HANDLE __cdecl SearchByName(const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName)
+ HANDLE __cdecl SearchByName(const wchar_t* nick, const wchar_t* firstName, const wchar_t* lastName)
{
PROTOSEARCHBYNAME psn;
- psn.pszNick = (TCHAR*)mir_t2a(nick);
- psn.pszFirstName = (TCHAR*)mir_t2a(firstName);
- psn.pszLastName = (TCHAR*)mir_t2a(lastName);
+ psn.pszNick = (wchar_t*)mir_t2a(nick);
+ psn.pszFirstName = (wchar_t*)mir_t2a(firstName);
+ psn.pszLastName = (wchar_t*)mir_t2a(lastName);
HANDLE res = (HANDLE)ProtoCallService(m_szModuleName, PS_SEARCHBYNAME, 0, (LPARAM)&psn);
mir_free(psn.pszNick);
mir_free(psn.pszFirstName);
@@ -216,7 +216,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
return (int)ProtoCallService(m_szModuleName, PSS_CONTACTS, 0, (LPARAM)&ccs);
}
- HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles)
+ HANDLE __cdecl SendFile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles)
{
CCSDATA ccs = { hContact, PSS_FILE, (WPARAM)szDescription, (LPARAM)ppszFiles };
@@ -226,7 +226,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
ccs.wParam = (WPARAM)mir_t2a(szDescription);
ccs.lParam = (LPARAM)Proto_FilesMatrixA(ppszFiles);
HANDLE res = (HANDLE)ProtoCallService(m_szModuleName, PSS_FILE, 0, (LPARAM)&ccs);
- if (res == 0) FreeFilesMatrix((TCHAR***)&ccs.lParam);
+ if (res == 0) FreeFilesMatrix((wchar_t***)&ccs.lParam);
mir_free((char*)ccs.wParam);
return res;
}
@@ -266,7 +266,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
return (int)ProtoCallService(m_szModuleName, PSR_AWAYMSG, 0, (LPARAM)&ccs);
}
- int __cdecl SetAwayMsg(int iStatus, const TCHAR *msg)
+ int __cdecl SetAwayMsg(int iStatus, const wchar_t *msg)
{
if (m_iVersion > 1)
return (int)ProtoCallService(m_szModuleName, PS_SETAWAYMSG, iStatus, (LPARAM)msg);
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp
index 096fdf0ed0..751af269c0 100644
--- a/src/mir_app/src/proto_opts.cpp
+++ b/src/mir_app/src/proto_opts.cpp
@@ -56,9 +56,9 @@ static HWND hAccMgr = NULL;
extern HANDLE hAccListChanged;
-int UnloadPlugin(TCHAR* buf, int bufLen);
+int UnloadPlugin(wchar_t* buf, int bufLen);
-PROTOACCOUNT* Proto_CreateAccount(const char *szModuleName, const char *szBaseProto, const TCHAR *tszAccountName)
+PROTOACCOUNT* Proto_CreateAccount(const char *szModuleName, const char *szBaseProto, const wchar_t *tszAccountName)
{
PROTOACCOUNT *pa = (PROTOACCOUNT*)mir_calloc(sizeof(PROTOACCOUNT));
if (pa == NULL)
@@ -123,7 +123,7 @@ static bool OnCreateAccount(HWND hwndDlg)
AccFormDlgParam* param = (AccFormDlgParam*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
PROTOACCOUNT *pa = param->pa;
- TCHAR tszAccName[256];
+ wchar_t tszAccName[256];
GetDlgItemText(hwndDlg, IDC_ACCNAME, tszAccName, _countof(tszAccName));
rtrimt(tszAccName);
if (tszAccName[0] == 0) {
@@ -142,13 +142,13 @@ static bool OnCreateAccount(HWND hwndDlg)
if (param->action == PRAC_UPGRADED) {
BOOL oldProto = pa->bOldProto;
- TCHAR szPlugin[MAX_PATH];
+ wchar_t szPlugin[MAX_PATH];
mir_sntprintf(szPlugin, L"%s.dll", _A2T(pa->szProtoName));
int idx = accounts.getIndex(pa);
UnloadAccount(pa, false, false);
accounts.remove(idx);
if (oldProto && UnloadPlugin(szPlugin, _countof(szPlugin))) {
- TCHAR szNewName[MAX_PATH];
+ wchar_t szNewName[MAX_PATH];
mir_sntprintf(szNewName, L"%s~", szPlugin);
MoveFile(szPlugin, szNewName);
}
@@ -199,7 +199,7 @@ static INT_PTR CALLBACK AccFormDlgProc(HWND hwndDlg, UINT message, WPARAM wParam
if (param->action == PRAC_ADDED) // new account
SetWindowText(hwndDlg, TranslateT("Create new account"));
else {
- TCHAR str[200];
+ wchar_t str[200];
if (param->action == PRAC_CHANGED) { // update
EnableWindow(GetDlgItem(hwndDlg, IDC_PROTOTYPECOMBO), FALSE);
mir_sntprintf(str, L"%s: %s", TranslateT("Editing account"), param->pa->tszAccountName);
@@ -280,7 +280,7 @@ static LRESULT CALLBACK sttEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam,
case WM_KILLFOCUS:
int length = GetWindowTextLength(hwnd) + 1;
- TCHAR *str = (TCHAR*)mir_alloc(sizeof(TCHAR) * length);
+ wchar_t *str = (wchar_t*)mir_alloc(sizeof(wchar_t) * length);
GetWindowText(hwnd, str, length);
SendMessage(GetParent(GetParent(hwnd)), WM_COMMAND, MAKEWPARAM(GetWindowLongPtr(GetParent(hwnd), GWL_ID), LBN_MY_RENAME), (LPARAM)str);
DestroyWindow(hwnd);
@@ -605,7 +605,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM
int length = SendDlgItemMessage(hwndDlg, IDC_ACCLIST, LB_GETTEXTLEN, lps->itemID, 0);
int size = max(length + 1, 256);
- TCHAR *text = (TCHAR *)_alloca(sizeof(TCHAR) * size);
+ wchar_t *text = (wchar_t *)_alloca(sizeof(wchar_t) * size);
SendDlgItemMessage(hwndDlg, IDC_ACCLIST, LB_GETTEXT, lps->itemID, (LPARAM)text);
SelectObject(lps->hDC, dat->hfntTitle);
@@ -770,7 +770,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM
else {
DWORD dwStatus = CallProtoServiceInt(NULL, pa->szModuleName, PS_GETSTATUS, 0, 0);
if (dwStatus >= ID_STATUS_ONLINE) {
- TCHAR buf[200];
+ wchar_t buf[200];
mir_sntprintf(buf, TranslateT("Account %s is being disabled"), pa->tszAccountName);
if (IDNO == ::MessageBox(hwndDlg,
TranslateT("Account is online. Disable account?"),
@@ -795,7 +795,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM
pa = (PROTOACCOUNT *)ListBox_GetItemData(hwndList, iItem);
if (pa) {
mir_free(pa->tszAccountName);
- pa->tszAccountName = (TCHAR*)lParam;
+ pa->tszAccountName = (wchar_t*)lParam;
WriteDbAccounts();
NotifyEventHooks(hAccListChanged, PRAC_CHANGED, (LPARAM)pa);
@@ -808,7 +808,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM
RedrawWindow(hwndList, NULL, NULL, RDW_INVALIDATE);
}
- else mir_free((TCHAR*)lParam);
+ else mir_free((wchar_t*)lParam);
}
break;
@@ -830,7 +830,7 @@ INT_PTR CALLBACK AccMgrDlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM
idx = ListBox_GetCurSel(hwndList);
if (idx != -1) {
pa = (PROTOACCOUNT*)ListBox_GetItemData(hwndList, idx);
- TCHAR buf[200];
+ wchar_t buf[200];
mir_sntprintf(buf, TranslateT("Account %s is being deleted"), pa->tszAccountName);
if (pa->bOldProto) {
MessageBox(hwndDlg, TranslateT("You need to disable plugin to delete this account"), buf, MB_ICONERROR | MB_OK);
diff --git a/src/mir_app/src/proto_ui.cpp b/src/mir_app/src/proto_ui.cpp
index ed0ac48b16..38ee85161b 100644
--- a/src/mir_app/src/proto_ui.cpp
+++ b/src/mir_app/src/proto_ui.cpp
@@ -48,7 +48,7 @@ void CProtoIntDlgBase::CreateLink(CCtrlData& ctrl, char *szSetting, BYTE type, D
ctrl.CreateDbLink(m_proto_interface->m_szModuleName, szSetting, type, iValue);
}
-void CProtoIntDlgBase::CreateLink(CCtrlData& ctrl, const char *szSetting, TCHAR *szValue)
+void CProtoIntDlgBase::CreateLink(CCtrlData& ctrl, const char *szSetting, wchar_t *szValue)
{
ctrl.CreateDbLink(m_proto_interface->m_szModuleName, szSetting, szValue);
}
@@ -57,7 +57,7 @@ void CProtoIntDlgBase::OnProtoRefresh(WPARAM, LPARAM) {}
void CProtoIntDlgBase::OnProtoActivate(WPARAM, LPARAM) {}
void CProtoIntDlgBase::OnProtoCheckOnline(WPARAM, LPARAM) {}
-void CProtoIntDlgBase::SetStatusText(const TCHAR *statusText)
+void CProtoIntDlgBase::SetStatusText(const wchar_t *statusText)
{
if (m_hwndStatus)
SendMessage(m_hwndStatus, SB_SETTEXT, 0, (LPARAM)statusText);
@@ -86,8 +86,8 @@ INT_PTR CProtoIntDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
case WM_SETTEXT:
if (m_show_label && IsWindowUnicode(m_hwnd)) {
- TCHAR *szTitle = (TCHAR *)lParam;
- if (!_tcsstr(szTitle, m_proto_interface->m_tszUserName)) {
+ wchar_t *szTitle = (wchar_t *)lParam;
+ if (!wcsstr(szTitle, m_proto_interface->m_tszUserName)) {
UpdateProtoTitle(szTitle);
return TRUE;
}
@@ -122,13 +122,13 @@ INT_PTR CProtoIntDlgBase::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam)
return CSuper::DlgProc(msg, wParam, lParam);
}
-void CProtoIntDlgBase::UpdateProtoTitle(const TCHAR *szText)
+void CProtoIntDlgBase::UpdateProtoTitle(const wchar_t *szText)
{
if (!m_show_label)
return;
int curLength;
- const TCHAR *curText;
+ const wchar_t *curText;
if (szText) {
curText = szText;
@@ -136,14 +136,14 @@ void CProtoIntDlgBase::UpdateProtoTitle(const TCHAR *szText)
}
else {
curLength = GetWindowTextLength(m_hwnd) + 1;
- TCHAR *tmp = (TCHAR *)_alloca(curLength * sizeof(TCHAR));
+ wchar_t *tmp = (wchar_t *)_alloca(curLength * sizeof(wchar_t));
GetWindowText(m_hwnd, tmp, curLength);
curText = tmp;
}
- if (!_tcsstr(curText, m_proto_interface->m_tszUserName)) {
+ if (!wcsstr(curText, m_proto_interface->m_tszUserName)) {
size_t length = curLength + mir_tstrlen(m_proto_interface->m_tszUserName) + 256;
- TCHAR *text = (TCHAR *)_alloca(length * sizeof(TCHAR));
+ wchar_t *text = (wchar_t *)_alloca(length * sizeof(wchar_t));
mir_sntprintf(text, length, L"%s [%s: %s]", curText, TranslateT("Account"), m_proto_interface->m_tszUserName);
SetWindowText(m_hwnd, text);
}
diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp
index 3274381078..24af3b02c1 100644
--- a/src/mir_app/src/proto_utils.cpp
+++ b/src/mir_app/src/proto_utils.cpp
@@ -172,12 +172,12 @@ MIR_APP_DLL(LPCTSTR) ProtoGetAvatarExtension(int format)
return L"";
}
-MIR_APP_DLL(int) ProtoGetAvatarFormat(const TCHAR *ptszFileName)
+MIR_APP_DLL(int) ProtoGetAvatarFormat(const wchar_t *ptszFileName)
{
if (ptszFileName == NULL)
return PA_FORMAT_UNKNOWN;
- const TCHAR *ptszExt = _tcsrchr(ptszFileName, '.');
+ const wchar_t *ptszExt = wcsrchr(ptszFileName, '.');
if (ptszExt == NULL)
return PA_FORMAT_UNKNOWN;
@@ -205,7 +205,7 @@ MIR_APP_DLL(int) ProtoGetAvatarFormat(const TCHAR *ptszFileName)
return PA_FORMAT_UNKNOWN;
}
-MIR_APP_DLL(int) ProtoGetBufferFormat(const void *pBuffer, const TCHAR **ptszExtension)
+MIR_APP_DLL(int) ProtoGetBufferFormat(const void *pBuffer, const wchar_t **ptszExtension)
{
if (!memcmp(pBuffer, "\x89PNG", 4)) {
if (ptszExtension) *ptszExtension = L".png";
@@ -236,7 +236,7 @@ MIR_APP_DLL(int) ProtoGetBufferFormat(const void *pBuffer, const TCHAR **ptszExt
return PA_FORMAT_UNKNOWN;
}
-MIR_APP_DLL(int) ProtoGetAvatarFileFormat(const TCHAR *ptszFileName)
+MIR_APP_DLL(int) ProtoGetAvatarFileFormat(const wchar_t *ptszFileName)
{
HANDLE hFile = CreateFile(ptszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
@@ -268,7 +268,7 @@ int PROTO_INTERFACE::Authorize(MEVENT)
return 1; // error
}
-int PROTO_INTERFACE::AuthDeny(MEVENT, const TCHAR*)
+int PROTO_INTERFACE::AuthDeny(MEVENT, const wchar_t*)
{
return 1; // error
}
@@ -278,12 +278,12 @@ int PROTO_INTERFACE::AuthRecv(MCONTACT, PROTORECVEVENT*)
return 1; // error
}
-int PROTO_INTERFACE::AuthRequest(MCONTACT, const TCHAR*)
+int PROTO_INTERFACE::AuthRequest(MCONTACT, const wchar_t*)
{
return 1; // error
}
-HANDLE PROTO_INTERFACE::FileAllow(MCONTACT, HANDLE, const TCHAR*)
+HANDLE PROTO_INTERFACE::FileAllow(MCONTACT, HANDLE, const wchar_t*)
{
return NULL; // error
}
@@ -293,12 +293,12 @@ int PROTO_INTERFACE::FileCancel(MCONTACT, HANDLE)
return 1; // error
}
-int PROTO_INTERFACE::FileDeny(MCONTACT, HANDLE, const TCHAR*)
+int PROTO_INTERFACE::FileDeny(MCONTACT, HANDLE, const wchar_t*)
{
return 1; // error
}
-int PROTO_INTERFACE::FileResume(HANDLE, int*, const TCHAR**)
+int PROTO_INTERFACE::FileResume(HANDLE, int*, const wchar_t**)
{
return 1; // error
}
@@ -313,17 +313,17 @@ int PROTO_INTERFACE::GetInfo(MCONTACT, int)
return 1; // error
}
-HANDLE PROTO_INTERFACE::SearchBasic(const TCHAR*)
+HANDLE PROTO_INTERFACE::SearchBasic(const wchar_t*)
{
return NULL; // error
}
-HANDLE PROTO_INTERFACE::SearchByEmail(const TCHAR*)
+HANDLE PROTO_INTERFACE::SearchByEmail(const wchar_t*)
{
return NULL; // error
}
-HANDLE PROTO_INTERFACE::SearchByName(const TCHAR*, const TCHAR*, const TCHAR*)
+HANDLE PROTO_INTERFACE::SearchByName(const wchar_t*, const wchar_t*, const wchar_t*)
{
return NULL; // error
}
@@ -364,7 +364,7 @@ int PROTO_INTERFACE::SendContacts(MCONTACT, int, int, MCONTACT*)
return 1; // error
}
-HANDLE PROTO_INTERFACE::SendFile(MCONTACT, const TCHAR*, TCHAR**)
+HANDLE PROTO_INTERFACE::SendFile(MCONTACT, const wchar_t*, wchar_t**)
{
return NULL; // error
}
@@ -399,7 +399,7 @@ int PROTO_INTERFACE::RecvAwayMsg(MCONTACT, int, PROTORECVEVENT*)
return 1; // error
}
-int PROTO_INTERFACE::SetAwayMsg(int, const TCHAR*)
+int PROTO_INTERFACE::SetAwayMsg(int, const wchar_t*)
{
return 1; // error
}
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp
index d162d38878..e06034833e 100644
--- a/src/mir_app/src/protocols.cpp
+++ b/src/mir_app/src/protocols.cpp
@@ -93,9 +93,9 @@ LIST<PROTOCOLDESCRIPTOR> filters(10, CompareProtos);
//------------------------------------------------------------------------------------
-void FreeFilesMatrix(TCHAR ***files);
+void FreeFilesMatrix(wchar_t ***files);
-static PROTO_INTERFACE* defInitProto(const char* szModule, const TCHAR*)
+static PROTO_INTERFACE* defInitProto(const char* szModule, const wchar_t*)
{
return AddDefaultAccount(szModule);
}
@@ -244,7 +244,7 @@ static INT_PTR Proto_ContactIsTyping(WPARAM wParam, LPARAM lParam)
void Proto_SetStatus(const char *szProto, unsigned status)
{
if (CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) {
- ptrT tszAwayMsg((TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGT, status, (LPARAM)szProto));
+ ptrT tszAwayMsg((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGT, status, (LPARAM)szProto));
CallProtoServiceInt(NULL, szProto, PS_SETAWAYMSG, status, tszAwayMsg);
}
CallProtoServiceInt(NULL, szProto, PS_SETSTATUS, status, 0);
@@ -382,22 +382,22 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char
case 1: return (INT_PTR)ppi->AddToList(wParam, (PROTOSEARCHRESULT*)lParam);
case 2: return (INT_PTR)ppi->AddToListByEvent(LOWORD(wParam), HIWORD(wParam), (MEVENT)lParam);
case 3: return (INT_PTR)ppi->Authorize((MEVENT)wParam);
- case 4: return (INT_PTR)ppi->AuthDeny((MEVENT)wParam, (TCHAR*)lParam);
+ case 4: return (INT_PTR)ppi->AuthDeny((MEVENT)wParam, (wchar_t*)lParam);
case 5: return (INT_PTR)ppi->AuthRecv(hContact, (PROTORECVEVENT*)lParam);
- case 6: return (INT_PTR)ppi->AuthRequest(hContact, (TCHAR*)lParam);
- case 8: return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, (TCHAR*)lParam);
+ case 6: return (INT_PTR)ppi->AuthRequest(hContact, (wchar_t*)lParam);
+ case 8: return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, (wchar_t*)lParam);
case 9: return (INT_PTR)ppi->FileCancel(hContact, (HANDLE)wParam);
- case 10: return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, (TCHAR*)lParam);
+ case 10: return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, (wchar_t*)lParam);
case 11: {
PROTOFILERESUME *pfr = (PROTOFILERESUME*)lParam;
- return (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action, (const TCHAR**)&pfr->szFilename);
+ return (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action, (const wchar_t**)&pfr->szFilename);
}
case 12: return (INT_PTR)ppi->GetCaps(wParam, lParam);
case 13: return (INT_PTR)Proto_GetIcon(ppi, wParam);
case 14: return (INT_PTR)ppi->GetInfo(hContact, wParam);
- case 15: return (INT_PTR)ppi->SearchBasic((TCHAR*)lParam);
- case 16: return (INT_PTR)ppi->SearchByEmail((TCHAR*)lParam);
+ case 15: return (INT_PTR)ppi->SearchBasic((wchar_t*)lParam);
+ case 16: return (INT_PTR)ppi->SearchByEmail((wchar_t*)lParam);
case 17: {
PROTOSEARCHBYNAME* psbn = (PROTOSEARCHBYNAME*)lParam;
return (INT_PTR)ppi->SearchByName(psbn->pszNick, psbn->pszFirstName, psbn->pszLastName);
@@ -409,14 +409,14 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char
case 22: return (INT_PTR)ppi->RecvMsg(hContact, (PROTORECVEVENT*)lParam);
case 23: return (INT_PTR)ppi->RecvUrl(hContact, (PROTORECVEVENT*)lParam);
case 24: return (INT_PTR)ppi->SendContacts(hContact, LOWORD(wParam), HIWORD(wParam), (MCONTACT*)lParam);
- case 25: return (INT_PTR)ppi->SendFile(hContact, (TCHAR*)wParam, (TCHAR**)lParam);
+ case 25: return (INT_PTR)ppi->SendFile(hContact, (wchar_t*)wParam, (wchar_t**)lParam);
case 26: return (INT_PTR)ppi->SendMsg(hContact, wParam, (const char*)lParam);
case 27: return (INT_PTR)ppi->SendUrl(hContact, wParam, (const char*)lParam);
case 28: return (INT_PTR)ppi->SetApparentMode(hContact, wParam);
case 29: return (INT_PTR)ppi->SetStatus(wParam);
case 30: return (INT_PTR)ppi->GetAwayMsg(hContact);
case 31: return (INT_PTR)ppi->RecvAwayMsg(hContact, wParam, (PROTORECVEVENT*)lParam);
- case 33: return (INT_PTR)ppi->SetAwayMsg(wParam, (TCHAR*)lParam);
+ case 33: return (INT_PTR)ppi->SetAwayMsg(wParam, (wchar_t*)lParam);
case 34: return (INT_PTR)ppi->UserIsTyping(wParam, lParam);
case 35: mir_strncpy((char*)lParam, ppi->m_szModuleName, wParam); return 0;
case 36:
diff --git a/src/mir_app/src/searchresults.cpp b/src/mir_app/src/searchresults.cpp
index 3aa2455e7a..8db9de005d 100644
--- a/src/mir_app/src/searchresults.cpp
+++ b/src/mir_app/src/searchresults.cpp
@@ -54,7 +54,7 @@ void SaveColumnSizes(HWND hwndResults)
db_set_b(NULL, "FindAdd", "SortAscending", (BYTE)dat->bSortAscending);
}
-static const TCHAR *szColumnNames[] = { NULL, NULL, L"Nick", L"First Name", L"Last Name", L"E-mail" };
+static const wchar_t *szColumnNames[] = { NULL, NULL, L"Nick", L"First Name", L"Last Name", L"E-mail" };
static int defaultColumnSizes[] = { 0, 90, 100, 100, 100, 2000 };
void LoadColumnSizes(HWND hwndResults, const char *szProto)
{
@@ -139,19 +139,19 @@ int CALLBACK SearchResultsCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lPa
case COLUMNID_PROTO:
return mir_strcmp(lsr1->szProto, lsr2->szProto)*sortMultiplier;
case COLUMNID_HANDLE:
- return mir_tstrcmpi(lsr1->psr.id.t, lsr2->psr.id.t)*sortMultiplier;
+ return mir_tstrcmpi(lsr1->psr.id.w, lsr2->psr.id.w)*sortMultiplier;
case COLUMNID_NICK:
- return mir_tstrcmpi(lsr1->psr.nick.t, lsr2->psr.nick.t)*sortMultiplier;
+ return mir_tstrcmpi(lsr1->psr.nick.w, lsr2->psr.nick.w)*sortMultiplier;
case COLUMNID_FIRST:
- return mir_tstrcmpi(lsr1->psr.firstName.t, lsr2->psr.firstName.t)*sortMultiplier;
+ return mir_tstrcmpi(lsr1->psr.firstName.w, lsr2->psr.firstName.w)*sortMultiplier;
case COLUMNID_LAST:
- return mir_tstrcmpi(lsr1->psr.lastName.t, lsr2->psr.lastName.t)*sortMultiplier;
+ return mir_tstrcmpi(lsr1->psr.lastName.w, lsr2->psr.lastName.w)*sortMultiplier;
case COLUMNID_EMAIL:
- return mir_tstrcmpi(lsr1->psr.email.t, lsr2->psr.email.t)*sortMultiplier;
+ return mir_tstrcmpi(lsr1->psr.email.w, lsr2->psr.email.w)*sortMultiplier;
}
}
else {
- TCHAR szText1[100], szText2[100];
+ wchar_t szText1[100], szText2[100];
ListView_GetItemText(hList, (int)lParam1, sortCol, szText1, _countof(szText1));
ListView_GetItemText(hList, (int)lParam2, sortCol, szText2, _countof(szText2));
return mir_tstrcmpi(szText1, szText2)*sortMultiplier;
@@ -167,11 +167,11 @@ void FreeSearchResults(HWND hwndResults)
ListView_GetItem(hwndResults, &lvi);
ListSearchResult *lsr = (ListSearchResult*)lvi.lParam;
if (lsr == NULL) continue;
- mir_free(lsr->psr.id.t);
- mir_free(lsr->psr.email.t);
- mir_free(lsr->psr.nick.t);
- mir_free(lsr->psr.firstName.t);
- mir_free(lsr->psr.lastName.t);
+ mir_free(lsr->psr.id.w);
+ mir_free(lsr->psr.email.w);
+ mir_free(lsr->psr.nick.w);
+ mir_free(lsr->psr.firstName.w);
+ mir_free(lsr->psr.lastName.w);
mir_free(lsr);
}
ListView_DeleteAllItems(hwndResults);
@@ -181,9 +181,9 @@ void FreeSearchResults(HWND hwndResults)
// on its own thread
static void BeginSearchFailed(void *arg)
{
- TCHAR buf[128];
+ wchar_t buf[128];
if (arg != NULL) {
- const TCHAR *protoName = (TCHAR*)arg;
+ const wchar_t *protoName = (wchar_t*)arg;
mir_sntprintf(buf,
TranslateT("Could not start a search on '%s', there was a problem - is %s connected?"),
protoName, protoName);
diff --git a/src/mir_app/src/services.cpp b/src/mir_app/src/services.cpp
index 08eaadbbff..4453ce3c83 100644
--- a/src/mir_app/src/services.cpp
+++ b/src/mir_app/src/services.cpp
@@ -144,7 +144,7 @@ int GetFontSettingFromDB(char *settings_group, char *prefix, LOGFONT *lf, COLORR
int retval = 0;
ptrT tszGroup(db_get_tsa(NULL, settings_group, idstr));
if (tszGroup != NULL)
- _tcsncpy_s(lf->lfFaceName, tszGroup, _TRUNCATE);
+ wcsncpy_s(lf->lfFaceName, tszGroup, _TRUNCATE);
else
retval = 1;
@@ -200,7 +200,7 @@ int CreateFromFontSettings(FontSettingsT *fs, LOGFONT *lf)
{
GetDefaultFontSetting(lf, 0);
- _tcsncpy_s(lf->lfFaceName, fs->szFace, _TRUNCATE);
+ wcsncpy_s(lf->lfFaceName, fs->szFace, _TRUNCATE);
lf->lfWidth = lf->lfEscapement = lf->lfOrientation = 0;
lf->lfWeight = fs->style & DBFONTF_BOLD ? FW_BOLD : FW_NORMAL;
@@ -232,7 +232,7 @@ void UpdateFontSettings(FontIDW *font_id, FontSettingsT *fontsettings)
fontsettings->size = (char)lf.lfHeight;
fontsettings->charset = lf.lfCharSet;
fontsettings->colour = colour;
- _tcsncpy_s(fontsettings->szFace, lf.lfFaceName, _TRUNCATE);
+ wcsncpy_s(fontsettings->szFace, lf.lfFaceName, _TRUNCATE);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -292,7 +292,7 @@ static INT_PTR sttGetFontWorker(FontIDW *font_id, LOGFONT *lf)
for (int i = 0; i < font_id_list.getCount(); i++) {
FontInternal& F = font_id_list[i];
- if (!_tcsncmp(F.name, font_id->name, _countof(F.name)) && !_tcsncmp(F.group, font_id->group, _countof(F.group))) {
+ if (!wcsncmp(F.name, font_id->name, _countof(F.name)) && !wcsncmp(F.group, font_id->group, _countof(F.group))) {
if (GetFontSettingFromDB(F.dbSettingsGroup, F.prefix, lf, &colour, F.flags) && (F.flags & FIDF_DEFAULTVALID)) {
CreateFromFontSettings(&F.deffontsettings, lf);
colour = F.deffontsettings.colour;
@@ -477,7 +477,7 @@ static INT_PTR sttGetEffectWorker(EffectIDW *effect_id, FONTEFFECT *effect)
{
for (int i = 0; i < effect_id_list.getCount(); i++) {
EffectInternal& E = effect_id_list[i];
- if (!_tcsncmp(E.name, effect_id->name, _countof(E.name)) && !_tcsncmp(E.group, effect_id->group, _countof(E.group))) {
+ if (!wcsncmp(E.name, effect_id->name, _countof(E.name)) && !wcsncmp(E.group, effect_id->group, _countof(E.group))) {
FONTEFFECT temp;
UpdateEffectSettings(effect_id, &temp);
diff --git a/src/mir_app/src/skin.h b/src/mir_app/src/skin.h
index 7ce5fbdc36..121169f8c3 100644
--- a/src/mir_app/src/skin.h
+++ b/src/mir_app/src/skin.h
@@ -38,7 +38,7 @@ struct THotkeyItem
{
THotkeyType type;
char *pszService, *pszName; // pszName is valid _only_ for "root" hotkeys
- TCHAR *ptszSection, *ptszDescription;
+ wchar_t *ptszSection, *ptszDescription;
LPARAM lParam;
WORD DefHotkey, Hotkey;
bool Enabled;
@@ -56,8 +56,8 @@ struct THotkeyItem
bool UnregisterHotkey; // valid only during WM_APP message in options UI, used to remove unregistered hotkeys from options
- __inline TCHAR* getSection() const { return TranslateTH(hLangpack, ptszSection); }
- __inline TCHAR* getDescr() const { return TranslateTH(hLangpack, ptszDescription); }
+ __inline wchar_t* getSection() const { return TranslateTH(hLangpack, ptszSection); }
+ __inline wchar_t* getDescr() const { return TranslateTH(hLangpack, ptszDescription); }
};
extern LIST<THotkeyItem> hotkeys;
diff --git a/src/mir_app/src/skin2opts.cpp b/src/mir_app/src/skin2opts.cpp
index b8563f05ec..feb5795b0d 100644
--- a/src/mir_app/src/skin2opts.cpp
+++ b/src/mir_app/src/skin2opts.cpp
@@ -39,10 +39,10 @@ struct IcoLibOptsData
/////////////////////////////////////////////////////////////////////////////////////////
-static HICON ExtractIconFromPath(const TCHAR *path, int cxIcon, int cyIcon)
+static HICON ExtractIconFromPath(const wchar_t *path, int cxIcon, int cyIcon)
{
- TCHAR *comma;
- TCHAR file[MAX_PATH], fileFull[MAX_PATH];
+ wchar_t *comma;
+ wchar_t file[MAX_PATH], fileFull[MAX_PATH];
int n;
HICON hIcon;
@@ -50,11 +50,11 @@ static HICON ExtractIconFromPath(const TCHAR *path, int cxIcon, int cyIcon)
return (HICON)NULL;
mir_tstrncpy(file, path, _countof(file));
- comma = _tcsrchr(file, ',');
+ comma = wcsrchr(file, ',');
if (!comma)
n = 0;
else {
- n = _ttoi(comma + 1);
+ n = _wtoi(comma + 1);
*comma = 0;
}
PathToAbsoluteT(file, fileFull);
@@ -110,14 +110,14 @@ HICON IconItem_GetIcon_Preview(IcolibItem* item)
/////////////////////////////////////////////////////////////////////////////////////////
// IcoLib GUI service routines
-static void __fastcall MySetCursor(TCHAR* nCursor)
+static void __fastcall MySetCursor(wchar_t* nCursor)
{
SetCursor(LoadCursor(NULL, nCursor));
}
-static void LoadSectionIcons(TCHAR *filename, SectionItem* sectionActive)
+static void LoadSectionIcons(wchar_t *filename, SectionItem* sectionActive)
{
- TCHAR path[MAX_PATH];
+ wchar_t path[MAX_PATH];
mir_sntprintf(path, L"%s,", filename);
size_t suffIndx = mir_tstrlen(path);
@@ -127,7 +127,7 @@ static void LoadSectionIcons(TCHAR *filename, SectionItem* sectionActive)
IcolibItem *item = iconList[indx];
if (item->default_file && item->section == sectionActive) {
- _itot(item->default_indx, path + suffIndx, 10);
+ _itow(item->default_indx, path + suffIndx, 10);
HICON hIcon = ExtractIconFromPath(path, item->cx, item->cy);
if (!hIcon)
continue;
@@ -142,7 +142,7 @@ static void LoadSectionIcons(TCHAR *filename, SectionItem* sectionActive)
}
}
-void LoadSubIcons(HWND htv, TCHAR *filename, HTREEITEM hItem)
+void LoadSubIcons(HWND htv, wchar_t *filename, HTREEITEM hItem)
{
TVITEM tvi;
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
@@ -220,10 +220,10 @@ static int OpenPopupMenu(HWND hwndDlg)
return cmd;
}
-static TCHAR* OpenFileDlg(HWND hParent, const TCHAR* szFile, BOOL bAll)
+static wchar_t* OpenFileDlg(HWND hParent, const wchar_t* szFile, BOOL bAll)
{
OPENFILENAME ofn = { 0 };
- TCHAR filter[512], *pfilter, file[MAX_PATH * 2];
+ wchar_t filter[512], *pfilter, file[MAX_PATH * 2];
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
ofn.hwndOwner = hParent;
@@ -302,10 +302,10 @@ void DoIconsChanged(HWND hwndDlg)
}
}
-static HTREEITEM FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const TCHAR *name)
+static HTREEITEM FindNamedTreeItemAt(HWND hwndTree, HTREEITEM hItem, const wchar_t *name)
{
TVITEM tvi = { 0 };
- TCHAR str[MAX_PATH];
+ wchar_t str[MAX_PATH];
if (hItem)
tvi.hItem = TreeView_GetChild(hwndTree, hItem);
@@ -397,7 +397,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
HIMAGELIST hIml = ListView_GetImageList(hPreview, LVSIL_NORMAL);
ImageList_RemoveAll(hIml);
- TCHAR filename[MAX_PATH], caption[64];
+ wchar_t filename[MAX_PATH], caption[64];
GetDlgItemText(hwndDlg, IDC_ICONSET, filename, _countof(filename));
{
RECT rcPreview, rcGroup;
@@ -407,7 +407,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
//SetWindowPos(hPreview, 0, 0, 0, rcPreview.right-rcPreview.left, rcGroup.bottom-rcPreview.top, SWP_NOZORDER|SWP_NOMOVE);
}
- if (_taccess(filename, 0) != 0) {
+ if (_waccess(filename, 0) != 0) {
MySetCursor(IDC_ARROW);
break;
}
@@ -437,7 +437,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
switch (LOWORD(wParam)) {
case IDC_BROWSE:
{
- TCHAR str[MAX_PATH], *file;
+ wchar_t str[MAX_PATH], *file;
GetDlgItemText(hwndDlg, IDC_ICONSET, str, _countof(str));
if (!(file = OpenFileDlg(GetParent(hwndDlg), str, TRUE)))
break;
@@ -512,7 +512,7 @@ INT_PTR CALLBACK DlgProcIconImport(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
ImageList_EndDrag();
dragging = 0;
if (dropHiLite != -1) {
- TCHAR path[MAX_PATH], fullPath[MAX_PATH], filename[MAX_PATH];
+ wchar_t path[MAX_PATH], fullPath[MAX_PATH], filename[MAX_PATH];
LVITEM lvi;
GetDlgItemText(hwndDlg, IDC_ICONSET, fullPath, _countof(fullPath));
@@ -655,7 +655,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
{
HWND hwndTree = GetDlgItem(hwndDlg, IDC_CATEGORYLIST);
int indx;
- TCHAR itemName[1024];
+ wchar_t itemName[1024];
HTREEITEM hSection;
if (!hwndTree) break;
@@ -664,7 +664,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
TreeView_DeleteAllItems(hwndTree);
for (indx = 0; indx < sectionList.getCount(); indx++) {
- TCHAR* sectionName;
+ wchar_t* sectionName;
int sectionLevel = 0;
hSection = NULL;
@@ -673,10 +673,10 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
while (sectionName) {
// allow multi-level tree
- TCHAR* pItemName = sectionName;
+ wchar_t* pItemName = sectionName;
HTREEITEM hItem;
- if (sectionName = _tcschr(sectionName, '/')) {
+ if (sectionName = wcschr(sectionName, '/')) {
// one level deeper
*sectionName = 0;
}
@@ -809,7 +809,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
IcolibItem *item = iconList[lvi.lParam];
SafeDestroyIcon(item->temp_icon);
- TCHAR *path = (TCHAR*)lParam;
+ wchar_t *path = (wchar_t*)lParam;
replaceStrT(item->temp_file, path);
item->temp_icon = (HICON)ExtractIconFromPath(path, item->cx, item->cy);
item->temp_reset = FALSE;
@@ -828,12 +828,12 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
break;
}
else if (LOWORD(wParam) == IDC_LOADICONS) {
- TCHAR filetmp[1] = { 0 };
- TCHAR *file;
+ wchar_t filetmp[1] = { 0 };
+ wchar_t *file;
if (file = OpenFileDlg(hwndDlg, filetmp, FALSE)) {
HWND htv = GetDlgItem(hwndDlg, IDC_CATEGORYLIST);
- TCHAR filename[MAX_PATH];
+ wchar_t filename[MAX_PATH];
PathToRelativeT(file, filename);
mir_free(file);
@@ -932,7 +932,7 @@ INT_PTR CALLBACK DlgProcIcoLibOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
if (lvi.lParam < iconList.getCount()) {
IcolibItem *item = iconList[lvi.lParam];
if (item->temp_file)
- _tcsncpy_s(pInfoTip->pszText, pInfoTip->cchTextMax, item->temp_file, _TRUNCATE);
+ wcsncpy_s(pInfoTip->pszText, pInfoTip->cchTextMax, item->temp_file, _TRUNCATE);
else if (item->default_file)
mir_sntprintf(pInfoTip->pszText, pInfoTip->cchTextMax, L"%s, %d", item->default_file->file, item->default_indx);
}
diff --git a/src/mir_app/src/skinicons.cpp b/src/mir_app/src/skinicons.cpp
index 858ccabc22..e50dba78e5 100644
--- a/src/mir_app/src/skinicons.cpp
+++ b/src/mir_app/src/skinicons.cpp
@@ -129,7 +129,7 @@ static HICON LoadSmallIconShared(HINSTANCE hInstance, LPCTSTR lpIconName)
// load small icon (not shared) it IS NEED to be destroyed
static HICON LoadSmallIcon(HINSTANCE hInstance, LPCTSTR lpIconName)
{
- TCHAR filename[MAX_PATH];
+ wchar_t filename[MAX_PATH];
if (GetModuleFileName(hInstance, filename, MAX_PATH) == 0)
return NULL;
@@ -273,35 +273,35 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big)
if (hIcon == NULL && (caps2 == 0 || (caps2 & statusIcons[statusIndx].pf2))) {
PROTOACCOUNT *pa = Proto_GetAccount(szProto);
if (pa) {
- TCHAR szPath[MAX_PATH], szFullPath[MAX_PATH], *str;
+ wchar_t szPath[MAX_PATH], szFullPath[MAX_PATH], *str;
GetModuleFileName(NULL, szPath, _countof(szPath));
// Queried protocol isn't in list, adding
- TCHAR tszSection[MAX_PATH];
+ wchar_t tszSection[MAX_PATH];
mir_sntprintf(tszSection, _T(PROTOCOLS_PREFIX)L"/%s", pa->tszAccountName);
SKINICONDESC sid = { 0 };
- sid.section.t = tszSection;
+ sid.section.w = tszSection;
sid.flags = SIDF_ALL_TCHAR;
- str = _tcsrchr(szPath, '\\');
+ str = wcsrchr(szPath, '\\');
if (str != NULL)
*str = 0;
mir_sntprintf(szFullPath, L"%s\\Icons\\proto_%S.dll", szPath, pa->szProtoName);
if (GetFileAttributes(szFullPath) != INVALID_FILE_ATTRIBUTES)
- sid.defaultFile.t = szFullPath;
+ sid.defaultFile.w = szFullPath;
else {
mir_sntprintf(szFullPath, L"%s\\Plugins\\%S.dll", szPath, szProto);
if (int(ExtractIconEx(szFullPath, statusIcons[statusIndx].resource_id, NULL, &hIcon, 1)) > 0) {
DestroyIcon(hIcon);
- sid.defaultFile.t = szFullPath;
+ sid.defaultFile.w = szFullPath;
hIcon = NULL;
}
if (sid.defaultFile.a == NULL) {
if (str != NULL)
*str = '\\';
- sid.defaultFile.t = szPath;
+ sid.defaultFile.w = szPath;
}
}
@@ -317,7 +317,7 @@ MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big)
// format: core_%s%d
mir_snprintf(iconName, "%s%s%d", statusIconsFmt, szProto, i);
sid.pszName = iconName;
- sid.description.t = cli.pfnGetStatusModeDescription(statusIcons[i].id, 0);
+ sid.description.w = cli.pfnGetStatusModeDescription(statusIcons[i].id, 0);
sid.iDefaultIndex = statusIcons[i].resource_id;
IcoLib_AddIcon(&sid, 0);
}
@@ -379,12 +379,12 @@ MIR_APP_DLL(HICON) Skin_LoadIcon(int idx, bool big)
int LoadSkinIcons(void)
{
- TCHAR modulePath[MAX_PATH];
+ wchar_t modulePath[MAX_PATH];
GetModuleFileName(g_hInst, modulePath, _countof(modulePath));
char iconName[MAX_PATH];
SKINICONDESC sid = { 0 };
- sid.defaultFile.t = modulePath;
+ sid.defaultFile.w = modulePath;
sid.flags = SIDF_PATH_TCHAR;
sid.pszName = iconName;
diff --git a/src/mir_app/src/sounds.cpp b/src/mir_app/src/sounds.cpp
index abda0e43fd..acdf34d5b9 100644
--- a/src/mir_app/src/sounds.cpp
+++ b/src/mir_app/src/sounds.cpp
@@ -29,13 +29,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
struct SoundItem
{
char* name;
- TCHAR* ptszSection;
- TCHAR* ptszDescription;
- TCHAR* ptszTempFile;
+ wchar_t* ptszSection;
+ wchar_t* ptszDescription;
+ wchar_t* ptszTempFile;
int hLangpack;
- __inline TCHAR* getSection() const { return TranslateTH(hLangpack, ptszSection); }
- __inline TCHAR* getDescr() const { return TranslateTH(hLangpack, ptszDescription); }
+ __inline wchar_t* getSection() const { return TranslateTH(hLangpack, ptszSection); }
+ __inline wchar_t* getDescr() const { return TranslateTH(hLangpack, ptszDescription); }
__inline void clear(void)
{
@@ -83,7 +83,7 @@ static INT_PTR ServiceSkinAddNewSound(WPARAM wParam, LPARAM lParam)
item->hLangpack = (int)wParam;
arSounds.insert(item);
- TCHAR* ptszDefaultFile;
+ wchar_t* ptszDefaultFile;
if (ssd->dwFlags & SSDF_UNICODE) {
item->ptszDescription = mir_tstrdup(ssd->ptszDescription);
item->ptszSection = mir_tstrdup((ssd->pszSection != NULL) ? ssd->ptszSection : L"Other");
@@ -109,7 +109,7 @@ static INT_PTR ServiceSkinAddNewSound(WPARAM wParam, LPARAM lParam)
static int SkinPlaySoundDefault(WPARAM wParam, LPARAM lParam)
{
- TCHAR* pszFile = (TCHAR*) lParam;
+ wchar_t* pszFile = (wchar_t*) lParam;
if (pszFile && (db_get_b(NULL, "Skin", "UseSound", 0) || (int)wParam == 1))
PlaySound(pszFile, NULL, SND_ASYNC | SND_FILENAME | SND_NOSTOP);
@@ -118,11 +118,11 @@ static int SkinPlaySoundDefault(WPARAM wParam, LPARAM lParam)
static INT_PTR ServiceSkinPlaySoundFile(WPARAM, LPARAM lParam)
{
- TCHAR *ptszFileName = (TCHAR*)lParam;
+ wchar_t *ptszFileName = (wchar_t*)lParam;
if (ptszFileName == NULL)
return 1;
- TCHAR tszFull[MAX_PATH];
+ wchar_t tszFull[MAX_PATH];
PathToAbsoluteT(ptszFileName, tszFull);
NotifyEventHooks(hPlayEvent, 0, (LPARAM)tszFull);
return 0;
@@ -266,7 +266,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
else {
DBVARIANT dbv;
if (!db_get_ts(NULL, "SkinSounds", arSounds[tvi.lParam].name, &dbv)) {
- TCHAR szPathFull[MAX_PATH];
+ wchar_t szPathFull[MAX_PATH];
PathToAbsoluteT(dbv.ptszVal, szPathFull);
NotifyEventHooks(hPlayEvent, 1, (LPARAM)szPathFull);
db_free(&dbv);
@@ -290,9 +290,9 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
SoundItem& snd = arSounds[tvi.lParam];
- TCHAR str[MAX_PATH], strFull[MAX_PATH], strdir[MAX_PATH], filter[MAX_PATH];
+ wchar_t str[MAX_PATH], strFull[MAX_PATH], strdir[MAX_PATH], filter[MAX_PATH];
if (snd.ptszTempFile)
- _tcsncpy_s(strFull, snd.ptszTempFile, _TRUNCATE);
+ wcsncpy_s(strFull, snd.ptszTempFile, _TRUNCATE);
else {
if (db_get_b(NULL, "SkinSoundsOff", snd.name, 0) == 0) {
DBVARIANT dbv;
@@ -301,7 +301,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
db_free(&dbv);
} } }
- _tcsncpy_s(strFull, (snd.ptszTempFile ? snd.ptszTempFile : L""), _TRUNCATE);
+ wcsncpy_s(strFull, (snd.ptszTempFile ? snd.ptszTempFile : L""), _TRUNCATE);
PathToAbsoluteT(strFull, strdir);
OPENFILENAME ofn;
@@ -315,7 +315,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
ofn.hInstance = NULL;
ofn.lpstrFilter = filter;
- TCHAR* slash = _tcsrchr(strdir, '\\');
+ wchar_t* slash = wcsrchr(strdir, '\\');
if (slash) {
*slash = 0;
ofn.lpstrInitialDir = strdir;
@@ -387,7 +387,7 @@ INT_PTR CALLBACK DlgProcSoundOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
if (tvi.lParam == -1)
SendMessage(hwndDlg, DM_HIDEPANE, 0, 0);
else {
- TCHAR buf[256];
+ wchar_t buf[256];
mir_sntprintf(buf, L"%s: %s", arSounds[tvi.lParam].getSection(), arSounds[tvi.lParam].getDescr());
SetDlgItemText(hwndDlg, IDC_NAMEVAL, buf);
if (arSounds[tvi.lParam].ptszTempFile)
diff --git a/src/mir_app/src/srmm_statusicon.cpp b/src/mir_app/src/srmm_statusicon.cpp
index e46a071c74..eeb76f9b13 100644
--- a/src/mir_app/src/srmm_statusicon.cpp
+++ b/src/mir_app/src/srmm_statusicon.cpp
@@ -42,7 +42,7 @@ struct StatusIconChild : public MZeroedObject
MCONTACT hContact;
HICON hIcon, hIconDisabled;
int flags;
- TCHAR *tszTooltip;
+ wchar_t *tszTooltip;
};
struct StatusIconMain : public MZeroedObject
diff --git a/src/mir_app/src/xmlApi.cpp b/src/mir_app/src/xmlApi.cpp
index ffa87f4f79..df2af6656a 100644
--- a/src/mir_app/src/xmlApi.cpp
+++ b/src/mir_app/src/xmlApi.cpp
@@ -182,8 +182,8 @@ MIR_APP_DLL(void) xmlAddAttr(HXML _n, LPCTSTR attrName, LPCTSTR attrValue)
MIR_APP_DLL(void) xmlAddAttrInt(HXML _n, LPCTSTR attrName, int attrValue)
{
- TCHAR buf[40];
- _itot(attrValue, buf, 10);
+ wchar_t buf[40];
+ _itow(attrValue, buf, 10);
XMLNode(_n).addAttribute(attrName, buf);
}
diff --git a/src/mir_app/src/xmlParser.cpp b/src/mir_app/src/xmlParser.cpp
index 9e79495845..9817e0fce5 100644
--- a/src/mir_app/src/xmlParser.cpp
+++ b/src/mir_app/src/xmlParser.cpp
@@ -1100,7 +1100,7 @@ XMLNode::XMLNode(XMLNodeData *pParent, XMLSTR lpszName, char isDeclaration)
d->lpszNS = NULL;
if (lpszName && pParent && pParent->lpszName && !pParent->isDeclaration) {
- TCHAR* p = _tcschr(lpszName, ':');
+ wchar_t* p = wcschr(lpszName, ':');
if (p) {
*p = 0;
d->lpszNS = d->lpszName;
@@ -1197,7 +1197,7 @@ XMLAttribute *XMLNode::addAttribute_priv(int memoryIncrease, XMLSTR lpszName, XM
pAttr->lpszValue = lpszValuev;
d->nAttribute++;
- TCHAR* p = _tcschr(lpszName, ':');
+ wchar_t* p = wcschr(lpszName, ':');
if (p)
if (!mir_tstrcmp(p+1, d->lpszNS) || (d->pParent && !mir_tstrcmp(p+1, d->pParent->lpszNS)))
*p = 0;
@@ -1541,7 +1541,7 @@ LBL_Error:
#endif
}
else {
- const TCHAR* p = _tcschr(lpszTemp, ':');
+ const wchar_t* p = wcschr(lpszTemp, ':');
if (!p)
goto LBL_Error;
diff --git a/src/mir_app/src/xmlParser.h b/src/mir_app/src/xmlParser.h
index aa9bf91a88..6433d00191 100644
--- a/src/mir_app/src/xmlParser.h
+++ b/src/mir_app/src/xmlParser.h
@@ -121,15 +121,11 @@
#undef _XMLWIDECHAR
#endif
-#ifdef _XMLWINDOWS
-#include <tchar.h>
-#else
#define XMLDLLENTRY
#ifndef XML_NO_WIDE_CHAR
#include <wchar.h> // to have 'wcsrtombs' for ANSI version
// to have 'mbsrtowcs' for WIDECHAR version
#endif
-#endif
// Some common types for char set portable code
#ifdef _XMLWIDECHAR