aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2016-02-14 08:23:43 -0800
committerGravatar Hoa V. DINH <dinh.viet.hoa@gmail.com>2016-02-14 08:34:38 -0800
commit62f5fd44bee8ee3034e23a4ce1c1ffc98b7db737 (patch)
tree4aa2cc321fd8ea32984fb35448c3f98859e7d5a7
parentf1b7cd8840f6ceb2e074af3eec77d413beb6e2ec (diff)
Added method to increase capacity
-rw-r--r--src/core/basetypes/MCData.cpp5
-rw-r--r--src/core/basetypes/MCData.h2
2 files changed, 7 insertions, 0 deletions
diff --git a/src/core/basetypes/MCData.cpp b/src/core/basetypes/MCData.cpp
index 24463a4f..796f580e 100644
--- a/src/core/basetypes/MCData.cpp
+++ b/src/core/basetypes/MCData.cpp
@@ -146,6 +146,11 @@ unsigned int Data::length()
return mLength;
}
+void Data::increaseCapacity(unsigned int length)
+{
+ allocate(mLength + length);
+}
+
void Data::appendData(Data * otherData)
{
appendBytes(otherData->bytes(), otherData->length());
diff --git a/src/core/basetypes/MCData.h b/src/core/basetypes/MCData.h
index 5bda3f6e..11c0d6c2 100644
--- a/src/core/basetypes/MCData.h
+++ b/src/core/basetypes/MCData.h
@@ -33,6 +33,8 @@ namespace mailcore {
virtual char * bytes();
virtual unsigned int length();
+
+ virtual void increaseCapacity(unsigned int length);
virtual void appendData(Data * otherData);
virtual void appendBytes(const char * bytes, unsigned int length);