Zip changes from 1.3.5

This commit is contained in:
Guenter Obiltschnig
2009-06-16 17:11:24 +00:00
parent c93c16008b
commit f2ca58ff73
85 changed files with 11985 additions and 11514 deletions

View File

@@ -1,20 +1,20 @@
# #
# Makefile # Makefile
# #
# $Id: //poco/1.3/Zip/Makefile#2 $ # $Id: //poco/Main/Zip/Makefile#6 $
# #
# Makefile for Poco Zip # Makefile for Poco Zip
# #
include $(POCO_BASE)/build/rules/global include $(POCO_BASE)/build/rules/global
objects = AutoDetectStream Compress Decompress ParseCallback PartialStream \ objects = AutoDetectStream Compress Decompress ParseCallback PartialStream \
SkipCallback ZipArchive ZipArchiveInfo ZipDataInfo \ SkipCallback ZipArchive ZipArchiveInfo ZipDataInfo \
ZipFileInfo ZipLocalFileHeader ZipStream ZipUtil ZipCommon ZipException \ ZipFileInfo ZipLocalFileHeader ZipStream ZipUtil ZipCommon ZipException \
Add Delete Keep Rename Replace ZipManipulator ZipOperation Add Delete Keep Rename Replace ZipManipulator ZipOperation
target = PocoZip target = PocoZip
target_version = $(LIBVERSION) target_version = $(LIBVERSION)
target_libs = PocoFoundation target_libs = PocoFoundation
include $(POCO_BASE)/build/rules/lib include $(POCO_BASE)/build/rules/lib

View File

@@ -1,16 +1,16 @@
# #
# Zip.vmsbuild # Zip.vmsbuild
# #
# $Id: //poco/1.3/Zip/Zip.vmsbuild#1 $ # $Id: //poco/Main/Zip/Zip.vmsbuild#3 $
# #
LIB=PocoZip LIB=PocoZip
Decompress Decompress
ParseCallback ParseCallback
PartialStream PartialStream
SkipCallback SkipCallback
ZipArchive ZipArchive
ZipArchiveInfo ZipArchiveInfo
ZipFileInfo ZipFileInfo
ZipLocalFileHeader ZipLocalFileHeader
ZipStream ZipStream
ZipUtil ZipUtil

View File

@@ -1,30 +1,40 @@
Microsoft Visual Studio Solution File, Format Version 8.00 Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Zip", "Zip_VS71.vcproj", "{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Zip", "Zip_VS71.vcproj", "{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_VS71.vcproj", "{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_VS71.vcproj", "{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61} = {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61} {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61} = {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}
EndProjectSection EndProjectSection
EndProject EndProject
Global Global
GlobalSection(SolutionConfiguration) = preSolution GlobalSection(SolutionConfiguration) = preSolution
debug_shared = debug_shared debug_shared = debug_shared
release_shared = release_shared release_shared = release_shared
EndGlobalSection debug_static = debug_static
GlobalSection(ProjectConfiguration) = postSolution release_static = release_static
{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.debug_shared.ActiveCfg = debug_shared|Win32 EndGlobalSection
{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.debug_shared.Build.0 = debug_shared|Win32 GlobalSection(ProjectConfiguration) = postSolution
{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.release_shared.ActiveCfg = release_shared|Win32 {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.debug_shared.ActiveCfg = debug_shared|Win32
{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.release_shared.Build.0 = release_shared|Win32 {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.debug_shared.Build.0 = debug_shared|Win32
{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.debug_shared.ActiveCfg = debug_shared|Win32 {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.release_shared.ActiveCfg = release_shared|Win32
{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.debug_shared.Build.0 = debug_shared|Win32 {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.release_shared.Build.0 = release_shared|Win32
{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.release_shared.ActiveCfg = release_shared|Win32 {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.debug_static.ActiveCfg = debug_static|Win32
{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.release_shared.Build.0 = release_shared|Win32 {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.debug_static.Build.0 = debug_static|Win32
EndGlobalSection {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.release_static.ActiveCfg = release_static|Win32
GlobalSection(ExtensibilityGlobals) = postSolution {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.release_static.Build.0 = release_static|Win32
EndGlobalSection {9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.debug_shared.ActiveCfg = debug_shared|Win32
GlobalSection(ExtensibilityAddIns) = postSolution {9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.debug_shared.Build.0 = debug_shared|Win32
EndGlobalSection {9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.release_shared.ActiveCfg = release_shared|Win32
EndGlobal {9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.release_shared.Build.0 = release_shared|Win32
{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.debug_static.ActiveCfg = debug_static|Win32
{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.debug_static.Build.0 = debug_static|Win32
{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.release_static.ActiveCfg = release_static|Win32
{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.release_static.Build.0 = release_static|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@@ -1,307 +1,410 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="7.10" Version="7.10"
Name="Zip" Name="Zip"
ProjectGUID="{4ac75ead-bfcf-41e6-ab1f-0da203cc7c61}" ProjectGUID="{4ac75ead-bfcf-41e6-ab1f-0da203cc7c61}"
RootNamespace="Zip" RootNamespace="Zip"
Keyword="Win32Proj"> Keyword="Win32Proj">
<Platforms> <Platforms>
<Platform <Platform
Name="Win32"/> Name="Win32"/>
</Platforms> </Platforms>
<Configurations> <Configurations>
<Configuration <Configuration
Name="debug_shared|Win32" Name="debug_shared|Win32"
OutputDirectory="obj\debug_shared" OutputDirectory="obj\debug_shared"
IntermediateDirectory="obj\debug_shared" IntermediateDirectory="obj\debug_shared"
ConfigurationType="2" ConfigurationType="2"
CharacterSet="2"> CharacterSet="2">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories=".\include;..\Foundation\include" AdditionalIncludeDirectories=".\include;..\Foundation\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;POCO_DLL;Zip_EXPORTS" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;POCO_DLL;Zip_EXPORTS"
StringPooling="TRUE" StringPooling="TRUE"
MinimalRebuild="TRUE" MinimalRebuild="TRUE"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
BufferSecurityCheck="TRUE" BufferSecurityCheck="TRUE"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE" ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE" RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="TRUE" Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4" DebugInformationFormat="4"
CompileAs="0"/> CompileAs="0"/>
<Tool <Tool
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="PocoFoundationd.lib" AdditionalDependencies="PocoFoundationd.lib"
OutputFile="..\bin\PocoZipd.dll" OutputFile="..\bin\PocoZipd.dll"
LinkIncremental="2" LinkIncremental="2"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\lib" AdditionalLibraryDirectories="..\lib"
GenerateDebugInformation="TRUE" GenerateDebugInformation="TRUE"
ProgramDatabaseFile="..\bin\PocoZipd.pdb" ProgramDatabaseFile="..\bin\PocoZipd.pdb"
SubSystem="1" SubSystem="1"
OptimizeForWindows98="1" OptimizeForWindows98="1"
ImportLibrary="..\lib\PocoZipd.lib" ImportLibrary="..\lib\PocoZipd.lib"
TargetMachine="1"/> TargetMachine="1"/>
<Tool <Tool
Name="VCMIDLTool"/> Name="VCMIDLTool"/>
<Tool <Tool
Name="VCPostBuildEventTool"/> Name="VCPostBuildEventTool"/>
<Tool <Tool
Name="VCPreBuildEventTool"/> Name="VCPreBuildEventTool"/>
<Tool <Tool
Name="VCPreLinkEventTool"/> Name="VCPreLinkEventTool"/>
<Tool <Tool
Name="VCResourceCompilerTool"/> Name="VCResourceCompilerTool"/>
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool"/> Name="VCWebServiceProxyGeneratorTool"/>
<Tool <Tool
Name="VCXMLDataGeneratorTool"/> Name="VCXMLDataGeneratorTool"/>
<Tool <Tool
Name="VCWebDeploymentTool"/> Name="VCWebDeploymentTool"/>
<Tool <Tool
Name="VCManagedWrapperGeneratorTool"/> Name="VCManagedWrapperGeneratorTool"/>
<Tool <Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/> Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration> </Configuration>
<Configuration <Configuration
Name="release_shared|Win32" Name="release_shared|Win32"
OutputDirectory="obj\release_shared" OutputDirectory="obj\release_shared"
IntermediateDirectory="obj\release_shared" IntermediateDirectory="obj\release_shared"
ConfigurationType="2" ConfigurationType="2"
CharacterSet="2"> CharacterSet="2">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="4" Optimization="4"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE" EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="TRUE" OmitFramePointers="TRUE"
OptimizeForProcessor="3" OptimizeForProcessor="3"
AdditionalIncludeDirectories=".\include;..\Foundation\include" AdditionalIncludeDirectories=".\include;..\Foundation\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;POCO_DLL;Zip_EXPORTS" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;POCO_DLL;Zip_EXPORTS"
GeneratePreprocessedFile="0" GeneratePreprocessedFile="0"
KeepComments="FALSE" KeepComments="FALSE"
StringPooling="TRUE" StringPooling="TRUE"
RuntimeLibrary="2" RuntimeLibrary="2"
BufferSecurityCheck="FALSE" BufferSecurityCheck="FALSE"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE" ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE" RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="TRUE" Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="0" DebugInformationFormat="0"
CompileAs="0"/> CompileAs="0"/>
<Tool <Tool
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="PocoFoundation.lib" AdditionalDependencies="PocoFoundation.lib"
OutputFile="..\bin\PocoZip.dll" OutputFile="..\bin\PocoZip.dll"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="TRUE" SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\lib" AdditionalLibraryDirectories="..\lib"
GenerateDebugInformation="FALSE" GenerateDebugInformation="FALSE"
ProgramDatabaseFile="" ProgramDatabaseFile=""
SubSystem="1" SubSystem="1"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"
OptimizeForWindows98="1" OptimizeForWindows98="1"
ImportLibrary="..\lib\PocoZip.lib" ImportLibrary="..\lib\PocoZip.lib"
TargetMachine="1"/> TargetMachine="1"/>
<Tool <Tool
Name="VCMIDLTool"/> Name="VCMIDLTool"/>
<Tool <Tool
Name="VCPostBuildEventTool"/> Name="VCPostBuildEventTool"/>
<Tool <Tool
Name="VCPreBuildEventTool"/> Name="VCPreBuildEventTool"/>
<Tool <Tool
Name="VCPreLinkEventTool"/> Name="VCPreLinkEventTool"/>
<Tool <Tool
Name="VCResourceCompilerTool"/> Name="VCResourceCompilerTool"/>
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool"/> Name="VCWebServiceProxyGeneratorTool"/>
<Tool <Tool
Name="VCXMLDataGeneratorTool"/> Name="VCXMLDataGeneratorTool"/>
<Tool <Tool
Name="VCWebDeploymentTool"/> Name="VCWebDeploymentTool"/>
<Tool <Tool
Name="VCManagedWrapperGeneratorTool"/> Name="VCManagedWrapperGeneratorTool"/>
<Tool <Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/> Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration> </Configuration>
</Configurations> <Configuration
<References> Name="debug_static|Win32"
</References> OutputDirectory="obj\debug_static"
<Files> IntermediateDirectory="obj\debug_static"
<Filter ConfigurationType="4"
Name="Zip" CharacterSet="2">
Filter=""> <Tool
<Filter Name="VCCLCompilerTool"
Name="Header Files" Optimization="0"
Filter=""> AdditionalIncludeDirectories=".\include;..\Foundation\include"
<File PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;Zip_EXPORTS;POCO_STATIC"
RelativePath=".\include\Poco\Zip\AutoDetectStream.h"> StringPooling="TRUE"
</File> MinimalRebuild="TRUE"
<File BasicRuntimeChecks="3"
RelativePath=".\include\Poco\Zip\Compress.h"> RuntimeLibrary="3"
</File> BufferSecurityCheck="TRUE"
<File TreatWChar_tAsBuiltInType="TRUE"
RelativePath=".\include\Poco\Zip\Decompress.h"> ForceConformanceInForLoopScope="TRUE"
</File> RuntimeTypeInfo="TRUE"
<File UsePrecompiledHeader="0"
RelativePath=".\include\Poco\Zip\ParseCallback.h"> WarningLevel="3"
</File> Detect64BitPortabilityProblems="TRUE"
<File DebugInformationFormat="4"
RelativePath=".\include\Poco\Zip\PartialStream.h"> CompileAs="0"/>
</File> <Tool
<File Name="VCCustomBuildTool"/>
RelativePath=".\include\Poco\Zip\SkipCallback.h"> <Tool
</File> Name="VCLibrarianTool"
<File AdditionalDependencies=""
RelativePath=".\include\Poco\Zip\Zip.h"> OutputFile="..\lib\PocoZipmtd.lib"/>
</File> <Tool
<File Name="VCMIDLTool"/>
RelativePath=".\include\Poco\Zip\ZipArchive.h"> <Tool
</File> Name="VCPostBuildEventTool"/>
<File <Tool
RelativePath=".\include\Poco\Zip\ZipArchiveInfo.h"> Name="VCPreBuildEventTool"/>
</File> <Tool
<File Name="VCPreLinkEventTool"/>
RelativePath=".\include\Poco\Zip\ZipCommon.h"> <Tool
</File> Name="VCResourceCompilerTool"/>
<File <Tool
RelativePath=".\include\Poco\Zip\ZipDataInfo.h"> Name="VCWebServiceProxyGeneratorTool"/>
</File> <Tool
<File Name="VCXMLDataGeneratorTool"/>
RelativePath=".\include\Poco\Zip\ZipException.h"> <Tool
</File> Name="VCManagedWrapperGeneratorTool"/>
<File <Tool
RelativePath=".\include\Poco\Zip\ZipFileInfo.h"> Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</File> </Configuration>
<File <Configuration
RelativePath=".\include\Poco\Zip\ZipLocalFileHeader.h"> Name="release_static|Win32"
</File> OutputDirectory="obj\release_static"
<File IntermediateDirectory="obj\release_static"
RelativePath=".\include\Poco\Zip\ZipStream.h"> ConfigurationType="4"
</File> CharacterSet="2">
<File <Tool
RelativePath=".\include\Poco\Zip\ZipUtil.h"> Name="VCCLCompilerTool"
</File> Optimization="4"
</Filter> InlineFunctionExpansion="1"
<Filter EnableIntrinsicFunctions="TRUE"
Name="Source Files" FavorSizeOrSpeed="1"
Filter=""> OmitFramePointers="TRUE"
<File OptimizeForProcessor="3"
RelativePath=".\src\AutoDetectStream.cpp"> AdditionalIncludeDirectories=".\include;..\Foundation\include"
</File> PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;Zip_EXPORTS;POCO_STATIC"
<File GeneratePreprocessedFile="0"
RelativePath=".\src\Compress.cpp"> KeepComments="FALSE"
</File> StringPooling="TRUE"
<File RuntimeLibrary="2"
RelativePath=".\src\Decompress.cpp"> BufferSecurityCheck="FALSE"
</File> TreatWChar_tAsBuiltInType="TRUE"
<File ForceConformanceInForLoopScope="TRUE"
RelativePath=".\src\ParseCallback.cpp"> RuntimeTypeInfo="TRUE"
</File> UsePrecompiledHeader="0"
<File WarningLevel="3"
RelativePath=".\src\PartialStream.cpp"> Detect64BitPortabilityProblems="TRUE"
</File> DebugInformationFormat="0"
<File CompileAs="0"/>
RelativePath=".\src\SkipCallback.cpp"> <Tool
</File> Name="VCCustomBuildTool"/>
<File <Tool
RelativePath=".\src\ZipArchive.cpp"> Name="VCLibrarianTool"
</File> AdditionalDependencies=""
<File OutputFile="..\lib\PocoZipmt.lib"/>
RelativePath=".\src\ZipArchiveInfo.cpp"> <Tool
</File> Name="VCMIDLTool"/>
<File <Tool
RelativePath=".\src\ZipCommon.cpp"> Name="VCPostBuildEventTool"/>
</File> <Tool
<File Name="VCPreBuildEventTool"/>
RelativePath=".\src\ZipDataInfo.cpp"> <Tool
</File> Name="VCPreLinkEventTool"/>
<File <Tool
RelativePath=".\src\ZipException.cpp"> Name="VCResourceCompilerTool"/>
</File> <Tool
<File Name="VCWebServiceProxyGeneratorTool"/>
RelativePath=".\src\ZipFileInfo.cpp"> <Tool
</File> Name="VCXMLDataGeneratorTool"/>
<File <Tool
RelativePath=".\src\ZipLocalFileHeader.cpp"> Name="VCManagedWrapperGeneratorTool"/>
</File> <Tool
<File Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
RelativePath=".\src\ZipStream.cpp"> </Configuration>
</File> </Configurations>
<File <References>
RelativePath=".\src\ZipUtil.cpp"> </References>
</File> <Files>
</Filter> <Filter
</Filter> Name="Zip"
<Filter Filter="">
Name="Manipulation" <Filter
Filter=""> Name="Header Files"
<Filter Filter="">
Name="Header Files" <File
Filter=""> RelativePath=".\include\Poco\Zip\AutoDetectStream.h">
<File </File>
RelativePath=".\include\Poco\Zip\Add.h"> <File
</File> RelativePath=".\include\Poco\Zip\Compress.h">
<File </File>
RelativePath=".\include\Poco\Zip\Delete.h"> <File
</File> RelativePath=".\include\Poco\Zip\Decompress.h">
<File </File>
RelativePath=".\include\Poco\Zip\Keep.h"> <File
</File> RelativePath=".\include\Poco\Zip\ParseCallback.h">
<File </File>
RelativePath=".\include\Poco\Zip\Rename.h"> <File
</File> RelativePath=".\include\Poco\Zip\PartialStream.h">
<File </File>
RelativePath=".\include\Poco\Zip\Replace.h"> <File
</File> RelativePath=".\include\Poco\Zip\SkipCallback.h">
<File </File>
RelativePath=".\include\Poco\Zip\ZipManipulator.h"> <File
</File> RelativePath=".\include\Poco\Zip\Zip.h">
<File </File>
RelativePath=".\include\Poco\Zip\ZipOperation.h"> <File
</File> RelativePath=".\include\Poco\Zip\ZipArchive.h">
</Filter> </File>
<Filter <File
Name="Source Files" RelativePath=".\include\Poco\Zip\ZipArchiveInfo.h">
Filter=""> </File>
<File <File
RelativePath=".\src\Add.cpp"> RelativePath=".\include\Poco\Zip\ZipCommon.h">
</File> </File>
<File <File
RelativePath=".\src\Delete.cpp"> RelativePath=".\include\Poco\Zip\ZipDataInfo.h">
</File> </File>
<File <File
RelativePath=".\src\Keep.cpp"> RelativePath=".\include\Poco\Zip\ZipException.h">
</File> </File>
<File <File
RelativePath=".\src\Rename.cpp"> RelativePath=".\include\Poco\Zip\ZipFileInfo.h">
</File> </File>
<File <File
RelativePath=".\src\Replace.cpp"> RelativePath=".\include\Poco\Zip\ZipLocalFileHeader.h">
</File> </File>
<File <File
RelativePath=".\src\ZipManipulator.cpp"> RelativePath=".\include\Poco\Zip\ZipStream.h">
</File> </File>
<File <File
RelativePath=".\src\ZipOperation.cpp"> RelativePath=".\include\Poco\Zip\ZipUtil.h">
</File> </File>
</Filter> </Filter>
</Filter> <Filter
</Files> Name="Source Files"
<Globals> Filter="">
</Globals> <File
</VisualStudioProject> RelativePath=".\src\AutoDetectStream.cpp">
</File>
<File
RelativePath=".\src\Compress.cpp">
</File>
<File
RelativePath=".\src\Decompress.cpp">
</File>
<File
RelativePath=".\src\ParseCallback.cpp">
</File>
<File
RelativePath=".\src\PartialStream.cpp">
</File>
<File
RelativePath=".\src\SkipCallback.cpp">
</File>
<File
RelativePath=".\src\ZipArchive.cpp">
</File>
<File
RelativePath=".\src\ZipArchiveInfo.cpp">
</File>
<File
RelativePath=".\src\ZipCommon.cpp">
</File>
<File
RelativePath=".\src\ZipDataInfo.cpp">
</File>
<File
RelativePath=".\src\ZipException.cpp">
</File>
<File
RelativePath=".\src\ZipFileInfo.cpp">
</File>
<File
RelativePath=".\src\ZipLocalFileHeader.cpp">
</File>
<File
RelativePath=".\src\ZipStream.cpp">
</File>
<File
RelativePath=".\src\ZipUtil.cpp">
</File>
</Filter>
</Filter>
<Filter
Name="Manipulation"
Filter="">
<Filter
Name="Header Files"
Filter="">
<File
RelativePath=".\include\Poco\Zip\Add.h">
</File>
<File
RelativePath=".\include\Poco\Zip\Delete.h">
</File>
<File
RelativePath=".\include\Poco\Zip\Keep.h">
</File>
<File
RelativePath=".\include\Poco\Zip\Rename.h">
</File>
<File
RelativePath=".\include\Poco\Zip\Replace.h">
</File>
<File
RelativePath=".\include\Poco\Zip\ZipManipulator.h">
</File>
<File
RelativePath=".\include\Poco\Zip\ZipOperation.h">
</File>
</Filter>
<Filter
Name="Source Files"
Filter="">
<File
RelativePath=".\src\Add.cpp">
</File>
<File
RelativePath=".\src\Delete.cpp">
</File>
<File
RelativePath=".\src\Keep.cpp">
</File>
<File
RelativePath=".\src\Rename.cpp">
</File>
<File
RelativePath=".\src\Replace.cpp">
</File>
<File
RelativePath=".\src\ZipManipulator.cpp">
</File>
<File
RelativePath=".\src\ZipOperation.cpp">
</File>
</Filter>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -1,28 +1,38 @@
Microsoft Visual Studio Solution File, Format Version 9.00 Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005 # Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Zip", "Zip_VS80.vcproj", "{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Zip", "Zip_VS80.vcproj", "{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_VS80.vcproj", "{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_VS80.vcproj", "{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61} = {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61} {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61} = {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}
EndProjectSection EndProjectSection
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
debug_shared|Win32 = debug_shared|Win32 debug_shared|Win32 = debug_shared|Win32
release_shared|Win32 = release_shared|Win32 release_shared|Win32 = release_shared|Win32
EndGlobalSection debug_static|Win32 = debug_static|Win32
GlobalSection(ProjectConfigurationPlatforms) = postSolution release_static|Win32 = release_static|Win32
{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 EndGlobalSection
{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.debug_shared|Win32.Build.0 = debug_shared|Win32 GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.release_shared|Win32.ActiveCfg = release_shared|Win32 {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.release_shared|Win32.Build.0 = release_shared|Win32 {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.debug_shared|Win32.Build.0 = debug_shared|Win32
{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.release_shared|Win32.ActiveCfg = release_shared|Win32
{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.debug_shared|Win32.Build.0 = debug_shared|Win32 {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.release_shared|Win32.Build.0 = release_shared|Win32
{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.release_shared|Win32.ActiveCfg = release_shared|Win32 {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.debug_static|Win32.ActiveCfg = debug_static|Win32
{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.release_shared|Win32.Build.0 = release_shared|Win32 {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.debug_static|Win32.Build.0 = debug_static|Win32
EndGlobalSection {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.release_static|Win32.ActiveCfg = release_static|Win32
GlobalSection(SolutionProperties) = preSolution {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.release_static|Win32.Build.0 = release_static|Win32
HideSolutionNode = FALSE {9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
EndGlobalSection {9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.debug_shared|Win32.Build.0 = debug_shared|Win32
EndGlobal {9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.release_shared|Win32.ActiveCfg = release_shared|Win32
{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.release_shared|Win32.Build.0 = release_shared|Win32
{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.debug_static|Win32.ActiveCfg = debug_static|Win32
{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.debug_static|Win32.Build.0 = debug_static|Win32
{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.release_static|Win32.ActiveCfg = release_static|Win32
{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.release_static|Win32.Build.0 = release_static|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -1,413 +1,561 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="8,00" Version="8,00"
Name="Zip" Name="Zip"
ProjectGUID="{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}" ProjectGUID="{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}"
RootNamespace="Zip" RootNamespace="Zip"
Keyword="Win32Proj" Keyword="Win32Proj"
> >
<Platforms> <Platforms>
<Platform <Platform
Name="Win32" Name="Win32"
/> />
</Platforms> </Platforms>
<ToolFiles> <ToolFiles>
</ToolFiles> </ToolFiles>
<Configurations> <Configurations>
<Configuration <Configuration
Name="debug_shared|Win32" Name="debug_shared|Win32"
OutputDirectory="obj\debug_shared" OutputDirectory="obj\debug_shared"
IntermediateDirectory="obj\debug_shared" IntermediateDirectory="obj\debug_shared"
ConfigurationType="2" ConfigurationType="2"
CharacterSet="2" CharacterSet="2"
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
/> />
<Tool <Tool
Name="VCXMLDataGeneratorTool" Name="VCXMLDataGeneratorTool"
/> />
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool" Name="VCWebServiceProxyGeneratorTool"
/> />
<Tool <Tool
Name="VCMIDLTool" Name="VCMIDLTool"
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories=".\include;..\Foundation\include" AdditionalIncludeDirectories=".\include;..\Foundation\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;POCO_DLL;Zip_EXPORTS" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;POCO_DLL;Zip_EXPORTS"
StringPooling="true" StringPooling="true"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
BufferSecurityCheck="true" BufferSecurityCheck="true"
TreatWChar_tAsBuiltInType="true" TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true" ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true" RuntimeTypeInfo="true"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="true" Detect64BitPortabilityProblems="true"
DebugInformationFormat="4" DebugInformationFormat="4"
CompileAs="0" CompileAs="0"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
/> />
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="PocoFoundationd.lib" AdditionalDependencies="PocoFoundationd.lib"
OutputFile="..\bin\PocoZipd.dll" OutputFile="..\bin\PocoZipd.dll"
LinkIncremental="2" LinkIncremental="2"
SuppressStartupBanner="true" SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\lib" AdditionalLibraryDirectories="..\lib"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="..\bin\PocoZipd.pdb" ProgramDatabaseFile="..\bin\PocoZipd.pdb"
SubSystem="1" SubSystem="1"
OptimizeForWindows98="1" OptimizeForWindows98="1"
ImportLibrary="..\lib\PocoZipd.lib" ImportLibrary="..\lib\PocoZipd.lib"
TargetMachine="1" TargetMachine="1"
/> />
<Tool <Tool
Name="VCALinkTool" Name="VCALinkTool"
/> />
<Tool <Tool
Name="VCManifestTool" Name="VCManifestTool"
/> />
<Tool <Tool
Name="VCXDCMakeTool" Name="VCXDCMakeTool"
/> />
<Tool <Tool
Name="VCBscMakeTool" Name="VCBscMakeTool"
/> />
<Tool <Tool
Name="VCFxCopTool" Name="VCFxCopTool"
/> />
<Tool <Tool
Name="VCAppVerifierTool" Name="VCAppVerifierTool"
/> />
<Tool <Tool
Name="VCWebDeploymentTool" Name="VCWebDeploymentTool"
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
/> />
</Configuration> </Configuration>
<Configuration <Configuration
Name="release_shared|Win32" Name="release_shared|Win32"
OutputDirectory="obj\release_shared" OutputDirectory="obj\release_shared"
IntermediateDirectory="obj\release_shared" IntermediateDirectory="obj\release_shared"
ConfigurationType="2" ConfigurationType="2"
CharacterSet="2" CharacterSet="2"
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
/> />
<Tool <Tool
Name="VCXMLDataGeneratorTool" Name="VCXMLDataGeneratorTool"
/> />
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool" Name="VCWebServiceProxyGeneratorTool"
/> />
<Tool <Tool
Name="VCMIDLTool" Name="VCMIDLTool"
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="4" Optimization="4"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="true" OmitFramePointers="true"
AdditionalIncludeDirectories=".\include;..\Foundation\include" AdditionalIncludeDirectories=".\include;..\Foundation\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;POCO_DLL;Zip_EXPORTS" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;POCO_DLL;Zip_EXPORTS"
GeneratePreprocessedFile="0" GeneratePreprocessedFile="0"
KeepComments="false" KeepComments="false"
StringPooling="true" StringPooling="true"
RuntimeLibrary="2" RuntimeLibrary="2"
BufferSecurityCheck="false" BufferSecurityCheck="false"
TreatWChar_tAsBuiltInType="true" TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true" ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true" RuntimeTypeInfo="true"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="true" Detect64BitPortabilityProblems="true"
DebugInformationFormat="0" DebugInformationFormat="0"
CompileAs="0" CompileAs="0"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
/> />
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="PocoFoundation.lib" AdditionalDependencies="PocoFoundation.lib"
OutputFile="..\bin\PocoZip.dll" OutputFile="..\bin\PocoZip.dll"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\lib" AdditionalLibraryDirectories="..\lib"
GenerateDebugInformation="false" GenerateDebugInformation="false"
ProgramDatabaseFile="" ProgramDatabaseFile=""
SubSystem="1" SubSystem="1"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"
OptimizeForWindows98="1" OptimizeForWindows98="1"
ImportLibrary="..\lib\PocoZip.lib" ImportLibrary="..\lib\PocoZip.lib"
TargetMachine="1" TargetMachine="1"
/> />
<Tool <Tool
Name="VCALinkTool" Name="VCALinkTool"
/> />
<Tool <Tool
Name="VCManifestTool" Name="VCManifestTool"
/> />
<Tool <Tool
Name="VCXDCMakeTool" Name="VCXDCMakeTool"
/> />
<Tool <Tool
Name="VCBscMakeTool" Name="VCBscMakeTool"
/> />
<Tool <Tool
Name="VCFxCopTool" Name="VCFxCopTool"
/> />
<Tool <Tool
Name="VCAppVerifierTool" Name="VCAppVerifierTool"
/> />
<Tool <Tool
Name="VCWebDeploymentTool" Name="VCWebDeploymentTool"
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
/> />
</Configuration> </Configuration>
</Configurations> <Configuration
<References> Name="release_static|Win32"
</References> OutputDirectory="obj\release_static"
<Files> IntermediateDirectory="obj\release_static"
<Filter ConfigurationType="4"
Name="Zip" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
> CharacterSet="2"
<Filter >
Name="Header Files" <Tool
> Name="VCPreBuildEventTool"
<File />
RelativePath=".\include\Poco\Zip\AutoDetectStream.h" <Tool
> Name="VCCustomBuildTool"
</File> />
<File <Tool
RelativePath=".\include\Poco\Zip\Compress.h" Name="VCXMLDataGeneratorTool"
> />
</File> <Tool
<File Name="VCWebServiceProxyGeneratorTool"
RelativePath=".\include\Poco\Zip\Decompress.h" />
> <Tool
</File> Name="VCMIDLTool"
<File />
RelativePath=".\include\Poco\Zip\ParseCallback.h" <Tool
> Name="VCCLCompilerTool"
</File> Optimization="4"
<File InlineFunctionExpansion="1"
RelativePath=".\include\Poco\Zip\PartialStream.h" EnableIntrinsicFunctions="true"
> FavorSizeOrSpeed="1"
</File> OmitFramePointers="true"
<File AdditionalIncludeDirectories=".\include;..\Foundation\include"
RelativePath=".\include\Poco\Zip\SkipCallback.h" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;Zip_EXPORTS;POCO_STATIC"
> GeneratePreprocessedFile="0"
</File> KeepComments="false"
<File StringPooling="true"
RelativePath=".\include\Poco\Zip\Zip.h" RuntimeLibrary="2"
> BufferSecurityCheck="false"
</File> TreatWChar_tAsBuiltInType="true"
<File ForceConformanceInForLoopScope="true"
RelativePath=".\include\Poco\Zip\ZipArchive.h" RuntimeTypeInfo="true"
> UsePrecompiledHeader="0"
</File> WarningLevel="3"
<File Detect64BitPortabilityProblems="true"
RelativePath=".\include\Poco\Zip\ZipArchiveInfo.h" DebugInformationFormat="0"
> CompileAs="0"
</File> />
<File <Tool
RelativePath=".\include\Poco\Zip\ZipCommon.h" Name="VCManagedResourceCompilerTool"
> />
</File> <Tool
<File Name="VCResourceCompilerTool"
RelativePath=".\include\Poco\Zip\ZipDataInfo.h" />
> <Tool
</File> Name="VCPreLinkEventTool"
<File />
RelativePath=".\include\Poco\Zip\ZipException.h" <Tool
> Name="VCLibrarianTool"
</File> AdditionalDependencies=""
<File OutputFile="..\lib\PocoZipmt.lib"
RelativePath=".\include\Poco\Zip\ZipFileInfo.h" />
> <Tool
</File> Name="VCALinkTool"
<File />
RelativePath=".\include\Poco\Zip\ZipLocalFileHeader.h" <Tool
> Name="VCXDCMakeTool"
</File> />
<File <Tool
RelativePath=".\include\Poco\Zip\ZipStream.h" Name="VCBscMakeTool"
> />
</File> <Tool
<File Name="VCFxCopTool"
RelativePath=".\include\Poco\Zip\ZipUtil.h" />
> <Tool
</File> Name="VCPostBuildEventTool"
</Filter> />
<Filter </Configuration>
Name="Source Files" <Configuration
> Name="debug_static|Win32"
<File OutputDirectory="obj\debug_static"
RelativePath=".\src\AutoDetectStream.cpp" IntermediateDirectory="obj\debug_static"
> ConfigurationType="4"
</File> InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
<File CharacterSet="2"
RelativePath=".\src\Compress.cpp" >
> <Tool
</File> Name="VCPreBuildEventTool"
<File />
RelativePath=".\src\Decompress.cpp" <Tool
> Name="VCCustomBuildTool"
</File> />
<File <Tool
RelativePath=".\src\ParseCallback.cpp" Name="VCXMLDataGeneratorTool"
> />
</File> <Tool
<File Name="VCWebServiceProxyGeneratorTool"
RelativePath=".\src\PartialStream.cpp" />
> <Tool
</File> Name="VCMIDLTool"
<File />
RelativePath=".\src\SkipCallback.cpp" <Tool
> Name="VCCLCompilerTool"
</File> Optimization="0"
<File AdditionalIncludeDirectories=".\include;..\Foundation\include"
RelativePath=".\src\ZipArchive.cpp" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;Zip_EXPORTS;POCO_STATIC"
> StringPooling="true"
</File> MinimalRebuild="true"
<File BasicRuntimeChecks="3"
RelativePath=".\src\ZipArchiveInfo.cpp" RuntimeLibrary="3"
> BufferSecurityCheck="true"
</File> TreatWChar_tAsBuiltInType="true"
<File ForceConformanceInForLoopScope="true"
RelativePath=".\src\ZipCommon.cpp" RuntimeTypeInfo="true"
> UsePrecompiledHeader="0"
</File> WarningLevel="3"
<File Detect64BitPortabilityProblems="true"
RelativePath=".\src\ZipDataInfo.cpp" DebugInformationFormat="4"
> CompileAs="0"
</File> />
<File <Tool
RelativePath=".\src\ZipException.cpp" Name="VCManagedResourceCompilerTool"
> />
</File> <Tool
<File Name="VCResourceCompilerTool"
RelativePath=".\src\ZipFileInfo.cpp" />
> <Tool
</File> Name="VCPreLinkEventTool"
<File />
RelativePath=".\src\ZipLocalFileHeader.cpp" <Tool
> Name="VCLibrarianTool"
</File> AdditionalDependencies=""
<File OutputFile="..\lib\PocoZipmtd.lib"
RelativePath=".\src\ZipStream.cpp" />
> <Tool
</File> Name="VCALinkTool"
<File />
RelativePath=".\src\ZipUtil.cpp" <Tool
> Name="VCXDCMakeTool"
</File> />
</Filter> <Tool
</Filter> Name="VCBscMakeTool"
<Filter />
Name="Manipulation" <Tool
> Name="VCFxCopTool"
<Filter />
Name="Header Files" <Tool
> Name="VCPostBuildEventTool"
<File />
RelativePath=".\include\Poco\Zip\Add.h" </Configuration>
> </Configurations>
</File> <References>
<File </References>
RelativePath=".\include\Poco\Zip\Delete.h" <Files>
> <Filter
</File> Name="Zip"
<File >
RelativePath=".\include\Poco\Zip\Keep.h" <Filter
> Name="Header Files"
</File> >
<File <File
RelativePath=".\include\Poco\Zip\Rename.h" RelativePath=".\include\Poco\Zip\AutoDetectStream.h"
> >
</File> </File>
<File <File
RelativePath=".\include\Poco\Zip\Replace.h" RelativePath=".\include\Poco\Zip\Compress.h"
> >
</File> </File>
<File <File
RelativePath=".\include\Poco\Zip\ZipManipulator.h" RelativePath=".\include\Poco\Zip\Decompress.h"
> >
</File> </File>
<File <File
RelativePath=".\include\Poco\Zip\ZipOperation.h" RelativePath=".\include\Poco\Zip\ParseCallback.h"
> >
</File> </File>
</Filter> <File
<Filter RelativePath=".\include\Poco\Zip\PartialStream.h"
Name="Source Files" >
> </File>
<File <File
RelativePath=".\src\Add.cpp" RelativePath=".\include\Poco\Zip\SkipCallback.h"
> >
</File> </File>
<File <File
RelativePath=".\src\Delete.cpp" RelativePath=".\include\Poco\Zip\Zip.h"
> >
</File> </File>
<File <File
RelativePath=".\src\Keep.cpp" RelativePath=".\include\Poco\Zip\ZipArchive.h"
> >
</File> </File>
<File <File
RelativePath=".\src\Rename.cpp" RelativePath=".\include\Poco\Zip\ZipArchiveInfo.h"
> >
</File> </File>
<File <File
RelativePath=".\src\Replace.cpp" RelativePath=".\include\Poco\Zip\ZipCommon.h"
> >
</File> </File>
<File <File
RelativePath=".\src\ZipManipulator.cpp" RelativePath=".\include\Poco\Zip\ZipDataInfo.h"
> >
</File> </File>
<File <File
RelativePath=".\src\ZipOperation.cpp" RelativePath=".\include\Poco\Zip\ZipException.h"
> >
</File> </File>
</Filter> <File
</Filter> RelativePath=".\include\Poco\Zip\ZipFileInfo.h"
</Files> >
<Globals> </File>
</Globals> <File
</VisualStudioProject> RelativePath=".\include\Poco\Zip\ZipLocalFileHeader.h"
>
</File>
<File
RelativePath=".\include\Poco\Zip\ZipStream.h"
>
</File>
<File
RelativePath=".\include\Poco\Zip\ZipUtil.h"
>
</File>
</Filter>
<Filter
Name="Source Files"
>
<File
RelativePath=".\src\AutoDetectStream.cpp"
>
</File>
<File
RelativePath=".\src\Compress.cpp"
>
</File>
<File
RelativePath=".\src\Decompress.cpp"
>
</File>
<File
RelativePath=".\src\ParseCallback.cpp"
>
</File>
<File
RelativePath=".\src\PartialStream.cpp"
>
</File>
<File
RelativePath=".\src\SkipCallback.cpp"
>
</File>
<File
RelativePath=".\src\ZipArchive.cpp"
>
</File>
<File
RelativePath=".\src\ZipArchiveInfo.cpp"
>
</File>
<File
RelativePath=".\src\ZipCommon.cpp"
>
</File>
<File
RelativePath=".\src\ZipDataInfo.cpp"
>
</File>
<File
RelativePath=".\src\ZipException.cpp"
>
</File>
<File
RelativePath=".\src\ZipFileInfo.cpp"
>
</File>
<File
RelativePath=".\src\ZipLocalFileHeader.cpp"
>
</File>
<File
RelativePath=".\src\ZipStream.cpp"
>
</File>
<File
RelativePath=".\src\ZipUtil.cpp"
>
</File>
</Filter>
</Filter>
<Filter
Name="Manipulation"
>
<Filter
Name="Header Files"
>
<File
RelativePath=".\include\Poco\Zip\Add.h"
>
</File>
<File
RelativePath=".\include\Poco\Zip\Delete.h"
>
</File>
<File
RelativePath=".\include\Poco\Zip\Keep.h"
>
</File>
<File
RelativePath=".\include\Poco\Zip\Rename.h"
>
</File>
<File
RelativePath=".\include\Poco\Zip\Replace.h"
>
</File>
<File
RelativePath=".\include\Poco\Zip\ZipManipulator.h"
>
</File>
<File
RelativePath=".\include\Poco\Zip\ZipOperation.h"
>
</File>
</Filter>
<Filter
Name="Source Files"
>
<File
RelativePath=".\src\Add.cpp"
>
</File>
<File
RelativePath=".\src\Delete.cpp"
>
</File>
<File
RelativePath=".\src\Keep.cpp"
>
</File>
<File
RelativePath=".\src\Rename.cpp"
>
</File>
<File
RelativePath=".\src\Replace.cpp"
>
</File>
<File
RelativePath=".\src\ZipManipulator.cpp"
>
</File>
<File
RelativePath=".\src\ZipOperation.cpp"
>
</File>
</Filter>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -1,28 +1,28 @@
Microsoft Visual Studio Solution File, Format Version 10.00 Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008 # Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Zip", "Zip_vs90.vcproj", "{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Zip", "Zip_VS90.vcproj", "{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_vs90.vcproj", "{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestSuite", "testsuite\TestSuite_VS90.vcproj", "{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61} = {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61} {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61} = {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}
EndProjectSection EndProjectSection
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
debug_shared|Win32 = debug_shared|Win32 debug_shared|Win32 = debug_shared|Win32
release_shared|Win32 = release_shared|Win32 release_shared|Win32 = release_shared|Win32
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.debug_shared|Win32.Build.0 = debug_shared|Win32 {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.debug_shared|Win32.Build.0 = debug_shared|Win32
{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.release_shared|Win32.ActiveCfg = release_shared|Win32 {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.release_shared|Win32.ActiveCfg = release_shared|Win32
{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.release_shared|Win32.Build.0 = release_shared|Win32 {4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}.release_shared|Win32.Build.0 = release_shared|Win32
{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 {9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.debug_shared|Win32.Build.0 = debug_shared|Win32 {9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.debug_shared|Win32.Build.0 = debug_shared|Win32
{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.release_shared|Win32.ActiveCfg = release_shared|Win32 {9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.release_shared|Win32.ActiveCfg = release_shared|Win32
{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.release_shared|Win32.Build.0 = release_shared|Win32 {9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}.release_shared|Win32.Build.0 = release_shared|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@@ -1,413 +1,412 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9.00" Version="9,00"
Name="Zip" Name="Zip"
ProjectGUID="{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}" ProjectGUID="{4AC75EAD-BFCF-41E6-AB1F-0DA203CC7C61}"
RootNamespace="Zip" RootNamespace="Zip"
Keyword="Win32Proj" Keyword="Win32Proj"
> TargetFrameworkVersion="131072"
<Platforms> >
<Platform <Platforms>
Name="Win32" <Platform
/> Name="Win32"
</Platforms> />
<ToolFiles> </Platforms>
</ToolFiles> <ToolFiles>
<Configurations> </ToolFiles>
<Configuration <Configurations>
Name="debug_shared|Win32" <Configuration
OutputDirectory="obj\debug_shared" Name="debug_shared|Win32"
IntermediateDirectory="obj\debug_shared" OutputDirectory="obj\debug_shared"
ConfigurationType="2" IntermediateDirectory="obj\debug_shared"
CharacterSet="2" ConfigurationType="2"
> CharacterSet="2"
<Tool >
Name="VCPreBuildEventTool" <Tool
/> Name="VCPreBuildEventTool"
<Tool />
Name="VCCustomBuildTool" <Tool
/> Name="VCCustomBuildTool"
<Tool />
Name="VCXMLDataGeneratorTool" <Tool
/> Name="VCXMLDataGeneratorTool"
<Tool />
Name="VCWebServiceProxyGeneratorTool" <Tool
/> Name="VCWebServiceProxyGeneratorTool"
<Tool />
Name="VCMIDLTool" <Tool
/> Name="VCMIDLTool"
<Tool />
Name="VCCLCompilerTool" <Tool
Optimization="0" Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".\include;..\Foundation\include" Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;POCO_DLL;Zip_EXPORTS" AdditionalIncludeDirectories=".\include;..\Foundation\include"
StringPooling="true" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;POCO_DLL;Zip_EXPORTS"
MinimalRebuild="true" StringPooling="true"
BasicRuntimeChecks="3" MinimalRebuild="true"
RuntimeLibrary="3" BasicRuntimeChecks="3"
BufferSecurityCheck="true" RuntimeLibrary="3"
TreatWChar_tAsBuiltInType="true" BufferSecurityCheck="true"
ForceConformanceInForLoopScope="true" TreatWChar_tAsBuiltInType="true"
RuntimeTypeInfo="true" ForceConformanceInForLoopScope="true"
UsePrecompiledHeader="0" RuntimeTypeInfo="true"
WarningLevel="3" UsePrecompiledHeader="0"
Detect64BitPortabilityProblems="false" WarningLevel="3"
DebugInformationFormat="4" Detect64BitPortabilityProblems="false"
CompileAs="0" DebugInformationFormat="4"
/> CompileAs="0"
<Tool />
Name="VCManagedResourceCompilerTool" <Tool
/> Name="VCManagedResourceCompilerTool"
<Tool />
Name="VCResourceCompilerTool" <Tool
/> Name="VCResourceCompilerTool"
<Tool />
Name="VCPreLinkEventTool" <Tool
/> Name="VCPreLinkEventTool"
<Tool />
Name="VCLinkerTool" <Tool
AdditionalDependencies="PocoFoundationd.lib" Name="VCLinkerTool"
OutputFile="..\bin\PocoZipd.dll" AdditionalDependencies="PocoFoundationd.lib"
LinkIncremental="2" OutputFile="..\bin\PocoZipd.dll"
SuppressStartupBanner="true" LinkIncremental="2"
AdditionalLibraryDirectories="..\lib" SuppressStartupBanner="true"
GenerateDebugInformation="true" AdditionalLibraryDirectories="..\lib"
ProgramDatabaseFile="..\bin\PocoZipd.pdb" GenerateDebugInformation="true"
SubSystem="1" ProgramDatabaseFile="..\bin\PocoZipd.pdb"
OptimizeForWindows98="0" SubSystem="1"
ImportLibrary="..\lib\PocoZipd.lib" OptimizeForWindows98="0"
TargetMachine="1" RandomizedBaseAddress="1"
/> DataExecutionPrevention="0"
<Tool ImportLibrary="..\lib\PocoZipd.lib"
Name="VCALinkTool" TargetMachine="1"
/> />
<Tool <Tool
Name="VCManifestTool" Name="VCALinkTool"
/> />
<Tool <Tool
Name="VCXDCMakeTool" Name="VCManifestTool"
/> />
<Tool <Tool
Name="VCBscMakeTool" Name="VCXDCMakeTool"
/> />
<Tool <Tool
Name="VCFxCopTool" Name="VCBscMakeTool"
/> />
<Tool <Tool
Name="VCAppVerifierTool" Name="VCFxCopTool"
/> />
<Tool <Tool
Name="VCWebDeploymentTool" Name="VCAppVerifierTool"
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
/> />
</Configuration> </Configuration>
<Configuration <Configuration
Name="release_shared|Win32" Name="release_shared|Win32"
OutputDirectory="obj\release_shared" OutputDirectory="obj\release_shared"
IntermediateDirectory="obj\release_shared" IntermediateDirectory="obj\release_shared"
ConfigurationType="2" ConfigurationType="2"
CharacterSet="2" CharacterSet="2"
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
/> />
<Tool <Tool
Name="VCXMLDataGeneratorTool" Name="VCXMLDataGeneratorTool"
/> />
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool" Name="VCWebServiceProxyGeneratorTool"
/> />
<Tool <Tool
Name="VCMIDLTool" Name="VCMIDLTool"
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="4" Optimization="4"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="true" OmitFramePointers="true"
AdditionalIncludeDirectories=".\include;..\Foundation\include" AdditionalIncludeDirectories=".\include;..\Foundation\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;POCO_DLL;Zip_EXPORTS" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;POCO_DLL;Zip_EXPORTS"
GeneratePreprocessedFile="0" GeneratePreprocessedFile="0"
KeepComments="false" KeepComments="false"
StringPooling="true" StringPooling="true"
RuntimeLibrary="2" RuntimeLibrary="2"
BufferSecurityCheck="false" BufferSecurityCheck="false"
TreatWChar_tAsBuiltInType="true" TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true" ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true" RuntimeTypeInfo="true"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="false" Detect64BitPortabilityProblems="false"
DebugInformationFormat="0" DebugInformationFormat="0"
CompileAs="0" CompileAs="0"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
/> />
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="PocoFoundation.lib" AdditionalDependencies="PocoFoundation.lib"
OutputFile="..\bin\PocoZip.dll" OutputFile="..\bin\PocoZip.dll"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
AdditionalLibraryDirectories="..\lib" AdditionalLibraryDirectories="..\lib"
GenerateDebugInformation="false" GenerateDebugInformation="false"
ProgramDatabaseFile="" ProgramDatabaseFile=""
SubSystem="1" SubSystem="1"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"
OptimizeForWindows98="0" OptimizeForWindows98="0"
ImportLibrary="..\lib\PocoZip.lib" RandomizedBaseAddress="1"
TargetMachine="1" DataExecutionPrevention="0"
/> ImportLibrary="..\lib\PocoZip.lib"
<Tool TargetMachine="1"
Name="VCALinkTool" />
/> <Tool
<Tool Name="VCALinkTool"
Name="VCManifestTool" />
/> <Tool
<Tool Name="VCManifestTool"
Name="VCXDCMakeTool" />
/> <Tool
<Tool Name="VCXDCMakeTool"
Name="VCBscMakeTool" />
/> <Tool
<Tool Name="VCBscMakeTool"
Name="VCFxCopTool" />
/> <Tool
<Tool Name="VCFxCopTool"
Name="VCAppVerifierTool" />
/> <Tool
<Tool Name="VCAppVerifierTool"
Name="VCWebDeploymentTool" />
/> <Tool
<Tool Name="VCPostBuildEventTool"
Name="VCPostBuildEventTool" />
/> </Configuration>
</Configuration> </Configurations>
</Configurations> <References>
<References> </References>
</References> <Files>
<Files> <Filter
<Filter Name="Zip"
Name="Zip" >
> <Filter
<Filter Name="Header Files"
Name="Header Files" >
> <File
<File RelativePath=".\include\Poco\Zip\AutoDetectStream.h"
RelativePath=".\include\Poco\Zip\AutoDetectStream.h" >
> </File>
</File> <File
<File RelativePath=".\include\Poco\Zip\Compress.h"
RelativePath=".\include\Poco\Zip\Compress.h" >
> </File>
</File> <File
<File RelativePath=".\include\Poco\Zip\Decompress.h"
RelativePath=".\include\Poco\Zip\Decompress.h" >
> </File>
</File> <File
<File RelativePath=".\include\Poco\Zip\ParseCallback.h"
RelativePath=".\include\Poco\Zip\ParseCallback.h" >
> </File>
</File> <File
<File RelativePath=".\include\Poco\Zip\PartialStream.h"
RelativePath=".\include\Poco\Zip\PartialStream.h" >
> </File>
</File> <File
<File RelativePath=".\include\Poco\Zip\SkipCallback.h"
RelativePath=".\include\Poco\Zip\SkipCallback.h" >
> </File>
</File> <File
<File RelativePath=".\include\Poco\Zip\Zip.h"
RelativePath=".\include\Poco\Zip\Zip.h" >
> </File>
</File> <File
<File RelativePath=".\include\Poco\Zip\ZipArchive.h"
RelativePath=".\include\Poco\Zip\ZipArchive.h" >
> </File>
</File> <File
<File RelativePath=".\include\Poco\Zip\ZipArchiveInfo.h"
RelativePath=".\include\Poco\Zip\ZipArchiveInfo.h" >
> </File>
</File> <File
<File RelativePath=".\include\Poco\Zip\ZipCommon.h"
RelativePath=".\include\Poco\Zip\ZipCommon.h" >
> </File>
</File> <File
<File RelativePath=".\include\Poco\Zip\ZipDataInfo.h"
RelativePath=".\include\Poco\Zip\ZipDataInfo.h" >
> </File>
</File> <File
<File RelativePath=".\include\Poco\Zip\ZipException.h"
RelativePath=".\include\Poco\Zip\ZipException.h" >
> </File>
</File> <File
<File RelativePath=".\include\Poco\Zip\ZipFileInfo.h"
RelativePath=".\include\Poco\Zip\ZipFileInfo.h" >
> </File>
</File> <File
<File RelativePath=".\include\Poco\Zip\ZipLocalFileHeader.h"
RelativePath=".\include\Poco\Zip\ZipLocalFileHeader.h" >
> </File>
</File> <File
<File RelativePath=".\include\Poco\Zip\ZipStream.h"
RelativePath=".\include\Poco\Zip\ZipStream.h" >
> </File>
</File> <File
<File RelativePath=".\include\Poco\Zip\ZipUtil.h"
RelativePath=".\include\Poco\Zip\ZipUtil.h" >
> </File>
</File> </Filter>
</Filter> <Filter
<Filter Name="Source Files"
Name="Source Files" >
> <File
<File RelativePath=".\src\AutoDetectStream.cpp"
RelativePath=".\src\AutoDetectStream.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\Compress.cpp"
RelativePath=".\src\Compress.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\Decompress.cpp"
RelativePath=".\src\Decompress.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\ParseCallback.cpp"
RelativePath=".\src\ParseCallback.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\PartialStream.cpp"
RelativePath=".\src\PartialStream.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\SkipCallback.cpp"
RelativePath=".\src\SkipCallback.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\ZipArchive.cpp"
RelativePath=".\src\ZipArchive.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\ZipArchiveInfo.cpp"
RelativePath=".\src\ZipArchiveInfo.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\ZipCommon.cpp"
RelativePath=".\src\ZipCommon.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\ZipDataInfo.cpp"
RelativePath=".\src\ZipDataInfo.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\ZipException.cpp"
RelativePath=".\src\ZipException.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\ZipFileInfo.cpp"
RelativePath=".\src\ZipFileInfo.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\ZipLocalFileHeader.cpp"
RelativePath=".\src\ZipLocalFileHeader.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\ZipStream.cpp"
RelativePath=".\src\ZipStream.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\ZipUtil.cpp"
RelativePath=".\src\ZipUtil.cpp" >
> </File>
</File> </Filter>
</Filter> </Filter>
</Filter> <Filter
<Filter Name="Manipulation"
Name="Manipulation" >
> <Filter
<Filter Name="Header Files"
Name="Header Files" >
> <File
<File RelativePath=".\include\Poco\Zip\Add.h"
RelativePath=".\include\Poco\Zip\Add.h" >
> </File>
</File> <File
<File RelativePath=".\include\Poco\Zip\Delete.h"
RelativePath=".\include\Poco\Zip\Delete.h" >
> </File>
</File> <File
<File RelativePath=".\include\Poco\Zip\Keep.h"
RelativePath=".\include\Poco\Zip\Keep.h" >
> </File>
</File> <File
<File RelativePath=".\include\Poco\Zip\Rename.h"
RelativePath=".\include\Poco\Zip\Rename.h" >
> </File>
</File> <File
<File RelativePath=".\include\Poco\Zip\Replace.h"
RelativePath=".\include\Poco\Zip\Replace.h" >
> </File>
</File> <File
<File RelativePath=".\include\Poco\Zip\ZipManipulator.h"
RelativePath=".\include\Poco\Zip\ZipManipulator.h" >
> </File>
</File> <File
<File RelativePath=".\include\Poco\Zip\ZipOperation.h"
RelativePath=".\include\Poco\Zip\ZipOperation.h" >
> </File>
</File> </Filter>
</Filter> <Filter
<Filter Name="Source Files"
Name="Source Files" >
> <File
<File RelativePath=".\src\Add.cpp"
RelativePath=".\src\Add.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\Delete.cpp"
RelativePath=".\src\Delete.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\Keep.cpp"
RelativePath=".\src\Keep.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\Rename.cpp"
RelativePath=".\src\Rename.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\Replace.cpp"
RelativePath=".\src\Replace.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\ZipManipulator.cpp"
RelativePath=".\src\ZipManipulator.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\ZipOperation.cpp"
RelativePath=".\src\ZipOperation.cpp" >
> </File>
</File> </Filter>
</Filter> </Filter>
</Filter> </Files>
</Files> <Globals>
<Globals> </Globals>
</Globals> </VisualStudioProject>
</VisualStudioProject>

View File

@@ -1,4 +1,4 @@
Foundation Foundation
Net Net
Util Util
XML XML

File diff suppressed because it is too large Load Diff

View File

@@ -1,161 +1,161 @@
POCO Zip User Guide POCO Zip User Guide
Zip Zip
!!!Introduction !!!Introduction
POCO Zip adds support for parsing and creating Zip files. It offers the following features: POCO Zip adds support for parsing and creating Zip files. It offers the following features:
* decompress from local files * decompress from local files
* decompress from network files while they are downloaded * decompress from network files while they are downloaded
* compress to local files * compress to local files
* compress directly to a network destination * compress directly to a network destination
!!Restrictions !!Restrictions
* POCO Zip does not support the DEFLATE64 algorithm. * POCO Zip does not support the DEFLATE64 algorithm.
* encrypted files are not supported * encrypted files are not supported
!!!Main Classes !!!Main Classes
Most users will work with two common classes: <*Compress*> and <*Decompress*> Most users will work with two common classes: <*Compress*> and <*Decompress*>
!!Compress !!Compress
Compress is a helper class that simplifies creation of Zip files. Compress is a helper class that simplifies creation of Zip files.
Creating a Zip file is a basically a three-step process: Creating a Zip file is a basically a three-step process:
* Create the Compress object: Specify the output stream and define if it is seekable (set to true for local files, to false for network files) * Create the Compress object: Specify the output stream and define if it is seekable (set to true for local files, to false for network files)
Compress(std::ostream& out, bool seekableOut); Compress(std::ostream& out, bool seekableOut);
---- ----
* Add entries: either add single files or directory entries * Add entries: either add single files or directory entries
void addFile(std::istream& input, void addFile(std::istream& input,
const Poco::DateTime& lastModifiedAt, const Poco::DateTime& lastModifiedAt,
const Poco::Path& fileName, const Poco::Path& fileName,
ZipCommon::CompressionMethod cm = ZipCommon::CM_DEFLATE, ZipCommon::CompressionMethod cm = ZipCommon::CM_DEFLATE,
ZipCommon::CompressionLevel cl = ZipCommon::CL_MAXIMUM); ZipCommon::CompressionLevel cl = ZipCommon::CL_MAXIMUM);
/// Adds a single file to the Zip File. fileName must not be a directory name. /// Adds a single file to the Zip File. fileName must not be a directory name.
void addFile(const Poco::Path& file, void addFile(const Poco::Path& file,
const Poco::Path& fileName, const Poco::Path& fileName,
ZipCommon::CompressionMethod cm = ZipCommon::CM_DEFLATE, ZipCommon::CompressionMethod cm = ZipCommon::CM_DEFLATE,
ZipCommon::CompressionLevel cl = ZipCommon::CL_MAXIMUM); ZipCommon::CompressionLevel cl = ZipCommon::CL_MAXIMUM);
/// Adds a single file to the Zip File. fileName must not be a directory name. The file must exist physically! /// Adds a single file to the Zip File. fileName must not be a directory name. The file must exist physically!
void addDirectory(const Poco::Path& entryName, const Poco::DateTime& lastModifiedAt); void addDirectory(const Poco::Path& entryName, const Poco::DateTime& lastModifiedAt);
/// Adds a directory entry excluding all children to the Zip file, entryName must not be empty. /// Adds a directory entry excluding all children to the Zip file, entryName must not be empty.
void addRecursive(const Poco::Path& entry, void addRecursive(const Poco::Path& entry,
ZipCommon::CompressionLevel cl = ZipCommon::CL_MAXIMUM, ZipCommon::CompressionLevel cl = ZipCommon::CL_MAXIMUM,
bool excludeRoot = true, bool excludeRoot = true,
const Poco::Path& name = Poco::Path()); const Poco::Path& name = Poco::Path());
/// Adds a directory entry recursively to the zip file, set excludeRoot to false to exclude the parent directory. /// Adds a directory entry recursively to the zip file, set excludeRoot to false to exclude the parent directory.
/// The name specifies under which path the entries are added in the Zip file. /// The name specifies under which path the entries are added in the Zip file.
---- ----
Note that one must always define a name when adding a file entry, otherwise the compresser can not decide if the file should be added with an absolute or a relative path. Note that one must always define a name when adding a file entry, otherwise the compresser can not decide if the file should be added with an absolute or a relative path.
Assume you are adding the file <*c:\\data\\hello.txt*> twice to a Zip: Assume you are adding the file <*c:\\data\\hello.txt*> twice to a Zip:
// MUST use binary! // MUST use binary!
std::ofstream out("test.zip", std::ios::binary); std::ofstream out("test.zip", std::ios::binary);
Compress c(out, true); Compress c(out, true);
Poco::Path aFile("c:\\data\\hello.txt"); Poco::Path aFile("c:\\data\\hello.txt");
c.addFile(theFile, "hello.txt"); c.addFile(theFile, "hello.txt");
c.addFile(theFile, theFile); c.addFile(theFile, theFile);
c.close(); // MUST be done to finalize the Zip file c.close(); // MUST be done to finalize the Zip file
---- ----
A Zip file stores entries internally in UNIX path style. The Zip file created above will contain the following entries: A Zip file stores entries internally in UNIX path style. The Zip file created above will contain the following entries:
hello.txt hello.txt
data/ data/
data/hello.txt data/hello.txt
---- ----
The directory entry <*data/*> was automatically added. The directory entry <*data/*> was automatically added.
When adding directories recursively, the same principle applies. You specify the root directory that should be added and an optional path name where entries are added in the Zip file. When adding directories recursively, the same principle applies. You specify the root directory that should be added and an optional path name where entries are added in the Zip file.
Assume you have the following directory structure: Assume you have the following directory structure:
data/ data/
run1/ run1/
result1.txt result1.txt
run2/ run2/
result2.txt result2.txt
---- ----
The following call will add all subdirectories and all files of data to the Zip but not the root entry <*data*>: The following call will add all subdirectories and all files of data to the Zip but not the root entry <*data*>:
Poco::Path data("data"); Poco::Path data("data");
data.makeDirectory(); data.makeDirectory();
c.addRecursive(data); c.addRecursive(data);
---- ----
Or if you want the files to be added under the directory name <*20070401*> (you basically <*rename*> data to 20070401): Or if you want the files to be added under the directory name <*20070401*> (you basically <*rename*> data to 20070401):
Poco::Path data("data"); Poco::Path data("data");
Poco::Path name("20070401); Poco::Path name("20070401);
data.makeDirectory(); data.makeDirectory();
name.makeDirectory(); name.makeDirectory();
c.addRecursive(data, ZipCommon::CL_NORMAL, false, name); c.addRecursive(data, ZipCommon::CL_NORMAL, false, name);
---- ----
Note that <*makeDirectory*> does not create a directory, it simply assures that the Path is treated as a directory not as a file. Note that <*makeDirectory*> does not create a directory, it simply assures that the Path is treated as a directory not as a file.
Also using NORMAL compression instead of MAXIMUM (which is the default) has the benefit of improved performance. Also using NORMAL compression instead of MAXIMUM (which is the default) has the benefit of improved performance.
To get notified about the entries that are added during <*addRecursive*> register to the <!EDone!> event of the Compress object: To get notified about the entries that are added during <*addRecursive*> register to the <!EDone!> event of the Compress object:
Poco::FIFOEvent<const ZipLocalFileHeader> EDone; Poco::FIFOEvent<const ZipLocalFileHeader> EDone;
---- ----
* Closing the Zip file: It is mandatory to manually close Compress objects. This guarantees that the Zip directory is written, thus creating a valid Zip file. It is safe to call <*close*> multiple times, only the first call takes effect. * Closing the Zip file: It is mandatory to manually close Compress objects. This guarantees that the Zip directory is written, thus creating a valid Zip file. It is safe to call <*close*> multiple times, only the first call takes effect.
ZipArchive close(); ZipArchive close();
---- ----
<*close*> returns a ZipArchive which describes all entries inside a Zip file. <*close*> returns a ZipArchive which describes all entries inside a Zip file.
!!Decompress !!Decompress
Decompress can be used to decompress all files from a Zip file or to decompress single files only. Decompress can be used to decompress all files from a Zip file or to decompress single files only.
!Decompress All !Decompress All
The following sample code shows how all entries can be extracted from a Zip file: The following sample code shows how all entries can be extracted from a Zip file:
std::ifstream inp("test.zip", std::ios::binary); std::ifstream inp("test.zip", std::ios::binary);
poco_assert (inp); poco_assert (inp);
// decompress to current working dir // decompress to current working dir
Decompress dec(inp, Poco::Path()); Decompress dec(inp, Poco::Path());
// if an error happens invoke the ZipTest::onDecompressError method // if an error happens invoke the ZipTest::onDecompressError method
dec.EError += Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError); dec.EError += Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError);
dec.decompressAllFiles(); dec.decompressAllFiles();
dec.EError -= Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError); dec.EError -= Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError);
---- ----
The onDecompressError method: The onDecompressError method:
void ZipTest::onDecompressError(const void* pSender, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string>& info) void ZipTest::onDecompressError(const void* pSender, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string>& info)
{ {
// inform user about error // inform user about error
[...] [...]
} }
---- ----
Decompressing directly from the net works similar: Decompressing directly from the net works similar:
Poco::URI uri("http://www.appinf.com/test.zip"); Poco::URI uri("http://www.appinf.com/test.zip");
HTTPClientSession session(uri.getHost(), uri.getPort()); HTTPClientSession session(uri.getHost(), uri.getPort());
HTTPRequest req(HTTPRequest::HTTP_GET, path, HTTPMessage::HTTP_1_1); HTTPRequest req(HTTPRequest::HTTP_GET, path, HTTPMessage::HTTP_1_1);
session.sendRequest(req); session.sendRequest(req);
HTTPResponse res; HTTPResponse res;
std::istream& rs = session.receiveResponse(res); std::istream& rs = session.receiveResponse(res);
Decompress dec(rs, Poco::Path()); Decompress dec(rs, Poco::Path());
// if an error happens invoke the ZipTest::onDecompressError method // if an error happens invoke the ZipTest::onDecompressError method
dec.EError += Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError); dec.EError += Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError);
dec.decompressAllFiles(); dec.decompressAllFiles();
dec.EError -= Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError); dec.EError -= Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError);
---- ----
Furthermore, Decompress supports additional parameters: Furthermore, Decompress supports additional parameters:
Decompress(std::istream& in, const Poco::Path& outputDir, bool flattenDirs = false, bool keepIncompleteFiles = false); Decompress(std::istream& in, const Poco::Path& outputDir, bool flattenDirs = false, bool keepIncompleteFiles = false);
---- ----
If <*flattenDirs*> is set to true no subdirs are extracted, if <*keepIncompleteFiles*> is set to true, corrupt files (i.e. wrong CRC, wrong size on disk) will not be deleted. If <*flattenDirs*> is set to true no subdirs are extracted, if <*keepIncompleteFiles*> is set to true, corrupt files (i.e. wrong CRC, wrong size on disk) will not be deleted.
!Decompress Single Files !Decompress Single Files
To decompress single files you must first parse a Zip file, and then decompress the file which happens transparently inside the <*ZipInputStream*>: To decompress single files you must first parse a Zip file, and then decompress the file which happens transparently inside the <*ZipInputStream*>:
std::ifstream inp("test.zip", std::ios::binary); std::ifstream inp("test.zip", std::ios::binary);
poco_assert (inp); poco_assert (inp);
ZipArchive arch(inp); ZipArchive arch(inp);
ZipArchive::FileHeaders::const_iterator it = arch.findHeader("data/hello.txt"); ZipArchive::FileHeaders::const_iterator it = arch.findHeader("data/hello.txt");
poco_assert (it != arch.headerEnd()); poco_assert (it != arch.headerEnd());
ZipInputStream zipin (inp, it->second); ZipInputStream zipin (inp, it->second);
std::ostringstream out(std::ios::binary); std::ostringstream out(std::ios::binary);
Poco::StreamCopier::copyStream(zipin, out); Poco::StreamCopier::copyStream(zipin, out);
---- ----
Note that this will only work with local files which allow us to seek inside the file. Note that this will only work with local files which allow us to seek inside the file.
Directly extracting single entries from a network file is currently not possible via the Decompress class. Directly extracting single entries from a network file is currently not possible via the Decompress class.

View File

@@ -1,73 +1,73 @@
// //
// Add.h // Add.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/Add.h#1 $ // $Id: //poco/Main/Zip/include/Poco/Zip/Add.h#1 $
// //
// Library: Zip // Library: Zip
// Package: Manipulation // Package: Manipulation
// Module: Add // Module: Add
// //
// Definition of the Add class. // Definition of the Add class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_Add_INCLUDED #ifndef Zip_Add_INCLUDED
#define Zip_Add_INCLUDED #define Zip_Add_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "Poco/Zip/ZipOperation.h" #include "Poco/Zip/ZipOperation.h"
#include "Poco/Zip/ZipCommon.h" #include "Poco/Zip/ZipCommon.h"
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
class Zip_API Add: public ZipOperation class Zip_API Add: public ZipOperation
/// Operation Add adds a new file entry to an existing Zip File /// Operation Add adds a new file entry to an existing Zip File
{ {
public: public:
Add(const std::string& zipPath, const std::string& localPath, ZipCommon::CompressionMethod cm, ZipCommon::CompressionLevel cl); Add(const std::string& zipPath, const std::string& localPath, ZipCommon::CompressionMethod cm, ZipCommon::CompressionLevel cl);
/// Creates the Add. /// Creates the Add.
void execute(Compress& c, std::istream& input); void execute(Compress& c, std::istream& input);
/// Performs the add operation /// Performs the add operation
private: private:
const std::string _zipPath; const std::string _zipPath;
const std::string _localPath; const std::string _localPath;
const ZipCommon::CompressionMethod _cm; const ZipCommon::CompressionMethod _cm;
const ZipCommon::CompressionLevel _cl; const ZipCommon::CompressionLevel _cl;
}; };
} } // namespace Poco::Zip } } // namespace Poco::Zip
#endif // Zip_Add_INCLUDED #endif // Zip_Add_INCLUDED

View File

@@ -1,152 +1,152 @@
// //
// AutoDetectStream.h // AutoDetectStream.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/AutoDetectStream.h#4 $ // $Id: //poco/Main/Zip/include/Poco/Zip/AutoDetectStream.h#4 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: AutoDetectStream // Module: AutoDetectStream
// //
// Definition of the AutoDetectStream class. // Definition of the AutoDetectStream class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_AutoDetectStream_INCLUDED #ifndef Zip_AutoDetectStream_INCLUDED
#define Zip_AutoDetectStream_INCLUDED #define Zip_AutoDetectStream_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "Poco/BufferedStreamBuf.h" #include "Poco/BufferedStreamBuf.h"
#include <istream> #include <istream>
#include <ostream> #include <ostream>
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
class Zip_API AutoDetectStreamBuf: public Poco::BufferedStreamBuf class Zip_API AutoDetectStreamBuf: public Poco::BufferedStreamBuf
/// A AutoDetectStreamBuf is a class that limits one view on an inputstream to a selected view range /// A AutoDetectStreamBuf is a class that limits one view on an inputstream to a selected view range
{ {
public: public:
AutoDetectStreamBuf(std::istream& in, const std::string& prefix, const std::string& postfix, bool reposition, Poco::UInt32 start); AutoDetectStreamBuf(std::istream& in, const std::string& prefix, const std::string& postfix, bool reposition, Poco::UInt32 start);
/// Creates the AutoDetectStream. /// Creates the AutoDetectStream.
AutoDetectStreamBuf(std::ostream& out); AutoDetectStreamBuf(std::ostream& out);
/// Creates the AutoDetectStream. /// Creates the AutoDetectStream.
/// If initStream is true the status of the stream will be cleared on the first access, and the stream will be repositioned /// If initStream is true the status of the stream will be cleared on the first access, and the stream will be repositioned
/// to position start /// to position start
~AutoDetectStreamBuf(); ~AutoDetectStreamBuf();
/// Destroys the AutoDetectStream. /// Destroys the AutoDetectStream.
protected: protected:
int readFromDevice(char* buffer, std::streamsize length); int readFromDevice(char* buffer, std::streamsize length);
int writeToDevice(const char* buffer, std::streamsize length); int writeToDevice(const char* buffer, std::streamsize length);
private: private:
enum enum
{ {
STREAM_BUFFER_SIZE = 1024 STREAM_BUFFER_SIZE = 1024
}; };
std::istream* _pIstr; std::istream* _pIstr;
std::ostream* _pOstr; std::ostream* _pOstr;
bool _eofDetected; bool _eofDetected;
int _matchCnt; int _matchCnt;
std::string _prefix; std::string _prefix;
std::string _postfix; std::string _postfix;
bool _reposition; bool _reposition;
Poco::UInt32 _start; Poco::UInt32 _start;
}; };
class Zip_API AutoDetectIOS: public virtual std::ios class Zip_API AutoDetectIOS: public virtual std::ios
/// The base class for AutoDetectInputStream and AutoDetectOutputStream. /// The base class for AutoDetectInputStream and AutoDetectOutputStream.
/// ///
/// This class is needed to ensure the correct initialization /// This class is needed to ensure the correct initialization
/// order of the stream buffer and base classes. /// order of the stream buffer and base classes.
{ {
public: public:
AutoDetectIOS(std::istream& istr, const std::string& prefix, const std::string& postfix, bool reposition, Poco::UInt32 start); AutoDetectIOS(std::istream& istr, const std::string& prefix, const std::string& postfix, bool reposition, Poco::UInt32 start);
/// Creates the basic stream and connects it /// Creates the basic stream and connects it
/// to the given input stream. /// to the given input stream.
AutoDetectIOS(std::ostream& ostr); AutoDetectIOS(std::ostream& ostr);
/// Creates the basic stream and connects it /// Creates the basic stream and connects it
/// to the given output stream. /// to the given output stream.
~AutoDetectIOS(); ~AutoDetectIOS();
/// Destroys the stream. /// Destroys the stream.
AutoDetectStreamBuf* rdbuf(); AutoDetectStreamBuf* rdbuf();
/// Returns a pointer to the underlying streambuf. /// Returns a pointer to the underlying streambuf.
protected: protected:
AutoDetectStreamBuf _buf; AutoDetectStreamBuf _buf;
}; };
class Zip_API AutoDetectInputStream: public AutoDetectIOS, public std::istream class Zip_API AutoDetectInputStream: public AutoDetectIOS, public std::istream
/// This stream copies all characters read through it /// This stream copies all characters read through it
/// to one or multiple output streams. /// to one or multiple output streams.
{ {
public: public:
AutoDetectInputStream(std::istream& istr, const std::string& prefix = std::string(), const std::string& postfix = std::string(), bool reposition = false, Poco::UInt32 start = 0); AutoDetectInputStream(std::istream& istr, const std::string& prefix = std::string(), const std::string& postfix = std::string(), bool reposition = false, Poco::UInt32 start = 0);
/// Creates the AutoDetectInputStream and connects it /// Creates the AutoDetectInputStream and connects it
/// to the given input stream. Bytes read are guaranteed to be in the range [start, end-1] /// to the given input stream. Bytes read are guaranteed to be in the range [start, end-1]
/// If initStream is true the status of the stream will be cleared on the first access, and the stream will be repositioned /// If initStream is true the status of the stream will be cleared on the first access, and the stream will be repositioned
/// to position start /// to position start
~AutoDetectInputStream(); ~AutoDetectInputStream();
/// Destroys the AutoDetectInputStream. /// Destroys the AutoDetectInputStream.
}; };
class Zip_API AutoDetectOutputStream: public AutoDetectIOS, public std::ostream class Zip_API AutoDetectOutputStream: public AutoDetectIOS, public std::ostream
/// This stream copies all characters written to it /// This stream copies all characters written to it
/// to one or multiple output streams. /// to one or multiple output streams.
{ {
public: public:
AutoDetectOutputStream(std::ostream& ostr); AutoDetectOutputStream(std::ostream& ostr);
/// Creates the AutoDetectOutputStream and connects it /// Creates the AutoDetectOutputStream and connects it
/// to the given input stream. Bytes written are guaranteed to be in the range [start, end-1] /// to the given input stream. Bytes written are guaranteed to be in the range [start, end-1]
/// If initStream is true the status of the stream will be cleared on the first access, and the stream will be repositioned /// If initStream is true the status of the stream will be cleared on the first access, and the stream will be repositioned
/// to position start /// to position start
~AutoDetectOutputStream(); ~AutoDetectOutputStream();
/// Destroys the AutoDetectOutputStream. /// Destroys the AutoDetectOutputStream.
}; };
} } // namespace Poco::Zip } } // namespace Poco::Zip
#endif // Zip_AutoDetectStream_INCLUDED #endif // Zip_AutoDetectStream_INCLUDED

View File

@@ -1,112 +1,114 @@
// //
// Compress.h // Compress.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/Compress.h#4 $ // $Id: //poco/Main/Zip/include/Poco/Zip/Compress.h#6 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: Compress // Module: Compress
// //
// Definition of the Compress class. // Definition of the Compress class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_Compress_INCLUDED #ifndef Zip_Compress_INCLUDED
#define Zip_Compress_INCLUDED #define Zip_Compress_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "Poco/Zip/ZipArchive.h" #include "Poco/Zip/ZipArchive.h"
#include "Poco/FIFOEvent.h" #include "Poco/FIFOEvent.h"
#include <istream>
#include <ostream>
namespace Poco {
namespace Zip {
namespace Poco {
namespace Zip {
class Zip_API Compress
/// Compresses a directory or files as zip.
{ class Zip_API Compress
public: /// Compresses a directory or files as zip.
Poco::FIFOEvent<const ZipLocalFileHeader> EDone; {
public:
Compress(std::ostream& out, bool seekableOut); Poco::FIFOEvent<const ZipLocalFileHeader> EDone;
/// seekableOut determines how we write the zip, setting it to true is recommended for local files (smaller zip file),
/// if you are compressing directly to a network, you MUST set it to false Compress(std::ostream& out, bool seekableOut);
/// seekableOut determines how we write the zip, setting it to true is recommended for local files (smaller zip file),
~Compress(); /// if you are compressing directly to a network, you MUST set it to false
void addFile(std::istream& input, const Poco::DateTime& lastModifiedAt, const Poco::Path& fileName, ZipCommon::CompressionMethod cm = ZipCommon::CM_DEFLATE, ZipCommon::CompressionLevel cl = ZipCommon::CL_MAXIMUM); ~Compress();
/// Adds a single file to the Zip File. fileName must not be a directory name.
void addFile(std::istream& input, const Poco::DateTime& lastModifiedAt, const Poco::Path& fileName, ZipCommon::CompressionMethod cm = ZipCommon::CM_DEFLATE, ZipCommon::CompressionLevel cl = ZipCommon::CL_MAXIMUM);
void addFile(const Poco::Path& file, const Poco::Path& fileName, ZipCommon::CompressionMethod cm = ZipCommon::CM_DEFLATE, ZipCommon::CompressionLevel cl = ZipCommon::CL_MAXIMUM); /// Adds a single file to the Zip File. fileName must not be a directory name.
/// Adds a single file to the Zip File. fileName must not be a directory name. The file must exist physically!
void addFile(const Poco::Path& file, const Poco::Path& fileName, ZipCommon::CompressionMethod cm = ZipCommon::CM_DEFLATE, ZipCommon::CompressionLevel cl = ZipCommon::CL_MAXIMUM);
void addDirectory(const Poco::Path& entryName, const Poco::DateTime& lastModifiedAt); /// Adds a single file to the Zip File. fileName must not be a directory name. The file must exist physically!
/// Adds a directory entry excluding all children to the Zip file, entryName must not be empty.
void addDirectory(const Poco::Path& entryName, const Poco::DateTime& lastModifiedAt);
void addRecursive(const Poco::Path& entry, ZipCommon::CompressionLevel cl = ZipCommon::CL_MAXIMUM, bool excludeRoot = true, const Poco::Path& name = Poco::Path()); /// Adds a directory entry excluding all children to the Zip file, entryName must not be empty.
/// Adds a directory entry recursively to the zip file, set excludeRoot to false to exclude the parent directory.
/// If excludeRoot is true you can specify an empty name to add the files as relative files void addRecursive(const Poco::Path& entry, ZipCommon::CompressionLevel cl = ZipCommon::CL_MAXIMUM, bool excludeRoot = true, const Poco::Path& name = Poco::Path());
/// Adds a directory entry recursively to the zip file, set excludeRoot to false to exclude the parent directory.
ZipArchive close(); /// If excludeRoot is true you can specify an empty name to add the files as relative files
/// Finalizes the ZipArchive, closes it.
ZipArchive close();
private: /// Finalizes the ZipArchive, closes it.
enum
{ private:
COMPRESS_CHUNK_SIZE = 8192 enum
}; {
COMPRESS_CHUNK_SIZE = 8192
Compress(const Compress&); };
Compress& operator=(const Compress&);
Compress(const Compress&);
void addEntry(std::istream& input, const Poco::DateTime& lastModifiedAt, const Poco::Path& fileName, ZipCommon::CompressionMethod cm = ZipCommon::CM_DEFLATE, ZipCommon::CompressionLevel cl = ZipCommon::CL_MAXIMUM); Compress& operator=(const Compress&);
/// Either adds a file or a single directory entry (excluding subchildren) to the Zip file. the compression level will be ignored
/// for directories. void addEntry(std::istream& input, const Poco::DateTime& lastModifiedAt, const Poco::Path& fileName, ZipCommon::CompressionMethod cm = ZipCommon::CM_DEFLATE, ZipCommon::CompressionLevel cl = ZipCommon::CL_MAXIMUM);
/// Either adds a file or a single directory entry (excluding subchildren) to the Zip file. the compression level will be ignored
void addFileRaw(std::istream& in, const ZipLocalFileHeader& hdr, const Poco::Path& fileName); /// for directories.
/// copys an already compressed ZipEntry from in
void addFileRaw(std::istream& in, const ZipLocalFileHeader& hdr, const Poco::Path& fileName);
private: /// copys an already compressed ZipEntry from in
std::ostream& _out;
bool _seekableOut; private:
ZipArchive::FileHeaders _files; std::ostream& _out;
ZipArchive::FileInfos _infos; bool _seekableOut;
ZipArchive::DirectoryInfos _dirs; ZipArchive::FileHeaders _files;
Poco::UInt32 _offset; ZipArchive::FileInfos _infos;
ZipArchive::DirectoryInfos _dirs;
friend class Keep; Poco::UInt32 _offset;
friend class Rename;
}; friend class Keep;
friend class Rename;
};
} } // namespace Poco::Zip
} } // namespace Poco::Zip
#endif // Zip_Compress_INCLUDED
#endif // Zip_Compress_INCLUDED

View File

@@ -1,112 +1,112 @@
// //
// Decompress.h // Decompress.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/Decompress.h#3 $ // $Id: //poco/Main/Zip/include/Poco/Zip/Decompress.h#4 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: Decompress // Module: Decompress
// //
// Definition of the Decompress class. // Definition of the Decompress class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_Decompress_INCLUDED #ifndef Zip_Decompress_INCLUDED
#define Zip_Decompress_INCLUDED #define Zip_Decompress_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "Poco/Zip/ParseCallback.h" #include "Poco/Zip/ParseCallback.h"
#include "Poco/Zip/ZipLocalFileHeader.h" #include "Poco/Zip/ZipArchive.h"
#include "Poco/Path.h" #include "Poco/Path.h"
#include "Poco/FIFOEvent.h" #include "Poco/FIFOEvent.h"
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
class ZipArchive; class ZipArchive;
class Zip_API Decompress: public ParseCallback class Zip_API Decompress: public ParseCallback
/// Decompress extracts files from zip files, can be used to extract single files or all files /// Decompress extracts files from zip files, can be used to extract single files or all files
{ {
public: public:
typedef std::map<std::string, Poco::Path> ZipMapping; typedef std::map<std::string, Poco::Path> ZipMapping;
/// Maps key of FileInfo entries to their local decompressed representation /// Maps key of FileInfo entries to their local decompressed representation
Poco::FIFOEvent<std::pair<const ZipLocalFileHeader, const std::string> > EError; Poco::FIFOEvent<std::pair<const ZipLocalFileHeader, const std::string> > EError;
/// Thrown whenever an error is detected when handling a ZipLocalFileHeader entry. The string contains an error message /// Thrown whenever an error is detected when handling a ZipLocalFileHeader entry. The string contains an error message
Poco::FIFOEvent<std::pair<const ZipLocalFileHeader, const Poco::Path> > EOk; Poco::FIFOEvent<std::pair<const ZipLocalFileHeader, const Poco::Path> > EOk;
/// Thrown whenever a file was successfully decompressed /// Thrown whenever a file was successfully decompressed
Decompress(std::istream& in, const Poco::Path& outputDir, bool flattenDirs = false, bool keepIncompleteFiles = false); Decompress(std::istream& in, const Poco::Path& outputDir, bool flattenDirs = false, bool keepIncompleteFiles = false);
/// Creates the Decompress. Note that istream must be good and at the very beginning of the file! /// Creates the Decompress. Note that istream must be good and at the very beginning of the file!
/// Calling decompressAllFiles will cause the stream to be in state failed once the zip file is processed. /// Calling decompressAllFiles will cause the stream to be in state failed once the zip file is processed.
/// outputDir must be a directory. If it doesn't exist yet, it will be automatically created. /// outputDir must be a directory. If it doesn't exist yet, it will be automatically created.
/// If flattenDirs is set to true, the directory structure of the zip file is not recreated. /// If flattenDirs is set to true, the directory structure of the zip file is not recreated.
/// Instead, all files are extracted into one single directory. /// Instead, all files are extracted into one single directory.
~Decompress(); ~Decompress();
/// Destroys the Decompress. /// Destroys the Decompress.
ZipArchive decompressAllFiles(); ZipArchive decompressAllFiles();
/// Decompresses all files stored in the zip File. Can only be called once per Decompress object. /// Decompresses all files stored in the zip File. Can only be called once per Decompress object.
/// Use mapping to retrieve the location of the decompressed files /// Use mapping to retrieve the location of the decompressed files
bool handleZipEntry(std::istream& zipStream, const ZipLocalFileHeader& hdr); bool handleZipEntry(std::istream& zipStream, const ZipLocalFileHeader& hdr);
const ZipMapping& mapping() const; const ZipMapping& mapping() const;
/// A ZipMapping stores as key the full name of the ZipFileInfo/ZipLocalFileHeader and as value the decompressed file /// A ZipMapping stores as key the full name of the ZipFileInfo/ZipLocalFileHeader and as value the decompressed file
/// If for a ZipFileInfo no mapping exists, there was an error during decompression and the entry is considered to be corrupt /// If for a ZipFileInfo no mapping exists, there was an error during decompression and the entry is considered to be corrupt
private: private:
Decompress(const Decompress&); Decompress(const Decompress&);
Decompress& operator=(const Decompress&); Decompress& operator=(const Decompress&);
void onOk(const void*, std::pair<const ZipLocalFileHeader, const Poco::Path>& val); void onOk(const void*, std::pair<const ZipLocalFileHeader, const Poco::Path>& val);
private: private:
std::istream& _in; std::istream& _in;
Poco::Path _outDir; Poco::Path _outDir;
bool _flattenDirs; bool _flattenDirs;
bool _keepIncompleteFiles; bool _keepIncompleteFiles;
ZipMapping _mapping; ZipMapping _mapping;
}; };
inline const Decompress::ZipMapping& Decompress::mapping() const inline const Decompress::ZipMapping& Decompress::mapping() const
{ {
return _mapping; return _mapping;
} }
} } // namespace Poco::Zip } } // namespace Poco::Zip
#endif // Zip_Decompress_INCLUDED #endif // Zip_Decompress_INCLUDED

View File

@@ -1,70 +1,70 @@
// //
// Delete.h // Delete.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/Delete.h#1 $ // $Id: //poco/Main/Zip/include/Poco/Zip/Delete.h#1 $
// //
// Library: Zip // Library: Zip
// Package: Manipulation // Package: Manipulation
// Module: Delete // Module: Delete
// //
// Definition of the Delete class. // Definition of the Delete class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_Delete_INCLUDED #ifndef Zip_Delete_INCLUDED
#define Zip_Delete_INCLUDED #define Zip_Delete_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "Poco/Zip/ZipOperation.h" #include "Poco/Zip/ZipOperation.h"
#include "Poco/Zip/ZipLocalFileHeader.h" #include "Poco/Zip/ZipLocalFileHeader.h"
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
class Zip_API Delete: public ZipOperation class Zip_API Delete: public ZipOperation
/// Delete Operation removes an entry from a Zip /// Delete Operation removes an entry from a Zip
{ {
public: public:
Delete(const ZipLocalFileHeader& hdr); Delete(const ZipLocalFileHeader& hdr);
/// Creates the Delete. /// Creates the Delete.
void execute(Compress& c, std::istream& input); void execute(Compress& c, std::istream& input);
/// Throws away the ZipEntry /// Throws away the ZipEntry
private: private:
const ZipLocalFileHeader _hdr; const ZipLocalFileHeader _hdr;
}; };
} } // namespace Poco::Zip } } // namespace Poco::Zip
#endif // Zip_Delete_INCLUDED #endif // Zip_Delete_INCLUDED

View File

@@ -1,71 +1,71 @@
// //
// Keep.h // Keep.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/Keep.h#1 $ // $Id: //poco/Main/Zip/include/Poco/Zip/Keep.h#1 $
// //
// Library: Zip // Library: Zip
// Package: Manipulation // Package: Manipulation
// Module: Keep // Module: Keep
// //
// Definition of the Keep class. // Definition of the Keep class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_Keep_INCLUDED #ifndef Zip_Keep_INCLUDED
#define Zip_Keep_INCLUDED #define Zip_Keep_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "Poco/Zip/ZipOperation.h" #include "Poco/Zip/ZipOperation.h"
#include "Poco/Zip/ZipLocalFileHeader.h" #include "Poco/Zip/ZipLocalFileHeader.h"
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
class Zip_API Keep: public ZipOperation class Zip_API Keep: public ZipOperation
/// Keep simply forwards the compressed data stream from the input ZipArchive /// Keep simply forwards the compressed data stream from the input ZipArchive
/// to the output zip archive /// to the output zip archive
{ {
public: public:
Keep(const ZipLocalFileHeader& hdr); Keep(const ZipLocalFileHeader& hdr);
/// Creates the Keep object. /// Creates the Keep object.
void execute(Compress& c, std::istream& input); void execute(Compress& c, std::istream& input);
///Adds a copy of the compressed input file to the ZipArchive ///Adds a copy of the compressed input file to the ZipArchive
private: private:
const ZipLocalFileHeader _hdr; const ZipLocalFileHeader _hdr;
}; };
} } // namespace Poco::Zip } } // namespace Poco::Zip
#endif // Zip_Keep_INCLUDED #endif // Zip_Keep_INCLUDED

View File

@@ -1,76 +1,76 @@
// //
// ParseCallback.h // ParseCallback.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/ParseCallback.h#3 $ // $Id: //poco/Main/Zip/include/Poco/Zip/ParseCallback.h#3 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: ParseCallback // Module: ParseCallback
// //
// Definition of the ParseCallback class. // Definition of the ParseCallback class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_ParseCallback_INCLUDED #ifndef Zip_ParseCallback_INCLUDED
#define Zip_ParseCallback_INCLUDED #define Zip_ParseCallback_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include <istream> #include <istream>
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
class ZipLocalFileHeader; class ZipLocalFileHeader;
class Zip_API ParseCallback class Zip_API ParseCallback
/// Interface for callbacks to handle ZipData /// Interface for callbacks to handle ZipData
{ {
public: public:
ParseCallback(); ParseCallback();
/// Creates the ParseCallback. /// Creates the ParseCallback.
virtual ~ParseCallback(); virtual ~ParseCallback();
/// Destroys the ParseCallback. /// Destroys the ParseCallback.
virtual bool handleZipEntry(std::istream& zipStream, const ZipLocalFileHeader& hdr) = 0; virtual bool handleZipEntry(std::istream& zipStream, const ZipLocalFileHeader& hdr) = 0;
/// Handles parsing of the data of a single Zip Entry. zipStream is guaranteed to be at the very first data byte. /// Handles parsing of the data of a single Zip Entry. zipStream is guaranteed to be at the very first data byte.
/// Note that a callback class SHOULD consume all data inside a zip file, ie. after /// Note that a callback class SHOULD consume all data inside a zip file, ie. after
/// processing the next 4 bytes point the next ZipLocalFileHeader or the ZipDirectory. /// processing the next 4 bytes point the next ZipLocalFileHeader or the ZipDirectory.
/// If it fails to do so, it must return false, otherwise true. /// If it fails to do so, it must return false, otherwise true.
}; };
} } // namespace Poco::Zip } } // namespace Poco::Zip
#endif // Zip_ParseCallback_INCLUDED #endif // Zip_ParseCallback_INCLUDED

View File

@@ -1,209 +1,209 @@
// //
// PartialStream.h // PartialStream.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/PartialStream.h#3 $ // $Id: //poco/Main/Zip/include/Poco/Zip/PartialStream.h#7 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: PartialStream // Module: PartialStream
// //
// Definition of the PartialStream class. // Definition of the PartialStream class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_PartialStream_INCLUDED #ifndef Zip_PartialStream_INCLUDED
#define Zip_PartialStream_INCLUDED #define Zip_PartialStream_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "Poco/BufferedStreamBuf.h" #include "Poco/BufferedStreamBuf.h"
#include "Poco/Buffer.h" #include "Poco/Buffer.h"
#include <istream> #include <istream>
#include <ostream> #include <ostream>
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
class Zip_API PartialStreamBuf: public Poco::BufferedStreamBuf class Zip_API PartialStreamBuf: public Poco::BufferedStreamBuf
/// A PartialStreamBuf is a class that limits one view on an inputstream to a selected view range /// A PartialStreamBuf is a class that limits one view on an inputstream to a selected view range
{ {
public: public:
PartialStreamBuf(std::istream& in, std::ios::pos_type start, std::ios::pos_type end, const std::string& prefix, const std::string& postfix, bool initStream); PartialStreamBuf(std::istream& in, std::ios::pos_type start, std::ios::pos_type end, const std::string& prefix, const std::string& postfix, bool initStream);
/// Creates the PartialStream. /// Creates the PartialStream.
/// If initStream is true the status of the stream will be cleared on the first access, and the stream will be repositioned /// If initStream is true the status of the stream will be cleared on the first access, and the stream will be repositioned
/// to position start /// to position start
PartialStreamBuf(std::ostream& out, std::size_t start, std::size_t end, bool initStream); PartialStreamBuf(std::ostream& out, std::size_t start, std::size_t end, bool initStream);
/// Creates the PartialStream. /// Creates the PartialStream.
/// If initStream is true the status of the stream will be cleared on the first access. /// If initStream is true the status of the stream will be cleared on the first access.
/// start and end acts as offset values for the written content. A start value greater than zero, /// start and end acts as offset values for the written content. A start value greater than zero,
/// means that the first bytes are not written but discarded instead, /// means that the first bytes are not written but discarded instead,
/// an end value not equal to zero means that the last end bytes are not written! /// an end value not equal to zero means that the last end bytes are not written!
/// Examples: /// Examples:
/// start = 3; end = 1 /// start = 3; end = 1
/// write("hello", 5) -> "l" /// write("hello", 5) -> "l"
~PartialStreamBuf(); ~PartialStreamBuf();
/// Destroys the PartialStream. /// Destroys the PartialStream.
void close(); void close();
/// Flushes a writing streambuf /// Flushes a writing streambuf
Poco::UInt64 bytesWritten() const; Poco::UInt64 bytesWritten() const;
protected: protected:
int readFromDevice(char* buffer, std::streamsize length); int readFromDevice(char* buffer, std::streamsize length);
int writeToDevice(const char* buffer, std::streamsize length); int writeToDevice(const char* buffer, std::streamsize length);
private: private:
enum enum
{ {
STREAM_BUFFER_SIZE = 1024 STREAM_BUFFER_SIZE = 1024
}; };
bool _initialized; bool _initialized;
std::ios::pos_type _start; std::ios::pos_type _start;
Poco::UInt64 _numBytes; Poco::UInt64 _numBytes;
Poco::UInt64 _bytesWritten; Poco::UInt64 _bytesWritten;
std::istream* _pIstr; std::istream* _pIstr;
std::ostream* _pOstr; std::ostream* _pOstr;
std::string _prefix; std::string _prefix;
std::string _postfix; std::string _postfix;
std::size_t _ignoreStart; std::size_t _ignoreStart;
Poco::Buffer<char> _buffer; Poco::Buffer<char> _buffer;
Poco::UInt32 _bufferOffset; Poco::UInt32 _bufferOffset;
}; };
inline Poco::UInt64 PartialStreamBuf::bytesWritten() const inline Poco::UInt64 PartialStreamBuf::bytesWritten() const
{ {
return _bytesWritten; return _bytesWritten;
} }
class Zip_API PartialIOS: public virtual std::ios class Zip_API PartialIOS: public virtual std::ios
/// The base class for PartialInputStream and PartialOutputStream. /// The base class for PartialInputStream and PartialOutputStream.
/// ///
/// This class is needed to ensure the correct initialization /// This class is needed to ensure the correct initialization
/// order of the stream buffer and base classes. /// order of the stream buffer and base classes.
{ {
public: public:
PartialIOS(std::istream& istr, std::ios::pos_type start, std::ios::pos_type end, const std::string& prefix, const std::string& postfix, bool initStream); PartialIOS(std::istream& istr, std::ios::pos_type start, std::ios::pos_type end, const std::string& prefix, const std::string& postfix, bool initStream);
/// Creates the basic stream and connects it /// Creates the basic stream and connects it
/// to the given input stream. /// to the given input stream.
/// If initStream is true the status of the stream will be cleared on the first access, and the stream will be repositioned /// If initStream is true the status of the stream will be cleared on the first access, and the stream will be repositioned
/// to position start /// to position start
PartialIOS(std::ostream& ostr, std::size_t start, std::size_t end, bool initStream); PartialIOS(std::ostream& ostr, std::size_t start, std::size_t end, bool initStream);
/// Creates the basic stream and connects it /// Creates the basic stream and connects it
/// to the given output stream. /// to the given output stream.
/// If initStream is true the status of the stream will be cleared on the first access. /// If initStream is true the status of the stream will be cleared on the first access.
/// start and end acts as offset values for the written content. A start value greater than zero, /// start and end acts as offset values for the written content. A start value greater than zero,
/// means that the first bytes are not written but discarded instead, /// means that the first bytes are not written but discarded instead,
/// an end value not equal to zero means that the last end bytes are not written! /// an end value not equal to zero means that the last end bytes are not written!
/// Examples: /// Examples:
/// start = 3; end = 1 /// start = 3; end = 1
/// write("hello", 5) -> "l" /// write("hello", 5) -> "l"
~PartialIOS(); ~PartialIOS();
/// Destroys the stream. /// Destroys the stream.
PartialStreamBuf* rdbuf(); PartialStreamBuf* rdbuf();
/// Returns a pointer to the underlying streambuf. /// Returns a pointer to the underlying streambuf.
protected: protected:
PartialStreamBuf _buf; PartialStreamBuf _buf;
}; };
class Zip_API PartialInputStream: public PartialIOS, public std::istream class Zip_API PartialInputStream: public PartialIOS, public std::istream
/// This stream copies all characters read through it /// This stream copies all characters read through it
/// to one or multiple output streams. /// to one or multiple output streams.
{ {
public: public:
PartialInputStream(std::istream& istr, std::ios::pos_type start, std::ios::pos_type end, bool initStream = true, const std::string& prefix = std::string(), const std::string& postfix = std::string()); PartialInputStream(std::istream& istr, std::ios::pos_type start, std::ios::pos_type end, bool initStream = true, const std::string& prefix = std::string(), const std::string& postfix = std::string());
/// Creates the PartialInputStream and connects it /// Creates the PartialInputStream and connects it
/// to the given input stream. Bytes read are guaranteed to be in the range [start, end-1] /// to the given input stream. Bytes read are guaranteed to be in the range [start, end-1]
/// If initStream is true the status of the stream will be cleared on the first access, and the stream will be repositioned /// If initStream is true the status of the stream will be cleared on the first access, and the stream will be repositioned
/// to position start /// to position start
~PartialInputStream(); ~PartialInputStream();
/// Destroys the PartialInputStream. /// Destroys the PartialInputStream.
}; };
class Zip_API PartialOutputStream: public PartialIOS, public std::ostream class Zip_API PartialOutputStream: public PartialIOS, public std::ostream
/// This stream copies all characters written to it /// This stream copies all characters written to it
/// to one or multiple output streams. /// to one or multiple output streams.
{ {
public: public:
PartialOutputStream(std::ostream& ostr, std::size_t start, std::size_t end, bool initStream = true); PartialOutputStream(std::ostream& ostr, std::size_t start, std::size_t end, bool initStream = true);
/// Creates the PartialOutputStream and connects it /// Creates the PartialOutputStream and connects it
/// to the given output stream. Bytes written are guaranteed to be in the range [start, realEnd - end]. /// to the given output stream. Bytes written are guaranteed to be in the range [start, realEnd - end].
/// If initStream is true the status of the stream will be cleared on the first access. /// If initStream is true the status of the stream will be cleared on the first access.
/// start and end acts as offset values for the written content. A start value greater than zero, /// start and end acts as offset values for the written content. A start value greater than zero,
/// means that the first bytes are not written but discarded instead, /// means that the first bytes are not written but discarded instead,
/// an end value not equal to zero means that the last end bytes are not written! /// an end value not equal to zero means that the last end bytes are not written!
/// Examples: /// Examples:
/// start = 3; end = 1 /// start = 3; end = 1
/// write("hello", 5) -> "l" /// write("hello", 5) -> "l"
/// ///
/// start = 3; end = 0 /// start = 3; end = 0
/// write("hello", 5) -> "lo" /// write("hello", 5) -> "lo"
~PartialOutputStream(); ~PartialOutputStream();
/// Destroys the PartialOutputStream. /// Destroys the PartialOutputStream.
void close(); void close();
/// must be called for the stream to properly terminate it /// must be called for the stream to properly terminate it
Poco::UInt64 bytesWritten() const; Poco::UInt64 bytesWritten() const;
/// Returns the number of bytes actually forwarded to the inner ostream /// Returns the number of bytes actually forwarded to the inner ostream
}; };
inline void PartialOutputStream::close() inline void PartialOutputStream::close()
{ {
flush(); flush();
_buf.close(); _buf.close();
} }
inline Poco::UInt64 PartialOutputStream::bytesWritten() const inline Poco::UInt64 PartialOutputStream::bytesWritten() const
{ {
return _buf.bytesWritten(); return _buf.bytesWritten();
} }
} } // namespace Poco::Zip } } // namespace Poco::Zip
#endif // Zip_PartialStream_INCLUDED #endif // Zip_PartialStream_INCLUDED

View File

@@ -1,71 +1,71 @@
// //
// Rename.h // Rename.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/Rename.h#1 $ // $Id: //poco/Main/Zip/include/Poco/Zip/Rename.h#1 $
// //
// Library: Zip // Library: Zip
// Package: Manipulation // Package: Manipulation
// Module: Rename // Module: Rename
// //
// Definition of the Rename class. // Definition of the Rename class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_Rename_INCLUDED #ifndef Zip_Rename_INCLUDED
#define Zip_Rename_INCLUDED #define Zip_Rename_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "Poco/Zip/ZipOperation.h" #include "Poco/Zip/ZipOperation.h"
#include "Poco/Zip/ZipLocalFileHeader.h" #include "Poco/Zip/ZipLocalFileHeader.h"
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
class Zip_API Rename: public ZipOperation class Zip_API Rename: public ZipOperation
/// Renames an existing Zip Entry /// Renames an existing Zip Entry
{ {
public: public:
Rename(const ZipLocalFileHeader& hdr, const std::string& newZipEntryName); Rename(const ZipLocalFileHeader& hdr, const std::string& newZipEntryName);
/// Creates the Rename. /// Creates the Rename.
void execute(Compress& c, std::istream& input); void execute(Compress& c, std::istream& input);
/// Performs the rename operation /// Performs the rename operation
private: private:
const ZipLocalFileHeader _hdr; const ZipLocalFileHeader _hdr;
const std::string _newZipEntryName; const std::string _newZipEntryName;
}; };
} } // namespace Poco::Zip } } // namespace Poco::Zip
#endif // Zip_Rename_INCLUDED #endif // Zip_Rename_INCLUDED

View File

@@ -1,72 +1,72 @@
// //
// Replace.h // Replace.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/Replace.h#1 $ // $Id: //poco/Main/Zip/include/Poco/Zip/Replace.h#1 $
// //
// Library: Zip // Library: Zip
// Package: Manipulation // Package: Manipulation
// Module: Replace // Module: Replace
// //
// Definition of the Replace class. // Definition of the Replace class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_Replace_INCLUDED #ifndef Zip_Replace_INCLUDED
#define Zip_Replace_INCLUDED #define Zip_Replace_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "Poco/Zip/Add.h" #include "Poco/Zip/Add.h"
#include "Poco/Zip/Delete.h" #include "Poco/Zip/Delete.h"
#include "Poco/Zip/ZipOperation.h" #include "Poco/Zip/ZipOperation.h"
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
class Zip_API Replace: public ZipOperation class Zip_API Replace: public ZipOperation
/// Operation Replace replaces the content of an existing entry with a new one /// Operation Replace replaces the content of an existing entry with a new one
{ {
public: public:
Replace(const ZipLocalFileHeader& hdr, const std::string& localPath); Replace(const ZipLocalFileHeader& hdr, const std::string& localPath);
/// Creates the Replace. /// Creates the Replace.
void execute(Compress& c, std::istream& input); void execute(Compress& c, std::istream& input);
/// Performs the replace operation /// Performs the replace operation
private: private:
Delete _del; Delete _del;
Add _add; Add _add;
}; };
} } // namespace Poco::Zip } } // namespace Poco::Zip
#endif // Zip_Replace_INCLUDED #endif // Zip_Replace_INCLUDED

View File

@@ -1,68 +1,68 @@
// //
// SkipCallback.h // SkipCallback.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/SkipCallback.h#3 $ // $Id: //poco/Main/Zip/include/Poco/Zip/SkipCallback.h#4 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: SkipCallback // Module: SkipCallback
// //
// Definition of the SkipCallback class. // Definition of the SkipCallback class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_SkipCallback_INCLUDED #ifndef Zip_SkipCallback_INCLUDED
#define Zip_SkipCallback_INCLUDED #define Zip_SkipCallback_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "Poco/Zip/ParseCallback.h" #include "Poco/Zip/ParseCallback.h"
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
class Zip_API SkipCallback: public ParseCallback class Zip_API SkipCallback: public ParseCallback
/// A SkipCallback simply skips over the data /// A SkipCallback simply skips over the data
{ {
public: public:
SkipCallback(); SkipCallback();
/// Creates the SkipCallback. /// Creates the SkipCallback.
virtual ~SkipCallback(); virtual ~SkipCallback();
/// Destroys the SkipCallback. /// Destroys the SkipCallback.
bool handleZipEntry(std::istream& zipStream, const ZipLocalFileHeader& hdr); bool handleZipEntry(std::istream& zipStream, const ZipLocalFileHeader& hdr);
}; };
} } // namespace Poco::Zip } } // namespace Poco::Zip
#endif // Zip_SkipCallback_INCLUDED #endif // Zip_SkipCallback_INCLUDED

View File

@@ -1,92 +1,92 @@
// //
// Zip.h // Zip.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/Zip.h#4 $ // $Id: //poco/Main/Zip/include/Poco/Zip/Zip.h#5 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: Zip // Module: Zip
// //
// Basic definitions for the Poco Zip library. // Basic definitions for the Poco Zip library.
// This file must be the first file included by every other Zip // This file must be the first file included by every other Zip
// header file. // header file.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_Zip_INCLUDED #ifndef Zip_Zip_INCLUDED
#define Zip_Zip_INCLUDED #define Zip_Zip_INCLUDED
#include "Poco/Foundation.h" #include "Poco/Foundation.h"
// //
// The following block is the standard way of creating macros which make exporting // The following block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the Zip_EXPORTS // from a DLL simpler. All files within this DLL are compiled with the Zip_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project // symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see // that uses this DLL. This way any other project whose source files include this file see
// Zip_API functions as being imported from a DLL, wheras this DLL sees symbols // Zip_API functions as being imported from a DLL, wheras this DLL sees symbols
// defined with this macro as being exported. // defined with this macro as being exported.
// //
#if defined(_WIN32) && defined(POCO_DLL) #if defined(_WIN32) && defined(POCO_DLL)
#if defined(Zip_EXPORTS) #if defined(Zip_EXPORTS)
#define Zip_API __declspec(dllexport) #define Zip_API __declspec(dllexport)
#else #else
#define Zip_API __declspec(dllimport) #define Zip_API __declspec(dllimport)
#endif #endif
#endif #endif
#if !defined(Zip_API) #if !defined(Zip_API)
#define Zip_API #define Zip_API
#endif #endif
// //
// Automatically link Zip library. // Automatically link Zip library.
// //
#if defined(_MSC_VER) #if defined(_MSC_VER)
#if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(Zip_EXPORTS) #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(Zip_EXPORTS)
#if defined(POCO_DLL) #if defined(POCO_DLL)
#if defined(_DEBUG) #if defined(_DEBUG)
#pragma comment(lib, "PocoZipd.lib") #pragma comment(lib, "PocoZipd.lib")
#else #else
#pragma comment(lib, "PocoZip.lib") #pragma comment(lib, "PocoZip.lib")
#endif #endif
#else #else
#if defined(_DEBUG) #if defined(_DEBUG)
#pragma comment(lib, "PocoZipmtd.lib") #pragma comment(lib, "PocoZipmtd.lib")
#else #else
#pragma comment(lib, "PocoZipmt.lib") #pragma comment(lib, "PocoZipmt.lib")
#endif #endif
#endif #endif
#endif #endif
#endif #endif
#endif // Zip_Zip_INCLUDED #endif // Zip_Zip_INCLUDED

View File

@@ -1,136 +1,136 @@
// //
// ZipArchive.h // ZipArchive.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/ZipArchive.h#3 $ // $Id: //poco/Main/Zip/include/Poco/Zip/ZipArchive.h#7 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: ZipArchive // Module: ZipArchive
// //
// Definition of the ZipArchive class. // Definition of the ZipArchive class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_ZipArchive_INCLUDED #ifndef Zip_ZipArchive_INCLUDED
#define Zip_ZipArchive_INCLUDED #define Zip_ZipArchive_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "Poco/Zip/ZipLocalFileHeader.h" #include "Poco/Zip/ZipLocalFileHeader.h"
#include "Poco/Zip/ZipFileInfo.h" #include "Poco/Zip/ZipFileInfo.h"
#include "Poco/Zip/ZipArchiveInfo.h" #include "Poco/Zip/ZipArchiveInfo.h"
#include <iostream> #include <istream>
#include <map> #include <map>
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
class ParseCallback; class ParseCallback;
class Compress; class Compress;
class Zip_API ZipArchive class Zip_API ZipArchive
/// A ZipArchive contains information on the content of a zip file /// A ZipArchive contains information on the content of a zip file
{ {
public: public:
typedef std::map<std::string, ZipLocalFileHeader> FileHeaders; typedef std::map<std::string, ZipLocalFileHeader> FileHeaders;
typedef std::map<std::string, ZipFileInfo> FileInfos; typedef std::map<std::string, ZipFileInfo> FileInfos;
typedef std::map<Poco::UInt16, ZipArchiveInfo> DirectoryInfos; typedef std::map<Poco::UInt16, ZipArchiveInfo> DirectoryInfos;
ZipArchive(std::istream& in); ZipArchive(std::istream& in);
/// Creates the ZipArchive from a file. Note that the in stream will be in state failed after the constructor is finished /// Creates the ZipArchive from a file. Note that the in stream will be in state failed after the constructor is finished
ZipArchive(std::istream& in, ParseCallback& callback); ZipArchive(std::istream& in, ParseCallback& callback);
/// Creates the ZipArchive from a file or network stream. Note that the in stream will be in state failed after the constructor is finished /// Creates the ZipArchive from a file or network stream. Note that the in stream will be in state failed after the constructor is finished
~ZipArchive(); ~ZipArchive();
/// Destroys the ZipArchive. /// Destroys the ZipArchive.
FileInfos::const_iterator fileInfoBegin() const; FileInfos::const_iterator fileInfoBegin() const;
FileInfos::const_iterator fileInfoEnd() const; FileInfos::const_iterator fileInfoEnd() const;
FileHeaders::const_iterator findHeader(const std::string& fileName) const; FileHeaders::const_iterator findHeader(const std::string& fileName) const;
FileHeaders::const_iterator headerBegin() const; FileHeaders::const_iterator headerBegin() const;
FileHeaders::const_iterator headerEnd() const; FileHeaders::const_iterator headerEnd() const;
private: private:
void parse(std::istream& in, ParseCallback& pc); void parse(std::istream& in, ParseCallback& pc);
ZipArchive(const FileHeaders& entries, const FileInfos& infos, const DirectoryInfos& dirs ); ZipArchive(const FileHeaders& entries, const FileInfos& infos, const DirectoryInfos& dirs );
private: private:
FileHeaders _entries; FileHeaders _entries;
/// Info generated by parsing the data block of the zip file /// Info generated by parsing the data block of the zip file
FileInfos _infos; FileInfos _infos;
/// Info generated by parsing the directory block of the zip file /// Info generated by parsing the directory block of the zip file
DirectoryInfos _disks; DirectoryInfos _disks;
/// Stores directory info for all found disks /// Stores directory info for all found disks
friend class Compress; friend class Compress;
}; };
inline ZipArchive::FileInfos::const_iterator ZipArchive::fileInfoBegin() const inline ZipArchive::FileInfos::const_iterator ZipArchive::fileInfoBegin() const
{ {
return _infos.begin(); return _infos.begin();
} }
inline ZipArchive::FileInfos::const_iterator ZipArchive::fileInfoEnd() const inline ZipArchive::FileInfos::const_iterator ZipArchive::fileInfoEnd() const
{ {
return _infos.end(); return _infos.end();
} }
inline ZipArchive::FileHeaders::const_iterator ZipArchive::findHeader(const std::string& fileName) const inline ZipArchive::FileHeaders::const_iterator ZipArchive::findHeader(const std::string& fileName) const
{ {
return _entries.find(fileName); return _entries.find(fileName);
} }
inline ZipArchive::FileHeaders::const_iterator ZipArchive::headerBegin() const inline ZipArchive::FileHeaders::const_iterator ZipArchive::headerBegin() const
{ {
return _entries.begin(); return _entries.begin();
} }
inline ZipArchive::FileHeaders::const_iterator ZipArchive::headerEnd() const inline ZipArchive::FileHeaders::const_iterator ZipArchive::headerEnd() const
{ {
return _entries.end(); return _entries.end();
} }
} } // namespace Poco::Zip } } // namespace Poco::Zip
#endif // Zip_ZipArchive_INCLUDED #endif // Zip_ZipArchive_INCLUDED

View File

@@ -1,210 +1,210 @@
// //
// ZipArchiveInfo.h // ZipArchiveInfo.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/ZipArchiveInfo.h#3 $ // $Id: //poco/Main/Zip/include/Poco/Zip/ZipArchiveInfo.h#6 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: ZipArchiveInfo // Module: ZipArchiveInfo
// //
// Definition of the ZipArchiveInfo class. // Definition of the ZipArchiveInfo class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_ZipArchiveInfo_INCLUDED #ifndef Zip_ZipArchiveInfo_INCLUDED
#define Zip_ZipArchiveInfo_INCLUDED #define Zip_ZipArchiveInfo_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "Poco/Zip/ZipCommon.h" #include "Poco/Zip/ZipCommon.h"
#include "Poco/Zip/ZipUtil.h" #include "Poco/Zip/ZipUtil.h"
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
class Zip_API ZipArchiveInfo class Zip_API ZipArchiveInfo
/// A ZipArchiveInfo stores central directory info /// A ZipArchiveInfo stores central directory info
{ {
public: public:
static const char HEADER[ZipCommon::HEADER_SIZE]; static const char HEADER[ZipCommon::HEADER_SIZE];
ZipArchiveInfo(); ZipArchiveInfo();
/// Default constructor, everything set to zero or empty /// Default constructor, everything set to zero or empty
ZipArchiveInfo(std::istream& in, bool assumeHeaderRead); ZipArchiveInfo(std::istream& in, bool assumeHeaderRead);
/// Creates the ZipArchiveInfo by parsing the input stream. /// Creates the ZipArchiveInfo by parsing the input stream.
/// If assumeHeaderRead is true we assume that the first 4 bytes were already read outside. /// If assumeHeaderRead is true we assume that the first 4 bytes were already read outside.
~ZipArchiveInfo(); ~ZipArchiveInfo();
/// Destroys the ZipArchiveInfo. /// Destroys the ZipArchiveInfo.
Poco::UInt16 getDiskNumber() const; Poco::UInt16 getDiskNumber() const;
/// Get the number of the disk where this header can be found /// Get the number of the disk where this header can be found
Poco::UInt16 getFirstDiskForDirectoryHeader() const; Poco::UInt16 getFirstDiskForDirectoryHeader() const;
/// Returns the number of the disk that contains the start of the directory header /// Returns the number of the disk that contains the start of the directory header
Poco::UInt16 getNumberOfEntries() const; Poco::UInt16 getNumberOfEntries() const;
/// Returns the number of entries on this disk /// Returns the number of entries on this disk
Poco::UInt16 getTotalNumberOfEntries() const; Poco::UInt16 getTotalNumberOfEntries() const;
/// Returns the total number of entries on all disks /// Returns the total number of entries on all disks
Poco::UInt32 getCentralDirectorySize() const; Poco::UInt32 getCentralDirectorySize() const;
/// Returns the size of the central directory in bytes /// Returns the size of the central directory in bytes
std::streamoff getHeaderOffset() const; std::streamoff getHeaderOffset() const;
/// Returns the offset of the header in relation to the begin of this disk /// Returns the offset of the header in relation to the begin of this disk
const std::string& getZipComment() const; const std::string& getZipComment() const;
/// Returns the (optional) Zip Comment /// Returns the (optional) Zip Comment
void setNumberOfEntries(Poco::UInt16 val); void setNumberOfEntries(Poco::UInt16 val);
/// Returns the number of entries on this disk /// Returns the number of entries on this disk
void setTotalNumberOfEntries(Poco::UInt16 val); void setTotalNumberOfEntries(Poco::UInt16 val);
/// Returns the total number of entries on all disks /// Returns the total number of entries on all disks
void setCentralDirectorySize(Poco::UInt32 val); void setCentralDirectorySize(Poco::UInt32 val);
/// Returns the size of the central directory in bytes /// Returns the size of the central directory in bytes
void setHeaderOffset(Poco::UInt32 val); void setHeaderOffset(Poco::UInt32 val);
std::string createHeader() const; std::string createHeader() const;
/// Creates a header /// Creates a header
private: private:
void parse(std::istream& inp, bool assumeHeaderRead); void parse(std::istream& inp, bool assumeHeaderRead);
Poco::UInt16 getZipCommentSize() const; Poco::UInt16 getZipCommentSize() const;
private: private:
enum enum
{ {
HEADER_POS = 0, HEADER_POS = 0,
NUMBEROFTHISDISK_POS = HEADER_POS + ZipCommon::HEADER_SIZE, NUMBEROFTHISDISK_POS = HEADER_POS + ZipCommon::HEADER_SIZE,
NUMBEROFTHISDISK_SIZE = 2, NUMBEROFTHISDISK_SIZE = 2,
NUMBEROFCENTRALDIRDISK_POS = NUMBEROFTHISDISK_POS + NUMBEROFTHISDISK_SIZE, NUMBEROFCENTRALDIRDISK_POS = NUMBEROFTHISDISK_POS + NUMBEROFTHISDISK_SIZE,
NUMBEROFCENTRALDIRDISK_SIZE = 2, NUMBEROFCENTRALDIRDISK_SIZE = 2,
NUMENTRIESTHISDISK_POS = NUMBEROFCENTRALDIRDISK_POS + NUMBEROFCENTRALDIRDISK_SIZE, NUMENTRIESTHISDISK_POS = NUMBEROFCENTRALDIRDISK_POS + NUMBEROFCENTRALDIRDISK_SIZE,
NUMENTRIESTHISDISK_SIZE = 2, NUMENTRIESTHISDISK_SIZE = 2,
TOTALNUMENTRIES_POS = NUMENTRIESTHISDISK_POS + NUMENTRIESTHISDISK_SIZE, TOTALNUMENTRIES_POS = NUMENTRIESTHISDISK_POS + NUMENTRIESTHISDISK_SIZE,
TOTALNUMENTRIES_SIZE = 2, TOTALNUMENTRIES_SIZE = 2,
CENTRALDIRSIZE_POS = TOTALNUMENTRIES_POS + TOTALNUMENTRIES_SIZE, CENTRALDIRSIZE_POS = TOTALNUMENTRIES_POS + TOTALNUMENTRIES_SIZE,
CENTRALDIRSIZE_SIZE = 4, CENTRALDIRSIZE_SIZE = 4,
CENTRALDIRSTARTOFFSET_POS = CENTRALDIRSIZE_POS + CENTRALDIRSIZE_SIZE, CENTRALDIRSTARTOFFSET_POS = CENTRALDIRSIZE_POS + CENTRALDIRSIZE_SIZE,
CENTRALDIRSTARTOFFSET_SIZE = 4, CENTRALDIRSTARTOFFSET_SIZE = 4,
ZIPCOMMENT_LENGTH_POS = CENTRALDIRSTARTOFFSET_POS + CENTRALDIRSTARTOFFSET_SIZE, ZIPCOMMENT_LENGTH_POS = CENTRALDIRSTARTOFFSET_POS + CENTRALDIRSTARTOFFSET_SIZE,
ZIPCOMMENT_LENGTH_SIZE = 2, ZIPCOMMENT_LENGTH_SIZE = 2,
FULLHEADER_SIZE = 22 FULLHEADER_SIZE = 22
}; };
char _rawInfo[FULLHEADER_SIZE]; char _rawInfo[FULLHEADER_SIZE];
std::streamoff _startPos; std::streamoff _startPos;
std::string _comment; std::string _comment;
}; };
inline Poco::UInt16 ZipArchiveInfo::getDiskNumber() const inline Poco::UInt16 ZipArchiveInfo::getDiskNumber() const
{ {
return ZipUtil::get16BitValue(_rawInfo, NUMBEROFTHISDISK_POS); return ZipUtil::get16BitValue(_rawInfo, NUMBEROFTHISDISK_POS);
} }
inline Poco::UInt16 ZipArchiveInfo::getFirstDiskForDirectoryHeader() const inline Poco::UInt16 ZipArchiveInfo::getFirstDiskForDirectoryHeader() const
{ {
return ZipUtil::get16BitValue(_rawInfo, NUMBEROFCENTRALDIRDISK_POS); return ZipUtil::get16BitValue(_rawInfo, NUMBEROFCENTRALDIRDISK_POS);
} }
inline Poco::UInt16 ZipArchiveInfo::getNumberOfEntries() const inline Poco::UInt16 ZipArchiveInfo::getNumberOfEntries() const
{ {
return ZipUtil::get16BitValue(_rawInfo, NUMENTRIESTHISDISK_POS); return ZipUtil::get16BitValue(_rawInfo, NUMENTRIESTHISDISK_POS);
} }
inline Poco::UInt16 ZipArchiveInfo::getTotalNumberOfEntries() const inline Poco::UInt16 ZipArchiveInfo::getTotalNumberOfEntries() const
{ {
return ZipUtil::get16BitValue(_rawInfo, TOTALNUMENTRIES_POS); return ZipUtil::get16BitValue(_rawInfo, TOTALNUMENTRIES_POS);
} }
inline Poco::UInt32 ZipArchiveInfo::getCentralDirectorySize() const inline Poco::UInt32 ZipArchiveInfo::getCentralDirectorySize() const
{ {
return ZipUtil::get32BitValue(_rawInfo, CENTRALDIRSIZE_POS); return ZipUtil::get32BitValue(_rawInfo, CENTRALDIRSIZE_POS);
} }
inline std::streamoff ZipArchiveInfo::getHeaderOffset() const inline std::streamoff ZipArchiveInfo::getHeaderOffset() const
{ {
return _startPos; return _startPos;
} }
inline Poco::UInt16 ZipArchiveInfo::getZipCommentSize() const inline Poco::UInt16 ZipArchiveInfo::getZipCommentSize() const
{ {
return ZipUtil::get16BitValue(_rawInfo, ZIPCOMMENT_LENGTH_POS); return ZipUtil::get16BitValue(_rawInfo, ZIPCOMMENT_LENGTH_POS);
} }
inline const std::string& ZipArchiveInfo::getZipComment() const inline const std::string& ZipArchiveInfo::getZipComment() const
{ {
return _comment; return _comment;
} }
inline void ZipArchiveInfo::setNumberOfEntries(Poco::UInt16 val) inline void ZipArchiveInfo::setNumberOfEntries(Poco::UInt16 val)
{ {
ZipUtil::set16BitValue(val, _rawInfo, NUMENTRIESTHISDISK_POS); ZipUtil::set16BitValue(val, _rawInfo, NUMENTRIESTHISDISK_POS);
} }
inline void ZipArchiveInfo::setTotalNumberOfEntries(Poco::UInt16 val) inline void ZipArchiveInfo::setTotalNumberOfEntries(Poco::UInt16 val)
{ {
ZipUtil::set16BitValue(val, _rawInfo, TOTALNUMENTRIES_POS); ZipUtil::set16BitValue(val, _rawInfo, TOTALNUMENTRIES_POS);
} }
inline void ZipArchiveInfo::setCentralDirectorySize(Poco::UInt32 val) inline void ZipArchiveInfo::setCentralDirectorySize(Poco::UInt32 val)
{ {
ZipUtil::set32BitValue(val, _rawInfo, CENTRALDIRSIZE_POS); ZipUtil::set32BitValue(val, _rawInfo, CENTRALDIRSIZE_POS);
} }
inline void ZipArchiveInfo::setHeaderOffset(Poco::UInt32 val) inline void ZipArchiveInfo::setHeaderOffset(Poco::UInt32 val)
{ {
ZipUtil::set32BitValue(val, _rawInfo, CENTRALDIRSTARTOFFSET_POS); ZipUtil::set32BitValue(val, _rawInfo, CENTRALDIRSTARTOFFSET_POS);
} }
} } // namespace Poco::Zip } } // namespace Poco::Zip
#endif // Zip_ZipArchiveInfo_INCLUDED #endif // Zip_ZipArchiveInfo_INCLUDED

View File

@@ -1,119 +1,119 @@
// //
// ZipCommon.h // ZipCommon.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/ZipCommon.h#3 $ // $Id: //poco/Main/Zip/include/Poco/Zip/ZipCommon.h#10 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: ZipCommon // Module: ZipCommon
// //
// Definition of the ZipCommon class. // Definition of the ZipCommon class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_ZipCommon_INCLUDED #ifndef Zip_ZipCommon_INCLUDED
#define Zip_ZipCommon_INCLUDED #define Zip_ZipCommon_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
class Zip_API ZipCommon class Zip_API ZipCommon
/// Common enums used in the Zip project /// Common enums used in the Zip project
{ {
public: public:
enum enum
{ {
HEADER_SIZE = 4 HEADER_SIZE = 4
}; };
enum CompressionMethod enum CompressionMethod
{ {
CM_STORE = 0, CM_STORE = 0,
CM_SHRUNK = 1, CM_SHRUNK = 1,
CM_FACTOR1 = 2, CM_FACTOR1 = 2,
CM_FACTOR2 = 3, CM_FACTOR2 = 3,
CM_FACTOR3 = 4, CM_FACTOR3 = 4,
CM_FACTOR4 = 5, CM_FACTOR4 = 5,
CM_IMPLODE = 6, CM_IMPLODE = 6,
CM_TOKENIZE= 7, CM_TOKENIZE= 7,
CM_DEFLATE = 8, CM_DEFLATE = 8,
CM_ENHANCEDDEFLATE = 9, CM_ENHANCEDDEFLATE = 9,
CM_DATECOMPRIMPLODING = 10, CM_DATECOMPRIMPLODING = 10,
CM_UNUSED = 11 CM_UNUSED = 11
}; };
enum CompressionLevel enum CompressionLevel
{ {
CL_NORMAL = 0, CL_NORMAL = 0,
CL_MAXIMUM = 1, CL_MAXIMUM = 1,
CL_FAST = 2, CL_FAST = 2,
CL_SUPERFAST = 3 CL_SUPERFAST = 3
}; };
enum HostSystem enum HostSystem
{ {
HS_FAT = 0, // + PKZIPW 2.50 VFAT, NTFS HS_FAT = 0, // + PKZIPW 2.50 VFAT, NTFS
HS_AMIGA = 1, HS_AMIGA = 1,
HS_VMS = 2, HS_VMS = 2,
HS_UNIX = 3, HS_UNIX = 3,
HS_VM_CMS = 4, HS_VM_CMS = 4,
HS_ATARI = 5, HS_ATARI = 5,
HS_HPFS = 6, HS_HPFS = 6,
HS_MACINTOSH = 7, HS_MACINTOSH = 7,
HS_ZSYSTEM = 8, HS_ZSYSTEM = 8,
HS_CP_M = 9, HS_CP_M = 9,
HS_TOPS20 = 10, // used by pkzip2.5 to indicate ntfs HS_TOPS20 = 10, // used by pkzip2.5 to indicate ntfs
HS_NTFS = 11, HS_NTFS = 11,
HS_SMS_QDOS = 12, HS_SMS_QDOS = 12,
HS_ACORN = 13, HS_ACORN = 13,
HS_VFAT = 14, HS_VFAT = 14,
HS_MVS = 15, HS_MVS = 15,
HS_BEOS = 16, HS_BEOS = 16,
HS_TANDEM = 17, HS_TANDEM = 17,
HS_UNUSED = 18 HS_UNUSED = 18
}; };
enum FileType enum FileType
{ {
FT_BINARY= 0, FT_BINARY= 0,
FT_ASCII = 1 FT_ASCII = 1
}; };
static const std::string ILLEGAL_PATH; static const std::string ILLEGAL_PATH;
}; };
} } // namespace Poco::Zip } } // namespace Poco::Zip
#endif // Zip_ZipCommon_INCLUDED #endif // Zip_ZipCommon_INCLUDED

View File

@@ -1,160 +1,160 @@
// //
// ZipDataInfo.h // ZipDataInfo.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/ZipDataInfo.h#3 $ // $Id: //poco/Main/Zip/include/Poco/Zip/ZipDataInfo.h#4 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: ZipDataInfo // Module: ZipDataInfo
// //
// Definition of the ZipDataInfo class. // Definition of the ZipDataInfo class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_ZipDataInfo_INCLUDED #ifndef Zip_ZipDataInfo_INCLUDED
#define Zip_ZipDataInfo_INCLUDED #define Zip_ZipDataInfo_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "Poco/Zip/ZipCommon.h" #include "Poco/Zip/ZipCommon.h"
#include "Poco/Zip/ZipUtil.h" #include "Poco/Zip/ZipUtil.h"
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
class Zip_API ZipDataInfo class Zip_API ZipDataInfo
/// A ZipDataInfo stores a Zip data descriptor /// A ZipDataInfo stores a Zip data descriptor
{ {
public: public:
static const char HEADER[ZipCommon::HEADER_SIZE]; static const char HEADER[ZipCommon::HEADER_SIZE];
ZipDataInfo(); ZipDataInfo();
/// Creates a header with all fields (except the header field) set to 0 /// Creates a header with all fields (except the header field) set to 0
ZipDataInfo(std::istream& in, bool assumeHeaderRead); ZipDataInfo(std::istream& in, bool assumeHeaderRead);
/// Creates the ZipDataInfo. /// Creates the ZipDataInfo.
~ZipDataInfo(); ~ZipDataInfo();
/// Destroys the ZipDataInfo. /// Destroys the ZipDataInfo.
bool isValid() const; bool isValid() const;
Poco::UInt32 getCRC32() const; Poco::UInt32 getCRC32() const;
void setCRC32(Poco::UInt32 crc); void setCRC32(Poco::UInt32 crc);
Poco::UInt32 getCompressedSize() const; Poco::UInt32 getCompressedSize() const;
void setCompressedSize(Poco::UInt32 size); void setCompressedSize(Poco::UInt32 size);
Poco::UInt32 getUncompressedSize() const; Poco::UInt32 getUncompressedSize() const;
void setUncompressedSize(Poco::UInt32 size); void setUncompressedSize(Poco::UInt32 size);
static Poco::UInt32 getFullHeaderSize(); static Poco::UInt32 getFullHeaderSize();
const char* getRawHeader() const; const char* getRawHeader() const;
private: private:
enum enum
{ {
HEADER_POS = 0, HEADER_POS = 0,
CRC32_POS = HEADER_POS + ZipCommon::HEADER_SIZE, CRC32_POS = HEADER_POS + ZipCommon::HEADER_SIZE,
CRC32_SIZE = 4, CRC32_SIZE = 4,
COMPRESSED_POS = CRC32_POS + CRC32_SIZE, COMPRESSED_POS = CRC32_POS + CRC32_SIZE,
COMPRESSED_SIZE = 4, COMPRESSED_SIZE = 4,
UNCOMPRESSED_POS = COMPRESSED_POS + COMPRESSED_SIZE, UNCOMPRESSED_POS = COMPRESSED_POS + COMPRESSED_SIZE,
UNCOMPRESSED_SIZE = 4, UNCOMPRESSED_SIZE = 4,
FULLHEADER_SIZE = UNCOMPRESSED_POS + UNCOMPRESSED_SIZE FULLHEADER_SIZE = UNCOMPRESSED_POS + UNCOMPRESSED_SIZE
}; };
char _rawInfo[FULLHEADER_SIZE]; char _rawInfo[FULLHEADER_SIZE];
bool _valid; bool _valid;
}; };
inline const char* ZipDataInfo::getRawHeader() const inline const char* ZipDataInfo::getRawHeader() const
{ {
return _rawInfo; return _rawInfo;
} }
inline bool ZipDataInfo::isValid() const inline bool ZipDataInfo::isValid() const
{ {
return _valid; return _valid;
} }
inline Poco::UInt32 ZipDataInfo::getCRC32() const inline Poco::UInt32 ZipDataInfo::getCRC32() const
{ {
return ZipUtil::get32BitValue(_rawInfo, CRC32_POS); return ZipUtil::get32BitValue(_rawInfo, CRC32_POS);
} }
inline void ZipDataInfo::setCRC32(Poco::UInt32 crc) inline void ZipDataInfo::setCRC32(Poco::UInt32 crc)
{ {
return ZipUtil::set32BitValue(crc, _rawInfo, CRC32_POS); return ZipUtil::set32BitValue(crc, _rawInfo, CRC32_POS);
} }
inline Poco::UInt32 ZipDataInfo::getCompressedSize() const inline Poco::UInt32 ZipDataInfo::getCompressedSize() const
{ {
return ZipUtil::get32BitValue(_rawInfo, COMPRESSED_POS); return ZipUtil::get32BitValue(_rawInfo, COMPRESSED_POS);
} }
inline void ZipDataInfo::setCompressedSize(Poco::UInt32 size) inline void ZipDataInfo::setCompressedSize(Poco::UInt32 size)
{ {
return ZipUtil::set32BitValue(size, _rawInfo, COMPRESSED_POS); return ZipUtil::set32BitValue(size, _rawInfo, COMPRESSED_POS);
} }
inline Poco::UInt32 ZipDataInfo::getUncompressedSize() const inline Poco::UInt32 ZipDataInfo::getUncompressedSize() const
{ {
return ZipUtil::get32BitValue(_rawInfo, UNCOMPRESSED_POS); return ZipUtil::get32BitValue(_rawInfo, UNCOMPRESSED_POS);
} }
inline void ZipDataInfo::setUncompressedSize(Poco::UInt32 size) inline void ZipDataInfo::setUncompressedSize(Poco::UInt32 size)
{ {
return ZipUtil::set32BitValue(size, _rawInfo, UNCOMPRESSED_POS); return ZipUtil::set32BitValue(size, _rawInfo, UNCOMPRESSED_POS);
} }
inline Poco::UInt32 ZipDataInfo::getFullHeaderSize() inline Poco::UInt32 ZipDataInfo::getFullHeaderSize()
{ {
return FULLHEADER_SIZE; return FULLHEADER_SIZE;
} }
} } // namespace Poco::Zip } } // namespace Poco::Zip
#endif // Zip_ZipDataInfo_INCLUDED #endif // Zip_ZipDataInfo_INCLUDED

View File

@@ -1,58 +1,58 @@
// //
// ZipException.h // ZipException.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/ZipException.h#4 $ // $Id: //poco/Main/Zip/include/Poco/Zip/ZipException.h#4 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: ZipException // Module: ZipException
// //
// Definition of the ZipException class. // Definition of the ZipException class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_ZipException_INCLUDED #ifndef Zip_ZipException_INCLUDED
#define Zip_ZipException_INCLUDED #define Zip_ZipException_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "Poco/Exception.h" #include "Poco/Exception.h"
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
POCO_DECLARE_EXCEPTION(Zip_API, ZipException, Poco::RuntimeException) POCO_DECLARE_EXCEPTION(Zip_API, ZipException, Poco::RuntimeException)
POCO_DECLARE_EXCEPTION(Zip_API, ZipManipulationException, ZipException) POCO_DECLARE_EXCEPTION(Zip_API, ZipManipulationException, ZipException)
} } // namespace Poco::Zip } } // namespace Poco::Zip
#endif // Zip_ZipException_INCLUDED #endif // Zip_ZipException_INCLUDED

View File

@@ -1,486 +1,486 @@
// //
// ZipLocalFileHeader.h // ZipLocalFileHeader.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/ZipLocalFileHeader.h#4 $ // $Id: //poco/Main/Zip/include/Poco/Zip/ZipLocalFileHeader.h#10 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: ZipLocalFileHeader // Module: ZipLocalFileHeader
// //
// Definition of the ZipLocalFileHeader class. // Definition of the ZipLocalFileHeader class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_ZipLocalFileHeader_INCLUDED #ifndef Zip_ZipLocalFileHeader_INCLUDED
#define Zip_ZipLocalFileHeader_INCLUDED #define Zip_ZipLocalFileHeader_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "Poco/Zip/ZipUtil.h" #include "Poco/Zip/ZipUtil.h"
#include "Poco/Zip/ZipCommon.h" #include "Poco/Zip/ZipCommon.h"
#include "Poco/DateTime.h" #include "Poco/DateTime.h"
#include "Poco/Path.h" #include "Poco/Path.h"
#include <iostream> #include <istream>
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
class ParseCallback; class ParseCallback;
class Zip_API ZipLocalFileHeader class Zip_API ZipLocalFileHeader
/// Stores a Zip local file header /// Stores a Zip local file header
{ {
public: public:
static const char HEADER[ZipCommon::HEADER_SIZE]; static const char HEADER[ZipCommon::HEADER_SIZE];
ZipLocalFileHeader(const Poco::Path& fileName, const Poco::DateTime& lastModifiedAt, ZipCommon::CompressionMethod cm, ZipCommon::CompressionLevel cl); ZipLocalFileHeader(const Poco::Path& fileName, const Poco::DateTime& lastModifiedAt, ZipCommon::CompressionMethod cm, ZipCommon::CompressionLevel cl);
/// Creates a zip file header from an absoluteFile. fileName is the name of the file in the zip, outputIsSeekable determines if we write /// Creates a zip file header from an absoluteFile. fileName is the name of the file in the zip, outputIsSeekable determines if we write
/// CRC and file sizes to the LocalFileHeader or after data compression into a ZipDataInfo /// CRC and file sizes to the LocalFileHeader or after data compression into a ZipDataInfo
ZipLocalFileHeader(std::istream& inp, bool assumeHeaderRead, ParseCallback& callback); ZipLocalFileHeader(std::istream& inp, bool assumeHeaderRead, ParseCallback& callback);
/// Creates the ZipLocalFileHeader by parsing the input stream. /// Creates the ZipLocalFileHeader by parsing the input stream.
/// If assumeHeaderRead is true we assume that the first 4 bytes were already read outside. /// If assumeHeaderRead is true we assume that the first 4 bytes were already read outside.
/// If skipOverDataBlock is true we position the stream after the data block (either at the next FileHeader or the Directory Entry) /// If skipOverDataBlock is true we position the stream after the data block (either at the next FileHeader or the Directory Entry)
virtual ~ZipLocalFileHeader(); virtual ~ZipLocalFileHeader();
/// Destroys the ZipLocalFileHeader. /// Destroys the ZipLocalFileHeader.
ZipCommon::HostSystem getHostSystem() const; ZipCommon::HostSystem getHostSystem() const;
int getMajorVersionNumber() const; int getMajorVersionNumber() const;
int getMinorVersionNumber() const; int getMinorVersionNumber() const;
void getRequiredVersion(int& major, int& minor); void getRequiredVersion(int& major, int& minor);
/// The minimum version required to extract the data /// The minimum version required to extract the data
Poco::UInt32 getHeaderSize() const; Poco::UInt32 getHeaderSize() const;
/// Returns the total size of the header including filename + extra field size /// Returns the total size of the header including filename + extra field size
void setStartPos(std::streamoff start); void setStartPos(std::streamoff start);
/// Sets the start position to start and the end position to start+compressedSize /// Sets the start position to start and the end position to start+compressedSize
std::streamoff getStartPos() const; std::streamoff getStartPos() const;
/// Returns the position of the first byte of the header in the file stream /// Returns the position of the first byte of the header in the file stream
std::streamoff getEndPos() const; std::streamoff getEndPos() const;
/// Points past the last byte of the file entry (ie. either the first byte of the next header, or the directory) /// Points past the last byte of the file entry (ie. either the first byte of the next header, or the directory)
std::streamoff getDataStartPos() const; std::streamoff getDataStartPos() const;
/// Returns the streamoffset for the very first byte of data. Will be equal to DataEndPos if no data present /// Returns the streamoffset for the very first byte of data. Will be equal to DataEndPos if no data present
std::streamoff getDataEndPos() const; std::streamoff getDataEndPos() const;
ZipCommon::CompressionMethod getCompressionMethod() const; ZipCommon::CompressionMethod getCompressionMethod() const;
ZipCommon::CompressionLevel getCompressionLevel() const; ZipCommon::CompressionLevel getCompressionLevel() const;
/// Returns the compression level used. Only valid when the compression method is CM_DEFLATE /// Returns the compression level used. Only valid when the compression method is CM_DEFLATE
bool isEncrypted() const; bool isEncrypted() const;
const Poco::DateTime& lastModifiedAt() const; const Poco::DateTime& lastModifiedAt() const;
Poco::UInt32 getCRC() const; Poco::UInt32 getCRC() const;
Poco::UInt32 getCompressedSize() const; Poco::UInt32 getCompressedSize() const;
Poco::UInt32 getUncompressedSize() const; Poco::UInt32 getUncompressedSize() const;
void setCRC(Poco::UInt32 val); void setCRC(Poco::UInt32 val);
void setCompressedSize(Poco::UInt32 val); void setCompressedSize(Poco::UInt32 val);
void setUncompressedSize(Poco::UInt32 val); void setUncompressedSize(Poco::UInt32 val);
const std::string& getFileName() const; const std::string& getFileName() const;
bool isFile() const; bool isFile() const;
bool isDirectory() const; bool isDirectory() const;
bool hasExtraField() const; bool hasExtraField() const;
const std::string& getExtraField() const; const std::string& getExtraField() const;
bool hasData() const; bool hasData() const;
bool searchCRCAndSizesAfterData() const; bool searchCRCAndSizesAfterData() const;
void setSearchCRCAndSizesAfterData(bool val); void setSearchCRCAndSizesAfterData(bool val);
void setFileName(const std::string& fileName, bool isDirectory); void setFileName(const std::string& fileName, bool isDirectory);
std::string createHeader() const; std::string createHeader() const;
/// Creates a header /// Creates a header
private: private:
void parse(std::istream& inp, bool assumeHeaderRead); void parse(std::istream& inp, bool assumeHeaderRead);
void parseDateTime(); void parseDateTime();
void init(const Poco::Path& fileName, ZipCommon::CompressionMethod cm, ZipCommon::CompressionLevel cl); void init(const Poco::Path& fileName, ZipCommon::CompressionMethod cm, ZipCommon::CompressionLevel cl);
Poco::UInt16 getFileNameLength() const; Poco::UInt16 getFileNameLength() const;
Poco::UInt16 getExtraFieldLength() const; Poco::UInt16 getExtraFieldLength() const;
Poco::UInt32 getCRCFromHeader() const; Poco::UInt32 getCRCFromHeader() const;
Poco::UInt32 getCompressedSizeFromHeader() const; Poco::UInt32 getCompressedSizeFromHeader() const;
Poco::UInt32 getUncompressedSizeFromHeader() const; Poco::UInt32 getUncompressedSizeFromHeader() const;
void setRequiredVersion(int major, int minor); void setRequiredVersion(int major, int minor);
void setHostSystem(ZipCommon::HostSystem hs); void setHostSystem(ZipCommon::HostSystem hs);
void setLastModifiedAt(const Poco::DateTime& dt); void setLastModifiedAt(const Poco::DateTime& dt);
void setEncryption(bool val); void setEncryption(bool val);
void setFileNameLength(Poco::UInt16 size); void setFileNameLength(Poco::UInt16 size);
void setExtraFieldSize(Poco::UInt16 size); void setExtraFieldSize(Poco::UInt16 size);
void setCompressionMethod(ZipCommon::CompressionMethod cm); void setCompressionMethod(ZipCommon::CompressionMethod cm);
void setCompressionLevel(ZipCommon::CompressionLevel cl); void setCompressionLevel(ZipCommon::CompressionLevel cl);
private: private:
enum enum
{ {
HEADER_POS = 0, HEADER_POS = 0,
VERSION_SIZE = 2, VERSION_SIZE = 2,
VERSION_POS = HEADER_POS+ZipCommon::HEADER_SIZE, VERSION_POS = HEADER_POS+ZipCommon::HEADER_SIZE,
GENERAL_PURPOSE_SIZE = 2, GENERAL_PURPOSE_SIZE = 2,
GENERAL_PURPOSE_POS = VERSION_POS + VERSION_SIZE, GENERAL_PURPOSE_POS = VERSION_POS + VERSION_SIZE,
COMPR_METHOD_SIZE = 2, COMPR_METHOD_SIZE = 2,
COMPR_METHOD_POS = GENERAL_PURPOSE_POS + GENERAL_PURPOSE_SIZE, COMPR_METHOD_POS = GENERAL_PURPOSE_POS + GENERAL_PURPOSE_SIZE,
LASTMODEFILETIME_SIZE = 2, LASTMODEFILETIME_SIZE = 2,
LASTMODEFILETIME_POS = COMPR_METHOD_POS + COMPR_METHOD_SIZE, LASTMODEFILETIME_POS = COMPR_METHOD_POS + COMPR_METHOD_SIZE,
LASTMODEFILEDATE_SIZE = 2, LASTMODEFILEDATE_SIZE = 2,
LASTMODEFILEDATE_POS = LASTMODEFILETIME_POS + LASTMODEFILETIME_SIZE, LASTMODEFILEDATE_POS = LASTMODEFILETIME_POS + LASTMODEFILETIME_SIZE,
CRC32_SIZE = 4, CRC32_SIZE = 4,
CRC32_POS = LASTMODEFILEDATE_POS + LASTMODEFILEDATE_SIZE, CRC32_POS = LASTMODEFILEDATE_POS + LASTMODEFILEDATE_SIZE,
COMPRESSEDSIZE_SIZE = 4, COMPRESSEDSIZE_SIZE = 4,
COMPRESSEDSIZE_POS = CRC32_POS + CRC32_SIZE, COMPRESSEDSIZE_POS = CRC32_POS + CRC32_SIZE,
UNCOMPRESSEDSIZE_SIZE = 4, UNCOMPRESSEDSIZE_SIZE = 4,
UNCOMPRESSEDSIZE_POS = COMPRESSEDSIZE_POS + COMPRESSEDSIZE_SIZE, UNCOMPRESSEDSIZE_POS = COMPRESSEDSIZE_POS + COMPRESSEDSIZE_SIZE,
FILELENGTH_SIZE = 2, FILELENGTH_SIZE = 2,
FILELENGTH_POS = UNCOMPRESSEDSIZE_POS + UNCOMPRESSEDSIZE_SIZE, FILELENGTH_POS = UNCOMPRESSEDSIZE_POS + UNCOMPRESSEDSIZE_SIZE,
EXTRAFIELD_LENGTH = 2, EXTRAFIELD_LENGTH = 2,
EXTRAFIELD_POS = FILELENGTH_POS + FILELENGTH_SIZE, EXTRAFIELD_POS = FILELENGTH_POS + FILELENGTH_SIZE,
FULLHEADER_SIZE = 30 FULLHEADER_SIZE = 30
}; };
char _rawHeader[FULLHEADER_SIZE]; char _rawHeader[FULLHEADER_SIZE];
std::streamoff _startPos; std::streamoff _startPos;
std::streamoff _endPos; std::streamoff _endPos;
std::string _fileName; std::string _fileName;
Poco::DateTime _lastModifiedAt; Poco::DateTime _lastModifiedAt;
std::string _extraField; std::string _extraField;
Poco::UInt32 _crc32; Poco::UInt32 _crc32;
Poco::UInt32 _compressedSize; Poco::UInt32 _compressedSize;
Poco::UInt32 _uncompressedSize; Poco::UInt32 _uncompressedSize;
}; };
inline void ZipLocalFileHeader::setFileNameLength(Poco::UInt16 size) inline void ZipLocalFileHeader::setFileNameLength(Poco::UInt16 size)
{ {
ZipUtil::set16BitValue(size, _rawHeader, FILELENGTH_POS); ZipUtil::set16BitValue(size, _rawHeader, FILELENGTH_POS);
} }
inline void ZipLocalFileHeader::setExtraFieldSize(Poco::UInt16 size) inline void ZipLocalFileHeader::setExtraFieldSize(Poco::UInt16 size)
{ {
ZipUtil::set16BitValue(size, _rawHeader, EXTRAFIELD_POS); ZipUtil::set16BitValue(size, _rawHeader, EXTRAFIELD_POS);
} }
inline ZipCommon::HostSystem ZipLocalFileHeader::getHostSystem() const inline ZipCommon::HostSystem ZipLocalFileHeader::getHostSystem() const
{ {
return static_cast<ZipCommon::HostSystem>(_rawHeader[VERSION_POS + 1]); return static_cast<ZipCommon::HostSystem>(_rawHeader[VERSION_POS + 1]);
} }
inline void ZipLocalFileHeader::setHostSystem(ZipCommon::HostSystem hs) inline void ZipLocalFileHeader::setHostSystem(ZipCommon::HostSystem hs)
{ {
_rawHeader[VERSION_POS + 1] = static_cast<char>(hs); _rawHeader[VERSION_POS + 1] = static_cast<char>(hs);
} }
inline int ZipLocalFileHeader::getMajorVersionNumber() const inline int ZipLocalFileHeader::getMajorVersionNumber() const
{ {
return (_rawHeader[VERSION_POS]/10); return (_rawHeader[VERSION_POS]/10);
} }
inline int ZipLocalFileHeader::getMinorVersionNumber() const inline int ZipLocalFileHeader::getMinorVersionNumber() const
{ {
return (_rawHeader[VERSION_POS]%10); return (_rawHeader[VERSION_POS]%10);
} }
inline void ZipLocalFileHeader::getRequiredVersion(int& major, int& minor) inline void ZipLocalFileHeader::getRequiredVersion(int& major, int& minor)
{ {
major = getMajorVersionNumber(); major = getMajorVersionNumber();
minor = getMinorVersionNumber(); minor = getMinorVersionNumber();
} }
inline void ZipLocalFileHeader::setRequiredVersion(int major, int minor) inline void ZipLocalFileHeader::setRequiredVersion(int major, int minor)
{ {
poco_assert (minor < 10); poco_assert (minor < 10);
poco_assert (major < 24); poco_assert (major < 24);
_rawHeader[VERSION_POS] = static_cast<char>(static_cast<unsigned char>(major)*10+static_cast<unsigned char>(minor)); _rawHeader[VERSION_POS] = static_cast<char>(static_cast<unsigned char>(major)*10+static_cast<unsigned char>(minor));
} }
inline Poco::UInt16 ZipLocalFileHeader::getFileNameLength() const inline Poco::UInt16 ZipLocalFileHeader::getFileNameLength() const
{ {
return ZipUtil::get16BitValue(_rawHeader, FILELENGTH_POS); return ZipUtil::get16BitValue(_rawHeader, FILELENGTH_POS);
} }
inline Poco::UInt16 ZipLocalFileHeader::getExtraFieldLength() const inline Poco::UInt16 ZipLocalFileHeader::getExtraFieldLength() const
{ {
return ZipUtil::get16BitValue(_rawHeader, EXTRAFIELD_POS); return ZipUtil::get16BitValue(_rawHeader, EXTRAFIELD_POS);
} }
inline Poco::UInt32 ZipLocalFileHeader::getHeaderSize() const inline Poco::UInt32 ZipLocalFileHeader::getHeaderSize() const
{ {
return FULLHEADER_SIZE+getExtraFieldLength()+getFileNameLength(); return FULLHEADER_SIZE+getExtraFieldLength()+getFileNameLength();
} }
inline std::streamoff ZipLocalFileHeader::getStartPos() const inline std::streamoff ZipLocalFileHeader::getStartPos() const
{ {
return _startPos; return _startPos;
} }
inline void ZipLocalFileHeader::setStartPos(std::streamoff start) inline void ZipLocalFileHeader::setStartPos(std::streamoff start)
{ {
_startPos = start; _startPos = start;
_endPos = start + getHeaderSize()+getCompressedSize(); _endPos = start + getHeaderSize()+getCompressedSize();
} }
inline std::streamoff ZipLocalFileHeader::getEndPos() const inline std::streamoff ZipLocalFileHeader::getEndPos() const
{ {
return _endPos; return _endPos;
} }
inline void ZipLocalFileHeader::parseDateTime() inline void ZipLocalFileHeader::parseDateTime()
{ {
_lastModifiedAt = ZipUtil::parseDateTime(_rawHeader, LASTMODEFILETIME_POS, LASTMODEFILEDATE_POS); _lastModifiedAt = ZipUtil::parseDateTime(_rawHeader, LASTMODEFILETIME_POS, LASTMODEFILEDATE_POS);
} }
inline void ZipLocalFileHeader::setLastModifiedAt(const Poco::DateTime& dt) inline void ZipLocalFileHeader::setLastModifiedAt(const Poco::DateTime& dt)
{ {
_lastModifiedAt = dt; _lastModifiedAt = dt;
ZipUtil::setDateTime(dt, _rawHeader, LASTMODEFILETIME_POS, LASTMODEFILEDATE_POS); ZipUtil::setDateTime(dt, _rawHeader, LASTMODEFILETIME_POS, LASTMODEFILEDATE_POS);
} }
inline ZipCommon::CompressionMethod ZipLocalFileHeader::getCompressionMethod() const inline ZipCommon::CompressionMethod ZipLocalFileHeader::getCompressionMethod() const
{ {
return static_cast<ZipCommon::CompressionMethod>(ZipUtil::get16BitValue(_rawHeader, COMPR_METHOD_POS)); return static_cast<ZipCommon::CompressionMethod>(ZipUtil::get16BitValue(_rawHeader, COMPR_METHOD_POS));
} }
inline ZipCommon::CompressionLevel ZipLocalFileHeader::getCompressionLevel() const inline ZipCommon::CompressionLevel ZipLocalFileHeader::getCompressionLevel() const
{ {
// bit 1 and 2 indicate the level // bit 1 and 2 indicate the level
return static_cast<ZipCommon::CompressionLevel>((ZipUtil::get16BitValue(_rawHeader, GENERAL_PURPOSE_POS)>>1) & 0x0003); return static_cast<ZipCommon::CompressionLevel>((ZipUtil::get16BitValue(_rawHeader, GENERAL_PURPOSE_POS)>>1) & 0x0003);
} }
inline void ZipLocalFileHeader::setCompressionMethod(ZipCommon::CompressionMethod cm) inline void ZipLocalFileHeader::setCompressionMethod(ZipCommon::CompressionMethod cm)
{ {
ZipUtil::set16BitValue(static_cast<Poco::UInt16>(cm), _rawHeader, COMPR_METHOD_POS); ZipUtil::set16BitValue(static_cast<Poco::UInt16>(cm), _rawHeader, COMPR_METHOD_POS);
} }
inline void ZipLocalFileHeader::setCompressionLevel(ZipCommon::CompressionLevel cl) inline void ZipLocalFileHeader::setCompressionLevel(ZipCommon::CompressionLevel cl)
{ {
// bit 1 and 2 indicate the level // bit 1 and 2 indicate the level
Poco::UInt16 val = static_cast<Poco::UInt16>(cl); Poco::UInt16 val = static_cast<Poco::UInt16>(cl);
val <<= 1; val <<= 1;
Poco::UInt16 mask = 0xfff9; Poco::UInt16 mask = 0xfff9;
_rawHeader[GENERAL_PURPOSE_POS] = ((_rawHeader[GENERAL_PURPOSE_POS] & mask) | val); _rawHeader[GENERAL_PURPOSE_POS] = ((_rawHeader[GENERAL_PURPOSE_POS] & mask) | val);
} }
inline bool ZipLocalFileHeader::isEncrypted() const inline bool ZipLocalFileHeader::isEncrypted() const
{ {
// bit 0 indicates encryption // bit 0 indicates encryption
return ((ZipUtil::get16BitValue(_rawHeader, GENERAL_PURPOSE_POS) & 0x0001) != 0); return ((ZipUtil::get16BitValue(_rawHeader, GENERAL_PURPOSE_POS) & 0x0001) != 0);
} }
inline void ZipLocalFileHeader::setEncryption(bool val) inline void ZipLocalFileHeader::setEncryption(bool val)
{ {
if (val) if (val)
_rawHeader[GENERAL_PURPOSE_POS] |= 0x01; _rawHeader[GENERAL_PURPOSE_POS] |= 0x01;
else else
_rawHeader[GENERAL_PURPOSE_POS] &= 0xfe; _rawHeader[GENERAL_PURPOSE_POS] &= 0xfe;
} }
inline void ZipLocalFileHeader::setSearchCRCAndSizesAfterData(bool val) inline void ZipLocalFileHeader::setSearchCRCAndSizesAfterData(bool val)
{ {
//set bit 3 of general purpose reg //set bit 3 of general purpose reg
if (val) if (val)
_rawHeader[GENERAL_PURPOSE_POS] |= 0x08; _rawHeader[GENERAL_PURPOSE_POS] |= 0x08;
else else
_rawHeader[GENERAL_PURPOSE_POS] &= 0xf7; _rawHeader[GENERAL_PURPOSE_POS] &= 0xf7;
} }
inline const Poco::DateTime& ZipLocalFileHeader::lastModifiedAt() const inline const Poco::DateTime& ZipLocalFileHeader::lastModifiedAt() const
{ {
return _lastModifiedAt; return _lastModifiedAt;
} }
inline Poco::UInt32 ZipLocalFileHeader::getCRC() const inline Poco::UInt32 ZipLocalFileHeader::getCRC() const
{ {
return _crc32; return _crc32;
} }
inline Poco::UInt32 ZipLocalFileHeader::getCompressedSize() const inline Poco::UInt32 ZipLocalFileHeader::getCompressedSize() const
{ {
return _compressedSize; return _compressedSize;
} }
inline Poco::UInt32 ZipLocalFileHeader::getUncompressedSize() const inline Poco::UInt32 ZipLocalFileHeader::getUncompressedSize() const
{ {
return _uncompressedSize; return _uncompressedSize;
} }
inline void ZipLocalFileHeader::setCRC(Poco::UInt32 val) inline void ZipLocalFileHeader::setCRC(Poco::UInt32 val)
{ {
_crc32 = val; _crc32 = val;
ZipUtil::set32BitValue(val, _rawHeader, CRC32_POS); ZipUtil::set32BitValue(val, _rawHeader, CRC32_POS);
} }
inline void ZipLocalFileHeader::setCompressedSize(Poco::UInt32 val) inline void ZipLocalFileHeader::setCompressedSize(Poco::UInt32 val)
{ {
_compressedSize = val; _compressedSize = val;
ZipUtil::set32BitValue(val, _rawHeader, COMPRESSEDSIZE_POS); ZipUtil::set32BitValue(val, _rawHeader, COMPRESSEDSIZE_POS);
} }
inline void ZipLocalFileHeader::setUncompressedSize(Poco::UInt32 val) inline void ZipLocalFileHeader::setUncompressedSize(Poco::UInt32 val)
{ {
_uncompressedSize = val; _uncompressedSize = val;
ZipUtil::set32BitValue(val, _rawHeader, UNCOMPRESSEDSIZE_POS); ZipUtil::set32BitValue(val, _rawHeader, UNCOMPRESSEDSIZE_POS);
} }
inline Poco::UInt32 ZipLocalFileHeader::getCRCFromHeader() const inline Poco::UInt32 ZipLocalFileHeader::getCRCFromHeader() const
{ {
return ZipUtil::get32BitValue(_rawHeader, CRC32_POS); return ZipUtil::get32BitValue(_rawHeader, CRC32_POS);
} }
inline Poco::UInt32 ZipLocalFileHeader::getCompressedSizeFromHeader() const inline Poco::UInt32 ZipLocalFileHeader::getCompressedSizeFromHeader() const
{ {
return ZipUtil::get32BitValue(_rawHeader, COMPRESSEDSIZE_POS); return ZipUtil::get32BitValue(_rawHeader, COMPRESSEDSIZE_POS);
} }
inline Poco::UInt32 ZipLocalFileHeader::getUncompressedSizeFromHeader() const inline Poco::UInt32 ZipLocalFileHeader::getUncompressedSizeFromHeader() const
{ {
return ZipUtil::get32BitValue(_rawHeader, UNCOMPRESSEDSIZE_POS); return ZipUtil::get32BitValue(_rawHeader, UNCOMPRESSEDSIZE_POS);
} }
inline const std::string& ZipLocalFileHeader::getFileName() const inline const std::string& ZipLocalFileHeader::getFileName() const
{ {
return _fileName; return _fileName;
} }
inline bool ZipLocalFileHeader::isFile() const inline bool ZipLocalFileHeader::isFile() const
{ {
return !isDirectory(); return !isDirectory();
} }
inline bool ZipLocalFileHeader::isDirectory() const inline bool ZipLocalFileHeader::isDirectory() const
{ {
poco_assert_dbg(!_fileName.empty()); poco_assert_dbg(!_fileName.empty());
return getUncompressedSize() == 0 && getCompressionMethod() == ZipCommon::CM_STORE && _fileName[_fileName.length()-1] == '/'; return getUncompressedSize() == 0 && getCompressionMethod() == ZipCommon::CM_STORE && _fileName[_fileName.length()-1] == '/';
} }
inline bool ZipLocalFileHeader::hasExtraField() const inline bool ZipLocalFileHeader::hasExtraField() const
{ {
return getExtraFieldLength() > 0; return getExtraFieldLength() > 0;
} }
inline const std::string& ZipLocalFileHeader::getExtraField() const inline const std::string& ZipLocalFileHeader::getExtraField() const
{ {
return _extraField; return _extraField;
} }
inline bool ZipLocalFileHeader::hasData() const inline bool ZipLocalFileHeader::hasData() const
{ {
return (getCompressedSize() > 0); return (getCompressedSize() > 0);
} }
inline std::streamoff ZipLocalFileHeader::getDataStartPos() const inline std::streamoff ZipLocalFileHeader::getDataStartPos() const
{ {
return getStartPos() + getHeaderSize(); return getStartPos() + getHeaderSize();
} }
inline std::streamoff ZipLocalFileHeader::getDataEndPos() const inline std::streamoff ZipLocalFileHeader::getDataEndPos() const
{ {
return getDataStartPos()+getCompressedSize(); return getDataStartPos()+getCompressedSize();
} }
} } // namespace Poco::Zip } } // namespace Poco::Zip
#endif // Zip_ZipLocalFileHeader_INCLUDED #endif // Zip_ZipLocalFileHeader_INCLUDED

View File

@@ -1,131 +1,131 @@
// //
// ZipManipulator.h // ZipManipulator.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/ZipManipulator.h#2 $ // $Id: //poco/Main/Zip/include/Poco/Zip/ZipManipulator.h#3 $
// //
// Library: Zip // Library: Zip
// Package: Manipulation // Package: Manipulation
// Module: ZipManipulator // Module: ZipManipulator
// //
// Definition of the ZipManipulator class. // Definition of the ZipManipulator class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_ZipManipulator_INCLUDED #ifndef Zip_ZipManipulator_INCLUDED
#define Zip_ZipManipulator_INCLUDED #define Zip_ZipManipulator_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "Poco/Zip/ZipArchive.h" #include "Poco/Zip/ZipArchive.h"
#include "Poco/Zip/ZipCommon.h" #include "Poco/Zip/ZipCommon.h"
#include "Poco/Zip/ZipOperation.h" #include "Poco/Zip/ZipOperation.h"
#include "Poco/FIFOEvent.h" #include "Poco/FIFOEvent.h"
#include "Poco/SharedPtr.h" #include "Poco/SharedPtr.h"
#include <map> #include <map>
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
class ZipArchive; class ZipArchive;
class Zip_API ZipManipulator class Zip_API ZipManipulator
/// ZipManipulator allows to add/remove/update files inside zip files /// ZipManipulator allows to add/remove/update files inside zip files
{ {
public: public:
Poco::FIFOEvent<const ZipLocalFileHeader> EDone; Poco::FIFOEvent<const ZipLocalFileHeader> EDone;
// Fired for each entry once commit is invoked // Fired for each entry once commit is invoked
ZipManipulator(const std::string& zipFile, bool backupOriginalFile); ZipManipulator(const std::string& zipFile, bool backupOriginalFile);
/// Creates the ZipManipulator. /// Creates the ZipManipulator.
virtual ~ZipManipulator(); virtual ~ZipManipulator();
/// Destroys the ZipManipulator. /// Destroys the ZipManipulator.
void deleteFile(const std::string& zipPath); void deleteFile(const std::string& zipPath);
/// Removes the given file from the Zip archive. /// Removes the given file from the Zip archive.
void replaceFile(const std::string& zipPath, const std::string& localPath); void replaceFile(const std::string& zipPath, const std::string& localPath);
/// Replaces the contents of the file in the archive with the contents /// Replaces the contents of the file in the archive with the contents
/// from the file given by localPath. /// from the file given by localPath.
void renameFile(const std::string& zipPath, const std::string& newZipPath); void renameFile(const std::string& zipPath, const std::string& newZipPath);
/// Renames the file in the archive to newZipPath /// Renames the file in the archive to newZipPath
void addFile(const std::string& zipPath, const std::string& localPath, ZipCommon::CompressionMethod cm = ZipCommon::CM_DEFLATE, ZipCommon::CompressionLevel cl = ZipCommon::CL_MAXIMUM); void addFile(const std::string& zipPath, const std::string& localPath, ZipCommon::CompressionMethod cm = ZipCommon::CM_DEFLATE, ZipCommon::CompressionLevel cl = ZipCommon::CL_MAXIMUM);
/// Adds a file to the zip file. /// Adds a file to the zip file.
ZipArchive commit(); ZipArchive commit();
/// Commits all changes and re-creates the Zip File with the changes applied. /// Commits all changes and re-creates the Zip File with the changes applied.
/// Returns the ZipArchive for the newly created archive /// Returns the ZipArchive for the newly created archive
/// ///
/// Changes will be first written to a temporary file, /// Changes will be first written to a temporary file,
/// then the originalfile will be either deleted or renamed to .bak, /// then the originalfile will be either deleted or renamed to .bak,
/// then, the temp file will be renamed to the original zip file name. /// then, the temp file will be renamed to the original zip file name.
const ZipArchive& originalArchive() const; const ZipArchive& originalArchive() const;
/// Returns the original archive information /// Returns the original archive information
private: private:
const ZipLocalFileHeader& getForChange(const std::string& zipPath) const; const ZipLocalFileHeader& getForChange(const std::string& zipPath) const;
/// Searches for the entry given by the zipPath. /// Searches for the entry given by the zipPath.
/// Throws an exception if the entry does not exist /// Throws an exception if the entry does not exist
/// or if an entry already exists in the Changeslist /// or if an entry already exists in the Changeslist
void addOperation(const std::string& zipPath, ZipOperation::Ptr ptrOp); void addOperation(const std::string& zipPath, ZipOperation::Ptr ptrOp);
/// Adds the operation to the changes list. Throws an exception if an /// Adds the operation to the changes list. Throws an exception if an
/// entry for the zipPath already exists /// entry for the zipPath already exists
void onEDone(const void* pSender, const ZipLocalFileHeader& hdr); void onEDone(const void* pSender, const ZipLocalFileHeader& hdr);
/// Forwards the event to the EDone event /// Forwards the event to the EDone event
ZipArchive compress(const std::string& outFile); ZipArchive compress(const std::string& outFile);
/// Compresses the new file to outFile /// Compresses the new file to outFile
private: private:
typedef std::map<std::string, ZipOperation::Ptr> Changes; typedef std::map<std::string, ZipOperation::Ptr> Changes;
const std::string _zipFile; const std::string _zipFile;
bool _backupOriginalFile; bool _backupOriginalFile;
Changes _changes; Changes _changes;
Poco::SharedPtr<ZipArchive> _in; Poco::SharedPtr<ZipArchive> _in;
}; };
inline const ZipArchive& ZipManipulator::originalArchive() const inline const ZipArchive& ZipManipulator::originalArchive() const
{ {
return *_in; return *_in;
} }
} } // namespace Poco::Zip } } // namespace Poco::Zip
#endif // Zip_ZipManipulator_INCLUDED #endif // Zip_ZipManipulator_INCLUDED

View File

@@ -1,78 +1,78 @@
// //
// ZipOperation.h // ZipOperation.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/ZipOperation.h#1 $ // $Id: //poco/Main/Zip/include/Poco/Zip/ZipOperation.h#1 $
// //
// Library: Zip // Library: Zip
// Package: Manipulation // Package: Manipulation
// Module: ZipOperation // Module: ZipOperation
// //
// Definition of the ZipOperation class. // Definition of the ZipOperation class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_ZipOperation_INCLUDED #ifndef Zip_ZipOperation_INCLUDED
#define Zip_ZipOperation_INCLUDED #define Zip_ZipOperation_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "Poco/RefCountedObject.h" #include "Poco/RefCountedObject.h"
#include "Poco/AutoPtr.h" #include "Poco/AutoPtr.h"
#include <ostream> #include <ostream>
#include <istream> #include <istream>
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
class Compress; class Compress;
class Zip_API ZipOperation: public Poco::RefCountedObject class Zip_API ZipOperation: public Poco::RefCountedObject
/// Abstract super class for operations on individual zip entries /// Abstract super class for operations on individual zip entries
{ {
public: public:
typedef Poco::AutoPtr<ZipOperation> Ptr; typedef Poco::AutoPtr<ZipOperation> Ptr;
ZipOperation(); ZipOperation();
/// Creates the ZipOperation. /// Creates the ZipOperation.
virtual void execute(Compress& c, std::istream& input) = 0; virtual void execute(Compress& c, std::istream& input) = 0;
/// Executes the operation /// Executes the operation
protected: protected:
virtual ~ZipOperation(); virtual ~ZipOperation();
/// Destroys the ZipOperation. /// Destroys the ZipOperation.
}; };
} } // namespace Poco::Zip } } // namespace Poco::Zip
#endif // Zip_ZipOperation_INCLUDED #endif // Zip_ZipOperation_INCLUDED

View File

@@ -1,171 +1,171 @@
// //
// ZipStream.h // ZipStream.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/ZipStream.h#3 $ // $Id: //poco/Main/Zip/include/Poco/Zip/ZipStream.h#9 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: ZipStream // Module: ZipStream
// //
// Definition of the ZipStream class. // Definition of the ZipStream class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_ZipStream_INCLUDED #ifndef Zip_ZipStream_INCLUDED
#define Zip_ZipStream_INCLUDED #define Zip_ZipStream_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "Poco/Zip/PartialStream.h" #include "Poco/Zip/PartialStream.h"
#include "Poco/SharedPtr.h" #include "Poco/SharedPtr.h"
#include "Poco/BufferedStreamBuf.h" #include "Poco/BufferedStreamBuf.h"
#include "Poco/Checksum.h" #include "Poco/Checksum.h"
#include <istream> #include <istream>
#include <ostream> #include <ostream>
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
class ZipArchive; class ZipArchive;
class ZipLocalFileHeader; class ZipLocalFileHeader;
class Zip_API ZipStreamBuf: public Poco::BufferedStreamBuf class Zip_API ZipStreamBuf: public Poco::BufferedStreamBuf
/// ZipStreamBuf is used to decompress single files from a Zip file. /// ZipStreamBuf is used to decompress single files from a Zip file.
{ {
public: public:
ZipStreamBuf(std::istream& istr, const ZipLocalFileHeader& fileEntry, bool reposition); ZipStreamBuf(std::istream& istr, const ZipLocalFileHeader& fileEntry, bool reposition);
/// Creates the ZipStreamBuf. Set reposition to false, if you do on-the-fly decompression. /// Creates the ZipStreamBuf. Set reposition to false, if you do on-the-fly decompression.
ZipStreamBuf(std::ostream& ostr, ZipLocalFileHeader& fileEntry, bool reposition); ZipStreamBuf(std::ostream& ostr, ZipLocalFileHeader& fileEntry, bool reposition);
/// Creates the ZipStreamBuf. Set reposition to false, if you do on-the-fly compression. /// Creates the ZipStreamBuf. Set reposition to false, if you do on-the-fly compression.
virtual ~ZipStreamBuf(); virtual ~ZipStreamBuf();
/// Destroys the ZipStreamBuf. /// Destroys the ZipStreamBuf.
void close(); void close();
/// Informs a writing outputstream that writing is done for this stream /// Informs a writing outputstream that writing is done for this stream
bool crcValid() const; bool crcValid() const;
/// Call this method once all bytes were read from the input stream to determine if the CRC is valid /// Call this method once all bytes were read from the input stream to determine if the CRC is valid
protected: protected:
int readFromDevice(char* buffer, std::streamsize length); int readFromDevice(char* buffer, std::streamsize length);
int writeToDevice(const char* buffer, std::streamsize length); int writeToDevice(const char* buffer, std::streamsize length);
private: private:
enum enum
{ {
STREAM_BUFFER_SIZE = 1024 STREAM_BUFFER_SIZE = 1024
}; };
typedef Poco::SharedPtr<std::istream> PtrIStream; typedef Poco::SharedPtr<std::istream> PtrIStream;
typedef Poco::SharedPtr<std::ostream> PtrOStream; typedef Poco::SharedPtr<std::ostream> PtrOStream;
std::istream* _pIstr; std::istream* _pIstr;
std::ostream* _pOstr; std::ostream* _pOstr;
PtrIStream _ptrBuf; PtrIStream _ptrBuf;
PtrOStream _ptrOBuf; PtrOStream _ptrOBuf;
PtrIStream _ptrHelper; PtrIStream _ptrHelper;
Poco::SharedPtr<PartialOutputStream> _ptrOHelper; Poco::SharedPtr<PartialOutputStream> _ptrOHelper;
Poco::Checksum _crc32; Poco::Checksum _crc32;
Poco::UInt32 _expectedCrc32; Poco::UInt32 _expectedCrc32;
bool _checkCRC; bool _checkCRC;
/// Note: we do not check crc if we decompress a streaming zip file and the crc is stored in the directory header /// Note: we do not check crc if we decompress a streaming zip file and the crc is stored in the directory header
Poco::UInt32 _bytesWritten; Poco::UInt32 _bytesWritten;
ZipLocalFileHeader* _pHeader; ZipLocalFileHeader* _pHeader;
}; };
class Zip_API ZipIOS: public virtual std::ios class Zip_API ZipIOS: public virtual std::ios
/// The base class for ZipInputStream and ZipOutputStream. /// The base class for ZipInputStream and ZipOutputStream.
/// ///
/// This class is needed to ensure the correct initialization /// This class is needed to ensure the correct initialization
/// order of the stream buffer and base classes. /// order of the stream buffer and base classes.
{ {
public: public:
ZipIOS(std::istream& istr, const ZipLocalFileHeader& fileEntry, bool reposition); ZipIOS(std::istream& istr, const ZipLocalFileHeader& fileEntry, bool reposition);
/// Creates the basic stream and connects it /// Creates the basic stream and connects it
/// to the given input stream. /// to the given input stream.
ZipIOS(std::ostream& ostr, ZipLocalFileHeader& fileEntry, bool reposition); ZipIOS(std::ostream& ostr, ZipLocalFileHeader& fileEntry, bool reposition);
/// Creates the basic stream and connects it /// Creates the basic stream and connects it
/// to the given output stream. /// to the given output stream.
~ZipIOS(); ~ZipIOS();
/// Destroys the stream. /// Destroys the stream.
ZipStreamBuf* rdbuf(); ZipStreamBuf* rdbuf();
/// Returns a pointer to the underlying streambuf. /// Returns a pointer to the underlying streambuf.
protected: protected:
ZipStreamBuf _buf; ZipStreamBuf _buf;
}; };
class Zip_API ZipInputStream: public ZipIOS, public std::istream class Zip_API ZipInputStream: public ZipIOS, public std::istream
/// This stream copies all characters read through it /// This stream copies all characters read through it
/// to one or multiple output streams. /// to one or multiple output streams.
{ {
public: public:
ZipInputStream(std::istream& istr, const ZipLocalFileHeader& fileEntry, bool reposition = true); ZipInputStream(std::istream& istr, const ZipLocalFileHeader& fileEntry, bool reposition = true);
/// Creates the ZipInputStream and connects it /// Creates the ZipInputStream and connects it
/// to the given input stream. /// to the given input stream.
~ZipInputStream(); ~ZipInputStream();
/// Destroys the ZipInputStream. /// Destroys the ZipInputStream.
bool crcValid() const; bool crcValid() const;
/// Call this method once all bytes were read from the input stream to determine if the CRC is valid /// Call this method once all bytes were read from the input stream to determine if the CRC is valid
}; };
class Zip_API ZipOutputStream: public ZipIOS, public std::ostream class Zip_API ZipOutputStream: public ZipIOS, public std::ostream
/// This stream compresses all characters written through it /// This stream compresses all characters written through it
/// to one output stream. /// to one output stream.
{ {
public: public:
ZipOutputStream(std::ostream& ostr, ZipLocalFileHeader& fileEntry, bool seekableOutput); ZipOutputStream(std::ostream& ostr, ZipLocalFileHeader& fileEntry, bool seekableOutput);
/// Creates the ZipOutputStream and connects it /// Creates the ZipOutputStream and connects it
/// to the given output stream. /// to the given output stream.
~ZipOutputStream(); ~ZipOutputStream();
/// Destroys the ZipOutputStream. /// Destroys the ZipOutputStream.
void close(); void close();
/// Must be called for ZipOutputStreams! /// Must be called for ZipOutputStreams!
}; };
} } // namespace Poco::Zip } } // namespace Poco::Zip
#endif // Zip_ZipStream_INCLUDED #endif // Zip_ZipStream_INCLUDED

View File

@@ -1,119 +1,120 @@
// //
// ZipUtil.h // ZipUtil.h
// //
// $Id: //poco/1.3/Zip/include/Poco/Zip/ZipUtil.h#4 $ // $Id: //poco/Main/Zip/include/Poco/Zip/ZipUtil.h#7 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: ZipUtil // Module: ZipUtil
// //
// Definition of the ZipUtil class. // Definition of the ZipUtil class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef Zip_ZipUtil_INCLUDED #ifndef Zip_ZipUtil_INCLUDED
#define Zip_ZipUtil_INCLUDED #define Zip_ZipUtil_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "Poco/Zip/ZipCommon.h" #include "Poco/Zip/ZipCommon.h"
#include "Poco/DateTime.h" #include "Poco/DateTime.h"
#include "Poco/Path.h" #include "Poco/Path.h"
#include <istream>
namespace Poco {
namespace Zip { namespace Poco {
namespace Zip {
class ZipUtil
/// A utility class used for parsing header information inside of zip files class ZipUtil
{ /// A utility class used for parsing header information inside of zip files
public: {
static Poco::UInt16 get16BitValue(const char* pVal, const Poco::UInt32 pos); public:
static Poco::UInt16 get16BitValue(const char* pVal, const Poco::UInt32 pos);
static Poco::UInt32 get32BitValue(const char* pVal, const Poco::UInt32 pos);
static Poco::UInt32 get32BitValue(const char* pVal, const Poco::UInt32 pos);
static void set16BitValue(const Poco::UInt16 val, char* pVal, const Poco::UInt32 pos);
static void set16BitValue(const Poco::UInt16 val, char* pVal, const Poco::UInt32 pos);
static void set32BitValue(const Poco::UInt32 val, char* pVal, const Poco::UInt32 pos);
static void set32BitValue(const Poco::UInt32 val, char* pVal, const Poco::UInt32 pos);
static Poco::DateTime parseDateTime(const char* pVal, const Poco::UInt32 timePos, const Poco::UInt32 datePos);
static Poco::DateTime parseDateTime(const char* pVal, const Poco::UInt32 timePos, const Poco::UInt32 datePos);
static void setDateTime(const Poco::DateTime& dt, char* pVal, const Poco::UInt32 timePos, const Poco::UInt32 datePos);
static void setDateTime(const Poco::DateTime& dt, char* pVal, const Poco::UInt32 timePos, const Poco::UInt32 datePos);
static std::string fakeZLibInitString(ZipCommon::CompressionLevel cl);
static std::string fakeZLibInitString(ZipCommon::CompressionLevel cl);
static void sync(std::istream& in);
/// Searches the next valid header in the input stream, stops right before it static void sync(std::istream& in);
/// Searches the next valid header in the input stream, stops right before it
static void verifyZipEntryFileName(const std::string& zipPath);
/// Verifies that the name of the ZipEntry is a valid path static void verifyZipEntryFileName(const std::string& zipPath);
/// Verifies that the name of the ZipEntry is a valid path
static std::string validZipEntryFileName(const Poco::Path& entry);
static std::string validZipEntryFileName(const Poco::Path& entry);
private:
ZipUtil(); private:
~ZipUtil(); ZipUtil();
ZipUtil(const ZipUtil&); ~ZipUtil();
ZipUtil& operator=(const ZipUtil&); ZipUtil(const ZipUtil&);
}; ZipUtil& operator=(const ZipUtil&);
};
inline Poco::UInt16 ZipUtil::get16BitValue(const char* pVal, const Poco::UInt32 pos)
{ inline Poco::UInt16 ZipUtil::get16BitValue(const char* pVal, const Poco::UInt32 pos)
return static_cast<Poco::UInt16>((unsigned char)pVal[pos])+ (static_cast<Poco::UInt16>((unsigned char)pVal[pos+1]) << 8); {
} return static_cast<Poco::UInt16>((unsigned char)pVal[pos])+ (static_cast<Poco::UInt16>((unsigned char)pVal[pos+1]) << 8);
}
inline Poco::UInt32 ZipUtil::get32BitValue(const char* pVal, const Poco::UInt32 pos)
{ inline Poco::UInt32 ZipUtil::get32BitValue(const char* pVal, const Poco::UInt32 pos)
return static_cast<Poco::UInt32>((unsigned char)pVal[pos])+ (static_cast<Poco::UInt32>((unsigned char)pVal[pos+1]) << 8)+ {
(static_cast<Poco::UInt32>((unsigned char)pVal[pos+2]) << 16) + (static_cast<Poco::UInt32>((unsigned char)pVal[pos+3]) << 24); return static_cast<Poco::UInt32>((unsigned char)pVal[pos])+ (static_cast<Poco::UInt32>((unsigned char)pVal[pos+1]) << 8)+
} (static_cast<Poco::UInt32>((unsigned char)pVal[pos+2]) << 16) + (static_cast<Poco::UInt32>((unsigned char)pVal[pos+3]) << 24);
}
inline void ZipUtil::set16BitValue(const Poco::UInt16 val, char* pVal, const Poco::UInt32 pos)
{ inline void ZipUtil::set16BitValue(const Poco::UInt16 val, char* pVal, const Poco::UInt32 pos)
pVal[pos] = static_cast<char>(val); {
pVal[pos+1] = static_cast<char>(val>>8); pVal[pos] = static_cast<char>(val);
} pVal[pos+1] = static_cast<char>(val>>8);
}
inline void ZipUtil::set32BitValue(const Poco::UInt32 val, char* pVal, const Poco::UInt32 pos)
{ inline void ZipUtil::set32BitValue(const Poco::UInt32 val, char* pVal, const Poco::UInt32 pos)
pVal[pos] = static_cast<char>(val); {
pVal[pos+1] = static_cast<char>(val>>8); pVal[pos] = static_cast<char>(val);
pVal[pos+2] = static_cast<char>(val>>16); pVal[pos+1] = static_cast<char>(val>>8);
pVal[pos+3] = static_cast<char>(val>>24); pVal[pos+2] = static_cast<char>(val>>16);
} pVal[pos+3] = static_cast<char>(val>>24);
}
} } // namespace Poco::Zip
} } // namespace Poco::Zip
#endif // Zip_ZipUtil_INCLUDED
#endif // Zip_ZipUtil_INCLUDED

View File

@@ -1,13 +1,13 @@
# #
# Makefile # Makefile
# #
# $Id: //poco/1.3/Zip/samples/Makefile#1 $ # $Id: //poco/Main/Zip/samples/Makefile#1 $
# #
# Makefile for Poco Util Samples # Makefile for Poco Util Samples
# #
.PHONY: projects .PHONY: projects
clean all: projects clean all: projects
projects: projects:
$(MAKE) -C unzip $(MAKECMDGOALS) $(MAKE) -C unzip $(MAKECMDGOALS)
$(MAKE) -C zip $(MAKECMDGOALS) $(MAKE) -C zip $(MAKECMDGOALS)

View File

@@ -1,39 +1,29 @@
Microsoft Visual Studio Solution File, Format Version 8.00 Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unzip", "unzip\unzip_vs71.vcproj", "{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unzip", "unzip\unzip_vs71.vcproj", "{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zip", "zip\zip_vs71.vcproj", "{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zip", "zip\zip_vs71.vcproj", "{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
EndProjectSection EndProjectSection
EndProject EndProject
Global Global
GlobalSection(SolutionConfiguration) = preSolution GlobalSection(SolutionConfiguration) = preSolution
debug_shared = debug_shared debug_shared = debug_shared
debug_static = debug_static release_shared = release_shared
release_shared = release_shared EndGlobalSection
release_static = release_static GlobalSection(ProjectConfiguration) = postSolution
EndGlobalSection {0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.debug_shared.ActiveCfg = debug_shared|Win32
GlobalSection(ProjectConfiguration) = postSolution {0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.debug_shared.Build.0 = debug_shared|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.debug_shared.ActiveCfg = debug_shared|Win32 {0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.release_shared.ActiveCfg = release_shared|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.debug_shared.Build.0 = debug_shared|Win32 {0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.release_shared.Build.0 = release_shared|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.debug_static.ActiveCfg = debug_shared|Win32 {73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_shared.ActiveCfg = debug_shared|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.debug_static.Build.0 = debug_shared|Win32 {73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_shared.Build.0 = debug_shared|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.release_shared.ActiveCfg = release_shared|Win32 {73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_shared.ActiveCfg = release_shared|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.release_shared.Build.0 = release_shared|Win32 {73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_shared.Build.0 = release_shared|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.release_static.ActiveCfg = release_shared|Win32 EndGlobalSection
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.release_static.Build.0 = release_shared|Win32 GlobalSection(ExtensibilityGlobals) = postSolution
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_shared.ActiveCfg = debug_shared|Win32 EndGlobalSection
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_shared.Build.0 = debug_shared|Win32 GlobalSection(ExtensibilityAddIns) = postSolution
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_static.ActiveCfg = debug_shared|Win32 EndGlobalSection
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_static.Build.0 = debug_shared|Win32 EndGlobal
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_shared.ActiveCfg = release_shared|Win32
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_shared.Build.0 = release_shared|Win32
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_static.ActiveCfg = release_shared|Win32
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_static.Build.0 = release_shared|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal

View File

@@ -1,25 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 9.00 Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005 # Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zip", "zip\zip_vs80.vcproj", "{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zip", "zip\zip_vs80.vcproj", "{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unzip", "unzip\unzip_vs80.vcproj", "{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unzip", "unzip\unzip_vs80.vcproj", "{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
debug_shared|Win32 = debug_shared|Win32 debug_shared|Win32 = debug_shared|Win32
release_shared|Win32 = release_shared|Win32 release_shared|Win32 = release_shared|Win32
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 {73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_shared|Win32.Build.0 = debug_shared|Win32 {73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_shared|Win32.Build.0 = debug_shared|Win32
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_shared|Win32.ActiveCfg = release_shared|Win32 {73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_shared|Win32.ActiveCfg = release_shared|Win32
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_shared|Win32.Build.0 = release_shared|Win32 {73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_shared|Win32.Build.0 = release_shared|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 {0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.debug_shared|Win32.Build.0 = debug_shared|Win32 {0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.debug_shared|Win32.Build.0 = debug_shared|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.release_shared|Win32.ActiveCfg = release_shared|Win32 {0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.release_shared|Win32.ActiveCfg = release_shared|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.release_shared|Win32.Build.0 = release_shared|Win32 {0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.release_shared|Win32.Build.0 = release_shared|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@@ -1,25 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 10.00 Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008 # Visual Studio 2008
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zip", "zip\zip_vs90.vcproj", "{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zip", "zip\zip_vs90.vcproj", "{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unzip", "unzip\unzip_vs90.vcproj", "{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unzip", "unzip\unzip_vs90.vcproj", "{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
debug_shared|Win32 = debug_shared|Win32 debug_shared|Win32 = debug_shared|Win32
release_shared|Win32 = release_shared|Win32 release_shared|Win32 = release_shared|Win32
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 {73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_shared|Win32.Build.0 = debug_shared|Win32 {73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.debug_shared|Win32.Build.0 = debug_shared|Win32
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_shared|Win32.ActiveCfg = release_shared|Win32 {73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_shared|Win32.ActiveCfg = release_shared|Win32
{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_shared|Win32.Build.0 = release_shared|Win32 {73408DCF-2E65-47AF-BF38-7466DAB8D5CB}.release_shared|Win32.Build.0 = release_shared|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.debug_shared|Win32.ActiveCfg = debug_shared|Win32 {0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.debug_shared|Win32.ActiveCfg = debug_shared|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.debug_shared|Win32.Build.0 = debug_shared|Win32 {0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.debug_shared|Win32.Build.0 = debug_shared|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.release_shared|Win32.ActiveCfg = release_shared|Win32 {0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.release_shared|Win32.ActiveCfg = release_shared|Win32
{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.release_shared|Win32.Build.0 = release_shared|Win32 {0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}.release_shared|Win32.Build.0 = release_shared|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

View File

@@ -1,17 +1,17 @@
# #
# Makefile # Makefile
# #
# $Id: //poco/1.3/Zip/samples/unzip/Makefile#1 $ # $Id: //poco/Main/Zip/samples/unzip/Makefile#1 $
# #
# Makefile for Poco SampleServer # Makefile for Poco SampleServer
# #
include $(POCO_BASE)/build/rules/global include $(POCO_BASE)/build/rules/global
objects = unzip objects = unzip
target = unzip target = unzip
target_version = 1 target_version = 1
target_libs = PocoZip PocoUtil PocoXML PocoFoundation target_libs = PocoZip PocoUtil PocoXML PocoFoundation
include $(POCO_BASE)/build/rules/exec include $(POCO_BASE)/build/rules/exec

View File

@@ -1,182 +1,182 @@
// //
// unzip.cpp // unzip.cpp
// //
// $Id: //poco/1.3/Zip/samples/unzip/src/unzip.cpp#3 $ // $Id: //poco/Main/Zip/samples/unzip/src/unzip.cpp#3 $
// //
// This sample demonstrates the Decompress class. // This sample demonstrates the Decompress class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/Util/Application.h" #include "Poco/Util/Application.h"
#include "Poco/Util/Option.h" #include "Poco/Util/Option.h"
#include "Poco/Util/OptionSet.h" #include "Poco/Util/OptionSet.h"
#include "Poco/Util/HelpFormatter.h" #include "Poco/Util/HelpFormatter.h"
#include "Poco/Util/AbstractConfiguration.h" #include "Poco/Util/AbstractConfiguration.h"
#include "Poco/AutoPtr.h" #include "Poco/AutoPtr.h"
#include "Poco/Zip/Decompress.h" #include "Poco/Zip/Decompress.h"
#include "Poco/Zip/ZipLocalFileHeader.h" #include "Poco/Zip/ZipLocalFileHeader.h"
#include "Poco/Zip/ZipArchive.h" #include "Poco/Zip/ZipArchive.h"
#include "Poco/Path.h" #include "Poco/Path.h"
#include "Poco/File.h" #include "Poco/File.h"
#include "Poco/Delegate.h" #include "Poco/Delegate.h"
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
using Poco::Util::Application; using Poco::Util::Application;
using Poco::Util::Option; using Poco::Util::Option;
using Poco::Util::OptionSet; using Poco::Util::OptionSet;
using Poco::Util::HelpFormatter; using Poco::Util::HelpFormatter;
using Poco::Util::AbstractConfiguration; using Poco::Util::AbstractConfiguration;
using Poco::Util::OptionCallback; using Poco::Util::OptionCallback;
using Poco::Zip::ZipLocalFileHeader; using Poco::Zip::ZipLocalFileHeader;
using Poco::AutoPtr; using Poco::AutoPtr;
class DecompressHandler class DecompressHandler
{ {
public: public:
DecompressHandler() DecompressHandler()
{ {
} }
~DecompressHandler() ~DecompressHandler()
{ {
} }
void onError(const void*, std::pair<const ZipLocalFileHeader, const std::string>& info) void onError(const void*, std::pair<const ZipLocalFileHeader, const std::string>& info)
{ {
Poco::Util::Application::instance().logger().error("ERR: " + info.second); Poco::Util::Application::instance().logger().error("ERR: " + info.second);
} }
void onOk(const void*, std::pair<const ZipLocalFileHeader, const Poco::Path>& info) void onOk(const void*, std::pair<const ZipLocalFileHeader, const Poco::Path>& info)
{ {
Poco::Util::Application::instance().logger().information("OK: " + info.second.toString(Poco::Path::PATH_UNIX)); Poco::Util::Application::instance().logger().information("OK: " + info.second.toString(Poco::Path::PATH_UNIX));
} }
}; };
class UnzipApp: public Application class UnzipApp: public Application
/// This sample demonstrates some of the features of the Util::Application class, /// This sample demonstrates some of the features of the Util::Application class,
/// such as configuration file handling and command line arguments processing. /// such as configuration file handling and command line arguments processing.
/// ///
/// Try zip --help (on Unix platforms) or zip /help (elsewhere) for /// Try zip --help (on Unix platforms) or zip /help (elsewhere) for
/// more information. /// more information.
{ {
public: public:
UnzipApp(): _helpRequested(false) UnzipApp(): _helpRequested(false)
{ {
} }
protected: protected:
void initialize(Application& self) void initialize(Application& self)
{ {
loadConfiguration(); // load default configuration files, if present loadConfiguration(); // load default configuration files, if present
Application::initialize(self); Application::initialize(self);
// add your own initialization code here // add your own initialization code here
} }
void uninitialize() void uninitialize()
{ {
// add your own uninitialization code here // add your own uninitialization code here
Application::uninitialize(); Application::uninitialize();
} }
void reinitialize(Application& self) void reinitialize(Application& self)
{ {
Application::reinitialize(self); Application::reinitialize(self);
// add your own reinitialization code here // add your own reinitialization code here
} }
void defineOptions(OptionSet& options) void defineOptions(OptionSet& options)
{ {
Application::defineOptions(options); Application::defineOptions(options);
options.addOption( options.addOption(
Option("help", "h", "display help information on command line arguments") Option("help", "h", "display help information on command line arguments")
.required(false) .required(false)
.repeatable(false) .repeatable(false)
.callback(OptionCallback<UnzipApp>(this, &UnzipApp::handleHelp))); .callback(OptionCallback<UnzipApp>(this, &UnzipApp::handleHelp)));
options.addOption( options.addOption(
Option("file", "f", "specifies the input zip file") Option("file", "f", "specifies the input zip file")
.required(true) .required(true)
.repeatable(false) .repeatable(false)
.argument("filename") .argument("filename")
.callback(OptionCallback<UnzipApp>(this, &UnzipApp::handleFile))); .callback(OptionCallback<UnzipApp>(this, &UnzipApp::handleFile)));
} }
void handleHelp(const std::string& name, const std::string& value) void handleHelp(const std::string& name, const std::string& value)
{ {
_helpRequested = true; _helpRequested = true;
displayHelp(); displayHelp();
stopOptionsProcessing(); stopOptionsProcessing();
} }
void handleFile(const std::string& name, const std::string& value) void handleFile(const std::string& name, const std::string& value)
{ {
_zipFile = value; _zipFile = value;
} }
void displayHelp() void displayHelp()
{ {
HelpFormatter helpFormatter(options()); HelpFormatter helpFormatter(options());
helpFormatter.setCommand(commandName()); helpFormatter.setCommand(commandName());
helpFormatter.setUsage("OPTIONS outdir"); helpFormatter.setUsage("OPTIONS outdir");
helpFormatter.setHeader("A application that demonstrates usage of Poco::Zip::Decompress class."); helpFormatter.setHeader("A application that demonstrates usage of Poco::Zip::Decompress class.");
helpFormatter.format(std::cout); helpFormatter.format(std::cout);
} }
int main(const std::vector<std::string>& args) int main(const std::vector<std::string>& args)
{ {
if (!_helpRequested) if (!_helpRequested)
{ {
Poco::Path outputDir; Poco::Path outputDir;
if (!args.empty()) if (!args.empty())
outputDir.parseDirectory(args[0]); outputDir.parseDirectory(args[0]);
std::ifstream in(_zipFile.c_str(), std::ios::binary); std::ifstream in(_zipFile.c_str(), std::ios::binary);
Poco::Zip::Decompress c(in, outputDir); Poco::Zip::Decompress c(in, outputDir);
DecompressHandler handler; DecompressHandler handler;
c.EError += Poco::Delegate<DecompressHandler, std::pair<const ZipLocalFileHeader, const std::string> >(&handler, &DecompressHandler::onError); c.EError += Poco::Delegate<DecompressHandler, std::pair<const ZipLocalFileHeader, const std::string> >(&handler, &DecompressHandler::onError);
c.EOk +=Poco::Delegate<DecompressHandler, std::pair<const ZipLocalFileHeader, const Poco::Path> >(&handler, &DecompressHandler::onOk); c.EOk +=Poco::Delegate<DecompressHandler, std::pair<const ZipLocalFileHeader, const Poco::Path> >(&handler, &DecompressHandler::onOk);
c.decompressAllFiles(); c.decompressAllFiles();
c.EError -= Poco::Delegate<DecompressHandler, std::pair<const ZipLocalFileHeader, const std::string> >(&handler, &DecompressHandler::onError); c.EError -= Poco::Delegate<DecompressHandler, std::pair<const ZipLocalFileHeader, const std::string> >(&handler, &DecompressHandler::onError);
c.EOk -=Poco::Delegate<DecompressHandler, std::pair<const ZipLocalFileHeader, const Poco::Path> >(&handler, &DecompressHandler::onOk); c.EOk -=Poco::Delegate<DecompressHandler, std::pair<const ZipLocalFileHeader, const Poco::Path> >(&handler, &DecompressHandler::onOk);
} }
return Application::EXIT_OK; return Application::EXIT_OK;
} }
private: private:
bool _helpRequested; bool _helpRequested;
std::string _zipFile; std::string _zipFile;
}; };
POCO_APP_MAIN(UnzipApp) POCO_APP_MAIN(UnzipApp)

View File

@@ -1,149 +1,149 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="7.10" Version="7.10"
Name="unzip" Name="unzip"
ProjectGUID="{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}" ProjectGUID="{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}"
Keyword="Win32Proj"> Keyword="Win32Proj">
<Platforms> <Platforms>
<Platform <Platform
Name="Win32"/> Name="Win32"/>
</Platforms> </Platforms>
<Configurations> <Configurations>
<Configuration <Configuration
Name="debug_shared|Win32" Name="debug_shared|Win32"
OutputDirectory="obj\debug_shared" OutputDirectory="obj\debug_shared"
IntermediateDirectory="obj\debug_shared" IntermediateDirectory="obj\debug_shared"
ConfigurationType="1" ConfigurationType="1"
UseOfMFC="2" UseOfMFC="2"
CharacterSet="2"> CharacterSet="2">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Zip\include" AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Zip\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
MinimalRebuild="TRUE" MinimalRebuild="TRUE"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
BufferSecurityCheck="TRUE" BufferSecurityCheck="TRUE"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE" ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE" RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="TRUE" Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/> DebugInformationFormat="4"/>
<Tool <Tool
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib PocoUtild.lib PocoZipd.lib" AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib PocoUtild.lib PocoZipd.lib"
OutputFile="bin/unzipd.exe" OutputFile="bin/unzipd.exe"
LinkIncremental="2" LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\lib" AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="TRUE" GenerateDebugInformation="TRUE"
ProgramDatabaseFile="bin/unzipd.pdb" ProgramDatabaseFile="bin/unzipd.pdb"
SubSystem="1" SubSystem="1"
TargetMachine="1"/> TargetMachine="1"/>
<Tool <Tool
Name="VCMIDLTool"/> Name="VCMIDLTool"/>
<Tool <Tool
Name="VCPostBuildEventTool"/> Name="VCPostBuildEventTool"/>
<Tool <Tool
Name="VCPreBuildEventTool"/> Name="VCPreBuildEventTool"/>
<Tool <Tool
Name="VCPreLinkEventTool"/> Name="VCPreLinkEventTool"/>
<Tool <Tool
Name="VCResourceCompilerTool"/> Name="VCResourceCompilerTool"/>
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool"/> Name="VCWebServiceProxyGeneratorTool"/>
<Tool <Tool
Name="VCXMLDataGeneratorTool"/> Name="VCXMLDataGeneratorTool"/>
<Tool <Tool
Name="VCWebDeploymentTool"/> Name="VCWebDeploymentTool"/>
<Tool <Tool
Name="VCManagedWrapperGeneratorTool"/> Name="VCManagedWrapperGeneratorTool"/>
<Tool <Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/> Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration> </Configuration>
<Configuration <Configuration
Name="release_shared|Win32" Name="release_shared|Win32"
OutputDirectory="obj\release_shared" OutputDirectory="obj\release_shared"
IntermediateDirectory="obj\release_shared" IntermediateDirectory="obj\release_shared"
ConfigurationType="1" ConfigurationType="1"
UseOfMFC="2" UseOfMFC="2"
CharacterSet="2"> CharacterSet="2">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="4" Optimization="4"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE" EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="TRUE" OmitFramePointers="TRUE"
OptimizeForWindowsApplication="TRUE" OptimizeForWindowsApplication="TRUE"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Zip\include" AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Zip\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
StringPooling="TRUE" StringPooling="TRUE"
RuntimeLibrary="2" RuntimeLibrary="2"
BufferSecurityCheck="FALSE" BufferSecurityCheck="FALSE"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE" ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE" RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="TRUE" Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/> DebugInformationFormat="3"/>
<Tool <Tool
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="PocoFoundation.lib PocoXML.lib PocoUtil.lib PocoZip.lib" AdditionalDependencies="PocoFoundation.lib PocoXML.lib PocoUtil.lib PocoZip.lib"
OutputFile="bin/unzip.exe" OutputFile="bin/unzip.exe"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\lib" AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="FALSE" GenerateDebugInformation="FALSE"
ProgramDatabaseFile="" ProgramDatabaseFile=""
SubSystem="1" SubSystem="1"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"
TargetMachine="1"/> TargetMachine="1"/>
<Tool <Tool
Name="VCMIDLTool"/> Name="VCMIDLTool"/>
<Tool <Tool
Name="VCPostBuildEventTool"/> Name="VCPostBuildEventTool"/>
<Tool <Tool
Name="VCPreBuildEventTool"/> Name="VCPreBuildEventTool"/>
<Tool <Tool
Name="VCPreLinkEventTool"/> Name="VCPreLinkEventTool"/>
<Tool <Tool
Name="VCResourceCompilerTool"/> Name="VCResourceCompilerTool"/>
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool"/> Name="VCWebServiceProxyGeneratorTool"/>
<Tool <Tool
Name="VCXMLDataGeneratorTool"/> Name="VCXMLDataGeneratorTool"/>
<Tool <Tool
Name="VCWebDeploymentTool"/> Name="VCWebDeploymentTool"/>
<Tool <Tool
Name="VCManagedWrapperGeneratorTool"/> Name="VCManagedWrapperGeneratorTool"/>
<Tool <Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/> Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration> </Configuration>
</Configurations> </Configurations>
<References> <References>
</References> </References>
<Files> <Files>
<Filter <Filter
Name="Header Files" Name="Header Files"
Filter=""> Filter="">
</Filter> </Filter>
<Filter <Filter
Name="Source Files" Name="Source Files"
Filter=""> Filter="">
<File <File
RelativePath=".\src\unzip.cpp"> RelativePath=".\src\unzip.cpp">
</File> </File>
</Filter> </Filter>
</Files> </Files>
<Globals> <Globals>
</Globals> </Globals>
</VisualStudioProject> </VisualStudioProject>

View File

@@ -1,213 +1,213 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="8,00" Version="8,00"
Name="unzip" Name="unzip"
ProjectGUID="{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}" ProjectGUID="{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}"
Keyword="Win32Proj" Keyword="Win32Proj"
> >
<Platforms> <Platforms>
<Platform <Platform
Name="Win32" Name="Win32"
/> />
</Platforms> </Platforms>
<ToolFiles> <ToolFiles>
</ToolFiles> </ToolFiles>
<Configurations> <Configurations>
<Configuration <Configuration
Name="debug_shared|Win32" Name="debug_shared|Win32"
OutputDirectory="obj\debug_shared" OutputDirectory="obj\debug_shared"
IntermediateDirectory="obj\debug_shared" IntermediateDirectory="obj\debug_shared"
ConfigurationType="1" ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="2" UseOfMFC="2"
CharacterSet="2" CharacterSet="2"
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
/> />
<Tool <Tool
Name="VCXMLDataGeneratorTool" Name="VCXMLDataGeneratorTool"
/> />
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool" Name="VCWebServiceProxyGeneratorTool"
/> />
<Tool <Tool
Name="VCMIDLTool" Name="VCMIDLTool"
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include" AdditionalIncludeDirectories="..\..\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
BufferSecurityCheck="true" BufferSecurityCheck="true"
TreatWChar_tAsBuiltInType="true" TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true" ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true" RuntimeTypeInfo="true"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="true" Detect64BitPortabilityProblems="true"
DebugInformationFormat="4" DebugInformationFormat="4"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
/> />
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib PocoUtild.lib PocoZipd.lib" AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib PocoUtild.lib PocoZipd.lib"
OutputFile="bin/unzipd.exe" OutputFile="bin/unzipd.exe"
LinkIncremental="2" LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\lib" AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="bin/unzipd.pdb" ProgramDatabaseFile="bin/unzipd.pdb"
SubSystem="1" SubSystem="1"
TargetMachine="1" TargetMachine="1"
/> />
<Tool <Tool
Name="VCALinkTool" Name="VCALinkTool"
/> />
<Tool <Tool
Name="VCManifestTool" Name="VCManifestTool"
/> />
<Tool <Tool
Name="VCXDCMakeTool" Name="VCXDCMakeTool"
/> />
<Tool <Tool
Name="VCBscMakeTool" Name="VCBscMakeTool"
/> />
<Tool <Tool
Name="VCFxCopTool" Name="VCFxCopTool"
/> />
<Tool <Tool
Name="VCAppVerifierTool" Name="VCAppVerifierTool"
/> />
<Tool <Tool
Name="VCWebDeploymentTool" Name="VCWebDeploymentTool"
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
/> />
</Configuration> </Configuration>
<Configuration <Configuration
Name="release_shared|Win32" Name="release_shared|Win32"
OutputDirectory="obj\release_shared" OutputDirectory="obj\release_shared"
IntermediateDirectory="obj\release_shared" IntermediateDirectory="obj\release_shared"
ConfigurationType="1" ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="2" UseOfMFC="2"
CharacterSet="2" CharacterSet="2"
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
/> />
<Tool <Tool
Name="VCXMLDataGeneratorTool" Name="VCXMLDataGeneratorTool"
/> />
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool" Name="VCWebServiceProxyGeneratorTool"
/> />
<Tool <Tool
Name="VCMIDLTool" Name="VCMIDLTool"
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="4" Optimization="4"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="true" OmitFramePointers="true"
AdditionalIncludeDirectories="..\..\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include" AdditionalIncludeDirectories="..\..\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
StringPooling="true" StringPooling="true"
RuntimeLibrary="2" RuntimeLibrary="2"
BufferSecurityCheck="false" BufferSecurityCheck="false"
TreatWChar_tAsBuiltInType="true" TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true" ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true" RuntimeTypeInfo="true"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="true" Detect64BitPortabilityProblems="true"
DebugInformationFormat="3" DebugInformationFormat="3"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
/> />
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="PocoFoundation.lib PocoXML.lib PocoUtil.lib PocoZip.lib" AdditionalDependencies="PocoFoundation.lib PocoXML.lib PocoUtil.lib PocoZip.lib"
OutputFile="bin/unzip.exe" OutputFile="bin/unzip.exe"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\lib" AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="false" GenerateDebugInformation="false"
ProgramDatabaseFile="" ProgramDatabaseFile=""
SubSystem="1" SubSystem="1"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"
TargetMachine="1" TargetMachine="1"
/> />
<Tool <Tool
Name="VCALinkTool" Name="VCALinkTool"
/> />
<Tool <Tool
Name="VCManifestTool" Name="VCManifestTool"
/> />
<Tool <Tool
Name="VCXDCMakeTool" Name="VCXDCMakeTool"
/> />
<Tool <Tool
Name="VCBscMakeTool" Name="VCBscMakeTool"
/> />
<Tool <Tool
Name="VCFxCopTool" Name="VCFxCopTool"
/> />
<Tool <Tool
Name="VCAppVerifierTool" Name="VCAppVerifierTool"
/> />
<Tool <Tool
Name="VCWebDeploymentTool" Name="VCWebDeploymentTool"
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
/> />
</Configuration> </Configuration>
</Configurations> </Configurations>
<References> <References>
</References> </References>
<Files> <Files>
<Filter <Filter
Name="Header Files" Name="Header Files"
> >
</Filter> </Filter>
<Filter <Filter
Name="Source Files" Name="Source Files"
> >
<File <File
RelativePath=".\src\unzip.cpp" RelativePath=".\src\unzip.cpp"
> >
</File> </File>
</Filter> </Filter>
</Files> </Files>
<Globals> <Globals>
</Globals> </Globals>
</VisualStudioProject> </VisualStudioProject>

View File

@@ -1,213 +1,212 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9.00" Version="9,00"
Name="unzip" Name="unzip"
ProjectGUID="{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}" ProjectGUID="{0CFFC7B0-04F4-4A60-B6E4-84D78EDA2C73}"
Keyword="Win32Proj" Keyword="Win32Proj"
> TargetFrameworkVersion="131072"
<Platforms> >
<Platform <Platforms>
Name="Win32" <Platform
/> Name="Win32"
</Platforms> />
<ToolFiles> </Platforms>
</ToolFiles> <ToolFiles>
<Configurations> </ToolFiles>
<Configuration <Configurations>
Name="debug_shared|Win32" <Configuration
OutputDirectory="obj\debug_shared" Name="debug_shared|Win32"
IntermediateDirectory="obj\debug_shared" OutputDirectory="obj\debug_shared"
ConfigurationType="1" IntermediateDirectory="obj\debug_shared"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" ConfigurationType="1"
UseOfMFC="2" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2" UseOfMFC="2"
> CharacterSet="2"
<Tool >
Name="VCPreBuildEventTool" <Tool
/> Name="VCPreBuildEventTool"
<Tool />
Name="VCCustomBuildTool" <Tool
/> Name="VCCustomBuildTool"
<Tool />
Name="VCXMLDataGeneratorTool" <Tool
/> Name="VCXMLDataGeneratorTool"
<Tool />
Name="VCWebServiceProxyGeneratorTool" <Tool
/> Name="VCWebServiceProxyGeneratorTool"
<Tool />
Name="VCMIDLTool" <Tool
/> Name="VCMIDLTool"
<Tool />
Name="VCCLCompilerTool" <Tool
Optimization="0" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include" Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500" AdditionalIncludeDirectories="..\..\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include"
MinimalRebuild="true" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
BasicRuntimeChecks="3" MinimalRebuild="true"
RuntimeLibrary="3" BasicRuntimeChecks="3"
BufferSecurityCheck="true" RuntimeLibrary="3"
TreatWChar_tAsBuiltInType="true" BufferSecurityCheck="true"
ForceConformanceInForLoopScope="true" TreatWChar_tAsBuiltInType="true"
RuntimeTypeInfo="true" ForceConformanceInForLoopScope="true"
UsePrecompiledHeader="0" RuntimeTypeInfo="true"
WarningLevel="3" UsePrecompiledHeader="0"
Detect64BitPortabilityProblems="false" WarningLevel="3"
DebugInformationFormat="4" Detect64BitPortabilityProblems="false"
/> DebugInformationFormat="4"
<Tool />
Name="VCManagedResourceCompilerTool" <Tool
/> Name="VCManagedResourceCompilerTool"
<Tool />
Name="VCResourceCompilerTool" <Tool
/> Name="VCResourceCompilerTool"
<Tool />
Name="VCPreLinkEventTool" <Tool
/> Name="VCPreLinkEventTool"
<Tool />
Name="VCLinkerTool" <Tool
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib PocoUtild.lib PocoZipd.lib" Name="VCLinkerTool"
OutputFile="bin/unzipd.exe" AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib PocoUtild.lib PocoZipd.lib"
LinkIncremental="2" OutputFile="bin/unzipd.exe"
AdditionalLibraryDirectories="..\..\..\lib" LinkIncremental="2"
GenerateDebugInformation="true" AdditionalLibraryDirectories="..\..\..\lib"
ProgramDatabaseFile="bin/unzipd.pdb" GenerateDebugInformation="true"
SubSystem="1" ProgramDatabaseFile="bin/unzipd.pdb"
TargetMachine="1" SubSystem="1"
/> RandomizedBaseAddress="1"
<Tool DataExecutionPrevention="0"
Name="VCALinkTool" TargetMachine="1"
/> />
<Tool <Tool
Name="VCManifestTool" Name="VCALinkTool"
/> />
<Tool <Tool
Name="VCXDCMakeTool" Name="VCManifestTool"
/> />
<Tool <Tool
Name="VCBscMakeTool" Name="VCXDCMakeTool"
/> />
<Tool <Tool
Name="VCFxCopTool" Name="VCBscMakeTool"
/> />
<Tool <Tool
Name="VCAppVerifierTool" Name="VCFxCopTool"
/> />
<Tool <Tool
Name="VCWebDeploymentTool" Name="VCAppVerifierTool"
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
/> />
</Configuration> </Configuration>
<Configuration <Configuration
Name="release_shared|Win32" Name="release_shared|Win32"
OutputDirectory="obj\release_shared" OutputDirectory="obj\release_shared"
IntermediateDirectory="obj\release_shared" IntermediateDirectory="obj\release_shared"
ConfigurationType="1" ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="2" UseOfMFC="2"
CharacterSet="2" CharacterSet="2"
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
/> />
<Tool <Tool
Name="VCXMLDataGeneratorTool" Name="VCXMLDataGeneratorTool"
/> />
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool" Name="VCWebServiceProxyGeneratorTool"
/> />
<Tool <Tool
Name="VCMIDLTool" Name="VCMIDLTool"
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="4" Optimization="4"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="true" OmitFramePointers="true"
AdditionalIncludeDirectories="..\..\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include" AdditionalIncludeDirectories="..\..\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
StringPooling="true" StringPooling="true"
RuntimeLibrary="2" RuntimeLibrary="2"
BufferSecurityCheck="false" BufferSecurityCheck="false"
TreatWChar_tAsBuiltInType="true" TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true" ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true" RuntimeTypeInfo="true"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="false" Detect64BitPortabilityProblems="false"
DebugInformationFormat="3" DebugInformationFormat="3"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
/> />
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="PocoFoundation.lib PocoXML.lib PocoUtil.lib PocoZip.lib" AdditionalDependencies="PocoFoundation.lib PocoXML.lib PocoUtil.lib PocoZip.lib"
OutputFile="bin/unzip.exe" OutputFile="bin/unzip.exe"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\lib" AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="false" GenerateDebugInformation="false"
ProgramDatabaseFile="" ProgramDatabaseFile=""
SubSystem="1" SubSystem="1"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"
TargetMachine="1" RandomizedBaseAddress="1"
/> DataExecutionPrevention="0"
<Tool TargetMachine="1"
Name="VCALinkTool" />
/> <Tool
<Tool Name="VCALinkTool"
Name="VCManifestTool" />
/> <Tool
<Tool Name="VCManifestTool"
Name="VCXDCMakeTool" />
/> <Tool
<Tool Name="VCXDCMakeTool"
Name="VCBscMakeTool" />
/> <Tool
<Tool Name="VCBscMakeTool"
Name="VCFxCopTool" />
/> <Tool
<Tool Name="VCFxCopTool"
Name="VCAppVerifierTool" />
/> <Tool
<Tool Name="VCAppVerifierTool"
Name="VCWebDeploymentTool" />
/> <Tool
<Tool Name="VCPostBuildEventTool"
Name="VCPostBuildEventTool" />
/> </Configuration>
</Configuration> </Configurations>
</Configurations> <References>
<References> </References>
</References> <Files>
<Files> <Filter
<Filter Name="Header Files"
Name="Header Files" >
> </Filter>
</Filter> <Filter
<Filter Name="Source Files"
Name="Source Files" >
> <File
<File RelativePath=".\src\unzip.cpp"
RelativePath=".\src\unzip.cpp" >
> </File>
</File> </Filter>
</Filter> </Files>
</Files> <Globals>
<Globals> </Globals>
</Globals> </VisualStudioProject>
</VisualStudioProject>

View File

@@ -1,17 +1,17 @@
# #
# Makefile # Makefile
# #
# $Id: //poco/1.3/Zip/samples/zip/Makefile#1 $ # $Id: //poco/Main/Zip/samples/zip/Makefile#1 $
# #
# Makefile for Poco SampleApp # Makefile for Poco SampleApp
# #
include $(POCO_BASE)/build/rules/global include $(POCO_BASE)/build/rules/global
objects = zip objects = zip
target = zip target = zip
target_version = 1 target_version = 1
target_libs = PocoZip PocoUtil PocoXML PocoFoundation target_libs = PocoZip PocoUtil PocoXML PocoFoundation
include $(POCO_BASE)/build/rules/exec include $(POCO_BASE)/build/rules/exec

View File

@@ -1,183 +1,183 @@
// //
// zip.cpp // zip.cpp
// //
// $Id: //poco/1.3/Zip/samples/zip/src/zip.cpp#3 $ // $Id: //poco/Main/Zip/samples/zip/src/zip.cpp#4 $
// //
// This sample demonstrates the Compress class. // This sample demonstrates the Compress class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/Util/Application.h" #include "Poco/Util/Application.h"
#include "Poco/Util/Option.h" #include "Poco/Util/Option.h"
#include "Poco/Util/OptionSet.h" #include "Poco/Util/OptionSet.h"
#include "Poco/Util/HelpFormatter.h" #include "Poco/Util/HelpFormatter.h"
#include "Poco/Util/AbstractConfiguration.h" #include "Poco/Util/AbstractConfiguration.h"
#include "Poco/AutoPtr.h" #include "Poco/AutoPtr.h"
#include "Poco/Zip/Compress.h" #include "Poco/Zip/Compress.h"
#include "Poco/Path.h" #include "Poco/Path.h"
#include "Poco/File.h" #include "Poco/File.h"
#include "Poco/Delegate.h" #include "Poco/Delegate.h"
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
using Poco::Util::Application; using Poco::Util::Application;
using Poco::Util::Option; using Poco::Util::Option;
using Poco::Util::OptionSet; using Poco::Util::OptionSet;
using Poco::Util::HelpFormatter; using Poco::Util::HelpFormatter;
using Poco::Util::AbstractConfiguration; using Poco::Util::AbstractConfiguration;
using Poco::Util::OptionCallback; using Poco::Util::OptionCallback;
using Poco::AutoPtr; using Poco::AutoPtr;
class ZipApp: public Application class ZipApp: public Application
/// This sample demonstrates some of the features of the Util::Application class, /// This sample demonstrates some of the features of the Util::Application class,
/// such as configuration file handling and command line arguments processing. /// such as configuration file handling and command line arguments processing.
/// ///
/// Try zip --help (on Unix platforms) or zip /help (elsewhere) for /// Try zip --help (on Unix platforms) or zip /help (elsewhere) for
/// more information. /// more information.
{ {
public: public:
ZipApp(): _helpRequested(false) ZipApp(): _helpRequested(false)
{ {
} }
protected: protected:
void initialize(Application& self) void initialize(Application& self)
{ {
loadConfiguration(); // load default configuration files, if present loadConfiguration(); // load default configuration files, if present
Application::initialize(self); Application::initialize(self);
// add your own initialization code here // add your own initialization code here
} }
void uninitialize() void uninitialize()
{ {
// add your own uninitialization code here // add your own uninitialization code here
Application::uninitialize(); Application::uninitialize();
} }
void reinitialize(Application& self) void reinitialize(Application& self)
{ {
Application::reinitialize(self); Application::reinitialize(self);
// add your own reinitialization code here // add your own reinitialization code here
} }
void defineOptions(OptionSet& options) void defineOptions(OptionSet& options)
{ {
Application::defineOptions(options); Application::defineOptions(options);
options.addOption( options.addOption(
Option("help", "h", "display help information on command line arguments") Option("help", "h", "display help information on command line arguments")
.required(false) .required(false)
.repeatable(false) .repeatable(false)
.callback(OptionCallback<ZipApp>(this, &ZipApp::handleHelp))); .callback(OptionCallback<ZipApp>(this, &ZipApp::handleHelp)));
options.addOption( options.addOption(
Option("file", "f", "specifies the output zip file") Option("file", "f", "specifies the output zip file")
.required(true) .required(true)
.repeatable(false) .repeatable(false)
.argument("filename") .argument("filename")
.callback(OptionCallback<ZipApp>(this, &ZipApp::handleFile))); .callback(OptionCallback<ZipApp>(this, &ZipApp::handleFile)));
} }
void handleHelp(const std::string& name, const std::string& value) void handleHelp(const std::string& name, const std::string& value)
{ {
_helpRequested = true; _helpRequested = true;
displayHelp(); displayHelp();
stopOptionsProcessing(); stopOptionsProcessing();
} }
void handleFile(const std::string& name, const std::string& value) void handleFile(const std::string& name, const std::string& value)
{ {
_outFile = value; _outFile = value;
} }
void displayHelp() void displayHelp()
{ {
HelpFormatter helpFormatter(options()); HelpFormatter helpFormatter(options());
helpFormatter.setCommand(commandName()); helpFormatter.setCommand(commandName());
helpFormatter.setUsage("OPTIONS <set of input files>"); helpFormatter.setUsage("OPTIONS <set of input files>");
helpFormatter.setHeader("A application that demonstrates usage of Poco::Zip::Compress class."); helpFormatter.setHeader("A application that demonstrates usage of Poco::Zip::Compress class.");
helpFormatter.format(std::cout); helpFormatter.format(std::cout);
} }
void onDone(const void*, const Poco::Zip::ZipLocalFileHeader& hdr) void onDone(const void*, const Poco::Zip::ZipLocalFileHeader& hdr)
{ {
logger().information("DONE: " + hdr.getFileName()); logger().information("DONE: " + hdr.getFileName());
} }
int main(const std::vector<std::string>& args) int main(const std::vector<std::string>& args)
{ {
if (!_helpRequested) if (!_helpRequested)
{ {
if (args.empty()) if (args.empty())
{ {
logger().warning("No input files specified for compression"); logger().warning("No input files specified for compression");
} }
else else
{ {
std::ofstream out(_outFile.c_str(), std::ios::binary); std::ofstream out(_outFile.c_str(), std::ios::binary);
Poco::Zip::Compress c(out, true); Poco::Zip::Compress c(out, true);
c.EDone += Poco::Delegate<ZipApp, const Poco::Zip::ZipLocalFileHeader>(this, &ZipApp::onDone); c.EDone += Poco::Delegate<ZipApp, const Poco::Zip::ZipLocalFileHeader>(this, &ZipApp::onDone);
for (std::vector<std::string>::const_iterator it = args.begin(); it != args.end(); ++it) for (std::vector<std::string>::const_iterator it = args.begin(); it != args.end(); ++it)
{ {
// no WILDCARD support! // no WILDCARD support!
Poco::File aFile(*it); Poco::File aFile(*it);
if (!aFile.exists()) if (!aFile.exists())
{ {
logger().error("File not found: " + *it); logger().error("File not found: " + *it);
} }
else else
{ {
Poco::Path anEntry(*it); Poco::Path anEntry(*it);
if (aFile.isDirectory()) if (aFile.isDirectory())
{ {
anEntry.makeDirectory(); anEntry.makeDirectory();
c.addRecursive(anEntry, Poco::Zip::ZipCommon::CL_MAXIMUM, (args.size() != 1)); // add root if we have more than one entry c.addRecursive(anEntry, Poco::Zip::ZipCommon::CL_MAXIMUM, (args.size() != 1)); // add root if we have more than one entry
} }
else else
{ {
anEntry.makeFile(); anEntry.makeFile();
c.addFile(anEntry, anEntry); c.addFile(anEntry, anEntry);
} }
} }
} }
c.close(); c.close();
c.EDone -= Poco::Delegate<ZipApp, const Poco::Zip::ZipLocalFileHeader>(this, &ZipApp::onDone); c.EDone -= Poco::Delegate<ZipApp, const Poco::Zip::ZipLocalFileHeader>(this, &ZipApp::onDone);
} }
} }
return Application::EXIT_OK; return Application::EXIT_OK;
} }
private: private:
bool _helpRequested; bool _helpRequested;
std::string _outFile; std::string _outFile;
}; };
POCO_APP_MAIN(ZipApp) POCO_APP_MAIN(ZipApp)

View File

@@ -1,145 +1,145 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="7.10" Version="7.10"
Name="zip" Name="zip"
ProjectGUID="{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}" ProjectGUID="{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}"
Keyword="Win32Proj"> Keyword="Win32Proj">
<Platforms> <Platforms>
<Platform <Platform
Name="Win32"/> Name="Win32"/>
</Platforms> </Platforms>
<Configurations> <Configurations>
<Configuration <Configuration
Name="debug_shared|Win32" Name="debug_shared|Win32"
OutputDirectory="obj\debug_shared" OutputDirectory="obj\debug_shared"
IntermediateDirectory="obj\debug_shared" IntermediateDirectory="obj\debug_shared"
ConfigurationType="1" ConfigurationType="1"
UseOfMFC="2" UseOfMFC="2"
CharacterSet="2"> CharacterSet="2">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Zip\include" AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Zip\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
MinimalRebuild="TRUE" MinimalRebuild="TRUE"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
BufferSecurityCheck="TRUE" BufferSecurityCheck="TRUE"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE" ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE" RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="TRUE" Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/> DebugInformationFormat="4"/>
<Tool <Tool
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib PocoUtild.lib PocoZipd.lib" AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib PocoUtild.lib PocoZipd.lib"
OutputFile="bin/zipd.exe" OutputFile="bin/zipd.exe"
LinkIncremental="2" LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\lib" AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="TRUE" GenerateDebugInformation="TRUE"
ProgramDatabaseFile="bin/zipd.pdb" ProgramDatabaseFile="bin/zipd.pdb"
SubSystem="1" SubSystem="1"
TargetMachine="1"/> TargetMachine="1"/>
<Tool <Tool
Name="VCMIDLTool"/> Name="VCMIDLTool"/>
<Tool <Tool
Name="VCPostBuildEventTool"/> Name="VCPostBuildEventTool"/>
<Tool <Tool
Name="VCPreBuildEventTool"/> Name="VCPreBuildEventTool"/>
<Tool <Tool
Name="VCPreLinkEventTool"/> Name="VCPreLinkEventTool"/>
<Tool <Tool
Name="VCResourceCompilerTool"/> Name="VCResourceCompilerTool"/>
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool"/> Name="VCWebServiceProxyGeneratorTool"/>
<Tool <Tool
Name="VCXMLDataGeneratorTool"/> Name="VCXMLDataGeneratorTool"/>
<Tool <Tool
Name="VCWebDeploymentTool"/> Name="VCWebDeploymentTool"/>
<Tool <Tool
Name="VCManagedWrapperGeneratorTool"/> Name="VCManagedWrapperGeneratorTool"/>
<Tool <Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/> Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration> </Configuration>
<Configuration <Configuration
Name="release_shared|Win32" Name="release_shared|Win32"
OutputDirectory="obj\release_shared" OutputDirectory="obj\release_shared"
IntermediateDirectory="obj\release_shared" IntermediateDirectory="obj\release_shared"
ConfigurationType="1" ConfigurationType="1"
UseOfMFC="2" UseOfMFC="2"
CharacterSet="2"> CharacterSet="2">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="4" Optimization="4"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE" EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="TRUE" OmitFramePointers="TRUE"
OptimizeForWindowsApplication="TRUE" OptimizeForWindowsApplication="TRUE"
AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Zip\include" AdditionalIncludeDirectories=".\include;..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\..\Zip\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
StringPooling="TRUE" StringPooling="TRUE"
RuntimeLibrary="2" RuntimeLibrary="2"
BufferSecurityCheck="FALSE" BufferSecurityCheck="FALSE"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE" ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE" RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="TRUE" Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/> DebugInformationFormat="3"/>
<Tool <Tool
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="PocoFoundation.lib PocoXML.lib PocoUtil.lib PocoZip.lib" AdditionalDependencies="PocoFoundation.lib PocoXML.lib PocoUtil.lib PocoZip.lib"
OutputFile="bin/zip.exe" OutputFile="bin/zip.exe"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\lib" AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="FALSE" GenerateDebugInformation="FALSE"
ProgramDatabaseFile="" ProgramDatabaseFile=""
SubSystem="1" SubSystem="1"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"
TargetMachine="1"/> TargetMachine="1"/>
<Tool <Tool
Name="VCMIDLTool"/> Name="VCMIDLTool"/>
<Tool <Tool
Name="VCPostBuildEventTool"/> Name="VCPostBuildEventTool"/>
<Tool <Tool
Name="VCPreBuildEventTool"/> Name="VCPreBuildEventTool"/>
<Tool <Tool
Name="VCPreLinkEventTool"/> Name="VCPreLinkEventTool"/>
<Tool <Tool
Name="VCResourceCompilerTool"/> Name="VCResourceCompilerTool"/>
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool"/> Name="VCWebServiceProxyGeneratorTool"/>
<Tool <Tool
Name="VCXMLDataGeneratorTool"/> Name="VCXMLDataGeneratorTool"/>
<Tool <Tool
Name="VCWebDeploymentTool"/> Name="VCWebDeploymentTool"/>
<Tool <Tool
Name="VCManagedWrapperGeneratorTool"/> Name="VCManagedWrapperGeneratorTool"/>
<Tool <Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/> Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration> </Configuration>
</Configurations> </Configurations>
<References> <References>
</References> </References>
<Files> <Files>
<Filter <Filter
Name="Source Files" Name="Source Files"
Filter=""> Filter="">
<File <File
RelativePath=".\src\zip.cpp"> RelativePath=".\src\zip.cpp">
</File> </File>
</Filter> </Filter>
</Files> </Files>
<Globals> <Globals>
</Globals> </Globals>
</VisualStudioProject> </VisualStudioProject>

View File

@@ -1,209 +1,209 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="8,00" Version="8,00"
Name="zip" Name="zip"
ProjectGUID="{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}" ProjectGUID="{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}"
Keyword="Win32Proj" Keyword="Win32Proj"
> >
<Platforms> <Platforms>
<Platform <Platform
Name="Win32" Name="Win32"
/> />
</Platforms> </Platforms>
<ToolFiles> <ToolFiles>
</ToolFiles> </ToolFiles>
<Configurations> <Configurations>
<Configuration <Configuration
Name="debug_shared|Win32" Name="debug_shared|Win32"
OutputDirectory="obj\debug_shared" OutputDirectory="obj\debug_shared"
IntermediateDirectory="obj\debug_shared" IntermediateDirectory="obj\debug_shared"
ConfigurationType="1" ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="2" UseOfMFC="2"
CharacterSet="2" CharacterSet="2"
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
/> />
<Tool <Tool
Name="VCXMLDataGeneratorTool" Name="VCXMLDataGeneratorTool"
/> />
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool" Name="VCWebServiceProxyGeneratorTool"
/> />
<Tool <Tool
Name="VCMIDLTool" Name="VCMIDLTool"
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\include" AdditionalIncludeDirectories="..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
BufferSecurityCheck="true" BufferSecurityCheck="true"
TreatWChar_tAsBuiltInType="true" TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true" ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true" RuntimeTypeInfo="true"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="true" Detect64BitPortabilityProblems="true"
DebugInformationFormat="4" DebugInformationFormat="4"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
/> />
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib PocoUtild.lib PocoZipd.lib" AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib PocoUtild.lib PocoZipd.lib"
OutputFile="bin/zipd.exe" OutputFile="bin/zipd.exe"
LinkIncremental="2" LinkIncremental="2"
AdditionalLibraryDirectories="..\..\..\lib" AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="bin/zipd.pdb" ProgramDatabaseFile="bin/zipd.pdb"
SubSystem="1" SubSystem="1"
TargetMachine="1" TargetMachine="1"
/> />
<Tool <Tool
Name="VCALinkTool" Name="VCALinkTool"
/> />
<Tool <Tool
Name="VCManifestTool" Name="VCManifestTool"
/> />
<Tool <Tool
Name="VCXDCMakeTool" Name="VCXDCMakeTool"
/> />
<Tool <Tool
Name="VCBscMakeTool" Name="VCBscMakeTool"
/> />
<Tool <Tool
Name="VCFxCopTool" Name="VCFxCopTool"
/> />
<Tool <Tool
Name="VCAppVerifierTool" Name="VCAppVerifierTool"
/> />
<Tool <Tool
Name="VCWebDeploymentTool" Name="VCWebDeploymentTool"
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
/> />
</Configuration> </Configuration>
<Configuration <Configuration
Name="release_shared|Win32" Name="release_shared|Win32"
OutputDirectory="obj\release_shared" OutputDirectory="obj\release_shared"
IntermediateDirectory="obj\release_shared" IntermediateDirectory="obj\release_shared"
ConfigurationType="1" ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="2" UseOfMFC="2"
CharacterSet="2" CharacterSet="2"
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
/> />
<Tool <Tool
Name="VCXMLDataGeneratorTool" Name="VCXMLDataGeneratorTool"
/> />
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool" Name="VCWebServiceProxyGeneratorTool"
/> />
<Tool <Tool
Name="VCMIDLTool" Name="VCMIDLTool"
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="4" Optimization="4"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="true" OmitFramePointers="true"
AdditionalIncludeDirectories="..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\include" AdditionalIncludeDirectories="..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
StringPooling="true" StringPooling="true"
RuntimeLibrary="2" RuntimeLibrary="2"
BufferSecurityCheck="false" BufferSecurityCheck="false"
TreatWChar_tAsBuiltInType="true" TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true" ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true" RuntimeTypeInfo="true"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="true" Detect64BitPortabilityProblems="true"
DebugInformationFormat="3" DebugInformationFormat="3"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
/> />
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="PocoFoundation.lib PocoXML.lib PocoUtil.lib PocoZip.lib" AdditionalDependencies="PocoFoundation.lib PocoXML.lib PocoUtil.lib PocoZip.lib"
OutputFile="bin/zip.exe" OutputFile="bin/zip.exe"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\lib" AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="false" GenerateDebugInformation="false"
ProgramDatabaseFile="" ProgramDatabaseFile=""
SubSystem="1" SubSystem="1"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"
TargetMachine="1" TargetMachine="1"
/> />
<Tool <Tool
Name="VCALinkTool" Name="VCALinkTool"
/> />
<Tool <Tool
Name="VCManifestTool" Name="VCManifestTool"
/> />
<Tool <Tool
Name="VCXDCMakeTool" Name="VCXDCMakeTool"
/> />
<Tool <Tool
Name="VCBscMakeTool" Name="VCBscMakeTool"
/> />
<Tool <Tool
Name="VCFxCopTool" Name="VCFxCopTool"
/> />
<Tool <Tool
Name="VCAppVerifierTool" Name="VCAppVerifierTool"
/> />
<Tool <Tool
Name="VCWebDeploymentTool" Name="VCWebDeploymentTool"
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
/> />
</Configuration> </Configuration>
</Configurations> </Configurations>
<References> <References>
</References> </References>
<Files> <Files>
<Filter <Filter
Name="Source Files" Name="Source Files"
> >
<File <File
RelativePath=".\src\zip.cpp" RelativePath=".\src\zip.cpp"
> >
</File> </File>
</Filter> </Filter>
</Files> </Files>
<Globals> <Globals>
</Globals> </Globals>
</VisualStudioProject> </VisualStudioProject>

View File

@@ -1,209 +1,208 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9.00" Version="9,00"
Name="zip" Name="zip"
ProjectGUID="{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}" ProjectGUID="{73408DCF-2E65-47AF-BF38-7466DAB8D5CB}"
Keyword="Win32Proj" Keyword="Win32Proj"
> TargetFrameworkVersion="131072"
<Platforms> >
<Platform <Platforms>
Name="Win32" <Platform
/> Name="Win32"
</Platforms> />
<ToolFiles> </Platforms>
</ToolFiles> <ToolFiles>
<Configurations> </ToolFiles>
<Configuration <Configurations>
Name="debug_shared|Win32" <Configuration
OutputDirectory="obj\debug_shared" Name="debug_shared|Win32"
IntermediateDirectory="obj\debug_shared" OutputDirectory="obj\debug_shared"
ConfigurationType="1" IntermediateDirectory="obj\debug_shared"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" ConfigurationType="1"
UseOfMFC="2" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
CharacterSet="2" UseOfMFC="2"
> CharacterSet="2"
<Tool >
Name="VCPreBuildEventTool" <Tool
/> Name="VCPreBuildEventTool"
<Tool />
Name="VCCustomBuildTool" <Tool
/> Name="VCCustomBuildTool"
<Tool />
Name="VCXMLDataGeneratorTool" <Tool
/> Name="VCXMLDataGeneratorTool"
<Tool />
Name="VCWebServiceProxyGeneratorTool" <Tool
/> Name="VCWebServiceProxyGeneratorTool"
<Tool />
Name="VCMIDLTool" <Tool
/> Name="VCMIDLTool"
<Tool />
Name="VCCLCompilerTool" <Tool
Optimization="0" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\include" Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500" AdditionalIncludeDirectories="..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\include"
MinimalRebuild="true" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
BasicRuntimeChecks="3" MinimalRebuild="true"
RuntimeLibrary="3" BasicRuntimeChecks="3"
BufferSecurityCheck="true" RuntimeLibrary="3"
TreatWChar_tAsBuiltInType="true" BufferSecurityCheck="true"
ForceConformanceInForLoopScope="true" TreatWChar_tAsBuiltInType="true"
RuntimeTypeInfo="true" ForceConformanceInForLoopScope="true"
UsePrecompiledHeader="0" RuntimeTypeInfo="true"
WarningLevel="3" UsePrecompiledHeader="0"
Detect64BitPortabilityProblems="false" WarningLevel="3"
DebugInformationFormat="4" Detect64BitPortabilityProblems="false"
/> DebugInformationFormat="4"
<Tool />
Name="VCManagedResourceCompilerTool" <Tool
/> Name="VCManagedResourceCompilerTool"
<Tool />
Name="VCResourceCompilerTool" <Tool
/> Name="VCResourceCompilerTool"
<Tool />
Name="VCPreLinkEventTool" <Tool
/> Name="VCPreLinkEventTool"
<Tool />
Name="VCLinkerTool" <Tool
AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib PocoUtild.lib PocoZipd.lib" Name="VCLinkerTool"
OutputFile="bin/zipd.exe" AdditionalDependencies="PocoFoundationd.lib PocoXMLd.lib PocoUtild.lib PocoZipd.lib"
LinkIncremental="2" OutputFile="bin/zipd.exe"
AdditionalLibraryDirectories="..\..\..\lib" LinkIncremental="2"
GenerateDebugInformation="true" AdditionalLibraryDirectories="..\..\..\lib"
ProgramDatabaseFile="bin/zipd.pdb" GenerateDebugInformation="true"
SubSystem="1" ProgramDatabaseFile="bin/zipd.pdb"
TargetMachine="1" SubSystem="1"
/> RandomizedBaseAddress="1"
<Tool DataExecutionPrevention="0"
Name="VCALinkTool" TargetMachine="1"
/> />
<Tool <Tool
Name="VCManifestTool" Name="VCALinkTool"
/> />
<Tool <Tool
Name="VCXDCMakeTool" Name="VCManifestTool"
/> />
<Tool <Tool
Name="VCBscMakeTool" Name="VCXDCMakeTool"
/> />
<Tool <Tool
Name="VCFxCopTool" Name="VCBscMakeTool"
/> />
<Tool <Tool
Name="VCAppVerifierTool" Name="VCFxCopTool"
/> />
<Tool <Tool
Name="VCWebDeploymentTool" Name="VCAppVerifierTool"
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
/> />
</Configuration> </Configuration>
<Configuration <Configuration
Name="release_shared|Win32" Name="release_shared|Win32"
OutputDirectory="obj\release_shared" OutputDirectory="obj\release_shared"
IntermediateDirectory="obj\release_shared" IntermediateDirectory="obj\release_shared"
ConfigurationType="1" ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="2" UseOfMFC="2"
CharacterSet="2" CharacterSet="2"
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
/> />
<Tool <Tool
Name="VCXMLDataGeneratorTool" Name="VCXMLDataGeneratorTool"
/> />
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool" Name="VCWebServiceProxyGeneratorTool"
/> />
<Tool <Tool
Name="VCMIDLTool" Name="VCMIDLTool"
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="4" Optimization="4"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="true" OmitFramePointers="true"
AdditionalIncludeDirectories="..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\include" AdditionalIncludeDirectories="..\..\..\Foundation\include;..\..\..\XML\include;..\..\..\Util\include;..\..\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
StringPooling="true" StringPooling="true"
RuntimeLibrary="2" RuntimeLibrary="2"
BufferSecurityCheck="false" BufferSecurityCheck="false"
TreatWChar_tAsBuiltInType="true" TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true" ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true" RuntimeTypeInfo="true"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="false" Detect64BitPortabilityProblems="false"
DebugInformationFormat="3" DebugInformationFormat="3"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
/> />
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="PocoFoundation.lib PocoXML.lib PocoUtil.lib PocoZip.lib" AdditionalDependencies="PocoFoundation.lib PocoXML.lib PocoUtil.lib PocoZip.lib"
OutputFile="bin/zip.exe" OutputFile="bin/zip.exe"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="..\..\..\lib" AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="false" GenerateDebugInformation="false"
ProgramDatabaseFile="" ProgramDatabaseFile=""
SubSystem="1" SubSystem="1"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"
TargetMachine="1" RandomizedBaseAddress="1"
/> DataExecutionPrevention="0"
<Tool TargetMachine="1"
Name="VCALinkTool" />
/> <Tool
<Tool Name="VCALinkTool"
Name="VCManifestTool" />
/> <Tool
<Tool Name="VCManifestTool"
Name="VCXDCMakeTool" />
/> <Tool
<Tool Name="VCXDCMakeTool"
Name="VCBscMakeTool" />
/> <Tool
<Tool Name="VCBscMakeTool"
Name="VCFxCopTool" />
/> <Tool
<Tool Name="VCFxCopTool"
Name="VCAppVerifierTool" />
/> <Tool
<Tool Name="VCAppVerifierTool"
Name="VCWebDeploymentTool" />
/> <Tool
<Tool Name="VCPostBuildEventTool"
Name="VCPostBuildEventTool" />
/> </Configuration>
</Configuration> </Configurations>
</Configurations> <References>
<References> </References>
</References> <Files>
<Files> <Filter
<Filter Name="Source Files"
Name="Source Files" >
> <File
<File RelativePath=".\src\zip.cpp"
RelativePath=".\src\zip.cpp" >
> </File>
</File> </Filter>
</Filter> </Files>
</Files> <Globals>
<Globals> </Globals>
</Globals> </VisualStudioProject>
</VisualStudioProject>

View File

@@ -1,60 +1,60 @@
// //
// Add.cpp // Add.cpp
// //
// $Id: //poco/1.3/Zip/src/Add.cpp#1 $ // $Id: //poco/Main/Zip/src/Add.cpp#1 $
// //
// Library: Zip // Library: Zip
// Package: Manipulation // Package: Manipulation
// Module: Add // Module: Add
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/Zip/Add.h" #include "Poco/Zip/Add.h"
#include "Poco/Zip/Compress.h" #include "Poco/Zip/Compress.h"
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
Add::Add(const std::string& zipPath, const std::string& localPath, ZipCommon::CompressionMethod cm, ZipCommon::CompressionLevel cl): Add::Add(const std::string& zipPath, const std::string& localPath, ZipCommon::CompressionMethod cm, ZipCommon::CompressionLevel cl):
_zipPath(zipPath), _zipPath(zipPath),
_localPath(localPath), _localPath(localPath),
_cm(cm), _cm(cm),
_cl(cl) _cl(cl)
{ {
} }
void Add::execute(Compress& c, std::istream& input) void Add::execute(Compress& c, std::istream& input)
{ {
c.addFile(Poco::Path(_localPath), Poco::Path(_zipPath), _cm, _cl); c.addFile(Poco::Path(_localPath), Poco::Path(_zipPath), _cm, _cl);
} }
} } // namespace Poco::Zip } } // namespace Poco::Zip

View File

@@ -1,252 +1,252 @@
// //
// AutoDetectStream.cpp // AutoDetectStream.cpp
// //
// $Id: //poco/1.3/Zip/src/AutoDetectStream.cpp#4 $ // $Id: //poco/Main/Zip/src/AutoDetectStream.cpp#6 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: AutoDetectStream // Module: AutoDetectStream
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/Zip/AutoDetectStream.h" #include "Poco/Zip/AutoDetectStream.h"
#include "Poco/Zip/ZipLocalFileHeader.h" #include "Poco/Zip/ZipLocalFileHeader.h"
#include "Poco/Zip/ZipArchiveInfo.h" #include "Poco/Zip/ZipArchiveInfo.h"
#include "Poco/Zip/ZipDataInfo.h" #include "Poco/Zip/ZipDataInfo.h"
#include "Poco/Zip/ZipFileInfo.h" #include "Poco/Zip/ZipFileInfo.h"
#include "Poco/Exception.h" #include "Poco/Exception.h"
#include <cstring> #include <cstring>
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
AutoDetectStreamBuf::AutoDetectStreamBuf(std::istream& in, const std::string& pre, const std::string& post, bool reposition, Poco::UInt32 start): AutoDetectStreamBuf::AutoDetectStreamBuf(std::istream& in, const std::string& pre, const std::string& post, bool reposition, Poco::UInt32 start):
Poco::BufferedStreamBuf(STREAM_BUFFER_SIZE, std::ios::in), Poco::BufferedStreamBuf(STREAM_BUFFER_SIZE, std::ios::in),
_pIstr(&in), _pIstr(&in),
_pOstr(0), _pOstr(0),
_eofDetected(false), _eofDetected(false),
_matchCnt(0), _matchCnt(0),
_prefix(pre), _prefix(pre),
_postfix(post), _postfix(post),
_reposition(reposition), _reposition(reposition),
_start(start) _start(start)
{ {
} }
AutoDetectStreamBuf::AutoDetectStreamBuf(std::ostream& out): AutoDetectStreamBuf::AutoDetectStreamBuf(std::ostream& out):
Poco::BufferedStreamBuf(STREAM_BUFFER_SIZE, std::ios::out), Poco::BufferedStreamBuf(STREAM_BUFFER_SIZE, std::ios::out),
_pIstr(0), _pIstr(0),
_pOstr(&out), _pOstr(&out),
_eofDetected(false), _eofDetected(false),
_matchCnt(0), _matchCnt(0),
_prefix(), _prefix(),
_postfix(), _postfix(),
_reposition(false), _reposition(false),
_start(0u) _start(0u)
{ {
} }
AutoDetectStreamBuf::~AutoDetectStreamBuf() AutoDetectStreamBuf::~AutoDetectStreamBuf()
{ {
} }
int AutoDetectStreamBuf::readFromDevice(char* buffer, std::streamsize length) int AutoDetectStreamBuf::readFromDevice(char* buffer, std::streamsize length)
{ {
poco_assert_dbg(length >= 8); poco_assert_dbg(length >= 8);
if (_pIstr == 0 ||length == 0) return -1; if (_pIstr == 0 ||length == 0) return -1;
if (_reposition) if (_reposition)
{ {
_pIstr->seekg(_start, std::ios_base::beg); _pIstr->seekg(_start, std::ios_base::beg);
_reposition = false; _reposition = false;
} }
if (!_prefix.empty()) if (!_prefix.empty())
{ {
std::streamsize tmp = (_prefix.size() > length)? length: static_cast<std::streamsize>(_prefix.size()); std::streamsize tmp = (_prefix.size() > length)? length: static_cast<std::streamsize>(_prefix.size());
std::memcpy(buffer, _prefix.c_str(), tmp); std::memcpy(buffer, _prefix.c_str(), tmp);
_prefix = _prefix.substr(tmp); _prefix = _prefix.substr(tmp);
return tmp; return tmp;
} }
if (_eofDetected) if (_eofDetected)
{ {
if (!_postfix.empty()) if (!_postfix.empty())
{ {
std::streamsize tmp = (_postfix.size() > length)? length: static_cast<std::streamsize>(_postfix.size()); std::streamsize tmp = (_postfix.size() > length)? length: static_cast<std::streamsize>(_postfix.size());
std::memcpy(buffer, _postfix.c_str(), tmp); std::memcpy(buffer, _postfix.c_str(), tmp);
_postfix = _postfix.substr(tmp); _postfix = _postfix.substr(tmp);
return tmp; return tmp;
} }
else else
return -1; return -1;
} }
if (!_pIstr->good()) if (!_pIstr->good())
return -1; return -1;
char byte3('\x00'); char byte3('\x00');
std::streamsize tempPos = 0; std::streamsize tempPos = 0;
static std::istream::int_type eof = std::istream::traits_type::eof(); static std::istream::int_type eof = std::istream::traits_type::eof();
while (_pIstr->good() && !_pIstr->eof() && (tempPos+4) < length) while (_pIstr->good() && !_pIstr->eof() && (tempPos+4) < length)
{ {
std::istream::int_type c = _pIstr->get(); std::istream::int_type c = _pIstr->get();
if (c != eof) if (c != eof)
{ {
// all zip headers start with the same 2byte prefix // all zip headers start with the same 2byte prefix
if (_matchCnt<2) if (_matchCnt<2)
{ {
if (c == ZipLocalFileHeader::HEADER[_matchCnt]) if (c == ZipLocalFileHeader::HEADER[_matchCnt])
++_matchCnt; ++_matchCnt;
else else
{ {
// matchcnt was either 0 or 1 the headers have all unique chars -> safe to set to 0 // matchcnt was either 0 or 1 the headers have all unique chars -> safe to set to 0
if (_matchCnt == 1) if (_matchCnt == 1)
{ {
buffer[tempPos++] = ZipLocalFileHeader::HEADER[0]; buffer[tempPos++] = ZipLocalFileHeader::HEADER[0];
} }
_matchCnt = 0; _matchCnt = 0;
buffer[tempPos++] = static_cast<char>(c); buffer[tempPos++] = static_cast<char>(c);
} }
} }
else else
{ {
//the upper 2 bytes differ: the lower one must be in range 1,3,5,7, the upper must be one larger: 2,4,6,8 //the upper 2 bytes differ: the lower one must be in range 1,3,5,7, the upper must be one larger: 2,4,6,8
if (_matchCnt == 2) if (_matchCnt == 2)
{ {
if (ZipLocalFileHeader::HEADER[2] == c || if (ZipLocalFileHeader::HEADER[2] == c ||
ZipArchiveInfo::HEADER[2] == c || ZipArchiveInfo::HEADER[2] == c ||
ZipFileInfo::HEADER[2] == c || ZipFileInfo::HEADER[2] == c ||
ZipDataInfo::HEADER[2] == c) ZipDataInfo::HEADER[2] == c)
{ {
byte3 = static_cast<char>(c);; byte3 = static_cast<char>(c);;
_matchCnt++; _matchCnt++;
} }
else else
{ {
buffer[tempPos++] = ZipLocalFileHeader::HEADER[0]; buffer[tempPos++] = ZipLocalFileHeader::HEADER[0];
buffer[tempPos++] = ZipLocalFileHeader::HEADER[1]; buffer[tempPos++] = ZipLocalFileHeader::HEADER[1];
buffer[tempPos++] = static_cast<char>(c); buffer[tempPos++] = static_cast<char>(c);
_matchCnt = 0; _matchCnt = 0;
} }
} }
else if (_matchCnt == 3) else if (_matchCnt == 3)
{ {
if (c-1 == byte3) if (c-1 == byte3)
{ {
// a match, pushback // a match, pushback
_pIstr->putback(c); _pIstr->putback(c);
_pIstr->putback(byte3); _pIstr->putback(byte3);
_pIstr->putback(ZipLocalFileHeader::HEADER[1]); _pIstr->putback(ZipLocalFileHeader::HEADER[1]);
_pIstr->putback(ZipLocalFileHeader::HEADER[0]); _pIstr->putback(ZipLocalFileHeader::HEADER[0]);
_eofDetected = true; _eofDetected = true;
return tempPos; return tempPos;
} }
else else
{ {
buffer[tempPos++] = ZipLocalFileHeader::HEADER[0]; buffer[tempPos++] = ZipLocalFileHeader::HEADER[0];
buffer[tempPos++] = ZipLocalFileHeader::HEADER[1]; buffer[tempPos++] = ZipLocalFileHeader::HEADER[1];
buffer[tempPos++] = byte3; buffer[tempPos++] = byte3;
buffer[tempPos++] = c; buffer[tempPos++] = c;
_matchCnt = 0; //the headers have all unique chars -> safe to set to 0 _matchCnt = 0; //the headers have all unique chars -> safe to set to 0
} }
} }
} }
} }
} }
return tempPos; return tempPos;
} }
int AutoDetectStreamBuf::writeToDevice(const char* buffer, std::streamsize length) int AutoDetectStreamBuf::writeToDevice(const char* buffer, std::streamsize length)
{ {
if (_pOstr == 0 || length == 0) return -1; if (_pOstr == 0 || length == 0) return -1;
_pOstr->write(buffer, length); _pOstr->write(buffer, length);
if (_pOstr->good()) if (_pOstr->good())
return length; return length;
throw Poco::IOException("Failed to write to output stream"); throw Poco::IOException("Failed to write to output stream");
} }
AutoDetectIOS::AutoDetectIOS(std::istream& istr, const std::string& pre, const std::string& post, bool reposition, Poco::UInt32 start): AutoDetectIOS::AutoDetectIOS(std::istream& istr, const std::string& pre, const std::string& post, bool reposition, Poco::UInt32 start):
_buf(istr, pre, post, reposition, start) _buf(istr, pre, post, reposition, start)
{ {
poco_ios_init(&_buf); poco_ios_init(&_buf);
} }
AutoDetectIOS::AutoDetectIOS(std::ostream& ostr): _buf(ostr) AutoDetectIOS::AutoDetectIOS(std::ostream& ostr): _buf(ostr)
{ {
poco_ios_init(&_buf); poco_ios_init(&_buf);
} }
AutoDetectIOS::~AutoDetectIOS() AutoDetectIOS::~AutoDetectIOS()
{ {
} }
AutoDetectStreamBuf* AutoDetectIOS::rdbuf() AutoDetectStreamBuf* AutoDetectIOS::rdbuf()
{ {
return &_buf; return &_buf;
} }
AutoDetectInputStream::AutoDetectInputStream(std::istream& istr, const std::string& pre, const std::string& post, bool reposition, Poco::UInt32 start): AutoDetectInputStream::AutoDetectInputStream(std::istream& istr, const std::string& pre, const std::string& post, bool reposition, Poco::UInt32 start):
AutoDetectIOS(istr, pre, post, reposition, start), AutoDetectIOS(istr, pre, post, reposition, start),
std::istream(&_buf) std::istream(&_buf)
{ {
} }
AutoDetectInputStream::~AutoDetectInputStream() AutoDetectInputStream::~AutoDetectInputStream()
{ {
} }
AutoDetectOutputStream::AutoDetectOutputStream(std::ostream& ostr): AutoDetectOutputStream::AutoDetectOutputStream(std::ostream& ostr):
AutoDetectIOS(ostr), AutoDetectIOS(ostr),
std::ostream(&_buf) std::ostream(&_buf)
{ {
} }
AutoDetectOutputStream::~AutoDetectOutputStream() AutoDetectOutputStream::~AutoDetectOutputStream()
{ {
} }
} } // namespace Poco::Zip } } // namespace Poco::Zip

View File

@@ -314,9 +314,7 @@ ZipArchive Compress::close()
std::string centr(central.createHeader()); std::string centr(central.createHeader());
_out.write(centr.c_str(), static_cast<std::streamsize>(centr.size())); _out.write(centr.c_str(), static_cast<std::streamsize>(centr.size()));
_out.flush(); _out.flush();
// SunPro C++ fix _dirs.insert(std::make_pair(0, central));
std::pair<UInt16, ZipArchiveInfo> par(0, central);
_dirs.insert(par);
return ZipArchive(_files, _infos, _dirs); return ZipArchive(_files, _infos, _dirs);
} }

View File

@@ -1,194 +1,193 @@
// //
// Decompress.cpp // Decompress.cpp
// //
// $Id: //poco/1.3/Zip/src/Decompress.cpp#4 $ // $Id: //poco/Main/Zip/src/Decompress.cpp#6 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: Decompress // Module: Decompress
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/Zip/Decompress.h" #include "Poco/Zip/Decompress.h"
#include "Poco/Zip/ZipLocalFileHeader.h" #include "Poco/Zip/ZipLocalFileHeader.h"
#include "Poco/Zip/ZipArchive.h" #include "Poco/Zip/ZipArchive.h"
#include "Poco/Zip/ZipStream.h" #include "Poco/Zip/ZipStream.h"
#include "Poco/Zip/ZipException.h" #include "Poco/Zip/ZipException.h"
#include "Poco/File.h" #include "Poco/File.h"
#include "Poco/Exception.h" #include "Poco/Exception.h"
#include "Poco/StreamCopier.h" #include "Poco/StreamCopier.h"
#include "Poco/Delegate.h" #include "Poco/Delegate.h"
#include <fstream> #include <fstream>
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
Decompress::Decompress(std::istream& in, const Poco::Path& outputDir, bool flattenDirs, bool keepIncompleteFiles): Decompress::Decompress(std::istream& in, const Poco::Path& outputDir, bool flattenDirs, bool keepIncompleteFiles):
_in(in), _in(in),
_outDir(outputDir), _outDir(outputDir),
_flattenDirs(flattenDirs), _flattenDirs(flattenDirs),
_keepIncompleteFiles(keepIncompleteFiles), _keepIncompleteFiles(keepIncompleteFiles),
_mapping() _mapping()
{ {
_outDir.makeAbsolute(); _outDir.makeAbsolute();
poco_assert (_in.good()); _outDir.makeDirectory();
Poco::File tmp(_outDir); poco_assert (_in.good());
if (!tmp.exists()) Poco::File tmp(_outDir);
{ if (!tmp.exists())
tmp.createDirectories(); {
} tmp.createDirectories();
if (!tmp.isDirectory()) }
throw Poco::IOException("Failed to create/open directory: " + _outDir.toString()); if (!tmp.isDirectory())
EOk += Poco::Delegate<Decompress, std::pair<const ZipLocalFileHeader, const Poco::Path> >(this, &Decompress::onOk); throw Poco::IOException("Failed to create/open directory: " + _outDir.toString());
EOk += Poco::Delegate<Decompress, std::pair<const ZipLocalFileHeader, const Poco::Path> >(this, &Decompress::onOk);
}
}
Decompress::~Decompress()
{ Decompress::~Decompress()
EOk -= Poco::Delegate<Decompress, std::pair<const ZipLocalFileHeader, const Poco::Path> >(this, &Decompress::onOk); {
} EOk -= Poco::Delegate<Decompress, std::pair<const ZipLocalFileHeader, const Poco::Path> >(this, &Decompress::onOk);
}
ZipArchive Decompress::decompressAllFiles()
{ ZipArchive Decompress::decompressAllFiles()
poco_assert (_mapping.empty()); {
ZipArchive arch(_in, *this); poco_assert (_mapping.empty());
return arch; ZipArchive arch(_in, *this);
} return arch;
}
bool Decompress::handleZipEntry(std::istream& zipStream, const ZipLocalFileHeader& hdr)
{ bool Decompress::handleZipEntry(std::istream& zipStream, const ZipLocalFileHeader& hdr)
if (hdr.isDirectory()) {
{ if (hdr.isDirectory())
// directory have 0 size, nth to read {
if (!_flattenDirs) // directory have 0 size, nth to read
{ if (!_flattenDirs)
std::string dirName = hdr.getFileName(); {
if (dirName.find(ZipCommon::ILLEGAL_PATH) != std::string::npos) std::string dirName = hdr.getFileName();
throw ZipException("Illegal entry name " + dirName + " containing " + ZipCommon::ILLEGAL_PATH); if (dirName.find(ZipCommon::ILLEGAL_PATH) != std::string::npos)
Poco::Path dir(dirName); throw ZipException("Illegal entry name " + dirName + " containing " + ZipCommon::ILLEGAL_PATH);
dir.makeDirectory(); Poco::Path dir(_outDir, dirName);
Poco::File aFile(dir); dir.makeDirectory();
aFile.createDirectories(); Poco::File aFile(dir);
} aFile.createDirectories();
return true; }
} return true;
try }
{ try
std::string fileName = hdr.getFileName(); {
if (_flattenDirs) std::string fileName = hdr.getFileName();
{ if (_flattenDirs)
// remove path info {
Poco::Path p(fileName); // remove path info
p.makeFile(); Poco::Path p(fileName);
fileName = p.getFileName(); p.makeFile();
} fileName = p.getFileName();
}
if (fileName.find(ZipCommon::ILLEGAL_PATH) != std::string::npos)
throw ZipException("Illegal entry name " + fileName + " containing " + ZipCommon::ILLEGAL_PATH); if (fileName.find(ZipCommon::ILLEGAL_PATH) != std::string::npos)
throw ZipException("Illegal entry name " + fileName + " containing " + ZipCommon::ILLEGAL_PATH);
Poco::Path file(fileName);
file.makeFile(); Poco::Path file(fileName);
Poco::Path dest(_outDir, file); file.makeFile();
dest.makeFile(); Poco::Path dest(_outDir, file);
if (dest.depth() > 0) dest.makeFile();
{ if (dest.depth() > 0)
Poco::File aFile(dest.parent()); {
aFile.createDirectories(); Poco::File aFile(dest.parent());
} aFile.createDirectories();
std::ofstream out(dest.toString().c_str(), std::ios::binary); }
if (!out) std::ofstream out(dest.toString().c_str(), std::ios::binary);
{ if (!out)
std::pair<const ZipLocalFileHeader, const std::string> tmp(hdr, "Failed to open output stream " + dest.toString()); {
EError.notify(this, tmp); std::pair<const ZipLocalFileHeader, const std::string> tmp = std::make_pair(hdr, "Failed to open output stream " + dest.toString());
return false; EError.notify(this, tmp);
} return false;
ZipInputStream inp(zipStream, hdr, false); }
Poco::StreamCopier::copyStream(inp, out); ZipInputStream inp(zipStream, hdr, false);
out.close(); Poco::StreamCopier::copyStream(inp, out);
Poco::File aFile(file); out.close();
if (!aFile.exists() || !aFile.isFile()) Poco::File aFile(file);
{ if (!aFile.exists() || !aFile.isFile())
std::pair<const ZipLocalFileHeader, const std::string> tmp(hdr, "Failed to create output stream " + dest.toString()); {
EError.notify(this, tmp); std::pair<const ZipLocalFileHeader, const std::string> tmp = std::make_pair(hdr, "Failed to create output stream " + dest.toString());
return false; EError.notify(this, tmp);
} return false;
}
if (!inp.crcValid())
{ if (!inp.crcValid())
if (!_keepIncompleteFiles) {
aFile.remove(); if (!_keepIncompleteFiles)
std::pair<const ZipLocalFileHeader, const std::string> tmp(hdr, "CRC mismatch. Corrupt file: " + dest.toString()); aFile.remove();
EError.notify(this, tmp); std::pair<const ZipLocalFileHeader, const std::string> tmp = std::make_pair(hdr, "CRC mismatch. Corrupt file: " + dest.toString());
return false; EError.notify(this, tmp);
} return false;
}
// cannot check against hdr.getUnCompressedSize if CRC and size are not set in hdr but in a ZipDataInfo
// crc is typically enough to detect errors // cannot check against hdr.getUnCompressedSize if CRC and size are not set in hdr but in a ZipDataInfo
if (aFile.getSize() != hdr.getUncompressedSize() && !hdr.searchCRCAndSizesAfterData()) // crc is typically enough to detect errors
{ if (aFile.getSize() != hdr.getUncompressedSize() && !hdr.searchCRCAndSizesAfterData())
if (!_keepIncompleteFiles) {
aFile.remove(); if (!_keepIncompleteFiles)
std::pair<const ZipLocalFileHeader, const std::string> tmp(hdr, "Filesizes do not match. Corrupt file: " + dest.toString()); aFile.remove();
EError.notify(this, tmp); std::pair<const ZipLocalFileHeader, const std::string> tmp = std::make_pair(hdr, "Filesizes do not match. Corrupt file: " + dest.toString());
return false; EError.notify(this, tmp);
} return false;
}
std::pair<const ZipLocalFileHeader, const Poco::Path> tmp(hdr, file);
EOk.notify(this, tmp); std::pair<const ZipLocalFileHeader, const Poco::Path> tmp = std::make_pair(hdr, file);
} EOk.notify(this, tmp);
catch (Poco::Exception& e) }
{ catch (Poco::Exception& e)
std::pair<const ZipLocalFileHeader, const std::string> tmp(hdr, "Exception: " + e.displayText()); {
EError.notify(this, tmp); std::pair<const ZipLocalFileHeader, const std::string> tmp = std::make_pair(hdr, std::string("Exception: " + e.displayText()));
return false; EError.notify(this, tmp);
} return false;
catch (...) }
{ catch (...)
std::pair<const ZipLocalFileHeader, const std::string> tmp(hdr, "Unknown Exception"); {
EError.notify(this, tmp); std::pair<const ZipLocalFileHeader, const std::string> tmp = std::make_pair(hdr, std::string("Unknown Exception"));
return false; EError.notify(this, tmp);
} return false;
}
return true;
} return true;
}
void Decompress::onOk(const void*, std::pair<const ZipLocalFileHeader, const Poco::Path>& val)
{ void Decompress::onOk(const void*, std::pair<const ZipLocalFileHeader, const Poco::Path>& val)
// std::pair<std::string,Poco::Path> par(val.first.getFileName(), val.second); {
ZipMapping::value_type p(val.first.getFileName(), val.second); _mapping.insert(std::make_pair(val.first.getFileName(), val.second));
_mapping.insert(p); }
}
} } // namespace Poco::Zip
} } // namespace Poco::Zip

View File

@@ -1,63 +1,56 @@
// //
// Delete.cpp // Delete.cpp
// //
// $Id: //poco/1.3/Zip/src/Delete.cpp#1 $ // $Id: //poco/Main/Zip/src/Delete.cpp#2 $
// //
// Library: Zip // Library: Zip
// Package: Manipulation // Package: Manipulation
// Module: Delete // Module: Delete
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/Zip/Delete.h" #include "Poco/Zip/Delete.h"
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
Delete::Delete(const ZipLocalFileHeader& hdr): Delete::Delete(const ZipLocalFileHeader& hdr):
_hdr(hdr) _hdr(hdr)
{ {
} }
void Delete::execute(Compress& c, std::istream& input) void Delete::execute(Compress& c, std::istream& input)
{ {
// due to absolute positioning in compress we don't need to do this // due to absolute positioning in compress we don't need to do anything
/* }
input.seekg(_hdr.getEndPos(), std::ios_base::beg);
if (_hdr.searchCRCAndSizesAfterData())
{ } } // namespace Poco::Zip
ZipDataInfo info(in, false);
}
*/
}
} } // namespace Poco::Zip

View File

@@ -1,59 +1,59 @@
// //
// Keep.cpp // Keep.cpp
// //
// $Id: //poco/1.3/Zip/src/Keep.cpp#1 $ // $Id: //poco/Main/Zip/src/Keep.cpp#1 $
// //
// Library: Zip // Library: Zip
// Package: Manipulation // Package: Manipulation
// Module: Keep // Module: Keep
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/Zip/Keep.h" #include "Poco/Zip/Keep.h"
#include "Poco/Zip/Compress.h" #include "Poco/Zip/Compress.h"
#include "Poco/Buffer.h" #include "Poco/Buffer.h"
#include "Poco/StreamCopier.h" #include "Poco/StreamCopier.h"
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
Keep::Keep(const ZipLocalFileHeader& hdr): Keep::Keep(const ZipLocalFileHeader& hdr):
_hdr(hdr) _hdr(hdr)
{ {
} }
void Keep::execute(Compress& c, std::istream& input) void Keep::execute(Compress& c, std::istream& input)
{ {
c.addFileRaw(input, _hdr, _hdr.getFileName()); c.addFileRaw(input, _hdr, _hdr.getFileName());
} }
} } // namespace Poco::Zip } } // namespace Poco::Zip

View File

@@ -1,54 +1,54 @@
// //
// ParseCallback.cpp // ParseCallback.cpp
// //
// $Id: //poco/1.3/Zip/src/ParseCallback.cpp#3 $ // $Id: //poco/Main/Zip/src/ParseCallback.cpp#4 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: ParseCallback // Module: ParseCallback
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/Zip/ParseCallback.h" #include "Poco/Zip/ParseCallback.h"
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
ParseCallback::ParseCallback() ParseCallback::ParseCallback()
{ {
} }
ParseCallback::~ParseCallback() ParseCallback::~ParseCallback()
{ {
} }
} } // namespace Poco::Zip } } // namespace Poco::Zip

View File

@@ -1,269 +1,269 @@
// //
// PartialStream.cpp // PartialStream.cpp
// //
// $Id: //poco/1.3/Zip/src/PartialStream.cpp#3 $ // $Id: //poco/Main/Zip/src/PartialStream.cpp#8 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: PartialStream // Module: PartialStream
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/Zip/PartialStream.h" #include "Poco/Zip/PartialStream.h"
#include "Poco/Exception.h" #include "Poco/Exception.h"
#include <cstring> #include <cstring>
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
PartialStreamBuf::PartialStreamBuf(std::istream& in, std::ios::pos_type start, std::ios::pos_type end, const std::string& pre, const std::string& post, bool initStream): PartialStreamBuf::PartialStreamBuf(std::istream& in, std::ios::pos_type start, std::ios::pos_type end, const std::string& pre, const std::string& post, bool initStream):
Poco::BufferedStreamBuf(STREAM_BUFFER_SIZE, std::ios::in), Poco::BufferedStreamBuf(STREAM_BUFFER_SIZE, std::ios::in),
_initialized(!initStream), _initialized(!initStream),
_start(start), _start(start),
_numBytes(end-start), _numBytes(end-start),
_bytesWritten(0), _bytesWritten(0),
_pIstr(&in), _pIstr(&in),
_pOstr(0), _pOstr(0),
_prefix(pre), _prefix(pre),
_postfix(post), _postfix(post),
_ignoreStart(0), _ignoreStart(0),
_buffer(0), _buffer(0),
_bufferOffset(0) _bufferOffset(0)
{ {
} }
PartialStreamBuf::PartialStreamBuf(std::ostream& out, std::size_t start, std::size_t end, bool initStream): PartialStreamBuf::PartialStreamBuf(std::ostream& out, std::size_t start, std::size_t end, bool initStream):
Poco::BufferedStreamBuf(STREAM_BUFFER_SIZE, std::ios::out), Poco::BufferedStreamBuf(STREAM_BUFFER_SIZE, std::ios::out),
_initialized(!initStream), _initialized(!initStream),
_start(0), _start(0),
_numBytes(0), _numBytes(0),
_bytesWritten(0), _bytesWritten(0),
_pIstr(0), _pIstr(0),
_pOstr(&out), _pOstr(&out),
_ignoreStart(start), _ignoreStart(start),
_buffer(end), _buffer(end),
_bufferOffset(0) _bufferOffset(0)
{ {
} }
PartialStreamBuf::~PartialStreamBuf() PartialStreamBuf::~PartialStreamBuf()
{ {
} }
int PartialStreamBuf::readFromDevice(char* buffer, std::streamsize length) int PartialStreamBuf::readFromDevice(char* buffer, std::streamsize length)
{ {
if (_pIstr == 0 ||length == 0) return -1; if (_pIstr == 0 ||length == 0) return -1;
if (!_initialized) if (!_initialized)
{ {
_initialized = true; _initialized = true;
_pIstr->clear(); _pIstr->clear();
_pIstr->seekg(_start, std::ios_base::beg); _pIstr->seekg(_start, std::ios_base::beg);
if (_pIstr->fail()) if (_pIstr->fail())
throw Poco::IOException("Failed to reposition in stream"); throw Poco::IOException("Failed to reposition in stream");
} }
if (!_prefix.empty()) if (!_prefix.empty())
{ {
std::streamsize tmp = (_prefix.size() > length)? length: static_cast<std::streamsize>(_prefix.size()); std::streamsize tmp = (_prefix.size() > length)? length: static_cast<std::streamsize>(_prefix.size());
std::memcpy(buffer, _prefix.c_str(), tmp); std::memcpy(buffer, _prefix.c_str(), tmp);
_prefix = _prefix.substr(tmp); _prefix = _prefix.substr(tmp);
return tmp; return tmp;
} }
if (_numBytes == 0) if (_numBytes == 0)
{ {
if (!_postfix.empty()) if (!_postfix.empty())
{ {
std::streamsize tmp = (_postfix.size() > length)? length: static_cast<std::streamsize>(_postfix.size()); std::streamsize tmp = (_postfix.size() > length)? length: static_cast<std::streamsize>(_postfix.size());
std::memcpy(buffer, _postfix.c_str(), tmp); std::memcpy(buffer, _postfix.c_str(), tmp);
_postfix = _postfix.substr(tmp); _postfix = _postfix.substr(tmp);
return tmp; return tmp;
} }
else else
return -1; return -1;
} }
if (!_pIstr->good()) if (!_pIstr->good())
return -1; return -1;
if (_numBytes < length) if (_numBytes < length)
length = static_cast<std::streamsize>(_numBytes); length = static_cast<std::streamsize>(_numBytes);
_pIstr->read(buffer, length); _pIstr->read(buffer, length);
std::streamsize bytesRead = _pIstr->gcount(); std::streamsize bytesRead = _pIstr->gcount();
_numBytes -= bytesRead; _numBytes -= bytesRead;
return bytesRead; return bytesRead;
} }
int PartialStreamBuf::writeToDevice(const char* buffer, std::streamsize length) int PartialStreamBuf::writeToDevice(const char* buffer, std::streamsize length)
{ {
if (_pOstr == 0 || length == 0) return -1; if (_pOstr == 0 || length == 0) return -1;
if (!_initialized) if (!_initialized)
{ {
_initialized = true; _initialized = true;
_pOstr->clear(); _pOstr->clear();
if (_pOstr->fail()) if (_pOstr->fail())
throw Poco::IOException("Failed to clear stream status"); throw Poco::IOException("Failed to clear stream status");
} }
if (_ignoreStart > 0) if (_ignoreStart > 0)
{ {
if (_ignoreStart > length) if (_ignoreStart > length)
{ {
_ignoreStart -= length; _ignoreStart -= length;
// fake return values // fake return values
return length; return length;
} }
else else
{ {
std::streamsize cnt = static_cast<std::streamsize>(length - _ignoreStart - _buffer.size()); std::streamsize cnt = static_cast<std::streamsize>(length - _ignoreStart - _buffer.size());
if (cnt > 0) if (cnt > 0)
{ {
_pOstr->write(buffer+_ignoreStart, cnt); _pOstr->write(buffer+_ignoreStart, cnt);
_bytesWritten += cnt; _bytesWritten += cnt;
} }
// copy the rest into buffer // copy the rest into buffer
cnt += static_cast<std::streamsize>(_ignoreStart); cnt += static_cast<std::streamsize>(_ignoreStart);
_ignoreStart = 0; _ignoreStart = 0;
poco_assert (cnt < length); poco_assert (cnt < length);
_bufferOffset = length - cnt; _bufferOffset = length - cnt;
std::memcpy(_buffer.begin(), buffer + cnt, _bufferOffset); std::memcpy(_buffer.begin(), buffer + cnt, _bufferOffset);
return length; return length;
} }
} }
if (_buffer.size() > 0) if (_buffer.size() > 0)
{ {
// always treat each write as the potential last one // always treat each write as the potential last one
// thus first fill the buffer with the last n bytes of the msg // thus first fill the buffer with the last n bytes of the msg
// how much of the already cached data do we need to write? // how much of the already cached data do we need to write?
Poco::Int32 cache = _bufferOffset + length - _buffer.size(); Poco::Int32 cache = _bufferOffset + length - _buffer.size();
if (cache > 0) if (cache > 0)
{ {
if (cache > _bufferOffset) if (cache > _bufferOffset)
cache = _bufferOffset; cache = _bufferOffset;
_pOstr->write(_buffer.begin(), cache); _pOstr->write(_buffer.begin(), cache);
_bytesWritten += cache; _bytesWritten += cache;
_bufferOffset -= cache; _bufferOffset -= cache;
if (_bufferOffset > 0) if (_bufferOffset > 0)
std::memmove(_buffer.begin(), _buffer.begin()+cache, _bufferOffset); std::memmove(_buffer.begin(), _buffer.begin()+cache, _bufferOffset);
} }
// now fill up _buffer with the last bytes from buffer // now fill up _buffer with the last bytes from buffer
Poco::Int32 pos = static_cast<Poco::Int32>(length - static_cast<Poco::Int32>(_buffer.size()) + _bufferOffset); Poco::Int32 pos = static_cast<Poco::Int32>(length - static_cast<Poco::Int32>(_buffer.size()) + _bufferOffset);
if (pos <= 0) if (pos <= 0)
{ {
// all of the message goes to _buffer // all of the message goes to _buffer
std::memcpy(_buffer.begin() + _bufferOffset, buffer, length); std::memcpy(_buffer.begin() + _bufferOffset, buffer, length);
} }
else else
{ {
poco_assert (_bufferOffset == 0); poco_assert (_bufferOffset == 0);
std::memcpy(_buffer.begin(), buffer+pos, _buffer.size()); std::memcpy(_buffer.begin(), buffer+pos, _buffer.size());
_bufferOffset = static_cast<Poco::UInt32>(_buffer.size()); _bufferOffset = static_cast<Poco::UInt32>(_buffer.size());
// the rest is written // the rest is written
_pOstr->write(buffer, static_cast<std::streamsize>(length - _buffer.size())); _pOstr->write(buffer, static_cast<std::streamsize>(length - _buffer.size()));
_bytesWritten += (length - _buffer.size()); _bytesWritten += (length - _buffer.size());
} }
} }
else else
{ {
_pOstr->write(buffer, length); _pOstr->write(buffer, length);
_bytesWritten += length; _bytesWritten += length;
} }
if (_pOstr->good()) if (_pOstr->good())
return length; return length;
throw Poco::IOException("Failed to write to output stream"); throw Poco::IOException("Failed to write to output stream");
} }
void PartialStreamBuf::close() void PartialStreamBuf::close()
{ {
// DONT write data from _buffer! // DONT write data from _buffer!
} }
PartialIOS::PartialIOS(std::istream& istr, std::ios::pos_type start, std::ios::pos_type end, const std::string& pre, const std::string& post, bool initStream): _buf(istr, start, end, pre, post, initStream) PartialIOS::PartialIOS(std::istream& istr, std::ios::pos_type start, std::ios::pos_type end, const std::string& pre, const std::string& post, bool initStream): _buf(istr, start, end, pre, post, initStream)
{ {
poco_ios_init(&_buf); poco_ios_init(&_buf);
} }
PartialIOS::PartialIOS(std::ostream& ostr, std::size_t start, std::size_t end, bool initStream): _buf(ostr, start, end, initStream) PartialIOS::PartialIOS(std::ostream& ostr, std::size_t start, std::size_t end, bool initStream): _buf(ostr, start, end, initStream)
{ {
poco_ios_init(&_buf); poco_ios_init(&_buf);
} }
PartialIOS::~PartialIOS() PartialIOS::~PartialIOS()
{ {
} }
PartialStreamBuf* PartialIOS::rdbuf() PartialStreamBuf* PartialIOS::rdbuf()
{ {
return &_buf; return &_buf;
} }
PartialInputStream::PartialInputStream(std::istream& istr, std::ios::pos_type start, std::ios::pos_type end, bool initStream, const std::string& pre, const std::string& post): PartialInputStream::PartialInputStream(std::istream& istr, std::ios::pos_type start, std::ios::pos_type end, bool initStream, const std::string& pre, const std::string& post):
PartialIOS(istr, start, end, pre, post, initStream), PartialIOS(istr, start, end, pre, post, initStream),
std::istream(&_buf) std::istream(&_buf)
{ {
} }
PartialInputStream::~PartialInputStream() PartialInputStream::~PartialInputStream()
{ {
} }
PartialOutputStream::PartialOutputStream(std::ostream& ostr, std::size_t start, std::size_t end, bool initStream): PartialOutputStream::PartialOutputStream(std::ostream& ostr, std::size_t start, std::size_t end, bool initStream):
PartialIOS(ostr, start, end, initStream), PartialIOS(ostr, start, end, initStream),
std::ostream(&_buf) std::ostream(&_buf)
{ {
} }
PartialOutputStream::~PartialOutputStream() PartialOutputStream::~PartialOutputStream()
{ {
close(); close();
} }
} } // namespace Poco::Zip } } // namespace Poco::Zip

View File

@@ -1,58 +1,58 @@
// //
// Rename.cpp // Rename.cpp
// //
// $Id: //poco/1.3/Zip/src/Rename.cpp#1 $ // $Id: //poco/Main/Zip/src/Rename.cpp#1 $
// //
// Library: Zip // Library: Zip
// Package: Manipulation // Package: Manipulation
// Module: Rename // Module: Rename
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/Zip/Rename.h" #include "Poco/Zip/Rename.h"
#include "Poco/Zip/Compress.h" #include "Poco/Zip/Compress.h"
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
Rename::Rename(const ZipLocalFileHeader& hdr, const std::string& newZipEntryName): Rename::Rename(const ZipLocalFileHeader& hdr, const std::string& newZipEntryName):
_hdr(hdr), _hdr(hdr),
_newZipEntryName(newZipEntryName) _newZipEntryName(newZipEntryName)
{ {
} }
void Rename::execute(Compress& c, std::istream& input) void Rename::execute(Compress& c, std::istream& input)
{ {
c.addFileRaw(input, _hdr, _newZipEntryName); c.addFileRaw(input, _hdr, _newZipEntryName);
} }
} } // namespace Poco::Zip } } // namespace Poco::Zip

View File

@@ -1,60 +1,59 @@
// //
// Replace.cpp // Replace.cpp
// //
// $Id: //poco/1.3/Zip/src/Replace.cpp#1 $ // $Id: //poco/Main/Zip/src/Replace.cpp#2 $
// //
// Library: Zip // Library: Zip
// Package: Manipulation // Package: Manipulation
// Module: Replace // Module: Replace
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/Zip/Replace.h" #include "Poco/Zip/Replace.h"
#include "Poco/Zip/Compress.h" #include "Poco/Zip/Compress.h"
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
Replace::Replace(const ZipLocalFileHeader& hdr, const std::string& localPath): Replace::Replace(const ZipLocalFileHeader& hdr, const std::string& localPath):
_del(hdr), _del(hdr),
_add(hdr.getFileName(), localPath, hdr.getCompressionMethod(), hdr.getCompressionLevel()) _add(hdr.getFileName(), localPath, hdr.getCompressionMethod(), hdr.getCompressionLevel())
{ {
} }
void Replace::execute(Compress& c, std::istream& input)
void Replace::execute(Compress& c, std::istream& input) {
{ _del.execute(c, input);
_del.execute(c, input); _add.execute(c, input);
_add.execute(c, input); }
}
} } // namespace Poco::Zip
} } // namespace Poco::Zip

View File

@@ -1,66 +1,66 @@
// //
// SkipCallback.cpp // SkipCallback.cpp
// //
// $Id: //poco/1.3/Zip/src/SkipCallback.cpp#4 $ // $Id: //poco/Main/Zip/src/SkipCallback.cpp#5 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: SkipCallback // Module: SkipCallback
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/Zip/SkipCallback.h" #include "Poco/Zip/SkipCallback.h"
#include "Poco/Zip/ZipLocalFileHeader.h" #include "Poco/Zip/ZipLocalFileHeader.h"
#include "Poco/Zip/ZipUtil.h" #include "Poco/Zip/ZipUtil.h"
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
SkipCallback::SkipCallback() SkipCallback::SkipCallback()
{ {
} }
SkipCallback::~SkipCallback() SkipCallback::~SkipCallback()
{ {
} }
bool SkipCallback::handleZipEntry(std::istream& zipStream, const ZipLocalFileHeader& hdr) bool SkipCallback::handleZipEntry(std::istream& zipStream, const ZipLocalFileHeader& hdr)
{ {
if (!hdr.searchCRCAndSizesAfterData()) if (!hdr.searchCRCAndSizesAfterData())
zipStream.seekg(hdr.getCompressedSize(), std::ios_base::cur); zipStream.seekg(hdr.getCompressedSize(), std::ios_base::cur);
else else
ZipUtil::sync(zipStream); ZipUtil::sync(zipStream);
return true; return true;
} }
} } // namespace Poco::Zip } } // namespace Poco::Zip

View File

@@ -1,122 +1,121 @@
// //
// ZipArchive.cpp // ZipArchive.cpp
// //
// $Id: //poco/1.3/Zip/src/ZipArchive.cpp#3 $ // $Id: //poco/Main/Zip/src/ZipArchive.cpp#8 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: ZipArchive // Module: ZipArchive
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/Zip/ZipArchive.h" #include "Poco/Zip/ZipArchive.h"
#include "Poco/Zip/SkipCallback.h" #include "Poco/Zip/SkipCallback.h"
#include "Poco/Exception.h" #include "Poco/Exception.h"
#include <cstring> #include <cstring>
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
ZipArchive::ZipArchive(std::istream& in): ZipArchive::ZipArchive(std::istream& in):
_entries(), _entries(),
_infos(), _infos(),
_disks() _disks()
{ {
poco_assert_dbg (in); poco_assert_dbg (in);
SkipCallback skip; SkipCallback skip;
parse(in, skip); parse(in, skip);
} }
ZipArchive::ZipArchive(const FileHeaders& entries, const FileInfos& infos, const DirectoryInfos& dirs): ZipArchive::ZipArchive(const FileHeaders& entries, const FileInfos& infos, const DirectoryInfos& dirs):
_entries(entries), _entries(entries),
_infos(infos), _infos(infos),
_disks(dirs) _disks(dirs)
{ {
} }
ZipArchive::ZipArchive(std::istream& in, ParseCallback& pc): ZipArchive::ZipArchive(std::istream& in, ParseCallback& pc):
_entries(), _entries(),
_infos(), _infos(),
_disks() _disks()
{ {
poco_assert_dbg (in); poco_assert_dbg (in);
parse(in, pc); parse(in, pc);
} }
ZipArchive::~ZipArchive() ZipArchive::~ZipArchive()
{ {
} }
void ZipArchive::parse(std::istream& in, ParseCallback& pc) void ZipArchive::parse(std::istream& in, ParseCallback& pc)
{ {
// read 4 bytes // read 4 bytes
while (in.good() && !in.eof()) while (in.good() && !in.eof())
{ {
char header[ZipCommon::HEADER_SIZE]={'\x00', '\x00', '\x00', '\x00'}; char header[ZipCommon::HEADER_SIZE]={'\x00', '\x00', '\x00', '\x00'};
in.read(header, ZipCommon::HEADER_SIZE); in.read(header, ZipCommon::HEADER_SIZE);
if (in.eof()) if (in.eof())
return; return;
if (std::memcmp(header, ZipLocalFileHeader::HEADER, ZipCommon::HEADER_SIZE) == 0) if (std::memcmp(header, ZipLocalFileHeader::HEADER, ZipCommon::HEADER_SIZE) == 0)
{ {
ZipLocalFileHeader entry(in, true, pc); ZipLocalFileHeader entry(in, true, pc);
poco_assert (_entries.insert(std::make_pair(entry.getFileName(), entry)).second); poco_assert (_entries.insert(std::make_pair(entry.getFileName(), entry)).second);
} }
else if (std::memcmp(header, ZipFileInfo::HEADER, ZipCommon::HEADER_SIZE) == 0) else if (std::memcmp(header, ZipFileInfo::HEADER, ZipCommon::HEADER_SIZE) == 0)
{ {
ZipFileInfo info(in, true); ZipFileInfo info(in, true);
FileHeaders::iterator it = _entries.find(info.getFileName()); FileHeaders::iterator it = _entries.find(info.getFileName());
if (it != _entries.end()) if (it != _entries.end())
{ {
it->second.setStartPos(info.getRelativeOffsetOfLocalHeader()); it->second.setStartPos(info.getRelativeOffsetOfLocalHeader());
} }
poco_assert (_infos.insert(std::make_pair(info.getFileName(), info)).second); poco_assert (_infos.insert(std::make_pair(info.getFileName(), info)).second);
} }
else if (std::memcmp(header, ZipArchiveInfo::HEADER, ZipCommon::HEADER_SIZE) == 0) else if (std::memcmp(header, ZipArchiveInfo::HEADER, ZipCommon::HEADER_SIZE) == 0)
{ {
ZipArchiveInfo nfo(in, true); ZipArchiveInfo nfo(in, true);
poco_assert (_disks.insert(std::make_pair(nfo.getDiskNumber(), nfo)).second); poco_assert (_disks.insert(std::make_pair(nfo.getDiskNumber(), nfo)).second);
} }
else else
{ {
if (_disks.empty()) if (_disks.empty())
throw Poco::IllegalStateException("Illegal header in zip file"); throw Poco::IllegalStateException("Illegal header in zip file");
else else
throw Poco::IllegalStateException("Garbage after directory header"); throw Poco::IllegalStateException("Garbage after directory header");
} }
}
} }
}
} } // namespace Poco::Zip
} } // namespace Poco::Zip

View File

@@ -1,106 +1,106 @@
// //
// ZipArchiveInfo.cpp // ZipArchiveInfo.cpp
// //
// $Id: //poco/1.3/Zip/src/ZipArchiveInfo.cpp#3 $ // $Id: //poco/Main/Zip/src/ZipArchiveInfo.cpp#7 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: ZipArchiveInfo // Module: ZipArchiveInfo
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/Zip/ZipArchiveInfo.h" #include "Poco/Zip/ZipArchiveInfo.h"
#include "Poco/Buffer.h" #include "Poco/Buffer.h"
#include <istream> #include <istream>
#include <cstring> #include <cstring>
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
const char ZipArchiveInfo::HEADER[ZipCommon::HEADER_SIZE] = {'\x50', '\x4b', '\x05', '\x06'}; const char ZipArchiveInfo::HEADER[ZipCommon::HEADER_SIZE] = {'\x50', '\x4b', '\x05', '\x06'};
ZipArchiveInfo::ZipArchiveInfo(std::istream& in, bool assumeHeaderRead): ZipArchiveInfo::ZipArchiveInfo(std::istream& in, bool assumeHeaderRead):
_rawInfo(), _rawInfo(),
_startPos(in.tellg()), _startPos(in.tellg()),
_comment() _comment()
{ {
if (assumeHeaderRead) if (assumeHeaderRead)
_startPos -= ZipCommon::HEADER_SIZE; _startPos -= ZipCommon::HEADER_SIZE;
parse(in, assumeHeaderRead); parse(in, assumeHeaderRead);
} }
ZipArchiveInfo::ZipArchiveInfo(): ZipArchiveInfo::ZipArchiveInfo():
_rawInfo(), _rawInfo(),
_startPos(0), _startPos(0),
_comment() _comment()
{ {
std::memset(_rawInfo, 0, FULLHEADER_SIZE); std::memset(_rawInfo, 0, FULLHEADER_SIZE);
std::memcpy(_rawInfo, HEADER, ZipCommon::HEADER_SIZE); std::memcpy(_rawInfo, HEADER, ZipCommon::HEADER_SIZE);
} }
ZipArchiveInfo::~ZipArchiveInfo() ZipArchiveInfo::~ZipArchiveInfo()
{ {
} }
void ZipArchiveInfo::parse(std::istream& inp, bool assumeHeaderRead) void ZipArchiveInfo::parse(std::istream& inp, bool assumeHeaderRead)
{ {
if (!assumeHeaderRead) if (!assumeHeaderRead)
{ {
inp.read(_rawInfo, ZipCommon::HEADER_SIZE); inp.read(_rawInfo, ZipCommon::HEADER_SIZE);
} }
else else
{ {
std::memcpy(_rawInfo, HEADER, ZipCommon::HEADER_SIZE); std::memcpy(_rawInfo, HEADER, ZipCommon::HEADER_SIZE);
} }
poco_assert (std::memcmp(_rawInfo, HEADER, ZipCommon::HEADER_SIZE) == 0); poco_assert (std::memcmp(_rawInfo, HEADER, ZipCommon::HEADER_SIZE) == 0);
// read the rest of the header // read the rest of the header
inp.read(_rawInfo + ZipCommon::HEADER_SIZE, FULLHEADER_SIZE - ZipCommon::HEADER_SIZE); inp.read(_rawInfo + ZipCommon::HEADER_SIZE, FULLHEADER_SIZE - ZipCommon::HEADER_SIZE);
Poco::UInt16 len = getZipCommentSize(); Poco::UInt16 len = getZipCommentSize();
if (len > 0) if (len > 0)
{ {
Poco::Buffer<char> buf(len); Poco::Buffer<char> buf(len);
inp.read(buf.begin(), len); inp.read(buf.begin(), len);
_comment = std::string(buf.begin(), len); _comment = std::string(buf.begin(), len);
} }
} }
std::string ZipArchiveInfo::createHeader() const std::string ZipArchiveInfo::createHeader() const
{ {
std::string result(_rawInfo, FULLHEADER_SIZE); std::string result(_rawInfo, FULLHEADER_SIZE);
result.append(_comment); result.append(_comment);
return result; return result;
} }
} } // namespace Poco::Zip } } // namespace Poco::Zip

View File

@@ -1,47 +1,47 @@
// //
// ZipCommon.cpp // ZipCommon.cpp
// //
// $Id: //poco/1.3/Zip/src/ZipCommon.cpp#3 $ // $Id: //poco/Main/Zip/src/ZipCommon.cpp#3 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: ZipCommon // Module: ZipCommon
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/Zip/ZipCommon.h" #include "Poco/Zip/ZipCommon.h"
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
const std::string ZipCommon::ILLEGAL_PATH(".."); const std::string ZipCommon::ILLEGAL_PATH("..");
} } // namespace Poco::Zip } } // namespace Poco::Zip

View File

@@ -1,79 +1,79 @@
// //
// ZipDataInfo.cpp // ZipDataInfo.cpp
// //
// $Id: //poco/1.3/Zip/src/ZipDataInfo.cpp#3 $ // $Id: //poco/Main/Zip/src/ZipDataInfo.cpp#5 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: ZipDataInfo // Module: ZipDataInfo
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/Zip/ZipDataInfo.h" #include "Poco/Zip/ZipDataInfo.h"
#include <istream> #include <istream>
#include <cstring> #include <cstring>
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
const char ZipDataInfo::HEADER[ZipCommon::HEADER_SIZE] = {'\x50', '\x4b', '\x07', '\x08'}; const char ZipDataInfo::HEADER[ZipCommon::HEADER_SIZE] = {'\x50', '\x4b', '\x07', '\x08'};
ZipDataInfo::ZipDataInfo(): ZipDataInfo::ZipDataInfo():
_rawInfo(), _rawInfo(),
_valid(true) _valid(true)
{ {
std::memcpy(_rawInfo, HEADER, ZipCommon::HEADER_SIZE); std::memcpy(_rawInfo, HEADER, ZipCommon::HEADER_SIZE);
std::memset(_rawInfo+ZipCommon::HEADER_SIZE, 0, FULLHEADER_SIZE - ZipCommon::HEADER_SIZE); std::memset(_rawInfo+ZipCommon::HEADER_SIZE, 0, FULLHEADER_SIZE - ZipCommon::HEADER_SIZE);
_valid = true; _valid = true;
} }
ZipDataInfo::ZipDataInfo(std::istream& in, bool assumeHeaderRead): ZipDataInfo::ZipDataInfo(std::istream& in, bool assumeHeaderRead):
_rawInfo(), _rawInfo(),
_valid(false) _valid(false)
{ {
if (assumeHeaderRead) if (assumeHeaderRead)
std::memcpy(_rawInfo, HEADER, ZipCommon::HEADER_SIZE); std::memcpy(_rawInfo, HEADER, ZipCommon::HEADER_SIZE);
else else
in.read(_rawInfo, ZipCommon::HEADER_SIZE); in.read(_rawInfo, ZipCommon::HEADER_SIZE);
poco_assert (std::memcmp(_rawInfo, HEADER, ZipCommon::HEADER_SIZE) == 0); poco_assert (std::memcmp(_rawInfo, HEADER, ZipCommon::HEADER_SIZE) == 0);
// now copy the rest of the header // now copy the rest of the header
in.read(_rawInfo+ZipCommon::HEADER_SIZE, FULLHEADER_SIZE - ZipCommon::HEADER_SIZE); in.read(_rawInfo+ZipCommon::HEADER_SIZE, FULLHEADER_SIZE - ZipCommon::HEADER_SIZE);
_valid = (!in.eof() && in.good()); _valid = (!in.eof() && in.good());
} }
ZipDataInfo::~ZipDataInfo() ZipDataInfo::~ZipDataInfo()
{ {
} }
} } // namespace Poco::Zip } } // namespace Poco::Zip

View File

@@ -1,49 +1,49 @@
// //
// ZipException.cpp // ZipException.cpp
// //
// $Id: //poco/1.3/Zip/src/ZipException.cpp#4 $ // $Id: //poco/Main/Zip/src/ZipException.cpp#4 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: ZipException // Module: ZipException
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/Zip/ZipException.h" #include "Poco/Zip/ZipException.h"
#include <typeinfo> #include <typeinfo>
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
POCO_IMPLEMENT_EXCEPTION(ZipException, Poco::RuntimeException, "ZIP Exception") POCO_IMPLEMENT_EXCEPTION(ZipException, Poco::RuntimeException, "ZIP Exception")
POCO_IMPLEMENT_EXCEPTION(ZipManipulationException, ZipException, "ZIP Manipulation Exception") POCO_IMPLEMENT_EXCEPTION(ZipManipulationException, ZipException, "ZIP Manipulation Exception")
} } // namespace Poco::Zip } } // namespace Poco::Zip

View File

@@ -1,238 +1,238 @@
// //
// ZipLocalFileHeader.cpp // ZipLocalFileHeader.cpp
// //
// $Id: //poco/1.3/Zip/src/ZipLocalFileHeader.cpp#4 $ // $Id: //poco/Main/Zip/src/ZipLocalFileHeader.cpp#9 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: ZipLocalFileHeader // Module: ZipLocalFileHeader
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/Zip/ZipLocalFileHeader.h" #include "Poco/Zip/ZipLocalFileHeader.h"
#include "Poco/Zip/ZipDataInfo.h" #include "Poco/Zip/ZipDataInfo.h"
#include "Poco/Zip/ParseCallback.h" #include "Poco/Zip/ParseCallback.h"
#include "Poco/Buffer.h" #include "Poco/Buffer.h"
#include "Poco/Exception.h" #include "Poco/Exception.h"
#include "Poco/File.h" #include "Poco/File.h"
#include <cstring> #include <cstring>
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
const char ZipLocalFileHeader::HEADER[ZipCommon::HEADER_SIZE] = {'\x50', '\x4b', '\x03', '\x04'}; const char ZipLocalFileHeader::HEADER[ZipCommon::HEADER_SIZE] = {'\x50', '\x4b', '\x03', '\x04'};
ZipLocalFileHeader::ZipLocalFileHeader(const Poco::Path& fileName, ZipLocalFileHeader::ZipLocalFileHeader(const Poco::Path& fileName,
const Poco::DateTime& lastModifiedAt, const Poco::DateTime& lastModifiedAt,
ZipCommon::CompressionMethod cm, ZipCommon::CompressionMethod cm,
ZipCommon::CompressionLevel cl): ZipCommon::CompressionLevel cl):
_rawHeader(), _rawHeader(),
_startPos(-1), _startPos(-1),
_endPos(-1), _endPos(-1),
_fileName(), _fileName(),
_lastModifiedAt(), _lastModifiedAt(),
_extraField(), _extraField(),
_crc32(0), _crc32(0),
_compressedSize(0), _compressedSize(0),
_uncompressedSize(0) _uncompressedSize(0)
{ {
std::memcpy(_rawHeader, HEADER, ZipCommon::HEADER_SIZE); std::memcpy(_rawHeader, HEADER, ZipCommon::HEADER_SIZE);
std::memset(_rawHeader+ZipCommon::HEADER_SIZE, 0, FULLHEADER_SIZE - ZipCommon::HEADER_SIZE); std::memset(_rawHeader+ZipCommon::HEADER_SIZE, 0, FULLHEADER_SIZE - ZipCommon::HEADER_SIZE);
ZipCommon::HostSystem hs = ZipCommon::HS_FAT; ZipCommon::HostSystem hs = ZipCommon::HS_FAT;
#if (POCO_OS == POCO_OS_CYGWIN) #if (POCO_OS == POCO_OS_CYGWIN)
hs = ZipCommon::HS_UNIX; hs = ZipCommon::HS_UNIX;
#endif #endif
#if (POCO_OS == POCO_OS_VMS) #if (POCO_OS == POCO_OS_VMS)
hs = ZipCommon::HS_VMS; hs = ZipCommon::HS_VMS;
#endif #endif
#if defined(POCO_OS_FAMILY_UNIX) #if defined(POCO_OS_FAMILY_UNIX)
hs = ZipCommon::HS_UNIX; hs = ZipCommon::HS_UNIX;
#endif #endif
setHostSystem(hs); setHostSystem(hs);
setEncryption(false); setEncryption(false);
setExtraFieldSize(0); setExtraFieldSize(0);
setLastModifiedAt(lastModifiedAt); setLastModifiedAt(lastModifiedAt);
init(fileName, cm, cl); init(fileName, cm, cl);
} }
ZipLocalFileHeader::ZipLocalFileHeader(std::istream& inp, bool assumeHeaderRead, ParseCallback& callback): ZipLocalFileHeader::ZipLocalFileHeader(std::istream& inp, bool assumeHeaderRead, ParseCallback& callback):
_rawHeader(), _rawHeader(),
_startPos(inp.tellg()), _startPos(inp.tellg()),
_endPos(-1), _endPos(-1),
_fileName(), _fileName(),
_lastModifiedAt(), _lastModifiedAt(),
_extraField(), _extraField(),
_crc32(0), _crc32(0),
_compressedSize(0), _compressedSize(0),
_uncompressedSize(0) _uncompressedSize(0)
{ {
poco_assert_dbg( (EXTRAFIELD_POS+EXTRAFIELD_LENGTH) == FULLHEADER_SIZE); poco_assert_dbg( (EXTRAFIELD_POS+EXTRAFIELD_LENGTH) == FULLHEADER_SIZE);
if (assumeHeaderRead) if (assumeHeaderRead)
_startPos -= ZipCommon::HEADER_SIZE; _startPos -= ZipCommon::HEADER_SIZE;
parse(inp, assumeHeaderRead); parse(inp, assumeHeaderRead);
bool ok = callback.handleZipEntry(inp, *this); bool ok = callback.handleZipEntry(inp, *this);
if (ok) if (ok)
{ {
if (searchCRCAndSizesAfterData()) if (searchCRCAndSizesAfterData())
{ {
ZipDataInfo nfo(inp, false); ZipDataInfo nfo(inp, false);
setCRC(nfo.getCRC32()); setCRC(nfo.getCRC32());
setCompressedSize(nfo.getCompressedSize()); setCompressedSize(nfo.getCompressedSize());
setUncompressedSize(nfo.getUncompressedSize()); setUncompressedSize(nfo.getUncompressedSize());
} }
} }
else else
{ {
poco_assert_dbg(!searchCRCAndSizesAfterData()); poco_assert_dbg(!searchCRCAndSizesAfterData());
ZipUtil::sync(inp); ZipUtil::sync(inp);
} }
_endPos = _startPos + getHeaderSize() + _compressedSize; // exclude the data block! _endPos = _startPos + getHeaderSize() + _compressedSize; // exclude the data block!
} }
ZipLocalFileHeader::~ZipLocalFileHeader() ZipLocalFileHeader::~ZipLocalFileHeader()
{ {
} }
void ZipLocalFileHeader::parse(std::istream& inp, bool assumeHeaderRead) void ZipLocalFileHeader::parse(std::istream& inp, bool assumeHeaderRead)
{ {
if (!assumeHeaderRead) if (!assumeHeaderRead)
{ {
inp.read(_rawHeader, ZipCommon::HEADER_SIZE); inp.read(_rawHeader, ZipCommon::HEADER_SIZE);
} }
else else
{ {
std::memcpy(_rawHeader, HEADER, ZipCommon::HEADER_SIZE); std::memcpy(_rawHeader, HEADER, ZipCommon::HEADER_SIZE);
} }
poco_assert (std::memcmp(_rawHeader, HEADER, ZipCommon::HEADER_SIZE) == 0); poco_assert (std::memcmp(_rawHeader, HEADER, ZipCommon::HEADER_SIZE) == 0);
// read the rest of the header // read the rest of the header
inp.read(_rawHeader + ZipCommon::HEADER_SIZE, FULLHEADER_SIZE - ZipCommon::HEADER_SIZE); inp.read(_rawHeader + ZipCommon::HEADER_SIZE, FULLHEADER_SIZE - ZipCommon::HEADER_SIZE);
poco_assert (_rawHeader[VERSION_POS + 1]>= ZipCommon::HS_FAT && _rawHeader[VERSION_POS + 1] < ZipCommon::HS_UNUSED); poco_assert (_rawHeader[VERSION_POS + 1]>= ZipCommon::HS_FAT && _rawHeader[VERSION_POS + 1] < ZipCommon::HS_UNUSED);
poco_assert (getMajorVersionNumber() <= 2); poco_assert (getMajorVersionNumber() <= 2);
poco_assert (ZipUtil::get16BitValue(_rawHeader, COMPR_METHOD_POS) < ZipCommon::CM_UNUSED); poco_assert (ZipUtil::get16BitValue(_rawHeader, COMPR_METHOD_POS) < ZipCommon::CM_UNUSED);
parseDateTime(); parseDateTime();
Poco::UInt16 len = getFileNameLength(); Poco::UInt16 len = getFileNameLength();
Poco::Buffer<char> buf(len); Poco::Buffer<char> buf(len);
inp.read(buf.begin(), len); inp.read(buf.begin(), len);
_fileName = std::string(buf.begin(), len); _fileName = std::string(buf.begin(), len);
if (hasExtraField()) if (hasExtraField())
{ {
len = getExtraFieldLength(); len = getExtraFieldLength();
Poco::Buffer<char> xtra(len); Poco::Buffer<char> xtra(len);
inp.read(xtra.begin(), len); inp.read(xtra.begin(), len);
_extraField = std::string(xtra.begin(), len); _extraField = std::string(xtra.begin(), len);
} }
if (!searchCRCAndSizesAfterData()) if (!searchCRCAndSizesAfterData())
{ {
_crc32 = getCRCFromHeader(); _crc32 = getCRCFromHeader();
_compressedSize = getCompressedSizeFromHeader(); _compressedSize = getCompressedSizeFromHeader();
_uncompressedSize = getUncompressedSizeFromHeader(); _uncompressedSize = getUncompressedSizeFromHeader();
} }
} }
bool ZipLocalFileHeader::searchCRCAndSizesAfterData() const bool ZipLocalFileHeader::searchCRCAndSizesAfterData() const
{ {
if (getCompressionMethod() == ZipCommon::CM_DEFLATE) if (getCompressionMethod() == ZipCommon::CM_DEFLATE)
{ {
// check bit 3 // check bit 3
return ((ZipUtil::get16BitValue(_rawHeader, GENERAL_PURPOSE_POS) & 0x0008) != 0); return ((ZipUtil::get16BitValue(_rawHeader, GENERAL_PURPOSE_POS) & 0x0008) != 0);
} }
return false; return false;
} }
void ZipLocalFileHeader::setFileName(const std::string& fileName, bool isDirectory) void ZipLocalFileHeader::setFileName(const std::string& fileName, bool isDirectory)
{ {
poco_assert (!fileName.empty()); poco_assert (!fileName.empty());
Poco::Path aPath(fileName); Poco::Path aPath(fileName);
if (isDirectory) if (isDirectory)
{ {
aPath.makeDirectory(); aPath.makeDirectory();
setCRC(0); setCRC(0);
setCompressedSize(0); setCompressedSize(0);
setUncompressedSize(0); setUncompressedSize(0);
setCompressionMethod(ZipCommon::CM_STORE); setCompressionMethod(ZipCommon::CM_STORE);
setCompressionLevel(ZipCommon::CL_NORMAL); setCompressionLevel(ZipCommon::CL_NORMAL);
} }
else else
{ {
aPath.makeFile(); aPath.makeFile();
} }
_fileName = aPath.toString(Poco::Path::PATH_UNIX); _fileName = aPath.toString(Poco::Path::PATH_UNIX);
if (_fileName[0] == '/') if (_fileName[0] == '/')
_fileName = _fileName.substr(1); _fileName = _fileName.substr(1);
if (isDirectory) if (isDirectory)
{ {
poco_assert_dbg (_fileName[_fileName.size()-1] == '/'); poco_assert_dbg (_fileName[_fileName.size()-1] == '/');
} }
setFileNameLength(static_cast<Poco::UInt16>(_fileName.size())); setFileNameLength(static_cast<Poco::UInt16>(_fileName.size()));
} }
void ZipLocalFileHeader::init( const Poco::Path& fName, void ZipLocalFileHeader::init( const Poco::Path& fName,
ZipCommon::CompressionMethod cm, ZipCommon::CompressionMethod cm,
ZipCommon::CompressionLevel cl) ZipCommon::CompressionLevel cl)
{ {
poco_assert (_fileName.empty()); poco_assert (_fileName.empty());
setSearchCRCAndSizesAfterData(false); setSearchCRCAndSizesAfterData(false);
Poco::Path fileName(fName); Poco::Path fileName(fName);
fileName.setDevice(""); // clear device! fileName.setDevice(""); // clear device!
setFileName(fileName.toString(Poco::Path::PATH_UNIX), fileName.isDirectory()); setFileName(fileName.toString(Poco::Path::PATH_UNIX), fileName.isDirectory());
setRequiredVersion(2, 0); setRequiredVersion(2, 0);
if (fileName.isFile()) if (fileName.isFile())
{ {
setCompressionMethod(cm); setCompressionMethod(cm);
setCompressionLevel(cl); setCompressionLevel(cl);
} }
else else
setCompressionMethod(ZipCommon::CM_STORE); setCompressionMethod(ZipCommon::CM_STORE);
} }
std::string ZipLocalFileHeader::createHeader() const std::string ZipLocalFileHeader::createHeader() const
{ {
std::string result(_rawHeader, FULLHEADER_SIZE); std::string result(_rawHeader, FULLHEADER_SIZE);
result.append(_fileName); result.append(_fileName);
result.append(_extraField); result.append(_extraField);
return result; return result;
} }
} } // namespace Poco::Zip } } // namespace Poco::Zip

View File

@@ -1,194 +1,194 @@
// //
// ZipManipulator.cpp // ZipManipulator.cpp
// //
// $Id: //poco/1.3/Zip/src/ZipManipulator.cpp#2 $ // $Id: //poco/Main/Zip/src/ZipManipulator.cpp#4 $
// //
// Library: Zip // Library: Zip
// Package: Manipulation // Package: Manipulation
// Module: ZipManipulator // Module: ZipManipulator
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/Zip/ZipManipulator.h" #include "Poco/Zip/ZipManipulator.h"
#include "Poco/Zip/ZipException.h" #include "Poco/Zip/ZipException.h"
#include "Poco/Zip/ZipUtil.h" #include "Poco/Zip/ZipUtil.h"
#include "Poco/Zip/Add.h" #include "Poco/Zip/Add.h"
#include "Poco/Zip/Delete.h" #include "Poco/Zip/Delete.h"
#include "Poco/Zip/Keep.h" #include "Poco/Zip/Keep.h"
#include "Poco/Zip/Rename.h" #include "Poco/Zip/Rename.h"
#include "Poco/Zip/Replace.h" #include "Poco/Zip/Replace.h"
#include "Poco/Zip/Compress.h" #include "Poco/Zip/Compress.h"
#include "Poco/Delegate.h" #include "Poco/Delegate.h"
#include "Poco/File.h" #include "Poco/File.h"
#include "Poco/FileStream.h" #include "Poco/FileStream.h"
#include <fstream> #include <fstream>
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
ZipManipulator::ZipManipulator(const std::string& zipFile, bool backupOriginalFile): ZipManipulator::ZipManipulator(const std::string& zipFile, bool backupOriginalFile):
_zipFile(zipFile), _zipFile(zipFile),
_backupOriginalFile(backupOriginalFile), _backupOriginalFile(backupOriginalFile),
_changes(), _changes(),
_in(0) _in(0)
{ {
std::ifstream in(zipFile.c_str()); std::ifstream in(zipFile.c_str(), std::ios::binary);
_in = new ZipArchive(in); _in = new ZipArchive(in);
} }
ZipManipulator::~ZipManipulator() ZipManipulator::~ZipManipulator()
{ {
} }
void ZipManipulator::deleteFile(const std::string& zipPath) void ZipManipulator::deleteFile(const std::string& zipPath)
{ {
const ZipLocalFileHeader& entry = getForChange(zipPath); const ZipLocalFileHeader& entry = getForChange(zipPath);
addOperation(zipPath, new Delete(entry)); addOperation(zipPath, new Delete(entry));
} }
void ZipManipulator::replaceFile(const std::string& zipPath, const std::string& localPath) void ZipManipulator::replaceFile(const std::string& zipPath, const std::string& localPath)
{ {
const ZipLocalFileHeader& entry = getForChange(zipPath); const ZipLocalFileHeader& entry = getForChange(zipPath);
addOperation(zipPath, new Replace(entry, localPath)); addOperation(zipPath, new Replace(entry, localPath));
} }
void ZipManipulator::renameFile(const std::string& zipPath, const std::string& newZipPath) void ZipManipulator::renameFile(const std::string& zipPath, const std::string& newZipPath)
{ {
const ZipLocalFileHeader& entry = getForChange(zipPath); const ZipLocalFileHeader& entry = getForChange(zipPath);
// checked later in Compress too but the earlier one gets the error the better // checked later in Compress too but the earlier one gets the error the better
std::string fn = ZipUtil::validZipEntryFileName(newZipPath); std::string fn = ZipUtil::validZipEntryFileName(newZipPath);
addOperation(zipPath, new Rename(entry, fn)); addOperation(zipPath, new Rename(entry, fn));
} }
void ZipManipulator::addFile(const std::string& zipPath, const std::string& localPath, ZipCommon::CompressionMethod cm, ZipCommon::CompressionLevel cl) void ZipManipulator::addFile(const std::string& zipPath, const std::string& localPath, ZipCommon::CompressionMethod cm, ZipCommon::CompressionLevel cl)
{ {
addOperation(zipPath, new Add(zipPath, localPath, cm, cl)); addOperation(zipPath, new Add(zipPath, localPath, cm, cl));
} }
ZipArchive ZipManipulator::commit() ZipArchive ZipManipulator::commit()
{ {
// write to a tmp file // write to a tmp file
std::string outFile(_zipFile + ".tmp"); std::string outFile(_zipFile + ".tmp");
ZipArchive retVal(compress(outFile)); ZipArchive retVal(compress(outFile));
//renaming //renaming
{ {
Poco::File aFile(_zipFile); Poco::File aFile(_zipFile);
if (_backupOriginalFile) if (_backupOriginalFile)
{ {
Poco::File tmp(_zipFile+".bak"); Poco::File tmp(_zipFile+".bak");
if (tmp.exists()) if (tmp.exists())
tmp.remove(); tmp.remove();
aFile.renameTo(_zipFile+".bak"); aFile.renameTo(_zipFile+".bak");
} }
else else
aFile.remove(); aFile.remove();
} }
{ {
Poco::File resFile(outFile); Poco::File resFile(outFile);
Poco::File zipFile(_zipFile); Poco::File zipFile(_zipFile);
if (zipFile.exists()) if (zipFile.exists())
zipFile.remove(); zipFile.remove();
resFile.renameTo(_zipFile); resFile.renameTo(_zipFile);
} }
return retVal; return retVal;
} }
const ZipLocalFileHeader& ZipManipulator::getForChange(const std::string& zipPath) const const ZipLocalFileHeader& ZipManipulator::getForChange(const std::string& zipPath) const
{ {
ZipArchive::FileHeaders::const_iterator it = _in->findHeader(zipPath); ZipArchive::FileHeaders::const_iterator it = _in->findHeader(zipPath);
if (it == _in->headerEnd()) if (it == _in->headerEnd())
throw ZipManipulationException("entry not found: " + zipPath); throw ZipManipulationException("entry not found: " + zipPath);
if (_changes.find(zipPath) != _changes.end()) if (_changes.find(zipPath) != _changes.end())
throw ZipManipulationException("A change request exists already for entry " + zipPath); throw ZipManipulationException("A change request exists already for entry " + zipPath);
return it->second; return it->second;
} }
void ZipManipulator::addOperation(const std::string& zipPath, ZipOperation::Ptr ptrOp) void ZipManipulator::addOperation(const std::string& zipPath, ZipOperation::Ptr ptrOp)
{ {
std::pair<Changes::iterator, bool> result = _changes.insert(std::make_pair(zipPath, ptrOp)); std::pair<Changes::iterator, bool> result = _changes.insert(std::make_pair(zipPath, ptrOp));
if (!result.second) if (!result.second)
throw ZipManipulationException("A change request exists already for entry " + zipPath); throw ZipManipulationException("A change request exists already for entry " + zipPath);
} }
void ZipManipulator::onEDone(const void*, const ZipLocalFileHeader& hdr) void ZipManipulator::onEDone(const void*, const ZipLocalFileHeader& hdr)
{ {
EDone(this, hdr); EDone(this, hdr);
} }
ZipArchive ZipManipulator::compress(const std::string& outFile) ZipArchive ZipManipulator::compress(const std::string& outFile)
{ {
// write to a tmp file // write to a tmp file
Poco::FileInputStream in(_zipFile); Poco::FileInputStream in(_zipFile);
Poco::FileOutputStream out(outFile); Poco::FileOutputStream out(outFile);
Compress c(out, true); Compress c(out, true);
c.EDone += Poco::Delegate<ZipManipulator, const ZipLocalFileHeader>(this, &ZipManipulator::onEDone); c.EDone += Poco::Delegate<ZipManipulator, const ZipLocalFileHeader>(this, &ZipManipulator::onEDone);
ZipArchive::FileHeaders::const_iterator it = _in->headerBegin(); ZipArchive::FileHeaders::const_iterator it = _in->headerBegin();
for (; it != _in->headerEnd(); ++it) for (; it != _in->headerEnd(); ++it)
{ {
Changes::iterator itC = _changes.find(it->first); Changes::iterator itC = _changes.find(it->first);
if (itC != _changes.end()) if (itC != _changes.end())
{ {
itC->second->execute(c, in); itC->second->execute(c, in);
_changes.erase(itC); _changes.erase(itC);
} }
else else
{ {
Keep k(it->second); Keep k(it->second);
k.execute(c, in); k.execute(c, in);
} }
} }
//Remaining files are add operations! //Remaining files are add operations!
Changes::iterator itC = _changes.begin(); Changes::iterator itC = _changes.begin();
for (; itC != _changes.end(); ++itC) for (; itC != _changes.end(); ++itC)
{ {
itC->second->execute(c, in); itC->second->execute(c, in);
} }
_changes.clear(); _changes.clear();
c.EDone -= Poco::Delegate<ZipManipulator, const ZipLocalFileHeader>(this, &ZipManipulator::onEDone); c.EDone -= Poco::Delegate<ZipManipulator, const ZipLocalFileHeader>(this, &ZipManipulator::onEDone);
in.close(); in.close();
return c.close(); return c.close();
} }
} } // namespace Poco::Zip } } // namespace Poco::Zip

View File

@@ -1,54 +1,54 @@
// //
// ZipOperation.cpp // ZipOperation.cpp
// //
// $Id: //poco/1.3/Zip/src/ZipOperation.cpp#1 $ // $Id: //poco/Main/Zip/src/ZipOperation.cpp#1 $
// //
// Library: Zip // Library: Zip
// Package: Manipulation // Package: Manipulation
// Module: ZipOperation // Module: ZipOperation
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/Zip/ZipOperation.h" #include "Poco/Zip/ZipOperation.h"
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
ZipOperation::ZipOperation() ZipOperation::ZipOperation()
{ {
} }
ZipOperation::~ZipOperation() ZipOperation::~ZipOperation()
{ {
} }
} } // namespace Poco::Zip } } // namespace Poco::Zip

View File

@@ -1,212 +1,212 @@
// //
// ZipUtil.cpp // ZipUtil.cpp
// //
// $Id: //poco/1.3/Zip/src/ZipUtil.cpp#4 $ // $Id: //poco/Main/Zip/src/ZipUtil.cpp#8 $
// //
// Library: Zip // Library: Zip
// Package: Zip // Package: Zip
// Module: ZipUtil // Module: ZipUtil
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "Poco/Zip/ZipUtil.h" #include "Poco/Zip/ZipUtil.h"
#include "Poco/Zip/ZipException.h" #include "Poco/Zip/ZipException.h"
#include "Poco/Zip/ZipLocalFileHeader.h" #include "Poco/Zip/ZipLocalFileHeader.h"
#include "Poco/Zip/ZipFileInfo.h" #include "Poco/Zip/ZipFileInfo.h"
#include "Poco/Zip/ZipDataInfo.h" #include "Poco/Zip/ZipDataInfo.h"
#include "Poco/Zip/ZipArchiveInfo.h" #include "Poco/Zip/ZipArchiveInfo.h"
#include <cstring> #include <cstring>
namespace Poco { namespace Poco {
namespace Zip { namespace Zip {
Poco::DateTime ZipUtil::parseDateTime(const char* pVal, const Poco::UInt32 timePos, const Poco::UInt32 datePos) Poco::DateTime ZipUtil::parseDateTime(const char* pVal, const Poco::UInt32 timePos, const Poco::UInt32 datePos)
{ {
Poco::UInt16 time = ZipUtil::get16BitValue(pVal, timePos); Poco::UInt16 time = ZipUtil::get16BitValue(pVal, timePos);
Poco::UInt16 date = ZipUtil::get16BitValue(pVal, datePos); Poco::UInt16 date = ZipUtil::get16BitValue(pVal, datePos);
//TIME: second 0-4, minute 5-10, hour 11-15, second resolution is 2! //TIME: second 0-4, minute 5-10, hour 11-15, second resolution is 2!
int sec = 2*(time & 0x001fu); // 0000 0000 0001 1111 int sec = 2*(time & 0x001fu); // 0000 0000 0001 1111
int min = ((time & 0x07e0u) >> 5); // 0000 0111 1110 0000 int min = ((time & 0x07e0u) >> 5); // 0000 0111 1110 0000
int hour= ((time & 0xf800u) >> 11); // 1111 1000 0000 0000 int hour= ((time & 0xf800u) >> 11); // 1111 1000 0000 0000
//DATE: day 0-4, month 5-8, year (starting with 1980): 9-16 //DATE: day 0-4, month 5-8, year (starting with 1980): 9-16
int day = (date & 0x001fu); // 0000 0000 0001 1111 int day = (date & 0x001fu); // 0000 0000 0001 1111
int mon = ((date & 0x01e0u) >> 5); // 0000 0001 1110 0000 int mon = ((date & 0x01e0u) >> 5); // 0000 0001 1110 0000
int year= 1980+((date & 0xfe00u) >> 9); // 1111 1110 0000 0000 int year= 1980+((date & 0xfe00u) >> 9); // 1111 1110 0000 0000
return Poco::DateTime(year, mon, day, hour, min, sec); return Poco::DateTime(year, mon, day, hour, min, sec);
} }
void ZipUtil::setDateTime(const Poco::DateTime& dt, char* pVal, const Poco::UInt32 timePos, const Poco::UInt32 datePos) void ZipUtil::setDateTime(const Poco::DateTime& dt, char* pVal, const Poco::UInt32 timePos, const Poco::UInt32 datePos)
{ {
//TIME: second 0-4, minute 5-10, hour 11-15 //TIME: second 0-4, minute 5-10, hour 11-15
Poco::UInt16 time = static_cast<Poco::UInt16>((dt.second()/2) + (dt.minute()<<5) + (dt.hour()<<11)); Poco::UInt16 time = static_cast<Poco::UInt16>((dt.second()/2) + (dt.minute()<<5) + (dt.hour()<<11));
//DATE: day 0-4, month 5-8, year (starting with 1980): 9-16 //DATE: day 0-4, month 5-8, year (starting with 1980): 9-16
int year = dt.year() - 1980; int year = dt.year() - 1980;
if (year<0) if (year<0)
year = 0; year = 0;
Poco::UInt16 date = static_cast<Poco::UInt16>(dt.day() + (dt.month()<<5) + (year<<9)); Poco::UInt16 date = static_cast<Poco::UInt16>(dt.day() + (dt.month()<<5) + (year<<9));
ZipUtil::set16BitValue(time, pVal, timePos); ZipUtil::set16BitValue(time, pVal, timePos);
ZipUtil::set16BitValue(date, pVal, datePos); ZipUtil::set16BitValue(date, pVal, datePos);
} }
std::string ZipUtil::fakeZLibInitString(ZipCommon::CompressionLevel cl) std::string ZipUtil::fakeZLibInitString(ZipCommon::CompressionLevel cl)
{ {
std::string init(2, ' '); std::string init(2, ' ');
// compression info: // compression info:
// deflate is used, bit 0-3: 0x08 // deflate is used, bit 0-3: 0x08
// dictionary size is always 32k: calc ld2(32k)-8 = ld2(2^15) - 8 = 15 - 8 = 7 --> bit 4-7: 0x70 // dictionary size is always 32k: calc ld2(32k)-8 = ld2(2^15) - 8 = 15 - 8 = 7 --> bit 4-7: 0x70
init[0] = '\x78'; init[0] = '\x78';
// now fake flags // now fake flags
// bits 0-4 check bits: set them so that init[0]*256+init[1] % 31 == 0 // bits 0-4 check bits: set them so that init[0]*256+init[1] % 31 == 0
// bit 5: preset dictionary? always no for us, set to 0 // bit 5: preset dictionary? always no for us, set to 0
// bits 6-7: compression level: 00 very fast, 01 fast, 10 normal, 11 best // bits 6-7: compression level: 00 very fast, 01 fast, 10 normal, 11 best
if (cl == ZipCommon::CL_SUPERFAST) if (cl == ZipCommon::CL_SUPERFAST)
init[1] = '\x00'; init[1] = '\x00';
else if (cl == ZipCommon::CL_FAST) else if (cl == ZipCommon::CL_FAST)
init[1] = '\x40'; init[1] = '\x40';
else if (cl == ZipCommon::CL_NORMAL) else if (cl == ZipCommon::CL_NORMAL)
init[1] = '\x80'; init[1] = '\x80';
else else
init[1] = '\xc0'; init[1] = '\xc0';
// now set the last 5 bits // now set the last 5 bits
Poco::UInt16 tmpVal = ((Poco::UInt16)init[0])*256+((unsigned char)init[1]); Poco::UInt16 tmpVal = ((Poco::UInt16)init[0])*256+((unsigned char)init[1]);
char checkBits = (31 - (char)(tmpVal%31)); char checkBits = (31 - (char)(tmpVal%31));
init[1] |= checkBits; // set the lower 5 bits init[1] |= checkBits; // set the lower 5 bits
tmpVal = ((Poco::UInt16)init[0])*256+((unsigned char)init[1]); tmpVal = ((Poco::UInt16)init[0])*256+((unsigned char)init[1]);
poco_assert_dbg ((tmpVal % 31) == 0); poco_assert_dbg ((tmpVal % 31) == 0);
return init; return init;
} }
void ZipUtil::sync(std::istream& in) void ZipUtil::sync(std::istream& in)
{ {
enum enum
{ {
PREFIX = 2, PREFIX = 2,
BUFFER_SIZE = 1024 BUFFER_SIZE = 1024
}; };
char temp[BUFFER_SIZE]; char temp[BUFFER_SIZE];
in.read(temp, PREFIX); in.read(temp, PREFIX);
std::size_t tempPos = PREFIX; std::size_t tempPos = PREFIX;
while (in.good() && !in.eof()) while (in.good() && !in.eof())
{ {
// all zip headers start withe same 2byte prefix // all zip headers start withe same 2byte prefix
if(std::memcmp(ZipLocalFileHeader::HEADER, &temp[tempPos - PREFIX], PREFIX) == 0) if(std::memcmp(ZipLocalFileHeader::HEADER, &temp[tempPos - PREFIX], PREFIX) == 0)
{ {
// we have a possible header! // we have a possible header!
// read the next 2 bytes // read the next 2 bytes
in.read(temp+tempPos, PREFIX); in.read(temp+tempPos, PREFIX);
tempPos += PREFIX; tempPos += PREFIX;
if (std::memcmp(ZipLocalFileHeader::HEADER+PREFIX, &temp[tempPos - PREFIX], PREFIX) == 0 || if (std::memcmp(ZipLocalFileHeader::HEADER+PREFIX, &temp[tempPos - PREFIX], PREFIX) == 0 ||
std::memcmp(ZipArchiveInfo::HEADER+PREFIX, &temp[tempPos - PREFIX], PREFIX) == 0 || std::memcmp(ZipArchiveInfo::HEADER+PREFIX, &temp[tempPos - PREFIX], PREFIX) == 0 ||
std::memcmp(ZipFileInfo::HEADER+PREFIX, &temp[tempPos - PREFIX], PREFIX) == 0 || std::memcmp(ZipFileInfo::HEADER+PREFIX, &temp[tempPos - PREFIX], PREFIX) == 0 ||
std::memcmp(ZipDataInfo::HEADER+PREFIX, &temp[tempPos - PREFIX], PREFIX) == 0) std::memcmp(ZipDataInfo::HEADER+PREFIX, &temp[tempPos - PREFIX], PREFIX) == 0)
{ {
if (std::memcmp(ZipLocalFileHeader::HEADER+PREFIX, &temp[tempPos - PREFIX], PREFIX) == 0) if (std::memcmp(ZipLocalFileHeader::HEADER+PREFIX, &temp[tempPos - PREFIX], PREFIX) == 0)
{ {
in.putback(ZipLocalFileHeader::HEADER[3]); in.putback(ZipLocalFileHeader::HEADER[3]);
in.putback(ZipLocalFileHeader::HEADER[2]); in.putback(ZipLocalFileHeader::HEADER[2]);
in.putback(ZipLocalFileHeader::HEADER[1]); in.putback(ZipLocalFileHeader::HEADER[1]);
in.putback(ZipLocalFileHeader::HEADER[0]); in.putback(ZipLocalFileHeader::HEADER[0]);
} }
else if (std::memcmp(ZipArchiveInfo::HEADER+PREFIX, &temp[tempPos - PREFIX], PREFIX) == 0) else if (std::memcmp(ZipArchiveInfo::HEADER+PREFIX, &temp[tempPos - PREFIX], PREFIX) == 0)
{ {
in.putback(ZipArchiveInfo::HEADER[3]); in.putback(ZipArchiveInfo::HEADER[3]);
in.putback(ZipArchiveInfo::HEADER[2]); in.putback(ZipArchiveInfo::HEADER[2]);
in.putback(ZipArchiveInfo::HEADER[1]); in.putback(ZipArchiveInfo::HEADER[1]);
in.putback(ZipArchiveInfo::HEADER[0]); in.putback(ZipArchiveInfo::HEADER[0]);
} }
else if (std::memcmp(ZipFileInfo::HEADER+PREFIX, &temp[tempPos - PREFIX], PREFIX) == 0) else if (std::memcmp(ZipFileInfo::HEADER+PREFIX, &temp[tempPos - PREFIX], PREFIX) == 0)
{ {
in.putback(ZipFileInfo::HEADER[3]); in.putback(ZipFileInfo::HEADER[3]);
in.putback(ZipFileInfo::HEADER[2]); in.putback(ZipFileInfo::HEADER[2]);
in.putback(ZipFileInfo::HEADER[1]); in.putback(ZipFileInfo::HEADER[1]);
in.putback(ZipFileInfo::HEADER[0]); in.putback(ZipFileInfo::HEADER[0]);
} }
else else
{ {
in.putback(ZipDataInfo::HEADER[3]); in.putback(ZipDataInfo::HEADER[3]);
in.putback(ZipDataInfo::HEADER[2]); in.putback(ZipDataInfo::HEADER[2]);
in.putback(ZipDataInfo::HEADER[1]); in.putback(ZipDataInfo::HEADER[1]);
in.putback(ZipDataInfo::HEADER[0]); in.putback(ZipDataInfo::HEADER[0]);
} }
return; return;
} }
else else
{ {
// we have read 2 bytes, should only be one: putback the last char // we have read 2 bytes, should only be one: putback the last char
in.putback(temp[tempPos - 1]); in.putback(temp[tempPos - 1]);
--tempPos; --tempPos;
} }
} }
else else
{ {
// read one byte // read one byte
in.read(temp + tempPos, 1); in.read(temp + tempPos, 1);
++tempPos; ++tempPos;
} }
if (tempPos > (BUFFER_SIZE - ZipCommon::HEADER_SIZE)) if (tempPos > (BUFFER_SIZE - ZipCommon::HEADER_SIZE))
{ {
std::memcpy(temp, &temp[tempPos - ZipCommon::HEADER_SIZE], ZipCommon::HEADER_SIZE); std::memcpy(temp, &temp[tempPos - ZipCommon::HEADER_SIZE], ZipCommon::HEADER_SIZE);
tempPos = ZipCommon::HEADER_SIZE; tempPos = ZipCommon::HEADER_SIZE;
} }
} }
} }
void ZipUtil::verifyZipEntryFileName(const std::string& fn) void ZipUtil::verifyZipEntryFileName(const std::string& fn)
{ {
if (fn.find("\\") != std::string::npos) if (fn.find("\\") != std::string::npos)
throw ZipException("Illegal entry name " + fn + " containing \\"); throw ZipException("Illegal entry name " + fn + " containing \\");
if (fn == "/") if (fn == "/")
throw ZipException("Illegal entry name /"); throw ZipException("Illegal entry name /");
if (fn.empty()) if (fn.empty())
throw ZipException("Illegal empty entry name"); throw ZipException("Illegal empty entry name");
if (fn.find(ZipCommon::ILLEGAL_PATH) != std::string::npos) if (fn.find(ZipCommon::ILLEGAL_PATH) != std::string::npos)
throw ZipException("Illegal entry name " + fn + " containing " + ZipCommon::ILLEGAL_PATH); throw ZipException("Illegal entry name " + fn + " containing " + ZipCommon::ILLEGAL_PATH);
} }
std::string ZipUtil::validZipEntryFileName(const Poco::Path& entry) std::string ZipUtil::validZipEntryFileName(const Poco::Path& entry)
{ {
std::string fn = entry.toString(Poco::Path::PATH_UNIX); std::string fn = entry.toString(Poco::Path::PATH_UNIX);
verifyZipEntryFileName(fn); verifyZipEntryFileName(fn);
return fn; return fn;
} }
} } // namespace Poco::Zip } } // namespace Poco::Zip

View File

@@ -1,18 +1,18 @@
# #
# Makefile # Makefile
# #
# $Id: //poco/1.3/Zip/testsuite/Makefile#1 $ # $Id: //poco/Main/Zip/testsuite/Makefile#5 $
# #
# Makefile for Poco Zip testsuite # Makefile for Poco Zip testsuite
# #
include $(POCO_BASE)/build/rules/global include $(POCO_BASE)/build/rules/global
objects = ZipTestSuite Driver \ objects = ZipTestSuite Driver \
ZipTest CompressTest PartialStreamTest ZipTest CompressTest PartialStreamTest
target = testrunner target = testrunner
target_version = 1 target_version = 1
target_libs = PocoZip PocoNet PocoFoundation CppUnit target_libs = PocoZip PocoNet PocoFoundation CppUnit
include $(POCO_BASE)/build/rules/exec include $(POCO_BASE)/build/rules/exec

View File

@@ -1,9 +1,9 @@
# #
# TestSuite.vmsbuild # TestSuite.vmsbuild
# #
# $Id: //poco/1.3/Zip/testsuite/TestSuite.vmsbuild#1 $ # $Id: //poco/Main/Zip/testsuite/TestSuite.vmsbuild#1 $
# #
EXE=TestRunner EXE=TestRunner
ZipTestSuite ZipTestSuite
Driver Driver
<SourceFilesHere> <SourceFilesHere>

View File

@@ -1,197 +1,315 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="7.10" Version="7.10"
Name="TestSuite" Name="TestSuite"
ProjectGUID="{9665fc3c-db71-4c6c-aaee-aafd73cb31e7}" ProjectGUID="{9665fc3c-db71-4c6c-aaee-aafd73cb31e7}"
Keyword="Win32Proj"> Keyword="Win32Proj">
<Platforms> <Platforms>
<Platform <Platform
Name="Win32"/> Name="Win32"/>
</Platforms> </Platforms>
<Configurations> <Configurations>
<Configuration <Configuration
Name="debug_shared|Win32" Name="debug_shared|Win32"
OutputDirectory="obj\debug_shared" OutputDirectory="obj\debug_shared"
IntermediateDirectory="obj\debug_shared" IntermediateDirectory="obj\debug_shared"
ConfigurationType="1" ConfigurationType="1"
UseOfMFC="2" UseOfMFC="2"
CharacterSet="2"> CharacterSet="2">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\include;..\..\Foundation\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Net\include" AdditionalIncludeDirectories="..\include;..\..\Foundation\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
MinimalRebuild="TRUE" MinimalRebuild="TRUE"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
BufferSecurityCheck="TRUE" BufferSecurityCheck="TRUE"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE" ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE" RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="TRUE" Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/> DebugInformationFormat="4"/>
<Tool <Tool
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="CppUnitd.lib WinTestRunnerd.lib PocoFoundationd.lib PocoZipd.lib PocoNetd.lib" AdditionalDependencies="CppUnitd.lib WinTestRunnerd.lib PocoFoundationd.lib PocoZipd.lib"
OutputFile="bin/TestSuited.exe" OutputFile="bin/TestSuited.exe"
LinkIncremental="2" LinkIncremental="2"
AdditionalLibraryDirectories="..\..\lib" AdditionalLibraryDirectories="..\..\lib"
GenerateDebugInformation="TRUE" GenerateDebugInformation="TRUE"
ProgramDatabaseFile="bin/TestSuited.pdb" ProgramDatabaseFile="bin/TestSuited.pdb"
SubSystem="2" SubSystem="2"
TargetMachine="1"/> TargetMachine="1"/>
<Tool <Tool
Name="VCMIDLTool"/> Name="VCMIDLTool"/>
<Tool <Tool
Name="VCPostBuildEventTool"/> Name="VCPostBuildEventTool"/>
<Tool <Tool
Name="VCPreBuildEventTool"/> Name="VCPreBuildEventTool"/>
<Tool <Tool
Name="VCPreLinkEventTool"/> Name="VCPreLinkEventTool"/>
<Tool <Tool
Name="VCResourceCompilerTool"/> Name="VCResourceCompilerTool"/>
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool"/> Name="VCWebServiceProxyGeneratorTool"/>
<Tool <Tool
Name="VCXMLDataGeneratorTool"/> Name="VCXMLDataGeneratorTool"/>
<Tool <Tool
Name="VCWebDeploymentTool"/> Name="VCWebDeploymentTool"/>
<Tool <Tool
Name="VCManagedWrapperGeneratorTool"/> Name="VCManagedWrapperGeneratorTool"/>
<Tool <Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/> Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration> </Configuration>
<Configuration <Configuration
Name="release_shared|Win32" Name="release_shared|Win32"
OutputDirectory="obj\release_shared" OutputDirectory="obj\release_shared"
IntermediateDirectory="obj\release_shared" IntermediateDirectory="obj\release_shared"
ConfigurationType="1" ConfigurationType="1"
UseOfMFC="2" UseOfMFC="2"
CharacterSet="2"> CharacterSet="2">
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="4" Optimization="4"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE" EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="TRUE" OmitFramePointers="TRUE"
OptimizeForWindowsApplication="TRUE" OptimizeForWindowsApplication="TRUE"
AdditionalIncludeDirectories="..\include;..\..\Foundation\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Net\include" AdditionalIncludeDirectories="..\include;..\..\Foundation\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
StringPooling="TRUE" StringPooling="TRUE"
RuntimeLibrary="2" RuntimeLibrary="2"
BufferSecurityCheck="FALSE" BufferSecurityCheck="FALSE"
TreatWChar_tAsBuiltInType="TRUE" TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE" ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE" RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="TRUE" Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/> DebugInformationFormat="3"/>
<Tool <Tool
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="CppUnit.lib WinTestRunner.lib PocoFoundation.lib PocoZip.lib PocoNet.lib" AdditionalDependencies="CppUnit.lib WinTestRunner.lib PocoFoundation.lib PocoZip.lib"
OutputFile="bin/TestSuite.exe" OutputFile="bin/TestSuite.exe"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="..\..\lib" AdditionalLibraryDirectories="..\..\lib"
GenerateDebugInformation="FALSE" GenerateDebugInformation="FALSE"
ProgramDatabaseFile="" ProgramDatabaseFile=""
SubSystem="2" SubSystem="2"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"
TargetMachine="1"/> TargetMachine="1"/>
<Tool <Tool
Name="VCMIDLTool"/> Name="VCMIDLTool"/>
<Tool <Tool
Name="VCPostBuildEventTool"/> Name="VCPostBuildEventTool"/>
<Tool <Tool
Name="VCPreBuildEventTool"/> Name="VCPreBuildEventTool"/>
<Tool <Tool
Name="VCPreLinkEventTool"/> Name="VCPreLinkEventTool"/>
<Tool <Tool
Name="VCResourceCompilerTool"/> Name="VCResourceCompilerTool"/>
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool"/> Name="VCWebServiceProxyGeneratorTool"/>
<Tool <Tool
Name="VCXMLDataGeneratorTool"/> Name="VCXMLDataGeneratorTool"/>
<Tool <Tool
Name="VCWebDeploymentTool"/> Name="VCWebDeploymentTool"/>
<Tool <Tool
Name="VCManagedWrapperGeneratorTool"/> Name="VCManagedWrapperGeneratorTool"/>
<Tool <Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/> Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration> </Configuration>
</Configurations> <Configuration
<References> Name="debug_static|Win32"
</References> OutputDirectory="obj\debug_static"
<Files> IntermediateDirectory="obj\debug_static"
<Filter ConfigurationType="1"
Name="Zip" UseOfMFC="2"
Filter=""> CharacterSet="2">
<Filter <Tool
Name="Header Files" Name="VCCLCompilerTool"
Filter=""> Optimization="0"
<File AdditionalIncludeDirectories="..\include;..\..\Foundation\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include"
RelativePath=".\src\CompressTest.h"> PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_STATIC;WINVER=0x0500;winmm.lib"
</File> MinimalRebuild="TRUE"
<File BasicRuntimeChecks="3"
RelativePath=".\src\PartialStreamTest.h"> RuntimeLibrary="3"
</File> BufferSecurityCheck="TRUE"
<File TreatWChar_tAsBuiltInType="TRUE"
RelativePath=".\src\ZipTest.h"> ForceConformanceInForLoopScope="TRUE"
</File> RuntimeTypeInfo="TRUE"
</Filter> UsePrecompiledHeader="0"
<Filter WarningLevel="3"
Name="Source Files" Detect64BitPortabilityProblems="TRUE"
Filter=""> DebugInformationFormat="4"/>
<File <Tool
RelativePath=".\src\CompressTest.cpp"> Name="VCCustomBuildTool"/>
</File> <Tool
<File Name="VCLinkerTool"
RelativePath=".\src\PartialStreamTest.cpp"> AdditionalDependencies="CppUnitmtd.lib WinTestRunnermtd.lib PocoFoundationmtd.lib PocoZipmtd.lib winmm.lib ..\..\CppUnit\WinTestRunner\obj\debug_static\WinTestRunner.res"
</File> OutputFile="bin/TestSuitemtd.exe"
<File LinkIncremental="2"
RelativePath=".\src\ZipTest.cpp"> AdditionalLibraryDirectories="..\..\lib"
</File> GenerateDebugInformation="TRUE"
</Filter> ProgramDatabaseFile="bin/TestSuitemtd.pdb"
</Filter> SubSystem="2"
<Filter TargetMachine="1"/>
Name="_Suite" <Tool
Filter=""> Name="VCMIDLTool"/>
<Filter <Tool
Name="Header Files" Name="VCPostBuildEventTool"/>
Filter=""> <Tool
<File Name="VCPreBuildEventTool"/>
RelativePath=".\src\ZipTestSuite.h"> <Tool
</File> Name="VCPreLinkEventTool"/>
</Filter> <Tool
<Filter Name="VCResourceCompilerTool"/>
Name="Source Files" <Tool
Filter=""> Name="VCWebServiceProxyGeneratorTool"/>
<File <Tool
RelativePath=".\src\ZipTestSuite.cpp"> Name="VCXMLDataGeneratorTool"/>
</File> <Tool
</Filter> Name="VCWebDeploymentTool"/>
</Filter> <Tool
<Filter Name="VCManagedWrapperGeneratorTool"/>
Name="_Driver" <Tool
Filter=""> Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
<Filter </Configuration>
Name="Source Files" <Configuration
Filter=""> Name="release_static|Win32"
<File OutputDirectory="obj\release_static"
RelativePath=".\src\WinDriver.cpp"> IntermediateDirectory="obj\release_static"
</File> ConfigurationType="1"
</Filter> UseOfMFC="2"
</Filter> CharacterSet="2">
</Files> <Tool
<Globals> Name="VCCLCompilerTool"
</Globals> Optimization="4"
</VisualStudioProject> InlineFunctionExpansion="1"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1"
OmitFramePointers="TRUE"
OptimizeForWindowsApplication="TRUE"
AdditionalIncludeDirectories="..\include;..\..\Foundation\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_STATIC;WINVER=0x0500;winmm.lib"
StringPooling="TRUE"
RuntimeLibrary="2"
BufferSecurityCheck="FALSE"
TreatWChar_tAsBuiltInType="TRUE"
ForceConformanceInForLoopScope="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="CppUnitmt.lib WinTestRunnermt.lib PocoFoundationmt.lib PocoZipmt.lib winmm.lib ..\..\CppUnit\WinTestRunner\obj\release_static\WinTestRunner.res"
OutputFile="bin/TestSuitemt.exe"
LinkIncremental="1"
AdditionalLibraryDirectories="..\..\lib"
GenerateDebugInformation="FALSE"
ProgramDatabaseFile=""
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Zip"
Filter="">
<Filter
Name="Header Files"
Filter="">
<File
RelativePath=".\src\CompressTest.h">
</File>
<File
RelativePath=".\src\PartialStreamTest.h">
</File>
<File
RelativePath=".\src\ZipTest.h">
</File>
</Filter>
<Filter
Name="Source Files"
Filter="">
<File
RelativePath=".\src\CompressTest.cpp">
</File>
<File
RelativePath=".\src\PartialStreamTest.cpp">
</File>
<File
RelativePath=".\src\ZipTest.cpp">
</File>
</Filter>
</Filter>
<Filter
Name="_Suite"
Filter="">
<Filter
Name="Header Files"
Filter="">
<File
RelativePath=".\src\ZipTestSuite.h">
</File>
</Filter>
<Filter
Name="Source Files"
Filter="">
<File
RelativePath=".\src\ZipTestSuite.cpp">
</File>
</Filter>
</Filter>
<Filter
Name="_Driver"
Filter="">
<Filter
Name="Source Files"
Filter="">
<File
RelativePath=".\src\WinDriver.cpp">
</File>
</Filter>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -1,267 +1,444 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="8,00" Version="8,00"
Name="TestSuite" Name="TestSuite"
ProjectGUID="{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}" ProjectGUID="{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}"
Keyword="Win32Proj" Keyword="Win32Proj"
> >
<Platforms> <Platforms>
<Platform <Platform
Name="Win32" Name="Win32"
/> />
</Platforms> </Platforms>
<ToolFiles> <ToolFiles>
</ToolFiles> </ToolFiles>
<Configurations> <Configurations>
<Configuration <Configuration
Name="debug_shared|Win32" Name="debug_shared|Win32"
OutputDirectory="obj\debug_shared" OutputDirectory="obj\debug_shared"
IntermediateDirectory="obj\debug_shared" IntermediateDirectory="obj\debug_shared"
ConfigurationType="1" ConfigurationType="1"
UseOfMFC="2" UseOfMFC="2"
CharacterSet="2" CharacterSet="2"
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
/> />
<Tool <Tool
Name="VCXMLDataGeneratorTool" Name="VCXMLDataGeneratorTool"
/> />
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool" Name="VCWebServiceProxyGeneratorTool"
/> />
<Tool <Tool
Name="VCMIDLTool" Name="VCMIDLTool"
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="0" Optimization="0"
AdditionalIncludeDirectories="..\include;..\..\Foundation\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Net\include" AdditionalIncludeDirectories="..\include;..\..\Foundation\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
MinimalRebuild="true" MinimalRebuild="true"
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="3" RuntimeLibrary="3"
BufferSecurityCheck="true" BufferSecurityCheck="true"
TreatWChar_tAsBuiltInType="true" TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true" ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true" RuntimeTypeInfo="true"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="true" Detect64BitPortabilityProblems="true"
DebugInformationFormat="4" DebugInformationFormat="4"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
/> />
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="CppUnitd.lib WinTestRunnerd.lib PocoFoundationd.lib PocoZipd.lib PocoNetd.lib" AdditionalDependencies="CppUnitd.lib WinTestRunnerd.lib PocoFoundationd.lib PocoZipd.lib"
OutputFile="bin/TestSuited.exe" OutputFile="bin/TestSuited.exe"
LinkIncremental="2" LinkIncremental="2"
AdditionalLibraryDirectories="..\..\lib" AdditionalLibraryDirectories="..\..\lib"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="bin/TestSuited.pdb" ProgramDatabaseFile="bin/TestSuited.pdb"
SubSystem="2" SubSystem="2"
TargetMachine="1" TargetMachine="1"
/> />
<Tool <Tool
Name="VCALinkTool" Name="VCALinkTool"
/> />
<Tool <Tool
Name="VCManifestTool" Name="VCManifestTool"
/> />
<Tool <Tool
Name="VCXDCMakeTool" Name="VCXDCMakeTool"
/> />
<Tool <Tool
Name="VCBscMakeTool" Name="VCBscMakeTool"
/> />
<Tool <Tool
Name="VCFxCopTool" Name="VCFxCopTool"
/> />
<Tool <Tool
Name="VCAppVerifierTool" Name="VCAppVerifierTool"
/> />
<Tool <Tool
Name="VCWebDeploymentTool" Name="VCWebDeploymentTool"
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
/> />
</Configuration> </Configuration>
<Configuration <Configuration
Name="release_shared|Win32" Name="release_shared|Win32"
OutputDirectory="obj\release_shared" OutputDirectory="obj\release_shared"
IntermediateDirectory="obj\release_shared" IntermediateDirectory="obj\release_shared"
ConfigurationType="1" ConfigurationType="1"
UseOfMFC="2" UseOfMFC="2"
CharacterSet="2" CharacterSet="2"
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
/> />
<Tool <Tool
Name="VCXMLDataGeneratorTool" Name="VCXMLDataGeneratorTool"
/> />
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool" Name="VCWebServiceProxyGeneratorTool"
/> />
<Tool <Tool
Name="VCMIDLTool" Name="VCMIDLTool"
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="4" Optimization="4"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="true" OmitFramePointers="true"
AdditionalIncludeDirectories="..\include;..\..\Foundation\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Net\include" AdditionalIncludeDirectories="..\include;..\..\Foundation\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
StringPooling="true" StringPooling="true"
RuntimeLibrary="2" RuntimeLibrary="2"
BufferSecurityCheck="false" BufferSecurityCheck="false"
TreatWChar_tAsBuiltInType="true" TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true" ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true" RuntimeTypeInfo="true"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="true" Detect64BitPortabilityProblems="true"
DebugInformationFormat="3" DebugInformationFormat="3"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
/> />
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="CppUnit.lib WinTestRunner.lib PocoFoundation.lib PocoZip.lib PocoNet.lib" AdditionalDependencies="CppUnit.lib WinTestRunner.lib PocoFoundation.lib PocoZip.lib"
OutputFile="bin/TestSuite.exe" OutputFile="bin/TestSuite.exe"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="..\..\lib" AdditionalLibraryDirectories="..\..\lib"
GenerateDebugInformation="false" GenerateDebugInformation="false"
ProgramDatabaseFile="" ProgramDatabaseFile=""
SubSystem="2" SubSystem="2"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"
TargetMachine="1" TargetMachine="1"
/> />
<Tool <Tool
Name="VCALinkTool" Name="VCALinkTool"
/> />
<Tool <Tool
Name="VCManifestTool" Name="VCManifestTool"
/> />
<Tool <Tool
Name="VCXDCMakeTool" Name="VCXDCMakeTool"
/> />
<Tool <Tool
Name="VCBscMakeTool" Name="VCBscMakeTool"
/> />
<Tool <Tool
Name="VCFxCopTool" Name="VCFxCopTool"
/> />
<Tool <Tool
Name="VCAppVerifierTool" Name="VCAppVerifierTool"
/> />
<Tool <Tool
Name="VCWebDeploymentTool" Name="VCWebDeploymentTool"
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
/> />
</Configuration> </Configuration>
</Configurations> <Configuration
<References> Name="release_static|Win32"
</References> OutputDirectory="obj\release_static"
<Files> IntermediateDirectory="obj\release_static"
<Filter ConfigurationType="1"
Name="Zip" InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
> UseOfMFC="2"
<Filter CharacterSet="2"
Name="Header Files" >
> <Tool
<File Name="VCPreBuildEventTool"
RelativePath=".\src\CompressTest.h" />
> <Tool
</File> Name="VCCustomBuildTool"
<File />
RelativePath=".\src\PartialStreamTest.h" <Tool
> Name="VCXMLDataGeneratorTool"
</File> />
<File <Tool
RelativePath=".\src\ZipTest.h" Name="VCWebServiceProxyGeneratorTool"
> />
</File> <Tool
</Filter> Name="VCMIDLTool"
<Filter />
Name="Source Files" <Tool
> Name="VCCLCompilerTool"
<File Optimization="4"
RelativePath=".\src\CompressTest.cpp" InlineFunctionExpansion="1"
> EnableIntrinsicFunctions="true"
</File> FavorSizeOrSpeed="1"
<File OmitFramePointers="true"
RelativePath=".\src\PartialStreamTest.cpp" AdditionalIncludeDirectories="..\include;..\..\Foundation\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include"
> PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_STATIC;WINVER=0x0500"
</File> StringPooling="true"
<File RuntimeLibrary="2"
RelativePath=".\src\ZipTest.cpp" BufferSecurityCheck="false"
> TreatWChar_tAsBuiltInType="true"
</File> ForceConformanceInForLoopScope="true"
</Filter> RuntimeTypeInfo="true"
</Filter> UsePrecompiledHeader="0"
<Filter WarningLevel="3"
Name="_Suite" Detect64BitPortabilityProblems="true"
> DebugInformationFormat="0"
<Filter />
Name="Header Files" <Tool
> Name="VCManagedResourceCompilerTool"
<File />
RelativePath=".\src\ZipTestSuite.h" <Tool
> Name="VCResourceCompilerTool"
</File> />
</Filter> <Tool
<Filter Name="VCPreLinkEventTool"
Name="Source Files" />
> <Tool
<File Name="VCLinkerTool"
RelativePath=".\src\ZipTestSuite.cpp" AdditionalDependencies="CppUnitmt.lib WinTestRunnermt.lib PocoFoundationmt.lib PocoZipmt.lib winmm.lib ..\..\CppUnit\WinTestRunner\obj\release_static\WinTestRunner.res"
> OutputFile="bin/TestSuitemt.exe"
</File> LinkIncremental="1"
</Filter> AdditionalLibraryDirectories="..\..\lib"
</Filter> GenerateDebugInformation="false"
<Filter ProgramDatabaseFile=""
Name="_Driver" SubSystem="2"
> OptimizeReferences="2"
<Filter EnableCOMDATFolding="2"
Name="Source Files" TargetMachine="1"
> />
<File <Tool
RelativePath=".\src\WinDriver.cpp" Name="VCALinkTool"
> />
</File> <Tool
</Filter> Name="VCManifestTool"
</Filter> />
</Files> <Tool
<Globals> Name="VCXDCMakeTool"
</Globals> />
</VisualStudioProject> <Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="debug_static|Win32"
OutputDirectory="obj\debug_static"
IntermediateDirectory="obj\debug_static"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="2"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\include;..\..\Foundation\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_STATIC;WINVER=0x0500"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
BufferSecurityCheck="true"
TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="CppUnitmtd.lib WinTestRunnermtd.lib PocoFoundationmtd.lib PocoZipmtd.lib winmm.lib ..\..\CppUnit\WinTestRunner\obj\debug_static\WinTestRunner.res"
OutputFile="bin/TestSuitemtd.exe"
LinkIncremental="2"
AdditionalLibraryDirectories="..\..\lib"
GenerateDebugInformation="true"
ProgramDatabaseFile="bin/TestSuitemtd.pdb"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Zip"
>
<Filter
Name="Header Files"
>
<File
RelativePath=".\src\CompressTest.h"
>
</File>
<File
RelativePath=".\src\PartialStreamTest.h"
>
</File>
<File
RelativePath=".\src\ZipTest.h"
>
</File>
</Filter>
<Filter
Name="Source Files"
>
<File
RelativePath=".\src\CompressTest.cpp"
>
</File>
<File
RelativePath=".\src\PartialStreamTest.cpp"
>
</File>
<File
RelativePath=".\src\ZipTest.cpp"
>
</File>
</Filter>
</Filter>
<Filter
Name="_Suite"
>
<Filter
Name="Header Files"
>
<File
RelativePath=".\src\ZipTestSuite.h"
>
</File>
</Filter>
<Filter
Name="Source Files"
>
<File
RelativePath=".\src\ZipTestSuite.cpp"
>
</File>
</Filter>
</Filter>
<Filter
Name="_Driver"
>
<Filter
Name="Source Files"
>
<File
RelativePath=".\src\WinDriver.cpp"
>
</File>
</Filter>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@@ -1,267 +1,266 @@
<?xml version="1.0" encoding="Windows-1252"?> <?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject <VisualStudioProject
ProjectType="Visual C++" ProjectType="Visual C++"
Version="9.00" Version="9,00"
Name="TestSuite" Name="TestSuite"
ProjectGUID="{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}" ProjectGUID="{9665FC3C-DB71-4C6C-AAEE-AAFD73CB31E7}"
Keyword="Win32Proj" Keyword="Win32Proj"
> TargetFrameworkVersion="131072"
<Platforms> >
<Platform <Platforms>
Name="Win32" <Platform
/> Name="Win32"
</Platforms> />
<ToolFiles> </Platforms>
</ToolFiles> <ToolFiles>
<Configurations> </ToolFiles>
<Configuration <Configurations>
Name="debug_shared|Win32" <Configuration
OutputDirectory="obj\debug_shared" Name="debug_shared|Win32"
IntermediateDirectory="obj\debug_shared" OutputDirectory="obj\debug_shared"
ConfigurationType="1" IntermediateDirectory="obj\debug_shared"
UseOfMFC="2" ConfigurationType="1"
CharacterSet="2" UseOfMFC="2"
> CharacterSet="2"
<Tool >
Name="VCPreBuildEventTool" <Tool
/> Name="VCPreBuildEventTool"
<Tool />
Name="VCCustomBuildTool" <Tool
/> Name="VCCustomBuildTool"
<Tool />
Name="VCXMLDataGeneratorTool" <Tool
/> Name="VCXMLDataGeneratorTool"
<Tool />
Name="VCWebServiceProxyGeneratorTool" <Tool
/> Name="VCWebServiceProxyGeneratorTool"
<Tool />
Name="VCMIDLTool" <Tool
/> Name="VCMIDLTool"
<Tool />
Name="VCCLCompilerTool" <Tool
Optimization="0" Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\include;..\..\Foundation\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Net\include" Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500" AdditionalIncludeDirectories="..\include;..\..\Foundation\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Net\include"
MinimalRebuild="true" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
BasicRuntimeChecks="3" MinimalRebuild="true"
RuntimeLibrary="3" BasicRuntimeChecks="3"
BufferSecurityCheck="true" RuntimeLibrary="3"
TreatWChar_tAsBuiltInType="true" BufferSecurityCheck="true"
ForceConformanceInForLoopScope="true" TreatWChar_tAsBuiltInType="true"
RuntimeTypeInfo="true" ForceConformanceInForLoopScope="true"
UsePrecompiledHeader="0" RuntimeTypeInfo="true"
WarningLevel="3" UsePrecompiledHeader="0"
Detect64BitPortabilityProblems="false" WarningLevel="3"
DebugInformationFormat="4" Detect64BitPortabilityProblems="false"
/> DebugInformationFormat="4"
<Tool />
Name="VCManagedResourceCompilerTool" <Tool
/> Name="VCManagedResourceCompilerTool"
<Tool />
Name="VCResourceCompilerTool" <Tool
/> Name="VCResourceCompilerTool"
<Tool />
Name="VCPreLinkEventTool" <Tool
/> Name="VCPreLinkEventTool"
<Tool />
Name="VCLinkerTool" <Tool
AdditionalDependencies="CppUnitd.lib WinTestRunnerd.lib PocoFoundationd.lib PocoZipd.lib PocoNetd.lib" Name="VCLinkerTool"
OutputFile="bin/TestSuited.exe" AdditionalDependencies="CppUnitd.lib WinTestRunnerd.lib PocoFoundationd.lib PocoZipd.lib PocoNetd.lib"
LinkIncremental="2" OutputFile="bin/TestSuited.exe"
AdditionalLibraryDirectories="..\..\lib" LinkIncremental="2"
GenerateDebugInformation="true" AdditionalLibraryDirectories="..\..\lib"
ProgramDatabaseFile="bin/TestSuited.pdb" GenerateDebugInformation="true"
SubSystem="2" ProgramDatabaseFile="bin/TestSuited.pdb"
TargetMachine="1" SubSystem="2"
/> RandomizedBaseAddress="1"
<Tool DataExecutionPrevention="0"
Name="VCALinkTool" TargetMachine="1"
/> />
<Tool <Tool
Name="VCManifestTool" Name="VCALinkTool"
/> />
<Tool <Tool
Name="VCXDCMakeTool" Name="VCManifestTool"
/> />
<Tool <Tool
Name="VCBscMakeTool" Name="VCXDCMakeTool"
/> />
<Tool <Tool
Name="VCFxCopTool" Name="VCBscMakeTool"
/> />
<Tool <Tool
Name="VCAppVerifierTool" Name="VCFxCopTool"
/> />
<Tool <Tool
Name="VCWebDeploymentTool" Name="VCAppVerifierTool"
/> />
<Tool <Tool
Name="VCPostBuildEventTool" Name="VCPostBuildEventTool"
/> />
</Configuration> </Configuration>
<Configuration <Configuration
Name="release_shared|Win32" Name="release_shared|Win32"
OutputDirectory="obj\release_shared" OutputDirectory="obj\release_shared"
IntermediateDirectory="obj\release_shared" IntermediateDirectory="obj\release_shared"
ConfigurationType="1" ConfigurationType="1"
UseOfMFC="2" UseOfMFC="2"
CharacterSet="2" CharacterSet="2"
> >
<Tool <Tool
Name="VCPreBuildEventTool" Name="VCPreBuildEventTool"
/> />
<Tool <Tool
Name="VCCustomBuildTool" Name="VCCustomBuildTool"
/> />
<Tool <Tool
Name="VCXMLDataGeneratorTool" Name="VCXMLDataGeneratorTool"
/> />
<Tool <Tool
Name="VCWebServiceProxyGeneratorTool" Name="VCWebServiceProxyGeneratorTool"
/> />
<Tool <Tool
Name="VCMIDLTool" Name="VCMIDLTool"
/> />
<Tool <Tool
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
Optimization="4" Optimization="4"
InlineFunctionExpansion="1" InlineFunctionExpansion="1"
EnableIntrinsicFunctions="true" EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1" FavorSizeOrSpeed="1"
OmitFramePointers="true" OmitFramePointers="true"
AdditionalIncludeDirectories="..\include;..\..\Foundation\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Net\include" AdditionalIncludeDirectories="..\include;..\..\Foundation\include;..\..\CppUnit\include;..\..\CppUnit\WinTestRunner\include;..\..\Net\include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;POCO_DLL;WINVER=0x0500"
StringPooling="true" StringPooling="true"
RuntimeLibrary="2" RuntimeLibrary="2"
BufferSecurityCheck="false" BufferSecurityCheck="false"
TreatWChar_tAsBuiltInType="true" TreatWChar_tAsBuiltInType="true"
ForceConformanceInForLoopScope="true" ForceConformanceInForLoopScope="true"
RuntimeTypeInfo="true" RuntimeTypeInfo="true"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
WarningLevel="3" WarningLevel="3"
Detect64BitPortabilityProblems="false" Detect64BitPortabilityProblems="false"
DebugInformationFormat="3" DebugInformationFormat="3"
/> />
<Tool <Tool
Name="VCManagedResourceCompilerTool" Name="VCManagedResourceCompilerTool"
/> />
<Tool <Tool
Name="VCResourceCompilerTool" Name="VCResourceCompilerTool"
/> />
<Tool <Tool
Name="VCPreLinkEventTool" Name="VCPreLinkEventTool"
/> />
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
AdditionalDependencies="CppUnit.lib WinTestRunner.lib PocoFoundation.lib PocoZip.lib PocoNet.lib" AdditionalDependencies="CppUnit.lib WinTestRunner.lib PocoFoundation.lib PocoZip.lib PocoNet.lib"
OutputFile="bin/TestSuite.exe" OutputFile="bin/TestSuite.exe"
LinkIncremental="1" LinkIncremental="1"
AdditionalLibraryDirectories="..\..\lib" AdditionalLibraryDirectories="..\..\lib"
GenerateDebugInformation="false" GenerateDebugInformation="false"
ProgramDatabaseFile="" ProgramDatabaseFile=""
SubSystem="2" SubSystem="2"
OptimizeReferences="2" OptimizeReferences="2"
EnableCOMDATFolding="2" EnableCOMDATFolding="2"
TargetMachine="1" RandomizedBaseAddress="1"
/> DataExecutionPrevention="0"
<Tool TargetMachine="1"
Name="VCALinkTool" />
/> <Tool
<Tool Name="VCALinkTool"
Name="VCManifestTool" />
/> <Tool
<Tool Name="VCManifestTool"
Name="VCXDCMakeTool" />
/> <Tool
<Tool Name="VCXDCMakeTool"
Name="VCBscMakeTool" />
/> <Tool
<Tool Name="VCBscMakeTool"
Name="VCFxCopTool" />
/> <Tool
<Tool Name="VCFxCopTool"
Name="VCAppVerifierTool" />
/> <Tool
<Tool Name="VCAppVerifierTool"
Name="VCWebDeploymentTool" />
/> <Tool
<Tool Name="VCPostBuildEventTool"
Name="VCPostBuildEventTool" />
/> </Configuration>
</Configuration> </Configurations>
</Configurations> <References>
<References> </References>
</References> <Files>
<Files> <Filter
<Filter Name="Zip"
Name="Zip" >
> <Filter
<Filter Name="Header Files"
Name="Header Files" >
> <File
<File RelativePath=".\src\CompressTest.h"
RelativePath=".\src\CompressTest.h" >
> </File>
</File> <File
<File RelativePath=".\src\PartialStreamTest.h"
RelativePath=".\src\PartialStreamTest.h" >
> </File>
</File> <File
<File RelativePath=".\src\ZipTest.h"
RelativePath=".\src\ZipTest.h" >
> </File>
</File> </Filter>
</Filter> <Filter
<Filter Name="Source Files"
Name="Source Files" >
> <File
<File RelativePath=".\src\CompressTest.cpp"
RelativePath=".\src\CompressTest.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\PartialStreamTest.cpp"
RelativePath=".\src\PartialStreamTest.cpp" >
> </File>
</File> <File
<File RelativePath=".\src\ZipTest.cpp"
RelativePath=".\src\ZipTest.cpp" >
> </File>
</File> </Filter>
</Filter> </Filter>
</Filter> <Filter
<Filter Name="_Suite"
Name="_Suite" >
> <Filter
<Filter Name="Header Files"
Name="Header Files" >
> <File
<File RelativePath=".\src\ZipTestSuite.h"
RelativePath=".\src\ZipTestSuite.h" >
> </File>
</File> </Filter>
</Filter> <Filter
<Filter Name="Source Files"
Name="Source Files" >
> <File
<File RelativePath=".\src\ZipTestSuite.cpp"
RelativePath=".\src\ZipTestSuite.cpp" >
> </File>
</File> </Filter>
</Filter> </Filter>
</Filter> <Filter
<Filter Name="_Driver"
Name="_Driver" >
> <Filter
<Filter Name="Source Files"
Name="Source Files" >
> <File
<File RelativePath=".\src\WinDriver.cpp"
RelativePath=".\src\WinDriver.cpp" >
> </File>
</File> </Filter>
</Filter> </Filter>
</Filter> </Files>
</Files> <Globals>
<Globals> </Globals>
</Globals> </VisualStudioProject>
</VisualStudioProject>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,165 +1,165 @@
// //
// CompressTest.cpp // CompressTest.cpp
// //
// $Id: //poco/1.3/Zip/testsuite/src/CompressTest.cpp#5 $ // $Id: //poco/Main/Zip/testsuite/src/CompressTest.cpp#9 $
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "CompressTest.h" #include "CompressTest.h"
#include "ZipTest.h" #include "ZipTest.h"
#include "Poco/Zip/Compress.h" #include "Poco/Zip/Compress.h"
#include "Poco/Zip/ZipManipulator.h" #include "Poco/Zip/ZipManipulator.h"
#include "Poco/File.h" #include "Poco/File.h"
#include "Poco/FileStream.h" #include "Poco/FileStream.h"
#include "CppUnit/TestCaller.h" #include "CppUnit/TestCaller.h"
#include "CppUnit/TestSuite.h" #include "CppUnit/TestSuite.h"
#include <fstream> #include <fstream>
using namespace Poco::Zip; using namespace Poco::Zip;
CompressTest::CompressTest(const std::string& name): CppUnit::TestCase(name) CompressTest::CompressTest(const std::string& name): CppUnit::TestCase(name)
{ {
} }
CompressTest::~CompressTest() CompressTest::~CompressTest()
{ {
} }
void CompressTest::testSingleFile() void CompressTest::testSingleFile()
{ {
std::ofstream out("appinf.zip", std::ios::binary); std::ofstream out("appinf.zip", std::ios::binary);
Poco::Path theFile(ZipTest::getTestFile("test.zip")); Poco::Path theFile(ZipTest::getTestFile("test.zip"));
Compress c(out, true); Compress c(out, true);
c.addFile(theFile, theFile.getFileName()); c.addFile(theFile, theFile.getFileName());
ZipArchive a(c.close()); ZipArchive a(c.close());
} }
void CompressTest::testDirectory() void CompressTest::testDirectory()
{ {
std::ofstream out("pocobin.zip", std::ios::binary); std::ofstream out("pocobin.zip", std::ios::binary);
Poco::File aFile("some/"); Poco::File aFile("some/");
if (aFile.exists()) if (aFile.exists())
aFile.remove(true); aFile.remove(true);
Poco::File aDir("some/recursive/dir/"); Poco::File aDir("some/recursive/dir/");
aDir.createDirectories(); aDir.createDirectories();
Poco::File aDir2("some/other/recursive/dir/"); Poco::File aDir2("some/other/recursive/dir/");
aDir2.createDirectories(); aDir2.createDirectories();
Poco::File aF("some/recursive/dir/test.file"); Poco::File aF("some/recursive/dir/test.file");
aF.createFile(); aF.createFile();
Poco::FileOutputStream fos(aF.path()); Poco::FileOutputStream fos(aF.path());
fos << "just some test data"; fos << "just some test data";
fos.close(); fos.close();
Poco::Path theFile(aFile.path()); Poco::Path theFile(aFile.path());
theFile.makeDirectory(); theFile.makeDirectory();
Compress c(out, true); Compress c(out, true);
c.addRecursive(theFile, ZipCommon::CL_MAXIMUM, false, theFile); c.addRecursive(theFile, ZipCommon::CL_MAXIMUM, false, theFile);
ZipArchive a(c.close()); ZipArchive a(c.close());
} }
void CompressTest::testManipulator() void CompressTest::testManipulator()
{ {
{ {
std::ofstream out("appinf.zip", std::ios::binary); std::ofstream out("appinf.zip", std::ios::binary);
Poco::Path theFile(ZipTest::getTestFile("test.zip")); Poco::Path theFile(ZipTest::getTestFile("test.zip"));
Compress c(out, true); Compress c(out, true);
c.addFile(theFile, theFile.getFileName()); c.addFile(theFile, theFile.getFileName());
ZipArchive a(c.close()); ZipArchive a(c.close());
} }
ZipManipulator zm("appinf.zip", true); ZipManipulator zm("appinf.zip", true);
zm.renameFile("test.zip", "renamedtest.zip"); zm.renameFile("test.zip", "renamedtest.zip");
zm.addFile("doc/othertest.zip", ZipTest::getTestFile("test.zip")); zm.addFile("doc/othertest.zip", ZipTest::getTestFile("test.zip"));
ZipArchive archive=zm.commit(); ZipArchive archive=zm.commit();
assert (archive.findHeader("doc/othertest.zip") != archive.headerEnd()); assert (archive.findHeader("doc/othertest.zip") != archive.headerEnd());
} }
void CompressTest::testManipulatorDel() void CompressTest::testManipulatorDel()
{ {
{ {
std::ofstream out("appinf.zip", std::ios::binary); std::ofstream out("appinf.zip", std::ios::binary);
Poco::Path theFile(ZipTest::getTestFile("test.zip")); Poco::Path theFile(ZipTest::getTestFile("test.zip"));
Compress c(out, true); Compress c(out, true);
c.addFile(theFile, theFile.getFileName()); c.addFile(theFile, theFile.getFileName());
ZipArchive a(c.close()); ZipArchive a(c.close());
} }
ZipManipulator zm("appinf.zip", true); ZipManipulator zm("appinf.zip", true);
zm.deleteFile("test.zip"); zm.deleteFile("test.zip");
zm.addFile("doc/data.zip", ZipTest::getTestFile("data.zip")); zm.addFile("doc/data.zip", ZipTest::getTestFile("data.zip"));
ZipArchive archive=zm.commit(); ZipArchive archive=zm.commit();
assert (archive.findHeader("test.zip") == archive.headerEnd()); assert (archive.findHeader("test.zip") == archive.headerEnd());
assert (archive.findHeader("doc/data.zip") != archive.headerEnd()); assert (archive.findHeader("doc/data.zip") != archive.headerEnd());
} }
void CompressTest::testManipulatorReplace() void CompressTest::testManipulatorReplace()
{ {
{ {
std::ofstream out("appinf.zip", std::ios::binary); std::ofstream out("appinf.zip", std::ios::binary);
Poco::Path theFile(ZipTest::getTestFile("test.zip")); Poco::Path theFile(ZipTest::getTestFile("test.zip"));
Compress c(out, true); Compress c(out, true);
c.addFile(theFile, theFile.getFileName()); c.addFile(theFile, theFile.getFileName());
ZipArchive a(c.close()); ZipArchive a(c.close());
} }
ZipManipulator zm("appinf.zip", true); ZipManipulator zm("appinf.zip", true);
zm.replaceFile("test.zip", ZipTest::getTestFile("doc.zip")); zm.replaceFile("test.zip", ZipTest::getTestFile("doc.zip"));
ZipArchive archive=zm.commit(); ZipArchive archive=zm.commit();
assert (archive.findHeader("test.zip") != archive.headerEnd()); assert (archive.findHeader("test.zip") != archive.headerEnd());
assert (archive.findHeader("doc.zip") == archive.headerEnd()); assert (archive.findHeader("doc.zip") == archive.headerEnd());
} }
void CompressTest::setUp() void CompressTest::setUp()
{ {
} }
void CompressTest::tearDown() void CompressTest::tearDown()
{ {
} }
CppUnit::Test* CompressTest::suite() CppUnit::Test* CompressTest::suite()
{ {
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("CompressTest"); CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("CompressTest");
CppUnit_addTest(pSuite, CompressTest, testSingleFile); CppUnit_addTest(pSuite, CompressTest, testSingleFile);
CppUnit_addTest(pSuite, CompressTest, testDirectory); CppUnit_addTest(pSuite, CompressTest, testDirectory);
CppUnit_addTest(pSuite, CompressTest, testManipulator); CppUnit_addTest(pSuite, CompressTest, testManipulator);
CppUnit_addTest(pSuite, CompressTest, testManipulatorDel); CppUnit_addTest(pSuite, CompressTest, testManipulatorDel);
CppUnit_addTest(pSuite, CompressTest, testManipulatorReplace); CppUnit_addTest(pSuite, CompressTest, testManipulatorReplace);
return pSuite; return pSuite;
} }

View File

@@ -1,64 +1,64 @@
// //
// CompressTest.h // CompressTest.h
// //
// $Id: //poco/1.3/Zip/testsuite/src/CompressTest.h#4 $ // $Id: //poco/Main/Zip/testsuite/src/CompressTest.h#5 $
// //
// Definition of the CompressTest class. // Definition of the CompressTest class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef CompressTest_INCLUDED #ifndef CompressTest_INCLUDED
#define CompressTest_INCLUDED #define CompressTest_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "CppUnit/TestCase.h" #include "CppUnit/TestCase.h"
class CompressTest: public CppUnit::TestCase class CompressTest: public CppUnit::TestCase
{ {
public: public:
CompressTest(const std::string& name); CompressTest(const std::string& name);
~CompressTest(); ~CompressTest();
void testSingleFile(); void testSingleFile();
void testDirectory(); void testDirectory();
void testManipulator(); void testManipulator();
void testManipulatorDel(); void testManipulatorDel();
void testManipulatorReplace(); void testManipulatorReplace();
void setUp(); void setUp();
void tearDown(); void tearDown();
static CppUnit::Test* suite(); static CppUnit::Test* suite();
private: private:
}; };
#endif // CompressTest_INCLUDED #endif // CompressTest_INCLUDED

View File

@@ -1,39 +1,39 @@
// //
// Driver.cpp // Driver.cpp
// //
// $Id: //poco/1.3/Zip/testsuite/src/Driver.cpp#2 $ // $Id: //poco/Main/Zip/testsuite/src/Driver.cpp#3 $
// //
// Console-based test driver for Poco Zip. // Console-based test driver for Poco Zip.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "CppUnit/TestRunner.h" #include "CppUnit/TestRunner.h"
#include "ZipTestSuite.h" #include "ZipTestSuite.h"
CppUnitMain(ZipTestSuite) CppUnitMain(ZipTestSuite)

View File

@@ -1,139 +1,139 @@
// //
// PartialStreamTest.cpp // PartialStreamTest.cpp
// //
// $Id: //poco/1.3/Zip/testsuite/src/PartialStreamTest.cpp#3 $ // $Id: //poco/Main/Zip/testsuite/src/PartialStreamTest.cpp#4 $
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "PartialStreamTest.h" #include "PartialStreamTest.h"
#include "CppUnit/TestCaller.h" #include "CppUnit/TestCaller.h"
#include "CppUnit/TestSuite.h" #include "CppUnit/TestSuite.h"
#include "Poco/Zip/PartialStream.h" #include "Poco/Zip/PartialStream.h"
#include <sstream> #include <sstream>
using namespace Poco::Zip; using namespace Poco::Zip;
PartialStreamTest::PartialStreamTest(const std::string& name): CppUnit::TestCase(name) PartialStreamTest::PartialStreamTest(const std::string& name): CppUnit::TestCase(name)
{ {
} }
PartialStreamTest::~PartialStreamTest() PartialStreamTest::~PartialStreamTest()
{ {
} }
void PartialStreamTest::testReading() void PartialStreamTest::testReading()
{ {
std::string message("some dummy message !"); std::string message("some dummy message !");
std::string prefix("pre "); std::string prefix("pre ");
std::string postfix(" post"); std::string postfix(" post");
std::string result(prefix+message+postfix); std::string result(prefix+message+postfix);
std::istringstream istr(message); std::istringstream istr(message);
PartialInputStream in(istr, 0, static_cast<std::streamoff>(message.length()), true, prefix, postfix); PartialInputStream in(istr, 0, static_cast<std::streamoff>(message.length()), true, prefix, postfix);
char buf[124]; char buf[124];
in.read(buf, 124); in.read(buf, 124);
std::string res(buf, in.gcount()); std::string res(buf, in.gcount());
poco_assert (res == result); assert (res == result);
} }
void PartialStreamTest::testWriting() void PartialStreamTest::testWriting()
{ {
std::string prefix("X"); std::string prefix("X");
std::string message("some test message"); std::string message("some test message");
std::string postfix("YYY"); std::string postfix("YYY");
std::string result(prefix+message+postfix); std::string result(prefix+message+postfix);
std::ostringstream ostr; std::ostringstream ostr;
PartialOutputStream out(ostr, prefix.size(), postfix.size()); PartialOutputStream out(ostr, prefix.size(), postfix.size());
out.write(result.c_str(), static_cast<std::streamsize>(result.length())); out.write(result.c_str(), static_cast<std::streamsize>(result.length()));
poco_assert (out.good()); assert (out.good());
out.close(); out.close();
std::string res (ostr.str()); std::string res (ostr.str());
poco_assert (out.bytesWritten() == message.size()); assert (out.bytesWritten() == message.size());
poco_assert (message == res); assert (message == res);
} }
void PartialStreamTest::testWritingZero() void PartialStreamTest::testWritingZero()
{ {
std::string prefix("X"); std::string prefix("X");
std::string message; std::string message;
std::string postfix("YYY"); std::string postfix("YYY");
std::string result(prefix+message+postfix); std::string result(prefix+message+postfix);
std::ostringstream ostr; std::ostringstream ostr;
PartialOutputStream out(ostr, prefix.size(), postfix.size()); PartialOutputStream out(ostr, prefix.size(), postfix.size());
out.write(result.c_str(), static_cast<std::streamsize>(result.length())); out.write(result.c_str(), static_cast<std::streamsize>(result.length()));
poco_assert (out.good()); assert (out.good());
out.close(); out.close();
std::string res (ostr.str()); std::string res (ostr.str());
poco_assert (out.bytesWritten() == message.size()); assert (out.bytesWritten() == message.size());
poco_assert (message == res); assert (message == res);
} }
void PartialStreamTest::testWritingOne() void PartialStreamTest::testWritingOne()
{ {
std::string prefix("X"); std::string prefix("X");
std::string message("a"); std::string message("a");
std::string postfix("YYY"); std::string postfix("YYY");
std::string result(prefix+message+postfix); std::string result(prefix+message+postfix);
std::ostringstream ostr; std::ostringstream ostr;
PartialOutputStream out(ostr, prefix.size(), postfix.size()); PartialOutputStream out(ostr, prefix.size(), postfix.size());
out.write(result.c_str(), static_cast<std::streamsize>(result.length())); out.write(result.c_str(), static_cast<std::streamsize>(result.length()));
poco_assert (out.good()); assert (out.good());
out.close(); out.close();
std::string res (ostr.str()); std::string res (ostr.str());
poco_assert (out.bytesWritten() == message.size()); assert (out.bytesWritten() == message.size());
poco_assert (message == res); assert (message == res);
} }
void PartialStreamTest::setUp() void PartialStreamTest::setUp()
{ {
} }
void PartialStreamTest::tearDown() void PartialStreamTest::tearDown()
{ {
} }
CppUnit::Test* PartialStreamTest::suite() CppUnit::Test* PartialStreamTest::suite()
{ {
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("PartialStreamTest"); CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("PartialStreamTest");
CppUnit_addTest(pSuite, PartialStreamTest, testReading); CppUnit_addTest(pSuite, PartialStreamTest, testReading);
CppUnit_addTest(pSuite, PartialStreamTest, testWriting); CppUnit_addTest(pSuite, PartialStreamTest, testWriting);
CppUnit_addTest(pSuite, PartialStreamTest, testWritingZero); CppUnit_addTest(pSuite, PartialStreamTest, testWritingZero);
CppUnit_addTest(pSuite, PartialStreamTest, testWritingOne); CppUnit_addTest(pSuite, PartialStreamTest, testWritingOne);
return pSuite; return pSuite;
} }

View File

@@ -1,63 +1,63 @@
// //
// PartialStreamTest.h // PartialStreamTest.h
// //
// $Id: //poco/1.3/Zip/testsuite/src/PartialStreamTest.h#3 $ // $Id: //poco/Main/Zip/testsuite/src/PartialStreamTest.h#4 $
// //
// Definition of the PartialStreamTest class. // Definition of the PartialStreamTest class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef PartialStreamTest_INCLUDED #ifndef PartialStreamTest_INCLUDED
#define PartialStreamTest_INCLUDED #define PartialStreamTest_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "CppUnit/TestCase.h" #include "CppUnit/TestCase.h"
class PartialStreamTest: public CppUnit::TestCase class PartialStreamTest: public CppUnit::TestCase
{ {
public: public:
PartialStreamTest(const std::string& name); PartialStreamTest(const std::string& name);
~PartialStreamTest(); ~PartialStreamTest();
void testReading(); void testReading();
void testWriting(); void testWriting();
void testWritingZero(); void testWritingZero();
void testWritingOne(); void testWritingOne();
void setUp(); void setUp();
void tearDown(); void tearDown();
static CppUnit::Test* suite(); static CppUnit::Test* suite();
private: private:
}; };
#endif // PartialStreamTest_INCLUDED #endif // PartialStreamTest_INCLUDED

View File

@@ -1,50 +1,50 @@
// //
// WinDriver.cpp // WinDriver.cpp
// //
// $Id: //poco/1.3/Zip/testsuite/src/WinDriver.cpp#2 $ // $Id: //poco/Main/Zip/testsuite/src/WinDriver.cpp#3 $
// //
// Windows test driver for Poco Zip. // Windows test driver for Poco Zip.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "WinTestRunner/WinTestRunner.h" #include "WinTestRunner/WinTestRunner.h"
#include "ZipTestSuite.h" #include "ZipTestSuite.h"
class TestDriver: public CppUnit::WinTestRunnerApp class TestDriver: public CppUnit::WinTestRunnerApp
{ {
void TestMain() void TestMain()
{ {
CppUnit::WinTestRunner runner; CppUnit::WinTestRunner runner;
runner.addTest(ZipTestSuite::suite()); runner.addTest(ZipTestSuite::suite());
runner.run(); runner.run();
} }
}; };
TestDriver theDriver; TestDriver theDriver;

View File

@@ -1,286 +1,215 @@
// //
// ZipTest.cpp // ZipTest.cpp
// //
// $Id: //poco/1.3/Zip/testsuite/src/ZipTest.cpp#6 $ // $Id: //poco/Main/Zip/testsuite/src/ZipTest.cpp#13 $
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "ZipTest.h" #include "ZipTest.h"
#include "Poco/Zip/SkipCallback.h" #include "Poco/Zip/SkipCallback.h"
#include "Poco/Zip/ZipLocalFileHeader.h" #include "Poco/Zip/ZipLocalFileHeader.h"
#include "Poco/Zip/ZipArchive.h" #include "Poco/Zip/ZipArchive.h"
#include "Poco/Zip/ZipStream.h" #include "Poco/Zip/ZipStream.h"
#include "Poco/Zip/Decompress.h" #include "Poco/Zip/Decompress.h"
#include "Poco/StreamCopier.h" #include "Poco/Zip/ZipCommon.h"
#include "Poco/File.h" #include "Poco/StreamCopier.h"
#include "Poco/URI.h" #include "Poco/File.h"
#include "Poco/Path.h" #include "Poco/URI.h"
#include "Poco/Delegate.h" #include "Poco/Path.h"
#include "Poco/Net/HTTPClientSession.h" #include "Poco/Delegate.h"
#include "Poco/Net/HTTPRequest.h" #include "Poco/StreamCopier.h"
#include "Poco/Net/HTTPResponse.h" #include "CppUnit/TestCaller.h"
#include "Poco/Net/HTTPServer.h" #include "CppUnit/TestSuite.h"
#include "Poco/Net/HTTPServerParams.h" #include <fstream>
#include "Poco/Net/AbstractHTTPRequestHandler.h" #include <sstream>
#include "Poco/Net/HTTPRequestHandlerFactory.h"
#include "Poco/Net/HTTPServerRequest.h"
#include "Poco/Net/HTTPServerResponse.h" using namespace Poco::Zip;
#include "Poco/Net/ServerSocket.h"
#include "Poco/StreamCopier.h"
#include "CppUnit/TestCaller.h" ZipTest::ZipTest(const std::string& name): CppUnit::TestCase(name)
#include "CppUnit/TestSuite.h" {
#include <fstream> }
#include <sstream>
ZipTest::~ZipTest()
using namespace Poco::Zip; {
using namespace Poco::Net; }
void ZipTest::testSkipSingleFile()
namespace {
{ std::string testFile = getTestFile("test.zip");
class ZipFileRequestHandler: public HTTPRequestHandler std::ifstream inp(testFile.c_str(), std::ios::binary);
{ assert (inp.good());
public: SkipCallback skip;
ZipFileRequestHandler() ZipLocalFileHeader hdr(inp, false, skip);
{ assert (ZipCommon::HS_FAT == hdr.getHostSystem());
} int major = hdr.getMajorVersionNumber();
int minor = hdr.getMinorVersionNumber();
void handleRequest(HTTPServerRequest& request, HTTPServerResponse& response) assert (major <= 2);
{ std::size_t hdrSize = hdr.getHeaderSize();
response.setChunkedTransferEncoding(true); assert (hdrSize > 30);
std::string testFile = ZipTest::getTestFile("test.zip"); ZipCommon::CompressionMethod cm = hdr.getCompressionMethod();
std::ifstream inp(testFile.c_str(), std::ios::binary); assert (!hdr.isEncrypted());
poco_assert (inp); Poco::DateTime aDate = hdr.lastModifiedAt();
Poco::UInt32 cS = hdr.getCompressedSize();
response.setContentType("application/zip"); Poco::UInt32 uS = hdr.getUncompressedSize();
const std::string& fileName = hdr.getFileName();
std::ostream& ostr = response.send(); }
Poco::StreamCopier::copyStream(inp, ostr);
}
}; void ZipTest::testDecompressSingleFile()
{
class RequestHandlerFactory: public HTTPRequestHandlerFactory std::string testFile = getTestFile("test.zip");
{ std::ifstream inp(testFile.c_str(), std::ios::binary);
public: assert (inp.good());
HTTPRequestHandler* createRequestHandler(const HTTPServerRequest& request) ZipArchive arch(inp);
{ ZipArchive::FileHeaders::const_iterator it = arch.findHeader("testfile.txt");
if (request.getURI() == "/test.zip") assert (it != arch.headerEnd());
return new ZipFileRequestHandler; ZipInputStream zipin (inp, it->second);
else std::ostringstream out(std::ios::binary);
return 0; Poco::StreamCopier::copyStream(zipin, out);
} assert(!out.str().empty());
}; }
}
ZipTest::ZipTest(const std::string& name): CppUnit::TestCase(name) void ZipTest::testCrcAndSizeAfterData()
{ {
} std::string testFile = getTestFile("data.zip");
std::ifstream inp(testFile.c_str(), std::ios::binary);
assert (inp.good());
ZipTest::~ZipTest() Decompress dec(inp, Poco::Path());
{ dec.EError += Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError);
} dec.decompressAllFiles();
dec.EError -= Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError);
assert (_errCnt == 0);
void ZipTest::testSkipSingleFile() assert (!dec.mapping().empty());
{ }
std::string testFile = getTestFile("test.zip");
std::ifstream inp(testFile.c_str(), std::ios::binary);
poco_assert (inp); void ZipTest::testCrcAndSizeAfterDataWithArchive()
SkipCallback skip; {
ZipLocalFileHeader hdr(inp, false, skip); std::string testFile = getTestFile("data.zip");
poco_assert (ZipCommon::HS_FAT == hdr.getHostSystem()); std::ifstream inp(testFile.c_str(), std::ios::binary);
int major = hdr.getMajorVersionNumber(); assert (inp.good());
int minor = hdr.getMinorVersionNumber(); Poco::Zip::ZipArchive zip(inp);
poco_assert (major <= 2); inp.clear();
std::size_t hdrSize = hdr.getHeaderSize(); inp.seekg(0);
poco_assert (hdrSize > 30); Poco::Zip::ZipArchive::FileHeaders::const_iterator it = zip.headerBegin();
ZipCommon::CompressionMethod cm = hdr.getCompressionMethod(); for ( ; it!=zip.headerEnd(); ++it)
poco_assert (!hdr.isEncrypted()); {
Poco::DateTime aDate = hdr.lastModifiedAt(); Poco::Zip::ZipInputStream zipis(inp,it->second);
Poco::UInt32 cS = hdr.getCompressedSize(); Poco::Path path(it->second.getFileName());
Poco::UInt32 uS = hdr.getUncompressedSize(); if (path.isFile())
const std::string& fileName = hdr.getFileName(); {
} std::ofstream os("test.dat");
Poco::StreamCopier::copyStream(zipis,os);
}
void ZipTest::testDecompressSingleFile() }
{ }
std::string testFile = getTestFile("test.zip");
std::ifstream inp(testFile.c_str(), std::ios::binary);
poco_assert (inp); std::string ZipTest::getTestFile(const std::string& testFile)
ZipArchive arch(inp); {
ZipArchive::FileHeaders::const_iterator it = arch.findHeader("Zip_VS71.vcproj"); Poco::Path root;
poco_assert (it != arch.headerEnd()); root.makeAbsolute();
ZipInputStream zipin (inp, it->second); Poco::Path result;
std::ostringstream out(std::ios::binary); while (!Poco::Path::find(root.toString(), "data", result))
Poco::StreamCopier::copyStream(zipin, out); {
poco_assert(!out.str().empty()); root.makeParent();
} if (root.toString().empty() || root.toString() == "/")
throw Poco::FileNotFoundException("Didn't find data subdir");
}
void ZipTest::testCrcAndSizeAfterData() result.makeDirectory();
{ result.setFileName(testFile);
std::string testFile = getTestFile("java.zip"); Poco::File aFile(result.toString());
std::ifstream inp(testFile.c_str(), std::ios::binary); if (!aFile.exists() || (aFile.exists() && !aFile.isFile()))
poco_assert (inp); throw Poco::FileNotFoundException("Didn't find " + testFile);
Decompress dec(inp, Poco::Path());
dec.EError += Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError); return result.toString();
dec.decompressAllFiles(); }
dec.EError -= Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError);
poco_assert (_errCnt == 0);
poco_assert (!dec.mapping().empty()); void ZipTest::testDecompress()
} {
std::string testFile = getTestFile("test.zip");
std::ifstream inp(testFile.c_str(), std::ios::binary);
void ZipTest::testCrcAndSizeAfterDataWithArchive() assert (inp.good());
{ Decompress dec(inp, Poco::Path());
std::string testFile = getTestFile("java.zip"); dec.EError += Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError);
std::ifstream inp(testFile.c_str(), std::ios::binary); dec.decompressAllFiles();
poco_assert (inp); dec.EError -= Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError);
Poco::Zip::ZipArchive zip(inp); assert (_errCnt == 0);
inp.clear(); assert (!dec.mapping().empty());
inp.seekg(0); }
Poco::Zip::ZipArchive::FileHeaders::const_iterator it = zip.headerBegin();
for ( ; it!=zip.headerEnd(); ++it)
{ void ZipTest::testDecompressFlat()
Poco::Zip::ZipInputStream zipis(inp,it->second); {
Poco::Path path(it->second.getFileName()); std::string testFile = getTestFile("test.zip");
if (path.isFile()) std::ifstream inp(testFile.c_str(), std::ios::binary);
{ assert (inp.good());
std::ofstream os("test.dat"); Decompress dec(inp, Poco::Path(), true);
Poco::StreamCopier::copyStream(zipis,os); dec.EError += Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError);
} dec.decompressAllFiles();
} dec.EError -= Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError);
} assert (_errCnt == 0);
assert (!dec.mapping().empty());
}
std::string ZipTest::getTestFile(const std::string& testFile)
{
Poco::Path root; void ZipTest::onDecompressError(const void* pSender, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string>& info)
root.makeAbsolute(); {
Poco::Path result; ++_errCnt;
while (!Poco::Path::find(root.toString(), "data", result)) }
{
root.makeParent();
if (root.toString().empty() || root.toString() == "/") void ZipTest::setUp()
throw Poco::FileNotFoundException("Didn't find data subdir"); {
} _errCnt = 0;
result.makeDirectory(); }
result.setFileName(testFile);
Poco::File aFile(result.toString());
if (!aFile.exists() || (aFile.exists() && !aFile.isFile())) void ZipTest::tearDown()
throw Poco::FileNotFoundException("Didn't find " + testFile); {
}
return result.toString();
}
CppUnit::Test* ZipTest::suite()
{
void ZipTest::testDecompress() CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ZipTest");
{
std::string testFile = getTestFile("test.zip"); CppUnit_addTest(pSuite, ZipTest, testSkipSingleFile);
std::ifstream inp(testFile.c_str(), std::ios::binary); CppUnit_addTest(pSuite, ZipTest, testDecompressSingleFile);
poco_assert (inp); CppUnit_addTest(pSuite, ZipTest, testDecompress);
Decompress dec(inp, Poco::Path()); CppUnit_addTest(pSuite, ZipTest, testDecompressFlat);
dec.EError += Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError); CppUnit_addTest(pSuite, ZipTest, testCrcAndSizeAfterData);
dec.decompressAllFiles(); CppUnit_addTest(pSuite, ZipTest, testCrcAndSizeAfterDataWithArchive);
dec.EError -= Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError); return pSuite;
poco_assert (_errCnt == 0); }
poco_assert (!dec.mapping().empty());
}
void ZipTest::testDecompressFlat()
{
std::string testFile = getTestFile("test.zip");
std::ifstream inp(testFile.c_str(), std::ios::binary);
poco_assert (inp);
Decompress dec(inp, Poco::Path(), true);
dec.EError += Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError);
dec.decompressAllFiles();
dec.EError -= Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError);
poco_assert (_errCnt == 0);
poco_assert (!dec.mapping().empty());
}
void ZipTest::decompressDirectlyFromNet()
{
ServerSocket svs(22222);
HTTPServerParams* pParams = new HTTPServerParams;
pParams->setKeepAlive(true);
HTTPServer srv(new RequestHandlerFactory, svs, pParams);
srv.start();
Poco::URI uri("http://localhost:22222/test.zip");
HTTPClientSession session("localhost", 22222);
HTTPRequest req(HTTPRequest::HTTP_GET, "/test.zip", HTTPMessage::HTTP_1_1);
session.sendRequest(req);
HTTPResponse res;
std::istream& rs = session.receiveResponse(res);
Decompress dec(rs, Poco::Path());
dec.EError += Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError);
dec.decompressAllFiles();
dec.EError -= Poco::Delegate<ZipTest, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> >(this, &ZipTest::onDecompressError);
poco_assert (_errCnt == 0);
poco_assert (!dec.mapping().empty());
}
void ZipTest::onDecompressError(const void* pSender, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string>& info)
{
++_errCnt;
}
void ZipTest::setUp()
{
_errCnt = 0;
}
void ZipTest::tearDown()
{
}
CppUnit::Test* ZipTest::suite()
{
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ZipTest");
CppUnit_addTest(pSuite, ZipTest, testSkipSingleFile);
CppUnit_addTest(pSuite, ZipTest, testDecompressSingleFile);
CppUnit_addTest(pSuite, ZipTest, testDecompress);
CppUnit_addTest(pSuite, ZipTest, testDecompressFlat);
CppUnit_addTest(pSuite, ZipTest, decompressDirectlyFromNet);
CppUnit_addTest(pSuite, ZipTest, testCrcAndSizeAfterData);
CppUnit_addTest(pSuite, ZipTest, testCrcAndSizeAfterDataWithArchive);
return pSuite;
}

View File

@@ -1,73 +1,72 @@
// //
// ZipTest.h // ZipTest.h
// //
// $Id: //poco/1.3/Zip/testsuite/src/ZipTest.h#5 $ // $Id: //poco/Main/Zip/testsuite/src/ZipTest.h#8 $
// //
// Definition of the ZipTest class. // Definition of the ZipTest class.
// //
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. // Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef ZipTest_INCLUDED #ifndef ZipTest_INCLUDED
#define ZipTest_INCLUDED #define ZipTest_INCLUDED
#include "Poco/Zip/Zip.h" #include "Poco/Zip/Zip.h"
#include "Poco/Zip/ZipLocalFileHeader.h" #include "Poco/Zip/ZipLocalFileHeader.h"
#include "CppUnit/TestCase.h" #include "CppUnit/TestCase.h"
class ZipTest: public CppUnit::TestCase class ZipTest: public CppUnit::TestCase
{ {
public: public:
ZipTest(const std::string& name); ZipTest(const std::string& name);
~ZipTest(); ~ZipTest();
void testSkipSingleFile(); void testSkipSingleFile();
void testDecompressSingleFile(); void testDecompressSingleFile();
void testDecompress(); void testDecompress();
void decompressDirectlyFromNet(); void testCrcAndSizeAfterData();
void testCrcAndSizeAfterData(); void testCrcAndSizeAfterDataWithArchive();
void testCrcAndSizeAfterDataWithArchive();
void testDecompressFlat();
void testDecompressFlat();
void setUp();
void setUp(); void tearDown();
void tearDown();
static CppUnit::Test* suite();
static CppUnit::Test* suite();
static std::string getTestFile(const std::string& testFile);
static std::string getTestFile(const std::string& testFile);
private:
private: void onDecompressError(const void* pSender, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string>& info);
void onDecompressError(const void* pSender, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string>& info);
int _errCnt;
int _errCnt; };
};
#endif // ZipTest_INCLUDED
#endif // ZipTest_INCLUDED

View File

@@ -1,48 +1,48 @@
// //
// ZipTestSuite.cpp // ZipTestSuite.cpp
// //
// $Id: //poco/1.3/Zip/testsuite/src/ZipTestSuite.cpp#1 $ // $Id: //poco/Main/Zip/testsuite/src/ZipTestSuite.cpp#3 $
// //
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. // Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#include "ZipTestSuite.h" #include "ZipTestSuite.h"
#include "ZipTest.h" #include "ZipTest.h"
#include "PartialStreamTest.h" #include "PartialStreamTest.h"
#include "CompressTest.h" #include "CompressTest.h"
CppUnit::Test* ZipTestSuite::suite() CppUnit::Test* ZipTestSuite::suite()
{ {
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ZipTestSuite"); CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ZipTestSuite");
pSuite->addTest(ZipTest::suite()); pSuite->addTest(ZipTest::suite());
pSuite->addTest(PartialStreamTest::suite()); pSuite->addTest(PartialStreamTest::suite());
pSuite->addTest(CompressTest::suite()); pSuite->addTest(CompressTest::suite());
return pSuite; return pSuite;
} }

View File

@@ -1,49 +1,49 @@
// //
// ZipTestSuite.h // ZipTestSuite.h
// //
// $Id: //poco/1.3/Zip/testsuite/src/ZipTestSuite.h#1 $ // $Id: //poco/Main/Zip/testsuite/src/ZipTestSuite.h#2 $
// //
// Definition of the ZipTestSuite class. // Definition of the ZipTestSuite class.
// //
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. // Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
// and Contributors. // and Contributors.
// //
// Permission is hereby granted, free of charge, to any person or organization // Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by // obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute, // this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the // execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to // Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following: // do so, all subject to the following:
// //
// The copyright notices in the Software and this entire statement, including // The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer, // the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and // must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative // all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by // works are solely in the form of machine-executable object code generated by
// a source language processor. // a source language processor.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// //
#ifndef ZipTestSuite_INCLUDED #ifndef ZipTestSuite_INCLUDED
#define ZipTestSuite_INCLUDED #define ZipTestSuite_INCLUDED
#include "CppUnit/TestSuite.h" #include "CppUnit/TestSuite.h"
class ZipTestSuite class ZipTestSuite
{ {
public: public:
static CppUnit::Test* suite(); static CppUnit::Test* suite();
}; };
#endif // ZipTestSuite_INCLUDED #endif // ZipTestSuite_INCLUDED