Upgrade ZipArchive to 2.3.4. SMPackage compiles in VC7 now.

This commit is contained in:
Glenn Maynard
2003-07-22 02:10:30 +00:00
parent eae9565659
commit e6dd1487ff
112 changed files with 7312 additions and 2673 deletions
@@ -1,16 +1,83 @@
/** \page pageHist Revision history
<B> ver 2.2b <SMALL>(01-2002)</SMALL></B>
<B> ver 2.3.4 <SMALL>(06-2003)</SMALL></B>
<B> Bug fixed: </B>
- 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)
<B> Changes: </B>
- 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)
<B> ver 2.3.3 <SMALL>(01-2003)</SMALL></B>
<B> Features added: </B>
- CZipArchive::m_bRemoveDriveLetter option added
<B> Bugs fixed: </B>
- 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).
<B> ver 2.3.2 <SMALL>(08-2002)</SMALL></B>
<B> Bug fixed: </B>
- problem with creating disk spanning archives in the STL version of the library (thanks to Luiz Rafael Culik for reporting)
<B> ver 2.3.1 <SMALL>(05-2002)</SMALL></B>
<B> Bug fixed: </B>
- using CZipMemFile::CZipMemFile(BYTE* , UINT , long ) constructor could cause memory errors (thanks to Laurent Doré)
<B> ver 2.3 <SMALL>(04-2002) (includes changes and fixes from 2.2a to 2.2c)</SMALL></B>
<B> Features added: </B>
- 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
<BR>( 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
<B> Changes: </B>
- zlib library updated to version 1.1.4 that fixes the security vulnerability in version 1.1.3
as described in
\htmlonly
<A HREF="http://www.zlib.org/advisory-2002-03-11.txt" target="_blank">http://www.zlib.org/advisory-2002-03-11.txt</A>
\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 &);
<B> Bugs fixed: </B>
- 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)
<B> ver 2.2a <SMALL>(11-2001)</SMALL></B>
<B> Bugs fixed: </B>
- aborting extraction of multi-disk archive caused errors (thanks to Sabina Terenzi)
- some GUI fixes in ZipArc
<B> Known issues: </B>
- 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
<B> ver 2.2 <SMALL>(10-2001)</SMALL></B> <EM>Time for global changes</EM>
@@ -214,10 +281,9 @@
- Changed names for several classes.
<B> ver 1.3.1 <SMALL>(11-2000)</SMALL></B>
- 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
<B> ver 1.2.2 <SMALL>(08-2000)</SMALL></B>
@@ -235,7 +301,7 @@
- one class for zip and unzip functions
- fast adding, deleting and extracting files with a single function call
<B> ver 1.1.2 <SMALL>(03-2001)</SMALL></B>
<B> ver 1.1.2 <SMALL>(03-2000)</SMALL></B>
- 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).
@@ -1,380 +0,0 @@
<!-- The Code Project article submission template (HTML version)
Using this template will help us post your article sooner. We are using MS
IIS and ASP pages on the server, allowing us to simplify the templates used
to create the articles.
To fill in this template, just follow the 3 easy steps below:
1. Fill in the article description details
2. Add links to your images and downloads
3. Include the main article text
That's all there is to it! All formatting will be done by the ASP script
engine.
-->
<html>
<head>
<title>The Code Project</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
BODY { FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; FONT-SIZE: 10pt }
H2 { COLOR: #0066ff; FONT-SIZE: 13pt; FONT-WEIGHT: bold; }
H3 { COLOR: #0066ff; FONT-SIZE: 12pt; FONT-WEIGHT: bold; font-style: italic; }
H3 { COLOR: #0066ff; FONT-SIZE: 11pt; FONT-WEIGHT: bold; }
PRE { BACKGROUND-COLOR: #FBEDBB; FONT-FAMILY: "Courier New", Courier, mono; WHITE-SPACE: pre; }
CODE { COLOR: #990000; FONT-FAMILY: "Courier New", Courier, mono; }
</style>
</head>
<body bgcolor="#FFFFFF" color="#000000">
<!-- STEP 1. Fill in the details (CodeProject will reformat this section for you) -->
<pre>
Title: Zip and Unzip in the MFC way
Author: Tadeusz Dracz
Email: [email protected]
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
</pre>
<hr width="100%" noshade>
<!-- STEP 2. Include download and sample image information -->
<ul>
<li class="download"><a href="zip_src.zip">Download source - 110 Kb</a></li>
<li class="download"><a href="zip_demo.zip">Download demo project - 40 Kb</a></li>
<h2>Overview</h2>
<p>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.</p>
<h2>How to integrate with the project</h2>
<p>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: &quot;zlib.h&quot; and &quot;zconf.h&quot; 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 &quot;ZipArchive.h&quot;):</p>
<h4>Method 1</h4>
<p>Add &quot;..\Zip\debug(release)\Zip.lib&quot; to <em>Project
Settings-&gt;Link-&gt;Input-&gt;Object/library modules</em> and add Zip
directory to the preprocessor searches (<em>Project Settings -&gt; C++ -&gt;
Preprocessor -&gt; Additional include directories</em>).</p>
<h4>Method 2 (simpler)</h4>
<p>Insert Zip project into workspace and set project dependencies (your project
dependent on Zip project).</p>
<h2>How to use</h2>
<p>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.</p>
<h3>Compression and decompression</h3>
<p>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.<br>
Remember to call Close() function when you finish working with CZipArchive
class.</p>
<h3>Multi-disk archives</h3>
<p>This library supports two kinds of multi-disk archives:<br>
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.<br>
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.</p>
<p>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
&quot;.zip&quot;. You should also label each disk with the appropriate label
starting from &quot;pkback# 001&quot;.</p>
<p>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.</p>
<p>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&nbsp; for
the best performance.</p>
<p>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).</p>
<h3>Password encryption and decryption</h3>
<p>&nbsp;&nbsp;&nbsp; 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.<br>
&nbsp;&nbsp;&nbsp; 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.<br>
&nbsp;&nbsp; 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.</p>
<h3>Self extract support</h3>
<p>The library automatically detects self-extracting archives. This is the
simplest self-extract code :</p>
<!-- start a block of source code -->
<pre>
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(&quot;Select directory to extract files&quot;);
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 &lt; 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 )
}
<!-- end the block of source code -->
</pre>
<p>After compiling it and appending a zip archive to it (e.g. with the DOS
command: <em>copy /b SelfExtract.exe + ZipFile.zip FinalFile.exe</em>) we have a
self extracting archive.</p>
<h3>Testing the integrity of the archive</h3>
<p>The new functions has been provided to allow the testing of the integrity of
the archive. The first one is <em>CZipArchive::TestFile </em>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: <em>CZipArchive::CloseFileAfterTestFailed.
</em>The detailed description and the example of use are provided in the sources
and in the example project.</p>
<h3>Exceptions</h3>
<p>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:</p>
<pre>
try
{
// ...
// some operations on Zip library
}
catch (CException* e)
{
if (e-&gt;IsKindOf( RUNTIME_CLASS( CZipException )))
{
CZipException* p = (CZipException*) e;
//... and so on
}
else if (e-&gt;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-&gt;Delete();
}
</pre>
<h3>Handling the extra field</h3>
<p>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 <em>header</em>
parameter of <font size="3"><em>CZipArchive::OpenNewFile </em>function<em>. </em>After
that the extra field is written to the local header and cleared. You should call
<em>CZipArchive::SetExtraField </em>function anytime after opening the new file
(but before closing it) to set the file extra field in the central directory.</font></p>
<h3>Sample application</h3>
<p>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.</p>
<h3>Linking errors</h3>
<p>When you experience linking errors (mostly <em>LNK2005)</em> you need to
make sure that the library and your program are both using
single-threaded or both multithreaded library. The option <em>&quot;Project-&gt;Settings-&gt;
c/c++ -&gt;Code Generation-&gt;Use run-time library&quot; </em>should be set
to the same value in the ZipArchive library and the program project options.
<p>If it doesn't help, try recompiling the zlib library ( <em>zlib.lib</em>
provided with the project is compiled from a release configuration and using <font SIZE="2">Multithreaded</font>
DLL run-time library ). You can download the zlib library
sources from <a href="http://software.artpol.com.pl/d_zip.html.">http://software.artpol.com.pl/d_zip.html.</a>
Use <em>zlibstat</em> project. Set <em>&quot;Use run-time library&quot;</em>
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 <em>zlib.lib</em> in the ZipArchive folder. You may
however experience linking warnings or errors while compiling the Debug
configuration. To eliminate them do as follows:
<ul>
<li>compile Debug and Release configuraions of the zlib library
<li>copy <em>zlib_d.lib</em> from Debug and <em>zlib.lib</em> from Release
directories to the ZipArchive directory
<li>add these files to the ZipArchive project <em>(Project -&gt; Add To
Project -&gt; Files...)</em>
<li>go to the project setting dialog <em>(Project -&gt; Settings)</em>
<li>select debug configurations <em>(Setting For -&gt; Multiple
Configurations)</em> such as Debug and Unicode Debug
<li>select <em>zlib.lib</em> file, then the General tab, and check the box <em>&quot;Exclude
file from build&quot;</em>
<li>select release configurations
<li>select <em>zlib_.lib</em> and exclude it from these builds</li>
</ul>
<p>&nbsp;</p>
<h2>To Do and updates</h2>
<p>I currently work on the non-MFC version of the library and a multi-platform
support. Make sure to check out the site <a href="http://software.artpol.com.pl">http://software.artpol.com.pl</a>
which is more likely to have an updated version.&nbsp;</p>
<h2>Downloads</h2>
<!-- demo and source files -->
<a HREF="file:///E:/b/ZipArchive/zip_src.zip">
<p>Download source - 110 KB</a><br>
<a href="file:///E:/b/ZipArchive/zip_demo.zip">Download example - 40 KB</a></p>
<h2>History</h2>
<p><b>03.2001</b></p>
<ul>
<li>when the central directory was not located, the library throws
CZipException::cdirNotFound,<br>
which allows distinguish from other exceptions (useful when we want to keep
prompting<br>
the user to insert the last disk in a multi-disk spanning archive).</li>
</ul>
</ul>
<p>&nbsp;</p>
<ul>
<b>02.2001</b>
<dl compact>
<dt><b>Features added:</b>
<dd>
<ul>
<li>ability to reuse the archive after an exception thrown during
extraction
<li>added progress control possibilities to CZipArchive::AddNewFile,
CZipArchive::ExtractFile, CZipArchive::TestFile</li>
</ul>
</dd>
</dl>
<dl compact>
<dt><b>Changes:</b>
<dd>
<ul>
<li>CZipArchive::FindFile operation boosted ( thanks to Darin Warling for
the idea)
<li>library name changed to ZipArchive</li>
</ul>
</dd>
</dl>
<dl compact>
<dt><b>Bugs fixed:</b>
<dd>
<ul>
<li>removed bug during extracting an encrypted file with 0 size
<li>fixed bug when extracting a file with an extra field in a local file
header (CZipFileHeader::ReadLocal)</li>
</ul>
</dd>
</dl>
<b>01.2001</b>
<ul>
<li>Disk numbering in a disk spanning archive begins now from PKBACK# 001 not
PKBACK# 000
<li>Adding and extracting without a full path possible in
CZipArchive::AddNewFile and CZipArchive::ExtractFile.
<li>Several minor changes and enhancements
<li>Changed names for several classes.</li>
</ul>
<b>11.2000</b>
<ul>
<li>Added support for password encryption and decryption. The encryption used
in PKZIP was generously supplied by Roger Schlafly.
<li>Testing the archive made easier
<li>Unicode support added</li>
</ul>
<b>08.2000</b>
<ul>
<li>Bugs fixed</li>
</ul>
<b>06.2000</b>
<p>the code has been completely rewritten since the very beginning; the main
improvements are:
<ul>
<li>multi-disk archive support
<li>creation of the disk spanning archives with the user-defined volume size
<li>ability to modify existing archives (add, delete files)
<li>modification self-extracting archives
<li>write buffer used for faster disk write operations
<li>one class for zip and unzip functions
<li>fast adding, deleting and extracting files with a single function call</li>
</ul>
<b>03.2000</b>
<ul>
<li>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).</li>
</ul>
<b>01.2000</b>
<p>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:
<ul>
<li>added class' wrappers
<li>several bugs fixed
<li>several enhancements added
<li>MFC support added
<li>memory leaks eliminated when write error occurred
<li>automatically free used memory on destruction or exception
<li>modern error notification using exceptions</li>
</ul>
</body>
</html>
+23 -14
View File
@@ -1,7 +1,7 @@
/** \page pageLic Licensing information
ZipArchive library - creation, modification and extraction of "zip" format archives <BR>
Copyright &copy; 2000 - 2002 Tadeusz Dracz. <BR>
ZipArchive library - creation, modification and decompression of "zip" format archives <BR>
Copyright &copy; 2000 - 2003 Tadeusz Dracz. <BR>
E-Mail: \htmlonly<a href="mailto:[email protected]"> [email protected]</a><BR>
Web: <A HREF="http://www.artpol-software.com" target="_blank">http://www.artpol-software.com</A> \endhtmlonly
@@ -21,19 +21,19 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
<HR>
*************************************************************************
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
<A HREF="http://www.gnu.org/copyleft/gpl.html" target="_blank">http://www.gnu.org/copyleft/gpl.html</A>
\endhtmlonly
<B><EM>
<EM><B>
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.
</B></EM>
\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)</B>, 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.
<BR>
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 <EM>(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)</EM>
- 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 <em>(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. )</em>
- 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 <A HREF="http://www.harbour-project.org" target="_blank">Harbour</A>\endhtmlonly)<BR>
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.
<BR>
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 <a href="mailto:[email protected]">contact the author</a> or visit <A HREF="http://www.artpol-software.com" target="_blank">the Artpol Software web site</A>\endhtmlonly to find out more.
Please \htmlonly <a href="mailto:[email protected]">contact the author</a> or visit <A HREF="http://www.artpol-software.com" target="_blank">the Artpol Software web site</A> \endhtmlonly to find out more.
*/
@@ -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)
@@ -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 <sys/mman.h>
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<char*> (m_pFileMap);
}
protected:
void* m_pFileMap;
size_t m_iSize;
};
}
#endif // !defined(AFX_AUTOHANDLE_H__D68326EA_D7FA_4792_AB1F_68D09533E399__INCLUDED_)
@@ -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;
}
@@ -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 <utime.h>
#include "ZipPathComponent.h"
#include "ZipCompatibility.h"
#include <sys/vfs.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
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;
}
+159 -110
View File
@@ -14,34 +14,41 @@ If you do not have it, please download it from http://www.artpol-software.com/
<I><B>
The ZipArchive library <BR>
</B>
Copyright &copy; 2000 - 2002 Tadeusz Dracz<BR>
Copyright &copy; 2000 - 2003 Tadeusz Dracz<BR>
</I>
\b Version: 2.2 <BR>
\b Date: 10-January-2002
\b Version: 2.3.4 <BR>
\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 <B> \ref pageHist "what's new" </b> in this version.<BR>
To be notified about the future library updates, sign up for the \ref pageSubsc.
<B>\ref pageSyst "Platforms supported:" </B>
- 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) <BR> \ref sectVisual "Microsoft Visual C++ 6.0" (<B>.NET compatible </B>), \ref sectBorl "Borland C++"
- \ref sectLinux "Linux (STL)"
\author Tadeusz Dracz <BR>
E-Mail: \htmlonly <a href="mailto:[email protected]">[email protected]</a> \endhtmlonly<BR>
Web Site: \htmlonly <A HREF="http://www.artpol-software.com" target="_blank">http://www.artpol-software.com</A> \endhtmlonly
This library uses \htmlonly <A HREF="http://www.freesoftware.com/pub/infozip/zlib/" target="_blank">the zlib library </A> \endhtmlonly by Jean-loup Gailly and Mark Adler to perform inflate and deflate operations.
This library uses \htmlonly <A HREF="http://www.gzip.org/zlib/" target="_blank">the zlib library </A> \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 <A HREF="http://www.freesoftware.com/pub/infozip/zli
- UNC and Windows Unicode paths recognized
- wide characters supported
- support for the Java <sup><small>TM</small></sup> Archive (jar) File Format (see CZipArchive::SetIgnoreCRC)
- can be used as a static library or DLL (necessary VC++ projects included)
- possibility to integrate help system with MSDN (see \ref sectHelp)
- easy interface
- easy transfer to other system platforms
@@ -58,97 +66,52 @@ This library uses \htmlonly <A HREF="http://www.freesoftware.com/pub/infozip/zli
- well documented
- full source code provided
- sample applications provided (for the STL version located in \e stl/zippie,
the MFC version is available separately)
the MFC version (multithreaded) is available separately)
Suggestions and bug reports are welcome. Drop me a note if you wish to share any.
No software product is entirely bugless and neither is this library. If you find a bug (or suspect one), please <a href="mailto:[email protected]?Subject=bug report">mail me</a>. 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
- <B>[Windows only]</B> 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, <BR>
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 <BR>
\e \\Windows and \e \\mfc <BR>
You can just execute <EM> _copy from Win-MFC.bat </EM> batch file.
\subsection winSTL Windows STL
\e \Windows and \e \stl <BR>
\e \\Windows and \e \\stl <BR>
You can just execute <EM> _copy from Win-STL.bat </EM> batch file.
\subsection LnxSTL Linux (STL version)
\e \Linux and \e \stl <BR>
\e \\Linux and \e \\stl <BR>
You can just execute <EM> _copy_from_Linux.sh </EM> script file
(don't forget to set executable rights before e.g. with the command:
<EM> chmod +x _copy_from_Linux.sh </EM>).
@@ -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. <EM> ..\ZipArchive\debug\ZipArchive.lib </EM> to <EM> Project Settings->Link->Input->Object/library modules </EM>
Add \e ZipArchive.lib with the proper path e.g. <EM> ..\\ZipArchive\\debug\\ZipArchive.lib </EM> to <EM> Project Settings->Link->Input->Object/library modules </EM>
and add ZipArchive library directory to the preprocessor searches (<EM> Project Settings -> C++ -> Preprocessor -> Additional include directories </EM>).
\subsection subsM2 Method 2 (simpler)
Insert Zip project into workspace and set project dependencies: your project dependent on ZipArchive project
(<EM> Project -> Dependencies </EM> 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
(<em> Project->Settings->General->Microsoft Fundation Classes </em> and <EM> Project->Settings-> c/c++ ->Code Generation->Use run-time library </EM>).
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 <B>ZIP_HAS_DLL</B> (e.g. in <EM> Project Settings -> C++ -> Preprocessor -> Preprocessor definitions </EM>).
Apart from integrating the ZipArchive library with your program (use one of the methods above), you also need to take into account <EM>zlib.lib</EM> file (use <EM>zlib/zlib.dsw </EM> to create it and add to preprocessor includes) or <EM>zlib/zlib.dsw</EM> project (insert into workspace and set ZipArchive project dependent on it)).
Files <EM>zlib.dll</EM> and <EM>ZipArchive.dll</EM> 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 <I> Tools->Visual C++ Project Conversion Utility </I>.
- 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 <I> Tools->Visual C++ Project Conversion Utility </I>.
\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.
<EM><B>The library contains also \e makefiles which should work with every version of Borland.</B></EM>
<EM><B>The library contains also \e makefiles which should work with other versions of Borland.</B></EM>
\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 <EM>make uninstall</EM>
\section sectNotes Notes
\subsection stlNotes STL version
- <B>[Windows only]</B> 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
<B>[Windows only]</B>
- The project that compiles the DLL version of the ZipArchive library needs to have defined <B>ZIP_HAS_DLL, ZIP_BUILD_DLL</B> and also <B>ZLIB_DLL</B>.
- The project that uses the ZipArchive library as the DLL version need to have defined <B>ZIP_HAS_DLL</B>
\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, <BR>
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
- <B>PKSpan</B> 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
- <B>TDSpan</B> 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* <VAR><B>(be sure to delete the object when you done with it)</B></VAR>. 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
*/
@@ -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
+12 -4
View File
@@ -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
@@ -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;
@@ -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
@@ -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;
}
@@ -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(){};
};
File diff suppressed because it is too large Load Diff
+42 -734
View File
@@ -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 <filter> <input-file>, where <filter>
# is the value of the INPUT_FILTER tag, and <input-file> 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 =
@@ -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
@@ -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>
{{{
File diff suppressed because it is too large Load Diff
@@ -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
@@ -3,7 +3,7 @@
ProjectType="Visual C++"
Version="7.00"
Name="ZipArchive"
SccProjectName="ZipArchive"
SccProjectName="&quot;$/ZipArchive&quot;, LDAAAAAA"
SccLocalPath="."
Keyword="MFCProj">
<Platforms>
@@ -22,7 +22,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
PreprocessorDefinitions="NDEBUG,WIN32,_WINDOWS,ZLIB_DLL,ZIP_ARCHIVE_MFC_PROJ"
PreprocessorDefinitions="NDEBUG,ZLIB_DLL,WIN32,_WINDOWS,ZIP_ARCHIVE_MFC_PROJ,PKZIP_BUG_WORKAROUND"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
@@ -66,7 +66,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="_DEBUG,WIN32,_WINDOWS,ZLIB_DLL,ZIP_ARCHIVE_MFC_PROJ,NDEBUG"
PreprocessorDefinitions="_DEBUG,WIN32,_WINDOWS,ZIP_ARCHIVE_MFC_PROJ,PKZIP_BUG_WORKAROUND"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="2"
@@ -111,7 +111,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;ZLIB_DLL;ZIP_ARCHIVE_MFC_PROJ"
PreprocessorDefinitions="NDEBUG;ZLIB_DLL;WIN32;_WINDOWS;ZIP_ARCHIVE_MFC_PROJ;PKZIP_BUG_WORKAROUND"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
@@ -155,7 +155,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;ZLIB_DLL;ZIP_ARCHIVE_MFC_PROJ"
PreprocessorDefinitions="_DEBUG;ZLIB_DLL;WIN32;_WINDOWS;ZIP_ARCHIVE_MFC_PROJ;PKZIP_BUG_WORKAROUND"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
@@ -200,7 +200,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;ZLIB_DLL;ZIP_ARCHIVE_MFC_PROJ"
PreprocessorDefinitions="_DEBUG;ZLIB_DLL;WIN32;_WINDOWS;ZIP_ARCHIVE_MFC_PROJ;PKZIP_BUG_WORKAROUND"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="2"
@@ -210,7 +210,7 @@
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
BrowseInformation="1"
WarningLevel="3"
WarningLevel="4"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"/>
<Tool
@@ -245,7 +245,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
PreprocessorDefinitions="NDEBUG,WIN32,_WINDOWS,ZLIB_DLL,ZIP_ARCHIVE_MFC_PROJ"
PreprocessorDefinitions="NDEBUG,WIN32,_WINDOWS,ZIP_ARCHIVE_MFC_PROJ,PKZIP_BUG_WORKAROUND"
StringPooling="TRUE"
RuntimeLibrary="0"
EnableFunctionLevelLinking="TRUE"
@@ -289,7 +289,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;ZLIB_DLL;ZIP_ARCHIVE_MFC_PROJ"
PreprocessorDefinitions="NDEBUG;ZLIB_DLL;WIN32;_WINDOWS;ZIP_ARCHIVE_MFC_PROJ;PKZIP_BUG_WORKAROUND"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
@@ -348,9 +348,6 @@
<File
RelativePath=".\ZipFileHeader.cpp">
</File>
<File
RelativePath=".\ZipInternalInfo.cpp">
</File>
<File
RelativePath=".\ZipMemFile.cpp">
</File>
@@ -491,6 +488,9 @@
<File
RelativePath=".\ZipException.h">
</File>
<File
RelativePath=".\ZipExport.h">
</File>
<File
RelativePath=".\ZipFile.h">
</File>
@@ -500,9 +500,6 @@
<File
RelativePath=".\ZipFileMapping.h">
</File>
<File
RelativePath=".\ZipInternalInfo.h">
</File>
<File
RelativePath=".\ZipMemFile.h">
</File>
@@ -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
@@ -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>
{{{
}}}
###############################################################################
@@ -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
@@ -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
@@ -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>
{{{
}}}
###############################################################################
@@ -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
@@ -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_)
@@ -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
@@ -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;
}
@@ -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_)
@@ -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);
}
@@ -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. <BR>
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);
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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);
@@ -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 */
@@ -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)
// {
+9 -8
View File
@@ -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();
};
@@ -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
@@ -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
@@ -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;
@@ -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_)
@@ -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;
}
@@ -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();
@@ -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
@@ -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)
@@ -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;
}
@@ -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 <sys/types.h>
#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
};
@@ -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
@@ -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));
}
+23 -14
View File
@@ -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
@@ -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
@@ -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 */
@@ -0,0 +1,5 @@
#!/bin/sh
cp -f Linux/* ./
cp -f stl/* ./
rm -f __*.zcfg
echo Linux STL > __Linux_STL.zcfg
@@ -0,0 +1,5 @@
@echo off
copy Windows\*.* *.*
copy mfc\*.* *.*
del __*.zcfg
echo Windows MFC > __Windows_MFC.zcfg
@@ -0,0 +1,5 @@
@echo off
copy Windows\*.* *.*
copy stl\*.* *.*
del __*.zcfg
echo Windows STL > __Windows_STL.zcfg
@@ -1 +1 @@
2.2
2.3.4
Binary file not shown.
+11 -10
View File
@@ -21,7 +21,7 @@ Q: When do I need to purchase the commercial license?
<A HREF="#q2">
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?
</A>
@@ -44,7 +44,7 @@ Q: Why the library doesn't want to extract archives (mostly old)?
</A>
<A HREF="#q9">
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.
</A>
@@ -53,7 +53,7 @@ Q: I want to create an archive that will be readable under Unix/Linux.
</A>
<A HREF="#q11">
Q: How can I use UNC path with CZipArchive::ExtractFile function ?
Q: How can I use UNC path with %CZipArchive::ExtractFile function ?
</A>
<A HREF="#q12">
@@ -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 <EM> Project->Settings-> c/c++ ->Code Generation->Use run-time library </EM>
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:<BR>
When I compress some directory, like this:
<em> c:\program files\example</em> (full directory path: <em>c:\program files\example\text\txt</em>)
it comes with the whole path. I would like that the zip only get the <em>EXAMPLE\text\txt path</em>.
<em> c:\\program files\\example</em> (full directory path: <em>c:\\program files\\example\\text\\txt</em>)
it comes with the whole path. I would like that the zip only get the <em>EXAMPLE\\text\\txt</em> path.
</B>
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
<em>c:\program files\ </em> (the path separator at the end is added automatically).
<em>c:\\program files\\ </em> (the path separator at the end is added automatically).
\anchor q10
<B>
@@ -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 ?
</B>
\verbatim
A: You need to replace \\\\ at the beginning of the UNC path with \\\\?\UNC\ .
\endverbatim
\anchor q12
<B>
+1 -1
View File
@@ -282,4 +282,4 @@ POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
*/
*/
@@ -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
@@ -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
@@ -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)
// {
@@ -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();
};
@@ -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 */
@@ -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
@@ -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
@@ -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__
@@ -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 <vector>
#include <list>
#include <map>
#include <algorithm>
#include <functional>
#include "ZipString.h"
#include "ZipExport.h"
template<class TYPE>
class CZipArray : private std::vector<TYPE>
{
public:
typedef std::vector<TYPE>::iterator iterator;
typedef std::vector<TYPE> inherited;
protected:
iterator GetIterFromIndex(int uIndex)
{
iterator iter = begin();
iter += uIndex;
// int t = 0; while (t != uIndex) {iter++;t++;}
return iter;
}
public:
void Sort(bool bAscending)
{
if (bAscending)
std::sort (begin (), end (), std::less<TYPE> ());
else
std::sort (begin (), end (), std::greater<TYPE> ());
}
int GetSize() const{return (int)size(); }
int GetUpperBound() const {return size() - 1;}
int Add(const TYPE& x) {push_back(x);return GetUpperBound();}
void RemoveAll() {clear();}
void RemoveAt(int uIndex) { erase(GetIterFromIndex(uIndex));}
void InsertAt(int uIndex, const TYPE& x){insert(GetIterFromIndex(uIndex), x);}
#ifndef _MSC_VER
TYPE& operator[](int iIndex)
{
return inherited::operator[](iIndex);
}
TYPE operator[](int iIndex) const
{
return inherited::operator[](iIndex);
}
#else
using inherited::operator[];
#endif
};
typedef CZipArray<CZipString> CZipStringArray;
typedef CZipArray<WORD> CZipWordArray;
template<class TYPE>
class ZIP_API CZipPtrList : private std::list<TYPE>
{
public:
typedef std::list<TYPE>::iterator iterator;
typedef std::list<TYPE>::const_iterator const_iterator;
int GetCount() const {return size();}
void AddTail(const TYPE& x){push_back(x);}
void AddHead(const TYPE& x){push_front(x);}
void RemoveHead() {pop_front();}
void RemoveTail() {pop_back();}
void RemoveAll() {clear();}
TYPE& GetHead() {return front();}
TYPE GetHead() const {return front();}
TYPE& GetTail() {return back();}
TYPE GetTail() const {return back();}
iterator GetHeadPosition() { return begin();}
const_iterator GetHeadPosition() const { return begin();}
iterator GetTailPosition() { return back();}
TYPE& GetNext(iterator& pos) { return *pos++;}
const TYPE GetNext(const_iterator& pos) const{ return *pos++;}
TYPE& GetPrev(iterator& pos) { return *pos--;}
TYPE GetPrev(iterator& pos) const{ return *pos--;}
iterator Find(TYPE& x) { return std::find(begin(), end(), x);}
void RemoveAt(iterator& pos) { erase(pos);}
bool IteratorValid(const_iterator &iter) const
{
return iter != end();
}
bool IteratorValid(iterator &iter)
{
return iter != end();
}
iterator FindIndex(int iIndex)
{
iterator iter = begin();
int t = 0; while (t != iIndex) {iter++;t++;}
return iter;
}
const_iterator FindIndex(int iIndex) const
{
const_iterator iter = begin();
int t = 0; while (t != iIndex) {iter++;t++;}
return iter;
}
TYPE& GetAt(const iterator& pos) { return *pos;}
TYPE GetAt(const_iterator& pos) const{ return *pos;}
};
// simplified and partial only
template<class KEY, class VALUE>
class ZIP_API CZipMap : private std::map<KEY, VALUE>
{
public:
void SetAt( KEY key, VALUE newValue)
{
insert(std::map<KEY, VALUE>::value_type(key, newValue));
}
BOOL RemoveKey( KEY key )
{
return erase(key) != 0;
}
BOOL Lookup( KEY key, VALUE& rValue ) const
{
const_iterator iter = find(key);
if (iter == end())
return FALSE;
else
{
rValue = iter->second;
return TRUE;
}
}
};
#if defined(_MSC_VER) && (_MSC_VER > 1100)
#pragma warning( pop)
#endif
#endif /* ZIPCOLLECTIONS_DOT_H */
@@ -0,0 +1,114 @@
////////////////////////////////////////////////////////////////////////////////
// $Workfile: ZipFile.cpp $
// $Archive: /ZipArchive_STL/ZipFile.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 "ZipFile.h"
#include "ZipException.h"
#include "ZipPlatform.h"
#include <fcntl.h>
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CZipFile::CZipFile()
{
m_hFile = -1;
}
void CZipFile::ThrowError() const
{
CZipException::Throw(errno, m_szFileName);
}
ZIP_ULONGLONG CZipFile::GetLength() const
{
// cannot use Seek here, Seek is not const
long lLen, lCur;
lCur = lseek(m_hFile, 0, current);
if (lCur == -1)
ThrowError();
lLen = lseek(m_hFile, 0, end);
// first get back
lseek(m_hFile, lCur, begin);
if (lLen == -1)
ThrowError();
return lLen;
}
bool CZipFile::Open(LPCTSTR lpszFileName, UINT openFlags, bool bThrow)
{
if (!IsClosed())
Close();
#ifndef __GNUC__
UINT iNewFlags = O_BINARY;
#else
UINT iNewFlags = 0;
#endif
bool bReadOnly = false;
if (openFlags & CZipFile::modeCreate)
iNewFlags |= O_CREAT;
if ((openFlags & CZipFile::modeReadWrite) == CZipFile::modeReadWrite)
iNewFlags |= O_RDWR;
else if (openFlags & CZipFile::modeRead)
{
// O_RDONLY is defined as 0
bReadOnly = true;
iNewFlags |= O_RDONLY;
}
else if (openFlags & CZipFile::modeWrite)
iNewFlags |= O_WRONLY;
if (!(openFlags & CZipFile::modeNoTruncate) && !bReadOnly)
iNewFlags |= O_TRUNC;
m_hFile = ZipPlatform::OpenFile(lpszFileName, iNewFlags, openFlags & 0x1C);
if (m_hFile == -1)
if (bThrow)
ThrowError();
else
return false;
m_szFileName = lpszFileName;
return true;
}
void CZipFile::SetLength(ZIP_ULONGLONG nNewLen)
{
ZipPlatform::TruncateFile(m_hFile, (DWORD)nNewLen);
}
void CZipFile::Flush()
{
if (!ZipPlatform::FlushFile(m_hFile))
ThrowError();
}
CZipFile::operator HANDLE()
{
int fh = ZipPlatform::GetFileSystemHandle(m_hFile);
if (fh == -1)
ThrowError();
return (HANDLE)fh;
}
@@ -0,0 +1,116 @@
////////////////////////////////////////////////////////////////////////////////
// $Workfile: ZipFile.h $
// $Archive: /ZipArchive_STL/ZipFile.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_ZIPFILE_H__80609DE0_2C6D_4C94_A90C_0BE34A50C769__INCLUDED_)
#define AFX_ZIPFILE_H__80609DE0_2C6D_4C94_A90C_0BE34A50C769__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "ZipAbstractFile.h"
#include "ZipString.h"
#include "ZipExport.h"
#ifndef __GNUC__
#include <io.h>
#else
#include <unistd.h>
#include <errno.h>
#endif
class ZIP_API CZipFile :public CZipAbstractFile
{
void ThrowError() const;
public:
int m_hFile;
operator HANDLE();
enum OpenModes
{
modeRead = 0x0001,
modeWrite = 0x0002,
modeReadWrite = modeRead | modeWrite,
shareDenyWrite = 0x0004,
shareDenyRead = 0x0008,
shareDenyNone = 0x0010,
modeCreate = 0x0020,
modeNoTruncate = 0x0040,
};
CZipFile(LPCTSTR lpszFileName, UINT openFlags)
{
m_hFile = -1;
Open(lpszFileName, openFlags, true);
}
void Flush();
ZIP_ULONGLONG GetLength() const;
CZipString GetFilePath() const {return m_szFileName;}
bool IsClosed()const { return m_hFile == -1;}
bool Open(LPCTSTR lpszFileName, UINT openFlags, bool bThrow);
void Close()
{
if (IsClosed())
return;
if (close(m_hFile) != 0)
ThrowError();
else
{
m_szFileName.empty();
m_hFile = -1;
}
}
void Write(const void* lpBuf, UINT nCount)
{
if (write(m_hFile, lpBuf, nCount) != (int) nCount)
ThrowError();
}
ZIP_ULONGLONG GetPosition() const
{
#ifndef __GNUC__
long ret = tell(m_hFile);
#else
long ret = lseek(m_hFile, 0, SEEK_CUR);
#endif
if (ret == -1L)
ThrowError();
return ret;
}
void SetLength(ZIP_ULONGLONG nNewLen);
UINT Read(void *lpBuf, UINT nCount)
{
errno = 0;
int ret = read(m_hFile, lpBuf, nCount);
if (ret < (int) nCount && errno != 0)
ThrowError();
return ret;
}
ZIP_ULONGLONG Seek(ZIP_LONGLONG dOff, int nFrom)
{
long ret = lseek(m_hFile, (long)dOff, nFrom);
if (ret == -1)
ThrowError();
return ret;
}
CZipFile ();
virtual ~CZipFile (){Close();};
protected:
CZipString m_szFileName;
};
#endif // !defined(AFX_ZIPFILE_H__80609DE0_2C6D_4C94_A90C_0BE34A50C769__INCLUDED_)
@@ -0,0 +1,296 @@
////////////////////////////////////////////////////////////////////////////////
// $Workfile: ZipString.h $
// $Archive: /ZipArchive_STL/ZipString.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 __ZIPSTRING_H__
#define __ZIPSTRING_H__
#include "stdafx.h"
#if defined(_MSC_VER) && (_MSC_VER > 1100)
#pragma warning( push, 3 ) // STL requrements
#endif
/**
If you wish the class to respect your locale (if it is different from
English), you need to set it in your program with function
std::locale::global(std::locale("")) (to set it to be the same as your
system locale) or e.g. std::locale::global(std::locale("French"))
( to set it to a specified value); setlocale() function is not sufficient here.
*/
#include <string>
#include <algorithm>
#include <stdarg.h>
#include <stdio.h>
#include "ZipExport.h"
#ifndef __GNUC__
#ifndef _vsntprintf
#ifdef _UNICODE
#define _vsntprintf _vsnwprintf
#else
#define _vsntprintf _vsnprintf
#endif
#endif
#include <locale>
#else
#define _vsntprintf vsnprintf
#endif
typedef std::basic_string<TCHAR> stdbs;
/**
This is not a full MFC - CString replacement.
For now it contains mostly the methods required by ZipArchive library.
*/
class ZIP_API CZipString : public stdbs
{
void TrimInternalL(size_type iPos)
{
if (iPos == npos)
erase ();
if (iPos)
erase(0, iPos);
}
void TrimInternalR(size_type iPos)
{
if (iPos == npos)
erase ();
erase(++iPos);
}
#ifndef __GNUC__
static int zslen(const TCHAR* lpsz)
{
return lpsz ? (int)std::char_traits<TCHAR>::length(lpsz) : 0;
}
static TCHAR tl(TCHAR c)
{
return std::tolower<TCHAR>(c, std::locale());
}
static TCHAR tu(TCHAR c)
{
return std::toupper<TCHAR>(c, std::locale());
}
#else
static int zslen(const TCHAR* lpsz)
{
return lpsz ? std::string_char_traits<TCHAR>::length(lpsz) : 0;
}
#endif
public:
CZipString(){}
explicit CZipString (TCHAR ch, int nRepeat = 1):stdbs(nRepeat, ch){}
CZipString( const CZipString& stringSrc ) {assign(stringSrc);}
CZipString( const stdbs& stringSrc ) {assign(stringSrc);}
CZipString( LPCTSTR lpsz ){if (!lpsz) Empty(); else assign(lpsz);}
operator LPCTSTR() const{return c_str();}
int GetLength() const {return (int) size();}
bool IsEmpty() const {return empty();}
void Empty() {erase(begin(), end());}
TCHAR GetAt (int iIndex) const{return at(iIndex);}
TCHAR operator[] (int iIndex) const{return at(iIndex);}
void SetAt( int nIndex, TCHAR ch ) {at(nIndex) = ch;}
LPTSTR GetBuffer(int nMinBufLength)
{
if ((int)size() < nMinBufLength)
resize(nMinBufLength);
return empty() ? const_cast<TCHAR*>(data()) : &(at(0));
}
void ReleaseBuffer( int nNewLength = -1 ) { resize(nNewLength > -1 ? nNewLength : zslen(c_str()));}
void TrimLeft( TCHAR chTarget )
{
TrimInternalL(find_first_not_of(chTarget));
}
void TrimLeft( LPCTSTR lpszTargets )
{
TrimInternalL(find_first_not_of(lpszTargets));
}
void TrimRight( TCHAR chTarget )
{
TrimInternalR(find_last_not_of(chTarget));
}
void TrimRight( LPCTSTR lpszTargets )
{
TrimInternalR(find_last_not_of(lpszTargets));
}
void Format(LPCTSTR lpszFormat, ...)
{
va_list arguments;
va_start (arguments, lpszFormat);
TCHAR* pBuf = NULL;
int iCounter = 1, uTotal = 0;
do
{
int nLen = sizeof(TCHAR) * iCounter*1024;
pBuf = (TCHAR*)realloc((void*)pBuf, nLen);
if (!pBuf)
return;
uTotal = _vsntprintf(pBuf, nLen - 1, lpszFormat, arguments);
if (uTotal == -1 || (uTotal == nLen - 1) ) // for some implementations
{
pBuf[nLen - 1] = _T('\0');
if (iCounter == 7)
break;
}
else
{
pBuf[uTotal] = _T('\0');
break;
}
} while (true);
va_end (arguments);
*this = pBuf;
free(pBuf);
}
void Insert( int nIndex, LPCTSTR pstr ){insert(nIndex, pstr, zslen(pstr));}
void Insert( int nIndex, TCHAR ch ) {insert(nIndex, 1, ch);}
int Delete( int nIndex, int nCount = 1 )
{
int iSize = (int) size();
int iToDelete = iSize < nIndex + nCount ? iSize - nIndex : nCount;
if (iToDelete > 0)
{
erase(nIndex, iToDelete);
iSize -= iToDelete;
}
return iSize;
}
void MakeLower()
{
#ifndef __GNUC__
// use_facet doesn't work here well (doesn't convert all the local characters properly)
std::transform(begin(),end(),begin(),tl);
#else
std::transform(begin(),end(),begin(),tolower);
#endif
}
void MakeUpper()
{
#ifndef __GNUC__
// use_facet doesn't work here well (doesn't convert all the local characters properly)
std::transform(begin(),end(),begin(),tu);
#else
std::transform(begin(),end(),begin(),toupper);
#endif
}
void MakeReverse()
{
std::reverse(begin(), end());
}
CZipString Left( int nCount ) const { return substr(0, nCount);}
CZipString Right( int nCount) const
{
nCount = (int)size() < nCount ? (int)size() : nCount;
return substr(size() - nCount);
}
CZipString Mid( int nFirst ) const {return substr(nFirst);}
CZipString Mid( int nFirst, int nCount ) const {return substr(nFirst, nCount);}
int Collate( LPCTSTR lpsz ) const
{
#ifndef __GNUC__
#ifdef _UNICODE
return wcscoll(c_str(), lpsz);
#else
return strcoll(c_str(), lpsz);
#endif
#else
// return compare(lpsz);
return strcoll(c_str(), lpsz);
#endif
}
int CollateNoCase( LPCTSTR lpsz ) const
{
CZipString s1(c_str()), s2(lpsz);
s1.MakeLower();
s2.MakeLower();
return s1.Collate(s2);
}
int Compare( LPCTSTR lpsz ) const
{
return compare(lpsz);
}
int CompareNoCase( LPCTSTR lpsz ) const
{
CZipString s1(c_str()), s2(lpsz);
s1.MakeLower();
s2.MakeLower();
return s1.Compare(s2);
}
bool operator != (LPCTSTR lpsz)
{
return Compare(lpsz) != 0;
}
bool operator == (LPCTSTR lpsz)
{
return Compare(lpsz) == 0;
}
int Find( TCHAR ch, int nStart = 0) const
{
return (int) find(ch, nStart);
}
int Find( LPCTSTR pstr, int nStart = 0) const
{
return (int) find(pstr, nStart);
}
int Replace( TCHAR chOld, TCHAR chNew )
{
int iCount = 0;
for (iterator it = begin(); it != end(); ++it)
if (*it == chOld)
{
*it = chNew;
iCount++;
}
return iCount;
}
};
/**
A poiter type to point to CZipString to Collate or CollateNoCase
or Compare or CompareNoCase
*/
typedef int (CZipString::*ZIPSTRINGCOMPARE)( LPCTSTR ) const;
/**
return a pointer to the function in CZipString structure,
used to compare elements depending on the arguments
*/
ZIP_API ZIPSTRINGCOMPARE GetCZipStrCompFunc(bool bCaseSensitive, bool bCollate = true);
#if defined(_MSC_VER) && (_MSC_VER > 1100)
#pragma warning( pop)
#endif
#endif //__ZIPSTRING_H__
@@ -0,0 +1,126 @@
////////////////////////////////////////////////////////////////////////////////
// $Workfile: stdafx.h $
// $Archive: /ZipArchive_STL/stdafx.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_STDAFX_H__926F70F4_1B34_49AA_9532_498E8D2F3495__INCLUDED_)
#define AFX_STDAFX_H__926F70F4_1B34_49AA_9532_498E8D2F3495__INCLUDED_
#if (_MSC_VER < 1300) && !defined (__BORLANDC__) && !defined (__GNUC__)
#define ZIPINLINE inline
#else
#define ZIPINLINE
#endif
#define ZIP_ARCHIVE_STL
#if _MSC_VER > 1000
#pragma once
//because of STL
#pragma warning (disable : 4710) // 'function' : function not inlined
#pragma warning (disable : 4514) // unreferenced inline/local function has been removed
#pragma warning (disable:4786) // 'identifier' : identifier was truncated to 'number' characters in the debug information
#endif // _MSC_VER > 1000
// some Windows typical definitions
#if defined (_UNICODE) && !defined (UNICODE)
#define UNICODE
#endif
#if defined (UNICODE) && !defined (_UNICODE)
#define _UNICODE
#endif
#ifndef _WIN32
#ifndef NULL
#define NULL 0
#endif
#include <ctype.h>
typedef int HFILE;
typedef void* HANDLE;
typedef unsigned long DWORD;
typedef long LONG;
typedef int BOOL;
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned int UINT;
#ifndef FALSE
#define FALSE (int)0
#endif
#ifndef TRUE
#define TRUE (int)1
#endif
typedef unsigned short WCHAR; // wc, 16-bit UNICODE character
typedef const WCHAR *LPCWSTR;
typedef const char *LPCSTR;
typedef WCHAR *LPWSTR;
typedef char *LPSTR;
#ifdef _UNICODE
typedef wchar_t TCHAR;
typedef LPCWSTR LPCTSTR;
typedef LPWSTR LPTSTR;
#define _T(x) L ## x
#else /* _UNICODE */ // r_winnt
typedef char TCHAR;
typedef LPCSTR LPCTSTR;
typedef LPSTR LPTSTR;
#define _T(x) x
#endif /* _UNICODE */ // r_winnt
#else
#include <TCHAR.H>
#include <windows.H>
#ifndef STRICT
#define STRICT
#endif
#endif // #ifndef _WIN32
#ifndef ASSERT
#include <assert.h>
#define ASSERT(f) assert((f))
#endif
#ifndef VERIFY
#ifdef _DEBUG
#define VERIFY(x) ASSERT((x))
#else
#define VERIFY(x) x
#endif
#endif
#ifndef TRACE
#define TRACE
#endif
#if _MSC_VER >= 1300
#define ZIP_ULONGLONG ULONGLONG
#define ZIP_LONGLONG LONGLONG
#else
#define ZIP_ULONGLONG DWORD
#define ZIP_LONGLONG LONG
#endif
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__926F70F4_1B34_49AA_9532_498E8D2F3495__INCLUDED_)
@@ -0,0 +1,268 @@
/*------------------------------------------------------
CCmdLine
A utility for parsing command lines.
Copyright (C) 1999 Chris Losinger, Smaller Animals Software.
http://www.smalleranimals.com
This software is provided 'as-is', without any express
or implied warranty. In no event will the authors be
held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software
for any purpose, including commercial applications, and
to alter it and redistribute it freely, subject to the
following restrictions:
1. The origin of this software must not be misrepresented;
you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment
in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such,
and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
See SACmds.h for more info.
------------------------------------------------------*/
// if you're using MFC, you'll need to un-comment this line
#include "CmdLine.h"
//#include "crtdbg.h"
/*------------------------------------------------------
int CCmdLine::SplitLine(int argc, char **argv)
parse the command line into switches and arguments
returns number of switches found
------------------------------------------------------*/
int CCmdLine::SplitLine(int argc, char **argv)
{
clear();
StringType curParam; // current argv[x]
// skip the exe name (start with i = 1)
for (int i = 1; i < argc; i++)
{
// if it's a switch, start a new CCmdLine
if (IsSwitch(argv[i]))
{
curParam = argv[i];
StringType arg;
// look at next input string to see if it's a switch or an argument
if (i + 1 < argc)
{
if (!IsSwitch(argv[i + 1]))
{
// it's an argument, not a switch
arg = argv[i + 1];
// skip to next
i++;
}
else
{
arg = "";
}
}
// add it
CCmdParam cmd;
cmd.m_strings.push_back(arg);
// add the CCmdParam to 'this'
pair<CCmdLine::iterator, bool> res = insert(CCmdLine::value_type(curParam, cmd));
}
else
{
// it's not a new switch, so it must be more stuff for the last switch
// ...let's add it
CCmdLine::iterator theIterator;
// get an iterator for the current param
theIterator = find(curParam);
if (theIterator!=end())
{
(*theIterator).second.m_strings.push_back(argv[i]);
}
else
{
// ??
}
}
}
return size();
}
/*------------------------------------------------------
protected member function
test a parameter to see if it's a switch :
switches are of the form : -x
where 'x' is one or more characters.
the first character of a switch must be non-numeric!
------------------------------------------------------*/
bool CCmdLine::IsSwitch(const char *pParam)
{
if (pParam==NULL)
return false;
// switches must non-empty
// must have at least one character after the '-'
int len = strlen(pParam);
if (len <= 1)
{
return false;
}
// switches always start with '-'
if (pParam[0]=='-')
{
// allow negative numbers as arguments.
// ie., don't count them as switches
return (!isdigit(pParam[1]));
}
else
{
return false;
}
}
/*------------------------------------------------------
bool CCmdLine::HasSwitch(const char *pSwitch)
was the switch found on the command line ?
ex. if the command line is : app.exe -a p1 p2 p3 -b p4 -c -d p5
call return
---- ------
cmdLine.HasSwitch("-a") true
cmdLine.HasSwitch("-z") false
------------------------------------------------------*/
bool CCmdLine::HasSwitch(const char *pSwitch)
{
CCmdLine::iterator theIterator;
theIterator = find(pSwitch);
return (theIterator!=end());
}
/*------------------------------------------------------
StringType CCmdLine::GetSafeArgument(const char *pSwitch, int iIdx, const char *pDefault)
fetch an argument associated with a switch . if the parameter at
index iIdx is not found, this will return the default that you
provide.
example :
command line is : app.exe -a p1 p2 p3 -b p4 -c -d p5
call return
---- ------
cmdLine.GetSafeArgument("-a", 0, "zz") p1
cmdLine.GetSafeArgument("-a", 1, "zz") p2
cmdLine.GetSafeArgument("-b", 0, "zz") p4
cmdLine.GetSafeArgument("-b", 1, "zz") zz
------------------------------------------------------*/
StringType CCmdLine::GetSafeArgument(const char *pSwitch, int iIdx, const char *pDefault)
{
StringType sRet;
if (pDefault!=NULL)
sRet = pDefault;
try
{
sRet = GetArgument(pSwitch, iIdx);
}
catch (...)
{
}
return sRet;
}
/*------------------------------------------------------
StringType CCmdLine::GetArgument(const char *pSwitch, int iIdx)
fetch a argument associated with a switch. throws an exception
of (int)0, if the parameter at index iIdx is not found.
example :
command line is : app.exe -a p1 p2 p3 -b p4 -c -d p5
call return
---- ------
cmdLine.GetArgument("-a", 0) p1
cmdLine.GetArgument("-b", 1) throws (int)0, returns an empty string
------------------------------------------------------*/
StringType CCmdLine::GetArgument(const char *pSwitch, int iIdx)
{
if (HasSwitch(pSwitch))
{
CCmdLine::iterator theIterator;
theIterator = find(pSwitch);
if (theIterator!=end())
{
if ((*theIterator).second.m_strings.size() > iIdx)
{
return (*theIterator).second.m_strings[iIdx];
}
}
}
throw (int)0;
return "";
}
/*------------------------------------------------------
int CCmdLine::GetArgumentCount(const char *pSwitch)
returns the number of arguments found for a given switch.
returns -1 if the switch was not found
------------------------------------------------------*/
int CCmdLine::GetArgumentCount(const char *pSwitch)
{
int iArgumentCount = -1;
if (HasSwitch(pSwitch))
{
CCmdLine::iterator theIterator;
theIterator = find(pSwitch);
if (theIterator!=end())
{
iArgumentCount = (*theIterator).second.m_strings.size();
}
}
return iArgumentCount;
}
@@ -0,0 +1,246 @@
/*------------------------------------------------------
CCmdLine
A utility for parsing command lines.
Copyright (C) 1999 Chris Losinger, Smaller Animals Software.
http://www.smalleranimals.com
This software is provided 'as-is', without any express
or implied warranty. In no event will the authors be
held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software
for any purpose, including commercial applications, and
to alter it and redistribute it freely, subject to the
following restrictions:
1. The origin of this software must not be misrepresented;
you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment
in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such,
and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
-------------------------
Example :
Our example application uses a command line that has two
required switches and two optional switches. The app should abort
if the required switches are not present and continue with default
values if the optional switches are not present.
Sample command line :
MyApp.exe -p1 text1 text2 -p2 "this is a big argument" -opt1 -55 -opt2
Switches -p1 and -p2 are required.
p1 has two arguments and p2 has one.
Switches -opt1 and -opt2 are optional.
opt1 requires a numeric argument.
opt2 has no arguments.
Also, assume that the app displays a 'help' screen if the '-h' switch
is present on the command line.
#include "CmdLine.h"
void main(int argc, char **argv)
{
// our cmd line parser object
CCmdLine cmdLine;
// parse argc,argv
if (cmdLine.SplitLine(argc, argv) < 1)
{
// no switches were given on the command line, abort
ASSERT(0);
exit(-1);
}
// test for the 'help' case
if (cmdLine.HasSwitch("-h"))
{
show_help();
exit(0);
}
// get the required arguments
StringType p1_1, p1_2, p2_1;
try
{
// if any of these fail, we'll end up in the catch() block
p1_1 = cmdLine.GetArgument("-p1", 0);
p1_2 = cmdLine.GetArgument("-p1", 1);
p2_1 = cmdLine.GetArgument("-p2", 0);
}
catch (...)
{
// one of the required arguments was missing, abort
ASSERT(0);
exit(-1);
}
// get the optional parameters
// convert to an int, default to '100'
int iOpt1Val = atoi(cmdLine.GetSafeArgument("-opt1", 0, 100));
// since opt2 has no arguments, just test for the presence of
// the '-opt2' switch
bool bOptVal2 = cmdLine.HasSwitch("-opt2");
.... and so on....
}
If this class is used in an MFC application, StringType is CString, else
it uses the STL 'string' type.
If this is an MFC app, you can use the __argc and __argv macros from
you CYourWinApp::InitInstance() function in place of the standard argc
and argv variables.
------------------------------------------------------*/
#ifndef SACMDSH
#define SACMDSH
#if _MSC_VER > 1000
#pragma once
#pragma warning(disable:4786)
#pragma warning (disable : 4018)
#endif // _MSC_VER > 1000
// #ifdef __AFX_H__
// // if we're using MFC, use CStrings
// #define StringType CString
// #else
// // if we're not using MFC, use STL strings
// #define StringType string
// #endif
#ifdef __GNUC__
#include "ZipString.h"
#else
#include "../../ZipString.h"
#endif
#define StringType CZipString
//#include <iostream> // you may need this
#include <map>
#include <string>
#include <vector>
using namespace std ;
// handy little container for our argument vector
struct CCmdParam
{
vector<StringType> m_strings;
};
// this class is actually a map of strings to vectors
typedef map<StringType, CCmdParam> _CCmdLine;
// the command line parser class
class CCmdLine : public _CCmdLine
{
public:
/*------------------------------------------------------
int CCmdLine::SplitLine(int argc, char **argv)
parse the command line into switches and arguments.
returns number of switches found
------------------------------------------------------*/
int SplitLine(int argc, char **argv);
/*------------------------------------------------------
bool CCmdLine::HasSwitch(const char *pSwitch)
was the switch found on the command line ?
ex. if the command line is : app.exe -a p1 p2 p3 -b p4 -c -d p5
call return
---- ------
cmdLine.HasSwitch("-a") true
cmdLine.HasSwitch("-z") false
------------------------------------------------------*/
bool HasSwitch(const char *pSwitch);
/*------------------------------------------------------
StringType CCmdLine::GetSafeArgument(const char *pSwitch, int iIdx, const char *pDefault)
fetch an argument associated with a switch . if the parameter at
index iIdx is not found, this will return the default that you
provide.
example :
command line is : app.exe -a p1 p2 p3 -b p4 -c -d p5
call return
---- ------
cmdLine.GetSafeArgument("-a", 0, "zz") p1
cmdLine.GetSafeArgument("-a", 1, "zz") p2
cmdLine.GetSafeArgument("-b", 0, "zz") p4
cmdLine.GetSafeArgument("-b", 1, "zz") zz
------------------------------------------------------*/
StringType GetSafeArgument(const char *pSwitch, int iIdx, const char *pDefault);
/*------------------------------------------------------
StringType CCmdLine::GetArgument(const char *pSwitch, int iIdx)
fetch a argument associated with a switch. throws an exception
of (int)0, if the parameter at index iIdx is not found.
example :
command line is : app.exe -a p1 p2 p3 -b p4 -c -d p5
call return
---- ------
cmdLine.GetArgument("-a", 0) p1
cmdLine.GetArgument("-b", 1) throws (int)0, returns an empty string
------------------------------------------------------*/
StringType GetArgument(const char *pSwitch, int iIdx);
/*------------------------------------------------------
int CCmdLine::GetArgumentCount(const char *pSwitch)
returns the number of arguments found for a given switch.
returns -1 if the switch was not found
------------------------------------------------------*/
int GetArgumentCount(const char *pSwitch);
protected:
/*------------------------------------------------------
protected member function
test a parameter to see if it's a switch :
switches are of the form : -x
where 'x' is one or more characters.
the first character of a switch must be non-numeric!
------------------------------------------------------*/
bool IsSwitch(const char *pParam);
};
#endif
@@ -0,0 +1,978 @@
/*
* $Archive: /zippie/zippie.cpp $
* $Author$
*
* $History: zippie.cpp $
*
* ***************** Version 4 *****************
* User: Tadeusz Dracz Date: 02-04-01 Time: 2:05
* Updated in $/zippie
*
* ***************** Version 3 *****************
* User: Tadeusz Dracz Date: 02-01-19 Time: 18:01
* Updated in $/zippie
*
* ***************** Version 2 *****************
* User: Tadeusz Dracz Date: 01-11-08 Time: 19:54
* Updated in $/zippie
* added support for wildcards when extracting or deleting
*
*/
/////////////////////////////////////////////////////////////////////////////////
// zippie.cpp : Defines the entry point for the console application.
// An STL program that uses the ZipArchive library
//
// Copyright (C) 2000 - 2003 Tadeusz Dracz.
// 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
////////////////////////////////////////////////////////////////////////////////
#ifdef __GNUC__
#include "ZipArchive.h"
#include "ZipPlatform.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <fnmatch.h>
#include <unistd.h>
#else
#include "../../ZipArchive.h"
#include "../../ZipPlatform.h"
#endif
#include "CmdLine.h"
#include <stdlib.h>
#include <list>
#include <time.h>
#include <stdio.h>
ZIPSTRINGCOMPARE pZipComp;
struct CZipAddFileInfo
{
CZipAddFileInfo(const CZipString& szFilePath, const CZipString& szFileNameInZip)
:m_szFilePath(szFilePath), m_szFileNameInZip(szFileNameInZip)
{
int is = szFileNameInZip.GetLength();
m_iSeparators = 0;
for (int i = 0; i < is; i++)
if (CZipPathComponent::IsSeparator(szFileNameInZip[i]))
m_iSeparators++;
}
CZipString m_szFilePath, m_szFileNameInZip;
bool CheckOrder(const CZipString& sz1, const CZipString& sz2,
int iSep1, int iSep2, bool bCheckTheBeginning = false) const
{
if (iSep1)
{
if (iSep2)
{
if (iSep1 == iSep2)
return (sz1.*pZipComp)(sz2) < 0;
if (bCheckTheBeginning)
{
int is = sz1.GetLength() > sz2.GetLength() ? sz2.GetLength() : sz1.GetLength();
int iSeparators = 0;
// find the common path beginning
int iLastSepPos = -1;
for (int i = 0; i < is; i++)
{
CZipString sz = sz2.Mid(i, 1);
if ((sz1.Mid(i, 1).*pZipComp)(sz) != 0) // must be Mid 'cos of case sens. here
break;
else if (CZipPathComponent::IsSeparator(sz[0]))
{
iLastSepPos = i;
iSeparators++;
}
}
// if necessary remove the common path beginning and check again
if (iLastSepPos != -1)
return CheckOrder(sz1.Mid(iLastSepPos), sz2.Mid(iLastSepPos), iSep1 - iSeparators, iSep2 - iSeparators);
}
return (sz1.*pZipComp)(sz2) < 0;
}
else
return false;
}
else
if (iSep2)
return true;
else
return (sz1.*pZipComp)(sz2) < 0;
}
bool operator>(const CZipAddFileInfo& wz) const
{
bool b = CheckOrder(m_szFileNameInZip, wz.m_szFileNameInZip,
m_iSeparators, wz.m_iSeparators, true);
return b;
}
protected:
int m_iSeparators; // for a sorting puroposes
};
typedef list<CZipString> FILELIST;
typedef list<CZipString>::iterator FILELISTIT;
typedef list<struct CZipAddFileInfo> FILELISTADD;
typedef list<struct CZipAddFileInfo>::iterator FILELISTADDIT;
struct AddDirectoryInfo
{
AddDirectoryInfo(FILELIST& l):m_l(l){}
FILELIST& m_l;
CZipString m_lpszFile;
bool m_bRecursive;
bool m_bAddEmpty;
};
void DisplayUsage()
{
printf("\
\n\
Zippie v2.2\n\
Copyright (C) 2000 - 2003 Tadeusz Dracz\n\
E-Mail: [email protected]\n\
Web : http://www.artpol-software.com\n\
\n\
This program is free software; you can redistribute it and/or\n\
modify it under the terms of the GNU General Public License\n\
as published by the Free Software Foundation; either version 2\n\
of the License, or (at your option) any later version.\n\
\n\
This is a zipping and unzipping program.\n\
It was created using ZipArchive library in the STL version.\n\
\n\
\n\
USAGE: zippie <commands and (or) switches>\n\
\n\
Notes:\n\
- the order of commands and switches doesn't matter\n\
- if some files have spaces inside, put them inside quotation marks\n\
\n\
************ Default switches ************\n\
\n\
-f <archive>[.zip]\n\
<archive> file to create or open (can be with or without extension)\n\
the extension .zip is added automatically if not present\n\
-st\n\
use this switch if you're opening an existing disk spanning archive\n\
in tdSpan mode on a removable device (or under Linux)\n\
(doesn't matter for commands that modify the archive \n\
e.g. add or delete commands)\n\
\n\
************ Add files to archive commands ************\n\
\n\
-a <files>\n\
add <files> to the <archive>; separate them with spaces;\n\
you can use wildcards (*?)\n\
-af <file>\n\
add files listed in <file> (one file per line);\n\
no wildcards allowed in the files\n\
-ax <files>\n\
prevent <files> from being added to the <archive>;\n\
separate them with spaces; you can use wildcards (*?)\n\
-afx <file>\n\
prevent files listed in <file> (one file per line) to be added \n\
to the <archive>; no wildcards allowed in the files\n\
\n\
you can use switches -a, -af, -ax, -afx simultaneously\n");
printf("\
\n\
-r\n\
recurse subdirectories; don't include in the <archive> directories\n\
from which no file is added; under linux put file masks into \n\
quotation marks otherwise they will be automatically expaned by \n\
the shell and the recursion will be one level only\n\
-re\n\
recurse subdirectories and add all subdirectories even empty to the\n\
<archive>; see a note above about using file masks under Linux\n\
-u\n\
this switch tells the program to not delete the <archive> if it\n\
already exists (and if it is not a disk spanning archive), but add\n\
the <files> to it;\n\
if this switch is not specified, there is a new archive created\n\
even if one with the same name already exists (it is overwritten)\n\
-as [<path>]\n\
(add smartly) if this switch is specified, in the disk spanning mode\n\
the file is first compressed to a temporary directory to see whether \n\
it is smaller after compression; if it is not it stored then without \n\
a compression; (you can specify a <path> where the temporary files \n\
will be created, if you do not specify it, they will be created in \n\
the directory specified by the TMP system variable or if this variable\n\
is not defined the file will be created in the current directory;\n\
in normal archive if there is a such a situation the file is removed\n\
from the archive and then stored again but with no compression \n\
(the <path> argument is ignored)\n\
-c <number>\n\
set the compression level (from 0 to 9);\n\
if not specified, 5 is assumed\n\
0 means no compression - only storing\n\
-v <size>\n\
create a disk spanning archive\n\
if <size> is 0 create archive in pkSpan mode,\n\
if <size> is greater than 0 create archive in tdSpan mode\n\
\n");
printf("\
************ Extract commands ************\n\
\n\
-xp <path>\n\
it specifies the path the files will be extracted to; if not present,\n\
the current path is assumed\n\
-x <files>\n\
extract <files> to the destination <path>;\n\
separate them with spaces; wildcards are allowed\n\
-xr <numbers>\n\
extract files with the given <numbers> to the destination <path>\n\
separate number with spaces; to specify a range of numbers \n\
put between them a hyphen without spaces e.g. 3-6; \n\
put before an exclamation mark to exclude the numbers from the set\n\
(e.g. 2-20 !6-8 !10);\n\
(use -lr command to list the files with numbers)\n\
-xf <file>\n\
extract files listed in <file> (one file per line)\n\
to the destination <path>; wildcards are allowed\n\
-xa \n\
extract all files from the archive to the <path>\n\
\n\
you can use switches -x , -xr and -xf (and even -xa) simultaneously\n\
\n\
************ Delete commands ************\n\
\n\
-d <files>\n\
delete <files> separate them with spaces; wildcards are allowed\n");
printf("\
-dr <numbers>\n\
delete files with the given <numbers>\n\
separate number with spaces; to specify a range of numbers \n\
put between them a hyphen without spaces e.g. 3-6 \n\
put before an exclamation mark to exclude the numbers from the set\n\
(e.g. 2-20 !6-8 !10);\n\
(use -lr command to list the files with numbers)\n\
-df <file>\n\
delete files listed in <file> (one file per line)\n\
wildcards are allowed\n\
-da \n\
delete all the files from the archive\n\
\n\
you can use switches -d , -dr and -df (and even -da) simultaneously\n\
\n\
************ Other commands ************\n\
\n\
-t\n\
test the <archive>\n\
-p <password>\n\
set the <password> when adding files to <archive>\n\
or extracting them; the <password> is set for all the files\n\
- you cannot set it separately for each file in one session\n\
-l\n\
list the files inside <archive>\n\
-lr\n\
list the files inside <archive> with the numbers\n\
-ll\n\
list the files inside <archive> (only filenames)\n\
when redirected to a file, it can be used then with command -xf\n\
\n");
printf("\
************ Special switches ************\n\
\n\
-cs \n\
enable case sensitivity when:\n\
- searching for files inside <archive> while using the command\n\
-x or -xf (if not specified a search is non-case-sensitive)\n\
- adding files to <archive> and trying to avoid the same\n\
filenames in the archive\n\
-g <comment>\n\
Set the global <comment> of the <archive>\n\
(cannot be used on an existing disk spanning archive)\n\
if the <comment> contains spaces, put the whole <comment>\n\
inside quotation marks\n\
-rp <path>\n\
set root <path> (see CZipArchive::SetRootPath() function description)\n\
-nfp\n\
the same as bFullPath set to false in functions\n\
CZipArchive::AddNewFile() and CZipArchive::ExtractFile()\n\
(if not present, bFullPath is assumed to be true; if -rp specified\n\
bFullPath is always false);\n\
-w\n\
Wait for a key after finishing the work to let the user read the output\n\
in some environments\n\
-dse\n\
Display only errors when adding or extracting files\n\
\n\
************ Sample commands ************\n\
\n\
zippie -f a:\\archive -a * -v 0 -as -c 9 \n\
(create a disk spanning archive adding all the files from the current \n\
directory, smart add is used, compression level set to maximum)\n\
\n\
zippie -f a:\\archive -xp d:\\a -x zippie.cpp -xr 2-12 !5-7 !9\n\
(extract file zippie.cpp from the archive and the files with numbers \n\
from 2 to 12 and the file number 15 apart from 5 to 7 and 9)\n\
\n\
zippie -f example -xa\n\
extract all files from example.zip file to the current directory\n\
\n\
");
}
char ReadKey()
{
fflush (stdin);
char c = (char) tolower(getchar());
return c;
}
struct SpanCallback : public CZipSpanCallback
{
bool Callback(int iProgress)
{
printf ("Insert disk number %d and hit ENTER to contuniue \n or press 'n' key followed by ENTER to abort (code = %d)\n", m_uDiskNeeded, iProgress);
return ReadKey() != 'n';
}
};
void FillFromFile(FILELIST& l, LPCTSTR lpszFile, bool bCheck)
{
FILE* f = fopen(lpszFile, "rt");
if (!f)
{
printf ("File %s could not be opened\n", lpszFile);
return;
}
fseek(f, 0, SEEK_END);
int iSize = ftell(f);
fseek(f, 0, SEEK_SET);
CZipAutoBuffer buf(iSize + 1);
iSize = fread(buf, 1, iSize, f);
fclose(f);
char* sEnd = buf + iSize;
char* sBeg = buf;
for (char* pos = buf; ; pos++)
{
bool bEnd = pos == sEnd; // there may be no newline at the end
if (strncmp(pos, "\n", 1) == 0 || bEnd)
{
*pos = '\0';
CZipString s = sBeg;
s.TrimLeft(" ");
s.TrimRight(" ");
if (!s.IsEmpty() && (!bCheck || ZipPlatform::FileExists(s) != 0))
l.push_back(s);
if (bEnd)
break;
sBeg = pos + 1;
}
}
}
bool IsDots(LPCTSTR lpsz)
{
return strcmp(lpsz, ".") == 0 || strcmp(lpsz, "..") == 0;
}
void AddDirectory(CZipString szPath, struct AddDirectoryInfo& info, bool bDoNotAdd)
{
if (!szPath.IsEmpty())
CZipPathComponent::AppendSeparator(szPath);
bool bPathAdded = info.m_bAddEmpty || bDoNotAdd;
if (info.m_bAddEmpty && !szPath.IsEmpty() && !bDoNotAdd)
info.m_l.push_back(szPath);
#ifdef __GNUC__
DIR* dp = opendir(szPath.IsEmpty() ? "." : szPath);
if (!dp)
return;
struct dirent* entry;
while (entry = readdir(dp))
{
struct stat sStats;
CZipString szFullFileName = szPath + entry->d_name;
if (stat(szFullFileName, &sStats) == -1)
continue;
if (S_ISDIR(sStats.st_mode))
{
if (info.m_bRecursive)
{
if (IsDots(entry->d_name))
continue;
AddDirectory(szFullFileName, info, false);
}
}
else if (fnmatch(info.m_lpszFile, entry->d_name, FNM_NOESCAPE |FNM_PATHNAME) == 0)
{
if (!bPathAdded)
{
if (!szPath.IsEmpty())
info.m_l.push_back(szPath);
bPathAdded = true;
}
info.m_l.push_back(szPath + entry->d_name);
}
}
closedir(dp);
#else
CZipString szFullFileName = szPath + info.m_lpszFile;
struct _finddata_t c_file;
long hFile;
if( (hFile = _findfirst( szFullFileName, &c_file )) != -1L )
{
do
{
if (!(c_file.attrib & FILE_ATTRIBUTE_DIRECTORY))
{
// add it when the first file comes
if (!bPathAdded)
{
if (!szPath.IsEmpty())
info.m_l.push_back(szPath);
bPathAdded = true;
}
info.m_l.push_back(szPath + c_file.name);
}
}
while (_findnext(hFile, &c_file) == 0L);
}
_findclose(hFile);
if (info.m_bRecursive)
{
szFullFileName = szPath + "*";
if( (hFile = _findfirst( szFullFileName, &c_file )) != -1L )
{
do
{
if (c_file.attrib & FILE_ATTRIBUTE_DIRECTORY)
{
if (IsDots(c_file.name))
continue;
szFullFileName = szPath + c_file.name;
AddDirectory(szFullFileName, info, false);
}
}
while (_findnext(hFile, &c_file) == 0L);
}
_findclose(hFile);
}
#endif
}
void ExpandFile(FILELIST& l, LPCTSTR lpszPath,
bool bRecursive, bool bAddEmpty, bool bFullPath)
{
// check if we need to expand it
// size_t pos = strcspn(lpszFile, "*?");
// if (pos == strlen(lpszFile))
// {
// l.push_back(lpszFile);
// return;
// }
CZipPathComponent zpc(lpszPath);
CZipString szDir = zpc.GetFilePath();
// if (szDir.IsEmpty())
// if (!ZipPlatform::GetCurrentDirectory(szDir))
// return;
struct AddDirectoryInfo adi(l);
adi.m_bAddEmpty = bAddEmpty;
adi.m_bRecursive = bRecursive;
adi.m_lpszFile = zpc.GetFileName();
AddDirectory(szDir, adi, !bFullPath); // when not full path is specified for a single file with a path, do not add a directory then
}
void FindInZip(CZipArchive& zip, FILELIST& l, CZipWordArray& n)
{
for (FILELISTIT it = l.begin(); it != l.end(); ++it)
zip.FindMatches(*it, n);
}
void ProcessData(CZipArchive& zip, CCmdLine& cmd, CZipWordArray& vRevised, bool bExtract)
{
if (cmd.HasSwitch(bExtract ? "-xa" : "-da"))
{
int iMax = zip.GetCount();
for (int i = 0; i < iMax; i++)
vRevised.Add(i);
}
else
{
CZipWordArray numbers;
CZipString temp = bExtract ? "-x" : "-d";
int iCount = cmd.GetArgumentCount(temp);
if (iCount > 0)
{
FILELIST lFiles;
for (int i = 0; i < iCount; i++)
lFiles.push_back(cmd.GetArgument(temp, i));
FindInZip(zip, lFiles, numbers);
}
temp = bExtract ? "-xf" : "-df";
if (cmd.GetArgumentCount(temp) > 0)
{
FILELIST lFiles;
FillFromFile(lFiles, cmd.GetArgument(temp, 0), false);
FindInZip(zip, lFiles, numbers);
}
temp = bExtract ? "-xr" : "-dr";
iCount = cmd.GetArgumentCount(temp);
CZipWordArray notNumbers;
if (iCount > 0)
{
for (int i = 0; i < iCount; i++)
{
CZipString sz = cmd.GetArgument(temp, i);
bool bNot = !sz.IsEmpty() && sz[0] == '!';
CZipWordArray& vN = bNot ? notNumbers : numbers;
if (bNot)
sz.TrimLeft('!');
size_t pos = strcspn(sz, "-");
if (pos == sz.GetLength() )
vN.Add(atoi(sz) - 1);
else
{
int b = atoi (sz.Left(pos));
int e = atoi (sz.Mid(pos + 1));
for (int i = b; i <= e ; i++)
vN.Add(i - 1);
}
}
}
int iSize = notNumbers.GetSize();
if (iSize)
{
for (int j = 0; j < iSize; ++j)
for (int i = numbers.GetSize() ; i >= 0 ;i--)
if (numbers[i] == notNumbers[j])
numbers.RemoveAt(i);
}
int iMax = zip.GetCount() - 1;
for (int i = 0; i < numbers.GetSize(); ++i)
{
int x = numbers[i];
if (x < 0 || x > iMax)
continue;
bool bNew = true;
for (int j = 0; j < vRevised.GetSize(); ++j)
if (vRevised[j] == numbers[i])
{
bNew = false;
break;
}
if (bNew)
vRevised.Add(x);
}
}
}
int main(int argc, char* argv[])
{
#ifndef __GNUC__
// set the locale the same as the system locale
// to handle local characters (non-English) properly by CZipString
std::locale::global(std::locale(""));
#endif
int iRet = 0;
CCmdLine cmd;
CZipArchive zip;
CZipString szArchive;
try
{
if (cmd.SplitLine(argc, argv) < 1)
throw 0;
if (cmd.GetArgumentCount("-f") <= 0)
throw 0;
int iVolumeSize = 0;
int iMode = CZipArchive::zipOpen;
bool bIsAdding = cmd.GetArgumentCount("-a") > 0 || cmd.GetArgumentCount("-af") > 0;
bool bIsExtracting = cmd.GetArgumentCount("-x") > 0 || cmd.GetArgumentCount("-xr") > 0
|| cmd.GetArgumentCount("-xf") > 0 || cmd.HasSwitch("-xa");
bool bIsDeleting = cmd.GetArgumentCount("-d") > 0 || cmd.GetArgumentCount("-dr") > 0
|| cmd.GetArgumentCount("-df") > 0 || cmd.HasSwitch("-da");
szArchive = cmd.GetArgument("-f", 0);
CZipPathComponent zpc(szArchive);
if (zpc.GetFileExt().IsEmpty())
szArchive += ".zip";
bool bUpdateMode = cmd.HasSwitch("-u");
bool bSetComment = cmd.GetArgumentCount("-g") > 0;
bool bIsListing = cmd.HasSwitch("-l") || cmd.HasSwitch("-ll") ||
cmd.HasSwitch("-lr");
bool bOnlyErrors = cmd.HasSwitch("-dse");
if (bIsAdding)
{
if (cmd.GetArgumentCount("-v") > 0)
{
iMode = CZipArchive::zipCreateSpan;
iVolumeSize = atoi(cmd.GetArgument("-v", 0));
}
else
{
if (!bUpdateMode || !ZipPlatform::FileExists(szArchive))
iMode = CZipArchive::zipCreate;
}
}
else if (bIsExtracting || cmd.HasSwitch("-t") || bIsListing)
{
if (cmd.HasSwitch("-st"))
iVolumeSize = 1;
}
else if (!bSetComment && !bIsDeleting)
throw 0;
SpanCallback span;
zip.SetSpanCallback(&span);
bool bAddEmpty = cmd.HasSwitch("-re");
bool bRecursive = cmd.HasSwitch("-r") || bAddEmpty;
bool bCaseSensitiveInZip = cmd.HasSwitch("-cs");
pZipComp = GetCZipStrCompFunc(bCaseSensitiveInZip);
zip.SetCaseSensitivity(bCaseSensitiveInZip);
try
{
zip.Open(szArchive, iMode, iVolumeSize);
if (cmd.GetArgumentCount("-p") > 0)
zip.SetPassword(cmd.GetArgument("-p", 0));
}
catch(...)
{
bool bContinue = false;
if (iMode == CZipArchive::zipOpen && !bIsDeleting && !bSetComment)
{
try
{
// try to open in read only mode (required if there is no write access to the storage)
zip.Open(szArchive, CZipArchive::zipOpenReadOnly, iVolumeSize);
bContinue = true;
}
catch(...)
{
throw;
}
}
if (!bContinue)
throw;
}
if (cmd.GetArgumentCount("-rp") > 0)
zip.SetRootPath(cmd.GetArgument("-rp", 0));
bool bFullPath = !cmd.HasSwitch("-nfp") && zip.GetRootPath().IsEmpty();
bool bIsSpan = zip.GetSpanMode() != 0;
if (bSetComment && !bIsSpan)
{
CZipString sz = cmd.GetArgument("-g", 0);
sz.TrimLeft("\"");
sz.TrimRight("\"");
zip.SetGlobalComment(sz);
}
if (bIsAdding)
{
if (bUpdateMode && bIsSpan)
{
printf ("Cannot update an existing disk spanning archive\n");
zip.Close();
return 1;
}
int iLevel = atoi(cmd.GetSafeArgument("-c", 0, "5"));
int iSmartLevel;
if (cmd.HasSwitch("-as"))
{
iSmartLevel = CZipArchive::zipsmSmartest;
zip.SetTempPath(cmd.GetSafeArgument("-as", 0, ""));
}
else
iSmartLevel = CZipArchive::zipsmSafeSmart;
FILELIST lFiles;
int iCount = cmd.GetArgumentCount("-a");
if (iCount > 0)
{
for (int i = 0; i < iCount; i++)
ExpandFile(lFiles, cmd.GetArgument("-a", i), bRecursive,
bAddEmpty, bFullPath);
}
iCount = cmd.GetArgumentCount("-af");
if (iCount > 0)
FillFromFile(lFiles, cmd.GetArgument("-af", 0), true);
FILELIST excl;
iCount = cmd.GetArgumentCount("-ax");
if (iCount > 0)
{
for (int i = 0; i < iCount; i++)
ExpandFile(excl, cmd.GetArgument("-ax", i), bRecursive,
bAddEmpty, bFullPath);
}
iCount = cmd.GetArgumentCount("-afx");
if (iCount > 0)
FillFromFile(excl, cmd.GetArgument("-afx", 0), true);
FILELISTADD rev;
for (FILELISTIT it = lFiles.begin(); it != lFiles.end(); ++it)
{
// that is how the filename will look in the archive
CZipString sz = zip.PredictFileNameInZip(*it, bFullPath);
if (!sz.IsEmpty())
{
bool bAdd = true;
for (FILELISTIT itt = excl.begin(); itt != excl.end(); ++itt)
{
if (!((*itt).*pZipComp)(*it))
{
bAdd = false;
break;
}
}
if (bAdd)
rev.push_back(CZipAddFileInfo(*it, sz));
}
}
lFiles.clear();
excl.clear();
// remove duplicates
FILELISTADDIT it1;
for (it1 = rev.begin(); it1 != rev.end();)
{
bool bErase = false;
FILELISTADDIT it2 = it1;
for (++it2; it2 != rev.end(); ++it2)
{
int x = ((*it1).m_szFileNameInZip.*pZipComp)((*it2).m_szFileNameInZip);
if (x == 0)
{
bErase = true;
break;
}
}
if (bErase)
rev.erase(it1++);
else
++it1;
}
// sort
rev.sort(std::greater<CZipAddFileInfo>());
printf ("\n");
for (it1 = rev.begin(); it1 != rev.end(); ++it1)
{
if (zip.AddNewFile((*it1).m_szFilePath, iLevel, bFullPath, iSmartLevel))
{
if (!bOnlyErrors)
printf ("%s added\n", (LPCTSTR)(*it1).m_szFileNameInZip);
}
else
printf ("%s not added\n", (LPCTSTR)(*it1).m_szFilePath);
}
}
else if (bIsExtracting)
{
CZipString szPath = cmd.GetSafeArgument("-xp", 0, ".");
CZipWordArray vRevised;
ProcessData(zip, cmd, vRevised, true);
printf ("\n");
for (int k = 0; k < vRevised.GetSize(); ++k)
{
int iFile = vRevised[k];
try
{
zip.ExtractFile(iFile, szPath, bFullPath);
CZipFileHeader fh;
if (zip.GetFileInfo(fh, iFile))
{
if (!bOnlyErrors )
printf ("%s extracted\n", (LPCTSTR)fh.GetFileName());
}
}
catch (...)
{
CZipFileHeader fh;
if (zip.GetFileInfo(fh, iFile))
printf("Error extracting file %s\n", (LPCTSTR)fh.GetFileName());
else
printf("There are troubles with getting info from file number %d\n", iFile);
}
}
printf("\n");
}
else if (bIsDeleting)
{
if (bIsSpan)
{
printf ("Cannot delete from an existing disk spanning archive\n");
zip.Close();
return 1;
}
CZipWordArray vRevised;
ProcessData(zip, cmd, vRevised, false);
try
{
zip.DeleteFiles(vRevised);
}
catch (...)
{
printf("Error occured while deleting files\n");
}
}
else if (cmd.HasSwitch("-t"))
{
FILELIST lFiles;
int iCount = zip.GetCount();
for (int i = 0; i < iCount; i++)
{
bool bOK = false;
try
{
bOK = zip.TestFile(i);
printf("Tested: %d of %d \r", i, iCount);
}
catch (...)
{
}
if (!bOK)
{
CZipFileHeader fh;
if (zip.GetFileInfo(fh, i))
lFiles.push_back(fh.GetFileName());
else
{
char buf[50];
sprintf(buf, "There are troubles with getting info from file number %d", i);
lFiles.push_back(buf);
}
}
}
printf("\n");
if (lFiles.size())
{
printf ("There were errors found in the following files:\n");
for (FILELISTIT it = lFiles.begin(); it != lFiles.end(); ++it)
printf("%s\n", (LPCTSTR)(*it));
}
else
printf ("There were no errors found in the archive\n");
}
else if (bIsListing)
{
bool bNumbers = cmd.HasSwitch("-lr");
bool bDescription = !cmd.HasSwitch("-ll");
int iCount = zip.GetCount();
if (bDescription)
printf("\n File name\tSize\t\tRatio\tTime Stamp\n\n");
for (int i = 0; i < iCount; i++)
{
CZipFileHeader fh;
if (zip.GetFileInfo(fh, i))
{
if (bNumbers)
printf("%d. " ,i + 1);
printf("%s\n", (LPCTSTR)fh.GetFileName());
if (bDescription)
{
printf("\t\t");
if (fh.IsDirectory())
printf("<DIR>\t\t");
else
{
printf("%u Bytes\t", fh.m_uUncomprSize);
printf("%.2f%%", fh.GetCompressionRatio());
}
time_t t = fh.GetTime();
printf ("\t%s", ctime(&t));
}
}
else
printf("There are troubles with getting info from file number %d\n", i);
}
printf("\n");
CZipString sz = zip.GetGlobalComment();
if (!sz.IsEmpty())
printf("Global archive comment:\n%s\n", (LPCTSTR)sz);
}
zip.Close();
}
catch (int)
{
DisplayUsage();
iRet = 1;
}
catch (CZipException e)
{
printf ("Error while processing archive %s\n%s\n", (LPCTSTR) szArchive, (LPCTSTR)e.GetErrorDescription());
if (e.m_szFileName.IsEmpty())
printf("\n");
else
printf("Filename in error object: %s\n\n", (LPCTSTR)e.m_szFileName);
zip.Close(true);
iRet = 1;
}
catch (...)
{
printf ("Unknown error while processing archive %s\n\n", (LPCTSTR) szArchive);
zip.Close(true);
iRet = 1;
}
if (cmd.HasSwitch("-w"))
{
printf("\nPress <ENTER> to exit.\n");
ReadKey();
printf ("\n");
}
return iRet;
}
@@ -0,0 +1,111 @@
# Microsoft Developer Studio Project File - Name="zippie" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=zippie - 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 "zippie.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 "zippie.mak" CFG="zippie - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "zippie - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "zippie - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""$/zippie", BGAAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "zippie - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "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 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x415 /d "NDEBUG"
# ADD RSC /l 0x415 /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 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 /subsystem:console /machine:I386
# ADD 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 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 /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "zippie - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x415 /d "_DEBUG"
# ADD RSC /l 0x415 /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 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 /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD 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 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 /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "zippie - Win32 Release"
# Name "zippie - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\CmdLine.cpp
# End Source File
# Begin Source File
SOURCE=.\zippie.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\CmdLine.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
@@ -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.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Project: "zippie"=".\zippie.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name ZipArchive
End Project Dependency
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
@@ -0,0 +1,112 @@
# Microsoft Developer Studio Project File - Name="zippie" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=zippie - 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 "zippie_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 "zippie_DLL.mak" CFG="zippie - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "zippie - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "zippie - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""$/zippie", BGAAAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "zippie - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "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 /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "ZIP_HAS_DLL" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x415 /d "NDEBUG"
# ADD RSC /l 0x415 /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 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 /subsystem:console /machine:I386
# ADD 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 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 /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "zippie - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "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 /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "ZIP_HAS_DLL" /FR /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu
# ADD BASE RSC /l 0x415 /d "_DEBUG"
# ADD RSC /l 0x415 /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 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 /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD 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 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 /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "zippie - Win32 Release"
# Name "zippie - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\CmdLine.cpp
# End Source File
# Begin Source File
SOURCE=.\zippie.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\CmdLine.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
@@ -0,0 +1,59 @@
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: "zippie"=".\zippie_DLL.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name ZipArchive
End Project Dependency
}}}
###############################################################################
Project: "zlib"="..\..\zlib\zlib.dsp" - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
-279
View File
@@ -1,279 +0,0 @@
/* zconf.h -- configuration of the zlib compression library
* Copyright (C) 1995-1998 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#ifndef _ZCONF_H
#define _ZCONF_H
/*
* If you *really* need a unique prefix for all types and library functions,
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
*/
#ifdef Z_PREFIX
# define deflateInit_ z_deflateInit_
# define deflate z_deflate
# define deflateEnd z_deflateEnd
# define inflateInit_ z_inflateInit_
# define inflate z_inflate
# define inflateEnd z_inflateEnd
# define deflateInit2_ z_deflateInit2_
# define deflateSetDictionary z_deflateSetDictionary
# define deflateCopy z_deflateCopy
# define deflateReset z_deflateReset
# define deflateParams z_deflateParams
# define inflateInit2_ z_inflateInit2_
# define inflateSetDictionary z_inflateSetDictionary
# define inflateSync z_inflateSync
# define inflateSyncPoint z_inflateSyncPoint
# define inflateReset z_inflateReset
# define compress z_compress
# define compress2 z_compress2
# define uncompress z_uncompress
# define adler32 z_adler32
# define crc32 z_crc32
# define get_crc_table z_get_crc_table
# define Byte z_Byte
# define uInt z_uInt
# define uLong z_uLong
# define Bytef z_Bytef
# define charf z_charf
# define intf z_intf
# define uIntf z_uIntf
# define uLongf z_uLongf
# define voidpf z_voidpf
# define voidp z_voidp
#endif
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
# define WIN32
#endif
#if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386)
# ifndef __32BIT__
# define __32BIT__
# endif
#endif
#if defined(__MSDOS__) && !defined(MSDOS)
# define MSDOS
#endif
/*
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
* than 64k bytes at a time (needed on systems with 16-bit int).
*/
#if defined(MSDOS) && !defined(__32BIT__)
# define MAXSEG_64K
#endif
#ifdef MSDOS
# define UNALIGNED_OK
#endif
#if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC)
# define STDC
#endif
#if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__)
# ifndef STDC
# define STDC
# endif
#endif
#ifndef STDC
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
# define const
# endif
#endif
/* Some Mac compilers merge all .h files incorrectly: */
#if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__)
# define NO_DUMMY_DECL
#endif
/* Old Borland C incorrectly complains about missing returns: */
#if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
# define NEED_DUMMY_RETURN
#endif
/* Maximum value for memLevel in deflateInit2 */
#ifndef MAX_MEM_LEVEL
# ifdef MAXSEG_64K
# define MAX_MEM_LEVEL 8
# else
# define MAX_MEM_LEVEL 9
# endif
#endif
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
* created by gzip. (Files created by minigzip can still be extracted by
* gzip.)
*/
#ifndef MAX_WBITS
# define MAX_WBITS 15 /* 32K LZ77 window */
#endif
/* The memory requirements for deflate are (in bytes):
(1 << (windowBits+2)) + (1 << (memLevel+9))
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
plus a few kilobytes for small objects. For example, if you want to reduce
the default memory requirements from 256K to 128K, compile with
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
Of course this will generally degrade compression (there's no free lunch).
The memory requirements for inflate are (in bytes) 1 << windowBits
that is, 32K for windowBits=15 (default value) plus a few kilobytes
for small objects.
*/
/* Type declarations */
#ifndef OF /* function prototypes */
# ifdef STDC
# define OF(args) args
# else
# define OF(args) ()
# endif
#endif
/* The following definitions for FAR are needed only for MSDOS mixed
* model programming (small or medium model with some far allocations).
* This was tested only with MSC; for other MSDOS compilers you may have
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
* just define FAR to be empty.
*/
#if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__)
/* MSC small or medium model */
# define SMALL_MEDIUM
# ifdef _MSC_VER
# define FAR _far
# else
# define FAR far
# endif
#endif
#if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__))
# ifndef __32BIT__
# define SMALL_MEDIUM
# define FAR _far
# endif
#endif
/* Compile with -DZLIB_DLL for Windows DLL support */
#if defined(ZLIB_DLL)
# if defined(_WINDOWS) || defined(WINDOWS)
# ifdef FAR
# undef FAR
# endif
# include <windows.h>
# define ZEXPORT WINAPI
# ifdef WIN32
# define ZEXPORTVA WINAPIV
# else
# define ZEXPORTVA FAR _cdecl _export
# endif
# endif
# if defined (__BORLANDC__)
# if (__BORLANDC__ >= 0x0500) && defined (WIN32)
# include <windows.h>
# define ZEXPORT __declspec(dllexport) WINAPI
# define ZEXPORTRVA __declspec(dllexport) WINAPIV
# else
# if defined (_Windows) && defined (__DLL__)
# define ZEXPORT _export
# define ZEXPORTVA _export
# endif
# endif
# endif
#endif
#if defined (__BEOS__)
# if defined (ZLIB_DLL)
# define ZEXTERN extern __declspec(dllexport)
# else
# define ZEXTERN extern __declspec(dllimport)
# endif
#endif
#ifndef ZEXPORT
# define ZEXPORT
#endif
#ifndef ZEXPORTVA
# define ZEXPORTVA
#endif
#ifndef ZEXTERN
# define ZEXTERN extern
#endif
#ifndef FAR
# define FAR
#endif
#if !defined(MACOS) && !defined(TARGET_OS_MAC)
typedef unsigned char Byte; /* 8 bits */
#endif
typedef unsigned int uInt; /* 16 bits or more */
typedef unsigned long uLong; /* 32 bits or more */
#ifdef SMALL_MEDIUM
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
# define Bytef Byte FAR
#else
typedef Byte FAR Bytef;
#endif
typedef char FAR charf;
typedef int FAR intf;
typedef uInt FAR uIntf;
typedef uLong FAR uLongf;
#ifdef STDC
typedef void FAR *voidpf;
typedef void *voidp;
#else
typedef Byte FAR *voidpf;
typedef Byte *voidp;
#endif
#ifdef HAVE_UNISTD_H
# include <sys/types.h> /* for off_t */
# include <unistd.h> /* for SEEK_* and off_t */
# define z_off_t off_t
#endif
#ifndef SEEK_SET
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
#endif
#ifndef z_off_t
# define z_off_t long
#endif
/* MVS linker does not support external names larger than 8 bytes */
#if defined(__MVS__)
# pragma map(deflateInit_,"DEIN")
# pragma map(deflateInit2_,"DEIN2")
# pragma map(deflateEnd,"DEEND")
# pragma map(inflateInit_,"ININ")
# pragma map(inflateInit2_,"ININ2")
# pragma map(inflateEnd,"INEND")
# pragma map(inflateSync,"INSY")
# pragma map(inflateSetDictionary,"INSEDI")
# pragma map(inflate_blocks,"INBL")
# pragma map(inflate_blocks_new,"INBLNE")
# pragma map(inflate_blocks_free,"INBLFR")
# pragma map(inflate_blocks_reset,"INBLRE")
# pragma map(inflate_codes_free,"INCOFR")
# pragma map(inflate_codes,"INCO")
# pragma map(inflate_fast,"INFA")
# pragma map(inflate_flush,"INFLU")
# pragma map(inflate_mask,"INMA")
# pragma map(inflate_set_dictionary,"INSEDI2")
# pragma map(inflate_copyright,"INCOPY")
# pragma map(inflate_trees_bits,"INTRBI")
# pragma map(inflate_trees_dynamic,"INTRDY")
# pragma map(inflate_trees_fixed,"INTRFI")
# pragma map(inflate_trees_free,"INTRFR")
#endif
#endif /* _ZCONF_H */
@@ -1,9 +1,9 @@
/* adler32.c -- compute the Adler-32 checksum of a data stream
* Copyright (C) 1995-1998 Mark Adler
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#include "zlib.h"
@@ -46,4 +46,3 @@ uLong ZEXPORT adler32(adler, buf, len)
}
return (s2 << 16) | s1;
}
@@ -1,9 +1,9 @@
/* compress.c -- compress a memory buffer
* Copyright (C) 1995-1998 Jean-loup Gailly.
* Copyright (C) 1995-2002 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#include "zlib.h"
@@ -1,8 +1,9 @@
/* crc32.c -- compute the CRC-32 of a data stream
* Copyright (C) 1995-1998 Mark Adler
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#include "zlib.h"
@@ -1,5 +1,5 @@
/* deflate.c -- compress data using the deflation algorithm
* Copyright (C) 1995-1998 Jean-loup Gailly.
* Copyright (C) 1995-2002 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -47,11 +47,12 @@
*
*/
/* @(#) $Id$ */
#include "deflate.h"
const char deflate_copyright[] =
" deflate 1.1.3 Copyright 1995-1998 Jean-loup Gailly ";
" deflate 1.1.4 Copyright 1995-2002 Jean-loup Gailly ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@@ -241,7 +242,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
windowBits = -windowBits;
}
if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED ||
windowBits < 8 || windowBits > 15 || level < 0 || level > 9 ||
windowBits < 9 || windowBits > 15 || level < 0 || level > 9 ||
strategy < 0 || strategy > Z_HUFFMAN_ONLY) {
return Z_STREAM_ERROR;
}
@@ -1,5 +1,5 @@
/* deflate.h -- internal compression state
* Copyright (C) 1995-1998 Jean-loup Gailly
* Copyright (C) 1995-2002 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -8,6 +8,7 @@
subject to change. Applications should only use zlib.h.
*/
/* @(#) $Id$ */
#ifndef _DEFLATE_H
#define _DEFLATE_H
@@ -0,0 +1,875 @@
/* gzio.c -- IO on .gz files
* Copyright (C) 1995-2002 Jean-loup Gailly.
* For conditions of distribution and use, see copyright notice in zlib.h
*
* Compile this file with -DNO_DEFLATE to avoid the compression code.
*/
/* @(#) $Id$ */
#include <stdio.h>
#include "zutil.h"
struct internal_state {int dummy;}; /* for buggy compilers */
#ifndef Z_BUFSIZE
# ifdef MAXSEG_64K
# define Z_BUFSIZE 4096 /* minimize memory usage for 16-bit DOS */
# else
# define Z_BUFSIZE 16384
# endif
#endif
#ifndef Z_PRINTF_BUFSIZE
# define Z_PRINTF_BUFSIZE 4096
#endif
#define ALLOC(size) malloc(size)
#define TRYFREE(p) {if (p) free(p);}
static int gz_magic[2] = {0x1f, 0x8b}; /* gzip magic header */
/* gzip flag byte */
#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
#define HEAD_CRC 0x02 /* bit 1 set: header CRC present */
#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
#define COMMENT 0x10 /* bit 4 set: file comment present */
#define RESERVED 0xE0 /* bits 5..7: reserved */
typedef struct gz_stream {
z_stream stream;
int z_err; /* error code for last stream operation */
int z_eof; /* set if end of input file */
FILE *file; /* .gz file */
Byte *inbuf; /* input buffer */
Byte *outbuf; /* output buffer */
uLong crc; /* crc32 of uncompressed data */
char *msg; /* error message */
char *path; /* path name for debugging only */
int transparent; /* 1 if input file is not a .gz file */
char mode; /* 'w' or 'r' */
long startpos; /* start of compressed data in file (header skipped) */
} gz_stream;
local gzFile gz_open OF((const char *path, const char *mode, int fd));
local int do_flush OF((gzFile file, int flush));
local int get_byte OF((gz_stream *s));
local void check_header OF((gz_stream *s));
local int destroy OF((gz_stream *s));
local void putLong OF((FILE *file, uLong x));
local uLong getLong OF((gz_stream *s));
/* ===========================================================================
Opens a gzip (.gz) file for reading or writing. The mode parameter
is as in fopen ("rb" or "wb"). The file is given either by file descriptor
or path name (if fd == -1).
gz_open return NULL if the file could not be opened or if there was
insufficient memory to allocate the (de)compression state; errno
can be checked to distinguish the two cases (if errno is zero, the
zlib error is Z_MEM_ERROR).
*/
local gzFile gz_open (path, mode, fd)
const char *path;
const char *mode;
int fd;
{
int err;
int level = Z_DEFAULT_COMPRESSION; /* compression level */
int strategy = Z_DEFAULT_STRATEGY; /* compression strategy */
char *p = (char*)mode;
gz_stream *s;
char fmode[80]; /* copy of mode, without the compression level */
char *m = fmode;
if (!path || !mode) return Z_NULL;
s = (gz_stream *)ALLOC(sizeof(gz_stream));
if (!s) return Z_NULL;
s->stream.zalloc = (alloc_func)0;
s->stream.zfree = (free_func)0;
s->stream.opaque = (voidpf)0;
s->stream.next_in = s->inbuf = Z_NULL;
s->stream.next_out = s->outbuf = Z_NULL;
s->stream.avail_in = s->stream.avail_out = 0;
s->file = NULL;
s->z_err = Z_OK;
s->z_eof = 0;
s->crc = crc32(0L, Z_NULL, 0);
s->msg = NULL;
s->transparent = 0;
s->path = (char*)ALLOC(strlen(path)+1);
if (s->path == NULL) {
return destroy(s), (gzFile)Z_NULL;
}
strcpy(s->path, path); /* do this early for debugging */
s->mode = '\0';
do {
if (*p == 'r') s->mode = 'r';
if (*p == 'w' || *p == 'a') s->mode = 'w';
if (*p >= '0' && *p <= '9') {
level = *p - '0';
} else if (*p == 'f') {
strategy = Z_FILTERED;
} else if (*p == 'h') {
strategy = Z_HUFFMAN_ONLY;
} else {
*m++ = *p; /* copy the mode */
}
} while (*p++ && m != fmode + sizeof(fmode));
if (s->mode == '\0') return destroy(s), (gzFile)Z_NULL;
if (s->mode == 'w') {
#ifdef NO_DEFLATE
err = Z_STREAM_ERROR;
#else
err = deflateInit2(&(s->stream), level,
Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, strategy);
/* windowBits is passed < 0 to suppress zlib header */
s->stream.next_out = s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
#endif
if (err != Z_OK || s->outbuf == Z_NULL) {
return destroy(s), (gzFile)Z_NULL;
}
} else {
s->stream.next_in = s->inbuf = (Byte*)ALLOC(Z_BUFSIZE);
err = inflateInit2(&(s->stream), -MAX_WBITS);
/* windowBits is passed < 0 to tell that there is no zlib header.
* Note that in this case inflate *requires* an extra "dummy" byte
* after the compressed stream in order to complete decompression and
* return Z_STREAM_END. Here the gzip CRC32 ensures that 4 bytes are
* present after the compressed stream.
*/
if (err != Z_OK || s->inbuf == Z_NULL) {
return destroy(s), (gzFile)Z_NULL;
}
}
s->stream.avail_out = Z_BUFSIZE;
errno = 0;
s->file = fd < 0 ? F_OPEN(path, fmode) : (FILE*)fdopen(fd, fmode);
if (s->file == NULL) {
return destroy(s), (gzFile)Z_NULL;
}
if (s->mode == 'w') {
/* Write a very simple .gz header:
*/
fprintf(s->file, "%c%c%c%c%c%c%c%c%c%c", gz_magic[0], gz_magic[1],
Z_DEFLATED, 0 /*flags*/, 0,0,0,0 /*time*/, 0 /*xflags*/, OS_CODE);
s->startpos = 10L;
/* We use 10L instead of ftell(s->file) to because ftell causes an
* fflush on some systems. This version of the library doesn't use
* startpos anyway in write mode, so this initialization is not
* necessary.
*/
} else {
check_header(s); /* skip the .gz header */
s->startpos = (ftell(s->file) - s->stream.avail_in);
}
return (gzFile)s;
}
/* ===========================================================================
Opens a gzip (.gz) file for reading or writing.
*/
gzFile ZEXPORT gzopen (path, mode)
const char *path;
const char *mode;
{
return gz_open (path, mode, -1);
}
/* ===========================================================================
Associate a gzFile with the file descriptor fd. fd is not dup'ed here
to mimic the behavio(u)r of fdopen.
*/
gzFile ZEXPORT gzdopen (fd, mode)
int fd;
const char *mode;
{
char name[20];
if (fd < 0) return (gzFile)Z_NULL;
sprintf(name, "<fd:%d>", fd); /* for debugging */
return gz_open (name, mode, fd);
}
/* ===========================================================================
* Update the compression level and strategy
*/
int ZEXPORT gzsetparams (file, level, strategy)
gzFile file;
int level;
int strategy;
{
gz_stream *s = (gz_stream*)file;
if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
/* Make room to allow flushing */
if (s->stream.avail_out == 0) {
s->stream.next_out = s->outbuf;
if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
s->z_err = Z_ERRNO;
}
s->stream.avail_out = Z_BUFSIZE;
}
return deflateParams (&(s->stream), level, strategy);
}
/* ===========================================================================
Read a byte from a gz_stream; update next_in and avail_in. Return EOF
for end of file.
IN assertion: the stream s has been sucessfully opened for reading.
*/
local int get_byte(s)
gz_stream *s;
{
if (s->z_eof) return EOF;
if (s->stream.avail_in == 0) {
errno = 0;
s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file);
if (s->stream.avail_in == 0) {
s->z_eof = 1;
if (ferror(s->file)) s->z_err = Z_ERRNO;
return EOF;
}
s->stream.next_in = s->inbuf;
}
s->stream.avail_in--;
return *(s->stream.next_in)++;
}
/* ===========================================================================
Check the gzip header of a gz_stream opened for reading. Set the stream
mode to transparent if the gzip magic header is not present; set s->err
to Z_DATA_ERROR if the magic header is present but the rest of the header
is incorrect.
IN assertion: the stream s has already been created sucessfully;
s->stream.avail_in is zero for the first time, but may be non-zero
for concatenated .gz files.
*/
local void check_header(s)
gz_stream *s;
{
int method; /* method byte */
int flags; /* flags byte */
uInt len;
int c;
/* Check the gzip magic header */
for (len = 0; len < 2; len++) {
c = get_byte(s);
if (c != gz_magic[len]) {
if (len != 0) s->stream.avail_in++, s->stream.next_in--;
if (c != EOF) {
s->stream.avail_in++, s->stream.next_in--;
s->transparent = 1;
}
s->z_err = s->stream.avail_in != 0 ? Z_OK : Z_STREAM_END;
return;
}
}
method = get_byte(s);
flags = get_byte(s);
if (method != Z_DEFLATED || (flags & RESERVED) != 0) {
s->z_err = Z_DATA_ERROR;
return;
}
/* Discard time, xflags and OS code: */
for (len = 0; len < 6; len++) (void)get_byte(s);
if ((flags & EXTRA_FIELD) != 0) { /* skip the extra field */
len = (uInt)get_byte(s);
len += ((uInt)get_byte(s))<<8;
/* len is garbage if EOF but the loop below will quit anyway */
while (len-- != 0 && get_byte(s) != EOF) ;
}
if ((flags & ORIG_NAME) != 0) { /* skip the original file name */
while ((c = get_byte(s)) != 0 && c != EOF) ;
}
if ((flags & COMMENT) != 0) { /* skip the .gz file comment */
while ((c = get_byte(s)) != 0 && c != EOF) ;
}
if ((flags & HEAD_CRC) != 0) { /* skip the header crc */
for (len = 0; len < 2; len++) (void)get_byte(s);
}
s->z_err = s->z_eof ? Z_DATA_ERROR : Z_OK;
}
/* ===========================================================================
* Cleanup then free the given gz_stream. Return a zlib error code.
Try freeing in the reverse order of allocations.
*/
local int destroy (s)
gz_stream *s;
{
int err = Z_OK;
if (!s) return Z_STREAM_ERROR;
TRYFREE(s->msg);
if (s->stream.state != NULL) {
if (s->mode == 'w') {
#ifdef NO_DEFLATE
err = Z_STREAM_ERROR;
#else
err = deflateEnd(&(s->stream));
#endif
} else if (s->mode == 'r') {
err = inflateEnd(&(s->stream));
}
}
if (s->file != NULL && fclose(s->file)) {
#ifdef ESPIPE
if (errno != ESPIPE) /* fclose is broken for pipes in HP/UX */
#endif
err = Z_ERRNO;
}
if (s->z_err < 0) err = s->z_err;
TRYFREE(s->inbuf);
TRYFREE(s->outbuf);
TRYFREE(s->path);
TRYFREE(s);
return err;
}
/* ===========================================================================
Reads the given number of uncompressed bytes from the compressed file.
gzread returns the number of bytes actually read (0 for end of file).
*/
int ZEXPORT gzread (file, buf, len)
gzFile file;
voidp buf;
unsigned len;
{
gz_stream *s = (gz_stream*)file;
Bytef *start = (Bytef*)buf; /* starting point for crc computation */
Byte *next_out; /* == stream.next_out but not forced far (for MSDOS) */
if (s == NULL || s->mode != 'r') return Z_STREAM_ERROR;
if (s->z_err == Z_DATA_ERROR || s->z_err == Z_ERRNO) return -1;
if (s->z_err == Z_STREAM_END) return 0; /* EOF */
next_out = (Byte*)buf;
s->stream.next_out = (Bytef*)buf;
s->stream.avail_out = len;
while (s->stream.avail_out != 0) {
if (s->transparent) {
/* Copy first the lookahead bytes: */
uInt n = s->stream.avail_in;
if (n > s->stream.avail_out) n = s->stream.avail_out;
if (n > 0) {
zmemcpy(s->stream.next_out, s->stream.next_in, n);
next_out += n;
s->stream.next_out = next_out;
s->stream.next_in += n;
s->stream.avail_out -= n;
s->stream.avail_in -= n;
}
if (s->stream.avail_out > 0) {
s->stream.avail_out -= fread(next_out, 1, s->stream.avail_out,
s->file);
}
len -= s->stream.avail_out;
s->stream.total_in += (uLong)len;
s->stream.total_out += (uLong)len;
if (len == 0) s->z_eof = 1;
return (int)len;
}
if (s->stream.avail_in == 0 && !s->z_eof) {
errno = 0;
s->stream.avail_in = fread(s->inbuf, 1, Z_BUFSIZE, s->file);
if (s->stream.avail_in == 0) {
s->z_eof = 1;
if (ferror(s->file)) {
s->z_err = Z_ERRNO;
break;
}
}
s->stream.next_in = s->inbuf;
}
s->z_err = inflate(&(s->stream), Z_NO_FLUSH);
if (s->z_err == Z_STREAM_END) {
/* Check CRC and original size */
s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
start = s->stream.next_out;
if (getLong(s) != s->crc) {
s->z_err = Z_DATA_ERROR;
} else {
(void)getLong(s);
/* The uncompressed length returned by above getlong() may
* be different from s->stream.total_out) in case of
* concatenated .gz files. Check for such files:
*/
check_header(s);
if (s->z_err == Z_OK) {
uLong total_in = s->stream.total_in;
uLong total_out = s->stream.total_out;
inflateReset(&(s->stream));
s->stream.total_in = total_in;
s->stream.total_out = total_out;
s->crc = crc32(0L, Z_NULL, 0);
}
}
}
if (s->z_err != Z_OK || s->z_eof) break;
}
s->crc = crc32(s->crc, start, (uInt)(s->stream.next_out - start));
return (int)(len - s->stream.avail_out);
}
/* ===========================================================================
Reads one byte from the compressed file. gzgetc returns this byte
or -1 in case of end of file or error.
*/
int ZEXPORT gzgetc(file)
gzFile file;
{
unsigned char c;
return gzread(file, &c, 1) == 1 ? c : -1;
}
/* ===========================================================================
Reads bytes from the compressed file until len-1 characters are
read, or a newline character is read and transferred to buf, or an
end-of-file condition is encountered. The string is then terminated
with a null character.
gzgets returns buf, or Z_NULL in case of error.
The current implementation is not optimized at all.
*/
char * ZEXPORT gzgets(file, buf, len)
gzFile file;
char *buf;
int len;
{
char *b = buf;
if (buf == Z_NULL || len <= 0) return Z_NULL;
while (--len > 0 && gzread(file, buf, 1) == 1 && *buf++ != '\n') ;
*buf = '\0';
return b == buf && len > 0 ? Z_NULL : b;
}
#ifndef NO_DEFLATE
/* ===========================================================================
Writes the given number of uncompressed bytes into the compressed file.
gzwrite returns the number of bytes actually written (0 in case of error).
*/
int ZEXPORT gzwrite (file, buf, len)
gzFile file;
const voidp buf;
unsigned len;
{
gz_stream *s = (gz_stream*)file;
if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
s->stream.next_in = (Bytef*)buf;
s->stream.avail_in = len;
while (s->stream.avail_in != 0) {
if (s->stream.avail_out == 0) {
s->stream.next_out = s->outbuf;
if (fwrite(s->outbuf, 1, Z_BUFSIZE, s->file) != Z_BUFSIZE) {
s->z_err = Z_ERRNO;
break;
}
s->stream.avail_out = Z_BUFSIZE;
}
s->z_err = deflate(&(s->stream), Z_NO_FLUSH);
if (s->z_err != Z_OK) break;
}
s->crc = crc32(s->crc, (const Bytef *)buf, len);
return (int)(len - s->stream.avail_in);
}
/* ===========================================================================
Converts, formats, and writes the args to the compressed file under
control of the format string, as in fprintf. gzprintf returns the number of
uncompressed bytes actually written (0 in case of error).
*/
#ifdef STDC
#include <stdarg.h>
int ZEXPORTVA gzprintf (gzFile file, const char *format, /* args */ ...)
{
char buf[Z_PRINTF_BUFSIZE];
va_list va;
int len;
va_start(va, format);
#ifdef HAS_vsnprintf
(void)vsnprintf(buf, sizeof(buf), format, va);
#else
(void)vsprintf(buf, format, va);
#endif
va_end(va);
len = strlen(buf); /* some *sprintf don't return the nb of bytes written */
if (len <= 0) return 0;
return gzwrite(file, buf, (unsigned)len);
}
#else /* not ANSI C */
int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
gzFile file;
const char *format;
int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
{
char buf[Z_PRINTF_BUFSIZE];
int len;
#ifdef HAS_snprintf
snprintf(buf, sizeof(buf), format, a1, a2, a3, a4, a5, a6, a7, a8,
a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
#else
sprintf(buf, format, a1, a2, a3, a4, a5, a6, a7, a8,
a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
#endif
len = strlen(buf); /* old sprintf doesn't return the nb of bytes written */
if (len <= 0) return 0;
return gzwrite(file, buf, len);
}
#endif
/* ===========================================================================
Writes c, converted to an unsigned char, into the compressed file.
gzputc returns the value that was written, or -1 in case of error.
*/
int ZEXPORT gzputc(file, c)
gzFile file;
int c;
{
unsigned char cc = (unsigned char) c; /* required for big endian systems */
return gzwrite(file, &cc, 1) == 1 ? (int)cc : -1;
}
/* ===========================================================================
Writes the given null-terminated string to the compressed file, excluding
the terminating null character.
gzputs returns the number of characters written, or -1 in case of error.
*/
int ZEXPORT gzputs(file, s)
gzFile file;
const char *s;
{
return gzwrite(file, (char*)s, (unsigned)strlen(s));
}
/* ===========================================================================
Flushes all pending output into the compressed file. The parameter
flush is as in the deflate() function.
*/
local int do_flush (file, flush)
gzFile file;
int flush;
{
uInt len;
int done = 0;
gz_stream *s = (gz_stream*)file;
if (s == NULL || s->mode != 'w') return Z_STREAM_ERROR;
s->stream.avail_in = 0; /* should be zero already anyway */
for (;;) {
len = Z_BUFSIZE - s->stream.avail_out;
if (len != 0) {
if ((uInt)fwrite(s->outbuf, 1, len, s->file) != len) {
s->z_err = Z_ERRNO;
return Z_ERRNO;
}
s->stream.next_out = s->outbuf;
s->stream.avail_out = Z_BUFSIZE;
}
if (done) break;
s->z_err = deflate(&(s->stream), flush);
/* Ignore the second of two consecutive flushes: */
if (len == 0 && s->z_err == Z_BUF_ERROR) s->z_err = Z_OK;
/* deflate has finished flushing only when it hasn't used up
* all the available space in the output buffer:
*/
done = (s->stream.avail_out != 0 || s->z_err == Z_STREAM_END);
if (s->z_err != Z_OK && s->z_err != Z_STREAM_END) break;
}
return s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
}
int ZEXPORT gzflush (file, flush)
gzFile file;
int flush;
{
gz_stream *s = (gz_stream*)file;
int err = do_flush (file, flush);
if (err) return err;
fflush(s->file);
return s->z_err == Z_STREAM_END ? Z_OK : s->z_err;
}
#endif /* NO_DEFLATE */
/* ===========================================================================
Sets the starting position for the next gzread or gzwrite on the given
compressed file. The offset represents a number of bytes in the
gzseek returns the resulting offset location as measured in bytes from
the beginning of the uncompressed stream, or -1 in case of error.
SEEK_END is not implemented, returns error.
In this version of the library, gzseek can be extremely slow.
*/
z_off_t ZEXPORT gzseek (file, offset, whence)
gzFile file;
z_off_t offset;
int whence;
{
gz_stream *s = (gz_stream*)file;
if (s == NULL || whence == SEEK_END ||
s->z_err == Z_ERRNO || s->z_err == Z_DATA_ERROR) {
return -1L;
}
if (s->mode == 'w') {
#ifdef NO_DEFLATE
return -1L;
#else
if (whence == SEEK_SET) {
offset -= s->stream.total_in;
}
if (offset < 0) return -1L;
/* At this point, offset is the number of zero bytes to write. */
if (s->inbuf == Z_NULL) {
s->inbuf = (Byte*)ALLOC(Z_BUFSIZE); /* for seeking */
zmemzero(s->inbuf, Z_BUFSIZE);
}
while (offset > 0) {
uInt size = Z_BUFSIZE;
if (offset < Z_BUFSIZE) size = (uInt)offset;
size = gzwrite(file, s->inbuf, size);
if (size == 0) return -1L;
offset -= size;
}
return (z_off_t)s->stream.total_in;
#endif
}
/* Rest of function is for reading only */
/* compute absolute position */
if (whence == SEEK_CUR) {
offset += s->stream.total_out;
}
if (offset < 0) return -1L;
if (s->transparent) {
/* map to fseek */
s->stream.avail_in = 0;
s->stream.next_in = s->inbuf;
if (fseek(s->file, offset, SEEK_SET) < 0) return -1L;
s->stream.total_in = s->stream.total_out = (uLong)offset;
return offset;
}
/* For a negative seek, rewind and use positive seek */
if ((uLong)offset >= s->stream.total_out) {
offset -= s->stream.total_out;
} else if (gzrewind(file) < 0) {
return -1L;
}
/* offset is now the number of bytes to skip. */
if (offset != 0 && s->outbuf == Z_NULL) {
s->outbuf = (Byte*)ALLOC(Z_BUFSIZE);
}
while (offset > 0) {
int size = Z_BUFSIZE;
if (offset < Z_BUFSIZE) size = (int)offset;
size = gzread(file, s->outbuf, (uInt)size);
if (size <= 0) return -1L;
offset -= size;
}
return (z_off_t)s->stream.total_out;
}
/* ===========================================================================
Rewinds input file.
*/
int ZEXPORT gzrewind (file)
gzFile file;
{
gz_stream *s = (gz_stream*)file;
if (s == NULL || s->mode != 'r') return -1;
s->z_err = Z_OK;
s->z_eof = 0;
s->stream.avail_in = 0;
s->stream.next_in = s->inbuf;
s->crc = crc32(0L, Z_NULL, 0);
if (s->startpos == 0) { /* not a compressed file */
rewind(s->file);
return 0;
}
(void) inflateReset(&s->stream);
return fseek(s->file, s->startpos, SEEK_SET);
}
/* ===========================================================================
Returns the starting position for the next gzread or gzwrite on the
given compressed file. This position represents a number of bytes in the
uncompressed data stream.
*/
z_off_t ZEXPORT gztell (file)
gzFile file;
{
return gzseek(file, 0L, SEEK_CUR);
}
/* ===========================================================================
Returns 1 when EOF has previously been detected reading the given
input stream, otherwise zero.
*/
int ZEXPORT gzeof (file)
gzFile file;
{
gz_stream *s = (gz_stream*)file;
return (s == NULL || s->mode != 'r') ? 0 : s->z_eof;
}
/* ===========================================================================
Outputs a long in LSB order to the given file
*/
local void putLong (file, x)
FILE *file;
uLong x;
{
int n;
for (n = 0; n < 4; n++) {
fputc((int)(x & 0xff), file);
x >>= 8;
}
}
/* ===========================================================================
Reads a long in LSB order from the given gz_stream. Sets z_err in case
of error.
*/
local uLong getLong (s)
gz_stream *s;
{
uLong x = (uLong)get_byte(s);
int c;
x += ((uLong)get_byte(s))<<8;
x += ((uLong)get_byte(s))<<16;
c = get_byte(s);
if (c == EOF) s->z_err = Z_DATA_ERROR;
x += ((uLong)c)<<24;
return x;
}
/* ===========================================================================
Flushes all pending output if necessary, closes the compressed file
and deallocates all the (de)compression state.
*/
int ZEXPORT gzclose (file)
gzFile file;
{
int err;
gz_stream *s = (gz_stream*)file;
if (s == NULL) return Z_STREAM_ERROR;
if (s->mode == 'w') {
#ifdef NO_DEFLATE
return Z_STREAM_ERROR;
#else
err = do_flush (file, Z_FINISH);
if (err != Z_OK) return destroy((gz_stream*)file);
putLong (s->file, s->crc);
putLong (s->file, s->stream.total_in);
#endif
}
return destroy((gz_stream*)file);
}
/* ===========================================================================
Returns the error message for the last error which occured on the
given compressed file. errnum is set to zlib error number. If an
error occured in the file system and not in the compression library,
errnum is set to Z_ERRNO and the application may consult errno
to get the exact error code.
*/
const char* ZEXPORT gzerror (file, errnum)
gzFile file;
int *errnum;
{
char *m;
gz_stream *s = (gz_stream*)file;
if (s == NULL) {
*errnum = Z_STREAM_ERROR;
return (const char*)ERR_MSG(Z_STREAM_ERROR);
}
*errnum = s->z_err;
if (*errnum == Z_OK) return (const char*)"";
m = (char*)(*errnum == Z_ERRNO ? zstrerror(errno) : s->stream.msg);
if (m == NULL || *m == '\0') m = (char*)ERR_MSG(s->z_err);
TRYFREE(s->msg);
s->msg = (char*)ALLOC(strlen(s->path) + strlen(m) + 3);
strcpy(s->msg, s->path);
strcat(s->msg, ": ");
strcat(s->msg, m);
return (const char*)s->msg;
}
@@ -1,5 +1,5 @@
/* infblock.c -- interpret and process block types to last block
* Copyright (C) 1995-1998 Mark Adler
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -249,10 +249,12 @@ int r;
&s->sub.trees.tb, s->hufts, z);
if (t != Z_OK)
{
ZFREE(z, s->sub.trees.blens);
r = t;
if (r == Z_DATA_ERROR)
{
ZFREE(z, s->sub.trees.blens);
s->mode = BAD;
}
LEAVE
}
s->sub.trees.index = 0;
@@ -313,11 +315,13 @@ int r;
t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f),
s->sub.trees.blens, &bl, &bd, &tl, &td,
s->hufts, z);
ZFREE(z, s->sub.trees.blens);
if (t != Z_OK)
{
if (t == (uInt)Z_DATA_ERROR)
{
ZFREE(z, s->sub.trees.blens);
s->mode = BAD;
}
r = t;
LEAVE
}
@@ -329,6 +333,7 @@ int r;
}
s->sub.decode.codes = c;
}
ZFREE(z, s->sub.trees.blens);
s->mode = CODES;
case CODES:
UPDATE
@@ -1,5 +1,5 @@
/* infblock.h -- header to use infblock.c
* Copyright (C) 1995-1998 Mark Adler
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -1,5 +1,5 @@
/* infcodes.c -- process literals and length/distance pairs
* Copyright (C) 1995-1998 Mark Adler
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -196,15 +196,9 @@ int r;
Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist));
c->mode = COPY;
case COPY: /* o: copying bytes in window, waiting for space */
#ifndef __TURBOC__ /* Turbo C bug for following expression */
f = (uInt)(q - s->window) < c->sub.copy.dist ?
s->end - (c->sub.copy.dist - (q - s->window)) :
q - c->sub.copy.dist;
#else
f = q - c->sub.copy.dist;
if ((uInt)(q - s->window) < c->sub.copy.dist)
f = s->end - (c->sub.copy.dist - (uInt)(q - s->window));
#endif
while (f < s->window) /* modulo window size-"while" instead */
f += s->end - s->window; /* of "if" handles invalid distances */
while (c->len)
{
NEEDOUT
@@ -1,5 +1,5 @@
/* infcodes.h -- header to use infcodes.c
* Copyright (C) 1995-1998 Mark Adler
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -1,5 +1,5 @@
/* inffast.c -- process literals and length/distance pairs fast
* Copyright (C) 1995-1998 Mark Adler
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -93,28 +93,41 @@ z_streamp z;
/* do the copy */
m -= c;
if ((uInt)(q - s->window) >= d) /* offset before dest */
{ /* just copy */
r = q - d;
*q++ = *r++; c--; /* minimum count is three, */
*q++ = *r++; c--; /* so unroll loop a little */
}
else /* else offset after destination */
r = q - d;
if (r < s->window) /* wrap if needed */
{
e = d - (uInt)(q - s->window); /* bytes from offset to end */
r = s->end - e; /* pointer to offset */
if (c > e) /* if source crosses, */
do {
r += s->end - s->window; /* force pointer in window */
} while (r < s->window); /* covers invalid distances */
e = s->end - r;
if (c > e)
{
c -= e; /* copy to end of window */
c -= e; /* wrapped copy */
do {
*q++ = *r++;
*q++ = *r++;
} while (--e);
r = s->window; /* copy rest from start of window */
r = s->window;
do {
*q++ = *r++;
} while (--c);
}
else /* normal copy */
{
*q++ = *r++; c--;
*q++ = *r++; c--;
do {
*q++ = *r++;
} while (--c);
}
}
do { /* copy all or what's left */
*q++ = *r++;
} while (--c);
else /* normal copy */
{
*q++ = *r++; c--;
*q++ = *r++; c--;
do {
*q++ = *r++;
} while (--c);
}
break;
}
else if ((e & 64) == 0)
@@ -1,5 +1,5 @@
/* inffast.h -- header to use inffast.c
* Copyright (C) 1995-1998 Mark Adler
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -1,5 +1,5 @@
/* inflate.c -- zlib interface to inflate modules
* Copyright (C) 1995-1998 Mark Adler
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -1,5 +1,5 @@
/* inftrees.c -- generate Huffman trees for efficient decoding
* Copyright (C) 1995-1998 Mark Adler
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -11,7 +11,7 @@
#endif
const char inflate_copyright[] =
" inflate 1.1.3 Copyright 1995-1998 Mark Adler ";
" inflate 1.1.4 Copyright 1995-2002 Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
@@ -104,8 +104,7 @@ uIntf *v; /* working area: values in order of bit length */
/* Given a list of code lengths and a maximum table size, make a set of
tables to decode that set of codes. Return Z_OK on success, Z_BUF_ERROR
if the given code set is incomplete (the tables are still built in this
case), Z_DATA_ERROR if the input is invalid (an over-subscribed set of
lengths), or Z_MEM_ERROR if not enough memory. */
case), or Z_DATA_ERROR if the input is invalid. */
{
uInt a; /* counter for codes of length k */
@@ -231,7 +230,7 @@ uIntf *v; /* working area: values in order of bit length */
/* allocate new table */
if (*hn + z > MANY) /* (note: doesn't matter for fixed) */
return Z_MEM_ERROR; /* not enough memory */
return Z_DATA_ERROR; /* overflow of MANY */
u[h] = q = hp + *hn;
*hn += z;
@@ -1,5 +1,5 @@
/* inftrees.h -- header to use inftrees.c
* Copyright (C) 1995-1998 Mark Adler
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -1,5 +1,5 @@
/* inflate_util.c -- data and routines common to blocks and codes
* Copyright (C) 1995-1998 Mark Adler
* Copyright (C) 1995-2002 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/

Some files were not shown because too many files have changed in this diff Show More