OSDN Git Service

Remove unhelpful const declarations in profile.{cpp,h} and xkeymacsdll.cpp.
authorKazuhiro Fujieda <fujieda@users.sourceforge.jp>
Mon, 7 Nov 2011 13:05:54 +0000 (22:05 +0900)
committerKazuhiro Fujieda <fujieda@users.sourceforge.jp>
Tue, 3 Jan 2012 12:04:00 +0000 (21:04 +0900)
xkeymacs/profile.cpp
xkeymacs/profile.h
xkeymacsdll/xkeymacsdll.cpp

index 7db0e15..404ca2a 100644 (file)
@@ -68,7 +68,7 @@ void CProfile::DeleteAllRegistryData()
 \r
 void CProfile::LevelUp()\r
 {\r
-       const int nCurrentLevel = AfxGetApp()->GetProfileInt(_T(""), _T("Level"), 0);\r
+       int nCurrentLevel = AfxGetApp()->GetProfileInt(_T(""), _T("Level"), 0);\r
        for (int nAppID = 0; nAppID < MAX_APP; ++nAppID) {\r
                CString entry;\r
                entry.Format(IDS_REG_ENTRY_APPLICATION, nAppID);\r
@@ -122,7 +122,7 @@ void CProfile::LevelUp()
        AfxGetApp()->WriteProfileInt(_T(""), _T("Level"), 4);\r
 }\r
 \r
-void CProfile::AddKeyBind2C_(const LPCSTR szAppName, const BYTE bVk)\r
+void CProfile::AddKeyBind2C_(LPCSTR szAppName, BYTE bVk)\r
 {\r
        int nComID;\r
        for (nComID = 0; nComID < MAX_COMMAND; ++nComID)\r
@@ -172,10 +172,10 @@ void CProfile::LoadRegistry()
                                RegCloseKey(hKey);\r
                        } else {\r
                                // Set the default assignment\r
-                               for (int i = 0; const int nKey = CCommands::GetDefaultCommandKey(nComID, i); ++i) {\r
+                               for (int i = 0; int nKey = CCommands::GetDefaultCommandKey(nComID, i); ++i) {\r
                                        if (CCommands::GetDefaultControlID(nComID, i) == IDC_CO2)\r
                                                continue;\r
-                                       const int nType = CCommands::GetDefaultCommandType(nComID, i);\r
+                                       int nType = CCommands::GetDefaultCommandType(nComID, i);\r
                                        m_Config.nCommandID[nAppID][nType][nKey] = nComID;\r
                                }\r
                        }\r
@@ -219,7 +219,7 @@ void CProfile::SaveRegistry()
 {\r
        const CString section(MAKEINTRESOURCE(IDS_REG_SECTION_APPLICATION));    \r
        for (int nAppID = 0; nAppID < MAX_APP; ++nAppID) {\r
-               const LPCTSTR szAppName = m_Config.szSpecialApp[nAppID];\r
+               LPCTSTR szAppName = m_Config.szSpecialApp[nAppID];\r
                CString entry;\r
                entry.Format(IDS_REG_ENTRY_APPLICATION, nAppID);\r
                if (!szAppName[0]) {\r
@@ -297,7 +297,7 @@ void CProfile::SetDllData()
        pApp->SendIPCMessage(XKEYMACS_RELOAD);\r
 }\r
 \r
-void CProfile::SaveKeyBind(const LPCTSTR appName, int comID, int type, int key)\r
+void CProfile::SaveKeyBind(LPCTSTR appName, int comID, int type, int key)\r
 {\r
        if (!comID)\r
                return;\r
@@ -307,7 +307,7 @@ void CProfile::SaveKeyBind(const LPCTSTR appName, int comID, int type, int key)
        SaveKeyBind(appName, comName, type, key);\r
 }\r
 \r
-void CProfile::SaveKeyBind(const LPCTSTR appName, const LPCTSTR comName, int type, int key)\r
+void CProfile::SaveKeyBind(LPCTSTR appName, LPCTSTR comName, int type, int key)\r
 {\r
        CString subKey = CString(MAKEINTRESOURCE(IDS_REGSUBKEY_DATA)) + _T("\\") + appName + _T("\\") + comName;\r
        CString s = KeyToString(type, key);\r
@@ -318,7 +318,7 @@ void CProfile::SaveKeyBind(const LPCTSTR appName, const LPCTSTR comName, int typ
                RegCloseKey(hKey);\r
 }\r
 \r
-void CProfile::StringToKey(const LPCTSTR str, int& type, int& key)\r
+void CProfile::StringToKey(LPCTSTR str, int& type, int& key)\r
 {\r
        m_KeyString.ToKey(str, type, key);\r
 }\r
@@ -335,8 +335,8 @@ void CProfile::InitAppList(CProperties& cProperties)
        EnumWindows(EnumWindowsProc, reinterpret_cast<LPARAM>(&cProperties));\r
 \r
        for (int i = 0; i < MAX_APP; ++i) {\r
-               const LPCTSTR szAppName = m_Config.szSpecialApp[i];\r
-               const LPCTSTR szAppTitle = m_szAppTitle[i];\r
+               LPCTSTR szAppName = m_Config.szSpecialApp[i];\r
+               LPCTSTR szAppTitle = m_szAppTitle[i];\r
                if (!szAppName[0] || !_tcscmp(szAppName, _T("IME")))\r
                        continue;\r
                if (CString(MAKEINTRESOURCE(IDS_DEFAULT)) == szAppName ||\r
@@ -367,7 +367,7 @@ void CProfile::GetTaskList()
        CloseHandle(hProcessSnap);\r
 }\r
 \r
-BOOL CALLBACK CProfile::EnumWindowsProc(const HWND hWnd, const LPARAM lParam)\r
+BOOL CALLBACK CProfile::EnumWindowsProc(HWND hWnd, LPARAM lParam)\r
 {\r
        CProperties *pProperties = reinterpret_cast<CProperties*>(lParam);\r
        PTASK_LIST pTask = CProfile::m_TaskList;\r
@@ -440,7 +440,7 @@ BOOL CALLBACK CProfile::EnumWindowsProc(const HWND hWnd, const LPARAM lParam)
 bool CProfile::GetAppTitle(CString& appTitle, const CString& windowName, int nth)\r
 {\r
        const CString sep(MAKEINTRESOURCE(IDS_SEPARATE_WINDOWTITLE));\r
-       const int nSep = windowName.Find(sep);\r
+       int nSep = windowName.Find(sep);\r
        if (nSep < 0) {\r
                appTitle = windowName;\r
                return false;\r
@@ -471,8 +471,8 @@ void CProfile::ClearData(const CString szCurrentApplication)
 \r
 void CProfile::CopyData(const CString szDstApp, const CString szSrcApp)\r
 {\r
-       const int nDstApp = AssignAppID(szDstApp);\r
-       const int nSrcApp = GetAppID(szSrcApp);\r
+       int nDstApp = AssignAppID(szDstApp);\r
+       int nSrcApp = GetAppID(szSrcApp);\r
        if (nDstApp == MAX_APP || nSrcApp == MAX_APP)\r
                return;\r
        SetSettingStyle(nDstApp, SETTING_SPECIFIC);\r
@@ -489,7 +489,7 @@ void CProfile::CopyData(const CString szDstApp, const CString szSrcApp)
 #undef CopyMember\r
 }\r
 \r
-int CProfile::AssignAppID(const LPCSTR szAppName)\r
+int CProfile::AssignAppID(LPCSTR szAppName)\r
 {\r
        int nAppID = GetAppID(szAppName);\r
        if (nAppID != MAX_APP)\r
@@ -511,7 +511,7 @@ int CProfile::DefaultAppID()
        return MAX_APP;\r
 }\r
 \r
-int CProfile::GetAppID(const LPCSTR szAppName)\r
+int CProfile::GetAppID(LPCSTR szAppName)\r
 {\r
        int nAppID = 0;\r
        for (nAppID = 0; nAppID < MAX_APP; ++nAppID)\r
@@ -520,7 +520,7 @@ int CProfile::GetAppID(const LPCSTR szAppName)
        return nAppID;\r
 }\r
 \r
-int CProfile::GetSettingStyle(const int nAppID)\r
+int CProfile::GetSettingStyle(int nAppID)\r
 {\r
        if (nAppID == MAX_APP)\r
                return SETTING_DEFAULT;\r
@@ -534,12 +534,12 @@ void CProfile::SetSettingStyle(int nAppID, int nSettingStyle)
        m_Config.nSettingStyle[nAppID] = static_cast<BYTE>(nSettingStyle);\r
 }\r
 \r
-void CProfile::SetAppTitle(const int nAppID, const CString& appTitle)\r
+void CProfile::SetAppTitle(int nAppID, const CString& appTitle)\r
 {\r
        _tcsncpy_s(m_szAppTitle[nAppID], appTitle, _TRUNCATE);\r
 }\r
 \r
-int CProfile::GetCommandID(const int nAppID, const int nType, const int nKey)\r
+int CProfile::GetCommandID(int nAppID, int nType, int nKey)\r
 {\r
        int nComID = m_Config.nCommandID[nAppID][nType][nKey];\r
        if (nKey == 0xf0 && Commands[nComID].fCommand == CCommands::C_Eisu)\r
@@ -550,7 +550,7 @@ int CProfile::GetCommandID(const int nAppID, const int nType, const int nKey)
        return nComID;\r
 }\r
 \r
-void CProfile::SetCommandID(const int nAppID, const int nType, const int nKey, int nComID)\r
+void CProfile::SetCommandID(int nAppID, int nType, int nKey, int nComID)\r
 {\r
        if (nKey == 0xf0 && Commands[nComID].fCommand == CCommands::C_)\r
                // Change CommandID C_Eisu\r
@@ -560,42 +560,42 @@ void CProfile::SetCommandID(const int nAppID, const int nType, const int nKey, i
        m_Config.nCommandID[nAppID][nType][nKey] = static_cast<BYTE>(nComID);\r
 }\r
 \r
-BOOL CProfile::GetUseDialogSetting(const int nAppID)\r
+BOOL CProfile::GetUseDialogSetting(int nAppID)\r
 {\r
        return m_Config.bUseDialogSetting[nAppID];\r
 }\r
 \r
-void CProfile::SetUseDialogSetting(const int nAppID, const BOOL bUseDialogSetting)\r
+void CProfile::SetUseDialogSetting(int nAppID, BOOL bUseDialogSetting)\r
 {\r
        m_Config.bUseDialogSetting[nAppID] = static_cast<BYTE>(bUseDialogSetting);\r
 }\r
 \r
-BOOL CProfile::GetEnableCUA(const int nAppID)\r
+BOOL CProfile::GetEnableCUA(int nAppID)\r
 {\r
        return m_Config.bEnableCUA[nAppID];\r
 }\r
 \r
-void CProfile::SetEnableCUA(const int nAppID, const BOOL bEnableCUA)\r
+void CProfile::SetEnableCUA(int nAppID, BOOL bEnableCUA)\r
 {\r
        m_Config.bEnableCUA[nAppID] = static_cast<BYTE>(bEnableCUA);\r
 }\r
 \r
-int CProfile::GetKillRingMax(const int nAppID)\r
+int CProfile::GetKillRingMax(int nAppID)\r
 {\r
        return m_Config.nKillRingMax[nAppID];\r
 }\r
 \r
-void CProfile::SetKillRingMax(const int nAppID, const int nKillRingMax)\r
+void CProfile::SetKillRingMax(int nAppID, int nKillRingMax)\r
 {\r
        m_Config.nKillRingMax[nAppID] = static_cast<BYTE>(nKillRingMax > 255 ? 255 : nKillRingMax);\r
 }\r
 \r
-CString CProfile::GetWindowText(const int nAppID)\r
+CString CProfile::GetWindowText(int nAppID)\r
 {\r
        return m_Config.szWindowText[nAppID];\r
 }\r
 \r
-void CProfile::SetWindowText(const int nAppID, const CString szWindowText)\r
+void CProfile::SetWindowText(int nAppID, const CString szWindowText)\r
 {\r
        if (CUtils::GetWindowTextType(szWindowText) == IDS_WINDOW_TEXT_IGNORE)\r
                _tcscpy_s(m_Config.szWindowText[nAppID], _T("*"));\r
@@ -617,7 +617,7 @@ BOOL CProfile::Is106Keyboard()
 \r
                if (verInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) {\r
                        HKEY hKey = NULL;\r
-                       CString szSubKey(_T("SYSTEM\\CurrentControlSet\\Services\\i8042prt\\Parameters"));\r
+                       const CString szSubKey(_T("SYSTEM\\CurrentControlSet\\Services\\i8042prt\\Parameters"));\r
                        if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, szSubKey, 0, KEY_QUERY_VALUE, &hKey) == ERROR_SUCCESS) {\r
                                static const CString szValueName(_T("OverrideKeyboardSubtype"));\r
                                if (RegQueryValueEx(hKey, szValueName, NULL, NULL, (LPBYTE)&subtype, &cbData) != ERROR_SUCCESS) {\r
index 29dc6af..8079c8e 100644 (file)
@@ -37,12 +37,12 @@ public:
        static void InitAppList(CProperties& cProperties);\r
        static void CopyData(CString szDestinationApplication, CString szSourceApplication);\r
        static void ClearData(CString szCurrentApplication);\r
-       static int AssignAppID(const LPCSTR szAppName);\r
+       static int AssignAppID(LPCSTR szAppName);\r
        static int DefaultAppID();\r
-       static int GetAppID(const LPCSTR szAppName);\r
-       static int GetSettingStyle(const int nAppID);\r
-       static void SetSettingStyle(const int nAppID, const int nSettingStyle);\r
-       static void SetAppTitle(const int nAppID, const CString& appTitle);\r
+       static int GetAppID(LPCSTR szAppName);\r
+       static int GetSettingStyle(int nAppID);\r
+       static void SetSettingStyle(int nAppID, int nSettingStyle);\r
+       static void SetAppTitle(int nAppID, const CString& appTitle);\r
        static int GetCommandID(int nAppID, int nType, int nKey);\r
        static void SetCommandID(int nAppID, int nType, int nKey, int nComID);\r
        static BOOL GetUseDialogSetting(int nAppID);\r
@@ -66,12 +66,12 @@ private:
        static TCHAR m_szAppTitle[MAX_APP][WINDOW_TEXT_LENGTH];\r
        static void DeleteAllRegistryData();\r
        static void LevelUp();\r
-       static void AddKeyBind2C_(const LPCTSTR szApplicationName, BYTE bVk);\r
+       static void AddKeyBind2C_(LPCTSTR szApplicationName, BYTE bVk);\r
        static void LoadRegistry();\r
        static void SaveRegistry();\r
        static void SetDllData();\r
-       static void SaveKeyBind(const LPCTSTR appName, int comID, int type, int key);\r
-       static void SaveKeyBind(const LPCTSTR appName, const LPCTSTR comName, int type, int key);\r
+       static void SaveKeyBind(LPCTSTR appName, int comID, int type, int key);\r
+       static void SaveKeyBind(LPCTSTR appName, LPCTSTR comName, int type, int key);\r
        static TASK_LIST m_TaskList[MAX_TASKS];\r
        static DWORD m_dwTasks;\r
        static void GetTaskList();\r
index d709a52..576f0c1 100644 (file)
@@ -447,10 +447,10 @@ void CXkeymacsDll::InitKeyboardProc(bool imeState)
                        if (m_nAppID < 0)\r
                                m_nAppID = nAppID;\r
                        else {\r
-                               const LPCSTR curText = m_Config.szWindowText[m_nAppID];\r
-                               const LPCSTR newText = m_Config.szWindowText[nAppID];\r
-                               const int curType = CUtils::GetWindowTextType(curText);\r
-                               const int newType = CUtils::GetWindowTextType(newText);\r
+                               LPCSTR curText = m_Config.szWindowText[m_nAppID];\r
+                               LPCSTR newText = m_Config.szWindowText[nAppID];\r
+                               int curType = CUtils::GetWindowTextType(curText);\r
+                               int newType = CUtils::GetWindowTextType(newText);\r
                                if (curType < newType || curType == newType && _tcscmp(curText, newText) <= 0)\r
                                        m_nAppID = nAppID;\r
                        }\r
@@ -485,9 +485,9 @@ int CXkeymacsDll::GetAppID(LPCSTR szName, int fallback)
 \r
 LRESULT CALLBACK CXkeymacsDll::KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam)\r
 {\r
-       const BYTE nOrigKey = static_cast<BYTE>(wParam);\r
-       const bool bRelease = (HIWORD(lParam) & KF_UP) != 0;\r
-       const bool bExtended = (HIWORD(lParam) & KF_EXTENDED) != 0;\r
+       BYTE nOrigKey = static_cast<BYTE>(wParam);\r
+       bool bRelease = (HIWORD(lParam) & KF_UP) != 0;\r
+       bool bExtended = (HIWORD(lParam) & KF_EXTENDED) != 0;\r
        BYTE nKey = nOrigKey;\r
 \r
        static BOOL bLocked = FALSE;\r
@@ -545,7 +545,7 @@ LRESULT CALLBACK CXkeymacsDll::KeyboardProc(int nCode, WPARAM wParam, LPARAM lPa
                case VK_RWIN:\r
                case VK_APPS:\r
                        for (int i = 0; i < MAX_COMMAND_TYPE; ++i) {\r
-                               int (*const fCommand)() = fCommand(i);\r
+                               int (*fCommand)() = fCommand(i);\r
                                if (fCommand && !(nOrigKey == VK_MENU && fCommand == CCommands::MetaAlt))\r
                                        goto HOOK;\r
                        }\r
@@ -608,7 +608,7 @@ LRESULT CALLBACK CXkeymacsDll::KeyboardProc(int nCode, WPARAM wParam, LPARAM lPa
        if (CheckOriginal(nVirtualType, nOrigKey))\r
                goto DO_NOTHING;\r
 \r
-       int (*const fCommand)() = fCommand(nType);\r
+       int (*fCommand)() = fCommand(nType);\r
        if (fCommand == CCommands::EnableOrDisableXKeymacs) {\r
                ToggleKeyboardHookState();\r
                goto HOOK;\r
@@ -668,7 +668,7 @@ LRESULT CALLBACK CXkeymacsDll::KeyboardProc(int nCode, WPARAM wParam, LPARAM lPa
                        memset(szPath, 0, sizeof(szPath));\r
                        goto HOOK;\r
                } else if (nKey && index < MAX_PATH - 1) {\r
-                       const BOOL bIsShiftDown = IsDown(VK_SHIFT, FALSE);\r
+                       BOOL bIsShiftDown = IsDown(VK_SHIFT, FALSE);\r
                        TCHAR nAscii = 0;\r
                        do { // 1-127\r
                                if (a2v(++nAscii) == nKey && bIsShiftDown == IsShift(nAscii)) {\r
@@ -983,7 +983,7 @@ void CXkeymacsDll::SetModifierState(UINT after, UINT before)
                UpdateKeyboardState(VK_CONTROL, 0);\r
        }\r
 \r
-       const BOOL bHookApp =\r
+       BOOL bHookApp =\r
                CUtils::IsVisualCpp() ||  CUtils::IsVisualStudio() ||\r
                CUtils::IsInternetExplorer() || CUtils::IsFirefox() || CUtils::IsChrome();\r
        if (after & META && !(before & META)) {\r
@@ -1152,7 +1152,7 @@ void CXkeymacsDll::CallFunction(int nFuncID)
        if (!def[0])\r
                return;\r
        std::vector<KeyBind> keybinds;\r
-       const LPCTSTR last = def + _tcslen(def) - 1;\r
+       LPCTSTR last = def + _tcslen(def) - 1;\r
        if (*def == _T('"') && *last == _T('"')) {\r
                ++def; // skip '"'\r
                while (def < last)\r
@@ -1184,8 +1184,8 @@ void CXkeymacsDll::CallFunction(int nFuncID)
        UINT before = GetModifierState(FALSE);\r
 \r
        for (std::vector<KeyBind>::const_iterator p = keybinds.begin(); p != keybinds.end(); ++p) {\r
-               const int nType = p->nType;\r
-               const BYTE bVk = p->bVk;\r
+               int nType = p->nType;\r
+               BYTE bVk = p->bVk;\r
                int (*fCommand)() = nType < MAX_COMMAND_TYPE ? Commands[m_Config.nCommandID[m_nAppID][nType][bVk]].fCommand : NULL;\r
                if (fCommand) {\r
                        if (fCommand == CCommands::ExecuteExtendedCommand)\r
@@ -1227,7 +1227,7 @@ void CXkeymacsDll::CallFunction(int nFuncID)
                if (nType & SHIFT)\r
                        DepressKey(VK_SHIFT);\r
                Kdu(bVk);\r
-               const int nNextType = (p + 1) != keybinds.end() ? (p + 1)->nType : 0;\r
+               int nNextType = (p + 1) != keybinds.end() ? (p + 1)->nType : 0;\r
                if (nType & SHIFT && !(nNextType & SHIFT))\r
                        ReleaseKey(VK_SHIFT);\r
                if (nType & WIN_ALT && !(nNextType & WIN_ALT))\r