diff --git a/stepmania/src/smpackage/ZipArchive/ChangeLog.txt b/stepmania/src/smpackage/ZipArchive/ChangeLog.txt
index bd4c261fa6..9f4d092f99 100644
--- a/stepmania/src/smpackage/ZipArchive/ChangeLog.txt
+++ b/stepmania/src/smpackage/ZipArchive/ChangeLog.txt
@@ -1,16 +1,83 @@
/** \page pageHist Revision history
- ver 2.2b (01-2002)
+ ver 2.3.4 (06-2003)
+
+ Bug fixed:
+
+ - problems with extracting some archives (very rare) (thanks to Ben Jos Walbeehm for the fix)
+ - problems with extracting some archives created under Linux (thanks to Jürgen Marquardt for reporting)
+ - small compilation errors under MSVC++ .NET (thanks to Darren Whobrey for the fixes)
+ - setting password in zippie (thanks to Amnon David for the fix)
+
+ Changes:
+
+ - CZipArchive::TestFile throws an exception now if CZipArchive::CloseFile returned -1. It makes it work as described in the documentation that an exception is thrown when the file is corrupted (thanks to Silvio Scarpati for pointing this out).
+ - it is now possible to add an already opened file to an archive (thanks to Kristjan Bjarnason for the change)
+
+ ver 2.3.3 (01-2003)
+
+ Features added:
+
+ - CZipArchive::m_bRemoveDriveLetter option added
Bugs fixed:
+
+ - not extracting files from the last volume when opening an existing archive created in TDSpan mode, where the last volume filename has other extension than ".zip"
+ - added PKZIP_BUG_WORKAROUND definition to the zlib.h file distributed with ZipArchive library as well as to ZipArchive project files (in case the zlib library is replaced with a new version).
+ It deals with pkzip bug existing in some archives (thanks to Ben Jos Walbeehm for reporting).
+
+ ver 2.3.2 (08-2002)
+
+ Bug fixed:
+
+ - problem with creating disk spanning archives in the STL version of the library (thanks to Luiz Rafael Culik for reporting)
+
+ ver 2.3.1 (05-2002)
+
+ Bug fixed:
+
+ - using CZipMemFile::CZipMemFile(BYTE* , UINT , long ) constructor could cause memory errors (thanks to Laurent Doré)
+
+ ver 2.3 (04-2002) (includes changes and fixes from 2.2a to 2.2c)
+
+ Features added:
+
+ - Visual Studio .NET compatibility
+ - methods CZipArchive::GetFromArchive added, which allow copying files from another archive without decompressing them
+ - many times requested replacing of files in the archive feature; it works with methods CZipArchive::GetFromArchive and a new
+ CZipArchive::AddNewFile(CZipAddNewFileInfo& ) which was introduced due to increasing parameters count
+ - added method CZipArchive::RenameFile which renames a file in the archive maintaining its physical position inside the archive
+ - projects and necessary changes for compiling ZipArchive as a DLL version (courtesy of Jonathan Reis) - see \ref subsDLL and \ref subDLLnotes
+
( they are not embedded into existing ones, but made separated, since the DLL version needs separated project for zlib.dll and for the static version,
+ zlib library is already included in the projects to minimize linking problems with applications)
+ - added CZipArchive::WillBeDuplicated which lets you check quickly if the given filename would duplicate an existing one in the archive
+ - CZipArchive::GetCount has now an additional parameter and can return the number of files in the archive not counting the directories
+ - CZipArchive::Close has been given also an additional parameter (\e bUpdateTimeStamp) and can set the modification time of the zip archive to the modification time of the newest file inside the archive
+ - method CZipArchive::GetIndexes added
+ - ZipArc application updated to support renaming, replacing (as well as updating files in the archive) and getting compressed files from another archive
+
+ Changes:
+ - zlib library updated to version 1.1.4 that fixes the security vulnerability in version 1.1.3
+ as described in
+ \htmlonly
+ http://www.zlib.org/advisory-2002-03-11.txt
+ \endhtmlonly
+ - if the file inside the archive has the wrong date/time stamp set, then the extracted file is given the current time instead of reporting an error
+ - a little change in CZipArchive::PredictFileNameInZip : parameter \e bAnsiOem changed to \e bExactly (apart from the name, the meaning has also been changed)
+ - removed parameter bFileNameOnly from CZipArchive::DeleteFiles(const CZipStringArray &);
+
+ Bugs fixed:
+ - eliminated possible errors when using CZipArchive::zipsmCheckForEff with disk-spanning mode
+ - reading some files created with other archivers failed occasionally in CZipFileHeader::ReadLocal (thanks to Christian von Seydlitz)
- while a file recompression (smartness level included CZipArchive::zipsmCheckForEff) if the
AutoFlush feature was enabled, there were redundant bytes added to the archive (thanks to Roman Scherzer)
-
- ver 2.2a (11-2001)
-
- Bugs fixed:
- aborting extraction of multi-disk archive caused errors (thanks to Sabina Terenzi)
+ - some GUI fixes in ZipArc
+ Known issues:
+ - under Windows XP, in TD disk spanning mode, when the central directory is not entirely
+ written on the last volume (but divided between volumes), \e SHGetFileInfo hangs up (it is used i.e. by \e CFileDialog::DoModal) - Windows probably tries to analize
+ zip structure, but fails becuase it is an additional feature of ZipArchive library to create multi volume archives on non-removable data storage
ver 2.2 (10-2001) Time for global changes
@@ -214,10 +281,9 @@
- Changed names for several classes.
ver 1.3.1 (11-2000)
- - Added support for password encryption and decryption.
- The encryption used in PKZIP was generously supplied by Roger
- Schlafly.
+
- Testing the archive made easier
+ - Added support for password encryption and decryption. The encryption used in PKZIP was generously supplied by Roger Schlafly.
- Unicode support added
ver 1.2.2 (08-2000)
@@ -235,7 +301,7 @@
- one class for zip and unzip functions
- fast adding, deleting and extracting files with a single function call
- ver 1.1.2 (03-2001)
+ ver 1.1.2 (03-2000)
- international characters in filenames inside archive are now
converted in a compatible way with other archiving programs (they are stored
converted to OEM inside archive).
diff --git a/stepmania/src/smpackage/ZipArchive/CodeProject.html b/stepmania/src/smpackage/ZipArchive/CodeProject.html
deleted file mode 100644
index 82a927b70b..0000000000
--- a/stepmania/src/smpackage/ZipArchive/CodeProject.html
+++ /dev/null
@@ -1,380 +0,0 @@
-
-
-
-
-The Code Project
-
-
-
-
-
-
-
-
-Title: Zip and Unzip in the MFC way
-Author: Tadeusz Dracz
-Email: tdracz@artpol.com.pl
-Environment: VC++ 6.0, MFC, Windows 95/98/NT/2000/Me
-Keywords: Zip, Unzip, MFC
-Level: Intermediate
-Description: The library to create, modify and extract zip archives
-Section Miscellaneous
-SubSection General
-
-
-
-
-
-
- - Download source - 110 Kb
- - Download demo project - 40 Kb
-Overview
-This library allows creating, modifying and extracting zip archives in the
-compatible way with PKZIP (2.5 and higher) and WinZip. Supported are all
-possible operations on the zip archive: creating, extracting, adding, deleting
-files from the archive, modifications of the existing archive. There is also the
-support for creating and extracting multiple disk archives (on non-removable
-devices as well) and for password encryption and decryption. This module uses
-compression and decompression functions from zlib library by Jean-loup Gailly
-and Mark Adler.
-How to integrate with the project
-Zip is a static library and statically links to compiled zlib.lib (version
-1.13 nowadays). The zlib library can be replaced with a newer version providing
-you also replace the files: "zlib.h" and "zconf.h" in the
-Zip project. The Zip library uses MFC in a shared library as a Release and Debug
-Configuration. Your project must use MFC in the same way in the appropriate
-project configuration. You may need to adapt this to your needs. To add Zip
-library functionality to your project you need to link the library to the
-project. You can do this in at least two ways (in both cases you need to include
-ZipArchive.h header in your sources like this: #include "ZipArchive.h"):
-Method 1
-Add "..\Zip\debug(release)\Zip.lib" to Project
-Settings->Link->Input->Object/library modules and add Zip
-directory to the preprocessor searches (Project Settings -> C++ ->
-Preprocessor -> Additional include directories).
-Method 2 (simpler)
-Insert Zip project into workspace and set project dependencies (your project
-dependent on Zip project).
-How to use
-The details about using this library are in the sources. The example
-available for download at the bottom of the page is an almost complete
-compression\decompression program. There are only main issues mentioned below
-about using this library. If you have a question about using the library and you
-can't find the answer here, don't hesitate to ask.
-Compression and decompression
-There are some functions defined for fast operations on archive; among
-others: AddNewFile(), ExtractFile(), DeleteFile(). You only need to call
-functions Open() - before and Close() - after using them.
-Remember to call Close() function when you finish working with CZipArchive
-class.
-Multi-disk archives
-This library supports two kinds of multi-disk archives:
-1. Disk spanning performed in the compatible way with all other main zip
-programs. It means that the archive can only be created on a removable device,
-the size of the volume is auto-detected and the label is written to the disk. To
-use this kind of disk spanning you need to define a static callback function for
-changing disks and set it with SetSpanCallback() function.
-2. Disk spanning performed in the internal mode, called in the sources TD span
-mode. This allows creating multi disk archives also on non-removable devices and
-with user-defined volume size. There is no need to set callback function in this
-mode.
-This two disk spanning modes create volumes with compatible internal
-structure. It means that you can easily convert the volumes created in one mode
-to the other one by renaming the files (in TD mode each volume but last has a
-number as an extension). To convert the archive from TD to PKZIP compatible
-archive, copy each file to the removable media, giving them the extension
-".zip". You should also label each disk with the appropriate label
-starting from "pkback# 001".
-There is a limited functions set available during work with multi-disk
-archives. Only adding is allowed when creating an archive and only extracting
-and testing when opening an existing one. Deleting files from these archives
-isn't allowed in any of these cases.
-Class CZipArchive uses write buffer to make write operations extremely fast.
-You can change its size with SetAdvanced() function. While creating a multi-disk
-archive, set the size of the buffer to the maximum size of the volume for
-the best performance.
-The popular archivers such as PKZIP and WinZip cannot operate on archive in
-TD span mode. You need to convert them to PKZIP span mode (have a look above).
-Remember about copying the files to the removable media (it does not comply with
-Winzip, which can extract a multi-disk archive from any media but only from the
-fixed location on the drive).
-Password encryption and decryption
- This library supports creating and extracting of the
-password protected archives. There are several issues you should be aware of
-when using this feature. To set the password for the file to be added or
-extracted call the function SetPassword() with the password as the argument. To
-clear the password call this function without arguments or with an empty string
-argument. The function has no effect on a closed archive and on the currently
-opened file (whether new or existing) inside archive. During opening an archive
-the password is cleared and it is not changed if the file inside archive is
-opened. You can set different passwords for different files inside the same
-archive, but remember to set it BEFORE opening the file. You cannot use ASCII
-characters with codes above 127 in a password, if you do so, the function
-SetPassword() returns false and the password is cleared. If the password is
-cleared, no encryption or decryption take place.
- You can find out what files are password encrypted by calling
-CZipArchive::GetFileInfo() which fills the structrure CZipFileHeader with data,
-and then the method IsEncrypted() of this structure. If it returns true, the
-file needs a password to extract.
- The successful extraction of the encrypted file doesn't always mean
-that the password is correct. CZipArchive doesn't check for a crc if
-m_info.m_uUncomprLeft is not zero in the function CZipArchive::CloseFile(). In
-some cases bad password causes that this value is not zero, so you have to check
-also for the return value of this function (it returns -1 in this case). You can
-also check the size of the extracted file since it is smaller than it should be.
-Self extract support
-The library automatically detects self-extracting archives. This is the
-simplest self-extract code :
-
-
-int APIENTRY WinMain(HINSTANCE hInstance,
-HINSTANCE hPrevInstance,
-LPSTR lpCmdLine,
-int nCmdShow)
-{
- CZipArchive zip;
-
- // get path of executable
- TCHAR szBuff[_MAX_PATH];
- if (!::GetModuleFileName(hInstance, szBuff, _MAX_PATH))
- return -1;
-
- CString szDest;
- // ...
- // add the code here to get the destination directory from the user
- // for example:
- /* CBrowseForFolder bf;
- bf.strTitle = _T("Select directory to extract files");
- if (!bf.GetFolder(szDest))
- return -1;
- */
- // class CBrowseForFolder is included in the example project
- // remember about including the header!
-
- zip.Open(szBuff, CZipArchive::openReadOnly);
- // openReadOnly mode is necessary for self extract archives
- for (WORD i = 0; i < zip.GetNoEntries(); i++)
- zip.ExtractFile(i, szDest);
-
- zip.Close();
- return 0;
- // this code will not work for the encrypted archives since it is needed
- // to get the password from the user ( a small addition to the
- // existing code I suppose )
-}
-
-
-
-After compiling it and appending a zip archive to it (e.g. with the DOS
-command: copy /b SelfExtract.exe + ZipFile.zip FinalFile.exe) we have a
-self extracting archive.
-Testing the integrity of the archive
-The new functions has been provided to allow the testing of the integrity of
-the archive. The first one is CZipArchive::TestFile which is a
-comprehensive testing function, but if you need a different functionality, you
-can make your own by taking advantage of the second function provided: CZipArchive::CloseFileAfterTestFailed.
-The detailed description and the example of use are provided in the sources
-and in the example project.
-Exceptions
-The library throws the following exceptions: CMemoryException, CFileExeption
-and CZipException. The first two don't need an explanation. The last is thrown
-when some internal error occurs. Handling them may be done in the following way:
-
-try
-{
- // ...
- // some operations on Zip library
-}
-catch (CException* e)
-{
- if (e->IsKindOf( RUNTIME_CLASS( CZipException )))
- {
- CZipException* p = (CZipException*) e;
- //... and so on
- }
- else if (e->IsKindOf( RUNTIME_CLASS( CFileException )))
- {
- CFileException* p = (CFileException*) e;
- //... and so on
- }
- else
- {
- // the only possibility is a memory exception I suppose
- //... and so on
- }
- e->Delete();
-}
-
-Handling the extra field
-The extra field of the file can be different in the local and central
-headers. To set the extra filed in the local header set it in header
-parameter of CZipArchive::OpenNewFile function. After
-that the extra field is written to the local header and cleared. You should call
-CZipArchive::SetExtraField function anytime after opening the new file
-(but before closing it) to set the file extra field in the central directory.
-Sample application
-To run the example, integrate first Zip library into it (Zip library is not
-included in the example, you must download it separately); you should be asked
-at the beginning about the location of the Zip project, if not, use one of the
-integration methods described above. If you don't put Zip library project at the
-same directory level what the sample application is, you also have to change the path pointing
-to ZipArchive.h in the file testzipdlgdlg.h.
- Linking errors
- When you experience linking errors (mostly LNK2005) you need to
- make sure that the library and your program are both using
- single-threaded or both multithreaded library. The option "Project->Settings->
- c/c++ ->Code Generation->Use run-time library" should be set
- to the same value in the ZipArchive library and the program project options.
-
If it doesn't help, try recompiling the zlib library ( zlib.lib
- provided with the project is compiled from a release configuration and using Multithreaded
- DLL run-time library ). You can download the zlib library
- sources from http://software.artpol.com.pl/d_zip.html.
- Use zlibstat project. Set "Use run-time library"
- option to the same value as you set it in ZipArchve library and your program
- configurations. Compile the Release configuration of the zlib library and
- replace with it the file zlib.lib in the ZipArchive folder. You may
- however experience linking warnings or errors while compiling the Debug
- configuration. To eliminate them do as follows:
-
- - compile Debug and Release configuraions of the zlib library
-
- copy zlib_d.lib from Debug and zlib.lib from Release
- directories to the ZipArchive directory
-
- add these files to the ZipArchive project (Project -> Add To
- Project -> Files...)
-
- go to the project setting dialog (Project -> Settings)
-
- select debug configurations (Setting For -> Multiple
- Configurations) such as Debug and Unicode Debug
-
- select zlib.lib file, then the General tab, and check the box "Exclude
- file from build"
-
- select release configurations
-
- select zlib_.lib and exclude it from these builds
-
-
-To Do and updates
-I currently work on the non-MFC version of the library and a multi-platform
-support. Make sure to check out the site http://software.artpol.com.pl
-which is more likely to have an updated version.
-Downloads
-
-
-Download source - 110 KB
-Download example - 40 KB
-History
-03.2001
-
- - when the central directory was not located, the library throws
- CZipException::cdirNotFound,
- which allows distinguish from other exceptions (useful when we want to keep
- prompting
- the user to insert the last disk in a multi-disk spanning archive).
-
-
-
-
-
-02.2001
-
- - Features added:
-
-
-
- - ability to reuse the archive after an exception thrown during
- extraction
-
- added progress control possibilities to CZipArchive::AddNewFile,
- CZipArchive::ExtractFile, CZipArchive::TestFile
-
-
-
-
- - Changes:
-
-
-
- - CZipArchive::FindFile operation boosted ( thanks to Darin Warling for
- the idea)
-
- library name changed to ZipArchive
-
-
-
-
- - Bugs fixed:
-
-
-
- - removed bug during extracting an encrypted file with 0 size
-
- fixed bug when extracting a file with an extra field in a local file
- header (CZipFileHeader::ReadLocal)
-
-
-
-01.2001
-
- - Disk numbering in a disk spanning archive begins now from PKBACK# 001 not
- PKBACK# 000
-
- Adding and extracting without a full path possible in
- CZipArchive::AddNewFile and CZipArchive::ExtractFile.
-
- Several minor changes and enhancements
-
- Changed names for several classes.
-
-11.2000
-
- - Added support for password encryption and decryption. The encryption used
- in PKZIP was generously supplied by Roger Schlafly.
-
- Testing the archive made easier
-
- Unicode support added
-
-08.2000
-
-06.2000
-the code has been completely rewritten since the very beginning; the main
-improvements are:
-
- - multi-disk archive support
-
- creation of the disk spanning archives with the user-defined volume size
-
- ability to modify existing archives (add, delete files)
-
- modification self-extracting archives
-
- write buffer used for faster disk write operations
-
- one class for zip and unzip functions
-
- fast adding, deleting and extracting files with a single function call
-
-03.2000
-
- - international characters in filenames inside archive are now converted in
- a compatible way with other archiving programs (they are stored converted to
- OEM inside archive).
-
-01.2000
-first version; it is just modified code from zip.c and unzip.c files written
-by Gilles Vollant and distributed with zlib library; the modifications are as
-follows:
-
- - added class' wrappers
-
- several bugs fixed
-
- several enhancements added
-
- MFC support added
-
- memory leaks eliminated when write error occurred
-
- automatically free used memory on destruction or exception
-
- modern error notification using exceptions
-
-
-
diff --git a/stepmania/src/smpackage/ZipArchive/License.txt b/stepmania/src/smpackage/ZipArchive/License.txt
index b55c0d541d..ae3039860c 100644
--- a/stepmania/src/smpackage/ZipArchive/License.txt
+++ b/stepmania/src/smpackage/ZipArchive/License.txt
@@ -1,7 +1,7 @@
/** \page pageLic Licensing information
-ZipArchive library - creation, modification and extraction of "zip" format archives
-Copyright © 2000 - 2002 Tadeusz Dracz.
+ZipArchive library - creation, modification and decompression of "zip" format archives
+Copyright © 2000 - 2003 Tadeusz Dracz.
E-Mail: \htmlonly tdracz@artpol-software.com
Web: http://www.artpol-software.com \endhtmlonly
@@ -21,19 +21,19 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*************************************************************************
-An English version of the \ref pageGPL "GNU GPL" is in the gpl.txt file distributed with
+An English version of the \ref pageGPL "GNU GPL" is in the %gpl.txt file distributed with
this project. Translations to other languages are available at:
\htmlonly
http://www.gnu.org/copyleft/gpl.html
\endhtmlonly
-
+
Distributing ZipArchive under GNU GPL implies ZipArchive can only be used
with software that is licensed under conditions compliant with the GPL.
Embedding in proprietary software requires an alternative license.
-\subsection s1 Alternative license for use with proprietary software
+\section s1 Alternative license for use with proprietary software
If you want to distribute software in a commercial context that incorporates
@@ -44,21 +44,30 @@ software that uses the ZipArchive library), you need to have a commercial li
addition allows you to embed ZipArchive library in proprietary software without
affecting the copyright of this software (it removes the GNU GPL obligation
to publish the source code)
+- The license gives you royalty free distribution rights
- The license does not allow you to transfer these rights
-- The license is granted per developer or per company
-- It does not depend on the amount of copies of software that uses the library sold
+- The license is granted per developer
- You won't need to purchase an additional license for the future versions of the library
-The commercial license is available free of charge for freeware and shareware
-programs. If your program is distributed in a similar way to the one of the
-above, the commercial license will be granted to you free of charge as well.
-
-There is a fee for the commercial license for using the library in the software
-not falling into the mentioned categories.
+The commercial license is available free of charge for using ZipArchive library in:
+- freeware software (freeware is software that is available free of charge, but which is copyrighted by the developer, who retains the right to control its redistribution and to sell it in the future)
+ - excluded is software which is associated with an equipment that the same company manufactures and which has no practical usage value without the mentioned equipment (e.g. software used for maintenace of machines) - unless the equipment is free as well
+ - if you decide to sell the software in the future - you will need to purchase the commercial license for using the ZipArchive library, unless it is distributed in the shareware way - see below
+- software distributed in the Shareware way (Shareware distribution gives users a chance to try software before buying it. If you try a Shareware program and continue using it, you are expected to register. Individual programs differ on details -- some request registration while others require it, some specify a maximum trial period.
+Copyright laws apply to both Shareware and commercial software and the copyright holder retains all rights, with the exception that copying and distributing the program for evaluation purposes is encouraged, subject to certain conditions. For example, some authors require written permission before a commercial disk vendor may copy their Shareware. )
+ - excluded is software which price for a single copy is higher than the price of the ZipArchive library for a single developer
+
+Extended Licence for HBZLIB (library for zip compression in \htmlonly Harbour\endhtmlonly)
+You can create proprietary software using hbzlib respecting the follow:
+- ZipArchive library must be linked together with hbzlib
+- you cannot use ZipArchive as a dynamic library (DLL), it must be linked staticaly with the software
+- the commercial license for ZipArchive is free of charge, but these grants are valid only if the whole application is written with Harbour
+
+There is a fee for the commercial license for using the library in the software not falling into the mentioned categories.
It is recommended that you should print two copies of the commercial license
document after you receive it, sign them and send by post. One copy, signed by the author will be sent back to you.
-Please \htmlonly contact the author or visit the Artpol Software web site\endhtmlonly to find out more.
+Please \htmlonly contact the author or visit the Artpol Software web site \endhtmlonly to find out more.
*/
diff --git a/stepmania/src/smpackage/ZipArchive/Linux/Makefile b/stepmania/src/smpackage/ZipArchive/Linux/Makefile
new file mode 100644
index 0000000000..b7878d1ce4
--- /dev/null
+++ b/stepmania/src/smpackage/ZipArchive/Linux/Makefile
@@ -0,0 +1,86 @@
+# Makefile for ZipArchive library
+# Copyright (C) 2000-2003 Tadeusz Dracz
+# For conditions of distribution and use, see copyright notice in License.txt
+# To install to /usr/lib and /usr/include, type:
+# make install
+# to install to a different directory change prefix
+
+
+
+CC=g++
+CCC=cc
+
+#FLAGSD = -g
+FLAGSD =
+
+ZIPARCHLIB = libziparch.a
+
+ZIPPIELOCATION = stl/zippie/
+
+prefix = /usr
+libdir = ${prefix}/lib
+includedir = ${prefix}/include
+zipardir = $(includedir)/ziparchive
+
+AR=ar rc
+RANLIB=ranlib
+
+.SUFFIXES: .c .cpp
+.c.o:
+ $(CCC) -c -I. -o $*.o $<
+.cpp.o:
+ $(CC) $(FLAGSD) -c -I. $<
+
+OBJS = ZipArchive.o ZipAutoBuffer.o ZipCentralDir.o \
+ZipCompatibility.o ZipException.o ZipFile.o ZipFileHeader.o \
+ZipMemFile.o ZipPathComponent.o ZipPlatform.o ZipPlatformComm.o \
+ZipStorage.o ZipString.o
+
+#OBJSZLIB = zlib/adler32.o zlib/compress.o zlib/crc32.o zlib/uncompr.o zlib/deflate.o zlib/trees.o \
+zlib/zutil.o zlib/inflate.o zlib/infblock.o zlib/inftrees.o zlib/infcodes.o zlib/infutil.o zlib/inffast.o
+
+OBJSZLIB =
+
+$(ZIPARCHLIB): $(OBJS) $(OBJSZLIB)
+ $(AR) $@ $(OBJS) $(OBJSZLIB)
+ -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
+
+ZipArchive.o: ZipArchive.h
+ZipAutoBuffer.o: ZipAutoBuffer.h
+ZipCentralDir.o: ZipCentralDir.h
+ZipCompatibility.o: ZipCompatibility.h
+ZipException.o: ZipException.h
+ZipFile.o: ZipFile.h
+ZipFileHeader.o: ZipFileHeader.h
+ZipMemFile.o: ZipMemFile.h
+ZipPathComponent.o: ZipPathComponent.h
+ZipPlatform.o: ZipPlatform.h
+ZipStorage.o: ZipStorage.h
+ZipString.o: ZipString.h
+
+clean:
+ -rm -f *.o *~ $(ZIPARCHLIB)
+
+zippie:
+
+ $(CC) -I$(zipardir) $(FLAGSD) -o zippie $(ZIPPIELOCATION)zippie.cpp $(ZIPPIELOCATION)CmdLine.cpp -lz -lstdc++ -lziparch
+# $(CC) -I$(zipardir) $(FLAGSD) -o zippie ZIPPIELOCATION)zippie.cpp $(ZIPPIELOCATION)CmdLine.cpp -lstdc++ -lziparch
+cleanzippie:
+ -rm -f zippie
+
+install:
+ -@if [ ! -d $(includedir) ]; then mkdir $(includedir); fi
+ -@if [ ! -d $(libdir) ]; then mkdir $(libdir); fi
+ -@if [ ! -d $(zipardir) ]; then mkdir $(zipardir); fi
+ cp libziparch.a $(libdir)
+ chmod 755 $(libdir)/$(ZIPARCHLIB)
+ cp *.h $(zipardir)
+ chmod 644 $(zipardir)/*h
+
+uninstall:
+ rm -f $(zipardir)/*h
+ rm -f $(libdir)/$(ZIPARCHLIB)
+ rmdir $(zipardir)
+
+
+
diff --git a/stepmania/src/smpackage/ZipArchive/Linux/ZipFileMapping.h b/stepmania/src/smpackage/ZipArchive/Linux/ZipFileMapping.h
new file mode 100644
index 0000000000..a777df161b
--- /dev/null
+++ b/stepmania/src/smpackage/ZipArchive/Linux/ZipFileMapping.h
@@ -0,0 +1,70 @@
+////////////////////////////////////////////////////////////////////////////////
+// $Workfile: ZipFileMapping.h $
+// $Archive: /ZipArchive_Linux/ZipFileMapping.h $
+// $Date$ $Author$
+////////////////////////////////////////////////////////////////////////////////
+// This source file is part of the ZipArchive library source distribution and
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// For the licensing details see the file License.txt
+////////////////////////////////////////////////////////////////////////////////
+
+
+#if !defined(AFX_AUTOHANDLE_H__D68326EA_D7FA_4792_AB1F_68D09533E399__INCLUDED_)
+#define AFX_AUTOHANDLE_H__D68326EA_D7FA_4792_AB1F_68D09533E399__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include
+
+namespace ziparchv
+{
+
+
+ struct CZipFileMapping
+ {
+ CZipFileMapping()
+ {
+ m_iSize = 0;
+ m_pFileMap = NULL;
+ }
+ bool CreateMapping(CZipFile* pFile)
+ {
+ if (!pFile)
+ return false;
+ m_iSize = pFile->GetLength();
+ m_pFileMap = mmap(0, m_iSize, PROT_READ|PROT_WRITE, MAP_SHARED, pFile->m_hFile, 0);
+ return (m_pFileMap != NULL);
+ }
+ void RemoveMapping()
+ {
+
+ if (m_pFileMap)
+ {
+ munmap(m_pFileMap, m_iSize);
+ m_pFileMap = NULL;
+ }
+ }
+ ~CZipFileMapping()
+ {
+ RemoveMapping();
+ }
+ char* GetMappedMemory()
+ {
+ return reinterpret_cast (m_pFileMap);
+ }
+ protected:
+ void* m_pFileMap;
+ size_t m_iSize;
+
+ };
+}
+
+#endif // !defined(AFX_AUTOHANDLE_H__D68326EA_D7FA_4792_AB1F_68D09533E399__INCLUDED_)
diff --git a/stepmania/src/smpackage/ZipArchive/Linux/ZipPathComponent.cpp b/stepmania/src/smpackage/ZipArchive/Linux/ZipPathComponent.cpp
new file mode 100644
index 0000000000..bb761cc7c0
--- /dev/null
+++ b/stepmania/src/smpackage/ZipArchive/Linux/ZipPathComponent.cpp
@@ -0,0 +1,97 @@
+////////////////////////////////////////////////////////////////////////////////
+// $Workfile: ZipPathComponent.cpp $
+// $Archive: /ZipArchive_Linux/ZipPathComponent.cpp $
+// $Date$ $Author$
+////////////////////////////////////////////////////////////////////////////////
+// This source file is part of the ZipArchive library source distribution and
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// For the licensing details see the file License.txt
+////////////////////////////////////////////////////////////////////////////////
+
+#include "stdafx.h"
+#include "ZipPathComponent.h"
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+
+CZipPathComponent::~CZipPathComponent()
+{
+
+}
+
+void CZipPathComponent::SetFullPath(LPCTSTR lpszFullPath)
+{
+
+ CZipString szTempPath(lpszFullPath);
+ const CZipString szPrefix = _T("\\\\?\\unc\\");
+ int i = -1, iLen = szPrefix.GetLength();
+ if (iLen > szTempPath.GetLength())
+ iLen = szTempPath.GetLength();
+ CZipString szPossiblePrefix = szTempPath.Left(iLen);
+ szPossiblePrefix.MakeLower(); // must perform case insensitive comparison
+ while (++i < iLen && szPossiblePrefix[i] == szPrefix[i]);
+ if (i == 2 || i == 4 || i == 8) // unc path, unicode path or unc path meeting windows file name conventions
+ {
+ m_szPrefix = szTempPath.Left(i);
+ szTempPath = szTempPath.Mid(i);
+ }
+ else
+ m_szPrefix.Empty();
+
+
+ m_szDrive.Empty();
+ m_szFileTitle.Empty();
+ m_szDirectory.Empty();
+ m_szFileExt.Empty();
+ int p;
+ for (p = szTempPath.GetLength() - 1; p >= 0; p--)
+ if (szTempPath[p] == m_cSeparator)
+ break;
+
+ if (p != -1)
+ {
+ m_szDirectory = szTempPath.Left(p);
+ if (p == szTempPath.GetLength() - 1 )
+ return; // no filename present
+ else
+ p++;
+ }
+ else
+ p = 0;
+
+ // p points at the beginning of the filename
+ m_szFileTitle = szTempPath.Mid(p);
+ for (p = m_szFileTitle.GetLength() - 1; p >= 0; p--)
+ if (m_szFileTitle[p] == _T('.'))
+ break;
+
+ if (p != -1)
+ {
+ m_szFileExt = m_szFileTitle.Mid(p+1);
+ m_szFileTitle = m_szFileTitle.Left(p);
+ }
+
+
+
+}
+
+
+CZipString CZipPathComponent::GetNoDrive() const
+{
+ CZipString szPath = m_szDirectory;
+ CZipString szFileName = GetFileName();
+ if (!szFileName.IsEmpty() && !szPath.IsEmpty())
+ szPath += m_cSeparator;
+
+ szPath += szFileName;
+ return szPath;
+}
+
diff --git a/stepmania/src/smpackage/ZipArchive/Linux/ZipPlatform.cpp b/stepmania/src/smpackage/ZipArchive/Linux/ZipPlatform.cpp
new file mode 100644
index 0000000000..223ec1a23e
--- /dev/null
+++ b/stepmania/src/smpackage/ZipArchive/Linux/ZipPlatform.cpp
@@ -0,0 +1,273 @@
+////////////////////////////////////////////////////////////////////////////////
+// $Workfile: ZipPlatform.cpp $
+// $Archive: /ZipArchive_Linux/ZipPlatform.cpp $
+// $Date$ $Author$
+////////////////////////////////////////////////////////////////////////////////
+// This source file is part of the ZipArchive library source distribution and
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// For the licensing details see the file License.txt
+////////////////////////////////////////////////////////////////////////////////
+
+
+#include "stdafx.h"
+#include "ZipPlatform.h"
+#include "ZipFileHeader.h"
+#include "ZipException.h"
+#include "ZipAutoBuffer.h"
+
+
+#include
+
+
+
+#include "ZipPathComponent.h"
+
+
+#include "ZipCompatibility.h"
+#include
+#include
+#include
+#include
+#include
+#include
+
+const TCHAR CZipPathComponent::m_cSeparator = _T('/');
+
+#ifndef _UTIMBUF_DEFINED
+#define _utimbuf utimbuf
+#endif
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+DWORD ZipPlatform::GetDeviceFreeSpace(LPCTSTR lpszPath)
+{
+ struct statfs sStats;
+ if (statfs(lpszPath, &sStats) == -1)
+ return 0;
+
+ return sStats.f_bsize * sStats.f_bavail;
+}
+
+bool ZipPlatform::GetFileSize(LPCTSTR lpszFileName, DWORD& dSize)
+{
+ int f = open(lpszFileName, O_RDONLY);
+ if (f == -1)
+ return false;
+ int iSize = lseek(f, 0, SEEK_END);
+ close(f);
+ if (iSize == -1)
+ return false;
+ dSize = (DWORD)iSize;
+ return true;
+}
+
+CZipString ZipPlatform::GetTmpFileName(LPCTSTR lpszPath, DWORD iSizeNeeded)
+{
+ TCHAR empty[] = _T(""), prefix [] = _T("zar");
+ TCHAR* buf = NULL;
+ CZipString tempPath;
+ if (lpszPath)
+ {
+ // first try the user provided directory
+ tempPath = lpszPath;
+ if (ZipPlatform::GetDeviceFreeSpace(tempPath) < iSizeNeeded)
+ tempPath.Empty();
+ else
+ {
+ CZipPathComponent::AppendSeparator(tempPath);
+ tempPath += prefix;
+ tempPath += _T("XXXXXX");
+ TCHAR* c = mktemp(tempPath.GetBuffer(tempPath.GetLength()));
+ tempPath.ReleaseBuffer();
+ if (c)
+ return tempPath;
+ else
+ tempPath.Empty();
+ }
+ }
+
+
+ TCHAR* v = tempnam(tempPath, prefix);
+ tempPath = v;
+ free(v);
+
+ if (!tempPath.IsEmpty())
+ {
+ CZipPathComponent zpc(tempPath);
+ if (ZipPlatform::GetDeviceFreeSpace(zpc.GetFilePath()) < iSizeNeeded)
+ return empty;
+ return tempPath;
+ }
+ else
+ return empty;
+}
+
+bool ZipPlatform::GetCurrentDirectory(CZipString& sz)
+{
+ char* pBuf = getcwd(NULL, 0);
+ if (!pBuf)
+ return false;
+ sz = pBuf;
+ free(pBuf);
+ return true;
+}
+
+bool ZipPlatform::SetFileAttr(LPCTSTR lpFileName, DWORD uAttr)
+{
+ return chmod(lpFileName, uAttr >> 16) == 0;
+
+}
+
+bool ZipPlatform::GetFileAttr(LPCTSTR lpFileName, DWORD& uAttr)
+{
+ struct stat sStats;
+ if (stat(lpFileName, &sStats) == -1)
+ return false;
+ uAttr = (sStats.st_mode & (S_IRWXU | S_IRWXG | S_IRWXO | S_IFMT)) << 16;
+ return true;
+
+
+}
+
+bool ZipPlatform::GetFileModTime(LPCTSTR lpFileName, time_t & ttime)
+{
+
+ struct stat st;
+ if (stat(lpFileName, &st) != 0)
+ return false;
+
+ ttime = st.st_mtime;
+ return ttime != -1;
+}
+
+bool ZipPlatform::SetFileModTime(LPCTSTR lpFileName, time_t ttime)
+{
+ struct utimbuf ub;
+ ub.actime = time(NULL);
+ ub.modtime = ttime == -1 ? time(NULL) : ttime; // if wrong file time, set it to the current
+ return utime(lpFileName, &ub) == 0;
+}
+
+
+bool ZipPlatform::ChangeDirectory(LPCTSTR lpDirectory)
+{
+ return chdir(lpDirectory) == 0;
+}
+int ZipPlatform::FileExists(LPCTSTR lpszName)
+{
+ struct stat st;
+ if (stat(lpszName, &st) != 0)
+ return 0;
+ else
+ {
+ if (S_ISDIR(st.st_mode))
+ return -1;
+ else
+ return 1;
+ }
+
+
+
+}
+
+ZIPINLINE bool ZipPlatform::IsDriveRemovable(LPCTSTR lpszFilePath)
+{
+ // not implemmented
+ return true;
+}
+
+ZIPINLINE bool ZipPlatform::SetVolLabel(LPCTSTR lpszPath, LPCTSTR lpszLabel)
+{
+ // not implemmented
+ return true;
+}
+
+ZIPINLINE void ZipPlatform::AnsiOem(CZipAutoBuffer& buffer, bool bAnsiToOem)
+{
+ // not implemmented
+}
+
+ZIPINLINE bool ZipPlatform::RemoveFile(LPCTSTR lpszFileName, bool bThrow)
+{
+ if (unlink(lpszFileName) != 0)
+ if (bThrow)
+ CZipException::Throw(CZipException::notRemoved, lpszFileName);
+ else
+ return false;
+ return true;
+
+
+}
+ZIPINLINE bool ZipPlatform::RenameFile( LPCTSTR lpszOldName, LPCTSTR lpszNewName , bool bThrow)
+{
+
+ if (rename(lpszOldName, lpszNewName) != 0)
+ if (bThrow)
+ CZipException::Throw(CZipException::notRenamed, lpszOldName);
+ else
+ return false;
+ return true;
+
+}
+ZIPINLINE bool ZipPlatform::IsDirectory(DWORD uAttr)
+{
+ return S_ISDIR(uAttr >> 16) != 0;
+}
+ZIPINLINE bool ZipPlatform::CreateDirectory(LPCTSTR lpDirectory)
+{
+ return mkdir(lpDirectory, S_IRUSR | S_IWUSR | S_IRGRP |S_IROTH) == 0;
+
+}
+
+ZIPINLINE DWORD ZipPlatform::GetDefaultAttributes()
+{
+ return 0x81a40000;
+}
+
+ZIPINLINE DWORD ZipPlatform::GetDefaultDirAttributes()
+{
+ return 0x41ff0010;
+}
+
+
+ZIPINLINE int ZipPlatform::GetSystemID()
+{
+ return ZipCompatibility::zcUnix;
+}
+
+ZIPINLINE bool ZipPlatform::GetSystemCaseSensitivity()
+{
+ return true;
+}
+
+
+bool ZipPlatform::TruncateFile(int iDes, DWORD iSize)
+{
+ return ftruncate(iDes, iSize) == 0;
+
+}
+
+int ZipPlatform::OpenFile(LPCTSTR lpszFileName, UINT iMode, int iShareMode)
+{
+ return open(lpszFileName, iMode, S_IRUSR | S_IWUSR | S_IRGRP |S_IROTH );
+}
+
+bool ZipPlatform::FlushFile(int iDes)
+{
+ return fsync(iDes) == 0;
+}
+
+int ZipPlatform::GetFileSystemHandle(int iDes)
+{
+ return iDes;
+}
+
+
+
diff --git a/stepmania/src/smpackage/ZipArchive/Readme.txt b/stepmania/src/smpackage/ZipArchive/Readme.txt
index f8531f3eee..286b19deb6 100644
--- a/stepmania/src/smpackage/ZipArchive/Readme.txt
+++ b/stepmania/src/smpackage/ZipArchive/Readme.txt
@@ -14,34 +14,41 @@ If you do not have it, please download it from http://www.artpol-software.com/
The ZipArchive library
-Copyright © 2000 - 2002 Tadeusz Dracz
+Copyright © 2000 - 2003 Tadeusz Dracz
-\b Version: 2.2
-\b Date: 10-January-2002
+\b Version: 2.3.4
+\b Date: 26-June-2003
-This library adds zip compression and decompression functionality to your program, allowing you to create and modify ZIP files in the compatible way with WinZip and PKZIP.
-It's easy and practical interface makes the library suitable for the beginners as well as for the advanced users.
+This library adds zip compression and decompression functionality to your program, allowing you to create and modify ZIP files in the compatible way with WinZip, PKZIP and other popular archivers.
+Its easy and practical interface makes the library suitable for the beginners as well as for the advanced users.
+
+See \ref pageHist "what's new" in this version.
+To be notified about the future library updates, sign up for the \ref pageSubsc.
\ref pageSyst "Platforms supported:"
-- Windows 9x\Me\NT\2000\XP (MFC and STL) - \ref sectVisual "Microsoft Visual C++ 6.0", \ref sectBorl "Borland C++"
+- Windows 9x\\Me\\NT\\2000\\XP (MFC and STL)
\ref sectVisual "Microsoft Visual C++ 6.0" (.NET compatible ), \ref sectBorl "Borland C++"
+
- \ref sectLinux "Linux (STL)"
\author Tadeusz Dracz
E-Mail: \htmlonly tdracz@artpol-software.com \endhtmlonly
Web Site: \htmlonly http://www.artpol-software.com \endhtmlonly
-This library uses \htmlonly the zlib library \endhtmlonly by Jean-loup Gailly and Mark Adler to perform inflate and deflate operations.
+This library uses \htmlonly the zlib library \endhtmlonly by Jean-loup Gailly and Mark Adler to perform inflate and deflate operations.
\section sectFeat Features Summary:
- work in a compatible way with PKZIP and WinZip (apart from \ref TDSpan "TD disk spanning mode" which is specific to this library)
- create, modify, extract and test zip archives
- create and extract multi-disk archives (on non-removable disks as well)
+- add file to the archive from another archive without decompressing the file (copy compressed data) (see CZipArchive::GetFromArchive)
+- highly optimized deleting multiple files from the archive
+- optimized replacing and renaming files in the archive
+- compression from and decompression to memory, create the whole archive in memory, extract the archive from memory (see \ref sectMemory)
- password encryption and decryption supported
- possibility to create or extract self-extracting archives
-- compression from and decompression to memory, create the whole archive in memory, extract the archive from memory (see \ref sectMemory)
- smart compression, if enabled, prevents the file in the archive to be larger after compression (see CZipArchive::Smartness)
- safe compression with CZipArchive::Flush function
- using functional objects as callback
@@ -51,6 +58,7 @@ This library uses \htmlonly mail me. The bugs are usually corrected within few days. Many thanks to the people that already tracked them down and submitted.
-\section secQl Quick Links
+\section secQl The Introduction
+
+All you need to know about the licensing: \ref pageLic .
+
+It's a good start to read these pages first (prior to reading the raw documentation):
+- \ref pageSyst
+- \ref pageGen
+
+Have you got a question? Maybe it's one of the \ref pageFaq "frequently asked questions".
+
+\ref pageHist not only shows how the development of the library went so far, but also you may find here an
+interesting library feature without digging through the documentation.
+
+If you wish to be notified about the future library updates, sign up for the \ref pageSubsc .
-\par
-\ref pageGen
-\par
-\ref pageSyst
-\par
-\ref pageFaq
-\par
-\ref pageHist
-\par
-\ref pageLic
-\par
-\ref pageSubsc
*/
/**
-
+
\page pageSyst Compilation & Integration
- \subsection stlNotes STL version notes
- - [Windows only] If your locale is different from English and you wish to use non-English
- characters in zip files, you need to set your locale with function
- \e std::locale::global(std::locale("")) to set it to be the same as your
- system locale or e.g. \e std::locale::global(std::locale("French"))
- to set it to the specified value (do not use \e _T() macro here when using
- Unicode); \e setlocale() function is not sufficient in this case.
- - There is a sample application that compiles under Windows (MSVC) and Linux (see below
- to find out \ref stlLinuxTest "how to compile it under Linux"). This sample application demonstrates most of the
- ZipArchive library features and is located in \e stl/zippie.
+ \par
+ - \ref secCompil
+ - \ref winMFC
+ - \ref winSTL
+ - \ref LnxSTL
+ - \ref sectVisual
+ - \ref subsM1
+ - \ref subsM2
+ - \ref subsDLL
+ - \ref sectBorl
+ - \ref subExample
+ - \ref sectLinux
+ - \ref subsLnxNot
+ - \ref subsLnxCom
+ - \ref sectNotes
+ - \ref stlNotes
+ - \ref subDLLnotes
+ - \ref MFCsample
- \subsection MFCsample MFC sample application (ZipArc) notes
- MFC sample application using ZipArchive library is available separately. Main features:
- - MDI application
- - multithreaded - you can work with many zip files at one time
- - shell integration (remembers the last application used to open zip files and can restore it correctly)
- - drag & drop support
- - detailed error reports
- - you can open and modify SFX archives
- - it demonstrates the use of the following functions (most of them are placed in ZipArcDoc.cpp) :
- CZipArchive::AddNewFile,
- CZipArchive::Close,
- CZipArchive::CloseFile,
- CZipArchive::CloseNewFile,
- CZipArchive::DeleteFiles,
- CZipArchive::EnableFindFast,
- CZipArchive::ExtractFile,
- CZipArchive::FindFile,
- CZipArchive::FindMatches,
- CZipArchive::Flush,
- CZipArchive::GetArchivePath,
- CZipArchive::GetCentralDirInfo,
- CZipArchive::GetCentralDirSize,
- CZipArchive::GetCurrentDisk,
- CZipArchive::GetFileInfo,
- CZipArchive::GetFindFastIndex,
- CZipArchive::GetGlobalComment,
- CZipArchive::GetCount,
- CZipArchive::GetPassword,
- CZipArchive::GetSpanMode,
- CZipArchive::IsClosed,
- CZipArchive::IsReadOnly,
- CZipArchive::Open,
- CZipArchive::PredictExtractedFileName,
- CZipArchive::SetAdvanced,
- CZipArchive::SetCallback,
- CZipArchive::SetFileComment,
- CZipArchive::SetGlobalComment,
- CZipArchive::SetIgnoreCRC,
- CZipArchive::SetPassword,
- CZipArchive::SetRootPath,
- CZipArchive::SetSpanCallback,
- CZipArchive::SetTempPath,
- CZipArchive::TestFile,
- CZipFileHeader::IsEncrypted,
- CZipFileHeader::IsDirectory,
- CZipFileHeader::GetTime,
- CZipFileHeader::GetSystemCompatibility,
- CZipFileHeader::GetSystemAttr,
- CZipFileHeader::GetSize,
- CZipFileHeader::GetFileName,
- CZipFileHeader::GetEffComprSize,
- CZipFileHeader::GetCompressionRatio,
- CZipFileHeader::GetComment,
- CZipFileHeader::CompressionEfficient,
\section secCompil Compiling for different implementations and platforms
@@ -160,15 +123,15 @@ Suggestions and bug reports are welcome. Drop me a note if you wish to share any
\subsection winMFC Windows MFC
- \e \Windows and \e \mfc
+ \e \\Windows and \e \\mfc
You can just execute _copy from Win-MFC.bat batch file.
\subsection winSTL Windows STL
- \e \Windows and \e \stl
+ \e \\Windows and \e \\stl
You can just execute _copy from Win-STL.bat batch file.
\subsection LnxSTL Linux (STL version)
- \e \Linux and \e \stl
+ \e \\Linux and \e \\stl
You can just execute _copy_from_Linux.sh script file
(don't forget to set executable rights before e.g. with the command:
chmod +x _copy_from_Linux.sh ).
@@ -185,10 +148,11 @@ Suggestions and bug reports are welcome. Drop me a note if you wish to share any
\subsection subsM1 Method 1
- Add \e ZipArchive.lib with the proper path e.g. ..\ZipArchive\debug\ZipArchive.lib to Project Settings->Link->Input->Object/library modules
+ Add \e ZipArchive.lib with the proper path e.g. ..\\ZipArchive\\debug\\ZipArchive.lib to Project Settings->Link->Input->Object/library modules
and add ZipArchive library directory to the preprocessor searches ( Project Settings -> C++ -> Preprocessor -> Additional include directories ).
\subsection subsM2 Method 2 (simpler)
+
Insert Zip project into workspace and set project dependencies: your project dependent on ZipArchive project
( Project -> Dependencies and then on the dialog that will appear
you select your project name from the combo box and check the box next to ZipArchive project name).
@@ -198,17 +162,21 @@ Suggestions and bug reports are welcome. Drop me a note if you wish to share any
in your application project and make sure that your project uses MFC library and run-time library in same way
( Project->Settings->General->Microsoft Fundation Classes and Project->Settings-> c/c++ ->Code Generation->Use run-time library ).
- In case you experience linking problems, please see the \ref pageFaq.
+ \subsection subsDLL DLL version
+
+ When you're using the DLL version of the ZipArchive library, you need to define in your program ZIP_HAS_DLL (e.g. in Project Settings -> C++ -> Preprocessor -> Preprocessor definitions ).
+ Apart from integrating the ZipArchive library with your program (use one of the methods above), you also need to take into account zlib.lib file (use zlib/zlib.dsw to create it and add to preprocessor includes) or zlib/zlib.dsw project (insert into workspace and set ZipArchive project dependent on it)).
+ Files zlib.dll and ZipArchive.dll must be available for the program when running (e.g. in the program's directory).
+
+
+
+ You can read about linking problems in the \ref pageFaq.
\section sectBorl Borland C++ compatibility
The library contains a project files for Borland C++ 5.0 (
They were created using Visual C++ Project Conversion Utility (VCTOBPR.EXE).
- You can start it with the command Tools->Visual C++ Project Conversion Utility .
- - The project \e ZipArchive.bpr was converted from a Release configuration
- of the MFC version of the library (\e ZipArchive.dsp).
- - The project \e ZipArchive_no_MFC.bpr was converted from a Release configuration
- of the non MFC version of the library (\e ZipArchive_no_MFC.dsp).
-
+ You can start this tool with the command Tools->Visual C++ Project Conversion Utility .
+
\note Be sure to create \e Release subfolder before compiling one of these projects,
otherwise you'll get a write error.
@@ -216,7 +184,7 @@ Suggestions and bug reports are welcome. Drop me a note if you wish to share any
to the root directory appropriate files for \ref winMFC "MFC" or \ref winSTL "STL" versions.
You may use the Borland project conversion utility.
- The library contains also \e makefiles which should work with every version of Borland.
+ The library contains also \e makefiles which should work with other versions of Borland.
\subsection subExample Compiling the sample application
@@ -279,6 +247,82 @@ Suggestions and bug reports are welcome. Drop me a note if you wish to share any
you need to switch the comments (comment one line and uncomment another) in the \e Makefile in the section \e "zippie:".
- If you wish to uninstall the library type make uninstall
+ \section sectNotes Notes
+
+ \subsection stlNotes STL version
+ - [Windows only] If your locale is different from English and you wish to use non-English
+ characters in zip files, you need to set your locale with function
+ \e std::locale::global(std::locale("")) to set it to be the same as your
+ system locale or e.g. \e std::locale::global(std::locale("French"))
+ to set it to the specified value (do not use \e _T() macro here when using
+ Unicode); \e setlocale() function is not sufficient in this case.
+ - There is a sample application that compiles under Windows (MSVC) and Linux (see below
+ to find out \ref stlLinuxTest "how to compile it under Linux"). This sample application demonstrates most of the
+ ZipArchive library features and is located in \e stl/zippie.
+
+ \subsection subDLLnotes Compiling as DLL
+ [Windows only]
+ - The project that compiles the DLL version of the ZipArchive library needs to have defined ZIP_HAS_DLL, ZIP_BUILD_DLL and also ZLIB_DLL.
+ - The project that uses the ZipArchive library as the DLL version need to have defined ZIP_HAS_DLL
+
+ \subsection MFCsample MFC sample application (ZipArc)
+ MFC sample application using ZipArchive library is available separately. Main features:
+ - MDI application
+ - multithreaded - you can work with many zip files at one time
+ - shell integration (remembers the last application used to open zip files and can restore it correctly)
+ - drag & drop support
+ - detailed error reports
+ - you can open and modify SFX archives
+ - it demonstrates the use of the following functions (most of them are placed in ZipArcDoc.cpp) :
+ CZipArchive::AddNewFile,
+ CZipArchive::Close,
+ CZipArchive::CloseFile,
+ CZipArchive::CloseNewFile,
+ CZipArchive::DeleteFiles,
+ CZipArchive::EnableFindFast,
+ CZipArchive::ExtractFile,
+ CZipArchive::FindFile,
+ CZipArchive::FindMatches,
+ CZipArchive::Flush,
+ CZipArchive::GetArchivePath,
+ CZipArchive::GetCentralDirInfo,
+ CZipArchive::GetCentralDirSize,
+ CZipArchive::GetCurrentDisk,
+ CZipArchive::GetFileInfo,
+ CZipArchive::GetFindFastIndex,
+ CZipArchive::GetGlobalComment,
+ CZipArchive::GetCount,
+ CZipArchive::GetPassword,
+ CZipArchive::GetSpanMode,
+ CZipArchive::IsClosed,
+ CZipArchive::IsReadOnly,
+ CZipArchive::Open,
+ CZipArchive::RenameFile,
+ CZipArchive::PredictExtractedFileName,
+ CZipArchive::SetAdvanced,
+ CZipArchive::SetCallback,
+ CZipArchive::SetFileComment,
+ CZipArchive::SetGlobalComment,
+ CZipArchive::SetIgnoreCRC,
+ CZipArchive::SetPassword,
+ CZipArchive::SetRootPath,
+ CZipArchive::SetSpanCallback,
+ CZipArchive::SetTempPath,
+ CZipArchive::TestFile,
+ CZipArchive::WillBeDuplicated,
+ CZipFileHeader::IsEncrypted,
+ CZipFileHeader::IsDirectory,
+ CZipFileHeader::GetTime,
+ CZipFileHeader::GetSystemCompatibility,
+ CZipFileHeader::GetSystemAttr,
+ CZipFileHeader::GetSize,
+ CZipFileHeader::GetFileName,
+ CZipFileHeader::GetEffComprSize,
+ CZipFileHeader::GetCompressionRatio,
+ CZipFileHeader::GetComment,
+ CZipFileHeader::CompressionEfficient,
+
+
*/
@@ -315,15 +359,17 @@ for the archive to be intact.
\section sectSpan Multi-disk archives
-This library supports two kinds of multi-disk archives:
+This library can create multi-disk archives in two ways (modes):
-- Disk spanning that is performed in the compatible way with all other main zip programs. It means that:
+\anchor PKSpan
+- PKSpan mode. Disk spanning is performed in the compatible way with all other main zip programs. It means that:
- the archive can only be created on a removable device,
- the size of the volume is auto-detected
- the label is written to the disk
- you need to define a callback functor for changing disks and set it with CZipArchive::SetSpanCallback function.
-- Disk spanning that is performed in the internal mode, called in the sources TDSpan mode and it means that:
+\anchor TDSpan
+- TDSpan mode. Disk spanning is performed in the internal mode. It means that:
- the archive can be created on non-removable device as well
- you need to define the single volume size
- there is no need to set callback functor in this mode.
@@ -334,7 +380,7 @@ These two disk spanning modes create volumes with compatible internal structure.
There is a limited functions set available while working with multi-disk archives. Only adding is allowed when creating the archive and only extracting and testing after opening an existing one. Deleting files from these archives is not allowed at all.
-Class CZipArchive uses write buffer to make write operations as fast as possible. You can change its size with CZipArchive::SetAdvanced function. While creating a multi-disk archive, set the size of the buffer to the maximum size of the volume for the best performance.
+Class CZipArchive uses write buffer to make write operations as fast as possible. You can change its size with CZipArchive::SetAdvanced function (first argument). While creating a multi-disk archive, set the size of the buffer to the maximum size of the volume for the best performance.
The popular archivers such as PKZIP and WinZip cannot operate on archive in TDSpan mode. You need to convert them to PKZIP span mode (\ref convertZips "have a look above"). Remember about copying the files to the removable media (it does not comply with Winzip, which can extract a multi-disk archive from any media but only from the fixed location on the drive).
@@ -374,8 +420,8 @@ int nCmdShow)
//
// class CBrowseForFolder is included in the sample application project
// remember about including the header!
- zip.Open(szBuff, CZipArchive::openReadOnly);
- // openReadOnly mode is necessary for self extract archives
+ zip.Open(szBuff, CZipArchive::zipOpenReadOnly);
+ // zipOpenReadOnly mode is necessary for self extract archives
for (WORD i = 0; i < zip.GetCount(); i++)
zip.ExtractFile(i, szDest);
@@ -393,8 +439,10 @@ After compiling it and appending a zip archive to it (e.g. with the DOS command:
\section sectExc Exceptions
-\subsection excmfc MFX version
-The library throws the following exceptions inherited from \c CException: \c CMemoryException*, \c CFileExeption* and \c CZipException*. The first two don't need an explanation. The last is thrown when some internal error occurs. Handling them may be done in the following way:
+The ZipArchive library mostly uses exceptions to notify about the error occured. The library throws CZipException to notify about errors specific to the internal zip file processing. In the MFC version CZipException class is derived from CException whereas in the STL version it is derived from std::exception.
+
+\subsection excmfc MFC version
+The library throws the following exceptions inherited from \c CException: \c CMemoryException*, \c CFileExeption* and \c CZipException* (be sure to delete the object when you done with it). Handling them may be done in the following way:
\code
@@ -570,7 +618,8 @@ be a lengthy process.
\page pageSubsc ZipArchive Newsletter
To be notified about ZipArchive library updates, enter your
-e-mail into the input field below and press \e Subscribe! button.
+e-mail into the input field below and press \e Subscribe! button.
+You should receive a confirmation message then.
\htmlonly
@@ -593,4 +642,4 @@ following the link that you will receive with every newsletter.
\endhtmlonly
*/
-
+
\ No newline at end of file
diff --git a/stepmania/src/smpackage/ZipArchive/StdAfx.cpp b/stepmania/src/smpackage/ZipArchive/StdAfx.cpp
index feaf620604..98e3f3d000 100644
--- a/stepmania/src/smpackage/ZipArchive/StdAfx.cpp
+++ b/stepmania/src/smpackage/ZipArchive/StdAfx.cpp
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/stepmania/src/smpackage/ZipArchive/StdAfx.h b/stepmania/src/smpackage/ZipArchive/StdAfx.h
index ea94a961f8..5d0ffb6dc2 100644
--- a/stepmania/src/smpackage/ZipArchive/StdAfx.h
+++ b/stepmania/src/smpackage/ZipArchive/StdAfx.h
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -22,10 +22,18 @@
#pragma once
#endif // _MSC_VER > 1000
-#ifdef __BORLANDC__
-#define ZIPINLINE
-#else
+#if _MSC_VER < 1300 && !defined __BORLANDC__
#define ZIPINLINE inline
+#else
+#define ZIPINLINE
+#endif
+
+#if _MSC_VER >= 1300
+#define ZIP_ULONGLONG ULONGLONG
+#define ZIP_LONGLONG LONGLONG
+#else
+#define ZIP_ULONGLONG DWORD
+#define ZIP_LONGLONG LONG
#endif
#define ZIP_ARCHIVE_MFC
diff --git a/stepmania/src/smpackage/ZipArchive/Windows/ZipFileMapping.h b/stepmania/src/smpackage/ZipArchive/Windows/ZipFileMapping.h
index 6d1dd50e2c..1ab8cd711a 100644
--- a/stepmania/src/smpackage/ZipArchive/Windows/ZipFileMapping.h
+++ b/stepmania/src/smpackage/ZipArchive/Windows/ZipFileMapping.h
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -36,11 +36,11 @@ namespace ziparchv
m_hFileMap = NULL;
m_pFileMap = NULL;
}
- bool CreateMapping(CZipFile* pFile)
+ bool CreateMapping(CZipFile* pFile)
{
if (!pFile)
return false;
- m_hFileMap = CreateFileMapping((HANDLE)pFile->operator HFILE(), NULL, PAGE_READWRITE,
+ m_hFileMap = CreateFileMapping((*pFile), NULL, PAGE_READWRITE,
0, 0, _T("ZipArchive Mapping File"));
if (!m_hFileMap)
return false;
diff --git a/stepmania/src/smpackage/ZipArchive/Windows/ZipPathComponent.cpp b/stepmania/src/smpackage/ZipArchive/Windows/ZipPathComponent.cpp
index 1976e23d1b..e259ded573 100644
--- a/stepmania/src/smpackage/ZipArchive/Windows/ZipPathComponent.cpp
+++ b/stepmania/src/smpackage/ZipArchive/Windows/ZipPathComponent.cpp
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/stepmania/src/smpackage/ZipArchive/Windows/ZipPlatform.cpp b/stepmania/src/smpackage/ZipArchive/Windows/ZipPlatform.cpp
index 0affb9e3a1..b2176e9bd0 100644
--- a/stepmania/src/smpackage/ZipArchive/Windows/ZipPlatform.cpp
+++ b/stepmania/src/smpackage/ZipArchive/Windows/ZipPlatform.cpp
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -165,7 +165,7 @@ bool ZipPlatform::SetFileModTime(LPCTSTR lpFileName, time_t ttime)
{
struct _utimbuf ub;
ub.actime = time(NULL);
- ub.modtime = ttime;
+ ub.modtime = ttime == -1 ? time(NULL) : ttime; // if wrong file time, set it to the current
return _tutime(lpFileName, &ub) == 0;
}
diff --git a/stepmania/src/smpackage/ZipArchive/ZipAbstractFile.h b/stepmania/src/smpackage/ZipArchive/ZipAbstractFile.h
index 3c1c83c2a5..20c84622a5 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipAbstractFile.h
+++ b/stepmania/src/smpackage/ZipArchive/ZipAbstractFile.h
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -20,8 +20,10 @@
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
+#include "ZipExport.h"
#include "ZipString.h"
-class CZipAbstractFile
+
+class ZIP_API CZipAbstractFile
{
public:
@@ -33,16 +35,16 @@ public:
virtual bool Open(LPCTSTR , UINT , bool ){return true;}
virtual void Close() = 0;
virtual void Flush() = 0;
- virtual DWORD GetPosition() const = 0;
- virtual void SeekToBegin(){Seek(0, begin);}
- virtual void SeekToEnd(){Seek(0, end);}
- virtual CZipString GetFilePath() const = 0;
- virtual void SetLength(long nNewLen) = 0;
+ virtual ZIP_ULONGLONG GetPosition() const = 0;
+ virtual ZIP_ULONGLONG Seek(ZIP_LONGLONG lOff, int nFrom) = 0;
+ virtual ZIP_ULONGLONG GetLength() const = 0;
+ virtual void SetLength(ZIP_ULONGLONG nNewLen) = 0;
+ virtual ZIP_ULONGLONG SeekToBegin(){return Seek(0, begin);}
+ virtual ZIP_ULONGLONG SeekToEnd(){return Seek(0, end);}
+ virtual CZipString GetFilePath() const = 0;
virtual UINT Read(void *lpBuf, UINT nCount) = 0;
- virtual void Write(const void* lpBuf, UINT nCount) = 0;
- virtual long Seek(long lOff, int nFrom) = 0;
- virtual bool IsClosed() const = 0;
- virtual DWORD GetLength() const = 0;
+ virtual void Write(const void* lpBuf, UINT nCount) = 0;
+ virtual bool IsClosed() const = 0;
virtual ~CZipAbstractFile(){};
};
diff --git a/stepmania/src/smpackage/ZipArchive/ZipArchive.cpp b/stepmania/src/smpackage/ZipArchive/ZipArchive.cpp
index 49a03866fa..32596f1dee 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipArchive.cpp
+++ b/stepmania/src/smpackage/ZipArchive/ZipArchive.cpp
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -35,13 +35,25 @@
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
+#define ZIP_COMPR_REPL_MASK 0xffffff00
+#define ZIP_COMPR_REPL_SIGN 0x0100 // first 8 bits should be 00 (reserved for compression level), next 8 should be different from ff (to distinguish from -1)
+
+const TCHAR CZipArchive::m_gszCopyright[] = {_T("ZipArchive library Copyright 2000 - 2003 Tadeusz Dracz")};
-const TCHAR CZipArchive::m_gszCopyright[] = {_T("ZipArchive library Copyright 2000 - 2002 Tadeusz Dracz")};
+void CZipAddNewFileInfo::Defaults()
+{
+ m_iSmartLevel = CZipArchive::zipsmSafeSmart;
+ m_iReplaceIndex = -1;
+ m_nBufSize = 65536;
+ m_iComprLevel = -1; // default
+
+}
+
CZipArchive::CZipArchive()
{
- m_bDetectZlibMemoryLeaks = true;
+ m_bRemoveDriveLetter = m_bDetectZlibMemoryLeaks = true;
m_bIgnoreCRC = m_bAutoFlush = false;
m_centralDir.m_pStorage= &m_storage;
m_info.m_stream.zalloc = (alloc_func)_zliballoc;
@@ -321,17 +333,22 @@ DWORD CZipArchive::ReadFile(void *pBuf,
while (m_info.m_stream.avail_out > 0 || (bForce && m_info.m_uComprLeft > 0))
{
if ((m_info.m_stream.avail_in == 0) &&
- (m_info.m_uComprLeft > 0))
+ (m_info.m_uComprLeft >= 0)) // Also when there are zero bytes left!
{
DWORD uToRead = m_info.m_pBuffer.GetSize();
if (m_info.m_uComprLeft < uToRead)
uToRead = m_info.m_uComprLeft;
if (uToRead == 0)
- return 0;
-
- m_storage.Read(m_info.m_pBuffer, uToRead, false);
- CryptDecodeBuffer(uToRead);
+ {
+ uToRead = 1; // Add dummy byte at end of compressed data.
+ }
+ else
+ {
+ m_storage.Read(m_info.m_pBuffer, uToRead, false);
+ CryptDecodeBuffer(uToRead);
+ }
+
m_info.m_uComprLeft -= uToRead;
m_info.m_stream.next_in = (Bytef*)(char*)m_info.m_pBuffer;
@@ -377,7 +394,7 @@ DWORD CZipArchive::ReadFile(void *pBuf,
return iRead;
}
-void CZipArchive::Close(int iAfterException)
+void CZipArchive::Close(int iAfterException, bool bUpdateTimeStamp)
{
// if after an exception - the archive may be closed, but the file may be opened
if (IsClosed() && (!iAfterException || IsClosed(false)))
@@ -395,21 +412,34 @@ void CZipArchive::Close(int iAfterException)
if (iAfterException != afAfterException && !IsClosed(false)) // in disk spanning when user aborts
WriteCentralDirectory(false); // we will flush in CZipStorage::Close
+ time_t tNewestTime = 0;
+
+ if (bUpdateTimeStamp)
+ {
+ int iSize = m_centralDir.m_headers.GetSize();
+ for (int i = 0; i< iSize; i++)
+ {
+ time_t tFileInZipTime = m_centralDir[i]->GetTime();
+ if (tFileInZipTime > tNewestTime)
+ tNewestTime = tFileInZipTime;
+ }
+ }
m_centralDir.Clear();
- m_storage.Close(iAfterException == afAfterException);
-
+ CZipString szFileName = m_storage.Close(iAfterException == afAfterException);
+ if (bUpdateTimeStamp && !szFileName.IsEmpty())
+ ZipPlatform::SetFileModTime(szFileName, tNewestTime);
}
void CZipArchive::WriteCentralDirectory(bool bFlush)
{
- m_centralDir.Write(m_callbacks.Get(cbSave));
+ m_centralDir.Write(GetCallback(cbSave));
if (bFlush)
m_storage.Flush();
}
void CZipArchive::SetCallback(CZipActionCallback* pCallback, int iWhich)
{
- CallbackType cbs[] = {cbAdd, cbAddTmp, cbAddStore,cbExtract,cbDeleteCnt,cbDelete,cbTest,cbSave};
+ CallbackType cbs[] = {cbAdd, cbAddTmp, cbAddStore,cbExtract,cbDeleteCnt,cbDelete,cbTest,cbSave, cbGetFromArchive, cbRename, cbReplace};
int iCount = sizeof(cbs)/sizeof(CallbackType);
for (int i = 0; i < iCount; i++)
{
@@ -419,7 +449,7 @@ void CZipArchive::SetCallback(CZipActionCallback* pCallback, int iWhich)
}
}
-void CZipArchive::SetAdvanced(int iWriteBuffer, int iExtractBuffer, int iSearchBuffer)
+void CZipArchive::SetAdvanced(int iWriteBuffer, int iGeneralBuffer, int iSearchBuffer)
{
if (!IsClosed())
{
@@ -428,7 +458,7 @@ void CZipArchive::SetAdvanced(int iWriteBuffer, int iExtractBuffer, int iSearchB
}
m_storage.m_iWriteBufferSize = iWriteBuffer < 1024 ? 1024 : iWriteBuffer;
- m_info.m_iBufferSize = iExtractBuffer < 1024 ? 1024 : iExtractBuffer;
+ m_info.m_iBufferSize = iGeneralBuffer < 1024 ? 1024 : iGeneralBuffer;
m_centralDir.m_iBufferSize = iSearchBuffer < 1024 ? 1024 : iSearchBuffer;
}
@@ -476,14 +506,14 @@ int CZipArchive::CloseFile(LPCTSTR lpszFilePath, bool bAfterException)
m_centralDir.CloseFile(bAfterException);
m_iFileOpened = nothing;
- m_info.m_pBuffer.Release();
+ m_info.ReleaseBuf();
EmptyPtrList();
return iRet;
}
bool CZipArchive::OpenNewFile(CZipFileHeader & header,
int iLevel,
- LPCTSTR lpszFilePath)
+ LPCTSTR lpszFilePath, DWORD uInternal)
{
if (IsClosed())
{
@@ -499,7 +529,7 @@ bool CZipArchive::OpenNewFile(CZipFileHeader & header,
if (m_storage.IsSpanMode() == -1)
{
- TRACE(_T("%s(%i) : You cannot add the files to the existing disk spannig archive.\n"),__FILE__,__LINE__);
+ TRACE(_T("%s(%i) : You cannot add files to the existing disk spannig archive.\n"),__FILE__,__LINE__);
return false;
}
@@ -534,51 +564,75 @@ bool CZipArchive::OpenNewFile(CZipFileHeader & header,
header.SetSystemCompatibility(m_iArchiveSystCompatib);
CZipString szFileName = header.GetFileName();
- if (szFileName.IsEmpty())
- {
- szFileName.Format(_T("file%i"), GetCount());
- header.SetFileName(szFileName);
- }
+
bool bIsDirectory = header.IsDirectory();
if (bIsDirectory)
{
- CZipString szEnding = szFileName.Right(1);
- if (szEnding != _T("/") && szEnding != _T("\\"))
+ int iNameLen = szFileName.GetLength();
+ if (!iNameLen || !CZipPathComponent::IsSeparator(szFileName[iNameLen-1]))
{
szFileName += CZipPathComponent::m_cSeparator;
header.SetFileName(szFileName);
}
}
-
+ if (szFileName.IsEmpty())
+ {
+ szFileName.Format(_T("file%i"), GetCount());
+ header.SetFileName(szFileName);
+ }
+
// make sure that all slashes are correct (as the current system default)
// because AddNewFile calls InsertFindFastElement if necessary and
// the find array keeps all the files already converted to the current system standards
// we do not perform Oem->Ansi here, because who would pass oem values here?
//
ZipCompatibility::SlashBackslashChg(header.m_pszFileName, true);
- m_centralDir.AddNewFile(header);
- // this ensures the conversion will take place anyway (must take because we are going
- // to write the local header in a moment
- m_centralDir.ConvertFileName(false, m_centralDir.m_bConvertAfterOpen);
-
-
-
bool bEncrypted = m_pszPassword.GetSize() != 0;
#ifdef _DEBUG
if (bIsDirectory && bEncrypted)
- TRACE(_T("%s(%i) : Warning! Encrypting a directory. It's pointless.\n\
- Clear the password before adding a directory.\n"),__FILE__,__LINE__);
-#endif
+ TRACE(_T("%s(%i) : Encrypting a directory. It's pointless.\n\
+ Clear the password before adding a directory.\n"),__FILE__,__LINE__);
+#endif
+
+
+
+ int iReplaceIndex = -1;
+ bool bReplace = (iLevel & 0xffff) == ZIP_COMPR_REPL_SIGN;
+ if (bReplace)
+ {
+ int iMask = ZIP_COMPR_REPL_MASK;
+ iReplaceIndex = (iLevel & iMask) >> 16;
+ iLevel = (char)(iLevel & ~iMask);
+ ASSERT(iLevel == 0);
+ }
+ else
+ uInternal = 0;
if (iLevel < -1 || iLevel > 9)
- iLevel = -1;
+ iLevel = -1;
- if (!CurrentFile()->PrepareData(iLevel, m_storage.IsSpanMode() == 1, bEncrypted))
- ThrowError(CZipException::tooLongFileName);
+ if (!header.PrepareData(iLevel, m_storage.IsSpanMode() == 1, bEncrypted))
+ ThrowError(CZipException::tooLongFileName);
+
+ if (bReplace)
+ {
+ uInternal += header.GetSize(true);
+ if (header.IsEncrypted())
+ uInternal += ZIPARCHIVE_ENCR_HEADER_LEN;
+ if (header.IsDataDescr())
+ uInternal += ZIPARCHIVE_DATADESCRIPTOR_LEN + 4; // CZipCentralDir::CloseNewFile
+ }
+ m_centralDir.AddNewFile(header, iReplaceIndex);
+ if (bReplace)
+ MakeSpaceForReplace(iReplaceIndex, uInternal, szFileName);
+
+ // this ensures the conversion will take place anyway (must take because we are going
+ // to write the local header in a moment
+ m_centralDir.ConvertFileName(false, m_centralDir.m_bConvertAfterOpen);
CurrentFile()->WriteLocal(m_storage);
@@ -634,7 +688,7 @@ bool CZipArchive::ExtractFile(WORD uIndex,
GetFileInfo(header, uIndex); // to ensure that slash and oem conversions take place
CZipString szFileNameInZip = (LPCTSTR)header.GetFileName();
CZipString szFile = PredictExtractedFileName(szFileNameInZip, lpszPath, bFullPath, lpszNewName);
- CZipActionCallback* pCallback = m_callbacks.Get(cbExtract);
+ CZipActionCallback* pCallback = GetCallback(cbExtract);
if (pCallback)
pCallback->Init(szFileNameInZip, szFile);
@@ -708,7 +762,7 @@ bool CZipArchive::ExtractFile(WORD uIndex,
CZipFileHeader header;
GetFileInfo(header, uIndex); // to ensure that slash and oem conversions take place
- CZipActionCallback* pCallback = m_callbacks.Get(cbExtract);
+ CZipActionCallback* pCallback = GetCallback(cbExtract);
if (pCallback)
{
pCallback->Init(header.GetFileName());
@@ -877,7 +931,7 @@ bool CZipArchive::CloseNewFile(bool bAfterException)
m_centralDir.m_pOpenedFile = NULL;
m_iFileOpened = nothing;
- m_info.m_pBuffer.Release();
+ m_info.ReleaseBuf();
EmptyPtrList();
if (m_bAutoFlush && !bAfterException)
@@ -893,19 +947,26 @@ void CZipArchive::DeleteFile(WORD uIndex)
DeleteFiles(indexes);
}
-
-void CZipArchive::DeleteFiles(const CZipStringArray &aNames, bool bFileNameOnly)
+void CZipArchive::GetIndexes(const CZipStringArray &aNames, CZipWordArray& aIndexes)
{
- CZipWordArray indexes;
-
+ if (IsClosed())
+ {
+ TRACE(_T("%s(%i) : ZipArchive is closed.\n"),__FILE__,__LINE__);
+ return;
+ }
int iSize = aNames.GetSize();
for (WORD i = 0; i < iSize; i++)
{
- int idx = FindFile(aNames[i], ffDefault, bFileNameOnly);
+ int idx = FindFile(aNames[i], ffDefault, false);
if (idx != -1)
- indexes.Add((WORD)idx);
- }
-
+ aIndexes.Add((WORD)idx);
+ }
+}
+
+void CZipArchive::DeleteFiles(const CZipStringArray &aNames)
+{
+ CZipWordArray indexes;
+ GetIndexes(aNames, indexes);
DeleteFiles(indexes);
}
@@ -930,7 +991,7 @@ void CZipArchive::DeleteFiles(CZipWordArray &aIndexes)
return;
}
- CZipActionCallback* pCallback = m_callbacks.Get(cbDeleteCnt);
+ CZipActionCallback* pCallback = GetCallback(cbDeleteCnt);
if (pCallback)
pCallback->Init();
@@ -941,13 +1002,13 @@ void CZipArchive::DeleteFiles(CZipWordArray &aIndexes)
return;
}
- // remove all - that's easy so don't waste a time
+ // remove all - that's easy so don't waste the time
if (uSize == GetCount())
{
- pCallback = m_callbacks.Get(cbDelete);
+ pCallback = GetCallback(cbDelete);
if (pCallback)
{
- // make this formal
+ // do it right and sent the notification
pCallback->Init();
pCallback->SetTotal(uSize);
}
@@ -1001,11 +1062,11 @@ void CZipArchive::DeleteFiles(CZipWordArray &aIndexes)
return;
// now we start deleting (not safe to break)
- pCallback = m_callbacks.Get(cbDelete);
+ pCallback = GetCallback(cbDelete);
if (pCallback)
pCallback->Init();
- m_storage.Flush();
+
m_centralDir.RemoveFromDisk();
DWORD uTotalToMoveBytes = 0, uLastOffset = m_storage.m_pFile->GetLength() - m_centralDir.GetBytesBefore();
@@ -1031,6 +1092,7 @@ void CZipArchive::DeleteFiles(CZipWordArray &aIndexes)
for (i = 0; i < uSize; i++)
{
const CZipDeleteInfo& di = aInfo[i];
+
if (di.m_bDelete)
{
// next hole
@@ -1039,7 +1101,7 @@ void CZipArchive::DeleteFiles(CZipWordArray &aIndexes)
if (uOffsetStart)
{
// copy the files over a previous holes
- MovePackedFiles(uOffsetStart, uTemp, uMoveBy);
+ MovePackedFiles(uOffsetStart, uTemp, uMoveBy, pCallback);
uOffsetStart = 0; // never be at the beginning, because the first file is always to be deleted
}
if (i == uSize - 1)
@@ -1061,9 +1123,9 @@ void CZipArchive::DeleteFiles(CZipWordArray &aIndexes)
if (uOffsetStart)
MovePackedFiles(uOffsetStart,
m_storage.m_pFile->GetLength() - m_centralDir.GetBytesBefore(),
- uMoveBy);
+ uMoveBy, pCallback);
- m_info.m_pBuffer.Release();
+ m_info.ReleaseBuf();
if (uMoveBy) // just in case
m_storage.m_pFile->SetLength(m_storage.m_pFile->GetLength() - uMoveBy);
@@ -1074,148 +1136,172 @@ void CZipArchive::DeleteFiles(CZipWordArray &aIndexes)
Flush();
}
-bool CZipArchive::MovePackedFiles(DWORD uStartOffset, DWORD uEndOffset, DWORD uMoveBy)
-{
- uStartOffset += m_centralDir.GetBytesBefore();
- uEndOffset += m_centralDir.GetBytesBefore();
-
-
- DWORD uTotalToMove = uEndOffset - uStartOffset;
- DWORD uPack = uTotalToMove > m_info.m_pBuffer.GetSize() ? m_info.m_pBuffer.GetSize() : uTotalToMove;
- char* buf = (char*)m_info.m_pBuffer;
-
- DWORD TotalMoved = 0;
- DWORD size_read;
- CZipActionCallback* pCallback = m_callbacks.Get(cbDelete); // already initiated
-
- do
- {
- m_storage.m_pFile->Seek(uStartOffset + TotalMoved, CZipAbstractFile::begin);
- size_read = m_storage.m_pFile->Read(buf, uPack);
- if (size_read > 0)
- {
- if (TotalMoved + size_read > uTotalToMove)
- size_read = uTotalToMove - TotalMoved;
- m_storage.m_pFile->Seek(uStartOffset + TotalMoved - uMoveBy, CZipAbstractFile::begin);
- m_storage.m_pFile->Write(buf, size_read);
- TotalMoved += size_read;
- if (pCallback)
- if (!(*pCallback)(size_read))
- ThrowError(CZipException::abortedAction);
- }
-
- }
- while (size_read);
-
- return true;
-}
bool CZipArchive::AddNewFile(LPCTSTR lpszFilePath,
- int iLevel,
+ int iComprLevel,
bool bFullPath,
int iSmartLevel,
unsigned long nBufSize)
{
-
- CZipString szFilePath(lpszFilePath);
- CZipPathComponent::RemoveSeparators(szFilePath);
- CZipPathComponent zpc(szFilePath);
-
- return AddNewFile(lpszFilePath, (LPCTSTR) (bFullPath ? zpc.GetNoDrive() : TrimRootPath(zpc)),
- iLevel, iSmartLevel, nBufSize);
-
+ CZipAddNewFileInfo zanfi (lpszFilePath, bFullPath);
+ zanfi.m_iComprLevel = iComprLevel;
+ zanfi.m_iSmartLevel = zipsmSafeSmart;
+ zanfi.m_nBufSize = nBufSize;
+ return AddNewFile(zanfi);
}
-
bool CZipArchive::AddNewFile(LPCTSTR lpszFilePath,
LPCTSTR lpszFileNameInZip,
- int iLevel,
+ int iComprLevel,
int iSmartLevel,
unsigned long nBufSize)
{
+ CZipAddNewFileInfo zanfi(lpszFilePath, lpszFileNameInZip);
+ zanfi.m_iComprLevel = iComprLevel;
+ zanfi.m_iSmartLevel = zipsmSafeSmart;
+ zanfi.m_nBufSize = nBufSize;
+ return AddNewFile(zanfi);
+}
- if (!nBufSize)
- return false;
+bool CZipArchive::AddNewFile(CZipMemFile& mf,
+ LPCTSTR lpszFileNameInZip,
+ int iComprLevel,
+ int iSmartLevel,
+ unsigned long nBufSize)
+{
+ CZipAddNewFileInfo zanfi(&mf, lpszFileNameInZip);
+ zanfi.m_iComprLevel = iComprLevel;
+ zanfi.m_iSmartLevel = zipsmSafeSmart;
+ zanfi.m_nBufSize = nBufSize;
+ return AddNewFile(zanfi);
+}
- CZipActionCallback* pCallback = m_callbacks.Get((iSmartLevel & zipsmInternal01) ? cbAddStore : cbAdd);
- if (pCallback)
- pCallback->Init(lpszFileNameInZip, lpszFilePath);
+bool CZipArchive::AddNewFile(CZipAddNewFileInfo& info)
+{
+ // no need for ASSERT and TRACE here - it will be done by OpenNewFile
- CZipString szFilePath(lpszFilePath);
- CZipPathComponent::RemoveSeparators(szFilePath);
- if (szFilePath.IsEmpty())
+ if (!m_info.m_iBufferSize)
return false;
+ CZipPathComponent::RemoveSeparators(info.m_szFilePath);
+ if (!info.m_szFilePath.IsEmpty()) // it may be empty after removing sep.
+ {
+ if (info.m_szFileNameInZip.IsEmpty())
+ {
+ CZipPathComponent zpc(info.m_szFilePath);
+ if (info.m_bFullPath)
+ {
+ if (m_bRemoveDriveLetter)
+ info.m_szFileNameInZip = zpc.GetNoDrive();
+ }
+ else
+ info.m_szFileNameInZip = TrimRootPath(zpc);
+ }
+ }
+ else if (!info.m_pFile)
+ return false;
+
+ bool bSpan = GetSpanMode() != 0;
+
+ // checking the iReplace index
+ if (!UpdateReplaceIndex(info.m_iReplaceIndex, info.m_szFileNameInZip))
+ return false;
+
+ bool bReplace = info.m_iReplaceIndex >= 0;
DWORD uAttr;
time_t ttime;
- if (!ZipPlatform::GetFileAttr(szFilePath, uAttr))
- return false;
- if (!ZipPlatform::GetFileModTime(szFilePath, ttime))
+ if (info.m_pFile)
+ {
+ uAttr = ZipPlatform::GetDefaultAttributes();
ttime = time(NULL);
-
+ }
+ else
+ {
+ if (!ZipPlatform::GetFileAttr(info.m_szFilePath, uAttr))
+ return false; // we don't know whether it is a file or a directory
+ if (!ZipPlatform::GetFileModTime(info.m_szFilePath, ttime))
+ ttime = time(NULL);
+ }
CZipFileHeader header;
- header.SetFileName(lpszFileNameInZip);
+ header.SetFileName(info.m_szFileNameInZip);
if (ZipPlatform::GetSystemID() != ZipCompatibility::zcUnix)
uAttr |= ZipCompatibility::ConvertToSystem(uAttr, ZipPlatform::GetSystemID(), ZipCompatibility::zcUnix); // make it readable under Unix as well, since it stores its attributes in HIWORD(uAttr)
SetFileHeaderAttr(header, uAttr);
header.SetTime(ttime);
-
- if (header.IsDirectory())
+ bool bInternal = (info.m_iSmartLevel & zipsmInternal01) != 0;
+ CZipActionCallback* pCallback = NULL;
+ if (!bInternal)
{
+ pCallback = GetCallback(cbAdd);
if (pCallback)
- pCallback->SetTotal(0); // in case of calling LeftToDo afterwards
+ pCallback->Init(info.m_szFileNameInZip, info.m_szFilePath);
+ }
+
+
+
+ if (header.IsDirectory()) // will never be when m_pFile is not NULL, so we don't check it
+ {
+ ASSERT(!info.m_pFile); // should never happened
+ ASSERT(!bInternal);
+
+ if (pCallback)
+ pCallback->SetTotal(0); // in case of calling LeftToDo afterwards
// clear password for a directory
bool bRet = false;
CZipSmClrPass smcp;
- if (iSmartLevel & zipsmCPassDir)
+ if (info.m_iSmartLevel & zipsmCPassDir)
smcp.ClearPasswordSmartly(this);
- bRet = OpenNewFile(header, 0);
- CloseNewFile();
+ bRet = OpenNewFile(header, bReplace ? (info.m_iReplaceIndex << 16) | ZIP_COMPR_REPL_SIGN : 0);
+
+ CloseNewFile();
if (pCallback)
pCallback->CallbackEnd();
-
- return bRet;
+
+ return bRet;
}
-
- DWORD iFileSize = DWORD(-1);
+
CZipSmClrPass smcp;
- bool bEff = (iSmartLevel & zipsmCheckForEff)&& (iLevel != 0);
- bool bSpan = GetSpanMode() != 0;
- if (((iSmartLevel & zipsmCPFile0) && !GetPassword().IsEmpty())
- || ((iSmartLevel & zipsmNotCompSmall) && iLevel != 0)
- || (bEff && bSpan))
+ bool bIsCompression = info.m_iComprLevel != 0;
+ bool bEff = (info.m_iSmartLevel & zipsmCheckForEff)&& bIsCompression;
+ bool bCheckForZeroSized = (info.m_iSmartLevel & zipsmCPFile0) && !GetPassword().IsEmpty();
+ bool bCheckForSmallFiles = (info.m_iSmartLevel & zipsmNotCompSmall) && bIsCompression;
+ DWORD iFileSize = DWORD(-1);
+ bool bNeedTempArchive = (bEff && bSpan) || (bReplace && bIsCompression);
+ if (bCheckForSmallFiles || bCheckForZeroSized || bNeedTempArchive)
{
- if (ZipPlatform::GetFileSize(szFilePath, iFileSize))
+ if (info.m_pFile)
+ iFileSize = info.m_pFile->GetLength();
+ else
{
- if ((iSmartLevel & zipsmNotCompSmall) && iFileSize < 5)
- iLevel = 0;
- if ((iSmartLevel & zipsmCPFile0) && iFileSize == 0)
- smcp.ClearPasswordSmartly(this);
+ if (!ZipPlatform::GetFileSize(info.m_szFilePath, iFileSize) && bEff)
+ bEff = false; // the file size is needed only when eff. in span mode
+ }
+ if (iFileSize != DWORD(-1))
+ {
+ if (bCheckForZeroSized && iFileSize == 0)
+ smcp.ClearPasswordSmartly(this);
+ if (bCheckForSmallFiles && iFileSize < 5)
+ info.m_iComprLevel = 0;
}
- else if (bEff) // the file size is needed only when eff. in span mode
- bEff = false;
}
-
-
- bool bEffInMem = bEff && (iSmartLevel & zipsmMemoryFlag);
+ bool bEffInMem = bEff && (info.m_iSmartLevel & zipsmMemoryFlag);
CZipString szTempFileName;
- if (bSpan && bEff
- && (bEffInMem || !(szTempFileName = ZipPlatform::GetTmpFileName(
- m_szTempPath.IsEmpty() ? NULL : (LPCTSTR)m_szTempPath, iFileSize)).IsEmpty()))
-
+ if (bNeedTempArchive && (bEffInMem ||
+ !(szTempFileName = ZipPlatform::GetTmpFileName(
+ m_szTempPath.IsEmpty() ? NULL : (LPCTSTR)m_szTempPath, iFileSize)
+ ).IsEmpty()))
{
CZipMemFile* pmf = NULL;
CZipArchive zip;
try
{
// compress first to a temporary file, if ok - copy the data, if not - add storing
- bEff = false;
if (bEffInMem)
{
@@ -1227,83 +1313,41 @@ bool CZipArchive::AddNewFile(LPCTSTR lpszFilePath,
zip.SetRootPath(m_szRootPath);
zip.SetPassword(GetPassword());
zip.SetSystemCompatibility(m_iArchiveSystCompatib);
+ zip.SetCallback(pCallback, cbAdd);
// create a temporary file
- if (!zip.AddNewFile(szFilePath, lpszFileNameInZip, iLevel,
- zipsmLazy, nBufSize))
+ int iTempReplaceIndex = info.m_iReplaceIndex;
+ info.m_iSmartLevel = zipsmLazy;
+ info.m_iReplaceIndex = -1;
+ if (!zip.AddNewFile(info))
throw false;
- CZipFileHeader fh;
- zip.GetFileInfo(fh, 0);
- if (!fh.CompressionEfficient())
- // compression is pointless, store instead
- throw AddNewFile(szFilePath, lpszFileNameInZip, 0,
- zipsmInternal01, nBufSize);
+ info.m_iReplaceIndex = iTempReplaceIndex;
- CZipActionCallback* pCallbackTmp = m_callbacks.Get(cbAddTmp);
- if (pCallbackTmp)
+ // this may also happen when bReplace, but not in span mode
+ if (bEff)
{
- pCallbackTmp->Init(lpszFileNameInZip, lpszFilePath);
- pCallbackTmp->SetTotal(fh.m_uComprSize);
- }
-
- m_centralDir.ConvertFileName(false, m_centralDir.m_bConvertAfterOpen, &fh);
- fh.WriteLocal(m_storage); // must be written as converted
- CZipString szConvertedFileName;
- if (!m_centralDir.m_bConvertAfterOpen)
- szConvertedFileName = fh.GetFileName();
- fh.SetFileName(lpszFileNameInZip);
- CZipAbstractFile* pFile = zip.m_storage.m_pFile;
- // skip reading the local file header
- pFile->Seek(fh.GetSize(true), CZipAbstractFile::begin);
-
- DWORD iRead;
- CZipAutoBuffer buf(nBufSize);
-
-
- int iAborted = 0;
- do
- {
- iRead = pFile->Read(buf, nBufSize);
- if (iRead)
+ CZipFileHeader fh;
+ zip.GetFileInfo(fh, 0);
+ if (!fh.CompressionEfficient())
{
- m_storage.Write(buf, iRead, false);
- if (pCallbackTmp)
- if (!(*pCallbackTmp)(iRead))
- {
- // todo: we could remove here the bytes of the file partially added if not disk-spanning
- if (iRead == buf.GetSize() && pFile->Read(buf, 1) != 0) // test one byte if there is something left
- iAborted = CZipException::abortedAction;
- else
- iAborted = CZipException::abortedSafely; // we did it!
- break;
- }
-
+ info.m_iComprLevel = 0;
+ info.m_iSmartLevel = zipsmInternal01;
+ // compression is pointless, store instead
+ throw AddNewFile(info);
}
-
}
- while (iRead == buf.GetSize());
- if (iAborted != CZipException::abortedAction)
- {
- CZipFileHeader* pHeader = m_centralDir.AddNewFile(fh); // must not converted when adding because of InsertFastElement
- if (!m_centralDir.m_bConvertAfterOpen) // we keep it converted to internal zip standards
- pHeader->SetFileName(szConvertedFileName);
- }
-
- m_centralDir.m_pOpenedFile = NULL;
- if (pCallbackTmp)
- pCallbackTmp->CallbackEnd();
-
- if (iAborted)
- CZipException::Throw(iAborted); // throw to distuingiush from other return codes
-
- throw true;
+
+ m_info.Init();
+ throw GetFromArchive(zip, 0, info.m_iReplaceIndex, true, GetCallback(cbAddTmp));
}
catch (bool bRet)
{
+
zip.Close(!bRet); // that doesn't really matter how it will be closed
if (pmf)
delete pmf;
if (!bEffInMem)
ZipPlatform::RemoveFile(szTempFileName, false);
+ m_info.ReleaseBuf();
return bRet;
}
catch (...)
@@ -1313,29 +1357,68 @@ bool CZipArchive::AddNewFile(LPCTSTR lpszFilePath,
delete pmf;
if (!bEffInMem)
ZipPlatform::RemoveFile(szTempFileName, false);
+ m_info.ReleaseBuf();
throw;
}
}
-
// try to open before adding
CZipFile f;
- if (!f.Open(szFilePath, CZipFile::modeRead | CZipFile::shareDenyWrite, false))
- return false;
- // call init before opening (in case of exception we have the names)
- if (pCallback)
- pCallback->SetTotal(f.GetLength());
+ CZipAbstractFile *pf;
+ if (info.m_pFile)
+ pf = info.m_pFile;
+ else
+ {
+ // cannot be shareDenyWrite
+ // from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/creating_and_opening_files.asp :
+ // If you specify the GENERIC_READ and GENERIC_WRITE access modes along with the FILE_SHARE_READ and FILE_SHARE_WRITE sharing modes in your first call to CreateFile. If you specify the GENERIC_READ and GENERIC_WRITE access modes and the FILE_SHARE_READ sharing mode only in your second call to CreateFile, the function will fail with a sharing violation because the read-only sharing mode specified in the second call conflicts with the read/write access that has been granted in the first call.
+ if (!f.Open(info.m_szFilePath, CZipFile::modeRead | CZipFile::shareDenyNone, false))
+ {
+ if (pCallback)
+ pCallback->CallbackEnd();
+ return false;
+ }
+ pf = &f;
+ }
- if (!OpenNewFile(header, iLevel))
+ ASSERT(pf);
+ // call init before opening (in case of exception we have the names)
+ iFileSize = pf->GetLength();
+
+
+ bool bRet;
+ if (bReplace)
+ {
+ ASSERT(!bIsCompression);
+ bRet = OpenNewFile(header, (info.m_iReplaceIndex << 16) | ZIP_COMPR_REPL_SIGN , NULL, iFileSize);
+ }
+ else
+ bRet = OpenNewFile(header, info.m_iComprLevel);
+ if (!bRet)
+ {
+ if (pCallback)
+ pCallback->CallbackEnd();
+
return false;
-
-
- CZipAutoBuffer buf(nBufSize);
+ }
+ if (bInternal)
+ {
+ // we do it here, because if in OpenNewFile is replacing
+ // then we get called cbReplace callback before and it would
+ // overwrite callback information written in pCallback->Init
+ pCallback = GetCallback(cbAddStore);
+ if (pCallback)
+ pCallback->Init(info.m_szFileNameInZip, info.m_szFilePath);
+ }
+ if (pCallback)
+ pCallback->SetTotal(iFileSize);
+
+ CZipAutoBuffer buf(info.m_nBufSize);
DWORD iRead;
int iAborted = 0;
do
{
- iRead = f.Read(buf, nBufSize);
+ iRead = pf->Read(buf, info.m_nBufSize);
if (iRead)
{
WriteNewFile(buf, iRead);
@@ -1343,9 +1426,9 @@ bool CZipArchive::AddNewFile(LPCTSTR lpszFilePath,
if (!(*pCallback)(iRead))
{
// todo: we could remove here the bytes of the file partially added if not disk-spanning
- if (iRead == buf.GetSize() && f.Read(buf, 1) != 0) // test one byte if there is something left
+ if (iRead == buf.GetSize() && pf->Read(buf, 1) != 0) // test one byte if there is something left
{
- if (!m_storage.IsSpanMode())
+ if (!m_storage.IsSpanMode() && !bReplace)
{
RemoveLast(true);
CloseNewFile(true);
@@ -1361,247 +1444,43 @@ bool CZipArchive::AddNewFile(LPCTSTR lpszFilePath,
}
break;
}
-
- }
-
- }
- while (iRead == buf.GetSize());
- if (!iAborted)
- CloseNewFile();
-
- if (pCallback)
- pCallback->CallbackEnd();
-
- if (iAborted)
- CZipException::Throw(iAborted); // throw to distuingiush from other return codes
-
- if (bEff)
- {
- // remove the last file and add it without the compression if needed
- f.Close();
- buf.Release();
- if (RemoveLast())
- return AddNewFile(szFilePath, lpszFileNameInZip, 0,
- zipsmInternal01, nBufSize);
- }
- return true;
-}
-
-bool CZipArchive::AddNewFile(CZipMemFile& mf,
- LPCTSTR lpszFileNameInZip,
- int iLevel,
- int iSmartLevel,
- unsigned long nBufSize)
-{
-
- if (!nBufSize)
- return false;
-
- CZipActionCallback* pCallback = m_callbacks.Get((iSmartLevel & zipsmInternal01) ? cbAddStore : cbAdd);
- if (pCallback)
- pCallback->Init(lpszFileNameInZip);
-
- CZipFileHeader header;
- header.SetFileName(lpszFileNameInZip);
- SetFileHeaderAttr(header, ZipPlatform::GetDefaultAttributes());
- header.SetTime(time(NULL));
-
- DWORD iFileSize = mf.GetLength();
-
- CZipSmClrPass smcp;
- bool bEff = (iSmartLevel & zipsmCheckForEff)&& (iLevel != 0);
- bool bSpan = GetSpanMode() != 0;
-
-
- if ((iSmartLevel & zipsmNotCompSmall) && iLevel != 0 && iFileSize < 6)
- iLevel = 0;
- if ((iSmartLevel & zipsmCPFile0) && !GetPassword().IsEmpty() && iFileSize == 0)
- smcp.ClearPasswordSmartly(this);
-
- bool bEffInMem = bEff && (iSmartLevel & zipsmMemoryFlag);
- CZipString szTempFileName;
- if (bSpan && bEff
- && (bEffInMem || !(szTempFileName = ZipPlatform::GetTmpFileName(
- m_szTempPath.IsEmpty() ? NULL : (LPCTSTR)m_szTempPath, iFileSize)).IsEmpty()))
-
- {
- CZipMemFile* pmf = NULL;
- CZipArchive zip;
- try
- {
- // compress first to a temporary file or memory, if ok - copy the data, if not - add storing
- bEff = false;
-
- if (bEffInMem)
- {
- pmf = new CZipMemFile;
- zip.Open(*pmf, zipCreate);
- }
- else
- zip.Open(szTempFileName, zipCreate);
- zip.SetRootPath(m_szRootPath);
- zip.SetPassword(GetPassword());
- zip.SetSystemCompatibility(m_iArchiveSystCompatib);
- if (!zip.AddNewFile(mf, lpszFileNameInZip, iLevel,
- zipsmLazy, nBufSize))
- throw false;
- CZipFileHeader fh;
- zip.GetFileInfo(fh, 0);
- if (!fh.CompressionEfficient())
- // compression is pointless, store instead
- throw AddNewFile(mf, lpszFileNameInZip, 0,
- zipsmInternal01, nBufSize);
- // moving compressed data - new callback
- CZipActionCallback* pCallbackTmp = m_callbacks.Get(cbAddTmp);
- if (pCallbackTmp)
- {
- pCallbackTmp->Init(lpszFileNameInZip);
- pCallbackTmp->SetTotal(fh.m_uComprSize);
- }
-
-
-
- m_centralDir.ConvertFileName(false, m_centralDir.m_bConvertAfterOpen, &fh);
- fh.WriteLocal(m_storage); // must be written converted
- CZipString szConvertedFileName;
- if (!m_centralDir.m_bConvertAfterOpen)
- szConvertedFileName = fh.GetFileName();
- fh.SetFileName(lpszFileNameInZip);
- CZipAbstractFile* pFile = zip.m_storage.m_pFile;
- // skip reading the local file header
- pFile->Seek(fh.GetSize(true), CZipAbstractFile::begin);
-
- DWORD iRead;
- CZipAutoBuffer buf(nBufSize);
-
- int iAborted = 0;
- do
- {
- iRead = pFile->Read(buf, nBufSize);
- if (iRead)
- {
- m_storage.Write(buf, iRead, false);
- if (pCallbackTmp)
- if (!(*pCallbackTmp)(iRead))
- {
- if (iRead == buf.GetSize() && pFile->Read(buf, 1) != 0) // test one byte if there is something left
- iAborted = CZipException::abortedAction;
- else
- iAborted = CZipException::abortedSafely; // we did it!
- break;
- }
- }
- }
- while (iRead == buf.GetSize());
-
- if (iAborted != CZipException::abortedAction)
- {
- CZipFileHeader* pHeader = m_centralDir.AddNewFile(fh); // must not converted when adding because of InsertFastElement
- if (!m_centralDir.m_bConvertAfterOpen) // we keep it converted to internal zip standards
- pHeader->SetFileName(szConvertedFileName);
- }
-
- m_centralDir.m_pOpenedFile = NULL;
-
- if (pCallbackTmp)
- pCallbackTmp->CallbackEnd();
-
-
- if (iAborted)
- CZipException::Throw(iAborted); // throw to distuingiush from other return codes
-
- throw true;
- }
- catch (bool bRet)
- {
- zip.Close(!bRet); // that doesn't really matter how it will be closed
- if (pmf)
- delete pmf;
- if (!bEffInMem)
- ZipPlatform::RemoveFile(szTempFileName, false);
- return bRet;
- }
- catch (...)
- {
- zip.Close(true);
- if (pmf)
- delete pmf;
- if (!bEffInMem)
- ZipPlatform::RemoveFile(szTempFileName, false);
- throw;
- }
- }
-
- // normal adding
- if (pCallback)
- pCallback->SetTotal(mf.GetLength());
-
- if (!OpenNewFile(header, iLevel))
- return false;
-
-
- // we cannot Detach CZipMemFile here
- CZipAutoBuffer buf(nBufSize);
- mf.SeekToBegin();
- DWORD iRead;
- int iAborted = 0;
- do
- {
- iRead = mf.Read(buf, nBufSize);
- if (iRead)
- {
- WriteNewFile(buf, iRead);
- if (pCallback)
- if (!(*pCallback)(iRead))
- {
- if (iRead == buf.GetSize() && mf.Read(buf, 1) != 0) // test one byte if there is something left
- {
- if (!m_storage.IsSpanMode())
- {
- RemoveLast(true);
- CloseNewFile(true);
- iAborted = CZipException::abortedSafely;
- }
- else
- iAborted = CZipException::abortedAction;
- }
- else
- {
- iAborted = CZipException::abortedSafely; // we did it!
- CloseNewFile();
- }
- break;
- }
}
}
while (iRead == buf.GetSize());
if (!iAborted)
CloseNewFile();
-
+
if (pCallback)
pCallback->CallbackEnd();
-
-
+
if (iAborted)
- CZipException::Throw(iAborted); // throw to distuingiush from other return codes
-
+ CZipException::Throw(iAborted); // throw to distuinguish from other return codes
+
if (bEff)
{
// remove the last file and add it without the compression if needed
+ if (!info.m_pFile)
+ f.Close();
+
buf.Release();
if (RemoveLast())
- return AddNewFile(mf, lpszFileNameInZip, 0,
- zipsmInternal01, nBufSize);
+ {
+ info.m_iComprLevel = 0;
+ info.m_iSmartLevel = zipsmInternal01;
+ return AddNewFile(info);
+ }
}
return true;
+
}
-
bool CZipArchive::RemoveLast(bool bRemoveAnyway)
{
int iIndex = GetCount() - 1;
+ if (iIndex < 0)
+ return false;
CZipFileHeader* pHeader = m_centralDir[iIndex];
if (!bRemoveAnyway && pHeader->CompressionEfficient())
@@ -1823,7 +1702,7 @@ void CZipArchive::CloseFileAfterTestFailed()
TRACE(_T("%s(%i) : No file opened.\n"),__FILE__,__LINE__);
return;
}
- m_info.m_pBuffer.Release();
+ m_info.ReleaseBuf();
m_centralDir.Clear(false);
m_iFileOpened = nothing;
}
@@ -1839,7 +1718,7 @@ bool CZipArchive::TestFile(WORD uIndex, DWORD uBufSize)
return false;
CZipFileHeader* pHeader = m_centralDir[uIndex];
- CZipActionCallback* pCallback = m_callbacks.Get(cbTest);
+ CZipActionCallback* pCallback = GetCallback(cbTest);
if (pCallback)
{
pCallback->Init(m_centralDir.GetProperHeaderFileName(pHeader));
@@ -1899,7 +1778,11 @@ bool CZipArchive::TestFile(WORD uIndex, DWORD uBufSize)
if (iAborted)
CZipException::Throw(iAborted); // throw to distuingiush from other return codes
- return bRet;
+ if (bRet)
+ return true;
+ else
+ CZipException::Throw(CZipException::badZipFile);
+ return false; // to satisfy the compiler and eliminate warning
}
catch(...)
{
@@ -2064,7 +1947,7 @@ void CZipArchive::SetTempPath(LPCTSTR lpszPath, bool bForce)
}
CZipString CZipArchive::PredictFileNameInZip(LPCTSTR lpszFilePath,
- bool bFullPath, int iWhat, bool bAnsiOEM)const
+ bool bFullPath, int iWhat, bool bExactly)const
{
CZipString sz = lpszFilePath;
if (sz.IsEmpty())
@@ -2081,23 +1964,35 @@ CZipString CZipArchive::PredictFileNameInZip(LPCTSTR lpszFilePath,
default:
bAppend = CZipPathComponent::IsSeparator(sz[sz.GetLength() - 1]);
}
-
+
// remove for CZipPathComponent treating last name as a file even if dir
CZipPathComponent::RemoveSeparators(sz);
CZipPathComponent zpc(sz);
- sz = bFullPath ? zpc.GetNoDrive() : TrimRootPath(zpc);
- sz.Replace(_T('\\'), _T('/'));
- if (bAppend && !sz.IsEmpty())
- sz += _T('/');
- if (bAnsiOEM)
+
+ if (bFullPath)
{
- CZipFileHeader fh; // create a temporary object to convert the CZipString to CZipAutoBuffer
- fh.SetFileName(sz);
- ZipPlatform::AnsiOem(fh.m_pszFileName, true);
- return fh.GetFileName();
+ if (m_bRemoveDriveLetter)
+ sz = zpc.GetNoDrive();
}
else
- return sz;
+ sz = TrimRootPath(zpc);
+
+ if (bAppend && !sz.IsEmpty())
+ CZipPathComponent::AppendSeparator(sz);
+ CZipFileHeader fh; // create a temporary object to convert
+ fh.SetFileName(sz);
+ if (bExactly)
+ {
+ fh.SetSystemCompatibility(m_iArchiveSystCompatib);
+ ZipCompatibility::FileNameUpdate(fh, false);
+ }
+ else
+ {
+ fh.SetSystemCompatibility(-1); // non existing system to prevent ansi oem conversion
+ ZipCompatibility::FileNameUpdate(fh, true);// update only path separators
+ }
+
+ return fh.GetFileName();
}
CZipString CZipArchive::PredictExtractedFileName(LPCTSTR lpszFileNameInZip, LPCTSTR lpszPath, bool bFullPath, LPCTSTR lpszNewName)const
@@ -2113,7 +2008,8 @@ CZipString CZipArchive::PredictExtractedFileName(LPCTSTR lpszFileNameInZip, LPCT
// remove for CZipPathComponent treating last name as a file even if dir
CZipPathComponent::RemoveSeparators(sz);
CZipPathComponent zpc(sz);
- szFile += bFullPath ? zpc.GetNoDrive() : TrimRootPath(zpc);
+ szFile += bFullPath ? (m_bRemoveDriveLetter ? zpc.GetNoDrive() : sz)
+ : TrimRootPath(zpc);
return szFile;
}
@@ -2570,4 +2466,463 @@ void CZipArchive::FindMatches(LPCTSTR lpszPattern, CZipWordArray &ar, bool bFull
ar.Add(i);
}
}
-
\ No newline at end of file
+
+int CZipArchive::WillBeDuplicated(LPCTSTR lpszFilePath, bool bFullPath, bool bFileNameOnly , int iWhat)
+{
+ CZipString szFile;
+ // we predict with bExactly set to false, because FindFile converts all filanames anyway
+ if (bFileNameOnly)
+ {
+ CZipPathComponent zpc(lpszFilePath);
+ szFile = PredictFileNameInZip(zpc.GetFileName(), false, iWhat);
+ }
+ else
+ szFile = PredictFileNameInZip(lpszFilePath, bFullPath, iWhat);
+ return FindFile(szFile, ffDefault, bFileNameOnly);
+}
+
+
+// it'll get up to the next file or to the end of file (bad if zip corrupted or not-ordered by offsett or redundant bytes added)
+bool CZipArchive::GetFromArchive(CZipArchive& zip, WORD uIndex, int iReplaceIndex, bool bKeepSystComp, CZipActionCallback* pCallback)
+{
+
+ if (IsClosed() || zip.IsClosed())
+ {
+ TRACE(_T("%s(%i) : ZipArchive is closed.\n"),__FILE__,__LINE__);
+ return false;
+ }
+
+ if (m_iFileOpened || zip.m_iFileOpened)
+ {
+ TRACE(_T("%s(%i) : You cannot get files from another archive if there is a file opened.\n"),__FILE__,__LINE__);
+ return false;
+ }
+
+ if (zip.m_storage.IsSpanMode())
+ {
+ TRACE(_T("%s(%i) : You cannot get files from the disk spannig archive.\n"),__FILE__,__LINE__);
+ return false;
+ }
+
+ if (m_storage.IsSpanMode() == -1)
+ {
+ TRACE(_T("%s(%i) : You cannot add files to the existing disk spannig archive.\n"),__FILE__,__LINE__);
+ return false;
+ }
+
+ ASSERT(m_info.m_pBuffer.GetSize() > 0);
+
+ bool bIsSpan = m_storage.IsSpanMode() == 1;
+
+ CZipFileHeader fh;
+ if (!zip.GetFileInfo(fh, uIndex))
+ return false;
+ CZipAbstractFile* pFile = zip.m_storage.m_pFile;
+
+
+ DWORD uEndOffset;
+ if (uIndex < zip.GetCount() - 1)
+ {
+ CZipFileHeader fhTemp;
+ if (!zip.GetFileInfo(fhTemp, uIndex+1))
+ return false;
+ uEndOffset = fhTemp.m_uOffset;
+ }
+ else
+ {
+ CZipCentralDir::Info info;
+ zip.m_centralDir.GetInfo(info);
+ if (info.m_bOnDisk)
+ uEndOffset = info.m_uOffset;
+ else
+ uEndOffset = pFile->GetLength();
+ }
+ uEndOffset += zip.m_centralDir.GetBytesBefore();
+ DWORD uStartOffset = zip.m_centralDir.GetBytesBefore() + fh.m_uOffset + fh.GetSize(true);
+ DWORD uTotalToMove = uEndOffset - uStartOffset, uTotalMoved = 0;
+
+ DWORD uPredictedSize = fh.m_uComprSize +
+ (fh.IsDataDescr() ? ZIPARCHIVE_DATADESCRIPTOR_LEN : 0);
+ if (uTotalToMove > uPredictedSize + 4/* may be or may be not a signature*/)
+ uTotalToMove = uPredictedSize + 4;
+ else if (uTotalToMove < uPredictedSize)
+ ThrowError(CZipException::badZipFile);
+
+ // conversion stuff
+ CZipString szFileNameConverted, szFileName;
+ bool bConvertSystem = !bKeepSystComp && fh.GetSystemCompatibility() != m_iArchiveSystCompatib;
+
+ // GetFileInfo always converts the filename regardless of zip.m_centralDir.m_bConvertAfterOpen value
+ szFileNameConverted = fh.GetFileName();
+ if (bConvertSystem)
+ {
+ DWORD uAttr = fh.GetSystemAttr();
+ fh.SetSystemCompatibility(m_iArchiveSystCompatib);
+ fh.SetSystemAttr(uAttr);
+ }
+
+ ZipCompatibility::FileNameUpdate(fh, false);
+ szFileName = fh.GetFileName();
+
+
+ bool bNeedDataDescr = bIsSpan && !fh.IsDataDescr();
+ if (bNeedDataDescr)
+ fh.m_uFlag |= 8; // data descriptor present
+
+
+ // needed by InsertFindFastElement
+ if (m_centralDir.IsFindFastEnabled())
+ fh.SetFileName(szFileNameConverted);
+
+
+ if (!UpdateReplaceIndex(iReplaceIndex, szFileNameConverted))
+ return false;
+
+ bool bReplace = iReplaceIndex >= 0;
+ int iCallbackType = 0;
+ if (pCallback)
+ iCallbackType = pCallback->m_iType;
+
+ // if the same callback is applied to cbReplace, then the previous information about the type will be lost
+ CZipFileHeader* pHeader = m_centralDir.AddNewFile(fh, iReplaceIndex); // must be converted when adding because of InsertFastElement
+ if (bReplace)
+ MakeSpaceForReplace(iReplaceIndex, uTotalToMove + fh.GetSize(true), szFileNameConverted);
+
+ if (pCallback)
+ {
+ pCallback->m_iType = iCallbackType;
+ pCallback->Init(szFileNameConverted, zip.GetArchivePath());
+ pCallback->SetTotal(fh.m_uComprSize);
+ }
+
+ if (m_centralDir.IsFindFastEnabled())
+ pHeader->SetFileName(szFileName);
+
+ // must be written as not converted
+ pHeader->WriteLocal(m_storage);
+
+ // made a correction to what was set in WriteLocal
+ pHeader->m_uOffset -= m_centralDir.GetBytesBefore();
+
+ // we keep in converted in memory
+ if (m_centralDir.m_bConvertAfterOpen)
+ pHeader->SetFileName(szFileNameConverted);
+
+
+ // skip reading the local file header
+
+ pFile->Seek(uStartOffset, CZipAbstractFile::begin);
+
+
+ DWORD uPack = uTotalToMove > m_info.m_pBuffer.GetSize() ? m_info.m_pBuffer.GetSize() : uTotalToMove;
+ char* buf = (char*)m_info.m_pBuffer;
+
+ DWORD size_read;
+
+ int iAborted = 0;
+ bool bBreak = false;
+ if (uPack)
+ do
+ {
+ size_read = pFile->Read(buf, uPack);
+ if (!size_read)
+ break;
+ if (uTotalMoved + size_read > uTotalToMove)
+ {
+ size_read = uTotalToMove - uTotalMoved;
+ if (!size_read) // this is for protection
+ break;
+ bBreak = true;
+ }
+
+ m_storage.Write(buf, size_read, false);
+ uTotalMoved += size_read;
+ if (pCallback)
+ if (!(*pCallback)(size_read))
+ {
+ if (uTotalToMove != uTotalMoved)
+ {
+ if (!bIsSpan && !bReplace)
+ {
+ m_centralDir.RemoveLastFile();
+ iAborted = CZipException::abortedSafely;
+ }
+ else
+ iAborted = CZipException::abortedAction;
+ }
+ else
+ iAborted = CZipException::abortedSafely; // we did it!
+ break;
+
+ }
+ }
+ while (!bBreak);
+
+ if (iAborted)
+ CZipException::Throw(iAborted); // throw to distuingiush from other return codes
+
+ // copying from non-span to span or from span without data description to span
+ // so add the data descriptor
+
+ m_centralDir.m_pOpenedFile = NULL;
+ if (bNeedDataDescr && uTotalMoved == uTotalToMove)
+ {
+ const int iToWrite = ZIPARCHIVE_DATADESCRIPTOR_LEN + 4;
+ CZipAutoBuffer buf(iToWrite);
+ memcpy(buf, m_storage.m_gszExtHeaderSignat, 4);
+ pHeader->GetCrcAndSizes(buf + 4);
+ m_storage.Write(buf, iToWrite, true);
+
+ }
+ m_storage.Flush();
+ if (uTotalMoved < uTotalToMove)
+ ThrowError(CZipException::badZipFile);
+
+
+ if (pCallback)
+ pCallback->CallbackEnd();
+
+ return true;
+}
+
+bool CZipArchive::GetFromArchive(CZipArchive& zip, CZipWordArray &aIndexes, bool bKeepSystComp)
+{
+ aIndexes.Sort(true);
+ int iFiles = aIndexes.GetSize();
+ m_info.Init();
+ try
+ {
+ for (int i = 0; i < iFiles; i++)
+ {
+ int iFileIndex = aIndexes[i];
+ if (!m_centralDir.IsValidIndex(iFileIndex))
+ if (!GetFromArchive(zip, iFileIndex, -1, bKeepSystComp, GetCallback(cbGetFromArchive)))
+ {
+ m_info.ReleaseBuf();
+ return false;
+ }
+ }
+ }
+ catch (...)
+ {
+ m_info.ReleaseBuf();
+ throw;
+ }
+ m_info.ReleaseBuf();
+ if (m_bAutoFlush)
+ Flush();
+ return true;
+}
+bool CZipArchive::RenameFile(WORD uIndex, LPCTSTR lpszNewName)
+{
+ if (IsClosed())
+ {
+ TRACE(_T("%s(%i) : ZipArchive is closed.\n"),__FILE__,__LINE__);
+ return false;
+ }
+
+ if (m_storage.IsSpanMode())
+ {
+ TRACE(_T("%s(%i) : You cannot rename files in the disk spannig archive.\n"),__FILE__,__LINE__);
+ return false;
+ }
+
+ if (m_iFileOpened)
+ {
+ TRACE(_T("%s(%i) : You cannot rename a file if there is a file opened.\n"),__FILE__,__LINE__);
+ return false;
+ }
+ CZipFileHeader fh, fhNew;
+ if (!GetFileInfo(fh, uIndex))
+ return false;
+ CZipString szNewName(lpszNewName);
+ if (fh.IsDirectory())
+ CZipPathComponent::AppendSeparator(szNewName);
+ else
+ CZipPathComponent::RemoveSeparators(szNewName);
+ if (fh.GetFileName().Collate(szNewName) == 0)
+ return true;
+ fhNew.SetSystemCompatibility(m_iArchiveSystCompatib);
+
+ fhNew.SetFileName(szNewName);
+ ZipCompatibility::FileNameUpdate(fhNew, false);
+ ZipCompatibility::FileNameUpdate(fh, false); // in case the conversion changes the filename size
+ WORD uFileNameLen = fh.GetFileNameSize();
+ WORD uNewFileNameLen = fhNew.GetFileNameSize();
+ int iDelta = uNewFileNameLen - uFileNameLen;
+ int iOffset = 0;
+ CZipAutoBuffer buf, *pBuf;
+ m_centralDir.RemoveFromDisk(); // does m_storage.Flush();
+ if (iDelta != 0)
+ {
+ // we need to make more or less space
+
+ m_info.Init();
+ DWORD uStartOffset = fh.m_uOffset + 30 + uFileNameLen;
+ DWORD uFileLen = m_storage.m_pFile->GetLength();
+ DWORD uEndOffset = uFileLen - m_centralDir.GetBytesBefore();
+ CZipActionCallback* pCallback = GetCallback(cbRename);
+ if (pCallback)
+ {
+ // do it right and sent the notification
+ pCallback->Init(fh.GetFileName(), GetArchivePath());
+ pCallback->SetTotal(uEndOffset - uStartOffset);
+ }
+ bool bForward = iDelta > 0;
+ if (bForward)
+ m_storage.m_pFile->SetLength(uFileLen + iDelta); // ensure the seek is correct
+
+ MovePackedFiles(uStartOffset, uEndOffset, abs(iDelta), pCallback, bForward);
+ if (pCallback)
+ pCallback->CallbackEnd();
+
+ if (!bForward)
+ m_storage.m_pFile->SetLength(uFileLen + iDelta); // delta < 0; shrink the file
+
+ m_info.ReleaseBuf();
+
+ int iSize = GetCount();
+ for (int i = uIndex + 1; i < iSize; i++)
+ m_centralDir[i]->m_uOffset += iDelta;
+ buf.Allocate(4+uNewFileNameLen);
+ WORD uExtraFieldSize = fh.GetExtraFieldSize();
+ memcpy(buf, &uNewFileNameLen, 2);
+ memcpy(buf + 2, &uExtraFieldSize, 2); // to write everything at once
+ memcpy(buf + 4, fhNew.m_pszFileName, uNewFileNameLen);
+ pBuf = &buf;
+ iOffset = -4;
+ }
+ else
+ pBuf = &fhNew.m_pszFileName;
+
+ m_storage.m_pFile->Seek(m_centralDir.GetBytesBefore() + fh.m_uOffset + 30 + iOffset, CZipAbstractFile::begin);
+ m_storage.m_pFile->Write(buf, buf.GetSize());
+ m_centralDir.RenameFile(uIndex, szNewName);
+ if (m_bAutoFlush)
+ Flush();
+
+ return true;
+}
+
+bool CZipArchive::UpdateReplaceIndex(int& iReplaceIndex, LPCTSTR lpszNewFileName)
+{
+ if (iReplaceIndex == -2)
+ iReplaceIndex = FindFile(lpszNewFileName);
+ if (iReplaceIndex < 0)
+ {
+ if (iReplaceIndex != -1)
+ iReplaceIndex = -1;
+ return true;
+ }
+
+ if (GetSpanMode()!=0)
+ {
+ TRACE(_T("%s(%i) : You cannot replace files in a disk-spanning archive.\n"),__FILE__,__LINE__);
+ return false;
+ }
+
+ if (!m_centralDir.IsValidIndex(iReplaceIndex))
+ {
+ TRACE(_T("%s(%i) : Not valid replace index.\n"),__FILE__,__LINE__);
+ return false;
+ }
+ if (iReplaceIndex == GetCount() - 1) // replacing last file in the archive
+ {
+ RemoveLast(true);
+ iReplaceIndex = -1;
+ }
+ return true;
+}
+
+void CZipArchive::MakeSpaceForReplace(int iReplaceIndex, DWORD uTotal, LPCTSTR lpszFileName)
+{
+
+ ASSERT(iReplaceIndex < GetCount() - 1);
+ DWORD uReplaceStart = m_storage.m_pFile->GetPosition() - m_centralDir.GetBytesBefore();
+ DWORD uReplaceEnd = m_centralDir.m_headers[iReplaceIndex + 1]->m_uOffset;
+ DWORD uReplaceTotal = uReplaceEnd - uReplaceStart;
+ int iDelta = uTotal - uReplaceTotal;
+
+ if (iDelta != 0)
+ {
+
+ // m_info.Init(); don't - the calling functions will
+ CZipActionCallback* pCallback = GetCallback(CZipArchive::cbReplace);
+ DWORD uFileLen = m_storage.m_pFile->GetLength();
+ DWORD uUpperLimit = uFileLen - m_centralDir.GetBytesBefore(); // will be added in MovePackedFiles
+ if (pCallback)
+ {
+ pCallback->Init(lpszFileName, GetArchivePath());
+ pCallback->SetTotal(uUpperLimit - uReplaceEnd);
+ }
+
+ bool bForward = iDelta > 0;
+ if (bForward)
+ m_storage.m_pFile->SetLength(uFileLen + iDelta); // ensure the seek is correct
+
+ MovePackedFiles(uReplaceEnd, uUpperLimit, abs(iDelta), pCallback, bForward);
+
+ if (!bForward)
+ m_storage.m_pFile->SetLength(uFileLen + iDelta); // delta < 0; shrink the file
+
+ m_storage.m_pFile->Seek(uReplaceStart, CZipAbstractFile::begin);
+ int iSize = m_centralDir.m_headers.GetSize();
+ for (int i = iReplaceIndex + 1; i < iSize; i++)
+ m_centralDir.m_headers[i]->m_uOffset += iDelta;
+ if (pCallback)
+ pCallback->CallbackEnd();
+ }
+}
+
+void CZipArchive::MovePackedFiles(DWORD uStartOffset, DWORD uEndOffset, DWORD uMoveBy, CZipActionCallback* pCallback, bool bForward)
+{
+ ASSERT(m_info.m_pBuffer.GetSize() > 0);
+ uStartOffset += m_centralDir.GetBytesBefore();
+ uEndOffset += m_centralDir.GetBytesBefore();
+
+
+ DWORD uTotalToMove = uEndOffset - uStartOffset;
+ DWORD uPack = uTotalToMove > m_info.m_pBuffer.GetSize() ? m_info.m_pBuffer.GetSize() : uTotalToMove;
+ char* buf = (char*)m_info.m_pBuffer;
+
+
+ DWORD size_read;
+ bool bBreak = false;
+ do
+ {
+
+ if (uEndOffset - uStartOffset < uPack)
+ {
+ uPack = uEndOffset - uStartOffset;
+ if (!uPack)
+ break;
+ bBreak = true;
+
+ }
+ DWORD uPosition = bForward ? uEndOffset - uPack : uStartOffset;
+
+ m_storage.m_pFile->Seek(uPosition, CZipAbstractFile::begin);
+ size_read = m_storage.m_pFile->Read(buf, uPack);
+ if (!size_read)
+ break;
+
+ if (bForward)
+ uPosition += uMoveBy;
+ else
+ uPosition -= uMoveBy;
+ m_storage.m_pFile->Seek(uPosition, CZipAbstractFile::begin);
+ m_storage.m_pFile->Write(buf, size_read);
+ if (bForward)
+ uEndOffset -= size_read;
+ else
+ uStartOffset += size_read;
+ if (pCallback)
+ if (!(*pCallback)(size_read))
+ ThrowError(CZipException::abortedAction);
+ }
+ while (!bBreak);
+
+ if (uEndOffset != uStartOffset)
+ ThrowError(CZipException::internal);
+
+}
\ No newline at end of file
diff --git a/stepmania/src/smpackage/ZipArchive/ZipArchive.dox b/stepmania/src/smpackage/ZipArchive/ZipArchive.dox
index 285ef4fff1..394c02ddcb 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipArchive.dox
+++ b/stepmania/src/smpackage/ZipArchive/ZipArchive.dox
@@ -1,306 +1,62 @@
-# Doxyfile 1.2.13.1
-
-# This file describes the settings to be used by the documentation system
-# doxygen (www.doxygen.org) for a project
-#
-# All text after a hash (#) is considered a comment and will be ignored
-# The format is:
-# TAG = value [value, ...]
-# For lists items can also be appended using:
-# TAG += value [value, ...]
-# Values that contain spaces should be placed between quotes (" ")
+# Doxyfile 1.3.2
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
-
-# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
-# by quotes) that should identify the project.
-
PROJECT_NAME = ZipArchive
-
-# The PROJECT_NUMBER tag can be used to enter a project or revision number.
-# This could be handy for archiving the generated documentation or
-# if some version control system is used.
-
PROJECT_NUMBER =
-
-# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
-# base path where the generated documentation will be put.
-# If a relative path is entered, it will be relative to the location
-# where doxygen was started. If left blank the current directory will be used.
-
OUTPUT_DIRECTORY = .\Doc
-
-# The OUTPUT_LANGUAGE tag is used to specify the language in which all
-# documentation generated by doxygen is written. Doxygen will use this
-# information to generate all constant output in the proper language.
-# The default language is English, other supported languages are:
-# Brazilian, Chinese, Croatian, Czech, Danish, Dutch, Finnish, French,
-# German, Greek, Hungarian, Italian, Japanese, Korean, Norwegian, Polish,
-# Portuguese, Romanian, Russian, Slovak, Slovene, Spanish and Swedish.
-
OUTPUT_LANGUAGE = English
-
-# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
-# documentation are documented, even if no documentation was available.
-# Private class members and static file members will be hidden unless
-# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
-
+USE_WINDOWS_ENCODING = YES
EXTRACT_ALL = NO
-
-# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
-# will be included in the documentation.
-
EXTRACT_PRIVATE = NO
-
-# If the EXTRACT_STATIC tag is set to YES all static members of a file
-# will be included in the documentation.
-
EXTRACT_STATIC = NO
-
-# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
-# defined locally in source files will be included in the documentation.
-# If set to NO only classes defined in header files are included.
-
EXTRACT_LOCAL_CLASSES = YES
-
-# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
-# undocumented members of documented classes, files or namespaces.
-# If set to NO (the default) these members will be included in the
-# various overviews, but no documentation section is generated.
-# This option has no effect if EXTRACT_ALL is enabled.
-
HIDE_UNDOC_MEMBERS = NO
-
-# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
-# undocumented classes that are normally visible in the class hierarchy.
-# If set to NO (the default) these class will be included in the various
-# overviews. This option has no effect if EXTRACT_ALL is enabled.
-
HIDE_UNDOC_CLASSES = NO
-
-# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
-# include brief member descriptions after the members that are listed in
-# the file and class documentation (similar to JavaDoc).
-# Set to NO to disable this.
-
+HIDE_FRIEND_COMPOUNDS = NO
+HIDE_IN_BODY_DOCS = NO
BRIEF_MEMBER_DESC = YES
-
-# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
-# the brief description of a member or function before the detailed description.
-# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
-# brief descriptions will be completely suppressed.
-
REPEAT_BRIEF = YES
-
-# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
-# Doxygen will generate a detailed section even if there is only a brief
-# description.
-
ALWAYS_DETAILED_SEC = NO
-
-# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited
-# members of a class in the documentation of that class as if those members were
-# ordinary class members. Constructors, destructors and assignment operators of
-# the base classes will not be shown.
-
INLINE_INHERITED_MEMB = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
-# path before files name in the file list and in the header files. If set
-# to NO the shortest path that makes the file name unique will be used.
-
FULL_PATH_NAMES = NO
-
-# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
-# can be used to strip a user defined part of the path. Stripping is
-# only done if one of the specified strings matches the left-hand part of
-# the path. It is allowed to use relative paths in the argument list.
-
STRIP_FROM_PATH = $(PWD)/
-
-# The INTERNAL_DOCS tag determines if documentation
-# that is typed after a \internal command is included. If the tag is set
-# to NO (the default) then the documentation will be excluded.
-# Set it to YES to include the internal documentation.
-
INTERNAL_DOCS = NO
-
-# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
-# doxygen to hide any special comment blocks from generated source code
-# fragments. Normal C and C++ comments will always remain visible.
-
-STRIP_CODE_COMMENTS = YES
-
-# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
-# file names in lower case letters. If set to YES upper case letters are also
-# allowed. This is useful if you have classes or files whose names only differ
-# in case and if your file system supports case sensitive file names. Windows
-# users are adviced to set this option to NO.
-
CASE_SENSE_NAMES = YES
-
-# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
-# (but less readable) file names. This can be useful is your file systems
-# doesn't support long names like on DOS, Mac, or CD-ROM.
-
SHORT_NAMES = NO
-
-# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
-# will show members with their full class and namespace scopes in the
-# documentation. If set to YES the scope will be hidden.
-
HIDE_SCOPE_NAMES = NO
-
-# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
-# will generate a verbatim copy of the header file for each class for
-# which an include is specified. Set to NO to disable this.
-
-VERBATIM_HEADERS = YES
-
-# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
-# will put list of the files that are included by a file in the documentation
-# of that file.
-
SHOW_INCLUDE_FILES = YES
-
-# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
-# will interpret the first line (until the first dot) of a JavaDoc-style
-# comment as the brief description. If set to NO, the JavaDoc
-# comments will behave just like the Qt-style comments (thus requiring an
-# explict @brief command for a brief description.
-
JAVADOC_AUTOBRIEF = YES
-
-# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
-# member inherits the documentation from any documented member that it
-# reimplements.
-
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
-
-# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
-# is inserted in the documentation for inline members.
-
INLINE_INFO = YES
-
-# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
-# will sort the (detailed) documentation of file and class members
-# alphabetically by member name. If set to NO the members will appear in
-# declaration order.
-
SORT_MEMBER_DOCS = YES
-
-# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
-# tag is set to YES, then doxygen will reuse the documentation of the first
-# member in the group (if any) for the other members of the group. By default
-# all members of a group must be documented explicitly.
-
DISTRIBUTE_GROUP_DOC = NO
-
-# The TAB_SIZE tag can be used to set the number of spaces in a tab.
-# Doxygen uses this value to replace tabs by spaces in code fragments.
-
-TAB_SIZE = 8
-
-# The GENERATE_TODOLIST tag can be used to enable (YES) or
-# disable (NO) the todo list. This list is created by putting \todo
-# commands in the documentation.
-
+TAB_SIZE = 1
GENERATE_TODOLIST = YES
-
-# The GENERATE_TESTLIST tag can be used to enable (YES) or
-# disable (NO) the test list. This list is created by putting \test
-# commands in the documentation.
-
GENERATE_TESTLIST = YES
-
-# The GENERATE_BUGLIST tag can be used to enable (YES) or
-# disable (NO) the bug list. This list is created by putting \bug
-# commands in the documentation.
-
GENERATE_BUGLIST = YES
-
-# This tag can be used to specify a number of aliases that acts
-# as commands in the documentation. An alias has the form "name=value".
-# For example adding "sideeffect=\par Side Effects:\n" will allow you to
-# put the command \sideeffect (or @sideeffect) in the documentation, which
-# will result in a user defined paragraph with heading "Side Effects:".
-# You can put \n's in the value part of an alias to insert newlines.
-
+GENERATE_DEPRECATEDLIST= YES
ALIASES =
-
-# The ENABLED_SECTIONS tag can be used to enable conditional
-# documentation sections, marked by \if sectionname ... \endif.
-
ENABLED_SECTIONS = YES
-
-# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
-# the initial value of a variable or define consist of for it to appear in
-# the documentation. If the initializer consists of more lines than specified
-# here it will be hidden. Use a value of 0 to hide initializers completely.
-# The appearance of the initializer of individual variables and defines in the
-# documentation can be controlled using \showinitializer or \hideinitializer
-# command in the documentation regardless of this setting.
-
MAX_INITIALIZER_LINES = 30
-
-# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
-# only. Doxygen will then generate output that is more tailored for C.
-# For instance some of the names that are used will be different. The list
-# of all members will be omitted, etc.
-
OPTIMIZE_OUTPUT_FOR_C = NO
-
-# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
-# at the bottom of the documentation of classes and structs. If set to YES the
-# list will mention the files that were used to generate the documentation.
-
+OPTIMIZE_OUTPUT_JAVA = NO
SHOW_USED_FILES = YES
-
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
-
-# The QUIET tag can be used to turn on/off the messages that are generated
-# by doxygen. Possible values are YES and NO. If left blank NO is used.
-
QUIET = NO
-
-# The WARNINGS tag can be used to turn on/off the warning messages that are
-# generated by doxygen. Possible values are YES and NO. If left blank
-# NO is used.
-
WARNINGS = YES
-
-# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
-# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
-# automatically be disabled.
-
WARN_IF_UNDOCUMENTED = NO
-
-# The WARN_FORMAT tag determines the format of the warning messages that
-# doxygen can produce. The string should contain the $file, $line, and $text
-# tags, which will be replaced by the file and line number from which the
-# warning originated and the warning text.
-
+WARN_IF_DOC_ERROR = YES
WARN_FORMAT = "$file:$line: $text"
-
-# The WARN_LOGFILE tag can be used to specify a file to which warning
-# and error messages should be written. If left blank the output is written
-# to stderr.
-
WARN_LOGFILE =
-
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
-
-# The INPUT tag can be used to specify the files and/or directories that contain
-# documented source files. You may enter file names like "myfile.cpp" or
-# directories like "/usr/src/myproject". Separate the files or directories
-# with spaces.
-
INPUT = .\ZipArchive.h \
.\ZipAutoBuffer.h \
.\ZipCentralDir.h \
@@ -308,7 +64,6 @@ INPUT = .\ZipArchive.h \
.\ZipException.h \
.\ZipFileHeader.h \
.\ZipPlatform.h \
- .\ZipInternalInfo.h \
.\ZipMemFile.h \
.\ZipPathComponent.h \
.\ZipStorage.h \
@@ -317,597 +72,150 @@ INPUT = .\ZipArchive.h \
.\License.txt \
.\gpl.txt \
.\Readme.txt
-
-# If the value of the INPUT tag contains directories, you can use the
-# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank the following patterns are tested:
-# *.c *.cc *.cxx *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp
-# *.h++ *.idl
-
FILE_PATTERNS =
-
-# The RECURSIVE tag can be used to turn specify whether or not subdirectories
-# should be searched for input files as well. Possible values are YES and NO.
-# If left blank NO is used.
-
RECURSIVE = NO
-
-# The EXCLUDE tag can be used to specify files and/or directories that should
-# excluded from the INPUT source files. This way you can easily exclude a
-# subdirectory from a directory tree whose root is specified with the INPUT tag.
-
EXCLUDE =
-
-# If the value of the INPUT tag contains directories, you can use the
-# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
-# certain files from those directories.
-
+EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
-
-# The EXAMPLE_PATH tag can be used to specify one or more files or
-# directories that contain example code fragments that are included (see
-# the \include command).
-
EXAMPLE_PATH =
-
-# If the value of the EXAMPLE_PATH tag contains directories, you can use the
-# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
-# and *.h) to filter out the source-files in the directories. If left
-# blank all files are included.
-
EXAMPLE_PATTERNS =
-
-# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
-# searched for input files to be used with the \include or \dontinclude
-# commands irrespective of the value of the RECURSIVE tag.
-# Possible values are YES and NO. If left blank NO is used.
-
EXAMPLE_RECURSIVE = NO
-
-# The IMAGE_PATH tag can be used to specify one or more files or
-# directories that contain image that are included in the documentation (see
-# the \image command).
-
IMAGE_PATH =
-
-# The INPUT_FILTER tag can be used to specify a program that doxygen should
-# invoke to filter for each input file. Doxygen will invoke the filter program
-# by executing (via popen()) the command , where
-# is the value of the INPUT_FILTER tag, and is the name of an
-# input file. Doxygen will then use the output that the filter program writes
-# to standard output.
-
INPUT_FILTER =
-
-# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
-# INPUT_FILTER) will be used to filter the input files when producing source
-# files to browse.
-
FILTER_SOURCE_FILES = NO
-
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
-
-# If the SOURCE_BROWSER tag is set to YES then a list of source files will
-# be generated. Documented entities will be cross-referenced with these sources.
-
-SOURCE_BROWSER = NO
-
-# Setting the INLINE_SOURCES tag to YES will include the body
-# of functions and classes directly in the documentation.
-
+SOURCE_BROWSER = YES
INLINE_SOURCES = NO
-
-# If the REFERENCED_BY_RELATION tag is set to YES (the default)
-# then for each documented function all documented
-# functions referencing it will be listed.
-
+STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = YES
-
-# If the REFERENCES_RELATION tag is set to YES (the default)
-# then for each documented function all documented entities
-# called/used by that function will be listed.
-
REFERENCES_RELATION = YES
-
+VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
-
-# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
-# of all compounds will be generated. Enable this if the project
-# contains a lot of classes, structs, unions or interfaces.
-
ALPHABETICAL_INDEX = YES
-
-# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
-# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
-# in which this list will be split (can be a number in the range [1..20])
-
COLS_IN_ALPHA_INDEX = 5
-
-# In case all classes in a project start with a common prefix, all
-# classes will be put under the same header in the alphabetical index.
-# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
-# should be ignored while generating the index headers.
-
-IGNORE_PREFIX =
-
+IGNORE_PREFIX = CZip
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
-
-# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
-# generate HTML output.
-
GENERATE_HTML = YES
-
-# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `html' will be used as the default path.
-
HTML_OUTPUT = .
-
-# The HTML_HEADER tag can be used to specify a personal HTML header for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard header.
-
+HTML_FILE_EXTENSION = .html
HTML_HEADER = "c:\Program Files\Doxygen\header.html"
-
-# The HTML_FOOTER tag can be used to specify a personal HTML footer for
-# each generated HTML page. If it is left blank doxygen will generate a
-# standard footer.
-
HTML_FOOTER = "c:\Program Files\Doxygen\footer.html"
-
-# The HTML_STYLESHEET tag can be used to specify a user defined cascading
-# style sheet that is used by each HTML page. It can be used to
-# fine-tune the look of the HTML output. If the tag is left blank doxygen
-# will generate a default style sheet
-
HTML_STYLESHEET =
-
-# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
-# files or namespaces will be aligned in HTML using tables. If set to
-# NO a bullet list will be used.
-
HTML_ALIGN_MEMBERS = YES
-
-# If the GENERATE_HTMLHELP tag is set to YES, additional index files
-# will be generated that can be used as input for tools like the
-# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
-# of the generated HTML documentation.
-
GENERATE_HTMLHELP = YES
-
-# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
-# controls if a separate .chi index file is generated (YES) or that
-# it should be included in the master .chm file (NO).
-
+CHM_FILE =
+HHC_LOCATION =
GENERATE_CHI = YES
-
-# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
-# controls whether a binary table of contents is generated (YES) or a
-# normal table of contents (NO) in the .chm file.
-
BINARY_TOC = YES
-
-# The TOC_EXPAND flag can be set to YES to add extra items for group members
-# to the contents of the Html help documentation and to the tree view.
-
TOC_EXPAND = YES
-
-# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
-# top of each HTML page. The value NO (the default) enables the index and
-# the value YES disables it.
-
DISABLE_INDEX = NO
-
-# This tag can be used to set the number of enum values (range [1..20])
-# that doxygen will group on one line in the generated HTML documentation.
-
ENUM_VALUES_PER_LINE = 4
-
-# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
-# generated containing a tree-like index structure (just like the one that
-# is generated for HTML Help). For this to work a browser that supports
-# JavaScript and frames is required (for instance Mozilla, Netscape 4.0+,
-# or Internet explorer 4.0+). Note that for large projects the tree generation
-# can take a very long time. In such cases it is better to disable this feature.
-# Windows users are probably better off using the HTML help feature.
-
GENERATE_TREEVIEW = NO
-
-# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
-# used to set the initial width (in pixels) of the frame in which the tree
-# is shown.
-
TREEVIEW_WIDTH = 250
-
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
-
-# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
-# generate Latex output.
-
GENERATE_LATEX = NO
-
-# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `latex' will be used as the default path.
-
LATEX_OUTPUT =
-
-# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
-# LaTeX documents. This may be useful for small projects and may help to
-# save some trees in general.
-
+LATEX_CMD_NAME = latex
+MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
-
-# The PAPER_TYPE tag can be used to set the paper type that is used
-# by the printer. Possible values are: a4, a4wide, letter, legal and
-# executive. If left blank a4wide will be used.
-
PAPER_TYPE = a4wide
-
-# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
-# packages that should be included in the LaTeX output.
-
EXTRA_PACKAGES =
-
-# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
-# the generated latex document. The header should contain everything until
-# the first chapter. If it is left blank doxygen will generate a
-# standard header. Notice: only use this tag if you know what you are doing!
-
LATEX_HEADER =
-
-# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
-# is prepared for conversion to pdf (using ps2pdf). The pdf file will
-# contain links (just like the HTML output) instead of page references
-# This makes the output suitable for online browsing using a pdf viewer.
-
PDF_HYPERLINKS = NO
-
-# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
-# plain latex in the generated Makefile. Set this option to YES to get a
-# higher quality PDF documentation.
-
USE_PDFLATEX = NO
-
-# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
-# command to the generated LaTeX files. This will instruct LaTeX to keep
-# running if errors occur, instead of asking the user for help.
-# This option is also used when generating formulas in HTML.
-
LATEX_BATCHMODE = NO
-
+LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
-
-# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
-# The RTF output is optimised for Word 97 and may not look very pretty with
-# other RTF readers or editors.
-
GENERATE_RTF = NO
-
-# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `rtf' will be used as the default path.
-
RTF_OUTPUT =
-
-# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
-# RTF documents. This may be useful for small projects and may help to
-# save some trees in general.
-
COMPACT_RTF = NO
-
-# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
-# will contain hyperlink fields. The RTF file will
-# contain links (just like the HTML output) instead of page references.
-# This makes the output suitable for online browsing using WORD or other
-# programs which support those fields.
-# Note: wordpad (write) and others do not support links.
-
RTF_HYPERLINKS = NO
-
-# Load stylesheet definitions from file. Syntax is similar to doxygen's
-# config file, i.e. a series of assigments. You only have to provide
-# replacements, missing definitions are set to their default value.
-
RTF_STYLESHEET_FILE =
-
-# Set optional variables used in the generation of an rtf document.
-# Syntax is similar to doxygen's config file.
-
RTF_EXTENSIONS_FILE =
-
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
-
-# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
-# generate man pages
-
GENERATE_MAN = NO
-
-# The MAN_OUTPUT tag is used to specify where the man pages will be put.
-# If a relative path is entered the value of OUTPUT_DIRECTORY will be
-# put in front of it. If left blank `man' will be used as the default path.
-
MAN_OUTPUT =
-
-# The MAN_EXTENSION tag determines the extension that is added to
-# the generated man pages (default is the subroutine's section .3)
-
MAN_EXTENSION = .3
-
-# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
-# then it will generate one additional man file for each entity
-# documented in the real man page(s). These additional files
-# only source the real man page, but without them the man command
-# would be unable to find the correct page. The default is NO.
-
MAN_LINKS = NO
-
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
-
-# If the GENERATE_XML tag is set to YES Doxygen will
-# generate an XML file that captures the structure of
-# the code including all documentation. Note that this
-# feature is still experimental and incomplete at the
-# moment.
-
GENERATE_XML = NO
-
+XML_OUTPUT = xml
+XML_SCHEMA =
+XML_DTD =
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
-
-# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
-# generate an AutoGen Definitions (see autogen.sf.net) file
-# that captures the structure of the code including all
-# documentation. Note that this feature is still experimental
-# and incomplete at the moment.
-
GENERATE_AUTOGEN_DEF = NO
-
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+GENERATE_PERLMOD = NO
+PERLMOD_LATEX = NO
+PERLMOD_PRETTY = YES
+PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
-
-# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
-# evaluate all C-preprocessor directives found in the sources and include
-# files.
-
ENABLE_PREPROCESSING = NO
-
-# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
-# names in the source code. If set to NO (the default) only conditional
-# compilation will be performed. Macro expansion can be done in a controlled
-# way by setting EXPAND_ONLY_PREDEF to YES.
-
MACRO_EXPANSION = NO
-
-# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
-# then the macro expansion is limited to the macros specified with the
-# PREDEFINED and EXPAND_AS_PREDEFINED tags.
-
EXPAND_ONLY_PREDEF = YES
-
-# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
-# in the INCLUDE_PATH (see below) will be search if a #include is found.
-
SEARCH_INCLUDES = YES
-
-# The INCLUDE_PATH tag can be used to specify one or more directories that
-# contain include files that are not input files but should be processed by
-# the preprocessor.
-
INCLUDE_PATH =
-
-# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
-# patterns (like *.h and *.hpp) to filter out the header-files in the
-# directories. If left blank, the patterns specified with FILE_PATTERNS will
-# be used.
-
INCLUDE_FILE_PATTERNS =
-
-# The PREDEFINED tag can be used to specify one or more macro names that
-# are defined before the preprocessor is started (similar to the -D option of
-# gcc). The argument of the tag is a list of macros of the form: name
-# or name=definition (no spaces). If the definition and the = are
-# omitted =1 is assumed.
-
PREDEFINED =
-
-# If the MACRO_EXPANSION and EXPAND_PREDEF_ONLY tags are set to YES then
-# this tag can be used to specify a list of macro names that should be expanded.
-# The macro definition that is found in the sources will be used.
-# Use the PREDEFINED tag if you want to use a different macro definition.
-
EXPAND_AS_DEFINED =
-
-# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
-# doxygen's preprocessor will remove all function-like macros that are alone
-# on a line and do not end with a semicolon. Such function macros are typically
-# used for boiler-plate code, and will confuse the parser if not removed.
-
SKIP_FUNCTION_MACROS = YES
-
#---------------------------------------------------------------------------
# Configuration::addtions related to external references
#---------------------------------------------------------------------------
-
-# The TAGFILES tag can be used to specify one or more tagfiles.
-
TAGFILES =
-
-# When a file name is specified after GENERATE_TAGFILE, doxygen will create
-# a tag file that is based on the input files it reads.
-
GENERATE_TAGFILE = NO
-
-# If the ALLEXTERNALS tag is set to YES all external classes will be listed
-# in the class index. If set to NO only the inherited external classes
-# will be listed.
-
ALLEXTERNALS = YES
-
-# The PERL_PATH should be the absolute path and name of the perl script
-# interpreter (i.e. the result of `which perl').
-
+EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
-
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
-
-# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
-# generate a inheritance diagram (in Html, RTF and LaTeX) for classes with base or
-# super classes. Setting the tag to NO turns the diagrams off. Note that this
-# option is superceded by the HAVE_DOT option below. This is only a fallback. It is
-# recommended to install and use dot, since it yield more powerful graphs.
-
CLASS_DIAGRAMS = YES
-
-# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
-# available from the path. This tool is part of Graphviz, a graph visualization
-# toolkit from AT&T and Lucent Bell Labs. The other options in this section
-# have no effect if this option is set to NO (the default)
-
-HAVE_DOT = NO
-
-# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect inheritance relations. Setting this tag to YES will force the
-# the CLASS_DIAGRAMS tag to NO.
-
-CLASS_GRAPH = YES
-
-# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
-# will generate a graph for each documented class showing the direct and
-# indirect implementation dependencies (inheritance, containment, and
-# class references variables) of the class with other documented classes.
-
-COLLABORATION_GRAPH = YES
-
-# If set to YES, the inheritance and collaboration graphs will show the
-# relations between templates and their instances.
-
-TEMPLATE_RELATIONS = YES
-
-# If set to YES, the inheritance and collaboration graphs will hide
-# inheritance and usage relations if the target is undocumented
-# or is not a class.
-
HIDE_UNDOC_RELATIONS = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
-# tags are set to YES then doxygen will generate a graph for each documented
-# file showing the direct and indirect include dependencies of the file with
-# other documented files.
-
-INCLUDE_GRAPH = YES
-
-# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
-# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
-# documented header file showing the documented files that directly or
-# indirectly include this file.
-
+HAVE_DOT = YES
+CLASS_GRAPH = YES
+COLLABORATION_GRAPH = NO
+UML_LOOK = YES
+TEMPLATE_RELATIONS = YES
+INCLUDE_GRAPH = NO
INCLUDED_BY_GRAPH = NO
-
-# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
-# will graphical hierarchy of all classes instead of a textual one.
-
+CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
-
-# The tag DOT_PATH can be used to specify the path where the dot tool can be
-# found. If left blank, it is assumed the dot tool can be found on the path.
-
-DOT_PATH =
-
-# The DOTFILE_DIRS tag can be used to specify one or more directories that
-# contain dot files that are included in the documentation (see the
-# \dotfile command).
-
+DOT_IMAGE_FORMAT = gif
+DOT_PATH = "c:/Program Files/ATT/Graphviz/bin/"
DOTFILE_DIRS =
-
-# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
MAX_DOT_GRAPH_WIDTH = 1024
-
-# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
-# (in pixels) of the graphs generated by dot. If a graph becomes larger than
-# this value, doxygen will try to truncate the graph, so that it fits within
-# the specified constraint. Beware that most browsers cannot cope with very
-# large images.
-
MAX_DOT_GRAPH_HEIGHT = 1024
-
-# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
-# generate a legend page explaining the meaning of the various boxes and
-# arrows in the dot generated graphs.
-
+MAX_DOT_GRAPH_DEPTH = 0
GENERATE_LEGEND = YES
-
-# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
-# remove the intermedate dot files that are used to generate
-# the various graphs.
-
DOT_CLEANUP = YES
-
#---------------------------------------------------------------------------
# Configuration::addtions related to the search engine
#---------------------------------------------------------------------------
-
-# The SEARCHENGINE tag specifies whether or not a search engine should be
-# used. If set to NO the values of all tags below this one will be ignored.
-
SEARCHENGINE = NO
-
-# The CGI_NAME tag should be the name of the CGI script that
-# starts the search engine (doxysearch) with the correct parameters.
-# A script with this name will be generated by doxygen.
-
CGI_NAME = search.cgi
-
-# The CGI_URL tag should be the absolute URL to the directory where the
-# cgi binaries are located. See the documentation of your http daemon for
-# details.
-
CGI_URL =
-
-# The DOC_URL tag should be the absolute URL to the directory where the
-# documentation is located. If left blank the absolute path to the
-# documentation, with file:// prepended to it, will be used.
-
DOC_URL =
-
-# The DOC_ABSPATH tag should be the absolute path to the directory where the
-# documentation is located. If left blank the directory on the local machine
-# will be used.
-
DOC_ABSPATH =
-
-# The BIN_ABSPATH tag must point to the directory where the doxysearch binary
-# is installed.
-
BIN_ABSPATH = /usr/local/bin/
-
-# The EXT_DOC_PATHS tag can be used to specify one or more paths to
-# documentation generated for other projects. This allows doxysearch to search
-# the documentation for these projects as well.
-
EXT_DOC_PATHS =
diff --git a/stepmania/src/smpackage/ZipArchive/ZipArchive.dsp b/stepmania/src/smpackage/ZipArchive/ZipArchive.dsp
index 647f1f7c87..29f4f4a2c4 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipArchive.dsp
+++ b/stepmania/src/smpackage/ZipArchive/ZipArchive.dsp
@@ -28,7 +28,7 @@ CFG=ZipArchive - Win32 Static Debug
# Begin Project
# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName "ZipArchive"
+# PROP Scc_ProjName ""$/ZipArchive", LDAAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
RSC=rc.exe
@@ -46,7 +46,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "ZLIB_DLL" /D "ZIP_ARCHIVE_MFC_PROJ" /D "_AFXDLL" /YX"stdafx.h" /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "_MBCS" /D "ZLIB_DLL" /D "_AFXDLL" /D "WIN32" /D "_WINDOWS" /D "ZIP_ARCHIVE_MFC_PROJ" /D "PKZIP_BUG_WORKAROUND" /YX"stdafx.h" /FD /c
# ADD BASE RSC /l 0x415 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
@@ -69,7 +69,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "_AFXDLL" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "ZLIB_DLL" /D "ZIP_ARCHIVE_MFC_PROJ" /Fr /YX"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /MDd /W4 /Gm /GX /ZI /Od /D "_DEBUG" /D "_AFXDLL" /D "_MBCS" /D "ZLIB_DLL" /D "WIN32" /D "_WINDOWS" /D "ZIP_ARCHIVE_MFC_PROJ" /D "PKZIP_BUG_WORKAROUND" /Fr /YX"stdafx.h" /FD /GZ /c
# ADD BASE RSC /l 0x415 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
@@ -92,7 +92,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Static_Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "ZLIB_DLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "ZLIB_DLL" /D "ZIP_ARCHIVE_MFC_PROJ" /YX"stdafx.h" /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "ZIP_ARCHIVE_MFC_PROJ" /D "PKZIP_BUG_WORKAROUND" /YX"stdafx.h" /FD /c
# ADD BASE RSC /l 0x415 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
@@ -115,7 +115,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Unicode_Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W4 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "ZLIB_DLL" /Fr /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /MDd /W4 /Gm /GX /ZI /Od /D "_DEBUG" /D "_AFXDLL" /D "_UNICODE" /D "WIN32" /D "_WINDOWS" /D "ZLIB_DLL" /D "ZIP_ARCHIVE_MFC_PROJ" /Fr /YX"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /MDd /W4 /Gm /GX /ZI /Od /D "_DEBUG" /D "_AFXDLL" /D "_UNICODE" /D "ZLIB_DLL" /D "WIN32" /D "_WINDOWS" /D "ZIP_ARCHIVE_MFC_PROJ" /D "PKZIP_BUG_WORKAROUND" /Fr /YX"stdafx.h" /FD /GZ /c
# ADD BASE RSC /l 0x415 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
@@ -138,7 +138,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Unicode_Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "ZLIB_DLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MD /W4 /GX /O2 /D "NDEBUG" /D "_AFXDLL" /D "_UNICODE" /D "WIN32" /D "_WINDOWS" /D "ZLIB_DLL" /D "ZIP_ARCHIVE_MFC_PROJ" /YX"stdafx.h" /FD /c
+# ADD CPP /nologo /MD /W4 /GX /O2 /D "NDEBUG" /D "_AFXDLL" /D "_UNICODE" /D "ZLIB_DLL" /D "WIN32" /D "_WINDOWS" /D "ZIP_ARCHIVE_MFC_PROJ" /D "PKZIP_BUG_WORKAROUND" /YX"stdafx.h" /FD /c
# ADD BASE RSC /l 0x415 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
@@ -161,7 +161,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Unicode_Static_Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "ZLIB_DLL" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "_UNICODE" /D "WIN32" /D "_WINDOWS" /D "ZLIB_DLL" /D "ZIP_ARCHIVE_MFC_PROJ" /YX"stdafx.h" /FD /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "_UNICODE" /D "ZLIB_DLL" /D "WIN32" /D "_WINDOWS" /D "ZIP_ARCHIVE_MFC_PROJ" /D "PKZIP_BUG_WORKAROUND" /YX"stdafx.h" /FD /c
# ADD BASE RSC /l 0x415 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
@@ -184,7 +184,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Static_Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W4 /Gm /GX /ZI /Od /D "_DEBUG" /D "_AFXDLL" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "ZLIB_DLL" /D "ZIP_ARCHIVE_MFC_PROJ" /Fr /YX"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "ZLIB_DLL" /D "ZIP_ARCHIVE_MFC_PROJ" /D "NDEBUG" /Fr /YX"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /MTd /W4 /Gm /GX /ZI /Od /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "ZIP_ARCHIVE_MFC_PROJ" /D "PKZIP_BUG_WORKAROUND" /Fr /YX"stdafx.h" /FD /GZ /c
# ADD BASE RSC /l 0x415 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
@@ -307,10 +307,6 @@ SOURCE=.\ZipFileHeader.cpp
# End Source File
# Begin Source File
-SOURCE=.\ZipInternalInfo.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\ZipMemFile.cpp
# End Source File
# Begin Source File
@@ -423,6 +419,10 @@ SOURCE=.\ZipException.h
# End Source File
# Begin Source File
+SOURCE=.\ZipExport.h
+# End Source File
+# Begin Source File
+
SOURCE=.\ZipFile.h
# End Source File
# Begin Source File
@@ -435,10 +435,6 @@ SOURCE=.\ZipFileMapping.h
# End Source File
# Begin Source File
-SOURCE=.\ZipInternalInfo.h
-# End Source File
-# Begin Source File
-
SOURCE=.\ZipMemFile.h
# End Source File
# Begin Source File
diff --git a/stepmania/src/smpackage/ZipArchive/ZipArchive.dsw b/stepmania/src/smpackage/ZipArchive/ZipArchive.dsw
index b4d097172a..204ef46774 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipArchive.dsw
+++ b/stepmania/src/smpackage/ZipArchive/ZipArchive.dsw
@@ -3,7 +3,7 @@ Microsoft Developer Studio Workspace File, Format Version 6.00
###############################################################################
-Project: "ZipArchive"=.\ZipArchive.dsp - Package Owner=<4>
+Project: "ZipArchive"=".\ZipArchive.dsp" - Package Owner=<4>
Package=<5>
{{{
diff --git a/stepmania/src/smpackage/ZipArchive/ZipArchive.h b/stepmania/src/smpackage/ZipArchive/ZipArchive.h
index b719cf6636..5402d6e7fa 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipArchive.h
+++ b/stepmania/src/smpackage/ZipArchive/ZipArchive.h
@@ -1,10 +1,10 @@
///////////////////////////////////////////////////////////////////////////////
// $Workfile: ZipArchive.h $
-// $Archive: /ZipArchive_STL/ZipArchive.h $
+// $Archive: /ZipArchive/ZipArchive.h $
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -27,6 +27,8 @@
//
//
+
+
/**
* \file ZipArchive.h
* Interface for the CZipArchive class.
@@ -72,24 +74,195 @@
#endif
#endif //
+#if (_MSC_VER > 1000) && (defined ZIP_HAS_DLL)
+ #pragma warning( disable : 4251 ) // needs to have dll-interface to be used by clients of class
+ #pragma warning( disable : 4275 ) // non dll-interface class used as base for dll-interface
+#endif
+
+#ifdef __GNUC__
+ #include "zlib.h"
+#else
+ #include "zlib/zlib.h"
+#endif
+
#include "ZipException.h"
+#include "ZipAutoBuffer.h"
#include "ZipCentralDir.h"
#include "ZipStorage.h"
-#include "ZipInternalInfo.h"
#include "ZipPathComponent.h"
#include "ZipString.h"
+#include "ZipExport.h"
+/**
+ Structure used as a parameter in CZipArchive::AddNewFile(CZipAddNewFileInfo& );
+ Use one of constructors provided and then adjust the member variables that are
+ set to default values by #Defaults method.
+*/
+struct ZIP_API CZipAddNewFileInfo
+{
+ CZipAddNewFileInfo(LPCTSTR lpszFilePath, bool bFullPath = true)
+ : m_szFilePath(lpszFilePath),m_bFullPath(bFullPath)
+ {
+ m_pFile = NULL;
+ Defaults();
+ }
+ CZipAddNewFileInfo(LPCTSTR lpszFilePath, LPCTSTR lpszFileNameInZip)
+ : m_szFilePath(lpszFilePath), m_szFileNameInZip(lpszFileNameInZip)
+ {
+ m_pFile = NULL;
+ Defaults();
+ }
+ CZipAddNewFileInfo(CZipAbstractFile* pFile, LPCTSTR lpszFileNameInZip)
+ : m_pFile(pFile), m_szFileNameInZip(lpszFileNameInZip)
+ {
+ Defaults();
+ }
+ /**
+ the full path to the file to be added; if it is empty you need to set #m_pFile
+ */
+ CZipString m_szFilePath;
+
+ /**
+ the file name that will be stored in the archive (if the file is a directory,
+ there is a path separator automatically added at the end); #SetRootPath
+ function has no effect on this parameter
+ */
+ CZipString m_szFileNameInZip;
+
+ /**
+ It has only the meaning when #m_szFileNameInZip is not specified and #m_szFilePath is not empty.
+
+ - if \c true, include full path of the file inside the archive (even if #m_szRootPath is set)
+
+ - if \c false only the filename without a path is stored in the archive
+
+ in this case if #m_szRootPath is set previously with #SetRootPath
+ and if the beginning of #m_szFilePath equals #m_szRootPath
+ then the filename is set to the remaining part of m_szFilePath
+ (you can say to m_lpszFilePath minus #m_szRootPath)
+ */
+ bool m_bFullPath;
+
+ /**
+ the compression level, see #OpenNewFile
+ */
+ int m_iComprLevel;
+
+ /**
+ the smartness level of of the library; can be one or more #Smartness
+ values (you can OR them);
+ if zipsmCheckForEff is specified and due to it the file needs to be
+ reinserted into the archive without a compression and the callback
+ functor is specified, the callback functor's method Callback is called with the first argument set to
+ DWORD (-1) (you need to remember the last argument if you need the size of the file)
+ */
+ int m_iSmartLevel;
+
+ /**
+ the index of the existing file in the archive to be replaced by the file being added (the new file
+ goes into the same physical place as the old file - the archive may of course grow or shrink as a result)
+
+- >= 0 the index of the file to be replaced
+- -1 do not replace any file and add the new file at the end of the archive (default)
+- -2 if the new file has the same name as a file already in the archive then replace it or add at the end of the archive if it's filename is unique; it uses CZipArchive::FindFile with
+ the arguments \e iCaseSensitive and \e bFileNameOnly set to default values
+
+ \note
+ - you replace files in disk-spanning archives (i.e. use a value different from -1)
+ - if the space size taken by the old file is different from the space size needed by the new file, the callback is called while moving data (see CZipArchive::cbReplace)
+ - this replaces the file physically, so no information from the file being replaced is retained (such as attributes, modification time, etc.)
+ - if you use an invalid index, the function will fail; if you specify the last file in the archive to be replaced, it'll be removed and the usual action taken
+ - the new file encryption does not depend on the old file encryption but only on the current password settings (see CZipArchive::SetPassword)
+ - if #m_iComprLevel is not 0 then a temporary archive is created in the temporary directory
+ (see CZipArchive::SetTempPath) or in the memory (if you use CZipArchive::zipsmMemoryFlag in #m_iSmartLevel)
+ - the most complicated scenario is when you try to replace the file and use CZipArchive::zipsmCheckForEff flag in #m_iSmartLevel and the file compression proves to be
+ inefficient (you can use the sample application \e ZipArc to observe the following process):
+ - first you get CZipArchive::cbAdd callback - the file is being compressed to a temporary archive,
+ - then the file compression proves to be inefficient and the file needs to be stored instead of compressed,
+ but first the space inside archive must be adjusted to fit the file being added in the place of file being replaced - you get CZipArchive::cbReplace,
+ - then, at the end, the file is being stored - you get CZipArchive::cbAddStore callback
+
+ \see SetAdvanced
+ \see CZipArchive::WillBeDuplicated
+ */
+ int m_iReplaceIndex;
+
+ /**
+ the size of the buffer used while file operations
+ */
+ unsigned long m_nBufSize;
+
+ /**
+ instead of from a physical file, the data for compression is taken from the CZipAbstractFile object (e.g. from CZipMemFile)
+
+ \note
+ - you have to leave #m_szFilePath empty if you set #m_pFile to not NULL
+ - the time of the file in zip is set to the current time, and the attributes to the default
+ file attributes (depending on the system)
+ - you cannot add directories this way
+ */
+ CZipAbstractFile* m_pFile;
+
+ /**
+ Set default values for #m_iSmartLevel, #m_iReplaceIndex, #m_nBufSize and #m_iComprLevel
+ */
+ void Defaults();
+};
+
/**
The representation of the zip archive file.
- This class provides all the operations on the zip archive.
+ This class provides all the operations on the zip archive.
+
*/
-class CZipArchive
+class ZIP_API CZipArchive
{
public:
+ /**
+ The purpose of this structure is to hold the data that allow communication
+ with the zlib library
+ */
+ struct ZIP_API CZipInternalInfo
+ {
+ CZipInternalInfo()
+ {
+ m_iBufferSize = 65536;
+ }
+ virtual ~CZipInternalInfo(){}
+
+ /**
+ Allocate internal buffer of m_iBufferSize size
+ */
+ void Init()
+ {
+ m_pBuffer.Allocate(m_iBufferSize);
+ }
+ void ReleaseBuf()
+ {
+ m_pBuffer.Release();
+ }
+ z_stream m_stream; ///< zlib library data stream
+ DWORD m_uUncomprLeft; ///< bytes left to uncompress
+ DWORD m_uComprLeft; ///< bytes left to decompress
+ DWORD m_uCrc32; ///< crc32 file control value
+
+ /**
+ The size of the buffer used in decompressing data.
+ Set before opening the archive.
+ It is usually set with CZipArchive::SetAdvanced
+ (specify this value as the second argument).
+ \see CZipArchive::SetAdvanced
+ */
+ DWORD m_iBufferSize;
+
+ /**
+ This buffer caches data during compression and decompression.
+ */
+ CZipAutoBuffer m_pBuffer;
+ };
CZipArchive();
virtual ~CZipArchive();
@@ -119,7 +292,7 @@ public:
/**
Set the password for the file to be opened or created.
- Use this method BEFORE opening or adding a file
+ Use this method BEFORE opening or adding a file, but AFTER opening an archive
\param lpszPassword
set it to NULL to clear password
\return \c false if the password contains ASCII characters
@@ -139,16 +312,30 @@ public:
the write buffer in the disk spanning archive is the size of the volume.
\param iWriteBuffer
- buffer used during write operation to the disk
+ the write cache size used
\see CZipStorage::m_iWriteBufferSize
- \param iExtractBuffer
- buffer used in extracting and compressing files
+ \param iGeneralBuffer
+ buffer used in extracting, compressing, deleting, getting (#GetFromArchive) files, renaming and replacing
\see CZipInternalInfo::m_iBufferSize
\param iSearchBuffer
the buffer used in searching for the central dir
\see CZipCentralDir::m_iBufferSize
+ \see GetAdvanced
*/
- void SetAdvanced(int iWriteBuffer = 65535, int iExtractBuffer = 16384, int iSearchBuffer = 32768);
+ void SetAdvanced(int iWriteBuffer = 65536, int iGeneralBuffer = 65536, int iSearchBuffer = 32768);
+
+ /**
+ retreive buffer size as set by #SetAdvanced
+ */
+ void GetAdvanced(int* piWriteBuffer = NULL, int* piGeneralBuffer = NULL, int* piSearchBuffer= NULL)
+ {
+ if (piWriteBuffer)
+ *piWriteBuffer = m_storage.m_iWriteBufferSize;
+ if (piGeneralBuffer)
+ *piGeneralBuffer = m_info.m_iBufferSize;
+ if (piSearchBuffer)
+ *piSearchBuffer = m_centralDir.m_iBufferSize;
+ }
/**
Enum values used as \e iWhich parameter in #SetCallback function.
@@ -172,9 +359,15 @@ public:
cbTest = 0x0040, ///< called when testing a file with #TestFile function
cbSave = 0x0080, ///< called when saving the central directory with CZipCentralDir::Write (usually on close or flush); it is safe to break on non-disk spanning archive - the saved part of
///< the central directory will be removed from disk
+ cbGetFromArchive
+ = 0x0100, ///< called when using one of #GetFromArchive methods
+ cbRename = 0x0200, ///< called when during the renaming a file there is a need to make less or more space for the new filename
+ cbReplace = 0x0400, ///< called when moving data while replacing files to make less or more space for the new file
+ cbNextValue = 0x0800, ///< for CZipActionCallback overrides and user defined callbacks
+
- cbSubActions= cbAddTmp | cbAddStore | cbDeleteCnt, ///< sub actions - they are part of bigger actions (#cbAddTmp | #cbAddStore | #cbDeleteCnt)
- cbActions = cbAdd | cbExtract | cbDelete | cbTest | cbSave, ///< main actions (#cbAdd | #cbExtract | #cbDelete | #cbTest | #cbSave)
+ cbSubActions= cbAddTmp | cbAddStore | cbDeleteCnt | cbReplace, ///< sub actions - they are part of bigger actions (#cbAddTmp | #cbAddStore | #cbDeleteCnt | #cbReplace)
+ cbActions = cbAdd | cbExtract | cbDelete | cbTest | cbSave | cbGetFromArchive | cbRename, ///< main actions (#cbAdd | #cbExtract | #cbDelete | #cbTest | #cbSave | #cbGetFromArchive | #cbRename)
cbAll = cbActions | cbSubActions ///< assign all callbacks to the same functor
};
@@ -191,10 +384,19 @@ public:
can be one or more (use logical OR) #CallbackType values.
\see CZipActionCallback
+ \see GetCallback
*/
void SetCallback(CZipActionCallback* pCallback = NULL, int iWhich = cbAll);
+ /**
+ \return the callback \e iWhich set with #SetCallback
+ */
+ CZipActionCallback* GetCallback(CallbackType iWhich)
+ {
+ return m_callbacks.Get(iWhich);
+ }
+
/**
Set the callback functor used during operations on a
PKZIP compatible disk spanning archive to change disks.
@@ -256,7 +458,13 @@ public:
\param iMode
one of the #OpenMode values
\param iVolumeSize
- the volume size in the disk spanning archive
+ the volume size in the disk spanning archive;
+ the size of the volume may be from 1 to INT_MAX ,
+ and the bigger - the faster is creation and extraction (no file changes between volumes) - but the size of the whole archive is the same.
+ If you're creating disk-spanning archive in \ref TDSpan "TD span compatible mode"
+ and plan later to convert it to \ref PKSpan "PKZIP compatible mode" (see \ref sectSpan), it is good to set this this value to
+ about the size of the diskette (a little less just in case).
+
\note Throws exceptions.
\see Open(CZipMemFile&, int);
\see GetSpanMode
@@ -290,7 +498,7 @@ public:
in the archive
if \c NULL - clears the #m_szRootPath and no path beginning will be matched against it
- \note set the case-sensitivity with #SetCaseSensitivity
+ \note Set the case-sensitivity with #SetCaseSensitivity
\see AddNewFile
\see ExtractFile
@@ -302,9 +510,6 @@ public:
/**
Return the current value of #m_szRootPath
-
- \param none
-
\return CZipString
*/
CZipString GetRootPath()const
@@ -314,7 +519,7 @@ public:
/**
The levels of smartness of the adding files action (see #AddNewFile)
- \note if you wish to use \e zipsmCheckForEff, you should use
+ \note If you wish to use \e zipsmCheckForEff, you should use
\e zipsmNotCompSmall as well, because it will save you the time
( the small file will be surely larger after compression, so that
we can add it not compressed straight away);the compression level
@@ -334,7 +539,7 @@ public:
///< if it is not present or there is not enough space there, it tries the current directory, if it fails, no temporary file is created
///< and the compression goes the usual way
- zipsmMemoryFlag = 0x0010, ///< combine it with zipsmCheckForEff or use zipsmCheckForEffInMem
+ zipsmMemoryFlag = 0x0010, ///< combine it with zipsmCheckForEff or use zipsmCheckForEffInMem, you can also use this when replacing files see note at CZipAddNewFileInfo::m_iReplaceIndex
zipsmCheckForEffInMem = zipsmMemoryFlag | zipsmCheckForEff, ///< the same as #zipsmCheckForEff, but the temporary file is created created in memory instead (the temporary directory set with #SetTempPath() is ignored); has the meaning only with a disk-spanning archive,
///< non-disk spanning archives don't need a temporary file
@@ -348,84 +553,51 @@ public:
};
-
-
-/**
- Add a new file to the archive. You can set the callback functor with #SetCallback.
-
- \param lpszFilePath
- the full path to the file to be added
- \param iLevel
- the compression level, see #OpenNewFile
- \param bFullPath
- - if \c true, include full path of the file inside the archive (even if #m_szRootPath is set);
- - if \c false only the filename without a path is stored in the archive
- in this case if #m_szRootPath is set previously with #SetRootPath
- and if the beginning of \e lpszFilePath equals #m_szRootPath
- then the filename is set to the remaining part of \e lpszFilePath
- (you can say to \e lpszFilePath minus #m_szRootPath)
- \param iSmartLevel
- the level of smartness of the library; can be one or more #Smartness
- values (you can OR them)
- if zipsmCheckForEff is specified and due to it the file needs to be
- reinserted into the archive without a compression and the callback
- functor is specified, the callback functor's method Callback is called with the first argument set to
- DWORD (-1) (you need to remember the last argument if you need the size of the file)
- \param nBufSize
- the size of the buffer used
- \return \c if it returns false then the file was not added, but the internal
- state allows you to add other files (which is not possible after throwing
- an exception)
- \note Throws exceptions.
- \note If you abort while adding a file in a non-disk-spanning archive, the added data will be removed from the archive
- \see SetCallback
- \see AddNewFile(LPCTSTR, LPCTSTR, int, int, unsigned long)
- \see AddNewFile(CZipMemFile&, LPCTSTR, int, int, unsigned long)
- \todo Replacing files in the archive
-*/
- bool AddNewFile(LPCTSTR lpszFilePath, int iLevel = -1, bool bFullPath = true,
- int iSmartLevel = zipsmSafeSmart, unsigned long nBufSize = 65535);
-
-
-/**
- Add a new file to the archive.
- The same as #AddNewFile(LPCTSTR, int, bool, int, unsigned long)
- but differs by one argument:
- \param lpszFileNameInZip
- the file name that will be stored in the archive (to the directories,
- there is a path separator automatically added at the end); #SetRootPath
- function has no effect on this parameter
+ /**
+ Add a new file to the archive. You can set the callback functor with #SetCallback.
+ \param info see CZipAddNewFileInfo
+ \return \c if it returns false then the file was not added, but the internal
+ state allows you to add other files (which is not possible after throwing
+ an exception)
+
+ \note
+ - If you abort while adding a file in a non-disk-spanning archive, the added data will be removed from the archive
+ - Throws exceptions.
+
+ \see SetCallback
+ \see AddNewFile(LPCTSTR, LPCTSTR, int, int, unsigned long)
+ \see AddNewFile(LPCTSTR, int, bool, int, unsigned long)
+ \see AddNewFile(CZipMemFile&, LPCTSTR, int, int, unsigned long)
+ */
+ bool AddNewFile(CZipAddNewFileInfo& info);
- \see AddNewFile(CZipMemFile&, LPCTSTR, int, int, unsigned long)
-
-*/
- bool AddNewFile(LPCTSTR lpszFilePath,
- LPCTSTR lpszFileNameInZip,
- int iLevel = -1,
- int iSmartLevel = zipsmSafeSmart,
- unsigned long nBufSize = 65535);
/**
- Add a new file to the archive.
- The same as #AddNewFile(LPCTSTR, LPCTSTR, int, int, unsigned long)
- but differs by one argument:
+ \see AddNewFile(CZipAddNewFileInfo& ); the parameters are equivalent to CZipAddNewFileInfo member variables
+
+ */
+ bool AddNewFile(LPCTSTR lpszFilePath, int iComprLevel = -1, bool bFullPath = true,
+ int iSmartLevel = zipsmSafeSmart, unsigned long nBufSize = 65536);
- \param mf
- instead of from the physical file, the data for compression is taken from the CZipMemFile object
- \note
- - the time of the file in zip is set to the current time, and the attributes to the default
- file attributes (depending on the system)
- - you cannot add directories with this function
- \see AddNewFile(LPCTSTR, int, bool, int, unsigned long)
-
+ /**
+ \see AddNewFile(CZipAddNewFileInfo& ); the parameters are equivalent to CZipAddNewFileInfo member variables
+ */
+ bool AddNewFile(LPCTSTR lpszFilePath,
+ LPCTSTR lpszFileNameInZip,
+ int iComprLevel = -1,
+ int iSmartLevel = zipsmSafeSmart,
+ unsigned long nBufSize = 65536);
+
+ /**
+ \see AddNewFile(CZipAddNewFileInfo& ); the parameters are equivalent to CZipAddNewFileInfo member variables
*/
bool AddNewFile(CZipMemFile& mf,
LPCTSTR lpszFileNameInZip,
- int iLevel = -1,
+ int iComprLevel = -1,
int iSmartLevel = zipsmSafeSmart,
- unsigned long nBufSize = 65535);
+ unsigned long nBufSize = 65536);
@@ -469,16 +641,18 @@ public:
\param lpszFilePath
The path to the file to retrieve date stamp and attributes from.
These values are stored inside the archive.
+ \param uInternal
+ for internal use only
\return \c false in the following cases:
- the \e lpszFilePath is not NULL and the file attributes and data was not correctly retrieved
- a file is already opened for extraction or compression
- archive is an existing disk span archive
- - maximum file count inside archive already reached (65535)
+ - maximum file count inside archive already reached (65536)
\note Throws exceptions.
*/
- bool OpenNewFile(CZipFileHeader & header, int iLevel = Z_DEFAULT_COMPRESSION, LPCTSTR lpszFilePath = NULL);
+ bool OpenNewFile(CZipFileHeader & header, int iLevel = Z_DEFAULT_COMPRESSION, LPCTSTR lpszFilePath = NULL, DWORD uInternal = 0);
/**
Compress the contents of the buffer and write it to a new file.
@@ -512,12 +686,108 @@ public:
\param bAfterException
it will close the new file without writing anything (call it also
with this parameter set to \c true after an exception other than CZipException::abortedSafely was
- thrown from one of \e AddNewFile functions)
+ thrown from one of #AddNewFile functions)
\note Throws exceptions.
\see OpenNewFile
*/
bool CloseNewFile(bool bAfterException = false);
+/**
+ Acquire a file with the given index from another archive.
+ The compressed data of the file from another archive are copied
+ without decompressing to the current archive.
+ You can set the callback functor with #SetCallback.
+ \param zip
+ an opened archive to get the file from (must not be multi-disk)
+ \param uIndex
+ a zero-based index of the file to get from the \e zip archive
+ \param iReplaceIndex the same as CZipAddNewFileInfo::m_iReplaceIndex
+ \param bKeepSystComp
+ if \c false, which is default, then the file from \e zip archive
+ system compatibility is converted to the current archive system
+ compatibility (if they differ)
+ \return \c false if the operation could not be performed (either of archives is closed,
+ a file inside either of archives is opened, \e zip archive is multi-disk or the current
+ archive is an existing multi-disk archive)
+ \note Throws exceptions
+ (when an exception is thrown, you may need to call #CloseNewFile with \e bAfterException set to \c true, to make the archive reusable).
+ \note it is safe to abort the action (by returning false from the callback call) in non-disk spanning archive and when no replacing is taking place
+ (the file not entirely added is removed from the archive)
+ \see SetCallback
+ \see GetFromArchive(CZipArchive& , CZipWordArray &, bool)
+ \see GetFromArchive(CZipArchive& , CZipStringArray &, bool)
+ \see FindMatches
+ \see SetAdvanced
+*/
+ bool GetFromArchive(CZipArchive& zip, WORD uIndex, int iReplaceIndex = -1, bool bKeepSystComp = false)
+ {
+
+ m_info.Init();
+ bool bRet;
+ try
+ {
+ bRet = GetFromArchive(zip, uIndex, iReplaceIndex, bKeepSystComp, GetCallback(cbGetFromArchive));
+ }
+ catch(...)
+ {
+ m_info.ReleaseBuf();
+ throw;
+ }
+ m_info.ReleaseBuf();
+ if (bRet && m_bAutoFlush)
+ Flush();
+
+ return bRet;
+ }
+
+ /**
+ Acquire files with the given indexes from another archive.
+
+ \param aIndexes
+ an array of zero-based indexes of the files inside the \e zip archive
+
+ \see GetFromArchive(CZipArchive& , WORD, int, bool)
+
+ \note
+ - To get files which filenames match a specified pattern, use #FindMatches function
+ */
+ bool GetFromArchive(CZipArchive& zip, CZipWordArray &aIndexes, bool bKeepSystComp = false);
+
+ /**
+ Acquire files with the given indexes from another archive.
+ \param aNames
+ an array of filenames inside the \e zip archive;
+
+ \see GetFromArchive(CZipArchive& , WORD, int, bool)
+ \see EnableFindFast
+
+ \note
+ - Set the case-sensitivity with #SetCaseSensitivity
+ - Enables FindFast if not enabled
+
+ */
+
+ bool GetFromArchive(CZipArchive& zip, CZipStringArray &aNames, bool bKeepSystComp = false)
+ {
+ CZipWordArray indexes;
+ zip.GetIndexes(aNames, indexes);
+ return GetFromArchive(zip, indexes, bKeepSystComp);
+
+ }
+
+ /**
+ Get indexes of the files stored int \e aNames array and put them into \e aIndexes
+ \param aNames
+ an array of filenames inside the archive;
+ \param aIndexes
+ an array of indexes to be build
+ \note
+ - Set the case-sensitivity with #SetCaseSensitivity
+ - Enables FindFast if not enabled
+
+ */
+ void GetIndexes(const CZipStringArray &aNames, CZipWordArray& aIndexes);
+
/**
Extract the file from the archive. You can set the callback functor with #SetCallback.
The argument \e lpszNewName may point to the full path and is influenced by \e bFullPath
@@ -525,14 +795,14 @@ public:
\param uIndex
the index of the file to extract
\param lpszPath
+ \verbatim
The PATH only to extract the file to. May not be NULL. If you wish to
use UNC path you need to replace \\\\ at the beginning of UNC path with \\\\?\UNC\ .
+ \endverbatim
\param bFullPath
- if \c true, then extract with the full path - in this case the resulting
file path is \e lpszPath plus the path stored in the archive or plus \e lpszNewName
if \e lpszNewName is not NULL.
- If the path of the file stored in the archive or \e lpszNewName contains a drive letter,
- it is removed.
- if \c false, the destination file path is \e lpszPath + \e the filename only
extracted from the path stored in the archive or from \e lpszNewName if
\e lpszNewName is specified;
@@ -544,19 +814,19 @@ public:
\param lpszNewName
The new name of the file after extraction.
If NULL the original filename stored in the archive is used.
- May point to the full path but, if \e bFullPath is \c false, only the filename is extracted from this argument,
- if the \e bFullPath is \c true, the drive letter (if exists) is removed.
+ May point to the full path but, if \e bFullPath is \c false, only the filename is extracted from this argument,
\param nBufSize
- the size of the buffer used
+ the size of the buffer used while file operations
\return \c true if successful
- \note to extract files which filenames match a specified pattern, use #FindMatches function
- \note Throws exceptions.
+ \note
+ - To extract files which filenames match a specified pattern, use #FindMatches function
+ - Throws exceptions.
\see SetCallback
\see ExtractFile(WORD, CZipMemFile&, DWORD)
\see FindMatches
*/
bool ExtractFile(WORD uIndex, LPCTSTR lpszPath, bool bFullPath = true,
- LPCTSTR lpszNewName = NULL, DWORD nBufSize = 65535);
+ LPCTSTR lpszNewName = NULL, DWORD nBufSize = 65536);
/**
@@ -566,7 +836,7 @@ public:
- if you pass CZipMemFile object already with data, its contents are NOT overwirtten, but the decompressed data is appended at the end
- if you try to extract a directory, the function will return \c false
*/
- bool ExtractFile(WORD uIndex, CZipMemFile& mf, DWORD nBufSize = 65535);
+ bool ExtractFile(WORD uIndex, CZipMemFile& mf, DWORD nBufSize = 65536);
/**
Open the file with the given index in the archive for extracting.
@@ -604,12 +874,12 @@ public:
the size of the buffer used during extraction
\return \c false if the incorrect action has been taken by
the user or the programmer (it is when #OpenFile or #GetFileInfo returned \c false or \e uBufSize is 0).
- If the file didn't passed the test or there was a disk I/O error, an exception is thrown.
+ If the file didn't passed the test or there was a disk I/O error or the password supplied was incorrect, an exception is thrown.
\note Throws exceptions.
\see SetCallback
*/
- bool TestFile(WORD uIndex, DWORD uBufSize = 65535);
+ bool TestFile(WORD uIndex, DWORD uBufSize = 65536);
/**
Perform the necessary cleanup after an exception was thrown
@@ -657,7 +927,7 @@ public:
because the system may not be able to retrieve information from it.
\return
- "1" = ok
- - "-1" = some bytes left to uncompress - probably due to a bad password
+ - "-1" = some bytes left to uncompress - probably due to a bad password or corrupted archive
- "-2" = setting extracted file date and attributes was not successful
\note Throws exceptions.
*/
@@ -666,6 +936,8 @@ public:
/**
Delete the file from the archive with the given index.
You can set the callback functor with #SetCallback.
+ If you plan to delete more than one file, use one of DeleteFiles functions rather than calling DeleteFile
+ successively, because these functions are optimized for deleting multiple files
\param uIndex
a zero-based index
\note Throws exceptions.
@@ -679,11 +951,12 @@ public:
/**
Delete files from the archive.
You can set the callback functor with #SetCallback.
- Sort \e aIndexes array in an ascending order.
+ Sorts \e aIndexes array in an ascending order.
\param aIndexes
an array of zero-based indexes of the files inside the archive
- \note to remove files which filenames match a specified pattern, use #FindMatches function
- \note Throws exceptions.
+ \note
+ - To remove files which filenames match a specified pattern, use #FindMatches function
+ - Throws exceptions.
\see SetCallback
\see DeleteFile
\see DeleteFiles(const CZipStringArray& )
@@ -695,19 +968,18 @@ public:
/**
Delete files from the archive.
You can set the callback functor with #SetCallback.
- \param &aNames
- an array of filenames inside the archive;
- \param bFileNameOnly
- the same as in #FindFile
- \note set the case-sensitivity with #SetCaseSensitivity
- \note Enables FindFast if not enabled
- \note Throws exceptions.
+ \param aNames
+ an array of filenames inside the archive;
+ \note
+ - Set the case-sensitivity with #SetCaseSensitivity
+ - Enables FindFast if not enabled
+ - Throws exceptions.
\see SetCallback
\see DeleteFile
\see DeleteFiles(CZipWordArray&)
\see EnableFindFast
*/
- void DeleteFiles(const CZipStringArray &aNames, bool bFileNameOnly = false);
+ void DeleteFiles(const CZipStringArray &aNames);
/**
@@ -755,21 +1027,6 @@ public:
/**
Return the disk spanning mode of the current archive.
- Disk spanning archive modes:
-
- \anchor PKSpan
- PKZIP compatible mode (pkzipSpan):
- - only on removable devices
- - auto-detect the size of the volume
- - write a label to the disk
- - there is a need to set a span callback functor (use #SetSpanCallback)
-
- \anchor TDSpan
- TD mode (tdSpan):
- - may be created on non removable devices
- - uses user-defined volume size
- - no need to set a span callback functor
-
\return
- -2 - existing TD mode compatible disk spanning archive
- -1 - existing PKZIP compatible
@@ -777,14 +1034,8 @@ public:
- 1 - PKZIP compatible in creation
- 2 - TD compatible in creation
- This two disk spanning modes create volumes with compatible internal
- structure. It means that you can easily convert the volumes created
- in one mode to the other one by renaming the files
- (in TD mode each volume but last has a number as an extension).
- To convert the archive from TD to PKZIP compatible archive,
- Copy each file to the removable media, giving them the extension.
- ".zip". You should also label each disk with the appropriate label
- starting from "pkback# 001".
+ \see \ref PKSpan, \ref TDSpan
+
*/
int GetSpanMode()const
{
@@ -813,9 +1064,9 @@ public:
/**
Find the file in the archive.
- If the archive wasn't opened with #m_bConvertAfterOpen set to \c true,
+ If the archive wasn't opened with CZipCentralDir::m_bConvertAfterOpen set to \c true,
this function automatically convert all the filenames with the function
- CZipCentralDir::ConvertAll and set #m_bConvertAfterOpen to \c true.
+ CZipCentralDir::ConvertAll and set CZipCentralDir::m_bConvertAfterOpen to \c true.
This function requires \link CZipCentralDir::m_bFindFastEnabled FindFast \endlink
feature enabled.
\param lpszFileName
@@ -825,9 +1076,7 @@ public:
\param iCaseSensitive can be one of #FFCaseSens values
\param bFileNameOnly
if \c true, the function tries to find a filename without a path (a less effective search is performed); if you wish to find
- a directory name, do not end it with the path separator, which is required if you
- set \e bFileName to \c false
-
+ a directory name, do not end it with the path separator, which is required if you set \e bFileName to \c false
\return
- the index of the file found
- -1 if there is no such a file in the archive
@@ -850,9 +1099,25 @@ public:
/**
+ \param bOnlyFiles
+ if \c true, the directories are not inluded in a total count;
+ default is \c false
\return the number of files in the archive
*/
- int GetCount()const {return m_centralDir.m_headers.GetSize();}
+ int GetCount(bool bOnlyFiles = false)const
+ {
+ int iTotalCount = m_centralDir.m_headers.GetSize();
+ if (bOnlyFiles)
+ {
+ int iCount = 0;
+ for (int i = 0; i < iTotalCount; i++)
+ if (!m_centralDir.m_headers[i]->IsDirectory())
+ iCount++;
+ return iCount;
+ }
+ else
+ return iTotalCount;
+ }
/**
values used in #Close function as parameter \e iAfterException
@@ -869,9 +1134,13 @@ public:
Close the archive.
\param iAfterException
one of #CloseAfterException enum values
+ \param bUpdateTimeStamp
+ if \c true, set the modification date of the zip file to the date of the newest file in the archive;
+ in disk-spanning mode only the last archive file will have the time stamp updated;
+ you can use this option even without performing any additional processing on the archive, just open and close it
\note Throws exceptions if \e iAfterException is different from \c afAfterException
*/
- void Close(int iAfterException = afNoException);
+ void Close(int iAfterException = afNoException, bool bUpdateTimeStamp = false);
/**
@@ -895,9 +1164,10 @@ public:
after finalizing the disk spanning archive it turns out that it is one disk only, it is converted to
a normal archive and you can use it as such. If you want to know what is the state of the archive after using
this function call #GetSpanMode.
- \note Cannot be used on existing disk spanning archives (they are not modifable anyway)
- \note If you have an archive with a huge central directory, it'll influence the perfomance calling this function without a reason.
- \note Throws exceptions.
+ \note
+ - Cannot be used on existing disk spanning archives (they are not modifable anyway)
+ - If you have an archive with a huge central directory, it'll influence the perfomance calling this function without a reason.
+ - Throws exceptions.
\see GetSpanMode
\see SetAutoFlush
\see GetAutoFlush
@@ -911,8 +1181,9 @@ public:
(adding a new file, deleting file(s), modifying the global or a file comment).
It is useful when we want to prevent the loss of data in case of the program crash - the zip file will be then finalized on the disk.
Use it after opening the archive.
- \note You can set AutoFlush only for non-disk spanning archives, however you can call #Flush once for a disk-spanning archive in creation.
- \note If you have an archive with a huge central directory, setting Auto-Flush will influence the performance.
+ \note
+ - You can set AutoFlush only for non-disk spanning archives, however you can call #Flush once for a disk-spanning archive in creation.
+ - If you have an archive with a huge central directory, setting Auto-Flush will influence the performance.
\see Flush
\see GetAutoFlush
*/
@@ -1046,7 +1317,7 @@ public:
Set CZipCentralDir::m_bFindFastEnabled to \c true, which is required by #FindFile.
#FindFileIt is called by #FindFileif necessary. It builds CZipCentralDir::m_findarray
with the default case-sensitivity (set with #SetCaseSensitivity)
- \note call after opening the archive.
+ \note Call it only after opening the archive.
\param bEnable
\see CZipCentralDir::m_bFindFastEnabled
\see FindFile
@@ -1126,12 +1397,26 @@ public:
the same as \e bFullPath in #AddNewFile
\param iWhat
one of #Predict values to treat \e lpszFilePath correctly
- bool bAnsiOEM
- if \c true, ANSI->OEM conversion is made
+ \param bExactly
+ if \c true, return the filename exactly as it would look inside the archive i.e. convert slash to backslash, and perform ANSI->OEM conversion;
+ otherwise return the filename with the path separators that are used by default in the system
\return a modified file path
*/
- CZipString PredictFileNameInZip(LPCTSTR lpszFilePath, bool bFullPath, int iWhat = prAuto, bool bAnsiOEM = false)const ;
+ CZipString PredictFileNameInZip(LPCTSTR lpszFilePath, bool bFullPath, int iWhat = prAuto, bool bExactly = false)const ;
+
+ /**
+ Check if the filename will be duplicted in the archive, if added to the archive in the given form
+ \param bFileNameOnly
+ if \c true, assume that the filename is duplicated if only the filename (no path) is the same (\e bFullPath is ignored), otherwise the whole filename with path is taken into account.
+
+ \b Default: \c false
+
+ The rest of the parameters have the same meaning as in #PredictFileNameInZip.
+
+ \return the zero-based index of the file in the archive that the filename would be duplicated, or -1, if the filename is unique
+ */
+ int WillBeDuplicated(LPCTSTR lpszFilePath, bool bFullPath, bool bFileNameOnly = false, int iWhat = prAuto);
/**
@@ -1139,7 +1424,7 @@ public:
to the #ExtractFile(WORD , LPCTSTR , bool , LPCTSTR , DWORD ) function. The function takes into account the root path set with #SetRootPath.
\param lpszFileNameInZip
the filename of the file inside the archive (may be \c NULL if lpszNewName is not \c NULL)
- \param lpszFilePath
+ \param lpszPath
\param bFullPath
\param lpszNewName
\return a predicted file path
@@ -1186,13 +1471,15 @@ public:
- #TrimRootPath
- #DeleteFiles
- \note set it before using one of the functions above or leave it as it is by default;
- the default CZipArchive case-sensitivity depends on the system and is set
- as follows:
- - on Windows: \c false
- - on Linux: \c true
-
+
+
\param bCaseSensitive
+ the default CZipArchive case-sensitivity depends on the system and is set
+ as follows:
+ - on Windows: \c false
+ - on Linux: \c true
+ \note Set it before using one of the functions above or leave it as it is by default;
+
*/
void SetCaseSensitivity(bool bCaseSensitive)
@@ -1239,7 +1526,7 @@ public:
This class is based on code by J. Kercheval, created 01/05/1991
and available as a public domain at http://www.snippets.org.
*/
- class CWildcard
+ class ZIP_API CWildcard
{
public:
@@ -1271,7 +1558,7 @@ public:
\param lpszText
the string to match against
- \param iErrorType
+ \param iRetCode
if not \c NULL, set to one of #Match values indicating the return code
\return \c true if \e lpszText matches the pattern.
\see SetPattern
@@ -1378,12 +1665,44 @@ public:
*/
void FindMatches(LPCTSTR lpszPattern, CZipWordArray& ar, bool bFullPath = true)const;
+
+
+ /**
+ Change the name of the file with the given index.
+
+ \param uIndex
+ zero-based index of the file
+ \param lpszNewName
+ new name for the file
+ \return
+
+ \note Throws exceptions.
+ \see SetAdvanced
+ */
+ bool RenameFile(WORD uIndex, LPCTSTR lpszNewName);
+
+ /**
+
+ If \c true, the drive letter is removed from the filename stored inside the archive when adding a new file to the archive. It affects
+ #AddNewFile, #ExtractFile, #PredictFileNameInZip, #PredictExtractedFileName, #WillBeDuplicated methods.
+
+ \b Default: \c true
+ */
+ bool m_bRemoveDriveLetter;
+
protected:
+
+ /**
+ \param iReplaceIndex index of file to be replaced
+ \param uTotal the size of the new file to replace existing
+ \param lpszFileName the filename for callback initialization
+ */
+ void MakeSpaceForReplace(int iReplaceIndex, DWORD uTotal, LPCTSTR lpszFileName);
/**
A structure for the internal use only. Clears the password if necessary and
restores it later (also in case of an exception).
*/
- struct CZipSmClrPass
+ struct ZIP_API CZipSmClrPass
{
void ClearPasswordSmartly(CZipArchive* pZip)
{
@@ -1405,7 +1724,7 @@ protected:
Holds map of holes and areas to remain when deleting files from the archive.
A structure for the internal use only.
*/
- struct CZipDeleteInfo
+ struct ZIP_API CZipDeleteInfo
{
CZipDeleteInfo(){m_pHeader = NULL; m_bDelete = false;}
CZipDeleteInfo(CZipFileHeader* pHeader, bool bDelete)
@@ -1419,7 +1738,7 @@ protected:
Storage for callback functors. A structure for the internal use only.
\see SetCallback
*/
- struct CZipClbckStrg : public CZipMap
+ struct ZIP_API CZipClbckStrg : public CZipMap
{
void Set(CZipActionCallback* pCallback, CallbackType iType)
{
@@ -1441,6 +1760,7 @@ protected:
else
return NULL;
}
+
};
@@ -1516,6 +1836,8 @@ protected:
*/
bool m_bIgnoreCRC;
+
+
/**
The root path to be omitted in #AddNewFile and #ExtractFile functions
from the beginning of the full file path. Set by #SetRootPath
@@ -1561,16 +1883,10 @@ protected:
/**
Move the range of data in the archive specified by the \e uStartOffset
- and \e uEndOffset by \e uToMove
- \param uStartOffset
-
- \param uEndOffset
- \param uMoveBy
-
- \return \c false if callback functor's operator () returned \c false
+ and \e uEndOffset by \e uToMove
*/
- bool MovePackedFiles(DWORD uStartOffset, DWORD uEndOffset, DWORD uMoveBy);
+ void MovePackedFiles(DWORD uStartOffset, DWORD uEndOffset, DWORD uMoveBy, CZipActionCallback* pCallback, bool bForward = false);
/**
Remove recently added file (used by AddNewFile) if compressed is larger than uncompressed or if callback method return \c false.
@@ -1578,6 +1894,17 @@ protected:
*/
bool RemoveLast(bool bRemoveAnyway = false);
+
+ /**
+ It is used in GetFromArchive public functions and in AddNewFile and the callback parameter is needed
+ */
+ bool GetFromArchive(CZipArchive& zip, WORD uIndex, int iReplaceIndex, bool bKeepSystComp, CZipActionCallback* pCallback);
+
+ /**
+ \return whether the code should continue or not
+ */
+ bool UpdateReplaceIndex(int& iReplaceIndex, LPCTSTR lpszNewFileName);
+
/**
\return the currently opened for compression or decompression
file inside the archive NULL if there is no file opened
@@ -1628,17 +1955,19 @@ protected:
Copyright string.
*/
static const TCHAR m_gszCopyright[];
- /**
- \name Cryptography
+
+/**
+ \defgroup Cryptography Cryptography
Methods performing data encryption and decryption
and attributes used by them.
- */
- //@{
+*/
+ /*@{*/
+
/**
- Decode \e nCount bytes from the internal buffer.
+ Decode \e uCount bytes from the internal buffer.
\see m_info
\see CZipInternalInfo::m_pBuffer
- \param uCount
+
*/
void CryptDecodeBuffer(DWORD uCount);
/**
@@ -1650,7 +1979,7 @@ protected:
/**
Encode the character \e c and update \link #m_keys encryption keys \endlink.
- \param &c
+
*/
void CryptEncode(char &c);
/**
@@ -1667,14 +1996,11 @@ protected:
void CryptCryptHeader(long iCrc, CZipAutoBuffer& buf);
/**
\internal
- \param l
- \param c
\return
*/
DWORD CryptCRC32(DWORD l, char c);
/**
Decode the character \e c and update \link #m_keys encryption keys \endlink.
- \param &c
*/
void CryptDecode(char &c);
/**
@@ -1690,9 +2016,7 @@ protected:
*/
bool CryptCheck();
/**
- Update \link #m_keys encryption keys \endlink with the given value.
- \param c
-
+ Update \link #m_keys encryption keys \endlink with the given value.
*/
void CryptUpdateKeys(char c);
/**
@@ -1710,10 +2034,8 @@ protected:
\see CryptInitKeys
*/
DWORD m_keys[3];
-
- //@}
-
-
+
+ /*@}*/
};
diff --git a/stepmania/src/smpackage/ZipArchive/ZipArchive.rc b/stepmania/src/smpackage/ZipArchive/ZipArchive.rc
new file mode 100644
index 0000000000..6d9ca8bc5b
--- /dev/null
+++ b/stepmania/src/smpackage/ZipArchive/ZipArchive.rc
@@ -0,0 +1,109 @@
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Polish resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_PLK)
+#ifdef _WIN32
+LANGUAGE LANG_POLISH, SUBLANG_DEFAULT
+#pragma code_page(1250)
+#endif //_WIN32
+
+#ifndef _MAC
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 2,3,0,0
+ PRODUCTVERSION 2,3,0,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "Comments", "http://www.artpol-software.com\0"
+ VALUE "CompanyName", "Artpol Software\0"
+ VALUE "FileDescription", "ZipArchive - zip compression library\0"
+ VALUE "FileVersion", "2.3\0"
+ VALUE "InternalName", "ZipArchive\0"
+ VALUE "LegalCopyright", "Copyright © 2000 - 2003 Tadeusz Dracz\0"
+ VALUE "LegalTrademarks", "\0"
+ VALUE "OriginalFilename", "ZipArchive.dll\0"
+ VALUE "PrivateBuild", "\0"
+ VALUE "ProductName", " ZipArchive library\0"
+ VALUE "ProductVersion", "2, 3, 0, 0\0"
+ VALUE "SpecialBuild", "\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // !_MAC
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // Polish resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/stepmania/src/smpackage/ZipArchive/ZipArchive.vcproj b/stepmania/src/smpackage/ZipArchive/ZipArchive.vcproj
index 46b385e4e4..4ced55fb3c 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipArchive.vcproj
+++ b/stepmania/src/smpackage/ZipArchive/ZipArchive.vcproj
@@ -3,7 +3,7 @@
ProjectType="Visual C++"
Version="7.00"
Name="ZipArchive"
- SccProjectName="ZipArchive"
+ SccProjectName=""$/ZipArchive", LDAAAAAA"
SccLocalPath="."
Keyword="MFCProj">
@@ -22,7 +22,7 @@
-
-
@@ -491,6 +488,9 @@
+
+
@@ -500,9 +500,6 @@
-
-
diff --git a/stepmania/src/smpackage/ZipArchive/ZipArchive_DLL.dsp b/stepmania/src/smpackage/ZipArchive/ZipArchive_DLL.dsp
new file mode 100644
index 0000000000..7c72878fa6
--- /dev/null
+++ b/stepmania/src/smpackage/ZipArchive/ZipArchive_DLL.dsp
@@ -0,0 +1,268 @@
+# Microsoft Developer Studio Project File - Name="ZipArchive" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=ZipArchive - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "ZipArchive_DLL.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "ZipArchive_DLL.mak" CFG="ZipArchive - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "ZipArchive - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "ZipArchive - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "ZipArchive - Win32 Unicode Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""$/ZipArchive", LDAAAAAA"
+# PROP Scc_LocalPath "."
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "ZipArchive - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "ZipArchive___Win32_Release"
+# PROP BASE Intermediate_Dir "ZipArchive___Win32_Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 2
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZipArchive_DLL_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O1 /I "./zlib" /D "NDEBUG" /D "_USRDLL" /D "ZLIB_DLL" /D "ZIP_BUILD_DLL" /D "_WINDLL" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "ZIP_HAS_DLL" /D "_AFXDLL" /D "ZIP_ARCHIVE_MFC_PROJ" /Fp"Release/ZipArchive.pch" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 User32.lib /nologo /dll /machine:I386 /out:"Release/ZipArchive.dll"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "ZipArchive - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "ZipArchive___Win32_Debug"
+# PROP BASE Intermediate_Dir "ZipArchive___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 2
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZipArchive_DLL_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "./zlib" /D "_DEBUG" /D "_USRDLL" /D "ZLIB_DLL" /D "ZIP_BUILD_DLL" /D "_WINDLL" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "ZIP_HAS_DLL" /D "_AFXDLL" /D "ZIP_ARCHIVE_MFC_PROJ" /Fp"Debug/ZipArchive.pch" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG" /d "_AFXDLL"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 User32.lib /nologo /dll /debug /machine:I386 /out:"Debug/ZipArchive.dll" /pdbtype:sept
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "ZipArchive - Win32 Unicode Release"
+
+# PROP BASE Use_MFC 2
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "ZipArchive___Win32_Unicode_Release"
+# PROP BASE Intermediate_Dir "ZipArchive___Win32_Unicode_Release"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 2
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Unicode_Release"
+# PROP Intermediate_Dir "Unicode_Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /GX /O1 /I "./zlib" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZLIB_DLL" /D "ZIP_HAS_DLL" /D "ZIP_BUILD_DLL" /D "_WINDLL" /D "_AFXDLL" /Fp"Release/ZipArchive.pch" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O1 /I "./zlib" /D "NDEBUG" /D "_UNICODE" /D "_USRDLL" /D "ZLIB_DLL" /D "ZIP_BUILD_DLL" /D "_WINDLL" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "ZIP_HAS_DLL" /D "_AFXDLL" /D "ZIP_ARCHIVE_MFC_PROJ" /Fp"Release/ZipArchive.pch" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
+# ADD RSC /l 0x409 /d "NDEBUG" /d "_AFXDLL"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 User32.lib /nologo /dll /machine:I386 /out:"Release/ZipArchive.dll"
+# SUBTRACT BASE LINK32 /pdb:none
+# ADD LINK32 User32.lib /nologo /dll /machine:I386 /out:"Unicode_Release/ZipArchive.dll"
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "ZipArchive - Win32 Release"
+# Name "ZipArchive - Win32 Debug"
+# Name "ZipArchive - Win32 Unicode Release"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\stdafx.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipArchive.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipArchive.rc
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipAutoBuffer.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipCentralDir.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipCompatibility.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipException.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipFile.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipFileHeader.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipMemFile.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipPathComponent.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipPlatform.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipPlatformComm.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipStorage.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipString.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\stdafx.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipAbstractFile.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipArchive.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipAutoBuffer.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipBaseException.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipCentralDir.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipCollections.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipCompatibility.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipException.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipExport.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipFile.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipFileHeader.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipFileMapping.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipMemFile.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipPathComponent.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipPlatform.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipStorage.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipString.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/stepmania/src/smpackage/ZipArchive/ZipArchive_DLL.dsw b/stepmania/src/smpackage/ZipArchive/ZipArchive_DLL.dsw
new file mode 100644
index 0000000000..5ede6d82c8
--- /dev/null
+++ b/stepmania/src/smpackage/ZipArchive/ZipArchive_DLL.dsw
@@ -0,0 +1,44 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "ZipArchive"=".\ZipArchive_DLL.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name zlib
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "zlib"=".\zlib\zlib.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/stepmania/src/smpackage/ZipArchive/ZipArchive_STL.dsp b/stepmania/src/smpackage/ZipArchive/ZipArchive_STL.dsp
index 2dd7c0dd93..abf7df4db1 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipArchive_STL.dsp
+++ b/stepmania/src/smpackage/ZipArchive/ZipArchive_STL.dsp
@@ -43,7 +43,7 @@ RSC=rc.exe
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MD /W4 /GX /O2 /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "ZLIB_DLL" /D "ZIP_ARCHIVE_STL_PROJ" /YX"stdafx.h" /FD /c
+# ADD CPP /nologo /MD /W4 /GX /O2 /D "NDEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "ZLIB_DLL" /D "ZIP_ARCHIVE_STL_PROJ" /D "PKZIP_BUG_WORKAROUND" /YX"stdafx.h" /FD /c
# ADD BASE RSC /l 0x415 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x415 /d "NDEBUG"
BSC32=bscmake.exe
@@ -66,7 +66,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /MDd /W4 /Gm /GX /ZI /Od /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "ZLIB_DLL" /D "ZIP_ARCHIVE_STL_PROJ" /Fr /YX"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /MDd /W4 /Gm /GX /ZI /Od /D "_DEBUG" /D "_MBCS" /D "WIN32" /D "_WINDOWS" /D "ZLIB_DLL" /D "ZIP_ARCHIVE_STL_PROJ" /D "PKZIP_BUG_WORKAROUND" /Fr /YX"stdafx.h" /FD /GZ /c
# ADD BASE RSC /l 0x415 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x415 /d "_DEBUG"
BSC32=bscmake.exe
@@ -89,7 +89,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Unicode_Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MDd /W4 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /D "ZLIB_DLL" /Fr /Yu"stdafx.h" /FD /GZ /c
-# ADD CPP /nologo /MDd /W4 /Gm /GX /ZI /Od /D "_DEBUG" /D "_UNICODE" /D "WIN32" /D "_WINDOWS" /D "ZLIB_DLL" /D "ZIP_ARCHIVE_STL_PROJ" /Fr /YX"stdafx.h" /FD /GZ /c
+# ADD CPP /nologo /MDd /W4 /Gm /GX /ZI /Od /D "_DEBUG" /D "_UNICODE" /D "WIN32" /D "_WINDOWS" /D "ZLIB_DLL" /D "ZIP_ARCHIVE_STL_PROJ" /D "PKZIP_BUG_WORKAROUND" /Fr /YX"stdafx.h" /FD /GZ /c
# ADD BASE RSC /l 0x415 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x415 /d "_DEBUG"
BSC32=bscmake.exe
@@ -112,7 +112,7 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Unicode_Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W4 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "ZLIB_DLL" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
-# ADD CPP /nologo /MD /W4 /GX /O2 /D "NDEBUG" /D "_UNICODE" /D "WIN32" /D "_WINDOWS" /D "ZLIB_DLL" /D "ZIP_ARCHIVE_STL_PROJ" /YX"stdafx.h" /FD /c
+# ADD CPP /nologo /MD /W4 /GX /O2 /D "NDEBUG" /D "_UNICODE" /D "WIN32" /D "_WINDOWS" /D "ZLIB_DLL" /D "ZIP_ARCHIVE_STL_PROJ" /D "PKZIP_BUG_WORKAROUND" /YX"stdafx.h" /FD /c
# ADD BASE RSC /l 0x415 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x415 /d "NDEBUG"
BSC32=bscmake.exe
@@ -232,10 +232,6 @@ SOURCE=.\ZipFileHeader.cpp
# End Source File
# Begin Source File
-SOURCE=.\ZipInternalInfo.cpp
-# End Source File
-# Begin Source File
-
SOURCE=.\ZipMemFile.cpp
# End Source File
# Begin Source File
@@ -348,6 +344,10 @@ SOURCE=.\ZipException.h
# End Source File
# Begin Source File
+SOURCE=.\ZipExport.h
+# End Source File
+# Begin Source File
+
SOURCE=.\ZipFile.h
# End Source File
# Begin Source File
@@ -360,10 +360,6 @@ SOURCE=.\ZipFileMapping.h
# End Source File
# Begin Source File
-SOURCE=.\ZipInternalInfo.h
-# End Source File
-# Begin Source File
-
SOURCE=.\ZipMemFile.h
# End Source File
# Begin Source File
diff --git a/stepmania/src/smpackage/ZipArchive/ZipArchive_STL_DLL.dsp b/stepmania/src/smpackage/ZipArchive/ZipArchive_STL_DLL.dsp
new file mode 100644
index 0000000000..e5348d3063
--- /dev/null
+++ b/stepmania/src/smpackage/ZipArchive/ZipArchive_STL_DLL.dsp
@@ -0,0 +1,272 @@
+# Microsoft Developer Studio Project File - Name="ZipArchive" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=ZipArchive - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "ZipArchive_STL_DLL.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "ZipArchive_STL_DLL.mak" CFG="ZipArchive - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "ZipArchive - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "ZipArchive - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "ZipArchive - Win32 Unicode Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""$/ZipArchive_STL", JHAAAAAA"
+# PROP Scc_LocalPath "."
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "ZipArchive - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "ZipArchive___Win32_Release"
+# PROP BASE Intermediate_Dir "ZipArchive___Win32_Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZipArchive_STL_EXPORTS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O1 /I "./zlib" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZLIB_DLL" /D "ZIP_HAS_DLL" /D "ZIP_BUILD_DLL" /D "ZIP_ARCHIVE_STL_PROJ" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
+# ADD LINK32 User32.lib /nologo /dll /machine:I386 /out:"Release/ZipArchive.dll"
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "ZipArchive - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "ZipArchive___Win32_Debug"
+# PROP BASE Intermediate_Dir "ZipArchive___Win32_Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZipArchive_STL_EXPORTS" /YX /FD /GZ /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "./zlib" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZLIB_DLL" /D "ZIP_HAS_DLL" /D "ZIP_BUILD_DLL" /D "ZIP_ARCHIVE_STL_PROJ" /YX /FD /GZ /c
+# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 User32.lib /nologo /dll /debug /machine:I386 /out:"Debug/ZipArchive.dll" /pdbtype:sept
+# SUBTRACT LINK32 /pdb:none
+
+!ELSEIF "$(CFG)" == "ZipArchive - Win32 Unicode Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "ZipArchive___Win32_Unicode_Release"
+# PROP BASE Intermediate_Dir "ZipArchive___Win32_Unicode_Release"
+# PROP BASE Ignore_Export_Lib 0
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Unicode_Release"
+# PROP Intermediate_Dir "Unicode_Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MD /W3 /GX /O1 /I "./zlib" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZLIB_DLL" /D "ZIP_HAS_DLL" /D "ZIP_BUILD_DLL" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O1 /I "./zlib" /D "NDEBUG" /D "_UNICODE" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "ZLIB_DLL" /D "ZIP_HAS_DLL" /D "ZIP_BUILD_DLL" /D "ZIP_ARCHIVE_STL_PROJ" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 User32.lib /nologo /dll /machine:I386 /out:"Release/ZipArchive.dll"
+# SUBTRACT BASE LINK32 /pdb:none
+# ADD LINK32 User32.lib /nologo /dll /machine:I386 /out:"Unicode_Release/ZipArchive.dll"
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "ZipArchive - Win32 Release"
+# Name "ZipArchive - Win32 Debug"
+# Name "ZipArchive - Win32 Unicode Release"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\stdafx.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipArchive.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipArchive.rc
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipAutoBuffer.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipCentralDir.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipCompatibility.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipException.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipFile.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipFileHeader.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipMemFile.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipPathComponent.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipPlatform.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipPlatformComm.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipStorage.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipString.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\resource.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\stdafx.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipAbstractFile.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipArchive.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipAutoBuffer.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipBaseException.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipCentralDir.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipCollections.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipCompatibility.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipException.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipExport.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipFile.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipFileHeader.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipFileMapping.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipMemFile.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipPathComponent.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipPlatform.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipStorage.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ZipString.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
+# End Group
+# End Target
+# End Project
diff --git a/stepmania/src/smpackage/ZipArchive/ZipArchive_STL_DLL.dsw b/stepmania/src/smpackage/ZipArchive/ZipArchive_STL_DLL.dsw
new file mode 100644
index 0000000000..7cd0f83d99
--- /dev/null
+++ b/stepmania/src/smpackage/ZipArchive/ZipArchive_STL_DLL.dsw
@@ -0,0 +1,44 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "ZipArchive"=".\ZipArchive_STL_DLL.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name zlib
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "zlib"=".\zlib\zlib.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/stepmania/src/smpackage/ZipArchive/ZipAutoBuffer.cpp b/stepmania/src/smpackage/ZipArchive/ZipAutoBuffer.cpp
index 08db1b5396..e303afbbb4 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipAutoBuffer.cpp
+++ b/stepmania/src/smpackage/ZipArchive/ZipAutoBuffer.cpp
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/stepmania/src/smpackage/ZipArchive/ZipAutoBuffer.h b/stepmania/src/smpackage/ZipArchive/ZipAutoBuffer.h
index ad8634c485..533f7c1328 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipAutoBuffer.h
+++ b/stepmania/src/smpackage/ZipArchive/ZipAutoBuffer.h
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -27,10 +27,11 @@
#pragma once
#endif // _MSC_VER > 1000
+#include "ZipExport.h"
/**
A smart buffer freeing its contents on destruction.
*/
-class CZipAutoBuffer
+class ZIP_API CZipAutoBuffer
{
public:
operator char*()
@@ -75,4 +76,4 @@ protected:
};
#endif // !defined(AFX_ZIPAUTOBUFFER_H__DEC28C20_83FE_11D3_B7C3_EDEC47A8A86C__INCLUDED_)
-
+
\ No newline at end of file
diff --git a/stepmania/src/smpackage/ZipArchive/ZipBaseException.h b/stepmania/src/smpackage/ZipArchive/ZipBaseException.h
index c68c5ca511..9e378ae8e1 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipBaseException.h
+++ b/stepmania/src/smpackage/ZipArchive/ZipBaseException.h
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/stepmania/src/smpackage/ZipArchive/ZipBigFile.cpp b/stepmania/src/smpackage/ZipArchive/ZipBigFile.cpp
deleted file mode 100644
index 1239e8e355..0000000000
--- a/stepmania/src/smpackage/ZipArchive/ZipBigFile.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-// ZipBigFile.cpp: implementation of the CZipBigFile class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#include "stdafx.h"
-#include "ZipBigFile.h"
-
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
-IMPLEMENT_DYNAMIC(CZipBigFile, CFile)
-
-CZipBigFile::CZipBigFile()
-{
-
-}
-
-CZipBigFile::~CZipBigFile()
-{
-
-}
-
-_int64 CZipBigFile::Seek(_int64 dOff, UINT nFrom)
-{
- ASSERT_VALID(this);
- ASSERT(m_hFile != (UINT)hFileNull);
- ASSERT(nFrom == begin || nFrom == end || nFrom == current);
- ASSERT(begin == FILE_BEGIN && end == FILE_END && current == FILE_CURRENT);
- LARGE_INTEGER li;
- li.QuadPart = dOff;
-
- li.LowPart = ::SetFilePointer((HANDLE)m_hFile, li.LowPart, &li.HighPart, (DWORD)nFrom);
- DWORD dw = GetLastError();
- if ((li.LowPart == (DWORD)-1) && (dw != NO_ERROR))
- {
- CFileException::ThrowOsError((LONG)dw);
- }
-
- return li.QuadPart;
-
-}
diff --git a/stepmania/src/smpackage/ZipArchive/ZipBigFile.h b/stepmania/src/smpackage/ZipArchive/ZipBigFile.h
deleted file mode 100644
index 3790dd3c56..0000000000
--- a/stepmania/src/smpackage/ZipArchive/ZipBigFile.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// ZipBigFile.h: interface for the CZipBigFile class.
-//
-//////////////////////////////////////////////////////////////////////
-
-#if !defined(AFX_ZipBigFile_H__79E0E6BD_25D6_4B82_85C5_AB397D9EC368__INCLUDED_)
-#define AFX_ZipBigFile_H__79E0E6BD_25D6_4B82_85C5_AB397D9EC368__INCLUDED_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
-class CZipBigFile : public CFile
-{
- DECLARE_DYNAMIC(CZipBigFile)
-public:
- _int64 Seek(_int64 dOff, UINT nFrom);
- CZipBigFile();
- virtual ~CZipBigFile();
-
-};
-
-#endif // !defined(AFX_ZipBigFile_H__79E0E6BD_25D6_4B82_85C5_AB397D9EC368__INCLUDED_)
diff --git a/stepmania/src/smpackage/ZipArchive/ZipCentralDir.cpp b/stepmania/src/smpackage/ZipArchive/ZipCentralDir.cpp
index 77a4e62d12..20a901bee9 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipCentralDir.cpp
+++ b/stepmania/src/smpackage/ZipArchive/ZipCentralDir.cpp
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -186,26 +186,18 @@ void CZipCentralDir::Clear(bool bEverything)
{
m_pOpenedFile = NULL;
m_pLocalExtraField.Release();
-
if (bEverything)
{
RemoveHeaders();
m_findarray.RemoveAll();
m_pszComment.Release();
-
}
}
bool CZipCentralDir::IsValidIndex(int uIndex)const
{
-
- bool ret = uIndex < m_headers.GetSize() && uIndex >= 0;
-#ifdef _DEBUG
- if (!ret)
- TRACE(_T("%s(%i) : Not a valid index.\n"),__FILE__,__LINE__);
-#endif
- return ret;
+ return uIndex < m_headers.GetSize() && uIndex >= 0;
}
@@ -228,7 +220,6 @@ void CZipCentralDir::OpenFile(WORD uIndex)
if (m_pStorage->GetCurrentDisk() != iCurrDsk)
ThrowError(CZipException::badZipFile);
}
-
}
void CZipCentralDir::CloseFile(bool bAfterException)
@@ -256,15 +247,31 @@ void CZipCentralDir::CloseFile(bool bAfterException)
}
// add new header using the argument as a template
-CZipFileHeader* CZipCentralDir::AddNewFile(const CZipFileHeader & header)
+CZipFileHeader* CZipCentralDir::AddNewFile(const CZipFileHeader & header, int iReplaceIndex)
{
CZipFileHeader* pHeader = new CZipFileHeader(header);
m_pOpenedFile = pHeader;
- m_headers.Add(pHeader);
+ WORD uIndex;
+ DWORD uOffset = 0;
+ bool bReplace = IsValidIndex(iReplaceIndex);
+ if (bReplace)
+ {
+ CZipFileHeader* pfh = m_headers[iReplaceIndex];
+ uOffset = pfh->m_uOffset + m_info.m_uBytesBeforeZip;
+ RemoveFile(pfh, iReplaceIndex, false);
+ m_headers.InsertAt(iReplaceIndex, pHeader);
+ uIndex = (WORD)iReplaceIndex;
+ }
+ else
+ uIndex = m_headers.Add(pHeader);
+
if (m_bFindFastEnabled)
- InsertFindFastElement(pHeader, WORD(m_headers.GetSize() - 1)); // GetCount > 0, 'cos we've just added a header
+ InsertFindFastElement(pHeader, uIndex); // GetCount > 0, 'cos we've just added a header
RemoveFromDisk();
- m_pStorage->m_pFile->SeekToEnd();
+ if (bReplace)
+ m_pStorage->m_pFile->Seek(uOffset, CZipAbstractFile::begin);
+ else
+ m_pStorage->m_pFile->SeekToEnd();
return pHeader;
}
@@ -277,12 +284,14 @@ void CZipCentralDir::RemoveFromDisk()
m_pStorage->m_pFile->SetLength(m_info.m_uBytesBeforeZip + m_info.m_uOffset);
m_info.m_bOnDisk = false;
}
+ else
+ m_pStorage->Flush(); // if remove from disk is requested, then the archive modification will follow, so flush the buffers
}
void CZipCentralDir::CloseNewFile()
{
- CZipAutoBuffer buf(12 + 4);
+ CZipAutoBuffer buf(ZIPARCHIVE_DATADESCRIPTOR_LEN + 4);
short iToWrite = 0;
bool bIsSpan = m_pStorage->IsSpanMode() != 0;
bool bEncrypted = m_pOpenedFile->IsEncrypted();
@@ -298,13 +307,14 @@ void CZipCentralDir::CloseNewFile()
{
ASSERT(!bIsSpan && !bEncrypted);
m_pStorage->Flush();
+ // the offset contains bytes before zip (set while writting the local header)
m_pStorage->m_pFile->Seek(m_pOpenedFile->m_uOffset + 14, CZipAbstractFile::begin);
// we don't have to restore the pointer, because before adding a new file,
// the pointer is moved to the end
}
m_pOpenedFile->GetCrcAndSizes(buf + iToWrite);
- iToWrite += 12;
+ iToWrite += ZIPARCHIVE_DATADESCRIPTOR_LEN;
// offset set during writing the local header
m_pOpenedFile->m_uOffset -= m_info.m_uBytesBeforeZip;
@@ -317,8 +327,8 @@ void CZipCentralDir::CloseNewFile()
{
// write the information to the local header too
m_pStorage->Flush();
- m_pStorage->m_pFile->Seek(m_pOpenedFile->m_uOffset + 14, CZipAbstractFile::begin);
- m_pStorage->Write(buf + 4, 12, true);
+ m_pStorage->m_pFile->Seek(m_info.m_uBytesBeforeZip + m_pOpenedFile->m_uOffset + 14, CZipAbstractFile::begin);
+ m_pStorage->Write(buf + 4, ZIPARCHIVE_DATADESCRIPTOR_LEN, true);
}
m_pStorage->Flush();
}
@@ -519,22 +529,8 @@ void CZipCentralDir::RemoveAll()
RemoveHeaders();
}
-void CZipCentralDir::RemoveFile(CZipFileHeader* pHeader, int iIndex)
+void CZipCentralDir::RemoveFile(CZipFileHeader* pHeader, int iIndex, bool bShift)
{
- if (m_bFindFastEnabled)
- {
- int i = FindFileNameIndex(pHeader->GetFileName());
- ASSERT(i != -1);
- int uIndex = m_findarray[i].m_uIndex;
- m_findarray.RemoveAt(i);
- // shift down the indexes
- int iSize = m_findarray.GetSize();
- for (int j = 0; j < iSize; j++)
- {
- if (m_findarray[j].m_uIndex > uIndex)
- m_findarray[j].m_uIndex--;
- }
- }
if (iIndex == -1)
{
@@ -546,6 +542,30 @@ void CZipCentralDir::RemoveFile(CZipFileHeader* pHeader, int iIndex)
break;
}
}
+ ASSERT(iIndex != -1 || pHeader);
+ if (!pHeader)
+ pHeader = m_headers[iIndex];
+
+ if (m_bFindFastEnabled)
+ {
+ int i = FindFileNameIndex(pHeader->GetFileName());
+ ASSERT(i != -1);
+ int uIndex = m_findarray[i].m_uIndex;
+ m_findarray.RemoveAt(i);
+ // shift down the indexes
+
+ if (bShift)
+ {
+ int iSize = m_findarray.GetSize();
+ for (int j = 0; j < iSize; j++)
+ {
+ if (m_findarray[j].m_uIndex > uIndex)
+ m_findarray[j].m_uIndex--;
+ }
+ }
+ }
+
+
if (iIndex != -1)
{
@@ -821,4 +841,12 @@ int CZipCentralDir::FindFileNameIndex(LPCTSTR lpszFileName) const
return -1;
}
-
+void CZipCentralDir::RenameFile(WORD uIndex, LPCTSTR lpszNewName)
+{
+ CZipFileHeader* pHeader = m_headers[uIndex];
+ pHeader->SetFileName(lpszNewName);
+ if (!m_bConvertAfterOpen)
+ ZipCompatibility::FileNameUpdate(*pHeader, false);
+ if (m_bFindFastEnabled)
+ BuildFindFastArray(m_bCaseSensitive);
+}
\ No newline at end of file
diff --git a/stepmania/src/smpackage/ZipArchive/ZipCentralDir.h b/stepmania/src/smpackage/ZipArchive/ZipCentralDir.h
index 3a41496880..9ab9650bd2 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipCentralDir.h
+++ b/stepmania/src/smpackage/ZipArchive/ZipCentralDir.h
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -26,17 +26,25 @@
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
+
+#if (_MSC_VER > 1000) && (defined ZIP_HAS_DLL)
+ #pragma warning( disable : 4251 ) // needs to have dll-interface to be used by clients of class
+#endif
+
#include "ZipException.h"
#include "ZipFileHeader.h"
#include "ZipAutoBuffer.h"
#include "ZipCollections.h"
#include "ZipCompatibility.h"
+#include "ZipExport.h"
+#define ZIPARCHIVE_DATADESCRIPTOR_LEN 12
/**
A class representing the central directory record in the archive.
*/
-class CZipCentralDir
+class ZIP_API CZipCentralDir
{
+public:
/**
Used in fast finding files by the filename.
A structure for the internal use only.
@@ -45,7 +53,7 @@ class CZipCentralDir
\see CZipArchive::FindFile
\see CZipArchive::EnableFindFast
*/
- struct CZipFindFast
+ struct ZIP_API CZipFindFast
{
CZipFindFast()
{
@@ -64,20 +72,22 @@ class CZipCentralDir
WORD m_uIndex;
};
-public:
+
/**
Stores general information about the central directory record.
*/
- struct Info
+ struct ZIP_API Info
{
- DWORD m_uCentrDirPos; ///< the position of the beginning of the central directory
- DWORD m_uBytesBeforeZip; ///< The number of bytes before the actual zip archive in a file. It is non-zero for self-extracting archives.
+ DWORD m_uCentrDirPos; ///< the position of the beginning of the central directory (as located by #Locate)
+ DWORD m_uBytesBeforeZip;///< The number of bytes before the actual zip archive in a file. It is non-zero for self-extracting archives.
WORD m_uThisDisk; ///< number of the disk with the central directory end record (the number of disks in the disk-spanning archive)
WORD m_uDiskWithCD; ///< number of the disk with the start of the central directory
WORD m_uDiskEntriesNo; ///< total number of entries in the central dir on this disk
WORD m_uEntriesNumber; ///< total number of entries in the central dir
DWORD m_uSize; ///< size of the central directory (valid only if #m_bOnDisk is \c true; use #GetSize instead)
- DWORD m_uOffset; ///< offset of start of central directory with respect to the starting disk number
+ DWORD m_uOffset; ///< offset of start of central directory with respect to the starting disk number
+ ///< (as written in the central directory record);
+ ///< valid only if #m_bOnDisk is \c true
bool m_bOnDisk; ///< \c true if the central directory is physically present in the archive
protected:
@@ -152,21 +162,26 @@ public:
\param pHeader
the header to remove
\param iIndex if index is not known set it to -1
+ \param bShift
\note Throws exceptions.
*/
- void RemoveFile(CZipFileHeader* pHeader, int iIndex = -1);
+ void RemoveFile(CZipFileHeader* pHeader, int iIndex = -1, bool bShift = true);
/**
- Remove last file from the central directory after the compression of the
- file has proven to be non-effective (according to smartness level set)
-
- \param pHeader
- \param iIndex
+ Remove last file from the central directory.
*/
- void RemoveLastFile(CZipFileHeader* pHeader, int iIndex)
+ void RemoveLastFile(CZipFileHeader* pHeader = NULL, int iIndex = -1)
{
+ if (iIndex == -1)
+ {
+ iIndex = m_headers.GetSize() - 1;
+ if (iIndex == -1)
+ return;
+ }
+ if (!pHeader)
+ pHeader = m_headers[iIndex];
DWORD uNewSize = pHeader->m_uOffset + GetBytesBefore();
// then remove
RemoveFile(pHeader, iIndex);
@@ -196,11 +211,12 @@ public:
/**
Add a new file to the central directory.
\param header
- copy data from it to the new file header
+ copy data from it to the new file header
+ \param iReplaceIndex if different from -1, the index of the file to be replaced
\return the pointer to the new header
\note Throws exceptions.
*/
- CZipFileHeader* AddNewFile(const CZipFileHeader & header);
+ CZipFileHeader* AddNewFile(const CZipFileHeader & header, int iReplaceIndex = -1);
/**
return the header filename, converted if needed
@@ -319,11 +335,14 @@ public:
the archive.
- If \c false, the conversion takes place on each call to CZipArchive::GetFileInfo
+ Change is value with CZipArchive::SetConvertAfterOpen.
+
Set it to \c true when you plan to use CZipArchive::FindFile or get the stored files information.
Set it to \c false when you plan mostly to modify the archive.
\b Default: \c true
\note Set it before opening the archive.
+ \see CZipArchive::SetConvertAfterOpen
\see ConvertFileName
*/
bool m_bConvertAfterOpen;
@@ -373,7 +392,18 @@ public:
int FindFileNameIndex(LPCTSTR lpszFileName) const;
DWORD GetBytesBefore() const {return m_info.m_uBytesBeforeZip;}
+ /**
+ Get the information about the central directory
+ */
void GetInfo(Info& info) const {info = m_info;}
+ /**
+ \return the value of m_bFindFastEnabled
+ */
+ bool IsFindFastEnabled(){return m_bFindFastEnabled;}
+ /**
+ Called by CZipArchive::RenameFile
+ */
+ void RenameFile(WORD uIndex, LPCTSTR lpszNewName);
protected:
/**
Sort the files inside the archive headers by the order in the archive.
@@ -425,6 +455,7 @@ protected:
bool m_bFindFastEnabled;
+
/**
The \e lpszFileName and \e bCaseSensitive arguments
are the same as in the #FindFileNameIndex. The function get CZipFindFast
@@ -445,8 +476,6 @@ protected:
/**
Insert a new CZipFindFast element to the #m_findarray.
Initialize CZipFindFast object with \e pHeader and \e uIndex values.
- \param pHeader
- \param uIndex
*/
void InsertFindFastElement(CZipFileHeader* pHeader, WORD uIndex);
diff --git a/stepmania/src/smpackage/ZipArchive/ZipCollections.h b/stepmania/src/smpackage/ZipArchive/ZipCollections.h
index 0bcdfe063e..b40f8d2d0e 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipCollections.h
+++ b/stepmania/src/smpackage/ZipArchive/ZipCollections.h
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/stepmania/src/smpackage/ZipArchive/ZipCompatibility.cpp b/stepmania/src/smpackage/ZipArchive/ZipCompatibility.cpp
index 37cc8bbbad..70670632d3 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipCompatibility.cpp
+++ b/stepmania/src/smpackage/ZipArchive/ZipCompatibility.cpp
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/stepmania/src/smpackage/ZipArchive/ZipCompatibility.h b/stepmania/src/smpackage/ZipArchive/ZipCompatibility.h
index e2d29fe6b8..b453ff5bcc 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipCompatibility.h
+++ b/stepmania/src/smpackage/ZipArchive/ZipCompatibility.h
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/stepmania/src/smpackage/ZipArchive/ZipException.cpp b/stepmania/src/smpackage/ZipArchive/ZipException.cpp
index ab73213e99..fcaa63354e 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipException.cpp
+++ b/stepmania/src/smpackage/ZipArchive/ZipException.cpp
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/stepmania/src/smpackage/ZipArchive/ZipException.h b/stepmania/src/smpackage/ZipArchive/ZipException.h
index 68219a9f7a..c5e2412237 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipException.h
+++ b/stepmania/src/smpackage/ZipArchive/ZipException.h
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -33,7 +33,7 @@
#include "ZipString.h"
#include "ZipBaseException.h"
-
+#include "ZipExport.h"
#define ZIP_ENABLE_ERROR_DESCRIPTION
@@ -42,7 +42,7 @@
Library exception class derived in the MFC version from \c CException
and in non-MFC version from \c std::exception.
*/
-class CZipException : public CZipBaseException
+class ZIP_API CZipException : public CZipBaseException
{
public:
@@ -99,12 +99,12 @@ public:
#ifdef ZIP_ENABLE_ERROR_DESCRIPTION
/**
- Return the error description (you need to have defined ZIP_ENABLE_ERROR_DESCRIPTION
- in file ZipException.h); undefine this value if you don't want to
+ Return the error description.
+ \note You need to have defined ZIP_ENABLE_ERROR_DESCRIPTION
+ (in file ZipException.h); undefine this value if you don't want to
store the messages in the library.
- \return
*/
CZipString GetErrorDescription();
@@ -120,15 +120,16 @@ public:
\param nMaxError
the maximum number of characters the buffer can hold, including the NULL terminator
- \param UINT*
- not used
\return
\c TRUE if the error string is not empty
\note
- the function will not copy more than \c nMaxError – 1 characters
+ - The function will not copy more than \c nMaxError – 1 characters
to the buffer, and it always adds a trailing null to end the string;
- if the buffer is too small, the error message will be truncated;
+ if the buffer is too small, the error message will be truncated.
+ - You need to have defined ZIP_ENABLE_ERROR_DESCRIPTION
+ (in file ZipException.h); undefine this value if you don't want to
+ store the messages in the library.
*/
BOOL GetErrorMessage(LPTSTR lpszError, UINT nMaxError, UINT* = NULL);
diff --git a/stepmania/src/smpackage/ZipArchive/ZipExport.h b/stepmania/src/smpackage/ZipArchive/ZipExport.h
new file mode 100644
index 0000000000..4723be5bda
--- /dev/null
+++ b/stepmania/src/smpackage/ZipArchive/ZipExport.h
@@ -0,0 +1,18 @@
+#if !defined (ZIP_EXPORT_H)
+#define ZIP_API_H
+
+#if defined (ZIP_HAS_DLL)
+# if (ZIP_HAS_DLL == 1)
+# if defined (ZIP_BUILD_DLL)
+# define ZIP_API __declspec (dllexport)
+# else
+# define ZIP_API __declspec (dllimport)
+# endif /* ZIP_BUILD_DLL */
+# else
+# define ZIP_API
+# endif /* ! ZIP_HAS_DLL == 1 */
+#else
+# define ZIP_API
+#endif /* ZIP_HAS_DLL */
+
+#endif /* ZIP_EXPORT_H */
diff --git a/stepmania/src/smpackage/ZipArchive/ZipFile.cpp b/stepmania/src/smpackage/ZipArchive/ZipFile.cpp
index 9cabf1251c..a8ac6b5c55 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipFile.cpp
+++ b/stepmania/src/smpackage/ZipArchive/ZipFile.cpp
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -33,6 +33,10 @@ CZipFile::~CZipFile()
}
+CZipFile::operator HANDLE()
+{
+ return (HANDLE)m_hFile;
+}
// __int64 CZipFile::Seek(__int64 dOff, UINT nFrom)
// {
diff --git a/stepmania/src/smpackage/ZipArchive/ZipFile.h b/stepmania/src/smpackage/ZipArchive/ZipFile.h
index af5b103704..a4510c2aa6 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipFile.h
+++ b/stepmania/src/smpackage/ZipArchive/ZipFile.h
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -21,20 +21,20 @@
#pragma once
#endif // _MSC_VER > 1000
#include "ZipAbstractFile.h"
+#include "ZipExport.h"
-class CZipFile :public CZipAbstractFile, public CFile
+class ZIP_API CZipFile :public CZipAbstractFile, public CFile
{
public:
DECLARE_DYNAMIC(CZipFile)
-// __int64 Seek(__int64 dOff, UINT nFrom);
void Flush(){CFile::Flush();}
- DWORD GetPosition() const {return CFile::GetPosition() ;}
+ ZIP_ULONGLONG GetPosition() const {return CFile::GetPosition() ;}
CZipString GetFilePath() const {return CFile::GetFilePath();}
- void SetLength(long nNewLen) {CFile::SetLength(nNewLen);}
+ void SetLength(ZIP_ULONGLONG nNewLen) {CFile::SetLength(nNewLen);}
UINT Read(void *lpBuf, UINT nCount){return CFile::Read(lpBuf, nCount);}
void Write(const void* lpBuf, UINT nCount){CFile::Write(lpBuf, nCount);}
- long Seek(long lOff, int nFrom){return CFile::Seek(lOff, nFrom);}
- DWORD GetLength() const {return CFile::GetLength();}
+ ZIP_ULONGLONG Seek(ZIP_LONGLONG lOff , int nFrom){return CFile::Seek(lOff, nFrom);}
+ ZIP_ULONGLONG GetLength() const {return CFile::GetLength();}
bool Open( LPCTSTR lpszFileName, UINT nOpenFlags, bool bThrowExc)
{
CFileException* e = new CFileException;
@@ -48,7 +48,7 @@ public:
CZipFile();
bool IsClosed() const
{
- return m_hFile == (UINT)CFile::hFileNull;
+ return m_hFile == CFile::hFileNull;
}
@@ -60,6 +60,7 @@ public:
if (!IsClosed())
CFile::Close();
}
+ operator HANDLE();
virtual ~CZipFile();
};
diff --git a/stepmania/src/smpackage/ZipArchive/ZipFileHeader.cpp b/stepmania/src/smpackage/ZipArchive/ZipFileHeader.cpp
index bf74e89e1c..16b839b434 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipFileHeader.cpp
+++ b/stepmania/src/smpackage/ZipArchive/ZipFileHeader.cpp
@@ -1,10 +1,10 @@
////////////////////////////////////////////////////////////////////////////////
// $Workfile: ZipFileHeader.cpp $
-// $Archive: /ZipArchive/ZipFileHeader.cpp $
+// $Archive: /ZipArchive_STL/ZipFileHeader.cpp $
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -16,7 +16,6 @@
#include "stdafx.h"
-#include "zlib/zlib.h"
#include "ZipFileHeader.h"
#include "ZipAutoBuffer.h"
#include "ZipArchive.h"
@@ -137,10 +136,10 @@ DWORD CZipFileHeader::Write(CZipStorage *pStorage)
if (uExtraFieldSize)
memcpy(buf + 46 + uFileNameSize, m_pExtraField, uExtraFieldSize);
-
+
if (uCommentSize)
memcpy(buf + 46 + uFileNameSize + uExtraFieldSize, m_pszComment, uCommentSize);
-
+
pStorage->Write(buf, iSize, true);
return iSize;
}
@@ -151,12 +150,15 @@ bool CZipFileHeader::ReadLocal(CZipStorage *pStorage, WORD& iLocExtrFieldSize)
pStorage->Read(buf, LOCALFILEHEADERSIZE, true);
if (memcmp(buf, m_gszLocalSignature, 4) != 0)
return false;
-
+
bool bIsDataDescr = (((WORD)*(buf + 6)) & 8) != 0;
-
+
WORD uFileNameSize = GetFileNameSize();
- if ((memcmp(buf + 6, &m_uFlag, 2) != 0)
- ||(memcmp(buf + 8, &m_uMethod, 2) != 0)
+ WORD uTemp;
+ memcpy(&uTemp, buf+6, 2); // give the priority to the local flag
+ if ((uTemp & 0xf) != (m_uFlag & 0xf))
+ m_uFlag = uTemp;
+ if ((memcmp(buf + 8, &m_uMethod, 2) != 0)
|| (m_uMethod && (m_uMethod != Z_DEFLATED))
|| (memcmp(buf + 26, &uFileNameSize, 2) != 0))
return false;
@@ -225,7 +227,7 @@ void CZipFileHeader::WriteLocal(CZipStorage& storage)
}
// prepare the data before adding a new file
-bool CZipFileHeader::PrepareData(int iLevel, bool bExtraHeader, bool bEncrypted)
+bool CZipFileHeader::PrepareData(int iLevel, bool bSpan, bool bEncrypted)
{
memcpy(m_szSignature, m_gszSignature, 4);
m_uInternalAttr = 0;
@@ -257,13 +259,13 @@ bool CZipFileHeader::PrepareData(int iLevel, bool bExtraHeader, bool bEncrypted)
break;
}
- if (bExtraHeader)
+ if (bSpan || bEncrypted)
m_uFlag |= 8; // data descriptor present
if (bEncrypted)
{
m_uComprSize = ZIPARCHIVE_ENCR_HEADER_LEN; // encrypted header
- m_uFlag |= 9; // encrypted file
+ m_uFlag |= 1; // encrypted file
}
return !(m_pszComment.GetSize() > USHRT_MAX || m_pszFileName.GetSize() > USHRT_MAX
diff --git a/stepmania/src/smpackage/ZipArchive/ZipFileHeader.h b/stepmania/src/smpackage/ZipArchive/ZipFileHeader.h
index c969bfa084..1acd86e4a6 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipFileHeader.h
+++ b/stepmania/src/smpackage/ZipArchive/ZipFileHeader.h
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -27,6 +27,7 @@
#pragma once
#endif // _MSC_VER > 1000
+#include "ZipExport.h"
#include "ZipStorage.h"
#include "ZipAutoBuffer.h"
#include "sys/types.h"
@@ -41,7 +42,7 @@
(it would mean updating all the information in the local headers
and the offsets would be changed as well when the filename would changed its size)
*/
-class CZipFileHeader
+class ZIP_API CZipFileHeader
{
friend class CZipCentralDir;
friend class CZipArchive;
@@ -174,7 +175,7 @@ public:
/**
Set #m_uModDate, #m_uModTime
(file modification time)
- \param const time_t& ttime
+ \param ttime
\see GetTime
*/
void SetTime(const time_t& ttime);
@@ -261,7 +262,7 @@ protected:
/**
Set the version made by number.
- \param uVersion
+
*/
void SetVersion(WORD uVersion)
{
@@ -285,7 +286,7 @@ protected:
/**
Fill the buffer with the current values of crc and compressed and
uncompressed sizes of the file.
- \param pBuffer
+
*/
void GetCrcAndSizes(char* pBuffer)const;
@@ -306,14 +307,14 @@ protected:
Called by CZipArchive::OpenNewFile
\param iLevel
a compression level
- \param bExtraHeader
- \c true, if the data descriptor will be present
+ \param bSpan
+ \c true, if the data descriptor will be present because of spanning archive
\param bEncrypted
\c true, if the file will be encrypted
\return \c true if the sizes of the filename, extra field and comments
does not exceed \c unsigned \c short maximum value; otherwise \c false;
*/
- bool PrepareData(int iLevel, bool bExtraHeader, bool bEncrypted);
+ bool PrepareData(int iLevel, bool bSpan, bool bEncrypted);
/**
Write the local file header to the \e storage
\param storage
diff --git a/stepmania/src/smpackage/ZipArchive/ZipFileMapping.h b/stepmania/src/smpackage/ZipArchive/ZipFileMapping.h
index 6d1dd50e2c..1ab8cd711a 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipFileMapping.h
+++ b/stepmania/src/smpackage/ZipArchive/ZipFileMapping.h
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -36,11 +36,11 @@ namespace ziparchv
m_hFileMap = NULL;
m_pFileMap = NULL;
}
- bool CreateMapping(CZipFile* pFile)
+ bool CreateMapping(CZipFile* pFile)
{
if (!pFile)
return false;
- m_hFileMap = CreateFileMapping((HANDLE)pFile->operator HFILE(), NULL, PAGE_READWRITE,
+ m_hFileMap = CreateFileMapping((*pFile), NULL, PAGE_READWRITE,
0, 0, _T("ZipArchive Mapping File"));
if (!m_hFileMap)
return false;
diff --git a/stepmania/src/smpackage/ZipArchive/ZipInternalInfo.h b/stepmania/src/smpackage/ZipArchive/ZipInternalInfo.h
deleted file mode 100644
index 61e567f652..0000000000
--- a/stepmania/src/smpackage/ZipArchive/ZipInternalInfo.h
+++ /dev/null
@@ -1,64 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////
-// $Workfile: ZipInternalInfo.h $
-// $Archive: /ZipArchive/ZipInternalInfo.h $
-// $Date$ $Author$
-////////////////////////////////////////////////////////////////////////////////
-// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// For the licensing details see the file License.txt
-////////////////////////////////////////////////////////////////////////////////
-
-/**
-* \file ZipInternalInfo.h
-* Interface for the CZipInternalInfo structure.
-*
-*/
-#if !defined(AFX_ZIPINTERNALINFO_H__C6749101_590C_4F74_8121_B82E3BE9FA44__INCLUDED_)
-#define AFX_ZIPINTERNALINFO_H__C6749101_590C_4F74_8121_B82E3BE9FA44__INCLUDED_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-#include "ZipAutoBuffer.h"
-#include "zlib/zlib.h"
-
-/**
- The purpose of this structure is to hold the data that allow communication
- with the zlib library
-*/
-struct CZipInternalInfo
-{
- CZipInternalInfo();
- virtual ~CZipInternalInfo();
-
-/**
- Allocate internal buffer of m_iBufferSize size
-*/
- void Init();
- z_stream m_stream; ///< zlib library data stream
- DWORD m_uUncomprLeft; ///< bytes left to uncompress
- DWORD m_uComprLeft; ///< bytes left to decompress
- DWORD m_uCrc32; ///< crc32 file control value
-
- /**
- The size of the buffer used in decompressing data.
- Set before opening the archive.
- It is usually set with CZipArchive::SetAdvanced
- (specify this value as the second argument).
- \see CZipArchive::SetAdvanced
- */
- DWORD m_iBufferSize;
-
- /**
- This buffer caches data during compression and decompression.
- */
- CZipAutoBuffer m_pBuffer;
-};
-
-#endif // !defined(AFX_ZIPINTERNALINFO_H__C6749101_590C_4F74_8121_B82E3BE9FA44__INCLUDED_)
diff --git a/stepmania/src/smpackage/ZipArchive/ZipMemFile.cpp b/stepmania/src/smpackage/ZipArchive/ZipMemFile.cpp
index 639ef6f1fc..b5560a3213 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipMemFile.cpp
+++ b/stepmania/src/smpackage/ZipArchive/ZipMemFile.cpp
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -22,13 +22,13 @@
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
-void CZipMemFile::Grow(long nGrowTo)
+void CZipMemFile::Grow(size_t nGrowTo)
{
if (m_nBufSize < (UINT)nGrowTo)
{
if (m_nGrowBy == 0)
CZipException::Throw(CZipException::memError);
- long nNewSize = m_nBufSize;
+ size_t nNewSize = m_nBufSize;
while (nNewSize < nGrowTo)
nNewSize += m_nGrowBy;
BYTE* lpNew;
@@ -42,15 +42,15 @@ void CZipMemFile::Grow(long nGrowTo)
m_nBufSize = nNewSize;
m_lpBuf = lpNew;
}
-}
+}
-void CZipMemFile::SetLength(long nNewLen)
+void CZipMemFile::SetLength(ZIP_ULONGLONG nNewLen)
{
if (m_nBufSize < (UINT)nNewLen)
- Grow(nNewLen);
+ Grow((size_t)nNewLen);
else
- m_nPos = nNewLen;
- m_nDataSize = nNewLen;
+ m_nPos = (size_t)nNewLen;
+ m_nDataSize = (size_t)nNewLen;
}
UINT CZipMemFile::Read(void *lpBuf, UINT nCount)
@@ -77,9 +77,9 @@ void CZipMemFile::Write(const void *lpBuf, UINT nCount)
m_nDataSize = m_nPos;
}
-long CZipMemFile::Seek(long lOff, int nFrom)
+ZIP_ULONGLONG CZipMemFile::Seek(ZIP_LONGLONG lOff, int nFrom)
{
- long lNew = m_nPos;
+ ZIP_ULONGLONG lNew = m_nPos;
if (nFrom == CZipAbstractFile::begin)
lNew = lOff;
@@ -93,6 +93,6 @@ long CZipMemFile::Seek(long lOff, int nFrom)
if (lNew< 0)
CZipException::Throw(CZipException::memError);
- m_nPos = lNew;
+ m_nPos = (size_t)lNew;
return lNew;
}
diff --git a/stepmania/src/smpackage/ZipArchive/ZipMemFile.h b/stepmania/src/smpackage/ZipArchive/ZipMemFile.h
index 605c603903..fa6408d6e8 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipMemFile.h
+++ b/stepmania/src/smpackage/ZipArchive/ZipMemFile.h
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -27,16 +27,17 @@
#endif // _MSC_VER > 1000
#include "ZipAbstractFile.h"
#include "ZipString.h"
+#include "ZipExport.h"
/**
A memory buffer which behaves like a physical file.
Automatically grows when necessary
*/
-class CZipMemFile : public CZipAbstractFile
+class ZIP_API CZipMemFile : public CZipAbstractFile
{
protected:
- UINT m_nGrowBy, m_nPos;
- UINT m_nBufSize, m_nDataSize;
+ size_t m_nGrowBy, m_nPos;
+ size_t m_nBufSize, m_nDataSize;
BYTE* m_lpBuf;
bool m_bAutoDelete;
void Free()
@@ -54,16 +55,16 @@ protected:
m_lpBuf = NULL;
}
- void Grow(long nBytes);
+ void Grow(size_t nBytes);
public:
bool IsClosed() const { return m_lpBuf == NULL;}
void Flush(){}
- long Seek(long lOff, int nFrom);
- DWORD GetLength() const {return m_nDataSize;}
+ ZIP_ULONGLONG Seek(ZIP_LONGLONG lOff, int nFrom);
+ ZIP_ULONGLONG GetLength() const {return m_nDataSize;}
void Write(const void* lpBuf, UINT nCount);
UINT Read(void* lpBuf, UINT nCount);
- void SetLength(long nNewLen);
+ void SetLength(ZIP_ULONGLONG nNewLen);
CZipString GetFilePath() const {return _T("");}
CZipMemFile(long nGrowBy = 1024)
{
@@ -74,9 +75,10 @@ public:
CZipMemFile(BYTE* lpBuf, UINT nBufSize, long nGrowBy = 0)
{
+ Init();
Attach(lpBuf, nBufSize, nGrowBy);
}
- DWORD GetPosition() const { return m_nPos;}
+ ZIP_ULONGLONG GetPosition() const { return m_nPos;}
void Attach(BYTE* lpBuf, UINT nBufSize, long nGrowBy = 0)
{
Close();
diff --git a/stepmania/src/smpackage/ZipArchive/ZipPathComponent.cpp b/stepmania/src/smpackage/ZipArchive/ZipPathComponent.cpp
index 1976e23d1b..e259ded573 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipPathComponent.cpp
+++ b/stepmania/src/smpackage/ZipArchive/ZipPathComponent.cpp
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/stepmania/src/smpackage/ZipArchive/ZipPathComponent.h b/stepmania/src/smpackage/ZipArchive/ZipPathComponent.h
index 77c11112c3..62b79b211d 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipPathComponent.h
+++ b/stepmania/src/smpackage/ZipArchive/ZipPathComponent.h
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -26,11 +26,12 @@
#pragma once
#endif // _MSC_VER > 1000
#include "ZipString.h"
+#include "ZipExport.h"
/**
A class splitting a file path into components.
*/
-class CZipPathComponent
+class ZIP_API CZipPathComponent
{
public:
CZipPathComponent(){}
@@ -39,7 +40,6 @@ public:
static const TCHAR m_cSeparator; ///< A system - specific default path separator. Defined in ZipPlatform.cpp.
/**
Append a path separator to \e szPath if it is not already there.
- \param szPath
*/
static void AppendSeparator(CZipString& szPath)
{
@@ -49,7 +49,6 @@ public:
/**
Remove separators from the end of \e szPath
- \param szPath
*/
static void RemoveSeparators(CZipString& szPath)
{
@@ -59,7 +58,7 @@ public:
/**
Remove separators from the beginning of \e szPath
- \param szPath
+
*/
static void RemoveSeparatorsLeft(CZipString& szPath)
@@ -72,7 +71,6 @@ public:
\return \c true if \e c is a slash or a backslash
- \param c
*/
static bool IsSeparator(TCHAR c)
diff --git a/stepmania/src/smpackage/ZipArchive/ZipPlatform.cpp b/stepmania/src/smpackage/ZipArchive/ZipPlatform.cpp
index 0affb9e3a1..b2176e9bd0 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipPlatform.cpp
+++ b/stepmania/src/smpackage/ZipArchive/ZipPlatform.cpp
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -165,7 +165,7 @@ bool ZipPlatform::SetFileModTime(LPCTSTR lpFileName, time_t ttime)
{
struct _utimbuf ub;
ub.actime = time(NULL);
- ub.modtime = ttime;
+ ub.modtime = ttime == -1 ? time(NULL) : ttime; // if wrong file time, set it to the current
return _tutime(lpFileName, &ub) == 0;
}
diff --git a/stepmania/src/smpackage/ZipArchive/ZipPlatform.h b/stepmania/src/smpackage/ZipArchive/ZipPlatform.h
index 7425f54483..6bf64f66e8 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipPlatform.h
+++ b/stepmania/src/smpackage/ZipArchive/ZipPlatform.h
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -30,6 +30,7 @@ class CZipAutoBuffer;
#include "ZipString.h"
#include "ZipPathComponent.h"
#include
+#include "ZipExport.h"
/**
Interface to the system API.
@@ -41,59 +42,59 @@ namespace ZipPlatform
/**
return the default system case-sensitivity
*/
- bool GetSystemCaseSensitivity();
+ ZIP_API bool GetSystemCaseSensitivity();
/**
\return A current system name tag.
May be one of ZipCompatibility::ZipPlatforms values.
\see CZipArchive::GetSystemCompatibility
*/
- int GetSystemID();
+ ZIP_API int GetSystemID();
/**
\return the default file attributes for the current system
*/
- DWORD GetDefaultAttributes();
+ ZIP_API DWORD GetDefaultAttributes();
/**
\return the default directory attributes for the current system
*/
- DWORD GetDefaultDirAttributes();
+ ZIP_API DWORD GetDefaultDirAttributes();
/**
Get the free space on the device pointed by \e lpszPath
*/
- DWORD GetDeviceFreeSpace(LPCTSTR lpszPath);
+ ZIP_API DWORD GetDeviceFreeSpace(LPCTSTR lpszPath);
/**
Return the temporary file name ensuring there is enough size in the destination directory,.
Checking for the size is disabled by default.
*/
- CZipString GetTmpFileName(LPCTSTR lpszPath = NULL, DWORD iSizeNeeded = DWORD(-1));
+ ZIP_API CZipString GetTmpFileName(LPCTSTR lpszPath = NULL, DWORD iSizeNeeded = DWORD(-1));
/**
\name Various operations on files and directories.
All the functions which are returning a \c bool value,
return \c true when the operation was successful.
*/
//@{
- bool GetCurrentDirectory(CZipString& sz); ///< Get the current directory and store it in \e sz
- bool ChangeDirectory(LPCTSTR lpDirectory);
- bool SetFileAttr(LPCTSTR lpFileName, DWORD uAttr);
- bool GetFileAttr(LPCTSTR lpFileName, DWORD& uAttr);
- bool GetFileModTime(LPCTSTR lpFileName, time_t & ttime); ///< get the file modification time
- bool GetFileSize(LPCTSTR lpszFileName, DWORD& dSize);
- bool SetFileModTime(LPCTSTR lpFileName, time_t ttime); ///< set the file modification time
- bool CreateDirectory(LPCTSTR lpDirectory);
- bool SetVolLabel(LPCTSTR lpszPath, LPCTSTR lpszLabel); ///< \c lpszPath may point to a file on the device
- bool ForceDirectory(LPCTSTR lpDirectory); ///< create nested directories at once
- bool RemoveFile(LPCTSTR lpszFileName, bool bThrow = true);
- bool RenameFile( LPCTSTR lpszOldName, LPCTSTR lpszNewName, bool bThrow = true);
+ ZIP_API bool GetCurrentDirectory(CZipString& sz); ///< Get the current directory and store it in \e sz
+ ZIP_API bool ChangeDirectory(LPCTSTR lpDirectory);
+ ZIP_API bool SetFileAttr(LPCTSTR lpFileName, DWORD uAttr);
+ ZIP_API bool GetFileAttr(LPCTSTR lpFileName, DWORD& uAttr);
+ ZIP_API bool GetFileModTime(LPCTSTR lpFileName, time_t & ttime); ///< get the file modification time
+ ZIP_API bool GetFileSize(LPCTSTR lpszFileName, DWORD& dSize);
+ ZIP_API bool SetFileModTime(LPCTSTR lpFileName, time_t ttime); ///< set the file modification time
+ ZIP_API bool CreateDirectory(LPCTSTR lpDirectory);
+ ZIP_API bool SetVolLabel(LPCTSTR lpszPath, LPCTSTR lpszLabel); ///< \c lpszPath may point to a file on the device
+ ZIP_API bool ForceDirectory(LPCTSTR lpDirectory); ///< create nested directories at once
+ ZIP_API bool RemoveFile(LPCTSTR lpszFileName, bool bThrow = true);
+ ZIP_API bool RenameFile( LPCTSTR lpszOldName, LPCTSTR lpszNewName, bool bThrow = true);
#ifndef _MFC_VER
- bool TruncateFile(int iDes, DWORD iSize);
- int OpenFile(LPCTSTR lpszFileName, UINT iMode, int iShareMode);
- bool FlushFile(int iDes); ///< flush the file to the disk.
- int GetFileSystemHandle(int iDes); ///< return the underlying system handle
+ ZIP_API bool TruncateFile(int iDes, DWORD iSize);
+ ZIP_API int OpenFile(LPCTSTR lpszFileName, UINT iMode, int iShareMode);
+ ZIP_API bool FlushFile(int iDes); ///< flush the file to the disk.
+ ZIP_API int GetFileSystemHandle(int iDes); ///< return the underlying system handle
#endif
//@}
@@ -102,20 +103,20 @@ namespace ZipPlatform
\return \c true, if \e lpszDir directory exists; otherwise \c false;
*/
- bool DirectoryExists(LPCTSTR lpszDir);
+ ZIP_API bool DirectoryExists(LPCTSTR lpszDir);
/**
\param lpszFilePath
may point to a file path or a directory on the device
\return \c true if the drive is removable.
Implemented only on Windows system, in all others always returns \c true.
*/
- bool IsDriveRemovable(LPCTSTR lpszFilePath);
+ ZIP_API bool IsDriveRemovable(LPCTSTR lpszFilePath);
/**
\param uAttr
attributes value to test
\return \c true if the attributes are the directory attributes
*/
- bool IsDirectory(DWORD uAttr);
+ ZIP_API bool IsDirectory(DWORD uAttr);
/**
Perform the translation between ANSI and OEM character sets.
@@ -131,7 +132,7 @@ namespace ZipPlatform
if \c true, convert ANSI to OEM
if \c false, OEM to ANSI
*/
- void AnsiOem(CZipAutoBuffer& buffer, bool bAnsiToOem);
+ ZIP_API void AnsiOem(CZipAutoBuffer& buffer, bool bAnsiToOem);
/**
Check if the given file or directory exists.
\param lpszName
@@ -141,7 +142,7 @@ namespace ZipPlatform
- 1 a file
- 0 if there is no such a file
*/
- int FileExists(LPCTSTR lpszName);
+ ZIP_API int FileExists(LPCTSTR lpszName);
#ifdef _UNICODE
@@ -155,7 +156,7 @@ namespace ZipPlatform
the \e szSingle buffer length, or \c -1 when not succeeded
\note Only in UNICODE version.
*/
- int WideToSingle(LPCTSTR lpWide, CZipAutoBuffer &szSingle);
+ ZIP_API int WideToSingle(LPCTSTR lpWide, CZipAutoBuffer &szSingle);
/**
Convert single character string to wide character string.
\param szSingle
@@ -166,7 +167,7 @@ namespace ZipPlatform
or \c -1 when not succeeded
\note Only in UNICODE version.
*/
- int SingleToWide(const CZipAutoBuffer &szSingle, CZipString& szWide);
+ ZIP_API int SingleToWide(const CZipAutoBuffer &szSingle, CZipString& szWide);
#endif
};
diff --git a/stepmania/src/smpackage/ZipArchive/ZipPlatformComm.cpp b/stepmania/src/smpackage/ZipArchive/ZipPlatformComm.cpp
index 1bb6e4cb40..98a5fdc07f 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipPlatformComm.cpp
+++ b/stepmania/src/smpackage/ZipArchive/ZipPlatformComm.cpp
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/stepmania/src/smpackage/ZipArchive/ZipStorage.cpp b/stepmania/src/smpackage/ZipArchive/ZipStorage.cpp
index bc4057084f..ffc6b3404c 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipStorage.cpp
+++ b/stepmania/src/smpackage/ZipArchive/ZipStorage.cpp
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -33,7 +33,7 @@ char CZipStorage::m_gszExtHeaderSignat[] = {0x50, 0x4b, 0x07, 0x08};
CZipStorage::CZipStorage()
{
m_pChangeDiskFunc = NULL;
- m_iWriteBufferSize = 65535;
+ m_iWriteBufferSize = 65536;
m_iCurrentDisk = -1;
m_pFile = NULL;
}
@@ -202,19 +202,21 @@ CZipString CZipStorage::RenameLastFileInTDSpan()
return szNewFileName;
}
-void CZipStorage::Close(bool bAfterException)
+CZipString CZipStorage::Close(bool bAfterException)
{
bool bClose = true;
+ CZipString sz;
if (!bAfterException)
{
Flush();
if ((m_iSpanMode == tdSpan) && (m_bNewSpan))
{
- RenameLastFileInTDSpan();
+ sz = RenameLastFileInTDSpan();
bClose = false;// already closed in RenameLastFileInTDSpan
}
}
-
+ if (sz.IsEmpty())
+ sz = m_pFile->GetFilePath();
if (bClose && !m_bInMemory)
{
FlushFile();
@@ -227,6 +229,7 @@ void CZipStorage::Close(bool bAfterException)
m_iCurrentDisk = -1;
m_iSpanMode = noSpan;
m_pFile = NULL;
+ return sz;
}
CZipString CZipStorage::GetTdVolumeName(bool bLast, LPCTSTR lpszZipName) const
@@ -235,7 +238,7 @@ CZipString CZipStorage::GetTdVolumeName(bool bLast, LPCTSTR lpszZipName) const
CZipPathComponent zpc(szFilePath);
CZipString szExt;
if (bLast)
- szExt = _T("zip");
+ szExt = m_szSpanExtension;
else
szExt.Format(_T("%.3d"), m_iCurrentDisk);
zpc.SetExtension(szExt);
@@ -260,8 +263,11 @@ void CZipStorage::NextDisk(int iNeeded, LPCTSTR lpszFileName)
else
szFileName = GetTdVolumeName(false, lpszFileName);
- m_pFile->Flush();
- m_pFile->Close();
+ if (!m_pFile->IsClosed())
+ {
+ m_pFile->Flush();
+ m_pFile->Close();
+ }
if (bPkSpan)
{
@@ -322,12 +328,15 @@ void CZipStorage::UpdateSpanMode(WORD uLastDisk)
if (uLastDisk)
{
// disk spanning detected
-
+ CZipString szFilePath = m_pFile->GetFilePath();
if (m_iSpanMode == suggestedAuto)
- m_iSpanMode = ZipPlatform::IsDriveRemovable(m_pFile->GetFilePath()) ?
+ m_iSpanMode = ZipPlatform::IsDriveRemovable(szFilePath) ?
pkzipSpan : tdSpan;
else
+ {
+ ASSERT(m_iSpanMode == suggestedTd);
m_iSpanMode = tdSpan;
+ }
if (m_iSpanMode == pkzipSpan)
{
@@ -336,7 +345,8 @@ void CZipStorage::UpdateSpanMode(WORD uLastDisk)
}
else /*if (m_iSpanMode == tdSpan)*/
m_iTdSpanData = uLastDisk; // disk with .zip extension ( the last one)
-
+ CZipPathComponent zpc(szFilePath);
+ m_szSpanExtension = zpc.GetFileExt();
m_pWriteBuffer.Release(); // no need for this in this case
}
else
@@ -448,3 +458,4 @@ void CZipStorage::FinalizeSpan()
OpenFile(szFileName, CZipFile::modeNoTruncate | (m_iSpanMode == noSpan ? CZipFile::modeReadWrite : CZipFile::modeRead));
}
+
diff --git a/stepmania/src/smpackage/ZipArchive/ZipStorage.h b/stepmania/src/smpackage/ZipArchive/ZipStorage.h
index 3aa1e097f8..6ba64e9c85 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipStorage.h
+++ b/stepmania/src/smpackage/ZipArchive/ZipStorage.h
@@ -1,10 +1,10 @@
////////////////////////////////////////////////////////////////////////////////
// $Workfile: ZipStorage.h $
// $Archive: /ZipArchive/ZipStorage.h $
-// $Date$ $Author$
+// $Date$ $Author$.
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -23,16 +23,17 @@
#if !defined(AFX_ZIPSTORAGE_H__941824FE_3320_4794_BDE3_BE334ED8984B__INCLUDED_)
#define AFX_ZIPSTORAGE_H__941824FE_3320_4794_BDE3_BE334ED8984B__INCLUDED_
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
#include "ZipFile.h"
#include "ZipAutoBuffer.h"
#include "ZipString.h"
#include "ZipMemFile.h"
+#include "ZipExport.h"
-#if _MSC_VER > 1000
-#pragma once
-#endif // _MSC_VER > 1000
-
/**
A base class for functional objects (functors) that are used as a callbacks during various actions.
@@ -40,7 +41,7 @@
Do not derive from CZipCallback directly but from CZipSpanCallback (as a callback when there is a need
for a disk change in a disk-spanning archive) or from CZipActionCallback for other actions.
*/
-struct CZipCallback
+struct ZIP_API CZipCallback
{
/**
Method called as a callback.
@@ -80,7 +81,7 @@ struct CZipCallback
\see CZipCallback::Callback
\see CZipArchive::SetSpanCallback
*/
-struct CZipSpanCallback : public CZipCallback
+struct ZIP_API CZipSpanCallback : public CZipCallback
{
DWORD m_uDiskNeeded; ///< the number of a disk needed (counting from 1)
};
@@ -97,7 +98,7 @@ struct CZipSpanCallback : public CZipCallback
\see CZipCallback::Callback
\see CZipArchive::SetCallback
*/
-struct CZipActionCallback : public CZipCallback
+struct ZIP_API CZipActionCallback : public CZipCallback
{
CZipActionCallback()
@@ -113,7 +114,7 @@ struct CZipActionCallback : public CZipCallback
int m_iType;
/**
- Used to init the callback function with the filenames. Resets #m_uTotalToDo and #m_uTotalSoFar variables to 0.
+ Used by the ZipArchive library to init the callback function with the filenames. Resets #m_uTotalToDo and #m_uTotalSoFar variables to 0.
#m_iType variable is already set to the proper value. Called at the beginning of the action.
*/
virtual void Init(LPCTSTR lpszFileInZip = NULL, LPCTSTR lpszExternalFile = NULL)
@@ -180,7 +181,9 @@ struct CZipActionCallback : public CZipCallback
Used only when creating map before deletion (see CZipArchive::cbDeleteCnt) or
saving the central directory record. You'll be notified every nth step (n is \e m_iStep value) with \e iProgress set to
\e m_iStep . Do not set it to low values or you can have a long waiting on archives
- with huge number of files. The default is 256.
+ with huge number of files.
+
+ \b Default: 256.
*/
static int m_iStep;
@@ -196,7 +199,7 @@ struct CZipActionCallback : public CZipCallback
/**
A low-level class - operates physically on archive (CZipArchive operates logically)
*/
-class CZipStorage
+class ZIP_API CZipStorage
{
friend class CZipCentralDir;
public:
@@ -295,7 +298,7 @@ public:
Return the position in the file, taking into account the bytes in the write buffer.
\note Throws exceptions.
*/
- DWORD GetPosition() const {return m_pFile->GetPosition() + m_uBytesInWriteBuffer;}
+ DWORD GetPosition() const {return (DWORD)(m_pFile->GetPosition()) + m_uBytesInWriteBuffer;}
/**
@@ -367,9 +370,10 @@ public:
The simplified mode is used then.
In this case it'll be possible to reuse the object to operate on another
archive, but the current archive file will not be valid anyway.
+ \return the filepath of the archive (used by CZipArchive::Close)
\note Throws exceptions.
*/
- void Close(bool bAfterException);
+ CZipString Close(bool bAfterException);
/**
@@ -516,6 +520,11 @@ protected:
*/
int m_iTdSpanData;
+
+ /**
+ The extension of the last volume.
+ */
+ CZipString m_szSpanExtension;
/**
\return the count bytes left free in the write buffer
diff --git a/stepmania/src/smpackage/ZipArchive/ZipString.cpp b/stepmania/src/smpackage/ZipArchive/ZipString.cpp
index 1df02b1ef0..a47317490c 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipString.cpp
+++ b/stepmania/src/smpackage/ZipArchive/ZipString.cpp
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/stepmania/src/smpackage/ZipArchive/ZipString.h b/stepmania/src/smpackage/ZipArchive/ZipString.h
index 9e2cf7690e..52a6e4f231 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipString.h
+++ b/stepmania/src/smpackage/ZipArchive/ZipString.h
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -17,7 +17,7 @@
#ifndef ZIPSTRING_DOT_H
#define ZIPSTRING_DOT_H
#include "stdafx.h"
-
+#include "ZipExport.h"
typedef CString CZipString;
@@ -33,6 +33,6 @@ typedef int (CZipString::*ZIPSTRINGCOMPARE)( LPCTSTR ) const;
return a pointer to the function in CZipString structure,
used to compare elements depending on the arguments
*/
- ZIPSTRINGCOMPARE GetCZipStrCompFunc(bool bCaseSensitive, bool bCollate = true);
+ ZIP_API ZIPSTRINGCOMPARE GetCZipStrCompFunc(bool bCaseSensitive, bool bCollate = true);
#endif /* ZIPSTRING_DOT_H */
diff --git a/stepmania/src/smpackage/ZipArchive/_copy_from_Linux-STL.sh b/stepmania/src/smpackage/ZipArchive/_copy_from_Linux-STL.sh
new file mode 100644
index 0000000000..942c91fa13
--- /dev/null
+++ b/stepmania/src/smpackage/ZipArchive/_copy_from_Linux-STL.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+cp -f Linux/* ./
+cp -f stl/* ./
+rm -f __*.zcfg
+echo Linux STL > __Linux_STL.zcfg
diff --git a/stepmania/src/smpackage/ZipArchive/_copy_from_Win-MFC.bat b/stepmania/src/smpackage/ZipArchive/_copy_from_Win-MFC.bat
new file mode 100644
index 0000000000..adac7df4d9
--- /dev/null
+++ b/stepmania/src/smpackage/ZipArchive/_copy_from_Win-MFC.bat
@@ -0,0 +1,5 @@
+@echo off
+copy Windows\*.* *.*
+copy mfc\*.* *.*
+del __*.zcfg
+echo Windows MFC > __Windows_MFC.zcfg
diff --git a/stepmania/src/smpackage/ZipArchive/_copy_from_Win-STL.bat b/stepmania/src/smpackage/ZipArchive/_copy_from_Win-STL.bat
new file mode 100644
index 0000000000..88f426740b
--- /dev/null
+++ b/stepmania/src/smpackage/ZipArchive/_copy_from_Win-STL.bat
@@ -0,0 +1,5 @@
+@echo off
+copy Windows\*.* *.*
+copy stl\*.* *.*
+del __*.zcfg
+echo Windows STL > __Windows_STL.zcfg
diff --git a/stepmania/src/smpackage/ZipArchive/_version.txt b/stepmania/src/smpackage/ZipArchive/_version.txt
index 8bbe6cf74a..3f684d2d90 100644
--- a/stepmania/src/smpackage/ZipArchive/_version.txt
+++ b/stepmania/src/smpackage/ZipArchive/_version.txt
@@ -1 +1 @@
-2.2
+2.3.4
diff --git a/stepmania/src/smpackage/ZipArchive/borland.zip b/stepmania/src/smpackage/ZipArchive/borland.zip
new file mode 100644
index 0000000000..98dfe5ded0
Binary files /dev/null and b/stepmania/src/smpackage/ZipArchive/borland.zip differ
diff --git a/stepmania/src/smpackage/ZipArchive/faq.txt b/stepmania/src/smpackage/ZipArchive/faq.txt
index 3a28b2a777..3bdf9237c8 100644
--- a/stepmania/src/smpackage/ZipArchive/faq.txt
+++ b/stepmania/src/smpackage/ZipArchive/faq.txt
@@ -21,7 +21,7 @@ Q: When do I need to purchase the commercial license?
Q: When I open a multi-disk archive (Pkzip mode) and the last disk is not in
- the drive, I receive the CZipException::cdirNotFound exception. How to detect
+ the drive, I receive the %CZipException::cdirNotFound exception. How to detect
whether the last disk is in the drive?
@@ -44,7 +44,7 @@ Q: Why the library doesn't want to extract archives (mostly old)?
-Q: In CZipArchive::AddNewFile and CZipArchive::ExtractFile I want to use partial
+Q: In %CZipArchive::AddNewFile and %CZipArchive::ExtractFile I want to use partial
path for the filename inside the archive.
@@ -53,7 +53,7 @@ Q: I want to create an archive that will be readable under Unix/Linux.
-Q: How can I use UNC path with CZipArchive::ExtractFile function ?
+Q: How can I use UNC path with %CZipArchive::ExtractFile function ?
@@ -74,8 +74,8 @@ Q: I experience linking problems. What to do?
A:
\par If you get mostly LNK2005 :
- You need to make sure that
- the library and your program are both using single-threaded or both
+ If you changed the project configuration (e.g. from Release to Unicode Release), rebuild the projects.
+ If you are still getting link errors, make sure that the library and your program are both using single-threaded or both
multithreaded (or multithreaded DLL) run-time library. The option Project->Settings-> c/c++ ->Code Generation->Use run-time library
should be set to the same value in the ZipArchive library and the program
project options. Make sure that you link appropriate configurations (Release against Release, Debug against Debug...)
@@ -83,7 +83,7 @@ A:
\par If you get LNK1104 (e.g. cannot open file "mfc42u.lib")
You're trying to compile the Unicode version but you haven't installed the necessary libraries.
When installing Visual C++ Professional for example, you need to check the boxes "Static Libraries for Unicode" and
-"Shared Libraries for Unicode". They are in "VC++ MFC and Template libraries\MS Foundation Class Libraries".
+"Shared Libraries for Unicode". They are in "VC++ MFC and Template libraries\\MS Foundation Class Libraries".
You don't need to reinstall the Visual Studio to add them.
@@ -160,15 +160,14 @@ The only methods supported by the zlib library are \e deflation which is the mos
Q: In CZipArchive::AddNewFile and CZipArchive::ExtractFile I want to use partial
path for the filename inside the archive. For example:
When I compress some directory, like this:
- c:\program files\example (full directory path: c:\program files\example\text\txt)
- it comes with the whole path. I would like that the zip only get the EXAMPLE\text\txt path.
-
+ c:\\program files\\example (full directory path: c:\\program files\\example\\text\\txt)
+ it comes with the whole path. I would like that the zip only get the EXAMPLE\\text\\txt path.
A: You can set \e bFullPath argument to \c false in these functions and set
the beginning part of the path that you commonly want to eliminate with
CZipArchive::SetRootPath function. In the example above you'd set it to
-c:\program files\ (the path separator at the end is added automatically).
+c:\\program files\\ (the path separator at the end is added automatically).
\anchor q10
@@ -188,7 +187,9 @@ with the argument set to ZipCompatibility::zcUnix after creating the archive.
Q: How can I use UNC path with CZipArchive::ExtractFile function ?
+\verbatim
A: You need to replace \\\\ at the beginning of the UNC path with \\\\?\UNC\ .
+\endverbatim
\anchor q12
diff --git a/stepmania/src/smpackage/ZipArchive/gpl.txt b/stepmania/src/smpackage/ZipArchive/gpl.txt
index 29c8515ffa..832de66790 100644
--- a/stepmania/src/smpackage/ZipArchive/gpl.txt
+++ b/stepmania/src/smpackage/ZipArchive/gpl.txt
@@ -282,4 +282,4 @@ POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
-*/
+*/
\ No newline at end of file
diff --git a/stepmania/src/smpackage/ZipArchive/mfc/ZipBaseException.h b/stepmania/src/smpackage/ZipArchive/mfc/ZipBaseException.h
index c68c5ca511..9e378ae8e1 100644
--- a/stepmania/src/smpackage/ZipArchive/mfc/ZipBaseException.h
+++ b/stepmania/src/smpackage/ZipArchive/mfc/ZipBaseException.h
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/stepmania/src/smpackage/ZipArchive/mfc/ZipCollections.h b/stepmania/src/smpackage/ZipArchive/mfc/ZipCollections.h
index 0bcdfe063e..b40f8d2d0e 100644
--- a/stepmania/src/smpackage/ZipArchive/mfc/ZipCollections.h
+++ b/stepmania/src/smpackage/ZipArchive/mfc/ZipCollections.h
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
diff --git a/stepmania/src/smpackage/ZipArchive/mfc/ZipFile.cpp b/stepmania/src/smpackage/ZipArchive/mfc/ZipFile.cpp
index 9cabf1251c..a8ac6b5c55 100644
--- a/stepmania/src/smpackage/ZipArchive/mfc/ZipFile.cpp
+++ b/stepmania/src/smpackage/ZipArchive/mfc/ZipFile.cpp
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -33,6 +33,10 @@ CZipFile::~CZipFile()
}
+CZipFile::operator HANDLE()
+{
+ return (HANDLE)m_hFile;
+}
// __int64 CZipFile::Seek(__int64 dOff, UINT nFrom)
// {
diff --git a/stepmania/src/smpackage/ZipArchive/mfc/ZipFile.h b/stepmania/src/smpackage/ZipArchive/mfc/ZipFile.h
index af5b103704..a4510c2aa6 100644
--- a/stepmania/src/smpackage/ZipArchive/mfc/ZipFile.h
+++ b/stepmania/src/smpackage/ZipArchive/mfc/ZipFile.h
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -21,20 +21,20 @@
#pragma once
#endif // _MSC_VER > 1000
#include "ZipAbstractFile.h"
+#include "ZipExport.h"
-class CZipFile :public CZipAbstractFile, public CFile
+class ZIP_API CZipFile :public CZipAbstractFile, public CFile
{
public:
DECLARE_DYNAMIC(CZipFile)
-// __int64 Seek(__int64 dOff, UINT nFrom);
void Flush(){CFile::Flush();}
- DWORD GetPosition() const {return CFile::GetPosition() ;}
+ ZIP_ULONGLONG GetPosition() const {return CFile::GetPosition() ;}
CZipString GetFilePath() const {return CFile::GetFilePath();}
- void SetLength(long nNewLen) {CFile::SetLength(nNewLen);}
+ void SetLength(ZIP_ULONGLONG nNewLen) {CFile::SetLength(nNewLen);}
UINT Read(void *lpBuf, UINT nCount){return CFile::Read(lpBuf, nCount);}
void Write(const void* lpBuf, UINT nCount){CFile::Write(lpBuf, nCount);}
- long Seek(long lOff, int nFrom){return CFile::Seek(lOff, nFrom);}
- DWORD GetLength() const {return CFile::GetLength();}
+ ZIP_ULONGLONG Seek(ZIP_LONGLONG lOff , int nFrom){return CFile::Seek(lOff, nFrom);}
+ ZIP_ULONGLONG GetLength() const {return CFile::GetLength();}
bool Open( LPCTSTR lpszFileName, UINT nOpenFlags, bool bThrowExc)
{
CFileException* e = new CFileException;
@@ -48,7 +48,7 @@ public:
CZipFile();
bool IsClosed() const
{
- return m_hFile == (UINT)CFile::hFileNull;
+ return m_hFile == CFile::hFileNull;
}
@@ -60,6 +60,7 @@ public:
if (!IsClosed())
CFile::Close();
}
+ operator HANDLE();
virtual ~CZipFile();
};
diff --git a/stepmania/src/smpackage/ZipArchive/mfc/ZipString.h b/stepmania/src/smpackage/ZipArchive/mfc/ZipString.h
index 9e2cf7690e..52a6e4f231 100644
--- a/stepmania/src/smpackage/ZipArchive/mfc/ZipString.h
+++ b/stepmania/src/smpackage/ZipArchive/mfc/ZipString.h
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -17,7 +17,7 @@
#ifndef ZIPSTRING_DOT_H
#define ZIPSTRING_DOT_H
#include "stdafx.h"
-
+#include "ZipExport.h"
typedef CString CZipString;
@@ -33,6 +33,6 @@ typedef int (CZipString::*ZIPSTRINGCOMPARE)( LPCTSTR ) const;
return a pointer to the function in CZipString structure,
used to compare elements depending on the arguments
*/
- ZIPSTRINGCOMPARE GetCZipStrCompFunc(bool bCaseSensitive, bool bCollate = true);
+ ZIP_API ZIPSTRINGCOMPARE GetCZipStrCompFunc(bool bCaseSensitive, bool bCollate = true);
#endif /* ZIPSTRING_DOT_H */
diff --git a/stepmania/src/smpackage/ZipArchive/mfc/stdafx.h b/stepmania/src/smpackage/ZipArchive/mfc/stdafx.h
index ea94a961f8..5d0ffb6dc2 100644
--- a/stepmania/src/smpackage/ZipArchive/mfc/stdafx.h
+++ b/stepmania/src/smpackage/ZipArchive/mfc/stdafx.h
@@ -4,7 +4,7 @@
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -22,10 +22,18 @@
#pragma once
#endif // _MSC_VER > 1000
-#ifdef __BORLANDC__
-#define ZIPINLINE
-#else
+#if _MSC_VER < 1300 && !defined __BORLANDC__
#define ZIPINLINE inline
+#else
+#define ZIPINLINE
+#endif
+
+#if _MSC_VER >= 1300
+#define ZIP_ULONGLONG ULONGLONG
+#define ZIP_LONGLONG LONGLONG
+#else
+#define ZIP_ULONGLONG DWORD
+#define ZIP_LONGLONG LONG
#endif
#define ZIP_ARCHIVE_MFC
diff --git a/stepmania/src/smpackage/ZipArchive/resource.h b/stepmania/src/smpackage/ZipArchive/resource.h
new file mode 100644
index 0000000000..6cf0c78db2
--- /dev/null
+++ b/stepmania/src/smpackage/ZipArchive/resource.h
@@ -0,0 +1,15 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by version.rc
+//
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/stepmania/src/smpackage/ZipArchive/ZipInternalInfo.cpp b/stepmania/src/smpackage/ZipArchive/stl/ZipBaseException.h
similarity index 55%
rename from stepmania/src/smpackage/ZipArchive/ZipInternalInfo.cpp
rename to stepmania/src/smpackage/ZipArchive/stl/ZipBaseException.h
index 91aecf03de..6eb4b00719 100644
--- a/stepmania/src/smpackage/ZipArchive/ZipInternalInfo.cpp
+++ b/stepmania/src/smpackage/ZipArchive/stl/ZipBaseException.h
@@ -1,10 +1,10 @@
////////////////////////////////////////////////////////////////////////////////
-// $Workfile: ZipInternalInfo.cpp $
-// $Archive: /ZipArchive/ZipInternalInfo.cpp $
+// $Workfile: ZipBaseException.h $
+// $Archive: /ZipArchive_STL/ZipBaseException.h $
// $Date$ $Author$
////////////////////////////////////////////////////////////////////////////////
// This source file is part of the ZipArchive library source distribution and
-// is Copyright 2000-2002 by Tadeusz Dracz (http://www.artpol-software.com/)
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@ -14,24 +14,9 @@
// For the licensing details see the file License.txt
////////////////////////////////////////////////////////////////////////////////
-#include "stdafx.h"
-#include "ZipInternalInfo.h"
+#ifndef __ZIPBASEEXCEPTION_H__
+#define __ZIPBASEEXCEPTION_H__
-//////////////////////////////////////////////////////////////////////
-// Construction/Destruction
-//////////////////////////////////////////////////////////////////////
+typedef std::exception CZipBaseException;
-CZipInternalInfo::CZipInternalInfo()
-{
- m_iBufferSize = 16384;
-}
-
-CZipInternalInfo::~CZipInternalInfo()
-{
-
-}
-
-void CZipInternalInfo::Init()
-{
- m_pBuffer.Allocate(m_iBufferSize);
-}
+#endif //__ZIPBASEEXCEPTION_H__
diff --git a/stepmania/src/smpackage/ZipArchive/stl/ZipCollections.h b/stepmania/src/smpackage/ZipArchive/stl/ZipCollections.h
new file mode 100644
index 0000000000..d475d648fb
--- /dev/null
+++ b/stepmania/src/smpackage/ZipArchive/stl/ZipCollections.h
@@ -0,0 +1,164 @@
+////////////////////////////////////////////////////////////////////////////////
+// $Workfile: ZipCollections.h $
+// $Archive: /ZipArchive_STL/ZipCollections.h $
+// $Date$ $Author$
+////////////////////////////////////////////////////////////////////////////////
+// This source file is part of the ZipArchive library source distribution and
+// is Copyright 2000-2003 by Tadeusz Dracz (http://www.artpol-software.com/)
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// For the licensing details see the file License.txt
+////////////////////////////////////////////////////////////////////////////////
+
+#ifndef ZIPCOLLECTIONS_DOT_H
+#define ZIPCOLLECTIONS_DOT_H
+
+#if _MSC_VER > 1000
+ #pragma warning( push, 3 ) // STL "requirements"
+ #pragma warning (disable : 4284) //return type for 'identifier::operator >' is not a UDT or reference to a UDT. Will produce errors if applied using infix notation
+ #pragma warning (disable : 4018) //'expression' : signed/unsigned mismatch
+#endif
+
+#include
+#include
+#include