OSDN Git Service

Use references instead of pointers in arguments of CProfile::ReadKeyBind.
authorKazuhiro Fujieda <fujieda@users.sourceforge.jp>
Fri, 8 Jul 2011 06:59:57 +0000 (15:59 +0900)
committerKazuhiro Fujieda <fujieda@users.sourceforge.jp>
Wed, 13 Jul 2011 05:28:19 +0000 (14:28 +0900)
xkeymacs/profile.cpp
xkeymacs/profile.h
xkeymacs/propertiesadvanced.cpp

index 923ff43..0f52fe4 100644 (file)
@@ -511,7 +511,7 @@ void CProfile::LoadRegistry()
                                DWORD dwKeyBind = _countof(szKeyBind);\r
                                for (DWORD dwIndex = 0; RegEnumKeyEx(hKey, dwIndex, szKeyBind, &dwKeyBind, NULL, NULL, NULL, NULL) == ERROR_SUCCESS; ++dwIndex) {\r
                                        int nType, nKey;\r
-                                       ReadKeyBind(&nType, &nKey, szKeyBind);\r
+                                       ReadKeyBind(nType, nKey, szKeyBind);\r
                                        m_Config.nCommandID[nAppID][nType][nKey] = nComID;\r
                                        dwKeyBind = _countof(szKeyBind);\r
                                }\r
@@ -535,7 +535,7 @@ void CProfile::LoadRegistry()
                                DWORD dwKeyBind = _countof(szKeyBind);\r
                                for (DWORD dwIndex = 0; RegEnumKeyEx(hKey, dwIndex, szKeyBind, &dwKeyBind, NULL, NULL, NULL, NULL) == ERROR_SUCCESS; ++dwIndex) {\r
                                        int nType, nKey;\r
-                                       ReadKeyBind(&nType, &nKey, szKeyBind);\r
+                                       ReadKeyBind(nType, nKey, szKeyBind);\r
                                        CDotXkeymacs::SetKey(nFuncID, nAppID, nType, nKey);\r
                                        dwKeyBind = _countof(szKeyBind);\r
                                }\r
@@ -657,10 +657,10 @@ void CProfile::SetDllData()
        pApp->SendIPCMessage(XKEYMACS_RELOAD);\r
 }\r
 \r
-void CProfile::ReadKeyBind(int *const pnCommandType, int *const pnKey, LPCTSTR szKeyBind)\r
+void CProfile::ReadKeyBind(int& nCommandType, int& nKey, const LPCTSTR szKeyBind)\r
 {\r
-       *pnCommandType = KeyBind2CommandType(szKeyBind);\r
-       *pnKey = KeyBind2Key(szKeyBind + _tcslen(CommandType2String(*pnCommandType)));\r
+       nCommandType = KeyBind2CommandType(szKeyBind);\r
+       nKey = KeyBind2Key(szKeyBind + _tcslen(CommandType2String(nCommandType)));\r
 }\r
 \r
 CString CProfile::WriteKeyBind(const int nType, const int nKey)\r
@@ -864,9 +864,8 @@ void CProfile::LevelUp()
                                                DWORD dwKeyBind = sizeof(szKeyBind);\r
                                                FILETIME ft = {'\0'};   // not use\r
                                                for (DWORD dwIndex = 0; RegEnumKeyEx(hKey, dwIndex, szKeyBind, &dwKeyBind, NULL, NULL, NULL, &ft) == ERROR_SUCCESS; ++dwIndex) {\r
-                                                       int nType = 0;\r
-                                                       int nKey = 0;\r
-                                                       ReadKeyBind(&nType, &nKey, szKeyBind);\r
+                                                       int nType, nKey;\r
+                                                       ReadKeyBind(nType, nKey, szKeyBind);\r
                                                        SaveKeyBind(szApplicationName, CDotXkeymacs::GetFunctionSymbol(nFuncID), nType, nKey);\r
 \r
                                                        memset(szKeyBind, 0, sizeof(szKeyBind));\r
index 2adfc4d..0b1c961 100644 (file)
@@ -44,7 +44,7 @@ public:
        static void SetUseDialogSetting(int nAppID, BOOL bUseDialogSetting);\r
        static int GetApplicationIndex(CString szApplicationName);\r
        static void CopyData(CString szDestinationApplication, CString szSourceApplication);\r
-       static void ReadKeyBind(int *pnCommandType, int *pnKey, LPCTSTR szKeyBind);\r
+       static void ReadKeyBind(int& pnCommandType, int& pnKey, LPCTSTR szKeyBind);\r
        static LPCTSTR Key2String(int nKey);\r
        static LPCTSTR CommandType2String(int nType);\r
        static int GetCurrentApplicationID(CComboBox *cApplicationList, CString szCurrentApplication);\r
index 1c4d07e..7fb37fc 100644 (file)
@@ -351,7 +351,7 @@ void CPropertiesAdvanced::OnSelchangeCurrentKeys()
 {\r
        TCHAR szKeyBind[128] = {'\0'};\r
        m_cCurrentKeys.GetText(m_cCurrentKeys.GetCurSel(), szKeyBind);\r
-       CProfile::ReadKeyBind(&m_nRemoveCommandType, &m_nRemoveKey, szKeyBind);\r
+       CProfile::ReadKeyBind(m_nRemoveCommandType, m_nRemoveKey, szKeyBind);\r
        m_cRemove.EnableWindow();\r
 }\r
 \r