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/ZipFile_stl.h | 67 +++++++++++++++----------------------------- 1 file changed, 22 insertions(+), 45 deletions(-) (limited to 'zip/ZipArchive/ZipFile_stl.h') diff --git a/zip/ZipArchive/ZipFile_stl.h b/zip/ZipArchive/ZipFile_stl.h index 754a78d..8b1a745 100644 --- a/zip/ZipArchive/ZipFile_stl.h +++ b/zip/ZipArchive/ZipFile_stl.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 //////////////////////////////////////////////////////////////////////////////// #ifndef ZIPARCHIVE_ZIPFILE_DOT_H @@ -23,7 +23,6 @@ #ifndef __GNUC__ #include #else - #include #include #endif @@ -60,58 +59,36 @@ public: operator HANDLE(); enum OpenModes { - modeRead = 0x0001, - modeWrite = 0x0002, - modeReadWrite = modeRead | modeWrite, - shareDenyWrite = 0x0004, - shareDenyRead = 0x0008, - shareDenyNone = 0x0010, - modeCreate = 0x0020, - modeNoTruncate = 0x0040, + modeRead = 0x00000, + modeWrite = 0x00001, + modeReadWrite = 0x00002, + shareExclusive = 0x00010, + shareDenyWrite = 0x00020, + shareDenyRead = 0x00030, + shareDenyNone = 0x00040, + modeCreate = 0x01000, + modeNoTruncate = 0x02000 }; - CZipFile(LPCTSTR lpszFileName, UINT openFlags) - { - m_hFile = -1; - Open(lpszFileName, openFlags, true); - } + CZipFile(); + CZipFile(LPCTSTR lpszFileName, UINT openFlags); void Flush(); ZIP_FILE_USIZE GetLength() const; CZipString GetFilePath() const {return m_szFileName;} - bool IsClosed()const { return m_hFile == -1;} - bool Open(LPCTSTR lpszFileName, UINT openFlags, bool bThrow); - void Close() + bool HasFilePath() const { - if (IsClosed()) - return; - if (_close(m_hFile) != 0) - ThrowError(); - else - { - m_szFileName.Empty(); - m_hFile = -1; - } - } - void Write(const void* lpBuf, UINT nCount) - { - if (_write(m_hFile, lpBuf, nCount) != (int) nCount) - ThrowError(); + return true; } + bool IsClosed()const { return m_hFile == -1;} + bool Open(LPCTSTR lpszFileName, UINT openFlags, bool bThrow); + void Close(); + + void Write(const void* lpBuf, size_t nCount); ZIP_FILE_USIZE GetPosition() const; void SetLength(ZIP_FILE_USIZE uNewLen); - UINT Read(void *lpBuf, UINT nCount) - { - errno = 0; - int ret = _read(m_hFile, lpBuf, nCount); - if (ret < (int) nCount && errno != 0) - ThrowError(); - return ret; - - } - + size_t Read(void *lpBuf, size_t nCount); ZIP_FILE_USIZE Seek(ZIP_FILE_SIZE dOff, int nFrom); - CZipFile (); virtual ~CZipFile (){Close();}; protected: CZipString m_szFileName; -- cgit v1.2.3