summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-05-03 13:21:26 (UTC)
committer mickeyl <mickeyl>2004-05-03 13:21:26 (UTC)
commit9efa98c49988a41de7613f56818f2e31bb24e22b (patch) (side-by-side diff)
tree62e5f95df7302eeef9a03681b708ae80c3d78d55
parent0490226f4ed54fdeef5578255594830659a8d3bd (diff)
downloadopie-9efa98c49988a41de7613f56818f2e31bb24e22b.zip
opie-9efa98c49988a41de7613f56818f2e31bb24e22b.tar.gz
opie-9efa98c49988a41de7613f56818f2e31bb24e22b.tar.bz2
honor limited buffer size, if set
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/wellenreiter/gui/packetview.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/noncore/net/wellenreiter/gui/packetview.cpp b/noncore/net/wellenreiter/gui/packetview.cpp
index f0f16ff..69438fa 100644
--- a/noncore/net/wellenreiter/gui/packetview.cpp
+++ b/noncore/net/wellenreiter/gui/packetview.cpp
@@ -68,27 +68,29 @@ PacketView::PacketView( QWidget * parent, const char * name, WFlags f )
clear();
}
void PacketView::add( const OPacket* p, int size )
{
odebug << "PacketView::add() size = " << size << oendl;
if ( size == -1 ) // unlimited buffer
{
_packets.append( p );
}
else
- // limited buffer, limit = size
- if ( _packets.count() < size )
- {
+ { // limited buffer, limit = size
+ while ( _packets.count() >= size )
+ {
+ _packets.removeFirst();
+ }
_packets.append( p );
}
_number->setMinValue( 1 );
_number->setMaxValue( _packets.count() );
_number->setValue( _packets.count() );
}
void PacketView::showPacket( int number )
{
_list->clear();
_hex->setText("");