From b68ef7c49e6abc9b9ff83f5c5b020beeb9934dea Mon Sep 17 00:00:00 2001 From: Takashi Sawanaka Date: Fri, 5 May 2017 11:40:54 +0900 Subject: [PATCH] Cppcheck: The scope of the variable '...' can be reduced. --- Externals/crystaledit/editlib/ccrystaleditview.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Externals/crystaledit/editlib/ccrystaleditview.cpp b/Externals/crystaledit/editlib/ccrystaleditview.cpp index e702ae654..9edfc8789 100644 --- a/Externals/crystaledit/editlib/ccrystaleditview.cpp +++ b/Externals/crystaledit/editlib/ccrystaleditview.cpp @@ -545,9 +545,9 @@ Paste () } ASSERT_VALIDTEXTPOS (ptCursorPos); - int x, y; if (!bColumnSelection) { + int x, y; m_pTextBuffer->InsertText (this, ptCursorPos.y, ptCursorPos.x, text, text.GetLength(), y, x, CE_ACTION_PASTE); // [JRT] ptCursorPos.x = x; ptCursorPos.y = y; @@ -1942,9 +1942,9 @@ OnEditOperation (int nAction, LPCTSTR pszText, int cchText) else { // Insert part of the previos line - TCHAR *pszInsertStr; if ((GetFlags () & (SRCOPT_BRACEGNU|SRCOPT_BRACEANSI)) && isopenbrace (pszLineChars[nLength - 1])) { + TCHAR *pszInsertStr; if (m_pTextBuffer->GetInsertTabs()) { pszInsertStr = (TCHAR *) _alloca (sizeof (TCHAR) * 2); @@ -2644,13 +2644,12 @@ void CCrystalEditView::OnEditGotoLastChange() int CCrystalEditView::SpellGetLine (struct SpellData_t *pdata) { - int nCount; CCrystalEditView *pView = (CCrystalEditView*) pdata->pUserData; static TCHAR szBuffer[4096]; if (pdata->nRow < pView->GetLineCount ()) { - nCount = pView->GetLineLength (pdata->nRow) + 1; + int nCount = pView->GetLineLength (pdata->nRow) + 1; /*if (pdata->pszBuffer) free (pdata->pszBuffer); pdata->pszBuffer = (LPTSTR) malloc (nCount + 2);*/ @@ -2674,7 +2673,6 @@ int CCrystalEditView::SpellNotify (int nEvent, struct SpellData_t *pdata) { CCrystalEditView *pView = (CCrystalEditView*) pdata->pUserData; CPoint ptStartPos, ptEndPos; - int x, y; switch (nEvent) { @@ -2701,6 +2699,7 @@ int CCrystalEditView::SpellNotify (int nEvent, struct SpellData_t *pdata) case SN_REPLACED: if (pView->IsSelection ()) { + int x, y; pView->GetSelection (ptStartPos, ptEndPos); pView->m_pTextBuffer->DeleteText (pView, ptStartPos.y, ptStartPos.x, ptEndPos.y, ptEndPos.x, CE_ACTION_SPELL); pView->m_pTextBuffer->InsertText (pView, ptStartPos.y, ptStartPos.x, pdata->pszWord, _tcslen(pdata->pszWord), y, x, CE_ACTION_SPELL); -- 2.11.0