OSDN Git Service

Use LPCSTR instead of CString in arguments of SaveKeyBind,
[xkeymacs/xkeymacs.git] / xkeymacs / profile.cpp
index d003ae4..923ff43 100644 (file)
@@ -734,50 +734,39 @@ BOOL CProfile::IsCommandType(const int nType, LPCTSTR szKeyBind)
        return FALSE;\r
 }\r
 \r
-void CProfile::SaveKeyBind(const CString szApplicationName, const int nComID, const int nType, const int nKey)\r
+void CProfile::SaveKeyBind(const LPCSTR szAppName, const int nComID, const int nType, const int nKey)\r
 {\r
-       if (!nComID) {\r
+       if (!nComID)\r
                return;\r
-       }\r
-\r
-       CString szCommandName = CCommands::GetCommandName(nComID);\r
-       if (szCommandName.IsEmpty()) {\r
+       const LPCSTR szComName = CCommands::GetCommandName(nComID);\r
+       if (!szComName[0])\r
                return;\r
-       }\r
-\r
-       SaveKeyBind(szApplicationName, szCommandName, nType, nKey);\r
+       SaveKeyBind(szAppName, szComName, nType, nKey);\r
 }\r
 \r
-void CProfile::SaveKeyBind(const CString szApplicationName, const CString szCommandName, const int nType, const int nKey)\r
+void CProfile::SaveKeyBind(const LPCSTR szAppName, const LPCSTR szComName, const int nType, const int nKey)\r
 {\r
-       CString szKeyBind = WriteKeyBind(nType, nKey);\r
-       CString szSubKey(MAKEINTRESOURCE(IDS_REGSUBKEY_DATA));\r
-       szSubKey += _T("\\") + szApplicationName + _T("\\") + szCommandName;\r
-       if (!szKeyBind.IsEmpty()) {\r
+       const CString szKeyBind = WriteKeyBind(nType, nKey);\r
+       CString szSubKey = CString(MAKEINTRESOURCE(IDS_REGSUBKEY_DATA)) + _T("\\") + szAppName + _T("\\") + szComName;\r
+       if (!szKeyBind.IsEmpty())\r
                szSubKey += _T("\\") + szKeyBind;\r
-       }\r
-\r
        HKEY hKey = NULL;\r
-       if (RegCreateKeyEx(HKEY_CURRENT_USER, szSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL) == ERROR_SUCCESS) {\r
+       if (RegCreateKeyEx(HKEY_CURRENT_USER, szSubKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hKey, NULL) == ERROR_SUCCESS)\r
                RegCloseKey(hKey);\r
-       }\r
 }\r
 \r
-void CProfile::SaveCommand(const CString szApplicationName, const int nComID)\r
+void CProfile::SaveCommand(const LPCSTR szAppName, const int nComID)\r
 {\r
-       SaveKeyBind(szApplicationName, nComID, 0, 0);\r
+       SaveKeyBind(szAppName, nComID, 0, 0);\r
 }\r
 \r
-void CProfile::AddKeyBind2C_(const CString szApplicationName, const BYTE bVk)\r
+void CProfile::AddKeyBind2C_(const LPCSTR szAppName, const BYTE bVk)\r
 {\r
        int nComID;\r
-       for (nComID = 0; nComID < MAX_COMMAND; ++nComID) {\r
-               if (Commands[nComID].fCommand == CCommands::C_) {\r
+       for (nComID = 0; nComID < MAX_COMMAND; ++nComID)\r
+               if (Commands[nComID].fCommand == CCommands::C_)\r
                        break;\r
-               }\r
-       }\r
-\r
-       SaveKeyBind(szApplicationName, nComID, NONE, bVk);\r
+       SaveKeyBind(szAppName, nComID, NONE, bVk);\r
 }\r
 \r
 void CProfile::LevelUp()\r