OSDN Git Service

Change arrays of BOOL or int to arrays of BYTE in CONFIG and CXkeymacsDll.
authorKazuhiro Fujieda <fujieda@users.sourceforge.jp>
Tue, 12 Jul 2011 09:41:23 +0000 (18:41 +0900)
committerKazuhiro Fujieda <fujieda@users.sourceforge.jp>
Wed, 13 Jul 2011 06:12:57 +0000 (15:12 +0900)
xkeymacs/profile.cpp
xkeymacsdll/ipc.h
xkeymacsdll/xkeymacsdll.cpp
xkeymacsdll/xkeymacsdll.h

index a6fdfaa..2d9f4c5 100644 (file)
@@ -420,7 +420,7 @@ void CProfile::LoadRegistry()
                _tcsncpy_s(m_Config.szWindowText[nAppID], AfxGetApp()->GetProfileString(appName, entry, _T("*")), _TRUNCATE);\r
 \r
                const CString regApp = CString(MAKEINTRESOURCE(IDS_REGSUBKEY_DATA)) + _T("\\") + appName;\r
-               for (int nComID = 1; nComID < MAX_COMMAND; ++nComID) {\r
+               for (BYTE nComID = 1; nComID < MAX_COMMAND; ++nComID) {\r
                        entry = CCommands::GetCommandName(nComID);\r
                        HKEY hKey;\r
                        const CString regKey = regApp + _T("\\") + entry;\r
@@ -462,19 +462,20 @@ void CProfile::LoadRegistry()
                }\r
 \r
                entry.LoadString(IDS_REG_ENTRY_KILL_RING_MAX);\r
-               m_Config.nKillRingMax[nAppID] = AfxGetApp()->GetProfileInt(appName, entry, 1);\r
+               int n = AfxGetApp()->GetProfileInt(appName, entry, 1);\r
+               m_Config.nKillRingMax[nAppID] = static_cast<BYTE>(n > 255 ? 255 : n);\r
                entry.LoadString(IDS_REG_ENTRY_USE_DIALOG_SETTING);\r
-               m_Config.bUseDialogSetting[nAppID] = AfxGetApp()->GetProfileInt(appName, entry, 1);\r
+               m_Config.bUseDialogSetting[nAppID] = static_cast<BYTE>(AfxGetApp()->GetProfileInt(appName, entry, 1));\r
                entry.LoadString(IDS_REG_ENTRY_DISABLE_XKEYMACS);\r
-               m_Config.nSettingStyle[nAppID] = AfxGetApp()->GetProfileInt(appName, entry, 0) ? SETTING_DISABLE : SETTING_SPECIFIC;\r
+               m_Config.nSettingStyle[nAppID] = static_cast<BYTE>(AfxGetApp()->GetProfileInt(appName, entry, 0) ? SETTING_DISABLE : SETTING_SPECIFIC);\r
                entry.LoadString(IDC_REG_ENTRY_IGNORE_META_CTRL);\r
-               m_Config.bIgnoreUndefinedMetaCtrl[nAppID] = AfxGetApp()->GetProfileInt(appName, entry, 0);\r
+               m_Config.bIgnoreUndefinedMetaCtrl[nAppID] = static_cast<BYTE>(AfxGetApp()->GetProfileInt(appName, entry, 0));\r
                entry.LoadString(IDC_REG_ENTRY_IGNORE_C_X);\r
-               m_Config.bIgnoreUndefinedC_x[nAppID] = AfxGetApp()->GetProfileInt(appName, entry, 0);\r
+               m_Config.bIgnoreUndefinedC_x[nAppID] = static_cast<BYTE>(AfxGetApp()->GetProfileInt(appName, entry, 0));\r
                entry.LoadString(IDC_REG_ENTRY_ENABLE_CUA);\r
-               m_Config.bEnableCUA[nAppID] = AfxGetApp()->GetProfileInt(appName, entry, 0);\r
+               m_Config.bEnableCUA[nAppID] = static_cast<BYTE>(AfxGetApp()->GetProfileInt(appName, entry, 0));\r
                entry.LoadString(IDS_REG_ENTRY_326_COMPATIBLE);\r
-               m_Config.b326Compatible[nAppID] = AfxGetApp()->GetProfileInt(appName, entry, 0);\r
+               m_Config.b326Compatible[nAppID] = static_cast<BYTE>(AfxGetApp()->GetProfileInt(appName, entry, 0));\r
        }\r
 }\r
 \r
