Skip to content

Commit

Permalink
qtermwidget: silence false positive cppcheck warning about assert wit…
Browse files Browse the repository at this point in the history
…h side effect
  • Loading branch information
rouault authored and nyalldawson committed Apr 10, 2023
1 parent 20a831f commit 58bdb1b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/plugins/grass/qtermwidget/Screen.cpp
Expand Up @@ -455,6 +455,7 @@ void Screen::updateEffectiveRendition()

void Screen::copyFromHistory(Character* dest, int startLine, int count) const
{
// cppcheck-suppress assertWithSideEffect
Q_ASSERT( startLine >= 0 && count > 0 && startLine + count <= history->getLines() );

for (int line = startLine; line < startLine + count; line++)
Expand Down Expand Up @@ -508,6 +509,7 @@ void Screen::copyFromScreen(Character* dest , int startLine , int count) const
void Screen::getImage( Character* dest, int size, int startLine, int endLine ) const
{
Q_ASSERT( startLine >= 0 );
// cppcheck-suppress assertWithSideEffect
Q_ASSERT( endLine >= startLine && endLine < history->getLines() + lines );

const int mergedLines = endLine - startLine + 1;
Expand Down Expand Up @@ -544,6 +546,7 @@ void Screen::getImage( Character* dest, int size, int startLine, int endLine ) c
QVector<LineProperty> Screen::getLineProperties( int startLine , int endLine ) const
{
Q_ASSERT( startLine >= 0 );
// cppcheck-suppress assertWithSideEffect
Q_ASSERT( endLine >= startLine && endLine < history->getLines() + lines );

const int mergedLines = endLine-startLine+1;
Expand Down Expand Up @@ -1263,6 +1266,7 @@ int Screen::copyLineToStream(int line ,
// safety checks
Q_ASSERT( start >= 0 );
Q_ASSERT( count >= 0 );
// cppcheck-suppress assertWithSideEffect
Q_ASSERT( (start+count) <= history->getLineLen(line) );

history->getCells(line,start,count,characterBuffer);
Expand Down

0 comments on commit 58bdb1b

Please sign in to comment.