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]
if (QueryEditable () && m_pTextBuffer != NULL)
{
m_pTextBuffer->BeginUndoGroup (m_bMergeUndo);
- m_bMergeUndo = true;
+ m_bMergeUndo = true;
CPoint ptSelStart, ptSelEnd;
GetSelection (ptSelStart, ptSelEnd);
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;
// [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;
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);
{
static LPCTSTR braces = _T("{}()[]<>");
LPCTSTR pos = _tcschr (braces, c);
- return pos ? pos - braces + 1 : 0;
+ return pos ? (int) (pos - braces) + 1 : 0;
}
int
{
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
memcpy (pszBuf, startLine.GetLine(nStartChar), sizeof (TCHAR) * nCount);
pszBuf += nCount;
}
- text.ReleaseBuffer (pszBuf - text);
+ text.ReleaseBuffer ((int) (pszBuf - text));
text.FreeExtra ();
}
// Start from the end of text
bWrapIt = FALSE;
- nCurrentLine = nSize - 1;
+ nCurrentLine = (int) (nSize - 1);
}
return -1;
}
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 */
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() )
{
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);
ASSERT (pszFindWhere != NULL);
ASSERT (pszFindWhat != NULL);
int nCur = 0;
- int nLength = _tcslen (pszFindWhat);
+ int nLength = (int) _tcslen (pszFindWhat);
nLen = nLength;
for (;;)
{
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
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++;
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 (;;)
{
if (!nCount--)
{
- ptCursorPos.x = pszEnd - pszText;
+ ptCursorPos.x = (LONG) (pszEnd - pszText);
if (bAfter)
ptCursorPos.x++;
SetCursorPos (ptCursorPos);
{
if (!nCount--)
{
- ptCursorPos.x = pszText - pszBegin;
+ ptCursorPos.x = (LONG) (pszText - pszBegin);
if (bAfter)
ptCursorPos.x++;
SetCursorPos (ptCursorPos);
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;
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)
{
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;
}
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);
{
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;
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;
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);