From 6e53dfca72b932c4bdcd7aa02ca62bf8b2630eac Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 26 Jul 2016 09:20:25 +0000 Subject: less TCHARs: - TCHAR is replaced with wchar_t everywhere; - LPGENT replaced with either LPGENW or LPGEN; - fixes for ANSI plugins that improperly used _t functions; - TCHAR *t removed from MAllStrings; - ptszGroup, ptszTitle & ptszTab in OPTIONSDIALOGPAGE replaced with pwsz* git-svn-id: http://svn.miranda-ng.org/main/trunk@17133 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Scriver/src/chat/chat.h | 10 +-- plugins/Scriver/src/chat/main.cpp | 2 +- plugins/Scriver/src/chat/manager.cpp | 4 +- plugins/Scriver/src/chat/options.cpp | 136 +++++++++++++++++------------------ plugins/Scriver/src/chat/tools.cpp | 14 ++-- plugins/Scriver/src/chat/window.cpp | 62 ++++++++-------- plugins/Scriver/src/globals.cpp | 32 ++++----- plugins/Scriver/src/infobar.cpp | 8 +-- plugins/Scriver/src/input.cpp | 10 +-- plugins/Scriver/src/msgdialog.cpp | 52 +++++++------- plugins/Scriver/src/msglog.cpp | 16 ++--- plugins/Scriver/src/msgoptions.cpp | 90 +++++++++++------------ plugins/Scriver/src/msgs.cpp | 11 ++- plugins/Scriver/src/msgs.h | 8 +-- plugins/Scriver/src/msgtimedout.cpp | 4 +- plugins/Scriver/src/msgwindow.cpp | 20 +++--- plugins/Scriver/src/msgwindow.h | 8 +-- plugins/Scriver/src/sendqueue.cpp | 2 +- plugins/Scriver/src/sendqueue.h | 2 +- plugins/Scriver/src/utils.cpp | 36 +++++----- plugins/Scriver/src/utils.h | 10 +-- 21 files changed, 268 insertions(+), 269 deletions(-) (limited to 'plugins/Scriver') diff --git a/plugins/Scriver/src/chat/chat.h b/plugins/Scriver/src/chat/chat.h index 949202712a..e1d2c3a693 100644 --- a/plugins/Scriver/src/chat/chat.h +++ b/plugins/Scriver/src/chat/chat.h @@ -60,7 +60,7 @@ struct LOGSTREAMDATA : public GCLogStreamDataBase struct SESSION_INFO : public GCSessionInfoBase, public CommonWindowData { - TCHAR szSearch[255]; + wchar_t szSearch[255]; int desiredInputAreaHeight; }; @@ -79,7 +79,7 @@ void LoadMsgLogBitmaps(void); void FreeMsgLogBitmaps(void); // window.c -int GetTextPixelSize( TCHAR* pszText, HFONT hFont, BOOL bWidth); +int GetTextPixelSize( wchar_t* pszText, HFONT hFont, BOOL bWidth); // options.c int OptionsInit(void); @@ -89,13 +89,13 @@ void ShowRoom(SESSION_INFO *si, WPARAM wp, BOOL bSetForeground); // manager.c HWND SM_FindWindowByContact(MCONTACT hContact); -SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO* currSession, SESSION_INFO* prevSession, const TCHAR* pszOriginal, const TCHAR* pszCurrent); +SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO* currSession, SESSION_INFO* prevSession, const wchar_t* pszOriginal, const wchar_t* pszCurrent); char SM_GetStatusIndicator(SESSION_INFO *si, USERINFO *ui); // tools.c BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight, int bManyFix); -TCHAR* my_strstri(const TCHAR* s1, const TCHAR* s2) ; -UINT CreateGCMenu(HWND hwndDlg, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, TCHAR* pszUID, TCHAR* pszWordText); +wchar_t* my_strstri(const wchar_t* s1, const wchar_t* s2) ; +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); ////////////////////////////////////////////////////////////////////////////////// diff --git a/plugins/Scriver/src/chat/main.cpp b/plugins/Scriver/src/chat/main.cpp index 29b88790d4..a223f9898d 100644 --- a/plugins/Scriver/src/chat/main.cpp +++ b/plugins/Scriver/src/chat/main.cpp @@ -154,7 +154,7 @@ static void OnLoadSettings() int Chat_Load() { - CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENT("Messaging") L"/" LPGENT("Group chats"), FONTMODE_SKIP }; + CHAT_MANAGER_INITDATA data = { &g_Settings, sizeof(MODULEINFO), sizeof(SESSION_INFO), LPGENW("Messaging") L"/" LPGENW("Group chats"), FONTMODE_SKIP }; mir_getCI(&data); saveCI = *pci; diff --git a/plugins/Scriver/src/chat/manager.cpp b/plugins/Scriver/src/chat/manager.cpp index 823547751c..e71eecc249 100644 --- a/plugins/Scriver/src/chat/manager.cpp +++ b/plugins/Scriver/src/chat/manager.cpp @@ -34,13 +34,13 @@ HWND SM_FindWindowByContact(MCONTACT hContact) return NULL; } -SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO* currSession, SESSION_INFO* prevSession, const TCHAR* pszOriginal, const TCHAR* pszCurrent) +SESSION_INFO* SM_FindSessionAutoComplete(const char* pszModule, SESSION_INFO* currSession, SESSION_INFO* prevSession, const wchar_t* pszOriginal, const wchar_t* pszCurrent) { SESSION_INFO* pResult = NULL; if (prevSession == NULL && my_strstri(currSession->ptszName, pszOriginal) == currSession->ptszName) pResult = currSession; else { - TCHAR* pszName = NULL; + wchar_t* pszName = NULL; SESSION_INFO* pTemp = pci->wndList; if (currSession == prevSession) pszCurrent = pszOriginal; diff --git a/plugins/Scriver/src/chat/options.cpp b/plugins/Scriver/src/chat/options.cpp index db8d646289..6f83994009 100644 --- a/plugins/Scriver/src/chat/options.cpp +++ b/plugins/Scriver/src/chat/options.cpp @@ -27,7 +27,7 @@ static HWND hPathTip = 0; struct branch_t { - TCHAR* szDescr; + wchar_t* szDescr; char* szDBName; int iMode; BYTE bDefault; @@ -35,79 +35,79 @@ struct branch_t }; static struct branch_t branch1[] = { - { LPGENT("Flash when someone speaks"), "FlashWindow", 0, 0, NULL }, - { LPGENT("Flash when a word is highlighted"), "FlashWindowHighlight", 0, 1, NULL }, - { LPGENT("Show chat nick list"), "ShowNicklist", 0, 1, NULL }, - { LPGENT("Enable button context menus"), "RightClickFilter", 0, 0, NULL }, - { LPGENT("Show topic on your contact list (if supported)"), "TopicOnClist", 0, 0, NULL }, - { LPGENT("Do not play sounds when focused"), "SoundsFocus", 0, 0, NULL }, - { LPGENT("Do not pop up when joining"), "PopupOnJoin", 0, 0, NULL }, - { LPGENT("Show and hide by double clicking in the contact list"), "ToggleVisibility", 0, 0, NULL }, - { LPGENT("Show contact statuses (if supported)"), "ShowContactStatus", 0, 0, NULL }, - { LPGENT("Display contact status icon before role icon"), "ContactStatusFirst", 0, 0, NULL }, - { LPGENT("Add ':' to auto-completed names"), "AddColonToAutoComplete", 0, 1, NULL } + { LPGENW("Flash when someone speaks"), "FlashWindow", 0, 0, NULL }, + { LPGENW("Flash when a word is highlighted"), "FlashWindowHighlight", 0, 1, NULL }, + { LPGENW("Show chat nick list"), "ShowNicklist", 0, 1, NULL }, + { LPGENW("Enable button context menus"), "RightClickFilter", 0, 0, NULL }, + { LPGENW("Show topic on your contact list (if supported)"), "TopicOnClist", 0, 0, NULL }, + { LPGENW("Do not play sounds when focused"), "SoundsFocus", 0, 0, NULL }, + { LPGENW("Do not pop up when joining"), "PopupOnJoin", 0, 0, NULL }, + { LPGENW("Show and hide by double clicking in the contact list"), "ToggleVisibility", 0, 0, NULL }, + { LPGENW("Show contact statuses (if supported)"), "ShowContactStatus", 0, 0, NULL }, + { LPGENW("Display contact status icon before role icon"), "ContactStatusFirst", 0, 0, NULL }, + { LPGENW("Add ':' to auto-completed names"), "AddColonToAutoComplete", 0, 1, NULL } }; static struct branch_t branch2[] = { - { LPGENT("Show icons"), "IconFlags", GC_EVENT_TOPIC | GC_EVENT_JOIN | GC_EVENT_QUIT | + { LPGENW("Show icons"), "IconFlags", GC_EVENT_TOPIC | GC_EVENT_JOIN | GC_EVENT_QUIT | GC_EVENT_MESSAGE | GC_EVENT_ACTION | GC_EVENT_HIGHLIGHT | GC_EVENT_PART | GC_EVENT_KICK | GC_EVENT_NOTICE | GC_EVENT_NICK | GC_EVENT_INFORMATION | GC_EVENT_ADDSTATUS, 0, NULL }, - { LPGENT("Prefix all events with a timestamp"), "ShowTimeStamp", 0, 1, NULL }, - { LPGENT("Only prefix with timestamp if it has changed"), "ShowTimeStampIfChanged", 0, 0, NULL }, - { LPGENT("Timestamp has same color as event"), "TimeStampEventColour", 0, 0, NULL }, - { LPGENT("Indent the second line of a message"), "LogIndentEnabled", 0, 1, NULL }, - { LPGENT("Limit user names to 20 characters"), "LogLimitNames", 0, 1, NULL }, - { LPGENT("Strip colors from messages"), "StripFormatting", 0, 0, NULL }, - { LPGENT("Enable 'event filter' for new rooms"), "FilterEnabled", 0, 0, NULL } + { LPGENW("Prefix all events with a timestamp"), "ShowTimeStamp", 0, 1, NULL }, + { LPGENW("Only prefix with timestamp if it has changed"), "ShowTimeStampIfChanged", 0, 0, NULL }, + { LPGENW("Timestamp has same color as event"), "TimeStampEventColour", 0, 0, NULL }, + { LPGENW("Indent the second line of a message"), "LogIndentEnabled", 0, 1, NULL }, + { LPGENW("Limit user names to 20 characters"), "LogLimitNames", 0, 1, NULL }, + { LPGENW("Strip colors from messages"), "StripFormatting", 0, 0, NULL }, + { LPGENW("Enable 'event filter' for new rooms"), "FilterEnabled", 0, 0, NULL } }; static struct branch_t branch3[] = { - { LPGENT("Show topic changes"), "FilterFlags", GC_EVENT_TOPIC, 0, NULL }, - { LPGENT("Show users joining"), "FilterFlags", GC_EVENT_JOIN, 0, NULL }, - { LPGENT("Show users disconnecting"), "FilterFlags", GC_EVENT_QUIT, 0, NULL }, - { LPGENT("Show messages"), "FilterFlags", GC_EVENT_MESSAGE, 1, NULL }, - { LPGENT("Show actions"), "FilterFlags", GC_EVENT_ACTION, 1, NULL }, - { LPGENT("Show users leaving"), "FilterFlags", GC_EVENT_PART, 0, NULL }, - { LPGENT("Show users being kicked"), "FilterFlags", GC_EVENT_KICK, 1, NULL }, - { LPGENT("Show notices"), "FilterFlags", GC_EVENT_NOTICE, 1, NULL }, - { LPGENT("Show users changing name"), "FilterFlags", GC_EVENT_NICK, 0, NULL }, - { LPGENT("Show information messages"), "FilterFlags", GC_EVENT_INFORMATION, 1, NULL }, - { LPGENT("Show status changes of users"), "FilterFlags", GC_EVENT_ADDSTATUS, 0, NULL }, + { LPGENW("Show topic changes"), "FilterFlags", GC_EVENT_TOPIC, 0, NULL }, + { LPGENW("Show users joining"), "FilterFlags", GC_EVENT_JOIN, 0, NULL }, + { LPGENW("Show users disconnecting"), "FilterFlags", GC_EVENT_QUIT, 0, NULL }, + { LPGENW("Show messages"), "FilterFlags", GC_EVENT_MESSAGE, 1, NULL }, + { LPGENW("Show actions"), "FilterFlags", GC_EVENT_ACTION, 1, NULL }, + { LPGENW("Show users leaving"), "FilterFlags", GC_EVENT_PART, 0, NULL }, + { LPGENW("Show users being kicked"), "FilterFlags", GC_EVENT_KICK, 1, NULL }, + { LPGENW("Show notices"), "FilterFlags", GC_EVENT_NOTICE, 1, NULL }, + { LPGENW("Show users changing name"), "FilterFlags", GC_EVENT_NICK, 0, NULL }, + { LPGENW("Show information messages"), "FilterFlags", GC_EVENT_INFORMATION, 1, NULL }, + { LPGENW("Show status changes of users"), "FilterFlags", GC_EVENT_ADDSTATUS, 0, NULL }, }; static struct branch_t branch4[] = { - { LPGENT("Show icons in tray only when the chat room is not active"), "TrayIconInactiveOnly", 0, 1, NULL }, - { LPGENT("Show icon in tray for topic changes"), "TrayIconFlags", GC_EVENT_TOPIC, 0, NULL }, - { LPGENT("Show icon in tray for users joining"), "TrayIconFlags", GC_EVENT_JOIN, 0, NULL }, - { LPGENT("Show icon in tray for users disconnecting"), "TrayIconFlags", GC_EVENT_QUIT, 0, NULL }, - { LPGENT("Show icon in tray for messages"), "TrayIconFlags", GC_EVENT_MESSAGE, 0, NULL }, - { LPGENT("Show icon in tray for actions"), "TrayIconFlags", GC_EVENT_ACTION, 0, NULL }, - { LPGENT("Show icon in tray for highlights"), "TrayIconFlags", GC_EVENT_HIGHLIGHT, 1, NULL }, - { LPGENT("Show icon in tray for users leaving"), "TrayIconFlags", GC_EVENT_PART, 0, NULL }, - { LPGENT("Show icon in tray for users kicking other user"), "TrayIconFlags", GC_EVENT_KICK, 0, NULL }, - { LPGENT("Show icon in tray for notices"), "TrayIconFlags", GC_EVENT_NOTICE, 0, NULL }, - { LPGENT("Show icon in tray for name changes"), "TrayIconFlags", GC_EVENT_NICK, 0, NULL }, - { LPGENT("Show icon in tray for information messages"), "TrayIconFlags", GC_EVENT_INFORMATION, 0, NULL }, - { LPGENT("Show icon in tray for status changes"), "TrayIconFlags", GC_EVENT_ADDSTATUS, 0, NULL }, + { LPGENW("Show icons in tray only when the chat room is not active"), "TrayIconInactiveOnly", 0, 1, NULL }, + { LPGENW("Show icon in tray for topic changes"), "TrayIconFlags", GC_EVENT_TOPIC, 0, NULL }, + { LPGENW("Show icon in tray for users joining"), "TrayIconFlags", GC_EVENT_JOIN, 0, NULL }, + { LPGENW("Show icon in tray for users disconnecting"), "TrayIconFlags", GC_EVENT_QUIT, 0, NULL }, + { LPGENW("Show icon in tray for messages"), "TrayIconFlags", GC_EVENT_MESSAGE, 0, NULL }, + { LPGENW("Show icon in tray for actions"), "TrayIconFlags", GC_EVENT_ACTION, 0, NULL }, + { LPGENW("Show icon in tray for highlights"), "TrayIconFlags", GC_EVENT_HIGHLIGHT, 1, NULL }, + { LPGENW("Show icon in tray for users leaving"), "TrayIconFlags", GC_EVENT_PART, 0, NULL }, + { LPGENW("Show icon in tray for users kicking other user"), "TrayIconFlags", GC_EVENT_KICK, 0, NULL }, + { LPGENW("Show icon in tray for notices"), "TrayIconFlags", GC_EVENT_NOTICE, 0, NULL }, + { LPGENW("Show icon in tray for name changes"), "TrayIconFlags", GC_EVENT_NICK, 0, NULL }, + { LPGENW("Show icon in tray for information messages"), "TrayIconFlags", GC_EVENT_INFORMATION, 0, NULL }, + { LPGENW("Show icon in tray for status changes"), "TrayIconFlags", GC_EVENT_ADDSTATUS, 0, NULL }, }; static struct branch_t branch6[] = { - { LPGENT("Show popups only when the chat room is not active"), "PopupInactiveOnly", 0, 1, NULL }, - { LPGENT("Show popup for topic changes"), "PopupFlags", GC_EVENT_TOPIC, 0, NULL }, - { LPGENT("Show popup for users joining"), "PopupFlags", GC_EVENT_JOIN, 0, NULL }, - { LPGENT("Show popup for users disconnecting"), "PopupFlags", GC_EVENT_QUIT, 0, NULL }, - { LPGENT("Show popup for messages"), "PopupFlags", GC_EVENT_MESSAGE, 0, NULL }, - { LPGENT("Show popup for actions"), "PopupFlags", GC_EVENT_ACTION, 0, NULL }, - { LPGENT("Show popup for highlights"), "PopupFlags", GC_EVENT_HIGHLIGHT, 0, NULL }, - { LPGENT("Show popup for users leaving"), "PopupFlags", GC_EVENT_PART, 0, NULL }, - { LPGENT("Show popup for users kicking other user"), "PopupFlags", GC_EVENT_KICK, 0, NULL }, - { LPGENT("Show popup for notices"), "PopupFlags", GC_EVENT_NOTICE, 0, NULL }, - { LPGENT("Show popup for name changes"), "PopupFlags", GC_EVENT_NICK, 0, NULL }, - { LPGENT("Show popup for information messages"), "PopupFlags", GC_EVENT_INFORMATION, 0, NULL }, - { LPGENT("Show popup for status changes"), "PopupFlags", GC_EVENT_ADDSTATUS, 0, NULL }, + { LPGENW("Show popups only when the chat room is not active"), "PopupInactiveOnly", 0, 1, NULL }, + { LPGENW("Show popup for topic changes"), "PopupFlags", GC_EVENT_TOPIC, 0, NULL }, + { LPGENW("Show popup for users joining"), "PopupFlags", GC_EVENT_JOIN, 0, NULL }, + { LPGENW("Show popup for users disconnecting"), "PopupFlags", GC_EVENT_QUIT, 0, NULL }, + { LPGENW("Show popup for messages"), "PopupFlags", GC_EVENT_MESSAGE, 0, NULL }, + { LPGENW("Show popup for actions"), "PopupFlags", GC_EVENT_ACTION, 0, NULL }, + { LPGENW("Show popup for highlights"), "PopupFlags", GC_EVENT_HIGHLIGHT, 0, NULL }, + { LPGENW("Show popup for users leaving"), "PopupFlags", GC_EVENT_PART, 0, NULL }, + { LPGENW("Show popup for users kicking other user"), "PopupFlags", GC_EVENT_KICK, 0, NULL }, + { LPGENW("Show popup for notices"), "PopupFlags", GC_EVENT_NOTICE, 0, NULL }, + { LPGENW("Show popup for name changes"), "PopupFlags", GC_EVENT_NICK, 0, NULL }, + { LPGENW("Show popup for information messages"), "PopupFlags", GC_EVENT_INFORMATION, 0, NULL }, + { LPGENW("Show popup for status changes"), "PopupFlags", GC_EVENT_ADDSTATUS, 0, NULL }, }; -static HTREEITEM InsertBranch(HWND hwndTree, TCHAR* pszDescr, BOOL bExpanded) +static HTREEITEM InsertBranch(HWND hwndTree, wchar_t* pszDescr, BOOL bExpanded) { TVINSERTSTRUCT tvis; tvis.hParent = NULL; @@ -222,7 +222,7 @@ static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lp, LPARAM p return 0; } -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 )) { @@ -250,7 +250,7 @@ INT_PTR CALLBACK DlgProcOptions1(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa FillBranch(GetDlgItem(hwndDlg, IDC_CHAT_CHECKBOXES), hListHeading4, branch4, _countof(branch4), 0x1000); SendMessage(hwndDlg, OPT_FIXHEADINGS, 0, 0); { - TCHAR* pszGroup = NULL; + wchar_t* pszGroup = NULL; InitSetting(&pszGroup, "AddToGroup", L"Chat rooms"); SetDlgItemText(hwndDlg, IDC_CHAT_GROUP, pszGroup); mir_free(pszGroup); @@ -357,12 +357,12 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN3,UDM_SETRANGE,0,MAKELONG(10000,0)); SendDlgItemMessage(hwndDlg,IDC_CHAT_SPIN3,UDM_SETPOS,0,MAKELONG(db_get_w(NULL,CHAT_MODULE,"LoggingLimit",100),0)); { - TCHAR tszTemp[MAX_PATH]; + wchar_t tszTemp[MAX_PATH]; PathToRelativeT(g_Settings.pszLogDir, tszTemp); SetDlgItemText(hwndDlg, IDC_CHAT_LOGDIRECTORY, tszTemp); } - TCHAR tszTooltipText[2048]; + wchar_t tszTooltipText[2048]; RECT rect; mir_sntprintf(tszTooltipText, @@ -452,7 +452,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa case IDC_CHAT_LOGDIRCHOOSE: LPMALLOC psMalloc; if (SUCCEEDED(CoGetMalloc(1, &psMalloc))) { - TCHAR tszDirectory[MAX_PATH], tszTemp[MAX_PATH]; + wchar_t tszDirectory[MAX_PATH], tszTemp[MAX_PATH]; BROWSEINFO bi = { 0 }; bi.hwndOwner = hwndDlg; bi.pszDisplayName = tszDirectory; @@ -519,15 +519,15 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_HIGHLIGHTWORDS)); if (iLen > 0) { - TCHAR *ptszText = (TCHAR*)mir_alloc((iLen + 2) * sizeof(TCHAR)); - TCHAR *p2 = NULL; + wchar_t *ptszText = (wchar_t*)mir_alloc((iLen + 2) * sizeof(wchar_t)); + wchar_t *p2 = NULL; if (ptszText) { GetDlgItemText(hwndDlg, IDC_CHAT_HIGHLIGHTWORDS, ptszText, iLen + 1); - p2 = _tcschr(ptszText, (TCHAR)','); + p2 = wcschr(ptszText, (wchar_t)','); while (p2) { *p2 = ' '; - p2 = _tcschr(ptszText, (TCHAR)','); + p2 = wcschr(ptszText, (wchar_t)','); } db_set_ts(NULL, CHAT_MODULE, "HighlightWords", ptszText); mir_free(ptszText); @@ -537,7 +537,7 @@ INT_PTR CALLBACK DlgProcOptions2(HWND hwndDlg,UINT uMsg,WPARAM wParam,LPARAM lPa iLen = GetWindowTextLength(GetDlgItem(hwndDlg, IDC_CHAT_LOGDIRECTORY)); if (iLen > 0) { - TCHAR *pszText1 = (TCHAR*)malloc(iLen*sizeof(TCHAR)+2); + wchar_t *pszText1 = (wchar_t*)malloc(iLen*sizeof(wchar_t)+2); GetDlgItemText(hwndDlg, IDC_CHAT_LOGDIRECTORY, pszText1, iLen + 1); db_set_ts(NULL, CHAT_MODULE, "LogDirectory", pszText1); free(pszText1); diff --git a/plugins/Scriver/src/chat/tools.cpp b/plugins/Scriver/src/chat/tools.cpp index 1a9be6ca87..eebd6fdd00 100644 --- a/plugins/Scriver/src/chat/tools.cpp +++ b/plugins/Scriver/src/chat/tools.cpp @@ -21,17 +21,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../stdafx.h" -TCHAR* my_strstri(const TCHAR* s1, const TCHAR* s2) +wchar_t* my_strstri(const wchar_t* s1, const wchar_t* s2) { for (int i = 0; s1[i]; i++) - for (int j = i, k = 0; _totlower(s1[j]) == _totlower(s2[k]); j++, k++) + for (int j = i, k = 0; towlower(s1[j]) == towlower(s2[k]); j++, k++) if (!s2[k + 1]) - return (TCHAR*)(s1 + i); + return (wchar_t*)(s1 + i); return NULL; } -UINT CreateGCMenu(HWND hwnd, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, TCHAR* pszUID, TCHAR* pszWordText) +UINT CreateGCMenu(HWND hwnd, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *si, wchar_t* pszUID, wchar_t* pszWordText) { GCMENUITEMS gcmi = { 0 }; HMENU hSubMenu = 0; @@ -52,7 +52,7 @@ UINT CreateGCMenu(HWND hwnd, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *s } if (pszWordText && pszWordText[0]) { - TCHAR szMenuText[4096]; + wchar_t szMenuText[4096]; mir_sntprintf(szMenuText, TranslateT("Look up '%s':"), pszWordText); ModifyMenu(*hMenu, 4, MF_STRING | MF_BYPOSITION, 4, szMenuText); SetSearchEngineIcons(*hMenu, g_dat.hSearchEngineIconList); @@ -61,7 +61,7 @@ UINT CreateGCMenu(HWND hwnd, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *s gcmi.Type = MENU_ON_LOG; } else if (iIndex == 0) { - TCHAR szTemp[50]; + wchar_t szTemp[50]; if (pszWordText) mir_sntprintf(szTemp, TranslateT("&Message %s"), pszWordText); else @@ -79,7 +79,7 @@ UINT CreateGCMenu(HWND hwnd, HMENU *hMenu, int iIndex, POINT pt, SESSION_INFO *s AppendMenu(*hMenu, MF_SEPARATOR, 0, 0); for (int i = 0; i < gcmi.nItems; i++) { - TCHAR *ptszText = TranslateTS(gcmi.Item[i].pszDesc); + wchar_t *ptszText = TranslateTS(gcmi.Item[i].pszDesc); DWORD dwState = gcmi.Item[i].bDisabled ? MF_GRAYED : 0; if (gcmi.Item[i].uType == MENU_NEWPOPUP) { diff --git a/plugins/Scriver/src/chat/window.cpp b/plugins/Scriver/src/chat/window.cpp index 53eaba0c5a..9e5d799407 100644 --- a/plugins/Scriver/src/chat/window.cpp +++ b/plugins/Scriver/src/chat/window.cpp @@ -22,23 +22,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "../stdafx.h" static ToolbarButton toolbarButtons[] = { - { LPGENT("Bold"), IDC_CHAT_BOLD, 0, 4, 24 }, - { LPGENT("Italic"), IDC_CHAT_ITALICS, 0, 0, 24 }, - { LPGENT("Underline"), IDC_CHAT_UNDERLINE, 0, 0, 24 }, - { LPGENT("Text color"), IDC_CHAT_COLOR, 0, 0, 24 }, - { LPGENT("Background color"), IDC_CHAT_BKGCOLOR, 0, 0, 24 }, - { LPGENT("History"), IDC_CHAT_HISTORY, 1, 0, 24 }, - { LPGENT("Filter"), IDC_CHAT_FILTER, 1, 0, 24 }, - { LPGENT("Manager"), IDC_CHAT_CHANMGR, 1, 0, 24 }, - { LPGENT("Nick list"), IDC_CHAT_SHOWNICKLIST, 1, 0, 24 }, - { LPGENT("Send"), IDOK, 1, 0, 38 }, + { LPGENW("Bold"), IDC_CHAT_BOLD, 0, 4, 24 }, + { LPGENW("Italic"), IDC_CHAT_ITALICS, 0, 0, 24 }, + { LPGENW("Underline"), IDC_CHAT_UNDERLINE, 0, 0, 24 }, + { LPGENW("Text color"), IDC_CHAT_COLOR, 0, 0, 24 }, + { LPGENW("Background color"), IDC_CHAT_BKGCOLOR, 0, 0, 24 }, + { LPGENW("History"), IDC_CHAT_HISTORY, 1, 0, 24 }, + { LPGENW("Filter"), IDC_CHAT_FILTER, 1, 0, 24 }, + { LPGENW("Manager"), IDC_CHAT_CHANMGR, 1, 0, 24 }, + { LPGENW("Nick list"), IDC_CHAT_SHOWNICKLIST, 1, 0, 24 }, + { LPGENW("Send"), IDOK, 1, 0, 38 }, }; struct MESSAGESUBDATA { time_t lastEnterTime; - TCHAR *szSearchQuery; - TCHAR *szSearchResult; + wchar_t *szSearchQuery; + wchar_t *szSearchResult; SESSION_INFO *lastSession; }; @@ -207,9 +207,9 @@ static void TabAutoComplete(HWND hwnd, MESSAGESUBDATA *dat, SESSION_INFO *si) return; bool isTopic = false, isRoom = false; - TCHAR *pszName = NULL; - TCHAR* pszText = (TCHAR*)mir_alloc(iLen + 100 * sizeof(TCHAR)); - gt.cb = iLen + 99 * sizeof(TCHAR); + wchar_t *pszName = NULL; + wchar_t* pszText = (wchar_t*)mir_alloc(iLen + 100 * sizeof(wchar_t)); + gt.cb = iLen + 99 * sizeof(wchar_t); gt.flags = GT_DEFAULT; SendMessage(hwnd, EM_GETTEXTEX, (WPARAM)>, (LPARAM)pszText); @@ -218,7 +218,7 @@ static void TabAutoComplete(HWND hwnd, MESSAGESUBDATA *dat, SESSION_INFO *si) if (dat->szSearchResult != NULL) { int cbResult = (int)mir_tstrlen(dat->szSearchResult); - if (start >= cbResult && !_tcsncicmp(dat->szSearchResult, pszText + start - cbResult, cbResult)) { + if (start >= cbResult && !wcsnicmp(dat->szSearchResult, pszText + start - cbResult, cbResult)) { start -= cbResult; goto LBL_SkipEnd; } @@ -237,12 +237,12 @@ LBL_SkipEnd: int topicStart = start; while (topicStart >0 && (pszText[topicStart - 1] == ' ' || pszText[topicStart - 1] == 13 || pszText[topicStart - 1] == VK_TAB)) topicStart--; - if (topicStart > 5 && _tcsstr(&pszText[topicStart - 6], L"/topic") == &pszText[topicStart - 6]) + if (topicStart > 5 && wcsstr(&pszText[topicStart - 6], L"/topic") == &pszText[topicStart - 6]) isTopic = true; } if (dat->szSearchQuery == NULL) { - dat->szSearchQuery = (TCHAR*)mir_alloc(sizeof(TCHAR)*(end - start + 1)); + dat->szSearchQuery = (wchar_t*)mir_alloc(sizeof(wchar_t)*(end - start + 1)); mir_tstrncpy(dat->szSearchQuery, pszText + start, end - start + 1); dat->szSearchResult = mir_tstrdup(dat->szSearchQuery); dat->lastSession = NULL; @@ -272,7 +272,7 @@ LBL_SkipEnd: if (end != start) { ptrT szReplace; if (!isRoom && !isTopic && g_Settings.bAddColonToAutoComplete && start == 0) { - szReplace = (TCHAR*)mir_alloc((mir_tstrlen(pszName) + 4) * sizeof(TCHAR)); + szReplace = (wchar_t*)mir_alloc((mir_tstrlen(pszName) + 4) * sizeof(wchar_t)); mir_tstrcpy(szReplace, pszName); mir_tstrcat(szReplace, L": "); pszName = szReplace; @@ -783,13 +783,13 @@ static void ProcessNickListHovering(HWND hwnd, int hoveredItem, SESSION_INFO * p ti.uId = 1; ti.rect = clientRect; - TCHAR tszBuf[1024]; tszBuf[0] = 0; + wchar_t tszBuf[1024]; tszBuf[0] = 0; USERINFO *ui = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, currentHovered); if (ui) { if (ProtoServiceExists(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT)) { - TCHAR *p = (TCHAR*)CallProtoService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui->pszUID); + wchar_t *p = (wchar_t*)CallProtoService(parentdat->pszModule, MS_GC_PROTO_GETTOOLTIPTEXT, (WPARAM)parentdat->ptszID, (LPARAM)ui->pszUID); if (p != NULL) { - _tcsncpy_s(tszBuf, p, _TRUNCATE); + wcsncpy_s(tszBuf, p, _TRUNCATE); mir_free(p); } } @@ -960,8 +960,8 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, else if (wParam < ' ') break; else { - TCHAR szNew[2]; - szNew[0] = (TCHAR)wParam; + wchar_t szNew[2]; + szNew[0] = (wchar_t)wParam; szNew[1] = '\0'; if (mir_tstrlen(si->szSearch) >= _countof(si->szSearch) - 2) { MessageBeep(MB_OK); @@ -976,7 +976,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, for (int i = 0; i < iItems; i++) { USERINFO *ui = pci->UM_FindUserFromIndex(si->pUsers, i); if (ui) { - if (!_tcsnicmp(ui->pszNick, si->szSearch, mir_tstrlen(si->szSearch))) { + if (!wcsnicmp(ui->pszNick, si->szSearch, mir_tstrlen(si->szSearch))) { SendMessage(hwnd, LB_SETCURSEL, i, 0); InvalidateRect(hwnd, NULL, FALSE); return 0; @@ -1018,7 +1018,7 @@ static LRESULT CALLBACK NicklistSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, return mir_callNextSubclass(hwnd, NicklistSubclassProc, msg, wParam, lParam); } -int GetTextPixelSize(TCHAR* pszText, HFONT hFont, BOOL bWidth) +int GetTextPixelSize(wchar_t* pszText, HFONT hFont, BOOL bWidth) { if (!pszText || !hFont) return 0; @@ -1051,7 +1051,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR HICON hIcon; TabControlData tcd; TitleBarData tbd; - TCHAR szTemp[512]; + wchar_t szTemp[512]; SESSION_INFO *si = (SESSION_INFO *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); if (!si && uMsg != WM_INITDIALOG) @@ -1088,7 +1088,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR int mask = (int)SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_GETEVENTMASK, 0, 0); SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETEVENTMASK, 0, mask | ENM_LINK | ENM_MOUSEEVENTS); SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_SETEVENTMASK, 0, ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE | ENM_REQUESTRESIZE); - SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_LIMITTEXT, sizeof(TCHAR) * 0x7FFFFFFF, 0); + SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_LIMITTEXT, sizeof(wchar_t) * 0x7FFFFFFF, 0); SendDlgItemMessage(hwndDlg, IDC_CHAT_LOG, EM_SETOLECALLBACK, 0, (LPARAM)&reOleCallback); if (db_get_b(NULL, CHAT_MODULE, "UseIEView", 0)) { @@ -1427,7 +1427,7 @@ static INT_PTR CALLBACK RoomWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPAR if (ui) { char szIndicator = SM_GetStatusIndicator(si, ui); if (szIndicator > '\0') { - static TCHAR ptszBuf[128]; + static wchar_t ptszBuf[128]; mir_sntprintf(ptszBuf, L"%c%s", szIndicator, ui->pszNick); SendDlgItemMessage(hwndDlg, IDC_CHAT_LIST, LB_ADDSTRING, 0, (LPARAM)ptszBuf); } @@ -1636,7 +1636,7 @@ LABEL_SHOWWINDOW: int item = LOWORD(SendDlgItemMessage(hwndDlg, IDC_CHAT_LIST, LB_ITEMFROMPOINT, 0, MAKELPARAM(p.x, p.y))); USERINFO *ui = pci->SM_GetUserFromIndex(parentdat->ptszID, parentdat->pszModule, item); if (ui != NULL) { - static TCHAR ptszBuf[1024]; + static wchar_t ptszBuf[1024]; mir_sntprintf(ptszBuf, L"%s: %s\r\n%s: %s\r\n%s: %s", TranslateT("Nickname"), ui->pszNick, TranslateT("Unique ID"), ui->pszUID, @@ -1668,7 +1668,7 @@ LABEL_SHOWWINDOW: LRESULT lResult = (LRESULT)SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_GETSEL, 0, 0); int start = LOWORD(lResult); size_t dwNameLenMax = (mir_tstrlen(ui->pszUID) + 4); - TCHAR* pszName = (TCHAR*)alloca(sizeof(TCHAR) * dwNameLenMax); + wchar_t* pszName = (wchar_t*)alloca(sizeof(wchar_t) * dwNameLenMax); if (start == 0) mir_sntprintf(pszName, dwNameLenMax, L"%s: ", ui->pszUID); else diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index 78259fb1ef..42ec8e52c0 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -254,23 +254,23 @@ void LoadGlobalIcons() } } -static struct { UINT cpId; const TCHAR *cpName; } cpTable[] = +static struct { UINT cpId; const wchar_t *cpName; } cpTable[] = { - { 874, LPGENT("Thai") }, // - { 932, LPGENT("Japanese") }, // - { 936, LPGENT("Simplified Chinese") }, // - { 949, LPGENT("Korean") }, // - { 950, LPGENT("Traditional Chinese") }, // - { 1250, LPGENT("Central European") }, // - { 1251, LPGENT("Cyrillic") }, // - { 1252, LPGENT("Latin I") }, // - { 1253, LPGENT("Greek") }, // - { 1254, LPGENT("Turkish") }, // - { 1255, LPGENT("Hebrew") }, // - { 1256, LPGENT("Arabic") }, // - { 1257, LPGENT("Baltic") }, // - { 1258, LPGENT("Vietnamese") }, // - { 1361, LPGENT("Korean (Johab)") } + { 874, LPGENW("Thai") }, // + { 932, LPGENW("Japanese") }, // + { 936, LPGENW("Simplified Chinese") }, // + { 949, LPGENW("Korean") }, // + { 950, LPGENW("Traditional Chinese") }, // + { 1250, LPGENW("Central European") }, // + { 1251, LPGENW("Cyrillic") }, // + { 1252, LPGENW("Latin I") }, // + { 1253, LPGENW("Greek") }, // + { 1254, LPGENW("Turkish") }, // + { 1255, LPGENW("Hebrew") }, // + { 1256, LPGENW("Arabic") }, // + { 1257, LPGENW("Baltic") }, // + { 1258, LPGENW("Vietnamese") }, // + { 1361, LPGENW("Korean (Johab)") } }; void LoadInfobarFonts() diff --git a/plugins/Scriver/src/infobar.cpp b/plugins/Scriver/src/infobar.cpp index c8485ed218..0175199ccc 100644 --- a/plugins/Scriver/src/infobar.cpp +++ b/plugins/Scriver/src/infobar.cpp @@ -40,7 +40,7 @@ void SetupInfobar(InfobarWindowData* idat) cf2.cbSize = sizeof(cf2); cf2.crTextColor = colour; cf2.bCharSet = lf.lfCharSet; - _tcsncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE); + wcsncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE); cf2.dwEffects = ((lf.lfWeight >= FW_BOLD) ? CFE_BOLD : 0) | (lf.lfItalic ? CFE_ITALIC : 0); cf2.wWeight = (WORD)lf.lfWeight; cf2.bPitchAndFamily = lf.lfPitchAndFamily; @@ -54,7 +54,7 @@ void SetupInfobar(InfobarWindowData* idat) cf2.cbSize = sizeof(cf2); cf2.crTextColor = colour; cf2.bCharSet = lf.lfCharSet; - _tcsncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE); + wcsncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE); cf2.dwEffects = ((lf.lfWeight >= FW_BOLD) ? CFE_BOLD : 0) | (lf.lfItalic ? CFE_ITALIC : 0); cf2.wWeight = (WORD)lf.lfWeight; cf2.bPitchAndFamily = lf.lfPitchAndFamily; @@ -83,12 +83,12 @@ void RefreshInfobar(InfobarWindowData* idat) ptrT szXStatusName(db_get_tsa(idat->mwd->hContact, idat->mwd->szProto, "XStatusName")); ptrT szXStatusMsg(db_get_tsa(idat->mwd->hContact, idat->mwd->szProto, "XStatusMsg")); HICON hIcon = GetExtraStatusIcon(idat); - TCHAR szText[2048]; + wchar_t szText[2048]; SETTEXTEX st; if (szXStatusMsg && *szXStatusMsg) mir_sntprintf(szText, L"%s (%s)", TranslateTS(szXStatusName), szXStatusMsg); else - _tcsncpy_s(szText, TranslateTS(szXStatusName), _TRUNCATE); + wcsncpy_s(szText, TranslateTS(szXStatusName), _TRUNCATE); st.flags = ST_DEFAULT; st.codepage = 1200; SendDlgItemMessage(hwnd, IDC_INFOBAR_NAME, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)pcli->pfnGetContactDisplayName(dat->hContact, 0)); diff --git a/plugins/Scriver/src/input.cpp b/plugins/Scriver/src/input.cpp index fcc305a9f4..d9ecad41e3 100644 --- a/plugins/Scriver/src/input.cpp +++ b/plugins/Scriver/src/input.cpp @@ -372,11 +372,11 @@ BOOL HandleLinkClick(HINSTANCE hInstance, HWND hwndDlg, HWND hwndFocus, ENLINK * TEXTRANGE tr; tr.chrg = lParam->chrg; - tr.lpstrText = (LPWSTR)mir_alloc(sizeof(TCHAR)*(tr.chrg.cpMax - tr.chrg.cpMin + 8)); + tr.lpstrText = (LPWSTR)mir_alloc(sizeof(wchar_t)*(tr.chrg.cpMax - tr.chrg.cpMin + 8)); SendMessage(lParam->nmhdr.hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)&tr); - if (_tcschr(tr.lpstrText, _T('@')) != NULL && _tcschr(tr.lpstrText, _T(':')) == NULL && _tcschr(tr.lpstrText, _T('/')) == NULL) { - memmove(tr.lpstrText + 7, tr.lpstrText, sizeof(TCHAR)*(tr.chrg.cpMax - tr.chrg.cpMin + 1)); - memcpy(tr.lpstrText, L"mailto:", sizeof(TCHAR) * 7); + if (wcschr(tr.lpstrText, '@') != NULL && wcschr(tr.lpstrText, ':') == NULL && wcschr(tr.lpstrText, '/') == NULL) { + memmove(tr.lpstrText + 7, tr.lpstrText, sizeof(wchar_t)*(tr.chrg.cpMax - tr.chrg.cpMin + 1)); + memcpy(tr.lpstrText, L"mailto:", sizeof(wchar_t) * 7); } BOOL bOpenLink = TRUE; @@ -399,7 +399,7 @@ BOOL HandleLinkClick(HINSTANCE hInstance, HWND hwndDlg, HWND hwndFocus, ENLINK * if (!OpenClipboard(hwndDlg)) break; EmptyClipboard(); - HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(TCHAR)*(mir_tstrlen(tr.lpstrText) + 1)); + HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t)*(mir_tstrlen(tr.lpstrText) + 1)); mir_tstrcpy((LPWSTR)GlobalLock(hData), tr.lpstrText); GlobalUnlock(hData); SetClipboardData(CF_UNICODETEXT, hData); diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index 34637e2010..341c9c6a3a 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -34,24 +34,24 @@ static void UpdateReadChars(HWND hwndDlg, SrmmWindowData * dat); static ToolbarButton toolbarButtons[] = { - { LPGENT("Quote"), IDC_QUOTE, 0, 4, 24 }, - { LPGENT("Add contact"), IDC_ADD, 0, 10, 24 }, - { LPGENT("User menu"), IDC_USERMENU, 1, 0, 24 }, - { LPGENT("User details"), IDC_DETAILS, 1, 0, 24 }, - { LPGENT("History"), IDC_HISTORY, 1, 0, 24 }, - { LPGENT("Send"), IDOK, 1, 0, 38 } + { LPGENW("Quote"), IDC_QUOTE, 0, 4, 24 }, + { LPGENW("Add contact"), IDC_ADD, 0, 10, 24 }, + { LPGENW("User menu"), IDC_USERMENU, 1, 0, 24 }, + { LPGENW("User details"), IDC_DETAILS, 1, 0, 24 }, + { LPGENW("History"), IDC_HISTORY, 1, 0, 24 }, + { LPGENW("Send"), IDOK, 1, 0, 38 } }; -static TCHAR* GetIEViewSelection(SrmmWindowData *dat) +static wchar_t* GetIEViewSelection(SrmmWindowData *dat) { IEVIEWEVENT evt = { sizeof(evt) }; evt.hwnd = dat->hwndLog; evt.hContact = dat->hContact; evt.iType = IEE_GET_SELECTION; - return mir_tstrdup((TCHAR*)CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&evt)); + return mir_tstrdup((wchar_t*)CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&evt)); } -static TCHAR* GetQuotedTextW(TCHAR *text) +static wchar_t* GetQuotedTextW(wchar_t *text) { size_t i, j, l = mir_wstrlen(text); int newLine = 1; @@ -79,7 +79,7 @@ static TCHAR* GetQuotedTextW(TCHAR *text) } j += 3; - TCHAR *out = (TCHAR*)mir_alloc(sizeof(TCHAR)* j); + wchar_t *out = (wchar_t*)mir_alloc(sizeof(wchar_t)* j); newLine = 1; wasCR = 0; for (i = j = 0; i < l; i++) { @@ -156,15 +156,15 @@ int RTL_Detect(WCHAR *pszwText) return 0; } -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; - TCHAR szPath[MAX_PATH]; + wchar_t szPath[MAX_PATH]; mir_sntprintf(szPath, L"%s\\*", szFilename); HANDLE hFind = FindFirstFile(szPath, &fd); if (hFind != INVALID_HANDLE_VALUE) { @@ -297,7 +297,7 @@ static LRESULT CALLBACK LogEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, ScreenToClient(hwnd, (LPPOINT)&ptl); ptrT pszWord(GetRichTextWord(hwnd, &ptl)); if (pszWord && pszWord[0]) { - TCHAR szMenuText[4096]; + wchar_t szMenuText[4096]; mir_sntprintf(szMenuText, TranslateT("Look up '%s':"), pszWord); ModifyMenu(hSubMenu, 5, MF_STRING | MF_BYPOSITION, 5, szMenuText); SetSearchEngineIcons(hMenu, g_dat.hSearchEngineIconList); @@ -544,7 +544,7 @@ static void MessageDialogResize(HWND hwndDlg, SrmmWindowData *dat, int w, int h) static void UpdateReadChars(HWND hwndDlg, SrmmWindowData *dat) { if (dat->parent->hwndActive == hwndDlg) { - TCHAR szText[256]; + wchar_t szText[256]; int len = GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), 1200, FALSE); StatusBarData sbd; @@ -754,7 +754,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (newData->szInitialText) { if (newData->isWchar) - SetDlgItemText(hwndDlg, IDC_MESSAGE, (TCHAR*)newData->szInitialText); + SetDlgItemText(hwndDlg, IDC_MESSAGE, (wchar_t*)newData->szInitialText); else SetDlgItemTextA(hwndDlg, IDC_MESSAGE, newData->szInitialText); } @@ -795,7 +795,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_LIMITTEXT, nMax, 0); } /* get around a lame bug in the Windows template resource code where richedits are limited to 0x7FFF */ - SendDlgItemMessage(hwndDlg, IDC_LOG, EM_LIMITTEXT, sizeof(TCHAR) * 0x7FFFFFFF, 0); + SendDlgItemMessage(hwndDlg, IDC_LOG, EM_LIMITTEXT, sizeof(wchar_t) * 0x7FFFFFFF, 0); SubclassLogEdit(GetDlgItem(hwndDlg, IDC_LOG)); SubclassMessageEdit(GetDlgItem(hwndDlg, IDC_MESSAGE)); dat->infobarData = CreateInfobar(hwndDlg, dat); @@ -951,10 +951,10 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (!(CallProtoService(dat->szProto, PS_GETCAPS, PFLAGNUM_1, 0)&PF1_FILESEND)) break; if (dat->wStatus == ID_STATUS_OFFLINE) break; if (dat->hContact != NULL) { - TCHAR szFilename[MAX_PATH]; + wchar_t szFilename[MAX_PATH]; HDROP hDrop = (HDROP)wParam; int fileCount = DragQueryFile(hDrop, -1, NULL, 0), totalCount = 0, i; - TCHAR** ppFiles = NULL; + wchar_t** ppFiles = NULL; for (i = 0; i < fileCount; i++) { DragQueryFile(hDrop, i, szFilename, _countof(szFilename)); AddToFileList(&ppFiles, &totalCount, szFilename); @@ -1088,7 +1088,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP cf2.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET | CFM_SIZE | CFM_WEIGHT | CFM_BOLD | CFM_ITALIC; cf2.crTextColor = colour; cf2.bCharSet = lf.lfCharSet; - _tcsncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE); + wcsncpy(cf2.szFaceName, lf.lfFaceName, LF_FACESIZE); cf2.dwEffects = ((lf.lfWeight >= FW_BOLD) ? CFE_BOLD : 0) | (lf.lfItalic ? CFE_ITALIC : 0); cf2.wWeight = (WORD)lf.lfWeight; cf2.bPitchAndFamily = lf.lfPitchAndFamily; @@ -1345,7 +1345,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP case DM_UPDATESTATUSBAR: if (dat->parent->hwndActive == hwndDlg) { - TCHAR szText[256]; + wchar_t szText[256]; StatusBarData sbd = { 0 }; sbd.iFlags = SBDF_TEXT | SBDF_ICON; if (dat->messagesInProgress && (g_dat.flags & SMF_SHOWPROGRESS)) { @@ -1360,7 +1360,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP dat->nTypeSecs--; } else if (dat->lastMessage) { - TCHAR date[64], time[64]; + wchar_t date[64], time[64]; TimeZone_PrintTimeStamp(NULL, dat->lastMessage, L"d", date, _countof(date), 0); TimeZone_PrintTimeStamp(NULL, dat->lastMessage, L"t", time, _countof(time), 0); mir_sntprintf(szText, TranslateT("Last message received on %s at %s."), date, time); @@ -1576,7 +1576,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_GETPARAFORMAT, 0, (LPARAM)&pf2); int bufSize = GetRichTextLength(GetDlgItem(hwndDlg, IDC_MESSAGE), 1200, TRUE) + 2; - ptrT ptszUnicode((TCHAR*)mir_alloc(bufSize * sizeof(TCHAR))); + ptrT ptszUnicode((wchar_t*)mir_alloc(bufSize * sizeof(wchar_t))); MessageSendQueueItem msi = { 0 }; if (pf2.wEffects & PFE_RTLPARA) @@ -1650,14 +1650,14 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP st.flags = ST_SELECTION; st.codepage = 1200; - TCHAR *buffer = NULL; + wchar_t *buffer = NULL; if (dat->hwndLog != NULL) buffer = GetIEViewSelection(dat); else buffer = GetRichEditSelection(GetDlgItem(hwndDlg, IDC_LOG)); if (buffer != NULL) { - TCHAR *quotedBuffer = GetQuotedTextW(buffer); + wchar_t *quotedBuffer = GetQuotedTextW(buffer); SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)quotedBuffer); mir_free(quotedBuffer); mir_free(buffer); @@ -1672,7 +1672,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP if (DbEventIsMessageOrCustom(&dbei)) { buffer = DbGetEventTextT(&dbei, CP_ACP); if (buffer != NULL) { - TCHAR *quotedBuffer = GetQuotedTextW(buffer); + wchar_t *quotedBuffer = GetQuotedTextW(buffer); SendDlgItemMessage(hwndDlg, IDC_MESSAGE, EM_SETTEXTEX, (WPARAM)&st, (LPARAM)quotedBuffer); mir_free(quotedBuffer); mir_free(buffer); diff --git a/plugins/Scriver/src/msglog.cpp b/plugins/Scriver/src/msglog.cpp index 43a81f12b8..fc1bdea405 100644 --- a/plugins/Scriver/src/msglog.cpp +++ b/plugins/Scriver/src/msglog.cpp @@ -51,17 +51,17 @@ struct EventData COLORREF color; union { char *pszNick; // Nick, usage depends on type of event - TCHAR *pszNickT; + wchar_t *pszNickT; wchar_t *pszNickW; // Nick - Unicode }; union { char *pszText; // Text, usage depends on type of event - TCHAR *pszTextT; + wchar_t *pszTextT; wchar_t *pszTextW; // Text - Unicode }; union { char *pszText2; // Text, usage depends on type of event - TCHAR *pszText2T; + wchar_t *pszText2T; wchar_t *pszText2W; // Text - Unicode }; DWORD time; @@ -346,11 +346,11 @@ static char* SetToStyle(int style) } // mode: 0 - date & time, 1 - date, 2 - time -TCHAR* TimestampToString(DWORD dwFlags, time_t check, int mode) +wchar_t* TimestampToString(DWORD dwFlags, time_t check, int mode) { - static TCHAR szResult[512]; - TCHAR str[80]; - TCHAR format[20]; + static wchar_t szResult[512]; + wchar_t str[80]; + wchar_t format[20]; szResult[0] = '\0'; format[0] = '\0'; @@ -574,7 +574,7 @@ static char* CreateRTFFromEvent(SrmmWindowData *dat, EventData *evt, GlobalMessa if (gdat->flags & SMF_SHOWTIME && (evt->eventType != EVENTTYPE_MESSAGE || (gdat->flags & SMF_MARKFOLLOWUPS || isGroupBreak || !(gdat->flags & SMF_GROUPMESSAGES)))) { - TCHAR *timestampString = NULL; + wchar_t *timestampString = NULL; if (gdat->flags & SMF_GROUPMESSAGES && evt->eventType == EVENTTYPE_MESSAGE) { if (isGroupBreak) { if (!(gdat->flags & SMF_MARKFOLLOWUPS)) diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index 41e9ebd30b..85f3f26fcc 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -51,48 +51,48 @@ static const TabDef tabPages[] = { typedef struct FontOptionsListStruct { - const TCHAR *szDescr; + const wchar_t *szDescr; COLORREF defColour; - const TCHAR *szDefFace; + const wchar_t *szDefFace; BYTE defStyle; char defSize; - const TCHAR *szBkgName; + const wchar_t *szBkgName; } FontOptionsList; static const FontOptionsList fontOptionsList[] = { - { LPGENT("Outgoing messages"), RGB(106, 106, 106), L"Arial", 0, -12, LPGENT("Outgoing background")}, - { LPGENT("Incoming messages"), RGB(0, 0, 0), L"Arial", 0, -12, LPGENT("Incoming background")}, - { LPGENT("Outgoing name"), RGB(89, 89, 89), L"Arial", FONTF_BOLD, -12, LPGENT("Outgoing background")}, - { LPGENT("Outgoing time"), RGB(0, 0, 0), L"Terminal", FONTF_BOLD, -9, LPGENT("Outgoing background")}, - { LPGENT("Outgoing colon"), RGB(89, 89, 89), L"Arial", 0, -11, LPGENT("Outgoing background")}, - { LPGENT("Incoming name"), RGB(215, 0, 0), L"Arial", FONTF_BOLD, -12, LPGENT("Incoming background")}, - { LPGENT("Incoming time"), RGB(0, 0, 0), L"Terminal", FONTF_BOLD, -9, LPGENT("Incoming background")}, - { LPGENT("Incoming colon"), RGB(215, 0, 0), L"Arial", 0, -11, LPGENT("Incoming background")}, - { LPGENT("Message area"), RGB(0, 0, 0), L"Arial", 0, -12, LPGENT("Input area background")}, - { LPGENT("Notices"), RGB(90, 90, 160), L"Arial", 0, -12, LPGENT("Incoming background")}, - { LPGENT("Outgoing URL"), RGB(0, 0, 255), L"Arial", 0, -12, LPGENT("Outgoing background")}, - { LPGENT("Incoming URL"), RGB(0, 0, 255), L"Arial", 0, -12, LPGENT("Incoming background")}, - { LPGENT("Info bar contact name"), RGB(0, 0, 0), L"Arial", FONTF_BOLD, -19, LPGENT("Info bar background")}, - { LPGENT("Info bar status message"), RGB(50, 50, 50), L"Arial", FONTF_ITALIC, -11, LPGENT("Info bar background")} + { LPGENW("Outgoing messages"), RGB(106, 106, 106), L"Arial", 0, -12, LPGENW("Outgoing background")}, + { LPGENW("Incoming messages"), RGB(0, 0, 0), L"Arial", 0, -12, LPGENW("Incoming background")}, + { LPGENW("Outgoing name"), RGB(89, 89, 89), L"Arial", FONTF_BOLD, -12, LPGENW("Outgoing background")}, + { LPGENW("Outgoing time"), RGB(0, 0, 0), L"Terminal", FONTF_BOLD, -9, LPGENW("Outgoing background")}, + { LPGENW("Outgoing colon"), RGB(89, 89, 89), L"Arial", 0, -11, LPGENW("Outgoing background")}, + { LPGENW("Incoming name"), RGB(215, 0, 0), L"Arial", FONTF_BOLD, -12, LPGENW("Incoming background")}, + { LPGENW("Incoming time"), RGB(0, 0, 0), L"Terminal", FONTF_BOLD, -9, LPGENW("Incoming background")}, + { LPGENW("Incoming colon"), RGB(215, 0, 0), L"Arial", 0, -11, LPGENW("Incoming background")}, + { LPGENW("Message area"), RGB(0, 0, 0), L"Arial", 0, -12, LPGENW("Input area background")}, + { LPGENW("Notices"), RGB(90, 90, 160), L"Arial", 0, -12, LPGENW("Incoming background")}, + { LPGENW("Outgoing URL"), RGB(0, 0, 255), L"Arial", 0, -12, LPGENW("Outgoing background")}, + { LPGENW("Incoming URL"), RGB(0, 0, 255), L"Arial", 0, -12, LPGENW("Incoming background")}, + { LPGENW("Info bar contact name"), RGB(0, 0, 0), L"Arial", FONTF_BOLD, -19, LPGENW("Info bar background")}, + { LPGENW("Info bar status message"), RGB(50, 50, 50), L"Arial", FONTF_ITALIC, -11, LPGENW("Info bar background")} }; int fontOptionsListSize = _countof(fontOptionsList); struct ColourOptionsList { - const TCHAR *szName; + const wchar_t *szName; const char *szSettingName; COLORREF defColour; int systemColor; } static const colourOptionsList[] = { - { LPGENT("Background"), SRMSGSET_BKGCOLOUR, 0, COLOR_WINDOW}, - { LPGENT("Input area background"), SRMSGSET_INPUTBKGCOLOUR, 0, COLOR_WINDOW}, - { LPGENT("Incoming background"), SRMSGSET_INCOMINGBKGCOLOUR, 0, COLOR_WINDOW}, - { LPGENT("Outgoing background"), SRMSGSET_OUTGOINGBKGCOLOUR, 0, COLOR_WINDOW}, - { LPGENT("Info bar background"), SRMSGSET_INFOBARBKGCOLOUR, 0, COLOR_3DLIGHT}, - { LPGENT("Line between messages"), SRMSGSET_LINECOLOUR, 0, COLOR_3DLIGHT}, + { LPGENW("Background"), SRMSGSET_BKGCOLOUR, 0, COLOR_WINDOW}, + { LPGENW("Input area background"), SRMSGSET_INPUTBKGCOLOUR, 0, COLOR_WINDOW}, + { LPGENW("Incoming background"), SRMSGSET_INCOMINGBKGCOLOUR, 0, COLOR_WINDOW}, + { LPGENW("Outgoing background"), SRMSGSET_OUTGOINGBKGCOLOUR, 0, COLOR_WINDOW}, + { LPGENW("Info bar background"), SRMSGSET_INFOBARBKGCOLOUR, 0, COLOR_3DLIGHT}, + { LPGENW("Line between messages"), SRMSGSET_LINECOLOUR, 0, COLOR_3DLIGHT}, }; int FontServiceFontsChanged(WPARAM, LPARAM) @@ -106,8 +106,8 @@ int FontServiceFontsChanged(WPARAM, LPARAM) void RegisterFontServiceFonts() { FontIDT fid = { sizeof(fid) }; - _tcsncpy_s(fid.group, LPGENT("Messaging"), _TRUNCATE); - _tcsncpy_s(fid.backgroundGroup, LPGENT("Messaging"), _TRUNCATE); + wcsncpy_s(fid.group, LPGENW("Messaging"), _TRUNCATE); + wcsncpy_s(fid.backgroundGroup, LPGENW("Messaging"), _TRUNCATE); strncpy(fid.dbSettingsGroup, SRMMMOD, _countof(fid.dbSettingsGroup)); fid.flags = FIDF_DEFAULTVALID | FIDF_DEFAULTVALID; for (int i = 0; i < _countof(fontOptionsList); i++) { @@ -116,23 +116,23 @@ void RegisterFontServiceFonts() char szTemp[100]; mir_snprintf(szTemp, "SRMFont%d", i); strncpy(fid.prefix, szTemp, _countof(fid.prefix)); - _tcsncpy(fid.name, fontOptionsList[i].szDescr, _countof(fid.name)); + wcsncpy(fid.name, fontOptionsList[i].szDescr, _countof(fid.name)); fid.deffontsettings.colour = fontOptionsList[i].defColour; fid.deffontsettings.size = fontOptionsList[i].defSize; fid.deffontsettings.style = fontOptionsList[i].defStyle; fid.deffontsettings.charset = DEFAULT_CHARSET; - _tcsncpy(fid.deffontsettings.szFace, fontOptionsList[i].szDefFace, _countof(fid.deffontsettings.szFace)); - _tcsncpy(fid.backgroundName, fontOptionsList[i].szBkgName, _countof(fid.backgroundName)); + wcsncpy(fid.deffontsettings.szFace, fontOptionsList[i].szDefFace, _countof(fid.deffontsettings.szFace)); + wcsncpy(fid.backgroundName, fontOptionsList[i].szBkgName, _countof(fid.backgroundName)); FontRegisterT(&fid); } ColourIDT cid = { sizeof(cid) }; - _tcsncpy_s(cid.group, LPGENT("Messaging"), _TRUNCATE); + wcsncpy_s(cid.group, LPGENW("Messaging"), _TRUNCATE); strncpy(cid.dbSettingsGroup, SRMMMOD, _countof(fid.dbSettingsGroup)); cid.flags = 0; for (int i = 0; i < _countof(colourOptionsList); i++) { cid.order = i; - _tcsncpy(cid.name, colourOptionsList[i].szName, _countof(cid.name)); + wcsncpy(cid.name, colourOptionsList[i].szName, _countof(cid.name)); if (colourOptionsList[i].systemColor != -1) cid.defcolour = GetSysColor(colourOptionsList[i].systemColor); else @@ -192,7 +192,7 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour) if (tszFace == NULL) mir_tstrcpy(lf->lfFaceName, fontOptionsList[i].szDefFace); else - _tcsncpy(lf->lfFaceName, tszFace, _countof(lf->lfFaceName)); + wcsncpy(lf->lfFaceName, tszFace, _countof(lf->lfFaceName)); mir_snprintf(str, "%s%dSet", "SRMFont", i); lf->lfCharSet = db_get_b(NULL, SRMMMOD, str, DEFAULT_CHARSET); @@ -202,21 +202,21 @@ void LoadMsgDlgFont(int i, LOGFONT *lf, COLORREF *colour) struct CheckBoxValues_t { DWORD style; - const TCHAR *szDescr; + const wchar_t *szDescr; }; static const struct CheckBoxValues_t statusValues[] = { - { MODEF_OFFLINE, LPGENT("Offline") }, - { PF2_ONLINE, LPGENT("Online") }, - { PF2_SHORTAWAY, LPGENT("Away") }, - { PF2_LONGAWAY, LPGENT("Not available") }, - { PF2_LIGHTDND, LPGENT("Occupied") }, - { PF2_HEAVYDND, LPGENT("Do not disturb") }, - { PF2_FREECHAT, LPGENT("Free for chat") }, - { PF2_INVISIBLE, LPGENT("Invisible") }, - { PF2_OUTTOLUNCH, LPGENT("Out to lunch") }, - { PF2_ONTHEPHONE, LPGENT("On the phone") } + { MODEF_OFFLINE, LPGENW("Offline") }, + { PF2_ONLINE, LPGENW("Online") }, + { PF2_SHORTAWAY, LPGENW("Away") }, + { PF2_LONGAWAY, LPGENW("Not available") }, + { PF2_LIGHTDND, LPGENW("Occupied") }, + { PF2_HEAVYDND, LPGENW("Do not disturb") }, + { PF2_FREECHAT, LPGENW("Free for chat") }, + { PF2_INVISIBLE, LPGENW("Invisible") }, + { PF2_OUTTOLUNCH, LPGENW("Out to lunch") }, + { PF2_ONTHEPHONE, LPGENW("On the phone") } }; static void FillCheckBoxTree(HWND hwndTree, const struct CheckBoxValues_t *values, int nValues, DWORD style) @@ -862,9 +862,9 @@ static INT_PTR CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam { CLCINFOITEM cii = { sizeof(cii) }; cii.flags = CLCIIF_GROUPFONT | CLCIIF_CHECKBOX; - cii.pszText = (TCHAR*)TranslateT("** New contacts **"); + cii.pszText = (wchar_t*)TranslateT("** New contacts **"); hItemNew = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii); - cii.pszText = (TCHAR*)TranslateT("** Unknown contacts **"); + cii.pszText = (wchar_t*)TranslateT("** Unknown contacts **"); hItemUnknown = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii); } SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CLIST), GWL_STYLE, GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_CLIST), GWL_STYLE) | CLS_SHOWHIDDEN | CLS_NOHIDEOFFLINE); diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index d397964eae..41c9fc09e9 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -120,7 +120,7 @@ static int MessageEventAdded(WPARAM hContact, LPARAM lParam) } } if (hwnd == NULL || !IsWindowVisible(GetParent(hwnd))) { - TCHAR toolTip[256]; + wchar_t toolTip[256]; mir_sntprintf(toolTip, TranslateT("Message from %s"), pcli->pfnGetContactDisplayName(hContact, 0)); CLISTEVENT cle = {}; @@ -205,7 +205,7 @@ static int TypingMessage(WPARAM hContact, LPARAM lParam) if (hwnd) SendMessage(hwnd, DM_TYPING, 0, lParam); else if (lParam && (g_dat.flags2 & SMF2_SHOWTYPINGTRAY)) { - TCHAR szTip[256]; + wchar_t szTip[256]; mir_sntprintf(szTip, TranslateT("%s is typing a message"), pcli->pfnGetContactDisplayName(hContact, 0)); if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY) && !(g_dat.flags2 & SMF2_SHOWTYPINGCLIST)) { @@ -292,7 +292,7 @@ static void RestoreUnreadMessageAlerts(void) } } - TCHAR toolTip[256]; + wchar_t toolTip[256]; CLISTEVENT cle = {}; cle.hIcon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE); @@ -523,8 +523,7 @@ int OnLoadModule(void) hMsftEdit = LoadLibrary(L"Msftedit.dll"); if (hMsftEdit == NULL) { if (IDYES != MessageBox(0, - TranslateT - ("Miranda could not load the built-in message module, Msftedit.dll is missing. If you are using WINE, please make sure you have Msftedit.dll installed. Press 'Yes' to continue loading Miranda."), + TranslateT("Miranda could not load the built-in message module, Msftedit.dll is missing. If you are using WINE, please make sure you have Msftedit.dll installed. Press 'Yes' to continue loading Miranda."), TranslateT("Information"), MB_YESNO | MB_ICONINFORMATION)) return 1; return 0; @@ -647,7 +646,7 @@ STDMETHODIMP CREOleCallback::GetInPlaceContext(LPOLEINPLACEFRAME*, LPOLEINPLACEU STDMETHODIMP CREOleCallback::GetNewStorage(LPSTORAGE *lplpstg) { - TCHAR sztName[64]; + wchar_t sztName[64]; mir_sntprintf(sztName, L"s%u", nextStgId++); if (pictStg == NULL) return STG_E_MEDIUMFULL; diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index e4a8a19660..a4e6d42553 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -29,7 +29,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct ToolbarButton { - TCHAR *name; + wchar_t *name; UINT controlId; int alignment; int spacing; @@ -38,9 +38,9 @@ struct ToolbarButton struct ErrorWindowData { - TCHAR *szName; - TCHAR *szDescription; - TCHAR *szText; + wchar_t *szName; + wchar_t *szDescription; + wchar_t *szText; MessageSendQueueItem *queueItem; HWND hwndParent; }; diff --git a/plugins/Scriver/src/msgtimedout.cpp b/plugins/Scriver/src/msgtimedout.cpp index e50504a340..1db437ddbf 100644 --- a/plugins/Scriver/src/msgtimedout.cpp +++ b/plugins/Scriver/src/msgtimedout.cpp @@ -31,7 +31,7 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar case WM_INITDIALOG: { RECT rc, rcParent; - TCHAR szText[2048]; + wchar_t szText[2048]; ewd = (ErrorWindowData *) lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) ewd); TranslateDialogDefault(hwndDlg); @@ -52,7 +52,7 @@ INT_PTR CALLBACK ErrorDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPar if (ewd->szName) mir_sntprintf(szText, L"%s - %s", TranslateT("Send error"), ewd->szName); else - _tcsncpy_s(szText, TranslateT("Send error"), _TRUNCATE); + wcsncpy_s(szText, TranslateT("Send error"), _TRUNCATE); SetWindowText(hwndDlg, szText); GetWindowRect(hwndDlg, &rc); diff --git a/plugins/Scriver/src/msgwindow.cpp b/plugins/Scriver/src/msgwindow.cpp index 53348f2bdb..3bf73b1fb3 100644 --- a/plugins/Scriver/src/msgwindow.cpp +++ b/plugins/Scriver/src/msgwindow.cpp @@ -33,12 +33,12 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM wParam, LPARAM lPar ///////////////////////////////////////////////////////////////////////////////////////// -static const TCHAR *titleTokenNames[] = { L"%name%", L"%status%", L"%statusmsg%", L"%account%" }; +static const wchar_t *titleTokenNames[] = { L"%name%", L"%status%", L"%statusmsg%", L"%account%" }; -TCHAR* GetWindowTitle(MCONTACT hContact, const char *szProto) +wchar_t* GetWindowTitle(MCONTACT hContact, const char *szProto) { ptrT tmplt; - const TCHAR* tokens[4] = { 0 }; + const wchar_t* tokens[4] = { 0 }; CMString tszTemplate, tszStatus, tszTitle; if (hContact && szProto) { @@ -67,12 +67,12 @@ TCHAR* GetWindowTitle(MCONTACT hContact, const char *szProto) } } - for (const TCHAR *p = tszTemplate; *p; p++) { + for (const wchar_t *p = tszTemplate; *p; p++) { if (*p == '%') { int i; for (i = 0; i < _countof(titleTokenNames); i++) { size_t tnlen = mir_tstrlen(titleTokenNames[i]); - if (!_tcsncmp(p, titleTokenNames[i], tnlen)) { + if (!wcsncmp(p, titleTokenNames[i], tnlen)) { if (tokens[i] != NULL) tszTitle.Append(tokens[i]); @@ -461,7 +461,7 @@ LRESULT CALLBACK TabCtrlProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) dat->destTab = TabCtrl_HitTest(hwnd, &thinfo); if (thinfo.flags != TCHT_NOWHERE && dat->destTab != dat->srcTab) { NMHDR nmh; - TCHAR sBuffer[501]; + wchar_t sBuffer[501]; TCITEM item; int curSel; curSel = TabCtrl_GetCurSel(hwnd); @@ -1207,7 +1207,7 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR TitleBarData *tbd = (TitleBarData *)wParam; if (tbd != NULL && dat->hwndActive == hwnd) { if (tbd->iFlags & TBDF_TEXT) { - TCHAR oldtitle[256]; + wchar_t oldtitle[256]; GetWindowText(hwndDlg, oldtitle, _countof(oldtitle)); if (mir_tstrcmp(tbd->pszText, oldtitle)) SetWindowText(hwndDlg, tbd->pszText); @@ -1248,7 +1248,7 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR TabControlData *tcd = (TabControlData*)wParam; int tabId = GetTabFromHWND(dat, (HWND)lParam); if (tabId >= 0 && tcd != NULL) { - TCHAR *ptszTemp = NULL; + wchar_t *ptszTemp = NULL; TCITEM tci; tci.mask = 0; @@ -1256,7 +1256,7 @@ INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR tci.mask |= TCIF_TEXT; tci.pszText = tcd->pszText; if (g_dat.flags2 & SMF2_LIMITNAMES) { - TCHAR *ltext = limitText(tcd->pszText, g_dat.limitNamesLength); + wchar_t *ltext = limitText(tcd->pszText, g_dat.limitNamesLength); if (ltext != tcd->pszText) tci.pszText = ptszTemp = ltext; } @@ -1345,7 +1345,7 @@ static void DrawTab(ParentWindowData *dat, HWND hwnd, WPARAM, LPARAM lParam) TabCtrlData *tcdat = (TabCtrlData*)GetWindowLongPtr(hwnd, GWLP_USERDATA); HANDLE hTheme = NULL; int tstate = 0; - TCHAR szLabel[1024]; + wchar_t szLabel[1024]; TCITEM tci; tci.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_STATE; tci.pszText = szLabel; diff --git a/plugins/Scriver/src/msgwindow.h b/plugins/Scriver/src/msgwindow.h index d3e8092b8b..df0c822d16 100644 --- a/plugins/Scriver/src/msgwindow.h +++ b/plugins/Scriver/src/msgwindow.h @@ -60,7 +60,7 @@ struct StatusBarData { int iItem; int iFlags; - TCHAR *pszText; + wchar_t *pszText; HICON hIcon; }; @@ -70,7 +70,7 @@ struct StatusBarData struct TitleBarData { int iFlags; - TCHAR *pszText; + wchar_t *pszText; HICON hIcon; HICON hIconBig; HICON hIconNot; @@ -82,11 +82,11 @@ struct TitleBarData struct TabControlData { int iFlags; - TCHAR *pszText; + wchar_t *pszText; HICON hIcon; }; -TCHAR* GetWindowTitle(MCONTACT hContact, const char *szProto); +wchar_t* GetWindowTitle(MCONTACT hContact, const char *szProto); HWND GetParentWindow(MCONTACT hContact, BOOL bChat); void NotifyLocalWinEvent(MCONTACT hContact, HWND hwnd, unsigned int type); diff --git a/plugins/Scriver/src/sendqueue.cpp b/plugins/Scriver/src/sendqueue.cpp index 908056ee08..770d00dc9c 100644 --- a/plugins/Scriver/src/sendqueue.cpp +++ b/plugins/Scriver/src/sendqueue.cpp @@ -26,7 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static MessageSendQueueItem *global_sendQueue = NULL; static mir_cs queueMutex; -TCHAR* GetSendBufferMsg(MessageSendQueueItem *item) +wchar_t* GetSendBufferMsg(MessageSendQueueItem *item) { return mir_utf8decodeW(item->sendBuffer); } diff --git a/plugins/Scriver/src/sendqueue.h b/plugins/Scriver/src/sendqueue.h index 8445a2dbac..470e3d5553 100644 --- a/plugins/Scriver/src/sendqueue.h +++ b/plugins/Scriver/src/sendqueue.h @@ -41,7 +41,7 @@ struct MessageSendQueueItem }; MessageSendQueueItem* CreateSendQueueItem(HWND hwndSender); -TCHAR * GetSendBufferMsg(MessageSendQueueItem *item); +wchar_t * GetSendBufferMsg(MessageSendQueueItem *item); MessageSendQueueItem* FindOldestPendingSendQueueItem(HWND hwndSender, MCONTACT hContact); MessageSendQueueItem* FindSendQueueItem(MCONTACT hContact, HANDLE hSendId); BOOL RemoveSendQueueItem(MessageSendQueueItem* item); diff --git a/plugins/Scriver/src/utils.cpp b/plugins/Scriver/src/utils.cpp index 43461d070b..8e771e2485 100644 --- a/plugins/Scriver/src/utils.cpp +++ b/plugins/Scriver/src/utils.cpp @@ -81,7 +81,7 @@ char* GetRichTextUtf(HWND hwnd) return textBuffer; } -int SetRichText(HWND hwnd, const TCHAR *text) +int SetRichText(HWND hwnd, const wchar_t *text) { SETTEXTEX st; st.flags = ST_DEFAULT; @@ -140,32 +140,32 @@ char* GetRichTextRTF(HWND hwnd) return pszText; // pszText contains the text } -void rtrimText(TCHAR *text) +void rtrimText(wchar_t *text) { - static TCHAR szTrimString[] = L":;,.!?\'\"><()[]- \r\n"; + static wchar_t szTrimString[] = L":;,.!?\'\"><()[]- \r\n"; size_t iLen = mir_tstrlen(text) - 1; - while (_tcschr(szTrimString, text[iLen])) { - text[iLen] = _T('\0'); + while (wcschr(szTrimString, text[iLen])) { + text[iLen] = '\0'; iLen--; } } -TCHAR* limitText(TCHAR *text, int limit) +wchar_t* limitText(wchar_t *text, int limit) { size_t len = mir_tstrlen(text); if (len > g_dat.limitNamesLength) { - TCHAR *ptszTemp = (TCHAR*)mir_alloc(sizeof(TCHAR) * (limit + 4)); - _tcsncpy(ptszTemp, text, limit + 1); - _tcsncpy(ptszTemp + limit, L"...", 4); + wchar_t *ptszTemp = (wchar_t*)mir_alloc(sizeof(wchar_t) * (limit + 4)); + wcsncpy(ptszTemp, text, limit + 1); + wcsncpy(ptszTemp + limit, L"...", 4); return ptszTemp; } return text; } -TCHAR* GetRichTextWord(HWND hwnd, POINTL *ptl) +wchar_t* GetRichTextWord(HWND hwnd, POINTL *ptl) { long iCharIndex, start, end, iRes; - TCHAR *pszWord = GetRichEditSelection(hwnd); + wchar_t *pszWord = GetRichEditSelection(hwnd); if (pszWord == NULL) { iCharIndex = SendMessage(hwnd, EM_CHARFROMPOS, 0, (LPARAM)ptl); if (iCharIndex >= 0) { @@ -175,7 +175,7 @@ TCHAR* GetRichTextWord(HWND hwnd, POINTL *ptl) TEXTRANGE tr; CHARRANGE cr; memset(&tr, 0, sizeof(TEXTRANGE)); - pszWord = (TCHAR*)mir_alloc(sizeof(TCHAR) * (end - start + 1)); + pszWord = (wchar_t*)mir_alloc(sizeof(wchar_t) * (end - start + 1)); cr.cpMin = start; cr.cpMax = end; tr.chrg = cr; @@ -200,12 +200,12 @@ static DWORD CALLBACK StreamOutCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG msi->sendBuffer = (char*)mir_realloc(msi->sendBuffer, msi->sendBufferSize + cb + 2); memcpy(msi->sendBuffer + msi->sendBufferSize, pbBuff, cb); msi->sendBufferSize += cb; - *((TCHAR*)(msi->sendBuffer + msi->sendBufferSize)) = '\0'; + *((wchar_t*)(msi->sendBuffer + msi->sendBufferSize)) = '\0'; *pcb = cb; return 0; } -TCHAR *GetRichEditSelection(HWND hwnd) +wchar_t *GetRichEditSelection(HWND hwnd) { CHARRANGE sel; SendMessage(hwnd, EM_EXGETSEL, 0, (LPARAM)&sel); @@ -221,7 +221,7 @@ TCHAR *GetRichEditSelection(HWND hwnd) stream.pfnCallback = StreamOutCallback; stream.dwCookie = (DWORD_PTR)&msi; SendMessage(hwnd, EM_STREAMOUT, SF_TEXT | SF_UNICODE | SFF_SELECTION, (LPARAM)&stream); - return (TCHAR*)msi.sendBuffer; + return (wchar_t*)msi.sendBuffer; } void AppendToBuffer(char *&buffer, size_t &cbBufferEnd, size_t &cbBufferAlloced, const char *fmt, ...) @@ -245,9 +245,9 @@ void AppendToBuffer(char *&buffer, size_t &cbBufferEnd, size_t &cbBufferAlloced, int MeasureMenuItem(WPARAM, LPARAM lParam) { LPMEASUREITEMSTRUCT mis = (LPMEASUREITEMSTRUCT)lParam; - if (mis->itemData != (ULONG_PTR)g_dat.hButtonIconList && mis->itemData != (ULONG_PTR)g_dat.hSearchEngineIconList && mis->itemData != (ULONG_PTR)g_dat.hChatButtonIconList) { + if (mis->itemData != (ULONG_PTR)g_dat.hButtonIconList && mis->itemData != (ULONG_PTR)g_dat.hSearchEngineIconList && mis->itemData != (ULONG_PTR)g_dat.hChatButtonIconList) return FALSE; - } + mis->itemWidth = max(0, GetSystemMetrics(SM_CXSMICON) - GetSystemMetrics(SM_CXMENUCHECK) + 4); mis->itemHeight = GetSystemMetrics(SM_CYSMICON) + 2; return TRUE; @@ -335,7 +335,7 @@ char *url_encode(char *str) return buf; } -void SearchWord(TCHAR *word, int engine) +void SearchWord(wchar_t *word, int engine) { char szURL[4096]; if (word && word[0]) { diff --git a/plugins/Scriver/src/utils.h b/plugins/Scriver/src/utils.h index 89ee584390..de18f2d2b5 100644 --- a/plugins/Scriver/src/utils.h +++ b/plugins/Scriver/src/utils.h @@ -34,16 +34,16 @@ enum SEARCHENGINES { SEARCHENGINE_FOODNETWORK = 8 }; -TCHAR *limitText(TCHAR *text, int limit); +wchar_t *limitText(wchar_t *text, int limit); void logInfo(const char *fmt, ...); int GetRichTextLength(HWND hwnd, int codepage, BOOL inBytes); -TCHAR *GetRichEditSelection(HWND hwnd); +wchar_t *GetRichEditSelection(HWND hwnd); char* GetRichTextRTF(HWND hwnd); char* GetRichTextUtf(HWND hwnd); -TCHAR *GetRichTextWord(HWND hwnd, POINTL *pt); -int SetRichText(HWND hwnd, const TCHAR *text); +wchar_t *GetRichTextWord(HWND hwnd, POINTL *pt); +int SetRichText(HWND hwnd, const wchar_t *text); int SetRichTextRTF(HWND hwnd, const char *text); -void SearchWord(TCHAR * word, int engine); +void SearchWord(wchar_t * word, int engine); HDWP ResizeToolbar(HWND hwnd, HDWP hdwp, int width, int vPos, int height, int cControls, const ToolbarButton * buttons, int controlVisibility); void ShowToolbarControls(HWND hwndDlg, int cControls, const ToolbarButton * buttons, int controlVisibility, int state); void AppendToBuffer(char *&buffer, size_t &cbBufferEnd, size_t &cbBufferAlloced, const char *fmt, ...); -- cgit v1.2.3