From dc93eb8b1552904e0eb5a01d9abf23c5cf7ede5e Mon Sep 17 00:00:00 2001 From: Kazuhiro Fujieda Date: Fri, 8 Jul 2011 15:59:57 +0900 Subject: [PATCH] Use references instead of pointers in arguments of CProfile::ReadKeyBind. --- xkeymacs/profile.cpp | 15 +++++++-------- xkeymacs/profile.h | 2 +- xkeymacs/propertiesadvanced.cpp | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/xkeymacs/profile.cpp b/xkeymacs/profile.cpp index 923ff43..0f52fe4 100644 --- a/xkeymacs/profile.cpp +++ b/xkeymacs/profile.cpp @@ -511,7 +511,7 @@ void CProfile::LoadRegistry() DWORD dwKeyBind = _countof(szKeyBind); for (DWORD dwIndex = 0; RegEnumKeyEx(hKey, dwIndex, szKeyBind, &dwKeyBind, NULL, NULL, NULL, NULL) == ERROR_SUCCESS; ++dwIndex) { int nType, nKey; - ReadKeyBind(&nType, &nKey, szKeyBind); + ReadKeyBind(nType, nKey, szKeyBind); m_Config.nCommandID[nAppID][nType][nKey] = nComID; dwKeyBind = _countof(szKeyBind); } @@ -535,7 +535,7 @@ void CProfile::LoadRegistry() DWORD dwKeyBind = _countof(szKeyBind); for (DWORD dwIndex = 0; RegEnumKeyEx(hKey, dwIndex, szKeyBind, &dwKeyBind, NULL, NULL, NULL, NULL) == ERROR_SUCCESS; ++dwIndex) { int nType, nKey; - ReadKeyBind(&nType, &nKey, szKeyBind); + ReadKeyBind(nType, nKey, szKeyBind); CDotXkeymacs::SetKey(nFuncID, nAppID, nType, nKey); dwKeyBind = _countof(szKeyBind); } @@ -657,10 +657,10 @@ void CProfile::SetDllData() pApp->SendIPCMessage(XKEYMACS_RELOAD); } -void CProfile::ReadKeyBind(int *const pnCommandType, int *const pnKey, LPCTSTR szKeyBind) +void CProfile::ReadKeyBind(int& nCommandType, int& nKey, const LPCTSTR szKeyBind) { - *pnCommandType = KeyBind2CommandType(szKeyBind); - *pnKey = KeyBind2Key(szKeyBind + _tcslen(CommandType2String(*pnCommandType))); + nCommandType = KeyBind2CommandType(szKeyBind); + nKey = KeyBind2Key(szKeyBind + _tcslen(CommandType2String(nCommandType))); } CString CProfile::WriteKeyBind(const int nType, const int nKey) @@ -864,9 +864,8 @@ void CProfile::LevelUp() DWORD dwKeyBind = sizeof(szKeyBind); FILETIME ft = {'\0'}; // not use for (DWORD dwIndex = 0; RegEnumKeyEx(hKey, dwIndex, szKeyBind, &dwKeyBind, NULL, NULL, NULL, &ft) == ERROR_SUCCESS; ++dwIndex) { - int nType = 0; - int nKey = 0; - ReadKeyBind(&nType, &nKey, szKeyBind); + int nType, nKey; + ReadKeyBind(nType, nKey, szKeyBind); SaveKeyBind(szApplicationName, CDotXkeymacs::GetFunctionSymbol(nFuncID), nType, nKey); memset(szKeyBind, 0, sizeof(szKeyBind)); diff --git a/xkeymacs/profile.h b/xkeymacs/profile.h index 2adfc4d..0b1c961 100644 --- a/xkeymacs/profile.h +++ b/xkeymacs/profile.h @@ -44,7 +44,7 @@ public: static void SetUseDialogSetting(int nAppID, BOOL bUseDialogSetting); static int GetApplicationIndex(CString szApplicationName); static void CopyData(CString szDestinationApplication, CString szSourceApplication); - static void ReadKeyBind(int *pnCommandType, int *pnKey, LPCTSTR szKeyBind); + static void ReadKeyBind(int& pnCommandType, int& pnKey, LPCTSTR szKeyBind); static LPCTSTR Key2String(int nKey); static LPCTSTR CommandType2String(int nType); static int GetCurrentApplicationID(CComboBox *cApplicationList, CString szCurrentApplication); diff --git a/xkeymacs/propertiesadvanced.cpp b/xkeymacs/propertiesadvanced.cpp index 1c4d07e..7fb37fc 100644 --- a/xkeymacs/propertiesadvanced.cpp +++ b/xkeymacs/propertiesadvanced.cpp @@ -351,7 +351,7 @@ void CPropertiesAdvanced::OnSelchangeCurrentKeys() { TCHAR szKeyBind[128] = {'\0'}; m_cCurrentKeys.GetText(m_cCurrentKeys.GetCurSel(), szKeyBind); - CProfile::ReadKeyBind(&m_nRemoveCommandType, &m_nRemoveKey, szKeyBind); + CProfile::ReadKeyBind(m_nRemoveCommandType, m_nRemoveKey, szKeyBind); m_cRemove.EnableWindow(); } -- 2.11.0