From 2f261839b60692e33d0e160344d0d636d49c90ba Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 27 Jul 2016 14:23:31 +0000 Subject: less TCHARs git-svn-id: http://svn.miranda-ng.org/main/trunk@17138 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Msg_Export/src/FileViewer.cpp | 18 ++++++------- plugins/Msg_Export/src/options.cpp | 16 ++++++------ plugins/Msg_Export/src/utils.cpp | 48 +++++++++++++++++------------------ 3 files changed, 41 insertions(+), 41 deletions(-) (limited to 'plugins/Msg_Export') diff --git a/plugins/Msg_Export/src/FileViewer.cpp b/plugins/Msg_Export/src/FileViewer.cpp index ecc4f8305c..f8b48d7ece 100755 --- a/plugins/Msg_Export/src/FileViewer.cpp +++ b/plugins/Msg_Export/src/FileViewer.cpp @@ -258,7 +258,7 @@ int CLStreamRTFInfo::nLoadFileStream(LPBYTE pbBuff, LONG cb) } dwCurrent += nWriteHeader((char*)pbBuff, cb); - tstring sMyNick = ptrT(GetMyOwnNick(hContact)); + tstring sMyNick = ptrW(GetMyOwnNick(hContact)); nNickLen = WideCharToMultiByte(bUtf8File ? CP_UTF8 : CP_ACP, 0, sMyNick.c_str(), (int)sMyNick.length(), szMyNick, sizeof(szMyNick), NULL, NULL); } @@ -621,9 +621,9 @@ bool bLoadFile(HWND hwndDlg, CLHistoryDlg * pclDlg) wchar_t szTmp[1500]; if (nDBCount == -1) - mir_sntprintf(szTmp, TranslateT("Failed to open file\r\n%s\r\n\r\nContact handle is invalid"), pclDlg->sPath.c_str()); + mir_snwprintf(szTmp, TranslateT("Failed to open file\r\n%s\r\n\r\nContact handle is invalid"), pclDlg->sPath.c_str()); else - mir_sntprintf(szTmp, TranslateT("Failed to open file\r\n%s\r\n\r\nMiranda database contains %d events"), pclDlg->sPath.c_str(), nDBCount); + mir_snwprintf(szTmp, TranslateT("Failed to open file\r\n%s\r\n\r\nMiranda database contains %d events"), pclDlg->sPath.c_str(), nDBCount); SETTEXTEX stText = { 0 }; stText.codepage = 1200; @@ -670,7 +670,7 @@ bool bLoadFile(HWND hwndDlg, CLHistoryDlg * pclDlg) CloseHandle(hFile); wchar_t szTmp[100]; - mir_sntprintf(szTmp, L"File open time %d\n", GetTickCount() - dwStart); + mir_snwprintf(szTmp, L"File open time %d\n", GetTickCount() - dwStart); OutputDebugString(szTmp); GETTEXTLENGTHEX sData = { 0 }; @@ -682,7 +682,7 @@ bool bLoadFile(HWND hwndDlg, CLHistoryDlg * pclDlg) if (!bScrollToBottom) SendMessage(hRichEdit, EM_SETSCROLLPOS, 0, (LPARAM)&ptOldPos); - mir_sntprintf(szTmp, TranslateT("With scroll to bottom %d\n"), GetTickCount() - dwStart); + mir_snwprintf(szTmp, TranslateT("With scroll to bottom %d\n"), GetTickCount() - dwStart); OutputDebugString(szTmp); return true; } @@ -828,7 +828,7 @@ LRESULT CALLBACK EditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa } } ft.chrg.cpMin = LONG(res); - ft.chrg.cpMax = LONG(res + mir_tstrlen(fr->lpstrFindWhat)); + ft.chrg.cpMax = LONG(res + mir_wstrlen(fr->lpstrFindWhat)); SendMessage(hwnd, EM_EXSETSEL, 0, (LPARAM)&ft.chrg); return 0; } @@ -908,7 +908,7 @@ void SetRichEditFont(HWND hRichEdit, bool bUseSyntaxHL) ncf.dwMask = CFM_BOLD | CFM_FACE | CFM_ITALIC | CFM_SIZE | CFM_UNDERLINE; ncf.dwEffects = db_get_dw(NULL, MODULE, szFileViewDB "TEffects", 0); ncf.yHeight = db_get_dw(NULL, MODULE, szFileViewDB "THeight", 165); - mir_tstrcpy(ncf.szFaceName, _DBGetString(NULL, MODULE, szFileViewDB "TFace", L"Courier New").c_str()); + mir_wstrcpy(ncf.szFaceName, _DBGetString(NULL, MODULE, szFileViewDB "TFace", L"Courier New").c_str()); if (!bUseSyntaxHL) { ncf.dwMask |= CFM_COLOR; @@ -988,7 +988,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, if (n != sPath.npos) sPath.erase(0, n + 1); - if (mir_sntprintf(szTitle, szFormat, pszNick, sPath.c_str(), (pclDlg->bUtf8File ? L"UTF8" : L"ANSI")) > 0) + if (mir_snwprintf(szTitle, szFormat, pszNick, sPath.c_str(), (pclDlg->bUtf8File ? L"UTF8" : L"ANSI")) > 0) SetWindowText(hwndDlg, szTitle); } @@ -1036,7 +1036,7 @@ static INT_PTR CALLBACK DlgProcFileViewer(HWND hwndDlg, UINT msg, WPARAM wParam, lf.lfStrikeOut = (dwEffects & CFE_STRIKEOUT) != 0; lf.lfItalic = (dwEffects & CFE_ITALIC) != 0; - mir_tstrcpy(lf.lfFaceName, _DBGetString(NULL, MODULE, szFileViewDB "TFace", L"Courier New").c_str()); + mir_wstrcpy(lf.lfFaceName, _DBGetString(NULL, MODULE, szFileViewDB "TFace", L"Courier New").c_str()); CHOOSEFONT cf = { 0 }; cf.lStructSize = sizeof(cf); cf.hwndOwner = hwndDlg; diff --git a/plugins/Msg_Export/src/options.cpp b/plugins/Msg_Export/src/options.cpp index bbcd2d8513..0b3faed0f8 100755 --- a/plugins/Msg_Export/src/options.cpp +++ b/plugins/Msg_Export/src/options.cpp @@ -92,7 +92,7 @@ public: int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort) { if (lParamSort == 1) - return mir_tstrcmpi(pcli->pfnGetContactDisplayName(lParam1, 0), pcli->pfnGetContactDisplayName(lParam2, 0)); + return mir_wstrcmpi(pcli->pfnGetContactDisplayName(lParam1, 0), pcli->pfnGetContactDisplayName(lParam2, 0)); if (lParamSort == 2) return _DBGetString((MCONTACT)lParam1, "Protocol", "p", L"").compare(_DBGetString((MCONTACT)lParam2, "Protocol", "p", L"")); @@ -322,7 +322,7 @@ BOOL bApplyChanges(HWND hwndDlg) int nTmp = GetDlgItemInt(hwndDlg, IDC_MAX_CLOUMN_WIDTH, &bTrans, TRUE); if (!bTrans || nTmp < 5) { - mir_sntprintf(szTemp, TranslateT("Max line width must be at least %d"), 5); + mir_snwprintf(szTemp, TranslateT("Max line width must be at least %d"), 5); MessageBox(hwndDlg, szTemp, MSG_BOX_TITEL, MB_OK); bRet = false; } @@ -365,7 +365,7 @@ BOOL bApplyChanges(HWND hwndDlg) if (ListView_GetItem(hMapUser, &sItem)) { MCONTACT hUser = (MCONTACT)sItem.lParam; - if (mir_tstrlen(szTemp) > 0) + if (mir_wstrlen(szTemp) > 0) db_set_ts(hUser, MODULE, "FileName", szTemp); else db_unset(hUser, MODULE, "FileName"); @@ -461,7 +461,7 @@ void AutoFindeFileNames(HWND hwndDlg) sItem.pszText = szSubCur; sItem.cchTextMax = _countof(szSubCur); if (ListView_GetItem(hMapUser, &sItem)) { - size_t nLen = mir_tstrlen(szSubCur); + size_t nLen = mir_wstrlen(szSubCur); if (wcsnicmp(szSubCur, szSearch, nLen) == 0) { if (nLen < (size_t)nShortestMatch) { nShortestMatch = (int)nLen; @@ -523,7 +523,7 @@ void OpenHelp(HWND hwndDlg) { wchar_t szPath[MAX_PATH]; if (GetModuleFileName(hInstance, szPath, _countof(szPath))) { - size_t nLen = mir_tstrlen(szPath); + size_t nLen = mir_wstrlen(szPath); if (nLen > 3) { szPath[nLen - 1] = 't'; szPath[nLen - 2] = 'x'; @@ -643,7 +643,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar DWORD dwUIN = db_get_dw(hContact, pa->szModuleName, "UIN", 0); wchar_t szTmp[50]; - mir_sntprintf(szTmp, L"%d", dwUIN); + mir_snwprintf(szTmp, L"%d", dwUIN); sItem.iSubItem = 3; sItem.pszText = szTmp; ListView_SetItem(hMapUser, &sItem); @@ -793,7 +793,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar GetDlgItemText(hwndDlg, IDC_FILE_VIEWER, szFile, _countof(szFile)); wchar_t buf[MAX_PATH]; - mir_sntprintf(buf, L"%s (*.exe;*.com;*.bat;*.cmd)%c*.exe;*.com;*.bat;*.cmd%c%s (*.*)%c*.*%c%c", TranslateT("Executable files"), 0, 0, TranslateT("All files"), 0, 0, 0); + mir_snwprintf(buf, L"%s (*.exe;*.com;*.bat;*.cmd)%c*.exe;*.com;*.bat;*.cmd%c%s (*.*)%c*.*%c%c", TranslateT("Executable files"), 0, 0, TranslateT("All files"), 0, 0, 0); { OPENFILENAME ofn = {}; // common dialog box structure ofn.lStructSize = sizeof(OPENFILENAME); @@ -843,7 +843,7 @@ static INT_PTR CALLBACK DlgProcMsgExportOpts(HWND hwndDlg, UINT msg, WPARAM wPar LPITEMIDLIST psItemIDList = SHBrowseForFolder(&sBrowseInfo); if (psItemIDList) { SHGetPathFromIDList(psItemIDList, lpDestDir); - size_t n = mir_tstrlen(lpDestDir); + size_t n = mir_wstrlen(lpDestDir); if (n > 0 && lpDestDir[n] != '\\') { lpDestDir[n] = '\\'; lpDestDir[n + 1] = 0; diff --git a/plugins/Msg_Export/src/utils.cpp b/plugins/Msg_Export/src/utils.cpp index c485229adc..686b006ffb 100755 --- a/plugins/Msg_Export/src/utils.cpp +++ b/plugins/Msg_Export/src/utils.cpp @@ -198,7 +198,7 @@ void DisplayLastError(const wchar_t *pszError) DWORD error = GetLastError(); wchar_t szTemp[50]; - mir_sntprintf(szTemp, L"\r\nErrorCode: %d\r\n", error); + mir_snwprintf(szTemp, L"\r\nErrorCode: %d\r\n", error); sError += szTemp; sError += sGetErrorString(error); MessageBox(NULL, sError.c_str(), MSG_BOX_TITEL, MB_OK); @@ -274,7 +274,7 @@ void ReplaceAll(tstring &sSrc, const wchar_t *pszReplace, const tstring &sNew) { string::size_type nCur = 0; while ((nCur = sSrc.find(pszReplace, nCur)) != sSrc.npos) { - sSrc.replace(nCur, mir_tstrlen(pszReplace), sNew); + sSrc.replace(nCur, mir_wstrlen(pszReplace), sNew); nCur += sNew.size(); } } @@ -368,13 +368,13 @@ static bool bWriteTextToFile(HANDLE hFile, const wchar_t *pszSrc, bool bUtf8File { if (nLen != -1) { wchar_t *tmp = (wchar_t*)alloca(sizeof(wchar_t)*(nLen + 1)); - mir_tstrncpy(tmp, pszSrc, nLen + 1); + mir_wstrncpy(tmp, pszSrc, nLen + 1); pszSrc = tmp; } if (!bUtf8File) { // We need to downgrade text to ansi - ptrA pszAstr(mir_t2a(pszSrc)); + ptrA pszAstr(mir_u2a(pszSrc)); return bWriteToFile(hFile, pszAstr, -1); } @@ -464,7 +464,7 @@ bool bWriteHexToFile(HANDLE hFile, void * pData, int nSize) bool bReadMirandaDirAndPath() { wchar_t szDBPath[MAX_PATH], tmp[MAX_PATH]; - mir_tstrcpy(szDBPath, pszDbPathError); + mir_wstrcpy(szDBPath, pszDbPathError); PathToAbsoluteT(L"miranda32.exe", tmp); sMirandaPath = tmp; sMirandaPath.erase(sMirandaPath.find_last_of(L"\\")); @@ -562,7 +562,7 @@ tstring GetFilePathFromUser(MCONTACT hContact) if (enRenameAction != eDAAutomatic) { tstring sRemoteUser = pcli->pfnGetContactDisplayName(hContact, 0); - mir_sntprintf(szTemp, + mir_snwprintf(szTemp, TranslateT("File name for the user \"%s\" has changed!\n\nfrom:\t%s\nto:\t%s\n\nDo you wish to rename file?"), sRemoteUser.c_str(), sPrevFileName.c_str(), @@ -580,7 +580,7 @@ tstring GetFilePathFromUser(MCONTACT hContact) bCreatePathToFile(sFilePath); while (!MoveFile(sPrevFileName.c_str(), sFilePath.c_str())) { - mir_sntprintf(szTemp, + mir_snwprintf(szTemp, TranslateT("Failed to rename file\n\nfrom:\t%s\nto:\t%s\n\nFailed with error: %s"), sPrevFileName.c_str(), sFilePath.c_str(), @@ -679,7 +679,7 @@ void ReplaceDefines(MCONTACT hContact, tstring & sTarget) tstring sReplaceUin; if (dwUIN) { wchar_t sTmp[20]; - mir_sntprintf(sTmp, L"%d", dwUIN); + mir_snwprintf(sTmp, L"%d", dwUIN); sReplaceUin = sTmp; } else sReplaceUin = FileNickFromHandle(hContact); @@ -761,11 +761,11 @@ void ReplaceTimeVariables(tstring &sRet) GetLocalTime(&stTime); wchar_t sTmp[20]; - mir_sntprintf(sTmp, L"%d", stTime.wYear); + mir_snwprintf(sTmp, L"%d", stTime.wYear); ReplaceAll(sRet, L"%year%", sTmp); - mir_sntprintf(sTmp, L"%.2d", stTime.wMonth); + mir_snwprintf(sTmp, L"%.2d", stTime.wMonth); ReplaceAll(sRet, L"%month%", sTmp); - mir_sntprintf(sTmp, L"%.2d", stTime.wDay); + mir_snwprintf(sTmp, L"%.2d", stTime.wDay); ReplaceAll(sRet, L"%day%", sTmp); } } @@ -821,7 +821,7 @@ void DisplayErrorDialog(const wchar_t *pszError, tstring& sFilePath, DBEVENTINFO if (MessageBox(NULL, sError.c_str(), MSG_BOX_TITEL, MB_YESNO) == IDYES) { OPENFILENAME ofn; // common dialog box structure wchar_t szFile[260]; // buffer for file name - mir_tstrcpy(szFile, L"DebugInfo.txt"); + mir_wstrcpy(szFile, L"DebugInfo.txt"); // Initialize OPENFILENAME memset(&ofn, 0, sizeof(OPENFILENAME)); @@ -908,7 +908,7 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei) nFirstColumnWidth = 4; } else { - sLocalUser = ptrT(GetMyOwnNick(hContact)); + sLocalUser = ptrW(GetMyOwnNick(hContact)); sRemoteUser = pcli->pfnGetContactDisplayName(hContact, 0); nFirstColumnWidth = max(sRemoteUser.size(), clFileTo1ColWidth[sFilePath]); nFirstColumnWidth = max(sLocalUser.size(), nFirstColumnWidth); @@ -973,11 +973,11 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei) for (int nCur = 0; nCur < 9; nCur++) ReplaceAll(output, pszReplaceList[nCur], _DBGetString(hContact, sProto.c_str(), pszReplaceListA[nCur], L"")); - ptrT id(Contact_GetInfo(CNF_UNIQUEID, hContact, sProto.c_str())); + ptrW id(Contact_GetInfo(CNF_UNIQUEID, hContact, sProto.c_str())); if (id != NULL) ReplaceAll(output, L"%UIN%", id); - mir_sntprintf(szTemp, L"%d", db_get_w(hContact, sProto.c_str(), "Age", 0)); + mir_snwprintf(szTemp, L"%d", db_get_w(hContact, sProto.c_str(), "Age", 0)); ReplaceAll(output, L"%Age%", szTemp); szTemp[0] = (wchar_t)db_get_b(hContact, sProto.c_str(), "Gender", 0); @@ -993,11 +993,11 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei) } // Get time stamp - int nIndent = mir_sntprintf(szTemp, L"%-*s", nFirstColumnWidth, dbei.flags & DBEF_SENT ? sLocalUser.c_str() : sRemoteUser.c_str()); + int nIndent = mir_snwprintf(szTemp, L"%-*s", nFirstColumnWidth, dbei.flags & DBEF_SENT ? sLocalUser.c_str() : sRemoteUser.c_str()); TimeZone_ToStringT(dbei.timestamp, sTimeFormat.c_str(), &szTemp[nIndent], _countof(szTemp) - nIndent - 2); - nIndent = (int)mir_tstrlen(szTemp); + nIndent = (int)mir_wstrlen(szTemp); szTemp[nIndent++] = ' '; // Write first part of line with name and timestamp @@ -1075,7 +1075,7 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei) LPGENW("Reason :") }; if (dbei.cbBlob < 8 || dbei.cbBlob > 5000) { - int n = mir_sntprintf(szTemp, TranslateT("Invalid Database event received. Type %d, size %d"), dbei.eventType, dbei.cbBlob); + int n = mir_snwprintf(szTemp, TranslateT("Invalid Database event received. Type %d, size %d"), dbei.eventType, dbei.cbBlob); if (!bWriteTextToFile(hFile, szTemp, bWriteUTF8Format, n)) DisplayErrorDialog(LPGENW("Failed to write Invalid Database event the file :\n"), sFilePath, &dbei); break; @@ -1103,7 +1103,7 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei) bWriteNewLine(hFile, nIndent) && bWriteTextToFile(hFile, LPGENW("UIN :"), bWriteUTF8Format)) { DWORD uin = *((PDWORD)(dbei.pBlob)); - int n = mir_sntprintf(szTemp, L"%d", uin); + int n = mir_snwprintf(szTemp, L"%d", uin); if (bWriteTextToFile(hFile, szTemp, bWriteUTF8Format, n)) { char *pszEnd = (char *)(dbei.pBlob + dbei.cbSize); for (int i = 0; i < nStringCount && pszCurBlobPos < pszEnd; i++) { @@ -1178,14 +1178,14 @@ void ExportDBEventInfo(MCONTACT hContact, DBEVENTINFO &dbei) break; default: - int n = mir_sntprintf(szTemp, TranslateT("Unknown event type %d, size %d"), dbei.eventType, dbei.cbBlob); + int n = mir_snwprintf(szTemp, TranslateT("Unknown event type %d, size %d"), dbei.eventType, dbei.cbBlob); if (!bWriteTextToFile(hFile, szTemp, bWriteUTF8Format, n)) DisplayErrorDialog(LPGENW("Failed to write Unknown event to the file :\n"), sFilePath, &dbei); break; } } else { - int n = mir_sntprintf(szTemp, TranslateT("Unknown event type %d, size %d"), dbei.eventType, dbei.cbBlob); + int n = mir_snwprintf(szTemp, TranslateT("Unknown event type %d, size %d"), dbei.eventType, dbei.cbBlob); bWriteTextToFile(hFile, szTemp, bWriteUTF8Format, n); } @@ -1380,13 +1380,13 @@ int nContactDeleted(WPARAM wparam, LPARAM /*lparam*/) CloseHandle(hPrevFile); wchar_t szTemp[500]; - mir_sntprintf(szTemp, L"%s\r\n%s", + mir_snwprintf(szTemp, L"%s\r\n%s", TranslateT("User has been deleted. Do you want to delete the file?"), sFilePath.c_str()); if (enDeleteAction == eDAAutomatic || MessageBox(NULL, szTemp, MSG_BOX_TITEL, MB_YESNO) == IDYES) { if (!DeleteFile(sFilePath.c_str())) { - mir_sntprintf(szTemp, + mir_snwprintf(szTemp, L"%s\r\n%s", TranslateT("Failed to delete the file"), sFilePath.c_str()); @@ -1434,5 +1434,5 @@ void SaveSettings() wchar_t* GetMyOwnNick(MCONTACT hContact) { wchar_t *p = Contact_GetInfo(CNF_DISPLAY, NULL, GetContactProto(hContact)); - return (p != NULL) ? p : mir_tstrdup(TranslateT("No_Nick")); + return (p != NULL) ? p : mir_wstrdup(TranslateT("No_Nick")); } -- cgit v1.2.3