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/ZipCompatibility.h | 133 +++++++++++++++++++++++++++++--------- 1 file changed, 104 insertions(+), 29 deletions(-) (limited to 'zip/ZipArchive/ZipCompatibility.h') diff --git a/zip/ZipArchive/ZipCompatibility.h b/zip/ZipArchive/ZipCompatibility.h index 38c00fa..71fd98b 100644 --- a/zip/ZipArchive/ZipCompatibility.h +++ b/zip/ZipArchive/ZipCompatibility.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 //////////////////////////////////////////////////////////////////////////////// @@ -30,7 +30,7 @@ class CZipAutoBuffer; class CZipFileHeader; #include "ZipString.h" - +#include "ZipPlatform.h" /** Includes functions that provide support for the proper conversion of attributes and filenames between different system platforms. @@ -49,19 +49,44 @@ namespace ZipCompatibility */ enum ZipPlatforms { - zcDosFat, ///< MS-DOS and OS/2 (FAT / VFAT / FAT32 file systems) - zcAmiga, ///< Amiga - zcVaxVms, ///< VAX/VMS - zcUnix, ///< Unix / Linux - zcVmCms, ///< VM/CMS - zcAtari, ///< Atari ST - zcOs2Hpfs, ///< OS/2 H.P.F.S. - zcMacintosh, ///< Macintosh - zcZsystem, ///< Z-System - zcCpm, ///< CP/M - zcNtfs ///< Windows NTFS + zcDosFat, ///< MS-DOS and OS/2 (FAT / VFAT / FAT32 file systems) + zcAmiga, ///< Amiga + zcVaxVms, ///< VAX/VMS + zcUnix, ///< Unix / Linux + zcVmCms, ///< VM/CMS + zcAtari, ///< Atari ST + zcOs2Hpfs, ///< OS/2 H.P.F.S. + zcMacintosh, ///< Macintosh + zcZsystem, ///< Z-System + zcCpm, ///< CP/M + zcTops20, ///< TOPS-20 (value of 10 used by PKZIP for NTFS) + zcNtfs, ///< Windows NTFS (value of 11 used for NTFS by WinZip and WinRar) + zcQDos, ///< SMS/QDOS + zcAcorn, ///< Acorn RISC OS + ZcMvs, ///< MVS + zcVfat, ///< Win32 VFAT + zcAtheOS, ///< AtheOS + zcBeOS, ///< BeOS + zcTandem, ///< Tandem NSK + zcTheos, ///< Theos + zcMacDarwin, ///< OS X (Darwin) + zcLast ///< For the internal use + }; + + /** + Platform independent attributes. + */ + enum InternalFileAttributes + { + attROnly = 0x01, ///< Read-only attribute. + attHidd = 0x02, ///< Hidden attribute. + attSys = 0x04, ///< System attribute. + attDir = 0x10, ///< Directory attribute. + attArch = 0x20 ///< Archived attribute. }; + ZIP_API DWORD GetAsInternalAttributes(DWORD uAttr, int iFromSystem); + /** Checks whether the system with the given code is supported by the ZipArchive Library. @@ -71,7 +96,7 @@ namespace ZipCompatibility \return \c true, if supported; \c false otherwise. */ - bool IsPlatformSupported(int iCode); + ZIP_API bool IsPlatformSupported(int iCode); /** Converts the system attributes between different system platforms. @@ -88,13 +113,11 @@ namespace ZipCompatibility \return The converted attributes. - \note - Throws exceptions. - + \see ZipPlatforms */ - DWORD ConvertToSystem(DWORD uAttr, int iFromSystem, int iToSystem); + ZIP_API DWORD ConvertToSystem(DWORD uAttr, int iFromSystem, int iToSystem); /** Converts the string stored in \a buffer using the given code page. @@ -107,11 +130,8 @@ namespace ZipCompatibility \param uCodePage The code page used in conversion. - - \see - 0610051525 */ - void ConvertBufferToString(CZipString& szString, const CZipAutoBuffer& buffer, UINT uCodePage); + ZIP_API void ConvertBufferToString(CZipString& szString, const CZipAutoBuffer& buffer, UINT uCodePage); /** Converts the \a lpszString using the given code page. @@ -124,11 +144,8 @@ namespace ZipCompatibility \param uCodePage The code page used in conversion. - - \see - 0610051525 */ - void ConvertStringToBuffer(LPCTSTR lpszString, CZipAutoBuffer& buffer, UINT uCodePage); + ZIP_API void ConvertStringToBuffer(LPCTSTR lpszString, CZipAutoBuffer& buffer, UINT uCodePage); /** Changes the path separators from slash to backslash or vice-versa in \a szFileName. @@ -139,7 +156,65 @@ namespace ZipCompatibility \param bReplaceSlash If \c true, changes slash to backslash. If \c false, changes backslash to slash. */ - void SlashBackslashChg(CZipString& szFileName, bool bReplaceSlash); + ZIP_API void SlashBackslashChg(CZipString& szFileName, bool bReplaceSlash); + + /** + Normalizes path separators to the default character used by the current platform. + + \param szFileName + The filename to have the path separators normalized. + */ + ZIP_API void NormalizePathSeparators(CZipString& szFileName); + + /** + Returns the default filename code page for the given platform. + + \param iPlatform + One of the ZipCompatibility::ZipPlatforms values. + + \return + The default filename code page. + */ + ZIP_API UINT GetDefaultNameCodePage(int iPlatform); + + + /** + Returns the default filename code page for the current platform. + + \return + The default filename code page. + */ + ZIP_API UINT GetDefaultNameCodePage(); + + /** + Returns the default comment code page. + + \param iPlatform + One of the ZipCompatibility::ZipPlatforms values. + + \return + The default comment code page. + */ + ZIP_API UINT GetDefaultCommentCodePage(int iPlatform); + + /** + Returns the default password code page. + + \param iPlatform + One of the ZipCompatibility::ZipPlatforms values. + + \return + The default password code page. + */ + ZIP_API UINT GetDefaultPasswordCodePage(int iPlatform); + + /** + Returns the default comment code page for the current platform. + + \return + The default comment code page. + */ + ZIP_API UINT GetDefaultCommentCodePage(); }; #endif // !defined(ZIPARCHIVE_ZIPCOMPATIBILITY_DOT_H) -- cgit v1.2.3