OSDN Git Service

Fixing 64-bit build warnings.
authorKimmo Varis <kimmov@gmail.com>
Thu, 1 Jul 2010 14:54:51 +0000 (14:54 +0000)
committerKimmo Varis <kimmov@gmail.com>
Thu, 1 Jul 2010 14:54:51 +0000 (14:54 +0000)
Src/editlib/ccrystaleditview.cpp
Src/editlib/ccrystaltextbuffer.cpp
Src/editlib/ccrystaltextview.cpp
Src/editlib/ccrystaltextview.h
Src/editlib/ccrystaltextview2.cpp

index 4211840..f43c9f4 100644 (file)
@@ -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
index 82fa269..68d4a62 100644 (file)
@@ -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;
 }
index a20ee35..82b636a 100644 (file)
@@ -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);
index 8930664..d1cf5ba 100644 (file)
@@ -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;
 
index 848427a..ac070fc 100644 (file)
@@ -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);