From 02d6107c97b48888362e7c6a70dcac323c89d741 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Sun, 17 Dec 2023 21:23:58 +0100 Subject: ZipArchive: Update to the 4.6.9 release --- zip/ZipArchive/ZipAutoBuffer.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'zip/ZipArchive/ZipAutoBuffer.cpp') 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 +#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; } -- cgit v1.2.3