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/YAMN/src/account.cpp | 38 ++++++++-------- plugins/YAMN/src/browser/badconnect.cpp | 12 ++--- plugins/YAMN/src/browser/mailbrowser.cpp | 40 ++++++++--------- plugins/YAMN/src/debug.cpp | 10 ++--- plugins/YAMN/src/debug.h | 2 +- plugins/YAMN/src/main.cpp | 28 ++++++------ plugins/YAMN/src/proto/pop3/pop3comm.cpp | 76 ++++++++++++++++---------------- plugins/YAMN/src/proto/pop3/pop3opt.cpp | 14 +++--- plugins/YAMN/src/protoplugin.cpp | 6 +-- plugins/YAMN/src/stdafx.h | 16 +++---- plugins/YAMN/src/synchro.cpp | 12 ++--- 11 files changed, 127 insertions(+), 127 deletions(-) (limited to 'plugins/YAMN/src') diff --git a/plugins/YAMN/src/account.cpp b/plugins/YAMN/src/account.cpp index 004dc1bd1b..a79c650ce7 100644 --- a/plugins/YAMN/src/account.cpp +++ b/plugins/YAMN/src/account.cpp @@ -162,18 +162,18 @@ void StopSignalFcn(HACCOUNT Which) void CodeDecodeString(char *Dest, BOOL Encrypt) { - TCHAR Code = STARTCODEPSW; + wchar_t Code = STARTCODEPSW; if (Dest == NULL) return; - for (; *Dest != (TCHAR)0; Dest++) + for (; *Dest != (wchar_t)0; Dest++) { if (Encrypt) *Dest = *Dest + Code; else *Dest = *Dest - Code; - Code += (TCHAR)ADDCODEPSW; + Code += (wchar_t)ADDCODEPSW; } } @@ -204,7 +204,7 @@ static DWORD PostFileToMemory(HANDLE File, char **MemFile, char **End) return 0; } -DWORD FileToMemory(TCHAR *FileName, char **MemFile, char **End) +DWORD FileToMemory(wchar_t *FileName, char **MemFile, char **End) { HANDLE hFile = CreateFile(FileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) @@ -214,23 +214,23 @@ DWORD FileToMemory(TCHAR *FileName, char **MemFile, char **End) } #if defined(DEBUG_FILEREAD) || defined(DEBUG_FILEREADMESSAGES) -DWORD ReadStringFromMemory(char **Parser,TCHAR *End,char **StoreTo,TCHAR *DebugString) +DWORD ReadStringFromMemory(char **Parser,wchar_t *End,char **StoreTo,wchar_t *DebugString) { //This is the debug version of ReadStringFromMemory function. This version shows MessageBox where //read string is displayed - TCHAR *Dest,*Finder; + wchar_t *Dest,*Finder; DWORD Size; - TCHAR Debug[65536]; + wchar_t Debug[65536]; Finder=*Parser; - while((*Finder != (TCHAR)0) && (Finder<=End)) Finder++; + while((*Finder != (wchar_t)0) && (Finder<=End)) Finder++; mir_sntprintf(Debug, L"%s: %s,length is %d, remaining %d chars", DebugString, *Parser, Finder-*Parser, End-Finder); MessageBox(NULL,Debug,L"debug",MB_OK); if (Finder>=End) return EACC_FILECOMPATIBILITY; if (Size=Finder-*Parser) { - if (NULL==(Dest=*StoreTo=new TCHAR[Size+1])) + if (NULL==(Dest=*StoreTo=new wchar_t[Size+1])) return EACC_ALLOC; for (;*Parser<=Finder;(*Parser)++,Dest++) *Dest=**Parser; @@ -250,7 +250,7 @@ DWORD ReadStringFromMemory(char **Parser, char *End, char **StoreTo) DWORD Size; Finder = *Parser; - while ((*Finder != (TCHAR)0) && (Finder <= End)) Finder++; + while ((*Finder != (wchar_t)0) && (Finder <= End)) Finder++; if (Finder >= End) return EACC_FILECOMPATIBILITY; if (Size = Finder - *Parser) @@ -269,7 +269,7 @@ DWORD ReadStringFromMemory(char **Parser, char *End, char **StoreTo) } #if defined(DEBUG_FILEREAD) || defined(DEBUG_FILEREADMESSAGES) -DWORD ReadStringFromMemoryW(WCHAR **Parser,TCHAR *End,WCHAR **StoreTo,WCHAR *DebugString) +DWORD ReadStringFromMemoryW(WCHAR **Parser,wchar_t *End,WCHAR **StoreTo,WCHAR *DebugString) { //This is the debug version of ReadStringFromMemoryW function. This version shows MessageBox where //read string is displayed @@ -327,7 +327,7 @@ static DWORD ReadNotificationFromMemory(char **Parser, char *End, YAMN_NOTIFICAT { DWORD Stat; #ifdef DEBUG_FILEREAD - TCHAR Debug[65536]; + wchar_t Debug[65536]; #endif Which->Flags = *(DWORD *)(*Parser); @@ -393,7 +393,7 @@ DWORD ReadMessagesFromMemory(HACCOUNT Which, char **Parser, char *End) do { Finder = *Parser; - while ((*Finder != (TCHAR)0) && (Finder <= End)) Finder++; + while ((*Finder != (wchar_t)0) && (Finder <= End)) Finder++; if (Finder >= End) return EACC_FILECOMPATIBILITY; if (Size = Finder - *Parser) @@ -485,7 +485,7 @@ DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, char *End) { DWORD Stat; #ifdef DEBUG_FILEREAD - TCHAR Debug[65536]; + wchar_t Debug[65536]; #endif //Read name of account @@ -735,7 +735,7 @@ static INT_PTR PerformAccountReading(HYAMNPROTOPLUGIN Plugin, char *MemFile, cha INT_PTR AddAccountsFromFileSvc(WPARAM wParam, LPARAM lParam) { char *MemFile, *End; - DWORD Stat = FileToMemory((TCHAR*)lParam, &MemFile, &End); + DWORD Stat = FileToMemory((wchar_t*)lParam, &MemFile, &End); if (Stat != NO_ERROR) return (INT_PTR)Stat; @@ -846,7 +846,7 @@ static INT_PTR PerformAccountWriting(HYAMNPROTOPLUGIN Plugin, HANDLE File) #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"WriteAccountsToFile:ActualAccountSO-read enter\n"); #endif - if ((ActualAccount->Name == NULL) || (*ActualAccount->Name == (TCHAR)0)) + if ((ActualAccount->Name == NULL) || (*ActualAccount->Name == (wchar_t)0)) { #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile,"WriteAccountsToFile:ActualAccountSO-read done\n"); @@ -976,7 +976,7 @@ INT_PTR WriteAccountsToFileSvc(WPARAM wParam, LPARAM lParam) HYAMNPROTOPLUGIN Plugin = (HYAMNPROTOPLUGIN)wParam; mir_cslock lck(csFileWritingCS); - HANDLE hFile = CreateFile((TCHAR*)lParam, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE hFile = CreateFile((wchar_t*)lParam, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) return EACC_SYSTEM; @@ -1226,7 +1226,7 @@ int DeleteAccounts(HYAMNPROTOPLUGIN Plugin) return 1; } -void WINAPI GetStatusFcn(HACCOUNT Which, TCHAR *Value) +void WINAPI GetStatusFcn(HACCOUNT Which, wchar_t *Value) { if (Which == NULL) return; @@ -1235,7 +1235,7 @@ void WINAPI GetStatusFcn(HACCOUNT Which, TCHAR *Value) mir_tstrcpy(Value, Which->Status); } -void WINAPI SetStatusFcn(HACCOUNT Which, TCHAR *Value) +void WINAPI SetStatusFcn(HACCOUNT Which, wchar_t *Value) { if (Which != NULL) { mir_cslock lck(csAccountStatusCS); diff --git a/plugins/YAMN/src/browser/badconnect.cpp b/plugins/YAMN/src/browser/badconnect.cpp index 80816e0704..d6e4fdf2e6 100644 --- a/plugins/YAMN/src/browser/badconnect.cpp +++ b/plugins/YAMN/src/browser/badconnect.cpp @@ -85,7 +85,7 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg, UINT msg, WPARAM wParam, LP DWORD ErrorCode; char* TitleStrA; char *Message1A = NULL; - TCHAR *Message1W = NULL; + wchar_t *Message1W = NULL; POPUPDATAT BadConnectPopup; ActualAccount = ((struct BadConnectionParam *)lParam)->account; @@ -125,7 +125,7 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg, UINT msg, WPARAM wParam, LP if (ActualAccount->Plugin->Fcn != NULL && ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr != NULL) { Message1W = ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr(ErrorCode); SetDlgItemText(hDlg, IDC_STATICMSG, Message1W); - _tcsncpy_s(BadConnectPopup.lptzText, Message1W, _TRUNCATE); + wcsncpy_s(BadConnectPopup.lptzText, Message1W, _TRUNCATE); if (ShowPopup) PUAddPopupT(&BadConnectPopup); } @@ -133,7 +133,7 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg, UINT msg, WPARAM wParam, LP { Message1W = ActualAccount->Plugin->Fcn->GetErrorStringWFcnPtr(ErrorCode); SetDlgItemText(hDlg, IDC_STATICMSG, Message1W); - _tcsncpy_s(BadConnectPopup.lptzText, Message1W, _TRUNCATE); + wcsncpy_s(BadConnectPopup.lptzText, Message1W, _TRUNCATE); if (ShowPopup) PUAddPopupT(&BadConnectPopup); } @@ -141,7 +141,7 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg, UINT msg, WPARAM wParam, LP { Message1W = TranslateT("Unknown error"); SetDlgItemText(hDlg, IDC_STATICMSG, Message1W); - _tcsncpy_s(BadConnectPopup.lptzText, Message1W, _TRUNCATE); + wcsncpy_s(BadConnectPopup.lptzText, Message1W, _TRUNCATE); if (ShowPopup) PUAddPopupT(&BadConnectPopup); } @@ -185,7 +185,7 @@ INT_PTR CALLBACK DlgProcYAMNBadConnection(HWND hDlg, UINT msg, WPARAM wParam, LP } return 0; case WM_CHAR: - switch ((TCHAR)wParam) + switch ((wchar_t)wParam) { case 27: case 13: @@ -257,7 +257,7 @@ void __cdecl BadConnection(void *Param) nid.hIcon = g_LoadIconEx(3); nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP; nid.uCallbackMessage = WM_YAMN_NOTIFYICON; - mir_sntprintf(nid.szTip, L"%S%s", ActualAccount->Name, TranslateT(" - connection error")); + mir_sntprintf(nid.szTip, L"%S%s", ActualAccount->Name, TranslateT(" - connection error")); Shell_NotifyIcon(NIM_ADD, &nid); } diff --git a/plugins/YAMN/src/browser/mailbrowser.cpp b/plugins/YAMN/src/browser/mailbrowser.cpp index ccd681a1d5..d768f3e363 100644 --- a/plugins/YAMN/src/browser/mailbrowser.cpp +++ b/plugins/YAMN/src/browser/mailbrowser.cpp @@ -177,7 +177,7 @@ typedef struct _SAMPLELISTVIEWCOLUMN int nSortType; // sorting type (STRING = 0, NUMERIC, DATE, DATETIME) int nSortOrder; // sorting order (ASCENDING = -1, NONE, DESCENDING) int nPriority; // sort priority (-1 for none, 0, 1, ..., nColumns - 1 maximum) - TCHAR lpszName[128]; // column name + wchar_t lpszName[128]; // column name } SAMPLELISTVIEWCOLUMN; // Compare priority @@ -633,12 +633,12 @@ void DoMailActions(HWND hDlg, HACCOUNT ActualAccount, struct CMailNumbers *MN, D CallService(MS_KBDNOTIFY_STARTBLINK, (WPARAM)MN->Real.PopupNC + MN->Virtual.PopupNC, NULL); if ((nflags & YAMN_ACC_CONT) && (MN->Real.PopupRun + MN->Virtual.PopupRun)) { - TCHAR tszMsg[250]; + wchar_t tszMsg[250]; mir_sntprintf(tszMsg, TranslateT("%s : %d new mail message(s), %d total"), _A2T(ActualAccount->Name), MN->Real.PopupNC + MN->Virtual.PopupNC, MN->Real.PopupTC + MN->Virtual.PopupTC); if (!(nflags & YAMN_ACC_CONTNOEVENT)) { - CLISTEVENT evt = {}; - evt.flags = CLEF_TCHAR; + CLISTEVENT evt = {}; + evt.flags = CLEF_TCHAR; evt.hContact = ActualAccount->hContact; evt.hIcon = g_LoadIconEx(2); evt.hDbEvent = ActualAccount->hContact; @@ -1268,7 +1268,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR HWND hListView = GetDlgItem(hDlg, IDC_LISTHEADERS); mir_subclassWindow(GetDlgItem(hDlg, IDC_SPLITTER), SplitterSubclassProc); SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR)MailParam); - Window_SetIcon_IcoLib(hDlg, g_GetIconHandle(2)); + Window_SetIcon_IcoLib(hDlg, g_GetIconHandle(2)); ListView_SetUnicodeFormat(hListView, TRUE); ListView_SetExtendedListViewStyle(hListView, LVS_EX_FULLROWSELECT); @@ -1437,11 +1437,11 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR if (From && Subj) mir_sntprintf(title, size, L"%s (%s)", Subj, From); else if (From) - _tcsncpy_s(title, size, From, _TRUNCATE); + wcsncpy_s(title, size, From, _TRUNCATE); else if (Subj) - _tcsncpy_s(title, size, Subj, _TRUNCATE); + wcsncpy_s(title, size, Subj, _TRUNCATE); else - _tcsncpy_s(title, size, L"none", _TRUNCATE); + wcsncpy_s(title, size, L"none", _TRUNCATE); if (Subj) delete[] Subj; if (From) delete[] From; SetWindowTextW(hDlg, title); @@ -1475,7 +1475,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR return (INT_PTR)GetSysColorBrush(COLOR_WINDOW); case WM_DESTROY: - Window_FreeIcon_IcoLib(hDlg); + Window_FreeIcon_IcoLib(hDlg); { RECT coord; if (GetWindowRect(hDlg, &coord)) { @@ -1557,7 +1557,7 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR if (nReturnCmd > 0) { int courRow = 0; size_t sizeNeeded = 0; - TCHAR headname[64] = { 0 }, headvalue[256] = { 0 }; + wchar_t headname[64] = { 0 }, headvalue[256] = { 0 }; for (courRow = 0; courRow < numRows; courRow++) { if ((nReturnCmd == 1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED) == 0)) continue; ListView_GetItemText(hList, courRow, 0, headname, _countof(headname)); @@ -1568,8 +1568,8 @@ INT_PTR CALLBACK DlgProcYAMNShowMessage(HWND hDlg, UINT msg, WPARAM wParam, LPAR } if (sizeNeeded && OpenClipboard(hDlg)) { EmptyClipboard(); - HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, (sizeNeeded + 1)*sizeof(TCHAR)); - TCHAR *buff = (TCHAR*)GlobalLock(hData); + HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, (sizeNeeded + 1)*sizeof(wchar_t)); + wchar_t *buff = (wchar_t*)GlobalLock(hData); int courPos = 0; for (courRow = 0; courRow < numRows; courRow++) { if ((nReturnCmd == 1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED) == 0)) continue; @@ -1687,7 +1687,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR WindowList_Add(YAMNVar.NewMailAccountWnd, hDlg, (UINT_PTR)ActualAccount); { - TCHAR accstatus[512]; + wchar_t accstatus[512]; GetStatusFcn(ActualAccount, accstatus); SetDlgItemText(hDlg, IDC_STSTATUS, accstatus); } @@ -1706,7 +1706,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR LVCOLUMN ColInfo; HYAMNMAIL Parser; - Window_FreeIcon_IcoLib(hDlg); + Window_FreeIcon_IcoLib(hDlg); struct CMailWinUserInfo *mwui = (struct CMailWinUserInfo *)GetWindowLongPtr(hDlg, DWLP_USER); if (NULL == (ActualAccount = GetWindowAccount(hDlg))) @@ -1802,7 +1802,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR if ((HACCOUNT)wParam != ActualAccount) break; - TCHAR accstatus[512]; + wchar_t accstatus[512]; GetStatusFcn(ActualAccount, accstatus); SetDlgItemText(hDlg, IDC_STSTATUS, accstatus); return 1; @@ -2037,7 +2037,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR WriteDoneFcn(ActualAccount->MessagesAccessSO); if (Total) { - TCHAR DeleteMsg[1024]; + wchar_t DeleteMsg[1024]; mir_sntprintf(DeleteMsg, TranslateT("Do you really want to delete %d selected mails?"), Total); if (IDOK == MessageBox(hDlg, DeleteMsg, TranslateT("Delete confirmation"), MB_OKCANCEL | MB_ICONWARNING)) { @@ -2236,7 +2236,7 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR if (nReturnCmd > 0) { int courRow = 0; size_t sizeNeeded = 0; - TCHAR from[128] = { 0 }, subject[256] = { 0 }, size[16] = { 0 }, date[64] = { 0 }; + wchar_t from[128] = { 0 }, subject[256] = { 0 }, size[16] = { 0 }, date[64] = { 0 }; for (courRow = 0; courRow < numRows; courRow++) { if ((nReturnCmd == 1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED) == 0)) continue; ListView_GetItemText(hList, courRow, 0, from, _countof(from)); @@ -2247,8 +2247,8 @@ INT_PTR CALLBACK DlgProcYAMNMailBrowser(HWND hDlg, UINT msg, WPARAM wParam, LPAR } if (sizeNeeded && OpenClipboard(hDlg)) { EmptyClipboard(); - HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, (sizeNeeded + 1)*sizeof(TCHAR)); - TCHAR *buff = (TCHAR *)GlobalLock(hData); + HGLOBAL hData = GlobalAlloc(GMEM_MOVEABLE, (sizeNeeded + 1)*sizeof(wchar_t)); + wchar_t *buff = (wchar_t *)GlobalLock(hData); int courPos = 0; for (courRow = 0; courRow < numRows; courRow++) { if ((nReturnCmd == 1) && (ListView_GetItemState(hList, courRow, LVIS_SELECTED) == 0)) continue; @@ -2344,7 +2344,7 @@ void __cdecl MailBrowser(void *Param) WndFound = TRUE; if ((hMailBrowser == NULL) && ((MyParam.nflags & YAMN_ACC_MSG) || (MyParam.nflags & YAMN_ACC_ICO) || (MyParam.nnflags & YAMN_ACC_MSG))) { hMailBrowser = CreateDialogParamW(YAMNVar.hInst, MAKEINTRESOURCEW(IDD_DLGVIEWMESSAGES), NULL, DlgProcYAMNMailBrowser, (LPARAM)&MyParam); - Window_SetIcon_IcoLib(hMailBrowser, g_GetIconHandle(2)); + Window_SetIcon_IcoLib(hMailBrowser, g_GetIconHandle(2)); MoveWindow(hMailBrowser, PosX, PosY, SizeX, SizeY, TRUE); } diff --git a/plugins/YAMN/src/debug.cpp b/plugins/YAMN/src/debug.cpp index 6655ebd3a9..fcf594018d 100644 --- a/plugins/YAMN/src/debug.cpp +++ b/plugins/YAMN/src/debug.cpp @@ -14,21 +14,21 @@ //-------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------- -TCHAR DebugUserDirectory[MAX_PATH] = L"."; +wchar_t DebugUserDirectory[MAX_PATH] = L"."; CRITICAL_SECTION FileAccessCS; #ifdef DEBUG_SYNCHRO -TCHAR DebugSynchroFileName2[]=L"%s\\yamn-debug.synchro.log"; +wchar_t DebugSynchroFileName2[]=L"%s\\yamn-debug.synchro.log"; HANDLE SynchroFile; #endif #ifdef DEBUG_COMM -TCHAR DebugCommFileName2[]=L"%s\\yamn-debug.comm.log"; +wchar_t DebugCommFileName2[]=L"%s\\yamn-debug.comm.log"; HANDLE CommFile; #endif #ifdef DEBUG_DECODE -TCHAR DebugDecodeFileName2[]=L"%s\\yamn-debug.decode.log"; +wchar_t DebugDecodeFileName2[]=L"%s\\yamn-debug.decode.log"; HANDLE DecodeFile; #endif @@ -38,7 +38,7 @@ HANDLE DecodeFile; void InitDebug() { #if defined (DEBUG_SYNCHRO) || defined (DEBUG_COMM) || defined (DEBUG_DECODE) - TCHAR DebugFileName[MAX_PATH]; + wchar_t DebugFileName[MAX_PATH]; #endif InitializeCriticalSection(&FileAccessCS); diff --git a/plugins/YAMN/src/debug.h b/plugins/YAMN/src/debug.h index 9581117503..d902d4c8b7 100644 --- a/plugins/YAMN/src/debug.h +++ b/plugins/YAMN/src/debug.h @@ -33,7 +33,7 @@ extern HANDLE DecodeFile; #if defined(DEBUG_FILEREAD) || defined(DEBUG_FILEREADMESSAGES) DWORD ReadStringFromMemory(char **Parser,char *End,char **StoreTo,char *DebugString); -DWORD ReadStringFromMemoryW(char **Parser,TCHAR *End,char **StoreTo,TCHAR *DebugString); +DWORD ReadStringFromMemoryW(char **Parser,wchar_t *End,char **StoreTo,wchar_t *DebugString); #else DWORD ReadStringFromMemory(char **Parser,char *End,char **StoreTo); diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp index bf60915d95..230ee89486 100644 --- a/plugins/YAMN/src/main.cpp +++ b/plugins/YAMN/src/main.cpp @@ -12,11 +12,11 @@ //-------------------------------------------------------------------------------------------------- -TCHAR ProfileName[MAX_PATH]; -TCHAR UserDirectory[MAX_PATH]; +wchar_t ProfileName[MAX_PATH]; +wchar_t UserDirectory[MAX_PATH]; -TCHAR szMirandaDir[MAX_PATH]; -TCHAR szProfileDir[MAX_PATH]; +wchar_t szMirandaDir[MAX_PATH]; +wchar_t szProfileDir[MAX_PATH]; int YAMN_STATUS; @@ -58,10 +58,10 @@ HGENMENU hMenuItemContApp = 0; #define FIXED_TAB_SIZE 100 // default value for fixed width tabs -static void GetProfileDirectory(TCHAR *szPath, int cbPath) +static void GetProfileDirectory(wchar_t *szPath, int cbPath) //This is copied from Miranda's sources. In 0.2.1.0 it is needed, in newer vesions of Miranda use MS_DB_GETPROFILEPATH service { - TCHAR tszOldPath[MAX_PATH]; + wchar_t tszOldPath[MAX_PATH]; CallService(MS_DB_GETPROFILEPATHT, _countof(tszOldPath), (LPARAM)tszOldPath); mir_tstrcat(tszOldPath, L"\\*.book"); @@ -78,7 +78,7 @@ static void GetProfileDirectory(TCHAR *szPath, int cbPath) L"" }; SHFileOperation(&file_op); - _tcsncpy(szPath, ptszNewPath, cbPath); + wcsncpy(szPath, ptszNewPath, cbPath); } ///////////////////////////////////////////////////////////////////////////////////////// @@ -99,13 +99,13 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) ///////////////////////////////////////////////////////////////////////////////////////// #ifdef _DEBUG -static TCHAR unknownCP[1500] = {0}; +static wchar_t unknownCP[1500] = {0}; #endif // The callback function BOOL CALLBACK EnumSystemCodePagesProc(LPTSTR cpStr) { //Convert code page string to number - UINT cp = _ttoi(cpStr); + UINT cp = _wtoi(cpStr); if (!IsValidCodePage(cp)) return TRUE; @@ -206,7 +206,7 @@ void WINAPI g_ReleaseIcon( HICON hIcon ) static void LoadPlugins() { - TCHAR szSearchPath[MAX_PATH]; + wchar_t szSearchPath[MAX_PATH]; mir_sntprintf(szSearchPath, L"%s\\Plugins\\YAMN\\*.dll", szMirandaDir); hDllPlugins = NULL; @@ -216,19 +216,19 @@ static void LoadPlugins() if (hFind != INVALID_HANDLE_VALUE) { do { //rewritten from Miranda sources... Needed because Win32 API has a bug in FindFirstFile, search is done for *.dlllllll... too - TCHAR *dot = _tcsrchr(fd.cFileName, '.'); + wchar_t *dot = wcsrchr(fd.cFileName, '.'); if (dot == NULL ) continue; // we have a dot int len = (int)mir_tstrlen(fd.cFileName); // find the length of the string - TCHAR* end = fd.cFileName+len; // get a pointer to the NULL + wchar_t* end = fd.cFileName+len; // get a pointer to the NULL int safe = (end-dot)-1; // figure out how many chars after the dot are "safe", not including NULL if ((safe != 3) || (mir_tstrcmpi(dot+1, L"dll") != 0)) //not bound, however the "dll" string should mean only 3 chars are compared continue; - TCHAR szPluginPath[MAX_PATH]; + wchar_t szPluginPath[MAX_PATH]; mir_sntprintf(szPluginPath, L"%s\\Plugins\\YAMN\\%s", szMirandaDir, fd.cFileName); HINSTANCE hDll = LoadLibrary(szPluginPath); if (hDll == NULL) @@ -269,7 +269,7 @@ extern "C" int __declspec(dllexport) Load(void) // retrieve the current profile name CallService(MS_DB_GETPROFILENAMET, (WPARAM)_countof(ProfileName), (LPARAM)ProfileName); //not to pass entire array to fcn - TCHAR *fc = _tcsrchr(ProfileName, '.'); + wchar_t *fc = wcsrchr(ProfileName, '.'); if ( fc != NULL ) *fc = 0; // we get the user path where our yamn-account.book.ini is stored from mirandaboot.ini file diff --git a/plugins/YAMN/src/proto/pop3/pop3comm.cpp b/plugins/YAMN/src/proto/pop3/pop3comm.cpp index d4f06bed62..cd8c3121db 100644 --- a/plugins/YAMN/src/proto/pop3/pop3comm.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3comm.cpp @@ -61,7 +61,7 @@ void __cdecl DeleteMailsPOP3(void *param); //Function makes readable message about error. It sends it back to YAMN, so YAMN then //can show it to the message window -TCHAR* WINAPI GetErrorString(DWORD Code); +wchar_t* WINAPI GetErrorString(DWORD Code); //Function deletes string allocated in GetErrorString void WINAPI DeleteErrorString(LPVOID String); @@ -130,7 +130,7 @@ YAMN_PROTOREGISTRATION POP3ProtocolRegistration = __AUTHORWEB, }; -static TCHAR *FileName = NULL; +static wchar_t *FileName = NULL; HANDLE RegisterNLClient(const char *name); @@ -247,7 +247,7 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) //You must first register account, before using this function as YAMN must use CreatePOP3Account function to add new accounts //But if CreatePOP3Account is not implemented (equals to NULL), YAMN creates account as YAMN's standard HACCOUNT if (FileName) CallService(MS_YAMN_DELETEFILENAME, (WPARAM)FileName, 0); //shoud not happen (only for secure) - FileName = (TCHAR *)CallService(MS_YAMN_GETFILENAME, (WPARAM)L"pop3", 0); + FileName = (wchar_t *)CallService(MS_YAMN_GETFILENAME, (WPARAM)L"pop3", 0); switch (CallService(MS_YAMN_READACCOUNTS, (WPARAM)POP3Plugin, (LPARAM)FileName)) { case EACC_FILEVERSION: @@ -268,7 +268,7 @@ int RegisterPOP3Plugin(WPARAM, LPARAM) case EACC_SYSTEM: if (ERROR_FILE_NOT_FOUND != GetLastError()) { - TCHAR temp[1024] = { 0 }; + wchar_t temp[1024] = { 0 }; mir_sntprintf(temp, L"%s\n%s", TranslateT("Reading file error. File already in use?"), FileName); MessageBox(NULL, temp, TranslateT("YAMN (internal POP3) read error"), MB_OK); CallService(MS_YAMN_DELETEFILENAME, (WPARAM)FileName, 0); @@ -343,7 +343,7 @@ DWORD WINAPI WritePOP3Accounts() { DWORD ReturnValue = CallService(MS_YAMN_WRITEACCOUNTS, (WPARAM)POP3Plugin, (LPARAM)FileName); if (ReturnValue == EACC_SYSTEM) { - TCHAR temp[1024] = { 0 }; + wchar_t temp[1024] = { 0 }; mir_sntprintf(temp, L"%s\n%s", TranslateT("Error while copying data to disk occurred. Is file in use?"), FileName); MessageBox(NULL, temp, TranslateT("POP3 plugin - write file error"), MB_OK); } @@ -366,7 +366,7 @@ DWORD WINAPI ReadPOP3Options(HACCOUNT Which, char **Parser, char *End) { DWORD Ver; #ifdef DEBUG_FILEREAD - TCHAR Debug[256]; + wchar_t Debug[256]; #endif Ver = *(DWORD *)(*Parser); (*Parser) += sizeof(DWORD); @@ -712,7 +712,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) HYAMNMAIL NewMsgsPtr = NULL; for (NewMsgsPtr = (HYAMNMAIL)NewMails; NewMsgsPtr != NULL; NewMsgsPtr = NewMsgsPtr->Next) { if (!mir_strcmp(MsgQueuePtr->ID, NewMsgsPtr->ID)) { - TCHAR accstatus[512]; + wchar_t accstatus[512]; mir_sntprintf(accstatus, TranslateT("Reading body %s"), NewMsgsPtr->ID); SetAccountStatus(ActualAccount, accstatus); DataRX = MyClient->Top(MsgQueuePtr->Number, 100); @@ -780,7 +780,7 @@ DWORD WINAPI SynchroPOP3(struct CheckParam * WhichTemp) try { - TCHAR accstatus[512]; + wchar_t accstatus[512]; for (i = 0, MsgQueuePtr = NewMails; MsgQueuePtr != NULL; i++) { @@ -1500,46 +1500,46 @@ void ExtractList(char *stream, int len, HYAMNMAIL queue) } } -TCHAR* WINAPI GetErrorString(DWORD Code) +wchar_t* WINAPI GetErrorString(DWORD Code) { - static TCHAR *POP3Errors[] = + static wchar_t *POP3Errors[] = { - LPGENT("Memory allocation error."), //memory allocation - LPGENT("Account is about to be stopped."), //stop account - LPGENT("Cannot connect to POP3 server."), - LPGENT("Cannot allocate memory for received data."), - LPGENT("Cannot login to POP3 server."), - LPGENT("Bad user or password."), - LPGENT("Server does not support APOP authorization."), - LPGENT("Error while executing POP3 command."), - LPGENT("Error while executing POP3 command."), - LPGENT("Error while executing POP3 command."), + LPGENW("Memory allocation error."), //memory allocation + LPGENW("Account is about to be stopped."), //stop account + LPGENW("Cannot connect to POP3 server."), + LPGENW("Cannot allocate memory for received data."), + LPGENW("Cannot login to POP3 server."), + LPGENW("Bad user or password."), + LPGENW("Server does not support APOP authorization."), + LPGENW("Error while executing POP3 command."), + LPGENW("Error while executing POP3 command."), + LPGENW("Error while executing POP3 command."), }; - static TCHAR *NetlibErrors[] = + static wchar_t *NetlibErrors[] = { - LPGENT("Cannot connect to server with NetLib."), - LPGENT("Cannot send data."), - LPGENT("Cannot receive data."), - LPGENT("Cannot allocate memory for received data."), + LPGENW("Cannot connect to server with NetLib."), + LPGENW("Cannot send data."), + LPGENW("Cannot receive data."), + LPGENW("Cannot allocate memory for received data."), }; - static TCHAR *SSLErrors[] = + static wchar_t *SSLErrors[] = { - LPGENT("OpenSSL not loaded."), - LPGENT("Windows socket 2.0 init failed."), - LPGENT("DNS lookup error."), - LPGENT("Error while creating base socket."), - LPGENT("Error connecting to server with socket."), - LPGENT("Error while creating SSL structure."), - LPGENT("Error connecting socket with SSL."), - LPGENT("Server rejected connection with SSL."), - LPGENT("Cannot write SSL data."), - LPGENT("Cannot read SSL data."), - LPGENT("Cannot allocate memory for received data."), + LPGENW("OpenSSL not loaded."), + LPGENW("Windows socket 2.0 init failed."), + LPGENW("DNS lookup error."), + LPGENW("Error while creating base socket."), + LPGENW("Error connecting to server with socket."), + LPGENW("Error while creating SSL structure."), + LPGENW("Error connecting socket with SSL."), + LPGENW("Server rejected connection with SSL."), + LPGENW("Cannot write SSL data."), + LPGENW("Cannot read SSL data."), + LPGENW("Cannot allocate memory for received data."), }; - TCHAR *ErrorString = new TCHAR[ERRORSTR_MAXLEN]; + wchar_t *ErrorString = new wchar_t[ERRORSTR_MAXLEN]; POP3_ERRORCODE *ErrorCode = (POP3_ERRORCODE *)(UINT_PTR)Code; mir_sntprintf(ErrorString, ERRORSTR_MAXLEN, TranslateT("Error %d-%d-%d-%d:"), ErrorCode->AppError, ErrorCode->POP3Error, ErrorCode->NetError, ErrorCode->SystemError); diff --git a/plugins/YAMN/src/proto/pop3/pop3opt.cpp b/plugins/YAMN/src/proto/pop3/pop3opt.cpp index 20ae0c8eac..4e083211fd 100644 --- a/plugins/YAMN/src/proto/pop3/pop3opt.cpp +++ b/plugins/YAMN/src/proto/pop3/pop3opt.cpp @@ -365,7 +365,7 @@ BOOL DlgShowAccount(HWND hDlg, WPARAM wParam, LPARAM lParam) int i; if ((DWORD)wParam == M_SHOWACTUAL) { - TCHAR accstatus[256]; + wchar_t accstatus[256]; #ifdef DEBUG_SYNCHRO DebugLog(SynchroFile, "Options:SHOWACCOUNT:ActualAccountSO-read wait\n"); #endif @@ -672,7 +672,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP case WM_YAMN_CHANGESTATUS: if ((HPOP3ACCOUNT)wParam == ActualAccount) { - TCHAR accstatus[256]; + wchar_t accstatus[256]; GetAccountStatus(ActualAccount, accstatus); SetDlgItemText(hDlg, IDC_STSTATUS, accstatus); return TRUE; @@ -686,7 +686,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP case WM_YAMN_CHANGETIME: if ((HPOP3ACCOUNT)wParam == ActualAccount) { - TCHAR Text[256]; + wchar_t Text[256]; mir_sntprintf(Text, TranslateT("Time left to next check [s]: %d"), (DWORD)lParam); SetDlgItemText(hDlg, IDC_STTIMELEFT, Text); } @@ -829,7 +829,7 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP case IDC_BTNAPP: { - TCHAR filter[MAX_PATH]; + wchar_t filter[MAX_PATH]; mir_sntprintf(filter, L"%s (*.exe;*.bat;*.cmd;*.com)%c*.exe;*.bat;*.cmd;*.com%c%s (*.*)%c*.*%c", TranslateT("Executables"), 0, 0, TranslateT("All Files"), 0, 0); @@ -839,8 +839,8 @@ INT_PTR CALLBACK DlgProcPOP3AccOpt(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP OFNStruct.lpstrFilter = filter; OFNStruct.nFilterIndex = 1; OFNStruct.nMaxFile = MAX_PATH; - OFNStruct.lpstrFile = new TCHAR[MAX_PATH]; - OFNStruct.lpstrFile[0] = (TCHAR)0; + OFNStruct.lpstrFile = new wchar_t[MAX_PATH]; + OFNStruct.lpstrFile[0] = (wchar_t)0; OFNStruct.lpstrTitle = TranslateT("Select executable used for notification"); OFNStruct.Flags = OFN_FILEMUSTEXIST | OFN_NONETWORKBUTTON | OFN_PATHMUSTEXIST | OFN_NOCHANGEDIR; if (!GetOpenFileName(&OFNStruct)) { @@ -1373,7 +1373,7 @@ INT_PTR CALLBACK DlgProcPOP3AccPopup(HWND hDlg, UINT msg, WPARAM wParam, LPARAM switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: { - TCHAR Text[MAX_PATH]; + wchar_t Text[MAX_PATH]; BOOL Translated, CheckPopup, CheckPopupW; BOOL CheckNPopup, CheckNPopupW, CheckFPopup, CheckFPopupW; BOOL CheckPopN; diff --git a/plugins/YAMN/src/protoplugin.cpp b/plugins/YAMN/src/protoplugin.cpp index e2a492d718..25e7a5a42c 100644 --- a/plugins/YAMN/src/protoplugin.cpp +++ b/plugins/YAMN/src/protoplugin.cpp @@ -175,7 +175,7 @@ INT_PTR UnregisterProtoPlugins() INT_PTR GetFileNameSvc(WPARAM wParam,LPARAM) { - TCHAR *FileName = new TCHAR[MAX_PATH]; + wchar_t *FileName = new wchar_t[MAX_PATH]; if (FileName == NULL) return NULL; @@ -185,8 +185,8 @@ INT_PTR GetFileNameSvc(WPARAM wParam,LPARAM) INT_PTR DeleteFileNameSvc(WPARAM wParam,LPARAM) { - if (( TCHAR* )wParam != NULL) - delete[] ( TCHAR* ) wParam; + if (( wchar_t* )wParam != NULL) + delete[] ( wchar_t* ) wParam; return 0; } diff --git a/plugins/YAMN/src/stdafx.h b/plugins/YAMN/src/stdafx.h index 31ec1ca5dd..e932de1d2e 100644 --- a/plugins/YAMN/src/stdafx.h +++ b/plugins/YAMN/src/stdafx.h @@ -76,14 +76,14 @@ int InitAccount(HACCOUNT Which); void DeInitAccount(HACCOUNT Which); void StopSignalFcn(HACCOUNT Which); void CodeDecodeString(char *Dest, BOOL Encrypt); -DWORD FileToMemory(TCHAR *FileName, char **MemFile, char **End); +DWORD FileToMemory(wchar_t *FileName, char **MemFile, char **End); #if defined(DEBUG_FILEREAD) || defined(DEBUG_FILEREADMESSAGES) DWORD ReadStringFromMemory(char **Parser,char *End,char **StoreTo,char *DebugString); #endif DWORD ReadStringFromMemory(char **Parser, char *End, char **StoreTo); DWORD ReadMessagesFromMemory(HACCOUNT Which, char **Parser, char *End); -DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, TCHAR *End); +DWORD ReadAccountFromMemory(HACCOUNT Which, char **Parser, wchar_t *End); INT_PTR AddAccountsFromFileSvc(WPARAM wParam, LPARAM lParam); DWORD WriteStringToFile(HANDLE File, char *Source); @@ -102,8 +102,8 @@ int StopAccounts(HYAMNPROTOPLUGIN Plugin); int WaitForAllAccounts(HYAMNPROTOPLUGIN Plugin, BOOL GetAccountBrowserAccess = FALSE); int DeleteAccounts(HYAMNPROTOPLUGIN Plugin); -void WINAPI GetStatusFcn(HACCOUNT Which, TCHAR *Value); -void WINAPI SetStatusFcn(HACCOUNT Which, TCHAR *Value); +void WINAPI GetStatusFcn(HACCOUNT Which, wchar_t *Value); +void WINAPI SetStatusFcn(HACCOUNT Which, wchar_t *Value); INT_PTR UnregisterProtoPlugins(); INT_PTR RegisterProtocolPluginSvc(WPARAM, LPARAM); @@ -162,8 +162,8 @@ int PostLoad(WPARAM, LPARAM); //Executed after all plugins loaded YAMN reads int Shutdown(WPARAM, LPARAM); //Executed before Miranda is going to shutdown int AddTopToolbarIcon(WPARAM, LPARAM); //Executed when TopToolBar plugin loaded Adds bitmap to toolbar -extern TCHAR UserDirectory[]; //e.g. "F:\WINNT\Profiles\UserXYZ" -extern TCHAR ProfileName[]; //e.g. "majvan" +extern wchar_t UserDirectory[]; //e.g. "F:\WINNT\Profiles\UserXYZ" +extern wchar_t ProfileName[]; //e.g. "majvan" extern SWMRG *AccountBrowserSO; extern YAMN_VARIABLES YAMNVar; extern HANDLE hNewMailHook; @@ -183,7 +183,7 @@ DWORD WINAPI WaitToReadFcn(PSWMRG SObject); void WINAPI ReadDoneFcn(PSWMRG SObject); DWORD WINAPI SCIncFcn(PSCOUNTER SCounter); DWORD WINAPI SCDecFcn(PSCOUNTER SCounter); -BOOL WINAPI SWMRGInitialize(PSWMRG, TCHAR *); +BOOL WINAPI SWMRGInitialize(PSWMRG, wchar_t *); void WINAPI SWMRGDelete(PSWMRG); DWORD WINAPI SWMRGWaitToWrite(PSWMRG pSWMRG, DWORD dwTimeout); void WINAPI SWMRGDoneWriting(PSWMRG pSWMRG); @@ -203,7 +203,7 @@ char *ExtractFromContentType(char *ContentType, char *value); WCHAR *ParseMultipartBody(char *src, char *bond); //From account.cpp -void WINAPI GetStatusFcn(HACCOUNT Which, TCHAR *Value); +void WINAPI GetStatusFcn(HACCOUNT Which, wchar_t *Value); extern HYAMNPROTOPLUGIN POP3Plugin; diff --git a/plugins/YAMN/src/synchro.cpp b/plugins/YAMN/src/synchro.cpp index 6b37e151dc..e008fe9db0 100644 --- a/plugins/YAMN/src/synchro.cpp +++ b/plugins/YAMN/src/synchro.cpp @@ -14,7 +14,7 @@ // the structure's address is passed as the first parameter. // The lpszName parameter is the name of the object. Pass // NULL if you do not want to share the object. -BOOL WINAPI SWMRGInitialize(PSWMRG pSWMRG,TCHAR *Name); +BOOL WINAPI SWMRGInitialize(PSWMRG pSWMRG,wchar_t *Name); // Deletes the system resources associated with a SWMRG // structure. The structure must be deleted only when @@ -98,7 +98,7 @@ void WINAPI SWMRGDelete(PSWMRG pSWMRG) CloseHandle(pSWMRG->hFinishEV); } -BOOL WINAPI SWMRGInitialize(PSWMRG pSWMRG,TCHAR *Name) +BOOL WINAPI SWMRGInitialize(PSWMRG pSWMRG,wchar_t *Name) { pSWMRG->hEventNoWriter=NULL; pSWMRG->hEventNoReaders=NULL; @@ -109,25 +109,25 @@ BOOL WINAPI SWMRGInitialize(PSWMRG pSWMRG,TCHAR *Name) // no writer threads are writing. // Initially no reader threads are reading. if (Name != NULL) - Name[0]=(TCHAR)'W'; + Name[0]=(wchar_t)'W'; pSWMRG->hEventNoWriter=CreateEvent(NULL,FALSE,TRUE,Name); // Creates the manual-reset event that is signalled when // no reader threads are reading. // Initially no reader threads are reading. if (Name != NULL) - Name[0]=(TCHAR)'R'; + Name[0]=(wchar_t)'R'; pSWMRG->hEventNoReaders=CreateEvent(NULL,TRUE,TRUE,Name); // Initializes the variable that indicates the number of // reader threads that are reading. // Initially no reader threads are reading. if (Name != NULL) - Name[0]=(TCHAR)'C'; + Name[0]=(wchar_t)'C'; pSWMRG->hSemNumReaders=CreateSemaphore(NULL,0,0x7FFFFFFF,Name); if (Name != NULL) - Name[0]=(TCHAR)'F'; + Name[0]=(wchar_t)'F'; pSWMRG->hFinishEV=CreateEvent(NULL,TRUE,FALSE,Name); // If a synchronization object could not be created, -- cgit v1.2.3