summaryrefslogtreecommitdiff
path: root/zip/ZipArchive/ZipAutoBuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'zip/ZipArchive/ZipAutoBuffer.cpp')
-rw-r--r--zip/ZipArchive/ZipAutoBuffer.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/zip/ZipArchive/ZipAutoBuffer.cpp b/zip/ZipArchive/ZipAutoBuffer.cpp
index 651fb15..76f27ac 100644
--- a/zip/ZipArchive/ZipAutoBuffer.cpp
+++ b/zip/ZipArchive/ZipAutoBuffer.cpp
@@ -1,6 +1,6 @@
////////////////////////////////////////////////////////////////////////////////
-// This source file is part of the ZipArchive library source distribution and
-// is Copyrighted 2000 - 2007 by Artpol Software - Tadeusz Dracz
+// This source file is part of the ZipArchive Library Open Source distribution
+// and is Copyrighted 2000 - 2022 by Artpol Software - Tadeusz Dracz
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -9,12 +9,15 @@
//
// For the licensing details refer to the License.txt file.
//
-// Web Site: http://www.artpol-software.com
+// Web Site: https://www.artpol-software.com
////////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ZipAutoBuffer.h"
#include <memory.h>
+#ifdef __ANDROID__
+#include "string.h"
+#endif
CZipAutoBuffer::CZipAutoBuffer()
{
@@ -52,7 +55,7 @@ char* CZipAutoBuffer::Allocate(DWORD iSize, bool bZeroMemory)
else
{
if (bZeroMemory)
- memset(m_pBuffer, 0, iSize); // zerowanie bufora
+ memset(m_pBuffer, 0, iSize);
return m_pBuffer;
}
@@ -60,7 +63,7 @@ char* CZipAutoBuffer::Allocate(DWORD iSize, bool bZeroMemory)
{
m_pBuffer = new char [iSize];
if (bZeroMemory)
- memset(m_pBuffer, 0, iSize); // zerowanie bufora
+ memset(m_pBuffer, 0, iSize);
m_iSize = iSize;
}
else
@@ -78,7 +81,10 @@ CZipAutoBuffer::CZipAutoBuffer(const CZipAutoBuffer& buffer)
if (buffer.m_pBuffer)
{
Allocate(buffer.m_iSize);
- memcpy(m_pBuffer, buffer.m_pBuffer, buffer.m_iSize);
+ if (m_pBuffer)
+ {
+ memcpy(m_pBuffer, buffer.m_pBuffer, buffer.m_iSize);
+ }
}
}
CZipAutoBuffer& CZipAutoBuffer::operator=(const CZipAutoBuffer& buffer)
@@ -89,7 +95,10 @@ CZipAutoBuffer& CZipAutoBuffer::operator=(const CZipAutoBuffer& buffer)
if (buffer.m_pBuffer)
{
Allocate(buffer.m_iSize);
- memcpy(m_pBuffer, buffer.m_pBuffer, buffer.m_iSize);
+ if (m_pBuffer)
+ {
+ memcpy(m_pBuffer, buffer.m_pBuffer, buffer.m_iSize);
+ }
}
return *this;
}