return;
}
+ ASSERT (nLength <= INT_MAX); // assert "positive int"
m_nLength = nLength;
m_nMax = ALIGN_BUF_SIZE (m_nLength + 1);
ASSERT (m_nMax < INT_MAX);
nEols = 2;
else if (nLength && IsEol(pszLine[nLength - 1]))
nEols = 1;
+ ASSERT (nEols <= m_nLength);
m_nLength -= nEols;
m_nEolChars = nEols;
}
*/
void LineInfo::Append(LPCTSTR pszChars, size_t nLength)
{
+ ASSERT (nLength <= INT_MAX); // assert "positive int"
size_t nBufNeeded = m_nLength + nLength + 1;
if (nBufNeeded > m_nMax)
{
{
m_nEolChars = 1;
}
+ ASSERT (m_nEolChars <= m_nLength);
m_nLength -= m_nEolChars;
ASSERT (m_nLength + m_nEolChars <= m_nMax);
}
void LineInfo::DeleteEnd(size_t nStartChar)
{
m_nLength = nStartChar;
+ ASSERT (m_nLength <= INT_MAX); // assert "positive int"
if (m_pcLine)
m_pcLine[nStartChar] = 0;
m_nEolChars = 0;
ASSERT (nStartLine >= 0 && nStartLine < (int)m_aLines.size ());
ASSERT (nStartChar >= 0 && nStartChar <= (int)m_aLines[nStartLine].Length());
ASSERT (nEndLine >= 0 && nEndLine < (int)m_aLines.size ());
- ASSERT (nEndChar >= 0 && nEndChar <= (int)m_aLines[nEndLine].Length());
+ ASSERT (nEndChar >= 0 && nEndChar <= (int)m_aLines[nEndLine].FullLength());
ASSERT (nStartLine < nEndLine || nStartLine == nEndLine && nStartChar <= nEndChar);
// some edit functions (delete...) should do nothing when there is no selection.
// assert to be sure to catch these 'do nothing' cases.
ASSERT (m_bUndoGroup);
if (pSource != NULL)
{
- ASSERT (static_cast<size_t>(m_nUndoPosition) == m_aUndoBuf.size());
+ ASSERT (static_cast<size_t>(m_nUndoPosition) <= m_aUndoBuf.size());
if (m_nUndoPosition > 0)
{
pSource->OnEditOperation (m_aUndoBuf[m_nUndoPosition - 1].m_nAction, m_aUndoBuf[m_nUndoPosition - 1].GetText (), m_aUndoBuf[m_nUndoPosition - 1].GetTextLength ());
{
ASSERT (m_bInit); // Text buffer not yet initialized.
// You must call InitNew() or LoadFromFile() first!
- ASSERT (nLine >= 0 && nLine <= static_cast<intptr_t>(m_aLines.size ()));
+ ASSERT (nCount >= 0);
+ ASSERT (nLine >= 0 && (nLine + nCount) <= static_cast<intptr_t>(m_aLines.size ()));
if (nCount == 0)
return true;