@@ -556,7 +557,7 @@ void CProfile::SetDllData()
                        for (int nKey = 0; nKey < MAX_KEY; ++nKey)\r
                                if ((nType & CONTROLX) && m_Config.nCommandID[nAppID][nType][nKey])\r
                                        m_Config.nCommandID[nAppID][CONTROL]['X'] = 1; // C-x is available.\r
-               for (int nFuncID = 0; nFuncID < CDotXkeymacs::GetFunctionNumber(); ++nFuncID)\r
+               for (BYTE nFuncID = 0; nFuncID < CDotXkeymacs::GetFunctionNumber(); ++nFuncID)\r
                        for (int nKeyID = 0; nKeyID < CDotXkeymacs::GetKeyNumber(nFuncID, nAppID); ++nKeyID) {\r
                                int nType, nKey;\r
                                CDotXkeymacs::GetKey(nFuncID, nAppID, nKeyID, &nType, &nKey);\r
@@ -565,7 +566,7 @@ void CProfile::SetDllData()
                                        m_Config.nCommandID[nAppID][CONTROL]['X'] = 1; // C-x is available.\r
                        }\r
        }\r
-       m_Config.b106Keyboard = Is106Keyboard();\r
+       m_Config.b106Keyboard = static_cast<BYTE>(Is106Keyboard());\r
        CXkeymacsDll::SetConfig(m_Config);\r
        CXkeymacsApp *pApp = static_cast<CXkeymacsApp *>(AfxGetApp());\r
        if (!pApp->IsWow64())\r
@@ -855,7 +856,7 @@ void CProfile::SetSettingStyle(int nAppID, int nSettingStyle)
 {\r
        if (nAppID == MAX_APP)\r
                return;\r
-       m_Config.nSettingStyle[nAppID] = nSettingStyle;\r
+       m_Config.nSettingStyle[nAppID] = static_cast<BYTE>(nSettingStyle);\r
 }\r
 \r
 BOOL CProfile::Is106Keyboard()\r
@@ -902,7 +903,7 @@ void CProfile::SetCommandID(const int nAppID, const int nType, const int nKey, i
                for (nComID = 1; nComID < MAX_COMMAND; ++nComID)\r
                        if (Commands[nComID].fCommand == CCommands::C_Eisu)\r
                                break;\r
-       m_Config.nCommandID[nAppID][nType][nKey] = nComID;\r
+       m_Config.nCommandID[nAppID][nType][nKey] = static_cast<BYTE>(nComID);\r
 }\r
 \r
 int CProfile::GetCommandID(const int nAppID, const int nType, const int nKey)\r
@@ -918,7 +919,7 @@ int CProfile::GetCommandID(const int nAppID, const int nType, const int nKey)
 \r
 void CProfile::SetKillRingMax(const int nAppID, const int nKillRingMax)\r
 {\r
-       m_Config.nKillRingMax[nAppID] = nKillRingMax;\r
+       m_Config.nKillRingMax[nAppID] = static_cast<BYTE>(nKillRingMax > 255 ? 255 : nKillRingMax);\r
 }\r
 \r
 int CProfile::GetKillRingMax(const int nAppID)\r
@@ -928,7 +929,7 @@ int CProfile::GetKillRingMax(const int nAppID)
 \r
 void CProfile::SetUseDialogSetting(const int nAppID, const BOOL bUseDialogSetting)\r
 {\r
-       m_Config.bUseDialogSetting[nAppID] = bUseDialogSetting;\r
+       m_Config.bUseDialogSetting[nAppID] = static_cast<BYTE>(bUseDialogSetting);\r
 }\r
 \r
 BOOL CProfile::GetUseDialogSetting(const int nAppID)\r
