From e1c81ae30fedd51c905569e696b1f0f53af3b6db Mon Sep 17 00:00:00 2001 From: Kimmo Varis Date: Thu, 1 Jul 2010 14:54:51 +0000 Subject: [PATCH] Fixing 64-bit build warnings. --- Src/editlib/ccrystaleditview.cpp | 16 ++++++++-------- Src/editlib/ccrystaltextbuffer.cpp | 6 +++--- Src/editlib/ccrystaltextview.cpp | 29 +++++++++++++++-------------- Src/editlib/ccrystaltextview.h | 2 +- Src/editlib/ccrystaltextview2.cpp | 22 +++++++++++----------- 5 files changed, 38 insertions(+), 37 deletions(-) diff --git a/Src/editlib/ccrystaleditview.cpp b/Src/editlib/ccrystaleditview.cpp index 4211840d2..f43c9f46e 100644 --- a/Src/editlib/ccrystaleditview.cpp +++ b/Src/editlib/ccrystaleditview.cpp @@ -495,7 +495,7 @@ OnChar (UINT nChar, UINT nRepCnt, UINT nFlags) ptCursorPos = GetCursorPos (); ASSERT_VALIDTEXTPOS (ptCursorPos); LPCTSTR pszText = m_pTextBuffer->GetDefaultEol(); - int cchText = _tcslen(pszText); + int cchText = (int) _tcslen(pszText); int x, y; m_pTextBuffer->InsertText (this, ptCursorPos.y, ptCursorPos.x, pszText, cchText, y, x, CE_ACTION_TYPING); // [JRT] @@ -521,7 +521,7 @@ OnChar (UINT nChar, UINT nRepCnt, UINT nFlags) if (QueryEditable () && m_pTextBuffer != NULL) { m_pTextBuffer->BeginUndoGroup (m_bMergeUndo); - m_bMergeUndo = true; + m_bMergeUndo = true; CPoint ptSelStart, ptSelEnd; GetSelection (ptSelStart, ptSelEnd); @@ -729,7 +729,7 @@ OnEditTab () for (int L = nStartLine; L <= nEndLine; L++) { int x, y; - m_pTextBuffer->InsertText (this, L, 0, pszText, _tcslen(pszText), y, x, CE_ACTION_INDENT); // [JRT] + m_pTextBuffer->InsertText (this, L, 0, pszText, (int) _tcslen(pszText), y, x, CE_ACTION_INDENT); // [JRT] } m_bHorzScrollBarLocked = FALSE; @@ -796,12 +796,12 @@ OnEditTab () // [JRT]: m_pTextBuffer->DeleteText (this, ptSelStart.y, ptSelStart.x, ptSelEnd.y, ptSelEnd.x, CE_ACTION_TYPING); - m_pTextBuffer->InsertText( this, ptSelStart.y, ptSelStart.x, pszText, _tcslen(pszText), y, x, CE_ACTION_TYPING ); + m_pTextBuffer->InsertText( this, ptSelStart.y, ptSelStart.x, pszText, (int) _tcslen(pszText), y, x, CE_ACTION_TYPING ); } // No selection, add tab else { - m_pTextBuffer->InsertText (this, ptCursorPos.y, ptCursorPos.x, pszText, _tcslen(pszText), y, x, CE_ACTION_TYPING); // [JRT] + m_pTextBuffer->InsertText (this, ptCursorPos.y, ptCursorPos.x, pszText, (int) _tcslen(pszText), y, x, CE_ACTION_TYPING); // [JRT] } ptCursorPos.x = x; @@ -1134,8 +1134,8 @@ DoDropText (COleDataObject * pDataObject, const CPoint & ptClient) return FALSE; } - SIZE_T cbData = ::GlobalSize (hData); - int cchText = cbData / sizeof(TCHAR) - 1; + UINT cbData = (UINT) ::GlobalSize (hData); + UINT cchText = cbData / sizeof(TCHAR) - 1; if (cchText < 0) return FALSE; LPTSTR pszText = (LPTSTR)::GlobalLock (hData); @@ -1577,7 +1577,7 @@ bracetype (TCHAR c) { static LPCTSTR braces = _T("{}()[]<>"); LPCTSTR pos = _tcschr (braces, c); - return pos ? pos - braces + 1 : 0; + return pos ? (int) (pos - braces) + 1 : 0; } int diff --git a/Src/editlib/ccrystaltextbuffer.cpp b/Src/editlib/ccrystaltextbuffer.cpp index 82fa269f9..68d4a62d3 100644 --- a/Src/editlib/ccrystaltextbuffer.cpp +++ b/Src/editlib/ccrystaltextbuffer.cpp @@ -659,7 +659,7 @@ applyEOLMode() { LPCTSTR lpEOLtoApply = GetDefaultEol(); BOOL bChanged = FALSE; - const int size = m_aLines.size(); + const size_t size = m_aLines.size(); for (int i = 0 ; i < size; i++) { // the last real line has no EOL @@ -935,7 +935,7 @@ GetText (int nStartLine, int nStartChar, int nEndLine, int nEndChar, memcpy (pszBuf, startLine.GetLine(nStartChar), sizeof (TCHAR) * nCount); pszBuf += nCount; } - text.ReleaseBuffer (pszBuf - text); + text.ReleaseBuffer ((int) (pszBuf - text)); text.FreeExtra (); } @@ -1834,7 +1834,7 @@ FindPrevBookmarkLine (int nCurrentLine) const // Start from the end of text bWrapIt = FALSE; - nCurrentLine = nSize - 1; + nCurrentLine = (int) (nSize - 1); } return -1; } diff --git a/Src/editlib/ccrystaltextview.cpp b/Src/editlib/ccrystaltextview.cpp index a20ee35c7..82b636a9d 100644 --- a/Src/editlib/ccrystaltextview.cpp +++ b/Src/editlib/ccrystaltextview.cpp @@ -809,7 +809,7 @@ ScrollToLine (int nNewTopLine, BOOL bNoSmoothScroll /*= FALSE*/ , BOOL bTrackScr static void AppendStringAdv(CString & str, int & curpos, LPCTSTR szadd) { str += szadd; - curpos += _tcslen(szadd); + curpos += (int) _tcslen(szadd); } /** Append escaped control char to string str, and advance position curpos */ @@ -1309,7 +1309,7 @@ void CCrystalTextView::InvalidateLineCache( int nLineIndex1, int nLineIndex2 /*= return; if( nLineIndex2 >= m_panSubLines->GetSize() ) - nLineIndex2 = m_panSubLines->GetUpperBound(); + nLineIndex2 = (int) m_panSubLines->GetUpperBound(); for( int i = nLineIndex1; i <= nLineIndex2; i++ ) if( i >= 0 && i < m_panSubLines->GetSize() ) @@ -4068,7 +4068,7 @@ UpdateView (CCrystalTextView * pSource, CUpdateContext * pContext, { ASSERT (nLineIndex != -1); // All text below this line should be reparsed - const int cookiesSize = m_ParseCookies->size(); + const int cookiesSize = (int) m_ParseCookies->size(); if (cookiesSize > 0) { ASSERT (cookiesSize == nLineCount); @@ -4581,7 +4581,7 @@ FindStringHelper (LPCTSTR pszFindWhere, LPCTSTR pszFindWhat, DWORD dwFlags, ASSERT (pszFindWhere != NULL); ASSERT (pszFindWhat != NULL); int nCur = 0; - int nLength = _tcslen (pszFindWhat); + int nLength = (int) _tcslen (pszFindWhat); nLen = nLength; for (;;) { @@ -4589,20 +4589,20 @@ FindStringHelper (LPCTSTR pszFindWhere, LPCTSTR pszFindWhat, DWORD dwFlags, if (pszPos == NULL) return -1; if ((dwFlags & FIND_WHOLE_WORD) == 0) - return nCur + (pszPos - pszFindWhere); + return nCur + (int) (pszPos - pszFindWhere); if (pszPos > pszFindWhere && xisalnum (pszPos[-1])) { - nCur += (pszPos - pszFindWhere + 1); + nCur += (int) (pszPos - pszFindWhere + 1); pszFindWhere = pszPos + 1; continue; } if (xisalnum (pszPos[nLength])) { - nCur += (pszPos - pszFindWhere + 1); + nCur += (int) (pszPos - pszFindWhere + 1); pszFindWhere = pszPos + 1; continue; } - return nCur + (pszPos - pszFindWhere); + return nCur + (int) (pszPos - pszFindWhere); } } ASSERT (FALSE); // Unreachable @@ -4671,7 +4671,8 @@ FindText (LPCTSTR pszText, const CPoint & ptStartPos, DWORD dwFlags, int HowManyStr (LPCTSTR s, LPCTSTR m) { LPCTSTR p = s; - int n = 0, l = _tcslen (m); + int n = 0; + const int l = (int) _tcslen (m); while ((p = _tcsstr (p, m)) != NULL) { n++; @@ -5457,9 +5458,9 @@ OnMatchBrace () LPCTSTR pszOpenComment = m_CurSourceDef->opencomment, pszCloseComment = m_CurSourceDef->closecomment, pszCommentLine = m_CurSourceDef->commentline, pszTest; - int nOpenComment = _tcslen (pszOpenComment), - nCloseComment = _tcslen (pszCloseComment), - nCommentLine = _tcslen (pszCommentLine); + int nOpenComment = (int) _tcslen (pszOpenComment), + nCloseComment = (int) _tcslen (pszCloseComment), + nCommentLine = (int) _tcslen (pszCommentLine); if (nOther & 1) { for (;;) @@ -5501,7 +5502,7 @@ OnMatchBrace () { if (!nCount--) { - ptCursorPos.x = pszEnd - pszText; + ptCursorPos.x = (LONG) (pszEnd - pszText); if (bAfter) ptCursorPos.x++; SetCursorPos (ptCursorPos); @@ -5568,7 +5569,7 @@ OnMatchBrace () { if (!nCount--) { - ptCursorPos.x = pszText - pszBegin; + ptCursorPos.x = (LONG) (pszText - pszBegin); if (bAfter) ptCursorPos.x++; SetCursorPos (ptCursorPos); diff --git a/Src/editlib/ccrystaltextview.h b/Src/editlib/ccrystaltextview.h index 8930664ae..d1cf5baae 100644 --- a/Src/editlib/ccrystaltextview.h +++ b/Src/editlib/ccrystaltextview.h @@ -172,7 +172,7 @@ protected: BOOL m_bPreparingToDrag; BOOL m_bDraggingText; BOOL m_bDragSelection, m_bWordSelection, m_bLineSelection; - UINT m_nDragSelTimer; + UINT_PTR m_nDragSelTimer; CPoint m_ptDrawSelStart, m_ptDrawSelEnd; diff --git a/Src/editlib/ccrystaltextview2.cpp b/Src/editlib/ccrystaltextview2.cpp index 848427a2f..ac070fc11 100644 --- a/Src/editlib/ccrystaltextview2.cpp +++ b/Src/editlib/ccrystaltextview2.cpp @@ -62,7 +62,7 @@ static char THIS_FILE[] = __FILE__; #endif -#define CRYSTAL_TIMER_DRAGSEL 1001 +static const UINT_PTR CRYSTAL_TIMER_DRAGSEL = 1001; static LPTSTR NTAPI EnsureCharNext(LPCTSTR current) { @@ -170,21 +170,21 @@ MoveWordLeft (BOOL bSelect) LPCTSTR pszChars = GetLineChars (m_ptCursorPos.y); int nPos = m_ptCursorPos.x; int nPrevPos; - while (nPos > 0 && xisspace (pszChars[nPrevPos = ::EnsureCharPrev(pszChars, pszChars + nPos) - pszChars])) + while (nPos > 0 && xisspace (pszChars[nPrevPos = (int) (::EnsureCharPrev(pszChars, pszChars + nPos) - pszChars)])) nPos = nPrevPos; if (nPos > 0) { - int nPrevPos = ::CharPrev(pszChars, pszChars + nPos) - pszChars; + int nPrevPos = (int) (::CharPrev(pszChars, pszChars + nPos) - pszChars); nPos = nPrevPos; if (xisalnum (pszChars[nPos])) { - while (nPos > 0 && (xisalnum (pszChars[nPrevPos = ::EnsureCharPrev(pszChars, pszChars + nPos) - pszChars]))) + while (nPos > 0 && (xisalnum (pszChars[nPrevPos = (int) (::EnsureCharPrev(pszChars, pszChars + nPos) - pszChars)]))) nPos = nPrevPos; } else { - while (nPos > 0 && !xisalnum (pszChars[nPrevPos = ::EnsureCharPrev(pszChars, pszChars + nPos) - pszChars]) + while (nPos > 0 && !xisalnum (pszChars[nPrevPos = (int) (::EnsureCharPrev(pszChars, pszChars + nPos) - pszChars)]) && !xisspace (pszChars[nPrevPos])) nPos = nPrevPos; } @@ -229,17 +229,17 @@ MoveWordRight (BOOL bSelect) if (xisalnum (pszChars[nPos])) { while (nPos < nLength && xisalnum (pszChars[nPos])) - nPos = ::EnsureCharNext(pszChars + nPos) - pszChars; + nPos = (int) (::EnsureCharNext(pszChars + nPos) - pszChars); } else { while (nPos < nLength && !xisalnum (pszChars[nPos]) && !xisspace (pszChars[nPos])) - nPos = ::EnsureCharNext(pszChars + nPos) - pszChars; + nPos = (int) (::EnsureCharNext(pszChars + nPos) - pszChars); } while (nPos < nLength && xisspace (pszChars[nPos])) - nPos = ::EnsureCharNext(pszChars + nPos) - pszChars; + nPos = (int) (::EnsureCharNext(pszChars + nPos) - pszChars); m_ptCursorPos.x = nPos; m_nIdealCharPos = CalculateActualOffset (m_ptCursorPos.y, m_ptCursorPos.x); @@ -532,7 +532,7 @@ WordToRight (CPoint pt) { if (!xisalnum (pszChars[pt.x])) break; - pt.x += ::CharNext (&pszChars[pt.x]) - &pszChars[pt.x]; + pt.x += (int) (::CharNext (&pszChars[pt.x]) - &pszChars[pt.x]); } ASSERT_VALIDTEXTPOS (pt); return pt; @@ -546,7 +546,7 @@ WordToLeft (CPoint pt) int nPrevX = pt.x; while (pt.x > 0) { - nPrevX -= &pszChars[pt.x] - ::CharPrev (pszChars, &pszChars[pt.x]); + nPrevX -= (int) (&pszChars[pt.x] - ::CharPrev (pszChars, &pszChars[pt.x])); if (!xisalnum (pszChars[nPrevX])) break; pt.x = nPrevX; @@ -1165,7 +1165,7 @@ GetFromClipboard (CString & text) LPTSTR pszData = (LPTSTR) GlobalLock (hData); if (pszData != NULL) { - SIZE_T cbData = GlobalSize (hData); + UINT cbData = (UINT) GlobalSize (hData); int cchText = cbData / sizeof(TCHAR) - 1; if (cchText >= 0) memcpy(text.GetBufferSetLength(cchText), pszData, cbData); -- 2.11.0