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 committed May 29, 2020
1 parent 439d5f5 commit 22c89b7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/plugins/grass/qtermwidget/Screen.cpp
Expand Up @@ -403,6 +403,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 @@ -456,6 +457,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 @@ -492,6 +494,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 @@ -1204,6 +1207,7 @@ int Screen::copyLineToStream(int line ,
// safety checks
assert( start >= 0 );
assert( count >= 0 );
// cppcheck-suppress assertWithSideEffect
assert( (start+count) <= history->getLineLen(line) );

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

0 comments on commit 22c89b7

Please sign in to comment.