summaryrefslogtreecommitdiff
path: root/src/packet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/packet.cpp')
-rw-r--r--src/packet.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/packet.cpp b/src/packet.cpp
index a7cd00cb..9ab27d84 100644
--- a/src/packet.cpp
+++ b/src/packet.cpp
@@ -23,6 +23,7 @@
#include "packet.h"
#include <string.h>
+#include <cstdlib>
Packet::Packet(const char *data, int length):
length(length)
@@ -30,6 +31,7 @@ Packet::Packet(const char *data, int length):
// Create a copy of the data
this->data = new char[length];
memcpy(this->data, data, length);
+ size = length;
}
Packet::~Packet()
@@ -37,3 +39,9 @@ Packet::~Packet()
// Clean up the data
delete[] data;
}
+
+void Packet::expand(unsigned int bytes)
+{
+ realloc(data, length + bytes);
+ size += bytes;
+}