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/ZipExtraData.h | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'zip/ZipArchive/ZipExtraData.h') diff --git a/zip/ZipArchive/ZipExtraData.h b/zip/ZipArchive/ZipExtraData.h index cb9c256..b1933bc 100644 --- a/zip/ZipArchive/ZipExtraData.h +++ b/zip/ZipArchive/ZipExtraData.h @@ -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,7 +9,7 @@ // // For the licensing details refer to the License.txt file. // -// Web Site: http://www.artpol-software.com +// Web Site: https://www.artpol-software.com //////////////////////////////////////////////////////////////////////////////// /** @@ -29,6 +29,9 @@ #include "ZipAutoBuffer.h" #include "ZipExtraField.h" #include "memory.h" +#ifdef __ANDROID__ +#include "string.h" +#endif /** Represents a single data record in an extra field. @@ -46,11 +49,21 @@ public: */ CZipAutoBuffer m_data; + /** + If \c true, the size of the extra data record is read from the archive and written to it. + This is default behavior consistent with the common ZIP format. + If \c false, the size is not read or written. + You should change this value only when you need special handling. + */ + bool m_bHasSize; + CZipExtraData() { m_uHeaderID = 0; + m_bHasSize = true; } +#pragma warning(suppress: 26495) CZipExtraData(const CZipExtraData& extra) { *this = extra; @@ -65,6 +78,7 @@ public: CZipExtraData(WORD uHeaderID) { m_uHeaderID = uHeaderID; + m_bHasSize = true; } CZipExtraData& operator=(const CZipExtraData& extra) @@ -72,6 +86,7 @@ public: m_uHeaderID = extra.m_uHeaderID; DWORD uSize = extra.m_data.GetSize(); m_data.Allocate(uSize); + m_bHasSize = extra.m_bHasSize; if (uSize > 0) memcpy(m_data, extra.m_data, uSize); return *this; @@ -103,18 +118,18 @@ public: } /** - Gets the total size, the extra data will occupy in the archive. + Returns the total size the extra data will occupy in the archive. \return The size in bytes. */ int GetTotalSize() const { - return 4 + m_data.GetSize(); + return (m_bHasSize ? 4 : 2) + m_data.GetSize(); } /** - Gets the data ID. + Returns the data ID. \return The data ID. @@ -151,7 +166,7 @@ protected: */ WORD Write(char* buffer)const; -private: +private: WORD m_uHeaderID; }; -- cgit v1.2.3