summaryrefslogtreecommitdiff
path: root/buffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'buffer.cpp')
-rw-r--r--buffer.cpp37
1 files changed, 7 insertions, 30 deletions
diff --git a/buffer.cpp b/buffer.cpp
index a21ebb3..e85500d 100644
--- a/buffer.cpp
+++ b/buffer.cpp
@@ -88,43 +88,20 @@ void Buffer::operator=(const Buffer &src)
length_ = 0;
}
-void Buffer::operator=(const seq_nr_t &src)
-{
- if(buf_)
- delete[] buf_;
-
- length_ = sizeof(src);
-
- buf_ = new u_int8_t[length_];
- if( buf_ )
- {
- for( u_int32_t index = 0; index <= length_; index++ )
- buf_[index] = (src>>index) & 0xFF;
- }
- else
- length_ = 0;
-}
-
-void Buffer::operator=(const sender_id_t &src)
+bool Buffer::operator==(const Buffer &cmp) const
{
- if(buf_)
- delete[] buf_;
+ if(length_ != cmp.length_)
+ return false;
- length_ = sizeof(src);
-
- buf_ = new u_int8_t[length_];
+ if(!std::memcmp(buf_, cmp.buf_, length_))
+ return true;
- if( buf_ )
- {
- for( u_int32_t index = 0; index <= length_; index++ )
- buf_[index] = (src>>index) & 0xFF;
- }
- else
- length_ = 0;
+ return false;
}
+
u_int32_t Buffer::resizeFront(u_int32_t new_length)
{
if(length_ == new_length)