@@ -1108,7 +1109,7 @@ BOOL CProfile::GetEnableCUA(const int nAppID)
 \r
 void CProfile::SetEnableCUA(const int nAppID, const BOOL bEnableCUA)\r
 {\r
-       m_Config.bEnableCUA[nAppID] = bEnableCUA;\r
+       m_Config.bEnableCUA[nAppID] = static_cast<BYTE>(bEnableCUA);\r
 }\r
 \r
 int CProfile::GetKeyboardSpeed()\r
index 147ab27..69b938c 100644 (file)
@@ -12,19 +12,19 @@ struct ICONMSG {
 };\r
 \r
 struct CONFIG {\r
-       BOOL b326Compatible[MAX_APP];\r
+       BYTE b326Compatible[MAX_APP];\r
        TCHAR szWindowText[MAX_APP][WINDOW_TEXT_LENGTH];\r
        TCHAR szFunctionDefinition[MAX_FUNCTION][MAX_DEFINITION];\r
-       int nFunctionID[MAX_APP][MAX_COMMAND_TYPE][MAX_KEY];\r
-       BOOL bEnableCUA[MAX_APP];\r
-       BOOL bUseDialogSetting[MAX_APP];\r
-       BOOL bIgnoreUndefinedC_x[MAX_APP];\r
-       BOOL bIgnoreUndefinedMetaCtrl[MAX_APP];\r
-       int nSettingStyle[MAX_APP];\r
-       int nKillRingMax[MAX_APP];\r
+       BYTE nFunctionID[MAX_APP][MAX_COMMAND_TYPE][MAX_KEY];\r
+       BYTE bEnableCUA[MAX_APP];\r
+       BYTE bUseDialogSetting[MAX_APP];\r
+       BYTE bIgnoreUndefinedC_x[MAX_APP];\r
+       BYTE bIgnoreUndefinedMetaCtrl[MAX_APP];\r
+       BYTE nSettingStyle[MAX_APP];\r
+       BYTE nKillRingMax[MAX_APP];\r
        TCHAR szSpecialApp[MAX_APP][CLASS_NAME_LENGTH];\r
-       int nCommandID[MAX_APP][MAX_COMMAND_TYPE][MAX_KEY];\r
-       BOOL b106Keyboard;\r
+       BYTE nCommandID[MAX_APP][MAX_COMMAND_TYPE][MAX_KEY];\r
+       BYTE b106Keyboard;\r
 };\r
 \r
 enum XKEYMACS_IPC { XKEYMACS_EXIT, XKEYMACS_RELOAD, XKEYMACS_RESET };\r
index 441863d..cb0f25d 100644 (file)
@@ -238,7 +238,7 @@ DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
        BOOL    CXkeymacsDll::m_bHook                   = TRUE;\r
        CList<CClipboardSnap *, CClipboardSnap *> CXkeymacsDll::m_oKillRing;\r
        int             CXkeymacsDll::m_nKillRing = 0;\r
-       int             CXkeymacsDll::m_nOriginal[MAX_COMMAND_TYPE][MAX_KEY] = {'\0'};\r
+       BYTE    CXkeymacsDll::m_nOriginal[MAX_COMMAND_TYPE][MAX_KEY] = {'\0'};\r
        int             CXkeymacsDll::m_nAppID = 0;\r
        int             CXkeymacsDll::m_nAccelerate = 0;\r
        int             CXkeymacsDll::m_nKeyboardSpeed = 31;\r
index d3c4a67..1e98ada 100644 (file)
@@ -139,7 +139,7 @@ private:
        static int CheckOriginal(UINT nType, BYTE bVk);\r
        static void InitKeyboardProc(BOOL bImeComposition);\r
        static int m_nAppID;\r
-       static int m_nOriginal[MAX_COMMAND_TYPE][MAX_KEY];\r
+       static BYTE m_nOriginal[MAX_COMMAND_TYPE][MAX_KEY];\r
        static int m_nKillRing;\r
        static CList<CClipboardSnap *, CClipboardSnap *> m_oKillRing;\r
        static BOOL m_bHook;\r