From a87224668bb8757559d97a033ece02cf8419abf6 Mon Sep 17 00:00:00 2001 From: Kazuhiro Fujieda Date: Fri, 24 Jun 2011 15:23:44 +0900 Subject: [PATCH] Declare index variables in for-loops outside the loops as needed. --- xkeymacs/profile.cpp | 9 ++++++--- xkeymacs/xkeymacs-vc10.vcxproj | 1 - xkeymacsdll/ClipboardFormatSnap.cpp | 10 ++++++---- xkeymacsdll/ClipboardSnap.cpp | 3 ++- xkeymacsdll/xkeymacsdll-vc10.vcxproj | 1 - xkeymacsdll/xkeymacsdll.cpp | 6 ++++-- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/xkeymacs/profile.cpp b/xkeymacs/profile.cpp index 780f12a..fc8d930 100644 --- a/xkeymacs/profile.cpp +++ b/xkeymacs/profile.cpp @@ -420,7 +420,8 @@ BOOL CALLBACK CProfile::EnumWindowsProc(const HWND hWnd, const LPARAM lParam) // Get Process Name DWORD dwProcessId = 0; GetWindowThreadProcessId(hWnd, &dwProcessId); - for (DWORD i = 0; i < CProfile::m_dwTasks; ++i) { + DWORD i; + for (i = 0; i < CProfile::m_dwTasks; ++i) { if (pTask[i].dwProcessId == dwProcessId) { // Get Application Name @@ -818,7 +819,8 @@ void CProfile::SaveCommand(const CString szApplicationName, const int nCommandID void CProfile::AddKeyBind2C_(const CString szApplicationName, const BYTE bVk) { - for (int nCommandID = 0; nCommandID < MAX_COMMAND; ++nCommandID) { + int nCommandID; + for (nCommandID = 0; nCommandID < MAX_COMMAND; ++nCommandID) { if (Commands[nCommandID].fCommand == CCommands::C_) { break; } @@ -955,7 +957,8 @@ void CProfile::InitDllData() void CProfile::ClearData(const CString szCurrentApplication) { - for (int nApplicationID = 0; nApplicationID < MAX_APP; ++nApplicationID) { + int nApplicationID; + for (nApplicationID = 0; nApplicationID < MAX_APP; ++nApplicationID) { if (m_Data[nApplicationID].GetApplicationName() == szCurrentApplication) { break; } diff --git a/xkeymacs/xkeymacs-vc10.vcxproj b/xkeymacs/xkeymacs-vc10.vcxproj index fc5486c..215c94d 100644 --- a/xkeymacs/xkeymacs-vc10.vcxproj +++ b/xkeymacs/xkeymacs-vc10.vcxproj @@ -137,7 +137,6 @@ Level4 ProgramDatabase C:\WinDDK\7600.16385.1\inc\mfc42 - false MaxSpeed true false diff --git a/xkeymacsdll/ClipboardFormatSnap.cpp b/xkeymacsdll/ClipboardFormatSnap.cpp index b3b71ba..6d63307 100644 --- a/xkeymacsdll/ClipboardFormatSnap.cpp +++ b/xkeymacsdll/ClipboardFormatSnap.cpp @@ -421,8 +421,8 @@ const int CClipboardFormatSnap::GetTextLength( const int nSizeOfNullTerminator ) const int CClipboardFormatSnap::GetRTFBodyHead() const { int nBra = 0; - - for( int i = 0; i < m_oData.GetSize(); ++i ) + int i; + for( i = 0; i < m_oData.GetSize(); ++i ) { BOOL bBody = FALSE; @@ -610,7 +610,8 @@ void CClipboardFormatSnap::Add( const char *const pAddedString, const BOOL bTop, if( bTop ) { - for( int i = nOffset + nSizeOfNullTerminator - 1; 0 <= i ; --i ) + int i; + for( i = nOffset + nSizeOfNullTerminator - 1; 0 <= i ; --i ) { m_oData[ nSizeOfNullTerminator * strlen(pAddedString) + i ] = m_oData[ i ]; } @@ -624,7 +625,8 @@ void CClipboardFormatSnap::Add( const char *const pAddedString, const BOOL bTop, } else { - for( unsigned int i = 0; i < strlen( pAddedString ); ++i ) + unsigned int i; + for( i = 0; i < strlen( pAddedString ); ++i ) { for( int j = 0; j < nSizeOfNullTerminator; ++j ) { diff --git a/xkeymacsdll/ClipboardSnap.cpp b/xkeymacsdll/ClipboardSnap.cpp index b0ef73f..889c1e3 100644 --- a/xkeymacsdll/ClipboardSnap.cpp +++ b/xkeymacsdll/ClipboardSnap.cpp @@ -125,7 +125,8 @@ const CClipboardSnap& CClipboardSnap::operator+=( const CClipboardSnap& rhs ) { if( rhs.m_oFormatSnaps[ nRHS ]->IsMergeableFormat() ) { - for( int i = 0; i < nMergeableClipboardFormatNumber; ++i ) + int i; + for( i = 0; i < nMergeableClipboardFormatNumber; ++i ) { if( ( pMergeableClipboardFormatPosition + i )->m_nLHS < 0 ) continue; if( rhs.m_oFormatSnaps[ nRHS ]->IsSameFormat( lhs.m_oFormatSnaps[ ( pMergeableClipboardFormatPosition + i )->m_nLHS ] ) ) break; diff --git a/xkeymacsdll/xkeymacsdll-vc10.vcxproj b/xkeymacsdll/xkeymacsdll-vc10.vcxproj index b92c224..0804ce5 100644 --- a/xkeymacsdll/xkeymacsdll-vc10.vcxproj +++ b/xkeymacsdll/xkeymacsdll-vc10.vcxproj @@ -141,7 +141,6 @@ Level4 ProgramDatabase C:\WinDDK\7600.16385.1\inc\mfc42 - false MaxSpeed false true diff --git a/xkeymacsdll/xkeymacsdll.cpp b/xkeymacsdll/xkeymacsdll.cpp index b320d74..25cae77 100644 --- a/xkeymacsdll/xkeymacsdll.cpp +++ b/xkeymacsdll/xkeymacsdll.cpp @@ -917,7 +917,8 @@ LRESULT CALLBACK CXkeymacsDll::KeyboardProc(int nCode, WPARAM wParam, LPARAM lPa Kdu(nKey); goto HOOK; } else { - for (int i = 0; i < MAX_KEY; ++i) { + int i; + for (i = 0; i < MAX_KEY; ++i) { if (nOneShotModifier[i] == nKey) { break; } @@ -1155,7 +1156,8 @@ void CXkeymacsDll::AddKillRing(BOOL bNewData) if (m_oKillRing.IsEmpty()) { m_oKillRing.AddHead(pSnap); } else { - for (CClipboardSnap *pParent = m_oKillRing.GetHead(); pParent->GetNext(); pParent = pParent->GetNext()) { + CClipboardSnap *pParent; + for (pParent = m_oKillRing.GetHead(); pParent->GetNext(); pParent = pParent->GetNext()) { ; } pParent->SetNext(pSnap); -- 2.11.0