From 4dacedd9ccdbdc6a6e62d9fb86e9b2ea903a3629 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Thu, 15 Sep 2016 10:04:05 +0200 Subject: Windows: Replace XZip/XUnzip library with zlib and libzip and include the sources of these library into VeraCrypt source tree. --- src/Common/BootEncryption.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/Common/BootEncryption.h') diff --git a/src/Common/BootEncryption.h b/src/Common/BootEncryption.h index c8c9e29f..06da2bba 100644 --- a/src/Common/BootEncryption.h +++ b/src/Common/BootEncryption.h @@ -82,6 +82,19 @@ namespace VeraCrypt ~Buffer () { delete[] DataPtr; } byte *Ptr () const { return DataPtr; } size_t Size () const { return DataSize; } + void Resize (size_t newSize) + { + if (newSize > DataSize) + { + byte *tmp = new byte[newSize]; + if (!tmp) + throw bad_alloc(); + memcpy (tmp, DataPtr, DataSize); + delete [] DataPtr; + DataPtr = tmp; + } + DataSize = newSize; + } protected: byte *DataPtr; -- cgit v1.2.3