From 436c5d5a697248d2db2be0121ca1c45450a18a83 Mon Sep 17 00:00:00 2001 From: Kazuhiro Fujieda Date: Thu, 17 Nov 2011 14:02:50 +0900 Subject: [PATCH] Change CString to LPCTSTR or const CString&. Modify LPCSTR into LPCTSTR. --- xkeymacs/profile.cpp | 24 ++++++++++++------------ xkeymacs/profile.h | 12 ++++++------ xkeymacs/propertiesbasic.cpp | 4 ++-- xkeymacs/propertieslist.cpp | 2 +- xkeymacsdll/Commands.cpp | 2 +- xkeymacsdll/Commands.h | 2 +- xkeymacsdll/Utils.cpp | 2 +- xkeymacsdll/xkeymacsdll.cpp | 6 +++--- xkeymacsdll/xkeymacsdll.h | 2 +- 9 files changed, 28 insertions(+), 28 deletions(-) diff --git a/xkeymacs/profile.cpp b/xkeymacs/profile.cpp index 3e16077..88655d6 100644 --- a/xkeymacs/profile.cpp +++ b/xkeymacs/profile.cpp @@ -122,7 +122,7 @@ void CProfile::LevelUp() AfxGetApp()->WriteProfileInt(_T(""), _T("Level"), 4); } -void CProfile::AddKeyBind2C_(LPCSTR appName, BYTE bVk) +void CProfile::AddKeyBind2C_(LPCTSTR appName, BYTE bVk) { int nComID; for (nComID = 0; nComID < MAX_COMMAND; ++nComID) @@ -459,20 +459,20 @@ void CProfile::AddIMEInfo(CProperties& cProperties) cProperties.AddItem(p->szDescription, p->szFileName); } -void CProfile::ClearData(const CString szCurrentApplication) +void CProfile::ClearData(LPCTSTR appName) { for (int nAppID = 0; nAppID < MAX_APP; ++nAppID) - if (szCurrentApplication == m_Config.szSpecialApp[nAppID]) { + if (!_tcscmp(appName, m_Config.szSpecialApp[nAppID])) { ZeroMemory(m_Config.nCommandID[nAppID], sizeof(m_Config.nCommandID[nAppID])); ZeroMemory(m_Config.szSpecialApp[nAppID], CLASS_NAME_LENGTH); return; } } -void CProfile::CopyData(const CString szDstApp, const CString szSrcApp) +void CProfile::CopyData(LPCTSTR dst, LPCTSTR src) { - int nDstApp = AssignAppID(szDstApp); - int nSrcApp = GetAppID(szSrcApp); + int nDstApp = AssignAppID(dst); + int nSrcApp = GetAppID(src); if (nDstApp == MAX_APP || nSrcApp == MAX_APP) return; SetSettingStyle(nDstApp, SETTING_SPECIFIC); @@ -489,7 +489,7 @@ void CProfile::CopyData(const CString szDstApp, const CString szSrcApp) #undef CopyMember } -int CProfile::AssignAppID(LPCSTR appName) +int CProfile::AssignAppID(LPCTSTR appName) { int nAppID = GetAppID(appName); if (nAppID != MAX_APP) @@ -511,7 +511,7 @@ int CProfile::DefaultAppID() return MAX_APP; } -int CProfile::GetAppID(LPCSTR appName) +int CProfile::GetAppID(LPCTSTR appName) { int nAppID = 0; for (nAppID = 0; nAppID < MAX_APP; ++nAppID) @@ -590,17 +590,17 @@ void CProfile::SetKillRingMax(int nAppID, int nKillRingMax) m_Config.nKillRingMax[nAppID] = static_cast(nKillRingMax > 255 ? 255 : nKillRingMax); } -CString CProfile::GetWindowText(int nAppID) +LPCTSTR CProfile::GetWindowText(int nAppID) { return m_Config.szWindowText[nAppID]; } -void CProfile::SetWindowText(int nAppID, const CString szWindowText) +void CProfile::SetWindowText(int nAppID, const CString& text) { - if (CUtils::GetWindowTextType(szWindowText) == IDS_WINDOW_TEXT_IGNORE) + if (CUtils::GetWindowTextType(text) == IDS_WINDOW_TEXT_IGNORE) _tcscpy_s(m_Config.szWindowText[nAppID], _T("*")); else - _tcsncpy_s(m_Config.szWindowText[nAppID], szWindowText, _TRUNCATE); + _tcsncpy_s(m_Config.szWindowText[nAppID], text, _TRUNCATE); } BOOL CProfile::Is106Keyboard() diff --git a/xkeymacs/profile.h b/xkeymacs/profile.h index 4404af0..de78955 100644 --- a/xkeymacs/profile.h +++ b/xkeymacs/profile.h @@ -35,11 +35,11 @@ public: static void StringToKey(LPCTSTR str, int& type, int& key); static CString KeyToString(int type, int key); static void InitAppList(CProperties& cProperties); - static void CopyData(CString szDestinationApplication, CString szSourceApplication); - static void ClearData(CString szCurrentApplication); - static int AssignAppID(LPCSTR appName); + static void ClearData(LPCTSTR appName); + static void CopyData(LPCTSTR dstApp, LPCTSTR srcApp); + static int AssignAppID(LPCTSTR appName); static int DefaultAppID(); - static int GetAppID(LPCSTR appName); + static int GetAppID(LPCTSTR appName); static int GetSettingStyle(int nAppID); static void SetSettingStyle(int nAppID, int nSettingStyle); static void SetAppTitle(int nAppID, const CString& appTitle); @@ -51,8 +51,8 @@ public: static BOOL GetEnableCUA(int nAppID); static int GetKillRingMax(int nAppID); static void SetKillRingMax(int nAppID, int nKillRingMax); - static CString GetWindowText(int nAppID); - static void SetWindowText(int nAppID, CString szWindowText); + static LPCTSTR GetWindowText(int nAppID); + static void SetWindowText(int nAppID, const CString& text); static BOOL Is106Keyboard(); static BOOL IsVistaOrLater(); static void RestartComputer(); diff --git a/xkeymacs/propertiesbasic.cpp b/xkeymacs/propertiesbasic.cpp index 32c996e..bc4560a 100644 --- a/xkeymacs/propertiesbasic.cpp +++ b/xkeymacs/propertiesbasic.cpp @@ -150,7 +150,7 @@ void CPropertiesBasic::SetDialogData() if (nAppID == MAX_APP) return; for (int nComID = 0; nComID < MAX_COMMAND; ++nComID) { - const LPCSTR szComName = CCommands::GetCommandName(nComID); + const LPCTSTR szComName = CCommands::GetCommandName(nComID); if (!szComName[0]) return; for (int i = 0; const int nKey = CCommands::GetDefaultCommandKey(nComID, i); ++i) { @@ -189,7 +189,7 @@ void CPropertiesBasic::GetDialogData() if (nAppID == MAX_APP) return; for (int nComID = 0; nComID < MAX_COMMAND; ++nComID) { - const LPCSTR szComName = CCommands::GetCommandName(nComID); + const LPCTSTR szComName = CCommands::GetCommandName(nComID); if (!szComName[0]) return; for (int i = 0; const int nKey = CCommands::GetDefaultCommandKey(nComID, i); ++i) { diff --git a/xkeymacs/propertieslist.cpp b/xkeymacs/propertieslist.cpp index e8f0151..7c5ba0a 100644 --- a/xkeymacs/propertieslist.cpp +++ b/xkeymacs/propertieslist.cpp @@ -65,7 +65,7 @@ void CPropertiesList::SetDialogData() const int nAppID = m_pProperties->GetApplicationID(); for (int nComID = 1; nComID < MAX_COMMAND; ++nComID) { - const LPCSTR szComName = CCommands::GetCommandName(nComID); + const LPCTSTR szComName = CCommands::GetCommandName(nComID); if (!szComName[0]) break; const CString category(MAKEINTRESOURCE(CCommands::GetCategoryID(nComID))); diff --git a/xkeymacsdll/Commands.cpp b/xkeymacsdll/Commands.cpp index ba11f47..95c4bc5 100644 --- a/xkeymacsdll/Commands.cpp +++ b/xkeymacsdll/Commands.cpp @@ -4005,7 +4005,7 @@ int CCommands::ExecuteExtendedCommand() return Reset(GOTO_HOOKX); } -LPCSTR CCommands::GetCommandName(int nComID) +LPCTSTR CCommands::GetCommandName(int nComID) { return Commands[nComID].szCommandName; } diff --git a/xkeymacsdll/Commands.h b/xkeymacsdll/Commands.h index 89d954d..800e98c 100644 --- a/xkeymacsdll/Commands.h +++ b/xkeymacsdll/Commands.h @@ -171,7 +171,7 @@ public: static int BackwardChar(); static int BeginningOfLine(); static int ForwardChar(); - static LPCSTR GetCommandName(int nComID); + static LPCTSTR GetCommandName(int nComID); static int GetCategoryID(int nComID); static int GetDescriptionID(int nComID); static int GetToolTipID(int nComID); diff --git a/xkeymacsdll/Utils.cpp b/xkeymacsdll/Utils.cpp index 2d628b6..b8c9756 100644 --- a/xkeymacsdll/Utils.cpp +++ b/xkeymacsdll/Utils.cpp @@ -242,7 +242,7 @@ BOOL CUtils::GetClipboardText(CString& text) const LPVOID pMem = GlobalLock(hClipboard); if (!pMem) return FALSE; - text = reinterpret_cast(pMem); + text = reinterpret_cast(pMem); GlobalUnlock(hClipboard); EmptyClipboard(); CloseClipboard(); diff --git a/xkeymacsdll/xkeymacsdll.cpp b/xkeymacsdll/xkeymacsdll.cpp index 576f0c1..ce1058a 100644 --- a/xkeymacsdll/xkeymacsdll.cpp +++ b/xkeymacsdll/xkeymacsdll.cpp @@ -447,8 +447,8 @@ void CXkeymacsDll::InitKeyboardProc(bool imeState) if (m_nAppID < 0) m_nAppID = nAppID; else { - LPCSTR curText = m_Config.szWindowText[m_nAppID]; - LPCSTR newText = m_Config.szWindowText[nAppID]; + LPCTSTR curText = m_Config.szWindowText[m_nAppID]; + LPCTSTR newText = m_Config.szWindowText[nAppID]; int curType = CUtils::GetWindowTextType(curText); int newType = CUtils::GetWindowTextType(newText); if (curType < newType || curType == newType && _tcscmp(curText, newText) <= 0) @@ -475,7 +475,7 @@ void CXkeymacsDll::InitKeyboardProc(bool imeState) CCommands::Reset(); } -int CXkeymacsDll::GetAppID(LPCSTR szName, int fallback) +int CXkeymacsDll::GetAppID(LPCTSTR szName, int fallback) { for (int i = 0; i < MAX_APP; ++i) if (!_tcsicmp(m_Config.szSpecialApp[i], szName)) diff --git a/xkeymacsdll/xkeymacsdll.h b/xkeymacsdll/xkeymacsdll.h index 0bea514..ac4a4fd 100644 --- a/xkeymacsdll/xkeymacsdll.h +++ b/xkeymacsdll/xkeymacsdll.h @@ -67,7 +67,7 @@ private: static LRESULT CALLBACK ShellProc(int nCode, WPARAM wParam, LPARAM lParam); static int m_nAppID; static void InitKeyboardProc(bool imeState); - static int GetAppID(LPCSTR szName, int fallback); + static int GetAppID(LPCTSTR szName, int fallback); static BOOL m_bRightShift; static BOOL m_bRightControl; static BOOL m_bRightAlt; -- 2.11.0