updated zlib, Moved and cleaned up the project settings in to property sheets also cleaned up some warnings
This commit is contained in:
parent
c07324ba53
commit
89bc4087ef
Binary file not shown.
|
@ -33,8 +33,8 @@ Global
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421}.Debug|Win32.ActiveCfg = Debug|Win32
|
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421}.Debug|Win32.Build.0 = Debug|Win32
|
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421}.External Release|Win32.ActiveCfg = External Release|Win32
|
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421}.External Release|Win32.ActiveCfg = Release|Win32
|
||||||
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421}.External Release|Win32.Build.0 = External Release|Win32
|
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421}.External Release|Win32.Build.0 = Release|Win32
|
||||||
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421}.Release|Win32.ActiveCfg = Release|Win32
|
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421}.Release|Win32.Build.0 = Release|Win32
|
{B4A4B994-9111-42B1-93C2-6F1CA8BC4421}.Release|Win32.Build.0 = Release|Win32
|
||||||
{7E534C8E-1ACE-4A88-8807-39A11ED4DA18}.Debug|Win32.ActiveCfg = Debug|Win32
|
{7E534C8E-1ACE-4A88-8807-39A11ED4DA18}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
@ -57,8 +57,8 @@ Global
|
||||||
{8B9961B1-88D9-4EA3-A752-507A00DD9F3D}.Release|Win32.Build.0 = Release|Win32
|
{8B9961B1-88D9-4EA3-A752-507A00DD9F3D}.Release|Win32.Build.0 = Release|Win32
|
||||||
{3326E128-33AF-422C-BB7C-67CC6B915610}.Debug|Win32.ActiveCfg = Debug|Win32
|
{3326E128-33AF-422C-BB7C-67CC6B915610}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
{3326E128-33AF-422C-BB7C-67CC6B915610}.Debug|Win32.Build.0 = Debug|Win32
|
{3326E128-33AF-422C-BB7C-67CC6B915610}.Debug|Win32.Build.0 = Debug|Win32
|
||||||
{3326E128-33AF-422C-BB7C-67CC6B915610}.External Release|Win32.ActiveCfg = External Release|Win32
|
{3326E128-33AF-422C-BB7C-67CC6B915610}.External Release|Win32.ActiveCfg = Release|Win32
|
||||||
{3326E128-33AF-422C-BB7C-67CC6B915610}.External Release|Win32.Build.0 = External Release|Win32
|
{3326E128-33AF-422C-BB7C-67CC6B915610}.External Release|Win32.Build.0 = Release|Win32
|
||||||
{3326E128-33AF-422C-BB7C-67CC6B915610}.Release|Win32.ActiveCfg = Release|Win32
|
{3326E128-33AF-422C-BB7C-67CC6B915610}.Release|Win32.ActiveCfg = Release|Win32
|
||||||
{3326E128-33AF-422C-BB7C-67CC6B915610}.Release|Win32.Build.0 = Release|Win32
|
{3326E128-33AF-422C-BB7C-67CC6B915610}.Release|Win32.Build.0 = Release|Win32
|
||||||
{4BC6906B-213E-40D7-9FC7-1A93E228393D}.Debug|Win32.ActiveCfg = Debug|Win32
|
{4BC6906B-213E-40D7-9FC7-1A93E228393D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
<?xml version="1.0" encoding="windows-1251"?>
|
||||||
|
<VisualStudioPropertySheet
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="8.00"
|
||||||
|
Name="Debug"
|
||||||
|
InheritedPropertySheets=".\Default.vsprops"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
PreprocessorDefinitions="_DEBUG;DEBUG"
|
||||||
|
Optimization="0"
|
||||||
|
InlineFunctionExpansion="0"
|
||||||
|
EnableIntrinsicFunctions="false"
|
||||||
|
FavorSizeOrSpeed="0"
|
||||||
|
OmitFramePointers="false"
|
||||||
|
EnableFiberSafeOptimizations="false"
|
||||||
|
WholeProgramOptimization="false"
|
||||||
|
BasicRuntimeChecks="3"
|
||||||
|
SmallerTypeCheck="true"
|
||||||
|
RuntimeLibrary="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
ProfileGuidedDatabase=""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
PreprocessorDefinitions="_DEBUG;DEBUG"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="_DEBUG;DEBUG"
|
||||||
|
/>
|
||||||
|
</VisualStudioPropertySheet>
|
|
@ -0,0 +1,184 @@
|
||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioPropertySheet
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="8.00"
|
||||||
|
Name="Default"
|
||||||
|
OutputDirectory="$(Root)bin/$(ConfigurationName)"
|
||||||
|
IntermediateDirectory="$(Root)build/$(ConfigurationName)/$(ProjectName)"
|
||||||
|
InheritedPropertySheets=".\Root.vsprops"
|
||||||
|
DeleteExtensionsOnClean="*.obj;*.ilk;*.tlb;*.tli;*.tlh;*.tmp;*.rsp;*.pgc;*.pgd;*.meta;$(TargetPath)"
|
||||||
|
BuildLogFile="$(IntDir)\BuildLog.htm"
|
||||||
|
UseOfMFC="2"
|
||||||
|
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||||
|
CharacterSet="2"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCBscMakeTool"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
OutputFile="$(OutDir)\$(ProjectName).bsc"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
UseUnicodeResponseFiles="true"
|
||||||
|
AdditionalIncludeDirectories=".\;..\;..\3rd Party"
|
||||||
|
PreprocessorDefinitions="_CRT_SECURE_NO_WARNINGS"
|
||||||
|
IgnoreStandardIncludePath="false"
|
||||||
|
GeneratePreprocessedFile="0"
|
||||||
|
KeepComments="false"
|
||||||
|
StringPooling="true"
|
||||||
|
MinimalRebuild="true"
|
||||||
|
ExceptionHandling="2"
|
||||||
|
BasicRuntimeChecks="0"
|
||||||
|
SmallerTypeCheck="false"
|
||||||
|
StructMemberAlignment="0"
|
||||||
|
BufferSecurityCheck="false"
|
||||||
|
EnableFunctionLevelLinking="true"
|
||||||
|
EnableEnhancedInstructionSet="0"
|
||||||
|
FloatingPointModel="0"
|
||||||
|
FloatingPointExceptions="false"
|
||||||
|
DisableLanguageExtensions="false"
|
||||||
|
DefaultCharIsUnsigned="false"
|
||||||
|
TreatWChar_tAsBuiltInType="true"
|
||||||
|
ForceConformanceInForLoopScope="true"
|
||||||
|
RuntimeTypeInfo="false"
|
||||||
|
OpenMP="false"
|
||||||
|
UsePrecompiledHeader="2"
|
||||||
|
PrecompiledHeaderThrough="StdAfx.h"
|
||||||
|
PrecompiledHeaderFile="$(IntDir)\$(TargetName).pch"
|
||||||
|
ExpandAttributedSource="false"
|
||||||
|
AssemblerOutput="0"
|
||||||
|
AssemblerListingLocation="$(IntDir)\"
|
||||||
|
ObjectFile="$(IntDir)\"
|
||||||
|
ProgramDataBaseFileName="$(IntDir)\vc90.pdb"
|
||||||
|
GenerateXMLDocumentationFiles="false"
|
||||||
|
XMLDocumentationFileName="$(IntDir)\"
|
||||||
|
BrowseInformation="0"
|
||||||
|
BrowseInformationFile="$(IntDir)\"
|
||||||
|
WarningLevel="3"
|
||||||
|
WarnAsError="false"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
DebugInformationFormat="3"
|
||||||
|
CallingConvention="0"
|
||||||
|
CompileAs="0"
|
||||||
|
ShowIncludes="false"
|
||||||
|
UndefineAllPreprocessorDefinitions="false"
|
||||||
|
EnablePREfast="false"
|
||||||
|
UseFullPaths="false"
|
||||||
|
OmitDefaultLibName="false"
|
||||||
|
ErrorReporting="1"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLibrarianTool"
|
||||||
|
OutputFile="$(OutDir)\lib\$(ProjectName).lib"
|
||||||
|
UseUnicodeResponseFiles="true"
|
||||||
|
LinkLibraryDependencies="true"
|
||||||
|
AdditionalLibraryDirectories=""
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
IgnoreAllDefaultLibraries="false"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
RegisterOutput="false"
|
||||||
|
PerUserRedirection="false"
|
||||||
|
IgnoreImportLibrary="false"
|
||||||
|
LinkLibraryDependencies="true"
|
||||||
|
UseLibraryDependencyInputs="false"
|
||||||
|
UseUnicodeResponseFiles="true"
|
||||||
|
AdditionalOptions="/IGNORE:4199 /OPT:ICF=3"
|
||||||
|
ShowProgress="0"
|
||||||
|
LinkIncremental="1"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
AdditionalLibraryDirectories=""
|
||||||
|
ManifestFile="$(IntDir)\$(TargetFileName).intermediate.manifest"
|
||||||
|
IgnoreAllDefaultLibraries="false"
|
||||||
|
ModuleDefinitionFile=""
|
||||||
|
DelayLoadDLLs="advapi32.dll;userenv.dll;shell32.dll;shlwapi.dll;ws2_32.dll;version.dll;wtsapi32.dll"
|
||||||
|
IgnoreEmbeddedIDL="false"
|
||||||
|
TypeLibraryResourceID="1"
|
||||||
|
GenerateDebugInformation="true"
|
||||||
|
AssemblyDebug="0"
|
||||||
|
ProgramDatabaseFile="$(TargetDir)pdb/$(TargetName).pdb"
|
||||||
|
GenerateMapFile="true"
|
||||||
|
MapFileName="$(TargetDir)map/$(TargetName).map"
|
||||||
|
MapExports="false"
|
||||||
|
HeapReserveSize="0"
|
||||||
|
HeapCommitSize="0"
|
||||||
|
StackReserveSize="0"
|
||||||
|
StackCommitSize="0"
|
||||||
|
LargeAddressAware="0"
|
||||||
|
TerminalServerAware="0"
|
||||||
|
SwapRunFromCD="false"
|
||||||
|
SwapRunFromNet="false"
|
||||||
|
OptimizeReferences="2"
|
||||||
|
EnableCOMDATFolding="2"
|
||||||
|
ProfileGuidedDatabase=""
|
||||||
|
ResourceOnlyDLL="false"
|
||||||
|
SetChecksum="false"
|
||||||
|
RandomizedBaseAddress="1"
|
||||||
|
FixedBaseAddress="1"
|
||||||
|
DataExecutionPrevention="2"
|
||||||
|
TurnOffAssemblyGeneration="false"
|
||||||
|
SupportUnloadOfDelayLoadedDLL="false"
|
||||||
|
ImportLibrary="$(TargetDir)lib/$(TargetName).lib"
|
||||||
|
DelaySign="false"
|
||||||
|
Profile="false"
|
||||||
|
CLRThreadAttribute="0"
|
||||||
|
CLRImageType="0"
|
||||||
|
ErrorReporting="1"
|
||||||
|
CLRUnmanagedCodeCheck="false"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
AdditionalIncludeDirectories=".;$(SRC);$(SRC)\3rd Party"
|
||||||
|
IgnoreStandardIncludePath="false"
|
||||||
|
MkTypLibCompatible="false"
|
||||||
|
WarningLevel="3"
|
||||||
|
WarnAsError="false"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
DefaultCharType="0"
|
||||||
|
GenerateStublessProxies="true"
|
||||||
|
GenerateTypeLibrary="true"
|
||||||
|
TypeLibraryName="$(IntDir)\$(InputName).tlb"
|
||||||
|
HeaderFileName="$(InputName)_h.h"
|
||||||
|
DLLDataFileName=""
|
||||||
|
InterfaceIdentifierFileName="$(InputName)_i.c"
|
||||||
|
ProxyFileName="$(InputName)_p.c"
|
||||||
|
EnableErrorChecks="2"
|
||||||
|
ErrorCheckAllocations="false"
|
||||||
|
ErrorCheckBounds="false"
|
||||||
|
ErrorCheckEnumRange="false"
|
||||||
|
ErrorCheckRefPointers="false"
|
||||||
|
ErrorCheckStubData="false"
|
||||||
|
ValidateParameters="true"
|
||||||
|
StructMemberAlignment="0"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
Culture="0"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
IgnoreStandardIncludePath="false"
|
||||||
|
ShowProgress="false"
|
||||||
|
ResourceOutputFileName="$(IntDir)\$(InputName).res"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCManifestTool"
|
||||||
|
UseUnicodeResponseFiles="true"
|
||||||
|
OutputManifestFile="$(IntDir)\$(TargetFileName).embed.manifest"
|
||||||
|
ManifestResourceFile="$(IntDir)\$(TargetFileName).embed.manifest.res"
|
||||||
|
EmbedManifest="true"
|
||||||
|
DependencyInformationFile="$(IntDir)\mt.dep"
|
||||||
|
UseFAT32Workaround="false"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
VerboseOutput="false"
|
||||||
|
GenerateCatalogFiles="false"
|
||||||
|
UpdateFileHashes="false"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCXDCMakeTool"
|
||||||
|
UseUnicodeResponseFiles="true"
|
||||||
|
DocumentLibraryDependencies="true"
|
||||||
|
SuppressStartupBanner="true"
|
||||||
|
ValidateIntelliSense="false"
|
||||||
|
OutputDocumentFile="$(TargetDir)$(TargetName).xml"
|
||||||
|
/>
|
||||||
|
</VisualStudioPropertySheet>
|
|
@ -0,0 +1,33 @@
|
||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioPropertySheet
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="8.00"
|
||||||
|
Name="Release"
|
||||||
|
InheritedPropertySheets=".\Default.vsprops"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
Optimization="1"
|
||||||
|
InlineFunctionExpansion="0"
|
||||||
|
EnableIntrinsicFunctions="false"
|
||||||
|
FavorSizeOrSpeed="2"
|
||||||
|
OmitFramePointers="false"
|
||||||
|
EnableFiberSafeOptimizations="false"
|
||||||
|
WholeProgramOptimization="false"
|
||||||
|
PreprocessorDefinitions="NDEBUG"
|
||||||
|
SmallerTypeCheck="false"
|
||||||
|
RuntimeLibrary="0"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
ProfileGuidedDatabase=""
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCMIDLTool"
|
||||||
|
PreprocessorDefinitions="NDEBUG"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCResourceCompilerTool"
|
||||||
|
PreprocessorDefinitions="NDEBUG"
|
||||||
|
/>
|
||||||
|
</VisualStudioPropertySheet>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="windows-1251"?>
|
||||||
|
<VisualStudioPropertySheet
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="8.00"
|
||||||
|
Name="Win32.Debug"
|
||||||
|
InheritedPropertySheets=".\Win32.vsprops;.\Debug.vsprops;"
|
||||||
|
>
|
||||||
|
</VisualStudioPropertySheet>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="windows-1251"?>
|
||||||
|
<VisualStudioPropertySheet
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="8.00"
|
||||||
|
Name="Win32.Release"
|
||||||
|
InheritedPropertySheets=".\Win32.vsprops;.\Release.vsprops"
|
||||||
|
>
|
||||||
|
</VisualStudioPropertySheet>
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="windows-1251"?>
|
||||||
|
<VisualStudioPropertySheet
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="8.00"
|
||||||
|
Name="Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
PreprocessorDefinitions="WIN32;_WIN32;_WINDOWS;WIN32_LEAN_AND_MEAN"
|
||||||
|
/>
|
||||||
|
<Tool
|
||||||
|
Name="VCLinkerTool"
|
||||||
|
TargetMachine="1"
|
||||||
|
/>
|
||||||
|
</VisualStudioPropertySheet>
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version="1.0" encoding="Windows-1252"?>
|
||||||
|
<VisualStudioPropertySheet
|
||||||
|
ProjectType="Visual C++"
|
||||||
|
Version="8.00"
|
||||||
|
Name="Root"
|
||||||
|
>
|
||||||
|
<UserMacro
|
||||||
|
Name="ROOT"
|
||||||
|
Value="$(SolutionDir)"
|
||||||
|
/>
|
||||||
|
<UserMacro
|
||||||
|
Name="SRC"
|
||||||
|
Value="$(ROOT)Source\"
|
||||||
|
/>
|
||||||
|
</VisualStudioPropertySheet>
|
|
@ -17,13 +17,8 @@
|
||||||
<Configurations>
|
<Configurations>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|Win32"
|
Name="Debug|Win32"
|
||||||
OutputDirectory="$(SolutionDir)bin/$(ConfigurationName)/lib"
|
|
||||||
IntermediateDirectory="$(SolutionDir)build/$(ConfigurationName)/$(ProjectName)"
|
|
||||||
ConfigurationType="4"
|
ConfigurationType="4"
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
InheritedPropertySheets="$(SolutionDir)PropertySheets/Win32.Debug.vsprops"
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
|
@ -42,24 +37,13 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
UsePrecompiledHeader="0"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
BufferSecurityCheck="false"
|
|
||||||
RuntimeTypeInfo="false"
|
|
||||||
WarningLevel="3"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
PreprocessorDefinitions="_DEBUG"
|
|
||||||
Culture="3081"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
|
@ -75,77 +59,6 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCBscMakeTool"
|
Name="VCBscMakeTool"
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\../../Build/7zip/Debug/7zip.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
OutputDirectory="$(SolutionDir)bin/$(ConfigurationName)/lib"
|
|
||||||
IntermediateDirectory="$(SolutionDir)build/$(ConfigurationName)/$(ProjectName)"
|
|
||||||
ConfigurationType="4"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
InlineFunctionExpansion="1"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
|
||||||
StringPooling="true"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
WarningLevel="3"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
Culture="3081"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLibrarianTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\../../Bin/External/7zip.bsc"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCFxCopTool"
|
Name="VCFxCopTool"
|
||||||
|
@ -156,13 +69,8 @@
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
OutputDirectory="$(SolutionDir)bin/$(ConfigurationName)/lib"
|
|
||||||
IntermediateDirectory="$(SolutionDir)build/$(ConfigurationName)/$(ProjectName)"
|
|
||||||
ConfigurationType="4"
|
ConfigurationType="4"
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
InheritedPropertySheets="$(SolutionDir)PropertySheets/Win32.Release.vsprops"
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
|
@ -181,30 +89,19 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="2"
|
UsePrecompiledHeader="0"
|
||||||
InlineFunctionExpansion="1"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
|
||||||
StringPooling="true"
|
|
||||||
ExceptionHandling="0"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
BufferSecurityCheck="false"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
WarningLevel="3"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
Culture="3081"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLibrarianTool"
|
Name="VCLibrarianTool"
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCALinkTool"
|
Name="VCALinkTool"
|
||||||
|
@ -214,8 +111,6 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCBscMakeTool"
|
Name="VCBscMakeTool"
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\../../Build/7zip/Release/7zip.bsc"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCFxCopTool"
|
Name="VCFxCopTool"
|
||||||
|
@ -235,282 +130,42 @@
|
||||||
<File
|
<File
|
||||||
RelativePath="7zAlloc.c"
|
RelativePath="7zAlloc.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="7zBuffer.c"
|
RelativePath="7zBuffer.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="7zCrc.c"
|
RelativePath="7zCrc.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="7zDecode.c"
|
RelativePath="7zDecode.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="7zExtract.c"
|
RelativePath="7zExtract.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="7zHeader.c"
|
RelativePath="7zHeader.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="7zIn.c"
|
RelativePath="7zIn.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="7zItem.c"
|
RelativePath="7zItem.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="7zMethodID.c"
|
RelativePath="7zMethodID.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="Compress\LzmaDecode.c"
|
RelativePath="Compress\LzmaDecode.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
|
|
|
@ -17,13 +17,10 @@
|
||||||
<Configurations>
|
<Configurations>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|Win32"
|
Name="Debug|Win32"
|
||||||
OutputDirectory="$(SolutionDir)bin/$(ConfigurationName)/lib"
|
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||||
IntermediateDirectory="$(SolutionDir)build/$(ConfigurationName)/$(ProjectName)"
|
IntermediateDirectory="$(ConfigurationName)"
|
||||||
ConfigurationType="4"
|
ConfigurationType="4"
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
|
@ -42,33 +39,18 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
PrecompiledHeaderFile=".\../../Build/WTL/Debug/WTL.pch"
|
|
||||||
AssemblerListingLocation=".\../../Build/WTL/Debug/"
|
|
||||||
ObjectFile=".\../../Build/WTL/Debug/"
|
|
||||||
ProgramDataBaseFileName=".\../../Build/WTL/Debug/"
|
|
||||||
WarningLevel="3"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
DebugInformationFormat="4"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
PreprocessorDefinitions="_DEBUG"
|
|
||||||
Culture="3081"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLibrarianTool"
|
Name="VCLibrarianTool"
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCALinkTool"
|
Name="VCALinkTool"
|
||||||
|
@ -78,8 +60,6 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCBscMakeTool"
|
Name="VCBscMakeTool"
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\../../Bin/Debug/WTL.bsc"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCFxCopTool"
|
Name="VCFxCopTool"
|
||||||
|
@ -90,13 +70,8 @@
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
OutputDirectory="$(SolutionDir)bin/$(ConfigurationName)/lib"
|
|
||||||
IntermediateDirectory="$(SolutionDir)build/$(ConfigurationName)/$(ProjectName)"
|
|
||||||
ConfigurationType="4"
|
ConfigurationType="4"
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
InheritedPropertySheets="$(SolutionDir)PropertySheets/Win32.Release.vsprops"
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
|
@ -115,34 +90,18 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="2"
|
|
||||||
InlineFunctionExpansion="1"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
|
||||||
StringPooling="true"
|
|
||||||
RuntimeLibrary="2"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
PrecompiledHeaderFile=".\Release/WTL.pch"
|
|
||||||
AssemblerListingLocation=".\Release/"
|
|
||||||
ObjectFile=".\Release/"
|
|
||||||
ProgramDataBaseFileName=".\Release/"
|
|
||||||
WarningLevel="3"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
Culture="3081"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLibrarianTool"
|
Name="VCLibrarianTool"
|
||||||
OutputFile=".\Release\WTL.lib"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCALinkTool"
|
Name="VCALinkTool"
|
||||||
|
@ -152,8 +111,6 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCBscMakeTool"
|
Name="VCBscMakeTool"
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Release/WTL.bsc"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCFxCopTool"
|
Name="VCFxCopTool"
|
||||||
|
|
|
@ -52,6 +52,8 @@
|
||||||
// CTabViewImpl<T, TBase, TWinTraits>
|
// CTabViewImpl<T, TBase, TWinTraits>
|
||||||
// CTabView
|
// CTabView
|
||||||
|
|
||||||
|
#include <ShellAPI.h>
|
||||||
|
|
||||||
namespace WTL
|
namespace WTL
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,359 @@
|
||||||
|
|
||||||
ChangeLog file for zlib
|
ChangeLog file for zlib
|
||||||
|
|
||||||
|
Changes in 1.2.5 (19 Apr 2010)
|
||||||
|
- Disable visibility attribute in win32/Makefile.gcc [Bar-Lev]
|
||||||
|
- Default to libdir as sharedlibdir in configure [Nieder]
|
||||||
|
- Update copyright dates on modified source files
|
||||||
|
- Update trees.c to be able to generate modified trees.h
|
||||||
|
- Exit configure for MinGW, suggesting win32/Makefile.gcc
|
||||||
|
|
||||||
|
Changes in 1.2.4.5 (18 Apr 2010)
|
||||||
|
- Set sharedlibdir in configure [Torok]
|
||||||
|
- Set LDFLAGS in Makefile.in [Bar-Lev]
|
||||||
|
- Avoid mkdir objs race condition in Makefile.in [Bowler]
|
||||||
|
- Add ZLIB_INTERNAL in front of internal inter-module functions and arrays
|
||||||
|
- Define ZLIB_INTERNAL to hide internal functions and arrays for GNU C
|
||||||
|
- Don't use hidden attribute when it is a warning generator (e.g. Solaris)
|
||||||
|
|
||||||
|
Changes in 1.2.4.4 (18 Apr 2010)
|
||||||
|
- Fix CROSS_PREFIX executable testing, CHOST extract, mingw* [Torok]
|
||||||
|
- Undefine _LARGEFILE64_SOURCE in zconf.h if it is zero, but not if empty
|
||||||
|
- Try to use bash or ksh regardless of functionality of /bin/sh
|
||||||
|
- Fix configure incompatibility with NetBSD sh
|
||||||
|
- Remove attempt to run under bash or ksh since have better NetBSD fix
|
||||||
|
- Fix win32/Makefile.gcc for MinGW [Bar-Lev]
|
||||||
|
- Add diagnostic messages when using CROSS_PREFIX in configure
|
||||||
|
- Added --sharedlibdir option to configure [Weigelt]
|
||||||
|
- Use hidden visibility attribute when available [Frysinger]
|
||||||
|
|
||||||
|
Changes in 1.2.4.3 (10 Apr 2010)
|
||||||
|
- Only use CROSS_PREFIX in configure for ar and ranlib if they exist
|
||||||
|
- Use CROSS_PREFIX for nm [Bar-Lev]
|
||||||
|
- Assume _LARGEFILE64_SOURCE defined is equivalent to true
|
||||||
|
- Avoid use of undefined symbols in #if with && and ||
|
||||||
|
- Make *64 prototypes in gzguts.h consistent with functions
|
||||||
|
- Add -shared load option for MinGW in configure [Bowler]
|
||||||
|
- Move z_off64_t to public interface, use instead of off64_t
|
||||||
|
- Remove ! from shell test in configure (not portable to Solaris)
|
||||||
|
- Change +0 macro tests to -0 for possibly increased portability
|
||||||
|
|
||||||
|
Changes in 1.2.4.2 (9 Apr 2010)
|
||||||
|
- Add consistent carriage returns to readme.txt's in masmx86 and masmx64
|
||||||
|
- Really provide prototypes for *64 functions when building without LFS
|
||||||
|
- Only define unlink() in minigzip.c if unistd.h not included
|
||||||
|
- Update README to point to contrib/vstudio project files
|
||||||
|
- Move projects/vc6 to old/ and remove projects/
|
||||||
|
- Include stdlib.h in minigzip.c for setmode() definition under WinCE
|
||||||
|
- Clean up assembler builds in win32/Makefile.msc [Rowe]
|
||||||
|
- Include sys/types.h for Microsoft for off_t definition
|
||||||
|
- Fix memory leak on error in gz_open()
|
||||||
|
- Symbolize nm as $NM in configure [Weigelt]
|
||||||
|
- Use TEST_LDSHARED instead of LDSHARED to link test programs [Weigelt]
|
||||||
|
- Add +0 to _FILE_OFFSET_BITS and _LFS64_LARGEFILE in case not defined
|
||||||
|
- Fix bug in gzeof() to take into account unused input data
|
||||||
|
- Avoid initialization of structures with variables in puff.c
|
||||||
|
- Updated win32/README-WIN32.txt [Rowe]
|
||||||
|
|
||||||
|
Changes in 1.2.4.1 (28 Mar 2010)
|
||||||
|
- Remove the use of [a-z] constructs for sed in configure [gentoo 310225]
|
||||||
|
- Remove $(SHAREDLIB) from LIBS in Makefile.in [Creech]
|
||||||
|
- Restore "for debugging" comment on sprintf() in gzlib.c
|
||||||
|
- Remove fdopen for MVS from gzguts.h
|
||||||
|
- Put new README-WIN32.txt in win32 [Rowe]
|
||||||
|
- Add check for shell to configure and invoke another shell if needed
|
||||||
|
- Fix big fat stinking bug in gzseek() on uncompressed files
|
||||||
|
- Remove vestigial F_OPEN64 define in zutil.h
|
||||||
|
- Set and check the value of _LARGEFILE_SOURCE and _LARGEFILE64_SOURCE
|
||||||
|
- Avoid errors on non-LFS systems when applications define LFS macros
|
||||||
|
- Set EXE to ".exe" in configure for MINGW [Kahle]
|
||||||
|
- Match crc32() in crc32.c exactly to the prototype in zlib.h [Sherrill]
|
||||||
|
- Add prefix for cross-compilation in win32/makefile.gcc [Bar-Lev]
|
||||||
|
- Add DLL install in win32/makefile.gcc [Bar-Lev]
|
||||||
|
- Allow Linux* or linux* from uname in configure [Bar-Lev]
|
||||||
|
- Allow ldconfig to be redefined in configure and Makefile.in [Bar-Lev]
|
||||||
|
- Add cross-compilation prefixes to configure [Bar-Lev]
|
||||||
|
- Match type exactly in gz_load() invocation in gzread.c
|
||||||
|
- Match type exactly of zcalloc() in zutil.c to zlib.h alloc_func
|
||||||
|
- Provide prototypes for *64 functions when building zlib without LFS
|
||||||
|
- Don't use -lc when linking shared library on MinGW
|
||||||
|
- Remove errno.h check in configure and vestigial errno code in zutil.h
|
||||||
|
|
||||||
|
Changes in 1.2.4 (14 Mar 2010)
|
||||||
|
- Fix VER3 extraction in configure for no fourth subversion
|
||||||
|
- Update zlib.3, add docs to Makefile.in to make .pdf out of it
|
||||||
|
- Add zlib.3.pdf to distribution
|
||||||
|
- Don't set error code in gzerror() if passed pointer is NULL
|
||||||
|
- Apply destination directory fixes to CMakeLists.txt [Lowman]
|
||||||
|
- Move #cmakedefine's to a new zconf.in.cmakein
|
||||||
|
- Restore zconf.h for builds that don't use configure or cmake
|
||||||
|
- Add distclean to dummy Makefile for convenience
|
||||||
|
- Update and improve INDEX, README, and FAQ
|
||||||
|
- Update CMakeLists.txt for the return of zconf.h [Lowman]
|
||||||
|
- Update contrib/vstudio/vc9 and vc10 [Vollant]
|
||||||
|
- Change libz.dll.a back to libzdll.a in win32/Makefile.gcc
|
||||||
|
- Apply license and readme changes to contrib/asm686 [Raiter]
|
||||||
|
- Check file name lengths and add -c option in minigzip.c [Li]
|
||||||
|
- Update contrib/amd64 and contrib/masmx86/ [Vollant]
|
||||||
|
- Avoid use of "eof" parameter in trees.c to not shadow library variable
|
||||||
|
- Update make_vms.com for removal of zlibdefs.h [Zinser]
|
||||||
|
- Update assembler code and vstudio projects in contrib [Vollant]
|
||||||
|
- Remove outdated assembler code contrib/masm686 and contrib/asm586
|
||||||
|
- Remove old vc7 and vc8 from contrib/vstudio
|
||||||
|
- Update win32/Makefile.msc, add ZLIB_VER_SUBREVISION [Rowe]
|
||||||
|
- Fix memory leaks in gzclose_r() and gzclose_w(), file leak in gz_open()
|
||||||
|
- Add contrib/gcc_gvmat64 for longest_match and inflate_fast [Vollant]
|
||||||
|
- Remove *64 functions from win32/zlib.def (they're not 64-bit yet)
|
||||||
|
- Fix bug in void-returning vsprintf() case in gzwrite.c
|
||||||
|
- Fix name change from inflate.h in contrib/inflate86/inffas86.c
|
||||||
|
- Check if temporary file exists before removing in make_vms.com [Zinser]
|
||||||
|
- Fix make install and uninstall for --static option
|
||||||
|
- Fix usage of _MSC_VER in gzguts.h and zutil.h [Truta]
|
||||||
|
- Update readme.txt in contrib/masmx64 and masmx86 to assemble
|
||||||
|
|
||||||
|
Changes in 1.2.3.9 (21 Feb 2010)
|
||||||
|
- Expunge gzio.c
|
||||||
|
- Move as400 build information to old
|
||||||
|
- Fix updates in contrib/minizip and contrib/vstudio
|
||||||
|
- Add const to vsnprintf test in configure to avoid warnings [Weigelt]
|
||||||
|
- Delete zconf.h (made by configure) [Weigelt]
|
||||||
|
- Change zconf.in.h to zconf.h.in per convention [Weigelt]
|
||||||
|
- Check for NULL buf in gzgets()
|
||||||
|
- Return empty string for gzgets() with len == 1 (like fgets())
|
||||||
|
- Fix description of gzgets() in zlib.h for end-of-file, NULL return
|
||||||
|
- Update minizip to 1.1 [Vollant]
|
||||||
|
- Avoid MSVC loss of data warnings in gzread.c, gzwrite.c
|
||||||
|
- Note in zlib.h that gzerror() should be used to distinguish from EOF
|
||||||
|
- Remove use of snprintf() from gzlib.c
|
||||||
|
- Fix bug in gzseek()
|
||||||
|
- Update contrib/vstudio, adding vc9 and vc10 [Kuno, Vollant]
|
||||||
|
- Fix zconf.h generation in CMakeLists.txt [Lowman]
|
||||||
|
- Improve comments in zconf.h where modified by configure
|
||||||
|
|
||||||
|
Changes in 1.2.3.8 (13 Feb 2010)
|
||||||
|
- Clean up text files (tabs, trailing whitespace, etc.) [Oberhumer]
|
||||||
|
- Use z_off64_t in gz_zero() and gz_skip() to match state->skip
|
||||||
|
- Avoid comparison problem when sizeof(int) == sizeof(z_off64_t)
|
||||||
|
- Revert to Makefile.in from 1.2.3.6 (live with the clutter)
|
||||||
|
- Fix missing error return in gzflush(), add zlib.h note
|
||||||
|
- Add *64 functions to zlib.map [Levin]
|
||||||
|
- Fix signed/unsigned comparison in gz_comp()
|
||||||
|
- Use SFLAGS when testing shared linking in configure
|
||||||
|
- Add --64 option to ./configure to use -m64 with gcc
|
||||||
|
- Fix ./configure --help to correctly name options
|
||||||
|
- Have make fail if a test fails [Levin]
|
||||||
|
- Avoid buffer overrun in contrib/masmx64/gvmat64.asm [Simpson]
|
||||||
|
- Remove assembler object files from contrib
|
||||||
|
|
||||||
|
Changes in 1.2.3.7 (24 Jan 2010)
|
||||||
|
- Always gzopen() with O_LARGEFILE if available
|
||||||
|
- Fix gzdirect() to work immediately after gzopen() or gzdopen()
|
||||||
|
- Make gzdirect() more precise when the state changes while reading
|
||||||
|
- Improve zlib.h documentation in many places
|
||||||
|
- Catch memory allocation failure in gz_open()
|
||||||
|
- Complete close operation if seek forward in gzclose_w() fails
|
||||||
|
- Return Z_ERRNO from gzclose_r() if close() fails
|
||||||
|
- Return Z_STREAM_ERROR instead of EOF for gzclose() being passed NULL
|
||||||
|
- Return zero for gzwrite() errors to match zlib.h description
|
||||||
|
- Return -1 on gzputs() error to match zlib.h description
|
||||||
|
- Add zconf.in.h to allow recovery from configure modification [Weigelt]
|
||||||
|
- Fix static library permissions in Makefile.in [Weigelt]
|
||||||
|
- Avoid warnings in configure tests that hide functionality [Weigelt]
|
||||||
|
- Add *BSD and DragonFly to Linux case in configure [gentoo 123571]
|
||||||
|
- Change libzdll.a to libz.dll.a in win32/Makefile.gcc [gentoo 288212]
|
||||||
|
- Avoid access of uninitialized data for first inflateReset2 call [Gomes]
|
||||||
|
- Keep object files in subdirectories to reduce the clutter somewhat
|
||||||
|
- Remove default Makefile and zlibdefs.h, add dummy Makefile
|
||||||
|
- Add new external functions to Z_PREFIX, remove duplicates, z_z_ -> z_
|
||||||
|
- Remove zlibdefs.h completely -- modify zconf.h instead
|
||||||
|
|
||||||
|
Changes in 1.2.3.6 (17 Jan 2010)
|
||||||
|
- Avoid void * arithmetic in gzread.c and gzwrite.c
|
||||||
|
- Make compilers happier with const char * for gz_error message
|
||||||
|
- Avoid unused parameter warning in inflate.c
|
||||||
|
- Avoid signed-unsigned comparison warning in inflate.c
|
||||||
|
- Indent #pragma's for traditional C
|
||||||
|
- Fix usage of strwinerror() in glib.c, change to gz_strwinerror()
|
||||||
|
- Correct email address in configure for system options
|
||||||
|
- Update make_vms.com and add make_vms.com to contrib/minizip [Zinser]
|
||||||
|
- Update zlib.map [Brown]
|
||||||
|
- Fix Makefile.in for Solaris 10 make of example64 and minizip64 [Torok]
|
||||||
|
- Apply various fixes to CMakeLists.txt [Lowman]
|
||||||
|
- Add checks on len in gzread() and gzwrite()
|
||||||
|
- Add error message for no more room for gzungetc()
|
||||||
|
- Remove zlib version check in gzwrite()
|
||||||
|
- Defer compression of gzprintf() result until need to
|
||||||
|
- Use snprintf() in gzdopen() if available
|
||||||
|
- Remove USE_MMAP configuration determination (only used by minigzip)
|
||||||
|
- Remove examples/pigz.c (available separately)
|
||||||
|
- Update examples/gun.c to 1.6
|
||||||
|
|
||||||
|
Changes in 1.2.3.5 (8 Jan 2010)
|
||||||
|
- Add space after #if in zutil.h for some compilers
|
||||||
|
- Fix relatively harmless bug in deflate_fast() [Exarevsky]
|
||||||
|
- Fix same problem in deflate_slow()
|
||||||
|
- Add $(SHAREDLIBV) to LIBS in Makefile.in [Brown]
|
||||||
|
- Add deflate_rle() for faster Z_RLE strategy run-length encoding
|
||||||
|
- Add deflate_huff() for faster Z_HUFFMAN_ONLY encoding
|
||||||
|
- Change name of "write" variable in inffast.c to avoid library collisions
|
||||||
|
- Fix premature EOF from gzread() in gzio.c [Brown]
|
||||||
|
- Use zlib header window size if windowBits is 0 in inflateInit2()
|
||||||
|
- Remove compressBound() call in deflate.c to avoid linking compress.o
|
||||||
|
- Replace use of errno in gz* with functions, support WinCE [Alves]
|
||||||
|
- Provide alternative to perror() in minigzip.c for WinCE [Alves]
|
||||||
|
- Don't use _vsnprintf on later versions of MSVC [Lowman]
|
||||||
|
- Add CMake build script and input file [Lowman]
|
||||||
|
- Update contrib/minizip to 1.1 [Svensson, Vollant]
|
||||||
|
- Moved nintendods directory from contrib to .
|
||||||
|
- Replace gzio.c with a new set of routines with the same functionality
|
||||||
|
- Add gzbuffer(), gzoffset(), gzclose_r(), gzclose_w() as part of above
|
||||||
|
- Update contrib/minizip to 1.1b
|
||||||
|
- Change gzeof() to return 0 on error instead of -1 to agree with zlib.h
|
||||||
|
|
||||||
|
Changes in 1.2.3.4 (21 Dec 2009)
|
||||||
|
- Use old school .SUFFIXES in Makefile.in for FreeBSD compatibility
|
||||||
|
- Update comments in configure and Makefile.in for default --shared
|
||||||
|
- Fix test -z's in configure [Marquess]
|
||||||
|
- Build examplesh and minigzipsh when not testing
|
||||||
|
- Change NULL's to Z_NULL's in deflate.c and in comments in zlib.h
|
||||||
|
- Import LDFLAGS from the environment in configure
|
||||||
|
- Fix configure to populate SFLAGS with discovered CFLAGS options
|
||||||
|
- Adapt make_vms.com to the new Makefile.in [Zinser]
|
||||||
|
- Add zlib2ansi script for C++ compilation [Marquess]
|
||||||
|
- Add _FILE_OFFSET_BITS=64 test to make test (when applicable)
|
||||||
|
- Add AMD64 assembler code for longest match to contrib [Teterin]
|
||||||
|
- Include options from $SFLAGS when doing $LDSHARED
|
||||||
|
- Simplify 64-bit file support by introducing z_off64_t type
|
||||||
|
- Make shared object files in objs directory to work around old Sun cc
|
||||||
|
- Use only three-part version number for Darwin shared compiles
|
||||||
|
- Add rc option to ar in Makefile.in for when ./configure not run
|
||||||
|
- Add -WI,-rpath,. to LDFLAGS for OSF 1 V4*
|
||||||
|
- Set LD_LIBRARYN32_PATH for SGI IRIX shared compile
|
||||||
|
- Protect against _FILE_OFFSET_BITS being defined when compiling zlib
|
||||||
|
- Rename Makefile.in targets allstatic to static and allshared to shared
|
||||||
|
- Fix static and shared Makefile.in targets to be independent
|
||||||
|
- Correct error return bug in gz_open() by setting state [Brown]
|
||||||
|
- Put spaces before ;;'s in configure for better sh compatibility
|
||||||
|
- Add pigz.c (parallel implementation of gzip) to examples/
|
||||||
|
- Correct constant in crc32.c to UL [Leventhal]
|
||||||
|
- Reject negative lengths in crc32_combine()
|
||||||
|
- Add inflateReset2() function to work like inflateEnd()/inflateInit2()
|
||||||
|
- Include sys/types.h for _LARGEFILE64_SOURCE [Brown]
|
||||||
|
- Correct typo in doc/algorithm.txt [Janik]
|
||||||
|
- Fix bug in adler32_combine() [Zhu]
|
||||||
|
- Catch missing-end-of-block-code error in all inflates and in puff
|
||||||
|
Assures that random input to inflate eventually results in an error
|
||||||
|
- Added enough.c (calculation of ENOUGH for inftrees.h) to examples/
|
||||||
|
- Update ENOUGH and its usage to reflect discovered bounds
|
||||||
|
- Fix gzerror() error report on empty input file [Brown]
|
||||||
|
- Add ush casts in trees.c to avoid pedantic runtime errors
|
||||||
|
- Fix typo in zlib.h uncompress() description [Reiss]
|
||||||
|
- Correct inflate() comments with regard to automatic header detection
|
||||||
|
- Remove deprecation comment on Z_PARTIAL_FLUSH (it stays)
|
||||||
|
- Put new version of gzlog (2.0) in examples with interruption recovery
|
||||||
|
- Add puff compile option to permit invalid distance-too-far streams
|
||||||
|
- Add puff TEST command options, ability to read piped input
|
||||||
|
- Prototype the *64 functions in zlib.h when _FILE_OFFSET_BITS == 64, but
|
||||||
|
_LARGEFILE64_SOURCE not defined
|
||||||
|
- Fix Z_FULL_FLUSH to truly erase the past by resetting s->strstart
|
||||||
|
- Fix deflateSetDictionary() to use all 32K for output consistency
|
||||||
|
- Remove extraneous #define MIN_LOOKAHEAD in deflate.c (in deflate.h)
|
||||||
|
- Clear bytes after deflate lookahead to avoid use of uninitialized data
|
||||||
|
- Change a limit in inftrees.c to be more transparent to Coverity Prevent
|
||||||
|
- Update win32/zlib.def with exported symbols from zlib.h
|
||||||
|
- Correct spelling error in zlib.h [Willem]
|
||||||
|
- Allow Z_BLOCK for deflate() to force a new block
|
||||||
|
- Allow negative bits in inflatePrime() to delete existing bit buffer
|
||||||
|
- Add Z_TREES flush option to inflate() to return at end of trees
|
||||||
|
- Add inflateMark() to return current state information for random access
|
||||||
|
- Add Makefile for NintendoDS to contrib [Costa]
|
||||||
|
- Add -w in configure compile tests to avoid spurious warnings [Beucler]
|
||||||
|
- Fix typos in zlib.h comments for deflateSetDictionary()
|
||||||
|
- Fix EOF detection in transparent gzread() [Maier]
|
||||||
|
|
||||||
|
Changes in 1.2.3.3 (2 October 2006)
|
||||||
|
- Make --shared the default for configure, add a --static option
|
||||||
|
- Add compile option to permit invalid distance-too-far streams
|
||||||
|
- Add inflateUndermine() function which is required to enable above
|
||||||
|
- Remove use of "this" variable name for C++ compatibility [Marquess]
|
||||||
|
- Add testing of shared library in make test, if shared library built
|
||||||
|
- Use ftello() and fseeko() if available instead of ftell() and fseek()
|
||||||
|
- Provide two versions of all functions that use the z_off_t type for
|
||||||
|
binary compatibility -- a normal version and a 64-bit offset version,
|
||||||
|
per the Large File Support Extension when _LARGEFILE64_SOURCE is
|
||||||
|
defined; use the 64-bit versions by default when _FILE_OFFSET_BITS
|
||||||
|
is defined to be 64
|
||||||
|
- Add a --uname= option to configure to perhaps help with cross-compiling
|
||||||
|
|
||||||
|
Changes in 1.2.3.2 (3 September 2006)
|
||||||
|
- Turn off silly Borland warnings [Hay]
|
||||||
|
- Use off64_t and define _LARGEFILE64_SOURCE when present
|
||||||
|
- Fix missing dependency on inffixed.h in Makefile.in
|
||||||
|
- Rig configure --shared to build both shared and static [Teredesai, Truta]
|
||||||
|
- Remove zconf.in.h and instead create a new zlibdefs.h file
|
||||||
|
- Fix contrib/minizip/unzip.c non-encrypted after encrypted [Vollant]
|
||||||
|
- Add treebuild.xml (see http://treebuild.metux.de/) [Weigelt]
|
||||||
|
|
||||||
|
Changes in 1.2.3.1 (16 August 2006)
|
||||||
|
- Add watcom directory with OpenWatcom make files [Daniel]
|
||||||
|
- Remove #undef of FAR in zconf.in.h for MVS [Fedtke]
|
||||||
|
- Update make_vms.com [Zinser]
|
||||||
|
- Use -fPIC for shared build in configure [Teredesai, Nicholson]
|
||||||
|
- Use only major version number for libz.so on IRIX and OSF1 [Reinholdtsen]
|
||||||
|
- Use fdopen() (not _fdopen()) for Interix in zutil.h [BŠck]
|
||||||
|
- Add some FAQ entries about the contrib directory
|
||||||
|
- Update the MVS question in the FAQ
|
||||||
|
- Avoid extraneous reads after EOF in gzio.c [Brown]
|
||||||
|
- Correct spelling of "successfully" in gzio.c [Randers-Pehrson]
|
||||||
|
- Add comments to zlib.h about gzerror() usage [Brown]
|
||||||
|
- Set extra flags in gzip header in gzopen() like deflate() does
|
||||||
|
- Make configure options more compatible with double-dash conventions
|
||||||
|
[Weigelt]
|
||||||
|
- Clean up compilation under Solaris SunStudio cc [Rowe, Reinholdtsen]
|
||||||
|
- Fix uninstall target in Makefile.in [Truta]
|
||||||
|
- Add pkgconfig support [Weigelt]
|
||||||
|
- Use $(DESTDIR) macro in Makefile.in [Reinholdtsen, Weigelt]
|
||||||
|
- Replace set_data_type() with a more accurate detect_data_type() in
|
||||||
|
trees.c, according to the txtvsbin.txt document [Truta]
|
||||||
|
- Swap the order of #include <stdio.h> and #include "zlib.h" in
|
||||||
|
gzio.c, example.c and minigzip.c [Truta]
|
||||||
|
- Shut up annoying VS2005 warnings about standard C deprecation [Rowe,
|
||||||
|
Truta] (where?)
|
||||||
|
- Fix target "clean" from win32/Makefile.bor [Truta]
|
||||||
|
- Create .pdb and .manifest files in win32/makefile.msc [Ziegler, Rowe]
|
||||||
|
- Update zlib www home address in win32/DLL_FAQ.txt [Truta]
|
||||||
|
- Update contrib/masmx86/inffas32.asm for VS2005 [Vollant, Van Wassenhove]
|
||||||
|
- Enable browse info in the "Debug" and "ASM Debug" configurations in
|
||||||
|
the Visual C++ 6 project, and set (non-ASM) "Debug" as default [Truta]
|
||||||
|
- Add pkgconfig support [Weigelt]
|
||||||
|
- Add ZLIB_VER_MAJOR, ZLIB_VER_MINOR and ZLIB_VER_REVISION in zlib.h,
|
||||||
|
for use in win32/zlib1.rc [Polushin, Rowe, Truta]
|
||||||
|
- Add a document that explains the new text detection scheme to
|
||||||
|
doc/txtvsbin.txt [Truta]
|
||||||
|
- Add rfc1950.txt, rfc1951.txt and rfc1952.txt to doc/ [Truta]
|
||||||
|
- Move algorithm.txt into doc/ [Truta]
|
||||||
|
- Synchronize FAQ with website
|
||||||
|
- Fix compressBound(), was low for some pathological cases [Fearnley]
|
||||||
|
- Take into account wrapper variations in deflateBound()
|
||||||
|
- Set examples/zpipe.c input and output to binary mode for Windows
|
||||||
|
- Update examples/zlib_how.html with new zpipe.c (also web site)
|
||||||
|
- Fix some warnings in examples/gzlog.c and examples/zran.c (it seems
|
||||||
|
that gcc became pickier in 4.0)
|
||||||
|
- Add zlib.map for Linux: "All symbols from zlib-1.1.4 remain
|
||||||
|
un-versioned, the patch adds versioning only for symbols introduced in
|
||||||
|
zlib-1.2.0 or later. It also declares as local those symbols which are
|
||||||
|
not designed to be exported." [Levin]
|
||||||
|
- Update Z_PREFIX list in zconf.in.h, add --zprefix option to configure
|
||||||
|
- Do not initialize global static by default in trees.c, add a response
|
||||||
|
NO_INIT_GLOBAL_POINTERS to initialize them if needed [Marquess]
|
||||||
|
- Don't use strerror() in gzio.c under WinCE [Yakimov]
|
||||||
|
- Don't use errno.h in zutil.h under WinCE [Yakimov]
|
||||||
|
- Move arguments for AR to its usage to allow replacing ar [Marot]
|
||||||
|
- Add HAVE_VISIBILITY_PRAGMA in zconf.in.h for Mozilla [Randers-Pehrson]
|
||||||
|
- Improve inflateInit() and inflateInit2() documentation
|
||||||
|
- Fix structure size comment in inflate.h
|
||||||
|
- Change configure help option from --h* to --help [Santos]
|
||||||
|
|
||||||
Changes in 1.2.3 (18 July 2005)
|
Changes in 1.2.3 (18 July 2005)
|
||||||
- Apply security vulnerability fixes to contrib/infback9 as well
|
- Apply security vulnerability fixes to contrib/infback9 as well
|
||||||
- Clean up some text files (carriage returns, trailing space)
|
- Clean up some text files (carriage returns, trailing space)
|
||||||
|
@ -13,7 +366,7 @@ Changes in 1.2.2.4 (11 July 2005)
|
||||||
compile
|
compile
|
||||||
- Fix some spelling errors in comments [Betts]
|
- Fix some spelling errors in comments [Betts]
|
||||||
- Correct inflateInit2() error return documentation in zlib.h
|
- Correct inflateInit2() error return documentation in zlib.h
|
||||||
- Added zran.c example of compressed data random access to examples
|
- Add zran.c example of compressed data random access to examples
|
||||||
directory, shows use of inflatePrime()
|
directory, shows use of inflatePrime()
|
||||||
- Fix cast for assignments to strm->state in inflate.c and infback.c
|
- Fix cast for assignments to strm->state in inflate.c and infback.c
|
||||||
- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer]
|
- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer]
|
||||||
|
|
|
@ -1,339 +0,0 @@
|
||||||
|
|
||||||
Frequently Asked Questions about zlib
|
|
||||||
|
|
||||||
|
|
||||||
If your question is not there, please check the zlib home page
|
|
||||||
http://www.zlib.org which may have more recent information.
|
|
||||||
The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html
|
|
||||||
|
|
||||||
|
|
||||||
1. Is zlib Y2K-compliant?
|
|
||||||
|
|
||||||
Yes. zlib doesn't handle dates.
|
|
||||||
|
|
||||||
2. Where can I get a Windows DLL version?
|
|
||||||
|
|
||||||
The zlib sources can be compiled without change to produce a DLL.
|
|
||||||
See the file win32/DLL_FAQ.txt in the zlib distribution.
|
|
||||||
Pointers to the precompiled DLL are found in the zlib web site at
|
|
||||||
http://www.zlib.org.
|
|
||||||
|
|
||||||
3. Where can I get a Visual Basic interface to zlib?
|
|
||||||
|
|
||||||
See
|
|
||||||
* http://www.dogma.net/markn/articles/zlibtool/zlibtool.htm
|
|
||||||
* contrib/visual-basic.txt in the zlib distribution
|
|
||||||
* win32/DLL_FAQ.txt in the zlib distribution
|
|
||||||
|
|
||||||
4. compress() returns Z_BUF_ERROR.
|
|
||||||
|
|
||||||
Make sure that before the call of compress, the length of the compressed
|
|
||||||
buffer is equal to the total size of the compressed buffer and not
|
|
||||||
zero. For Visual Basic, check that this parameter is passed by reference
|
|
||||||
("as any"), not by value ("as long").
|
|
||||||
|
|
||||||
5. deflate() or inflate() returns Z_BUF_ERROR.
|
|
||||||
|
|
||||||
Before making the call, make sure that avail_in and avail_out are not
|
|
||||||
zero. When setting the parameter flush equal to Z_FINISH, also make sure
|
|
||||||
that avail_out is big enough to allow processing all pending input.
|
|
||||||
Note that a Z_BUF_ERROR is not fatal--another call to deflate() or
|
|
||||||
inflate() can be made with more input or output space. A Z_BUF_ERROR
|
|
||||||
may in fact be unavoidable depending on how the functions are used, since
|
|
||||||
it is not possible to tell whether or not there is more output pending
|
|
||||||
when strm.avail_out returns with zero.
|
|
||||||
|
|
||||||
6. Where's the zlib documentation (man pages, etc.)?
|
|
||||||
|
|
||||||
It's in zlib.h for the moment, and Francis S. Lin has converted it to a
|
|
||||||
web page zlib.html. Volunteers to transform this to Unix-style man pages,
|
|
||||||
please contact us (zlib@gzip.org). Examples of zlib usage are in the files
|
|
||||||
example.c and minigzip.c.
|
|
||||||
|
|
||||||
7. Why don't you use GNU autoconf or libtool or ...?
|
|
||||||
|
|
||||||
Because we would like to keep zlib as a very small and simple
|
|
||||||
package. zlib is rather portable and doesn't need much configuration.
|
|
||||||
|
|
||||||
8. I found a bug in zlib.
|
|
||||||
|
|
||||||
Most of the time, such problems are due to an incorrect usage of
|
|
||||||
zlib. Please try to reproduce the problem with a small program and send
|
|
||||||
the corresponding source to us at zlib@gzip.org . Do not send
|
|
||||||
multi-megabyte data files without prior agreement.
|
|
||||||
|
|
||||||
9. Why do I get "undefined reference to gzputc"?
|
|
||||||
|
|
||||||
If "make test" produces something like
|
|
||||||
|
|
||||||
example.o(.text+0x154): undefined reference to `gzputc'
|
|
||||||
|
|
||||||
check that you don't have old files libz.* in /usr/lib, /usr/local/lib or
|
|
||||||
/usr/X11R6/lib. Remove any old versions, then do "make install".
|
|
||||||
|
|
||||||
10. I need a Delphi interface to zlib.
|
|
||||||
|
|
||||||
See the contrib/delphi directory in the zlib distribution.
|
|
||||||
|
|
||||||
11. Can zlib handle .zip archives?
|
|
||||||
|
|
||||||
Not by itself, no. See the directory contrib/minizip in the zlib
|
|
||||||
distribution.
|
|
||||||
|
|
||||||
12. Can zlib handle .Z files?
|
|
||||||
|
|
||||||
No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt
|
|
||||||
the code of uncompress on your own.
|
|
||||||
|
|
||||||
13. How can I make a Unix shared library?
|
|
||||||
|
|
||||||
make clean
|
|
||||||
./configure -s
|
|
||||||
make
|
|
||||||
|
|
||||||
14. How do I install a shared zlib library on Unix?
|
|
||||||
|
|
||||||
After the above, then:
|
|
||||||
|
|
||||||
make install
|
|
||||||
|
|
||||||
However, many flavors of Unix come with a shared zlib already installed.
|
|
||||||
Before going to the trouble of compiling a shared version of zlib and
|
|
||||||
trying to install it, you may want to check if it's already there! If you
|
|
||||||
can #include <zlib.h>, it's there. The -lz option will probably link to it.
|
|
||||||
|
|
||||||
15. I have a question about OttoPDF.
|
|
||||||
|
|
||||||
We are not the authors of OttoPDF. The real author is on the OttoPDF web
|
|
||||||
site: Joel Hainley, jhainley@myndkryme.com.
|
|
||||||
|
|
||||||
16. Can zlib decode Flate data in an Adobe PDF file?
|
|
||||||
|
|
||||||
Yes. See http://www.fastio.com/ (ClibPDF), or http://www.pdflib.com/ .
|
|
||||||
To modify PDF forms, see http://sourceforge.net/projects/acroformtool/ .
|
|
||||||
|
|
||||||
17. Why am I getting this "register_frame_info not found" error on Solaris?
|
|
||||||
|
|
||||||
After installing zlib 1.1.4 on Solaris 2.6, running applications using zlib
|
|
||||||
generates an error such as:
|
|
||||||
|
|
||||||
ld.so.1: rpm: fatal: relocation error: file /usr/local/lib/libz.so:
|
|
||||||
symbol __register_frame_info: referenced symbol not found
|
|
||||||
|
|
||||||
The symbol __register_frame_info is not part of zlib, it is generated by
|
|
||||||
the C compiler (cc or gcc). You must recompile applications using zlib
|
|
||||||
which have this problem. This problem is specific to Solaris. See
|
|
||||||
http://www.sunfreeware.com for Solaris versions of zlib and applications
|
|
||||||
using zlib.
|
|
||||||
|
|
||||||
18. Why does gzip give an error on a file I make with compress/deflate?
|
|
||||||
|
|
||||||
The compress and deflate functions produce data in the zlib format, which
|
|
||||||
is different and incompatible with the gzip format. The gz* functions in
|
|
||||||
zlib on the other hand use the gzip format. Both the zlib and gzip
|
|
||||||
formats use the same compressed data format internally, but have different
|
|
||||||
headers and trailers around the compressed data.
|
|
||||||
|
|
||||||
19. Ok, so why are there two different formats?
|
|
||||||
|
|
||||||
The gzip format was designed to retain the directory information about
|
|
||||||
a single file, such as the name and last modification date. The zlib
|
|
||||||
format on the other hand was designed for in-memory and communication
|
|
||||||
channel applications, and has a much more compact header and trailer and
|
|
||||||
uses a faster integrity check than gzip.
|
|
||||||
|
|
||||||
20. Well that's nice, but how do I make a gzip file in memory?
|
|
||||||
|
|
||||||
You can request that deflate write the gzip format instead of the zlib
|
|
||||||
format using deflateInit2(). You can also request that inflate decode
|
|
||||||
the gzip format using inflateInit2(). Read zlib.h for more details.
|
|
||||||
|
|
||||||
21. Is zlib thread-safe?
|
|
||||||
|
|
||||||
Yes. However any library routines that zlib uses and any application-
|
|
||||||
provided memory allocation routines must also be thread-safe. zlib's gz*
|
|
||||||
functions use stdio library routines, and most of zlib's functions use the
|
|
||||||
library memory allocation routines by default. zlib's Init functions allow
|
|
||||||
for the application to provide custom memory allocation routines.
|
|
||||||
|
|
||||||
Of course, you should only operate on any given zlib or gzip stream from a
|
|
||||||
single thread at a time.
|
|
||||||
|
|
||||||
22. Can I use zlib in my commercial application?
|
|
||||||
|
|
||||||
Yes. Please read the license in zlib.h.
|
|
||||||
|
|
||||||
23. Is zlib under the GNU license?
|
|
||||||
|
|
||||||
No. Please read the license in zlib.h.
|
|
||||||
|
|
||||||
24. The license says that altered source versions must be "plainly marked". So
|
|
||||||
what exactly do I need to do to meet that requirement?
|
|
||||||
|
|
||||||
You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In
|
|
||||||
particular, the final version number needs to be changed to "f", and an
|
|
||||||
identification string should be appended to ZLIB_VERSION. Version numbers
|
|
||||||
x.x.x.f are reserved for modifications to zlib by others than the zlib
|
|
||||||
maintainers. For example, if the version of the base zlib you are altering
|
|
||||||
is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and
|
|
||||||
ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also
|
|
||||||
update the version strings in deflate.c and inftrees.c.
|
|
||||||
|
|
||||||
For altered source distributions, you should also note the origin and
|
|
||||||
nature of the changes in zlib.h, as well as in ChangeLog and README, along
|
|
||||||
with the dates of the alterations. The origin should include at least your
|
|
||||||
name (or your company's name), and an email address to contact for help or
|
|
||||||
issues with the library.
|
|
||||||
|
|
||||||
Note that distributing a compiled zlib library along with zlib.h and
|
|
||||||
zconf.h is also a source distribution, and so you should change
|
|
||||||
ZLIB_VERSION and ZLIB_VERNUM and note the origin and nature of the changes
|
|
||||||
in zlib.h as you would for a full source distribution.
|
|
||||||
|
|
||||||
25. Will zlib work on a big-endian or little-endian architecture, and can I
|
|
||||||
exchange compressed data between them?
|
|
||||||
|
|
||||||
Yes and yes.
|
|
||||||
|
|
||||||
26. Will zlib work on a 64-bit machine?
|
|
||||||
|
|
||||||
It should. It has been tested on 64-bit machines, and has no dependence
|
|
||||||
on any data types being limited to 32-bits in length. If you have any
|
|
||||||
difficulties, please provide a complete problem report to zlib@gzip.org
|
|
||||||
|
|
||||||
27. Will zlib decompress data from the PKWare Data Compression Library?
|
|
||||||
|
|
||||||
No. The PKWare DCL uses a completely different compressed data format
|
|
||||||
than does PKZIP and zlib. However, you can look in zlib's contrib/blast
|
|
||||||
directory for a possible solution to your problem.
|
|
||||||
|
|
||||||
28. Can I access data randomly in a compressed stream?
|
|
||||||
|
|
||||||
No, not without some preparation. If when compressing you periodically
|
|
||||||
use Z_FULL_FLUSH, carefully write all the pending data at those points,
|
|
||||||
and keep an index of those locations, then you can start decompression
|
|
||||||
at those points. You have to be careful to not use Z_FULL_FLUSH too
|
|
||||||
often, since it can significantly degrade compression.
|
|
||||||
|
|
||||||
29. Does zlib work on MVS, OS/390, CICS, etc.?
|
|
||||||
|
|
||||||
We don't know for sure. We have heard occasional reports of success on
|
|
||||||
these systems. If you do use it on one of these, please provide us with
|
|
||||||
a report, instructions, and patches that we can reference when we get
|
|
||||||
these questions. Thanks.
|
|
||||||
|
|
||||||
30. Is there some simpler, easier to read version of inflate I can look at
|
|
||||||
to understand the deflate format?
|
|
||||||
|
|
||||||
First off, you should read RFC 1951. Second, yes. Look in zlib's
|
|
||||||
contrib/puff directory.
|
|
||||||
|
|
||||||
31. Does zlib infringe on any patents?
|
|
||||||
|
|
||||||
As far as we know, no. In fact, that was originally the whole point behind
|
|
||||||
zlib. Look here for some more information:
|
|
||||||
|
|
||||||
http://www.gzip.org/#faq11
|
|
||||||
|
|
||||||
32. Can zlib work with greater than 4 GB of data?
|
|
||||||
|
|
||||||
Yes. inflate() and deflate() will process any amount of data correctly.
|
|
||||||
Each call of inflate() or deflate() is limited to input and output chunks
|
|
||||||
of the maximum value that can be stored in the compiler's "unsigned int"
|
|
||||||
type, but there is no limit to the number of chunks. Note however that the
|
|
||||||
strm.total_in and strm_total_out counters may be limited to 4 GB. These
|
|
||||||
counters are provided as a convenience and are not used internally by
|
|
||||||
inflate() or deflate(). The application can easily set up its own counters
|
|
||||||
updated after each call of inflate() or deflate() to count beyond 4 GB.
|
|
||||||
compress() and uncompress() may be limited to 4 GB, since they operate in a
|
|
||||||
single call. gzseek() and gztell() may be limited to 4 GB depending on how
|
|
||||||
zlib is compiled. See the zlibCompileFlags() function in zlib.h.
|
|
||||||
|
|
||||||
The word "may" appears several times above since there is a 4 GB limit
|
|
||||||
only if the compiler's "long" type is 32 bits. If the compiler's "long"
|
|
||||||
type is 64 bits, then the limit is 16 exabytes.
|
|
||||||
|
|
||||||
33. Does zlib have any security vulnerabilities?
|
|
||||||
|
|
||||||
The only one that we are aware of is potentially in gzprintf(). If zlib
|
|
||||||
is compiled to use sprintf() or vsprintf(), then there is no protection
|
|
||||||
against a buffer overflow of a 4K string space, other than the caller of
|
|
||||||
gzprintf() assuring that the output will not exceed 4K. On the other
|
|
||||||
hand, if zlib is compiled to use snprintf() or vsnprintf(), which should
|
|
||||||
normally be the case, then there is no vulnerability. The ./configure
|
|
||||||
script will display warnings if an insecure variation of sprintf() will
|
|
||||||
be used by gzprintf(). Also the zlibCompileFlags() function will return
|
|
||||||
information on what variant of sprintf() is used by gzprintf().
|
|
||||||
|
|
||||||
If you don't have snprintf() or vsnprintf() and would like one, you can
|
|
||||||
find a portable implementation here:
|
|
||||||
|
|
||||||
http://www.ijs.si/software/snprintf/
|
|
||||||
|
|
||||||
Note that you should be using the most recent version of zlib. Versions
|
|
||||||
1.1.3 and before were subject to a double-free vulnerability.
|
|
||||||
|
|
||||||
34. Is there a Java version of zlib?
|
|
||||||
|
|
||||||
Probably what you want is to use zlib in Java. zlib is already included
|
|
||||||
as part of the Java SDK in the java.util.zip package. If you really want
|
|
||||||
a version of zlib written in the Java language, look on the zlib home
|
|
||||||
page for links: http://www.zlib.org/
|
|
||||||
|
|
||||||
35. I get this or that compiler or source-code scanner warning when I crank it
|
|
||||||
up to maximally-pedantic. Can't you guys write proper code?
|
|
||||||
|
|
||||||
Many years ago, we gave up attempting to avoid warnings on every compiler
|
|
||||||
in the universe. It just got to be a waste of time, and some compilers
|
|
||||||
were downright silly. So now, we simply make sure that the code always
|
|
||||||
works.
|
|
||||||
|
|
||||||
36. Valgrind (or some similar memory access checker) says that deflate is
|
|
||||||
performing a conditional jump that depends on an uninitialized value.
|
|
||||||
Isn't that a bug?
|
|
||||||
|
|
||||||
No. That is intentional for performance reasons, and the output of
|
|
||||||
deflate is not affected. This only started showing up recently since
|
|
||||||
zlib 1.2.x uses malloc() by default for allocations, whereas earlier
|
|
||||||
versions used calloc(), which zeros out the allocated memory.
|
|
||||||
|
|
||||||
37. Will zlib read the (insert any ancient or arcane format here) compressed
|
|
||||||
data format?
|
|
||||||
|
|
||||||
Probably not. Look in the comp.compression FAQ for pointers to various
|
|
||||||
formats and associated software.
|
|
||||||
|
|
||||||
38. How can I encrypt/decrypt zip files with zlib?
|
|
||||||
|
|
||||||
zlib doesn't support encryption. The original PKZIP encryption is very weak
|
|
||||||
and can be broken with freely available programs. To get strong encryption,
|
|
||||||
use GnuPG, http://www.gnupg.org/ , which already includes zlib compression.
|
|
||||||
For PKZIP compatible "encryption", look at http://www.info-zip.org/
|
|
||||||
|
|
||||||
39. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings?
|
|
||||||
|
|
||||||
"gzip" is the gzip format, and "deflate" is the zlib format. They should
|
|
||||||
probably have called the second one "zlib" instead to avoid confusion
|
|
||||||
with the raw deflate compressed data format. While the HTTP 1.1 RFC 2616
|
|
||||||
correctly points to the zlib specification in RFC 1950 for the "deflate"
|
|
||||||
transfer encoding, there have been reports of servers and browsers that
|
|
||||||
incorrectly produce or expect raw deflate data per the deflate
|
|
||||||
specficiation in RFC 1951, most notably Microsoft. So even though the
|
|
||||||
"deflate" transfer encoding using the zlib format would be the more
|
|
||||||
efficient approach (and in fact exactly what the zlib format was designed
|
|
||||||
for), using the "gzip" transfer encoding is probably more reliable due to
|
|
||||||
an unfortunate choice of name on the part of the HTTP 1.1 authors.
|
|
||||||
|
|
||||||
Bottom line: use the gzip format for HTTP 1.1 encoding.
|
|
||||||
|
|
||||||
40. Does zlib support the new "Deflate64" format introduced by PKWare?
|
|
||||||
|
|
||||||
No. PKWare has apparently decided to keep that format proprietary, since
|
|
||||||
they have not documented it as they have previous compression formats.
|
|
||||||
In any case, the compression improvements are so modest compared to other
|
|
||||||
more modern approaches, that it's not worth the effort to implement.
|
|
||||||
|
|
||||||
41. Can you please sign these lengthy legal documents and fax them back to us
|
|
||||||
so that we can use your software in our product?
|
|
||||||
|
|
||||||
No. Go away. Shoo.
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
CMakeLists.txt cmake build file
|
||||||
|
ChangeLog history of changes
|
||||||
|
FAQ Frequently Asked Questions about zlib
|
||||||
|
INDEX this file
|
||||||
|
Makefile dummy Makefile that tells you to ./configure
|
||||||
|
Makefile.in template for Unix Makefile
|
||||||
|
README guess what
|
||||||
|
configure configure script for Unix
|
||||||
|
make_vms.com makefile for VMS
|
||||||
|
treebuild.xml XML description of source file dependencies
|
||||||
|
zconf.h.cmakein zconf.h template for cmake
|
||||||
|
zconf.h.in zconf.h template for configure
|
||||||
|
zlib.3 Man page for zlib
|
||||||
|
zlib.3.pdf Man page in PDF format
|
||||||
|
zlib.map Linux symbol information
|
||||||
|
zlib.pc.in Template for pkg-config descriptor
|
||||||
|
zlib2ansi perl script to convert source files for C++ compilation
|
||||||
|
|
||||||
|
amiga/ makefiles for Amiga SAS C
|
||||||
|
doc/ documentation for formats and algorithms
|
||||||
|
msdos/ makefiles for MSDOS
|
||||||
|
nintendods/ makefile for Nintendo DS
|
||||||
|
old/ makefiles for various architectures and zlib documentation
|
||||||
|
files that have not yet been updated for zlib 1.2.x
|
||||||
|
qnx/ makefiles for QNX
|
||||||
|
watcom/ makefiles for OpenWatcom
|
||||||
|
win32/ makefiles for Windows
|
||||||
|
|
||||||
|
zlib public header files (required for library use):
|
||||||
|
zconf.h
|
||||||
|
zlib.h
|
||||||
|
|
||||||
|
private source files used to build the zlib library:
|
||||||
|
adler32.c
|
||||||
|
compress.c
|
||||||
|
crc32.c
|
||||||
|
crc32.h
|
||||||
|
deflate.c
|
||||||
|
deflate.h
|
||||||
|
gzclose.c
|
||||||
|
gzguts.h
|
||||||
|
gzlib.c
|
||||||
|
gzread.c
|
||||||
|
gzwrite.c
|
||||||
|
infback.c
|
||||||
|
inffast.c
|
||||||
|
inffast.h
|
||||||
|
inffixed.h
|
||||||
|
inflate.c
|
||||||
|
inflate.h
|
||||||
|
inftrees.c
|
||||||
|
inftrees.h
|
||||||
|
trees.c
|
||||||
|
trees.h
|
||||||
|
uncompr.c
|
||||||
|
zutil.c
|
||||||
|
zutil.h
|
||||||
|
|
||||||
|
source files for sample programs:
|
||||||
|
example.c
|
||||||
|
minigzip.c
|
||||||
|
See examples/README.examples for more
|
||||||
|
|
||||||
|
unsupported contribution by third parties
|
||||||
|
See contrib/README.contrib
|
|
@ -1,56 +1,52 @@
|
||||||
ZLIB DATA COMPRESSION LIBRARY
|
ZLIB DATA COMPRESSION LIBRARY
|
||||||
|
|
||||||
zlib 1.2.3 is a general purpose data compression library. All the code is
|
zlib 1.2.5 is a general purpose data compression library. All the code is
|
||||||
thread safe. The data format used by the zlib library is described by RFCs
|
thread safe. The data format used by the zlib library is described by RFCs
|
||||||
(Request for Comments) 1950 to 1952 in the files
|
(Request for Comments) 1950 to 1952 in the files
|
||||||
http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
|
http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format)
|
||||||
and rfc1952.txt (gzip format). These documents are also available in other
|
and rfc1952.txt (gzip format).
|
||||||
formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
|
|
||||||
|
|
||||||
All functions of the compression library are documented in the file zlib.h
|
All functions of the compression library are documented in the file zlib.h
|
||||||
(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
|
(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
|
||||||
of the library is given in the file example.c which also tests that the library
|
of the library is given in the file example.c which also tests that the library
|
||||||
is working correctly. Another example is given in the file minigzip.c. The
|
is working correctly. Another example is given in the file minigzip.c. The
|
||||||
compression library itself is composed of all source files except example.c and
|
compression library itself is composed of all source files except example.c and
|
||||||
minigzip.c.
|
minigzip.c.
|
||||||
|
|
||||||
To compile all files and run the test program, follow the instructions given at
|
To compile all files and run the test program, follow the instructions given at
|
||||||
the top of Makefile. In short "make test; make install" should work for most
|
the top of Makefile.in. In short "./configure; make test", and if that goes
|
||||||
machines. For Unix: "./configure; make test; make install". For MSDOS, use one
|
well, "make install" should work for most flavors of Unix. For Windows, use one
|
||||||
of the special makefiles such as Makefile.msc. For VMS, use make_vms.com.
|
of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use
|
||||||
|
make_vms.com.
|
||||||
|
|
||||||
Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant
|
Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant
|
||||||
<info@winimage.com> for the Windows DLL version. The zlib home page is
|
<info@winimage.com> for the Windows DLL version. The zlib home page is
|
||||||
http://www.zlib.org or http://www.gzip.org/zlib/ Before reporting a problem,
|
http://zlib.net/ . Before reporting a problem, please check this site to
|
||||||
please check this site to verify that you have the latest version of zlib;
|
verify that you have the latest version of zlib; otherwise get the latest
|
||||||
otherwise get the latest version and check whether the problem still exists or
|
version and check whether the problem still exists or not.
|
||||||
not.
|
|
||||||
|
|
||||||
PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html before asking
|
PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
|
||||||
for help.
|
|
||||||
|
|
||||||
Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
|
Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
|
||||||
issue of Dr. Dobb's Journal; a copy of the article is available in
|
issue of Dr. Dobb's Journal; a copy of the article is available at
|
||||||
http://dogma.net/markn/articles/zlibtool/zlibtool.htm
|
http://marknelson.us/1997/01/01/zlib-engine/ .
|
||||||
|
|
||||||
The changes made in version 1.2.3 are documented in the file ChangeLog.
|
The changes made in version 1.2.5 are documented in the file ChangeLog.
|
||||||
|
|
||||||
Unsupported third party contributions are provided in directory "contrib".
|
Unsupported third party contributions are provided in directory contrib/ .
|
||||||
|
|
||||||
A Java implementation of zlib is available in the Java Development Kit
|
zlib is available in Java using the java.util.zip package, documented at
|
||||||
http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html
|
http://java.sun.com/developer/technicalArticles/Programming/compression/ .
|
||||||
See the zlib home page http://www.zlib.org for details.
|
|
||||||
|
|
||||||
A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is in the
|
A Perl interface to zlib written by Paul Marquess <pmqs@cpan.org> is available
|
||||||
CPAN (Comprehensive Perl Archive Network) sites
|
at CPAN (Comprehensive Perl Archive Network) sites, including
|
||||||
http://www.cpan.org/modules/by-module/Compress/
|
http://search.cpan.org/~pmqs/IO-Compress-Zlib/ .
|
||||||
|
|
||||||
A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
|
A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
|
||||||
available in Python 1.5 and later versions, see
|
available in Python 1.5 and later versions, see
|
||||||
http://www.python.org/doc/lib/module-zlib.html
|
http://www.python.org/doc/lib/module-zlib.html .
|
||||||
|
|
||||||
A zlib binding for TCL written by Andreas Kupries <a.kupries@westend.com> is
|
zlib is built into tcl: http://wiki.tcl.tk/4610 .
|
||||||
availlable at http://www.oche.de/~akupries/soft/trf/trf_zip.html
|
|
||||||
|
|
||||||
An experimental package to read and write files in .zip format, written on top
|
An experimental package to read and write files in .zip format, written on top
|
||||||
of zlib by Gilles Vollant <info@winimage.com>, is available in the
|
of zlib by Gilles Vollant <info@winimage.com>, is available in the
|
||||||
|
@ -74,25 +70,21 @@ Notes for some targets:
|
||||||
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
|
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
|
||||||
other compilers. Use "make test" to check your compiler.
|
other compilers. Use "make test" to check your compiler.
|
||||||
|
|
||||||
- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers.
|
- gzdopen is not supported on RISCOS or BEOS.
|
||||||
|
|
||||||
- For PalmOs, see http://palmzlib.sourceforge.net/
|
- For PalmOs, see http://palmzlib.sourceforge.net/
|
||||||
|
|
||||||
- When building a shared, i.e. dynamic library on Mac OS X, the library must be
|
|
||||||
installed before testing (do "make install" before "make test"), since the
|
|
||||||
library location is specified in the library.
|
|
||||||
|
|
||||||
|
|
||||||
Acknowledgments:
|
Acknowledgments:
|
||||||
|
|
||||||
The deflate format used by zlib was defined by Phil Katz. The deflate
|
The deflate format used by zlib was defined by Phil Katz. The deflate and
|
||||||
and zlib specifications were written by L. Peter Deutsch. Thanks to all the
|
zlib specifications were written by L. Peter Deutsch. Thanks to all the
|
||||||
people who reported problems and suggested various improvements in zlib;
|
people who reported problems and suggested various improvements in zlib; they
|
||||||
they are too numerous to cite here.
|
are too numerous to cite here.
|
||||||
|
|
||||||
Copyright notice:
|
Copyright notice:
|
||||||
|
|
||||||
(C) 1995-2004 Jean-loup Gailly and Mark Adler
|
(C) 1995-2010 Jean-loup Gailly and Mark Adler
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
This software is provided 'as-is', without any express or implied
|
||||||
warranty. In no event will the authors be held liable for any damages
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
@ -113,13 +105,11 @@ Copyright notice:
|
||||||
Jean-loup Gailly Mark Adler
|
Jean-loup Gailly Mark Adler
|
||||||
jloup@gzip.org madler@alumni.caltech.edu
|
jloup@gzip.org madler@alumni.caltech.edu
|
||||||
|
|
||||||
If you use the zlib library in a product, we would appreciate *not*
|
If you use the zlib library in a product, we would appreciate *not* receiving
|
||||||
receiving lengthy legal documents to sign. The sources are provided
|
lengthy legal documents to sign. The sources are provided for free but without
|
||||||
for free but without warranty of any kind. The library has been
|
warranty of any kind. The library has been entirely written by Jean-loup
|
||||||
entirely written by Jean-loup Gailly and Mark Adler; it does not
|
Gailly and Mark Adler; it does not include third-party code.
|
||||||
include third-party code.
|
|
||||||
|
|
||||||
If you redistribute modified sources, we would appreciate that you include
|
If you redistribute modified sources, we would appreciate that you include in
|
||||||
in the file ChangeLog history information documenting your changes. Please
|
the file ChangeLog history information documenting your changes. Please read
|
||||||
read the FAQ for more information on the distribution of modified source
|
the FAQ for more information on the distribution of modified source versions.
|
||||||
versions.
|
|
||||||
|
|
|
@ -1,12 +1,15 @@
|
||||||
/* adler32.c -- compute the Adler-32 checksum of a data stream
|
/* adler32.c -- compute the Adler-32 checksum of a data stream
|
||||||
* Copyright (C) 1995-2004 Mark Adler
|
* Copyright (C) 1995-2007 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* @(#) $Id$ */
|
/* @(#) $Id$ */
|
||||||
|
|
||||||
#define ZLIB_INTERNAL
|
#include "zutil.h"
|
||||||
#include "zlib.h"
|
|
||||||
|
#define local static
|
||||||
|
|
||||||
|
local uLong adler32_combine_(uLong adler1, uLong adler2, z_off64_t len2);
|
||||||
|
|
||||||
#define BASE 65521UL /* largest prime smaller than 65536 */
|
#define BASE 65521UL /* largest prime smaller than 65536 */
|
||||||
#define NMAX 5552
|
#define NMAX 5552
|
||||||
|
@ -125,10 +128,10 @@ uLong ZEXPORT adler32(adler, buf, len)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
uLong ZEXPORT adler32_combine(adler1, adler2, len2)
|
local uLong adler32_combine_(adler1, adler2, len2)
|
||||||
uLong adler1;
|
uLong adler1;
|
||||||
uLong adler2;
|
uLong adler2;
|
||||||
z_off_t len2;
|
z_off64_t len2;
|
||||||
{
|
{
|
||||||
unsigned long sum1;
|
unsigned long sum1;
|
||||||
unsigned long sum2;
|
unsigned long sum2;
|
||||||
|
@ -141,9 +144,26 @@ uLong ZEXPORT adler32_combine(adler1, adler2, len2)
|
||||||
MOD(sum2);
|
MOD(sum2);
|
||||||
sum1 += (adler2 & 0xffff) + BASE - 1;
|
sum1 += (adler2 & 0xffff) + BASE - 1;
|
||||||
sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
|
sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem;
|
||||||
if (sum1 > BASE) sum1 -= BASE;
|
if (sum1 >= BASE) sum1 -= BASE;
|
||||||
if (sum1 > BASE) sum1 -= BASE;
|
if (sum1 >= BASE) sum1 -= BASE;
|
||||||
if (sum2 > (BASE << 1)) sum2 -= (BASE << 1);
|
if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1);
|
||||||
if (sum2 > BASE) sum2 -= BASE;
|
if (sum2 >= BASE) sum2 -= BASE;
|
||||||
return sum1 | (sum2 << 16);
|
return sum1 | (sum2 << 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ========================================================================= */
|
||||||
|
uLong ZEXPORT adler32_combine(adler1, adler2, len2)
|
||||||
|
uLong adler1;
|
||||||
|
uLong adler2;
|
||||||
|
z_off_t len2;
|
||||||
|
{
|
||||||
|
return adler32_combine_(adler1, adler2, len2);
|
||||||
|
}
|
||||||
|
|
||||||
|
uLong ZEXPORT adler32_combine64(adler1, adler2, len2)
|
||||||
|
uLong adler1;
|
||||||
|
uLong adler2;
|
||||||
|
z_off64_t len2;
|
||||||
|
{
|
||||||
|
return adler32_combine_(adler1, adler2, len2);
|
||||||
|
}
|
||||||
|
|
|
@ -1,209 +0,0 @@
|
||||||
1. Compression algorithm (deflate)
|
|
||||||
|
|
||||||
The deflation algorithm used by gzip (also zip and zlib) is a variation of
|
|
||||||
LZ77 (Lempel-Ziv 1977, see reference below). It finds duplicated strings in
|
|
||||||
the input data. The second occurrence of a string is replaced by a
|
|
||||||
pointer to the previous string, in the form of a pair (distance,
|
|
||||||
length). Distances are limited to 32K bytes, and lengths are limited
|
|
||||||
to 258 bytes. When a string does not occur anywhere in the previous
|
|
||||||
32K bytes, it is emitted as a sequence of literal bytes. (In this
|
|
||||||
description, `string' must be taken as an arbitrary sequence of bytes,
|
|
||||||
and is not restricted to printable characters.)
|
|
||||||
|
|
||||||
Literals or match lengths are compressed with one Huffman tree, and
|
|
||||||
match distances are compressed with another tree. The trees are stored
|
|
||||||
in a compact form at the start of each block. The blocks can have any
|
|
||||||
size (except that the compressed data for one block must fit in
|
|
||||||
available memory). A block is terminated when deflate() determines that
|
|
||||||
it would be useful to start another block with fresh trees. (This is
|
|
||||||
somewhat similar to the behavior of LZW-based _compress_.)
|
|
||||||
|
|
||||||
Duplicated strings are found using a hash table. All input strings of
|
|
||||||
length 3 are inserted in the hash table. A hash index is computed for
|
|
||||||
the next 3 bytes. If the hash chain for this index is not empty, all
|
|
||||||
strings in the chain are compared with the current input string, and
|
|
||||||
the longest match is selected.
|
|
||||||
|
|
||||||
The hash chains are searched starting with the most recent strings, to
|
|
||||||
favor small distances and thus take advantage of the Huffman encoding.
|
|
||||||
The hash chains are singly linked. There are no deletions from the
|
|
||||||
hash chains, the algorithm simply discards matches that are too old.
|
|
||||||
|
|
||||||
To avoid a worst-case situation, very long hash chains are arbitrarily
|
|
||||||
truncated at a certain length, determined by a runtime option (level
|
|
||||||
parameter of deflateInit). So deflate() does not always find the longest
|
|
||||||
possible match but generally finds a match which is long enough.
|
|
||||||
|
|
||||||
deflate() also defers the selection of matches with a lazy evaluation
|
|
||||||
mechanism. After a match of length N has been found, deflate() searches for
|
|
||||||
a longer match at the next input byte. If a longer match is found, the
|
|
||||||
previous match is truncated to a length of one (thus producing a single
|
|
||||||
literal byte) and the process of lazy evaluation begins again. Otherwise,
|
|
||||||
the original match is kept, and the next match search is attempted only N
|
|
||||||
steps later.
|
|
||||||
|
|
||||||
The lazy match evaluation is also subject to a runtime parameter. If
|
|
||||||
the current match is long enough, deflate() reduces the search for a longer
|
|
||||||
match, thus speeding up the whole process. If compression ratio is more
|
|
||||||
important than speed, deflate() attempts a complete second search even if
|
|
||||||
the first match is already long enough.
|
|
||||||
|
|
||||||
The lazy match evaluation is not performed for the fastest compression
|
|
||||||
modes (level parameter 1 to 3). For these fast modes, new strings
|
|
||||||
are inserted in the hash table only when no match was found, or
|
|
||||||
when the match is not too long. This degrades the compression ratio
|
|
||||||
but saves time since there are both fewer insertions and fewer searches.
|
|
||||||
|
|
||||||
|
|
||||||
2. Decompression algorithm (inflate)
|
|
||||||
|
|
||||||
2.1 Introduction
|
|
||||||
|
|
||||||
The key question is how to represent a Huffman code (or any prefix code) so
|
|
||||||
that you can decode fast. The most important characteristic is that shorter
|
|
||||||
codes are much more common than longer codes, so pay attention to decoding the
|
|
||||||
short codes fast, and let the long codes take longer to decode.
|
|
||||||
|
|
||||||
inflate() sets up a first level table that covers some number of bits of
|
|
||||||
input less than the length of longest code. It gets that many bits from the
|
|
||||||
stream, and looks it up in the table. The table will tell if the next
|
|
||||||
code is that many bits or less and how many, and if it is, it will tell
|
|
||||||
the value, else it will point to the next level table for which inflate()
|
|
||||||
grabs more bits and tries to decode a longer code.
|
|
||||||
|
|
||||||
How many bits to make the first lookup is a tradeoff between the time it
|
|
||||||
takes to decode and the time it takes to build the table. If building the
|
|
||||||
table took no time (and if you had infinite memory), then there would only
|
|
||||||
be a first level table to cover all the way to the longest code. However,
|
|
||||||
building the table ends up taking a lot longer for more bits since short
|
|
||||||
codes are replicated many times in such a table. What inflate() does is
|
|
||||||
simply to make the number of bits in the first table a variable, and then
|
|
||||||
to set that variable for the maximum speed.
|
|
||||||
|
|
||||||
For inflate, which has 286 possible codes for the literal/length tree, the size
|
|
||||||
of the first table is nine bits. Also the distance trees have 30 possible
|
|
||||||
values, and the size of the first table is six bits. Note that for each of
|
|
||||||
those cases, the table ended up one bit longer than the ``average'' code
|
|
||||||
length, i.e. the code length of an approximately flat code which would be a
|
|
||||||
little more than eight bits for 286 symbols and a little less than five bits
|
|
||||||
for 30 symbols.
|
|
||||||
|
|
||||||
|
|
||||||
2.2 More details on the inflate table lookup
|
|
||||||
|
|
||||||
Ok, you want to know what this cleverly obfuscated inflate tree actually
|
|
||||||
looks like. You are correct that it's not a Huffman tree. It is simply a
|
|
||||||
lookup table for the first, let's say, nine bits of a Huffman symbol. The
|
|
||||||
symbol could be as short as one bit or as long as 15 bits. If a particular
|
|
||||||
symbol is shorter than nine bits, then that symbol's translation is duplicated
|
|
||||||
in all those entries that start with that symbol's bits. For example, if the
|
|
||||||
symbol is four bits, then it's duplicated 32 times in a nine-bit table. If a
|
|
||||||
symbol is nine bits long, it appears in the table once.
|
|
||||||
|
|
||||||
If the symbol is longer than nine bits, then that entry in the table points
|
|
||||||
to another similar table for the remaining bits. Again, there are duplicated
|
|
||||||
entries as needed. The idea is that most of the time the symbol will be short
|
|
||||||
and there will only be one table look up. (That's whole idea behind data
|
|
||||||
compression in the first place.) For the less frequent long symbols, there
|
|
||||||
will be two lookups. If you had a compression method with really long
|
|
||||||
symbols, you could have as many levels of lookups as is efficient. For
|
|
||||||
inflate, two is enough.
|
|
||||||
|
|
||||||
So a table entry either points to another table (in which case nine bits in
|
|
||||||
the above example are gobbled), or it contains the translation for the symbol
|
|
||||||
and the number of bits to gobble. Then you start again with the next
|
|
||||||
ungobbled bit.
|
|
||||||
|
|
||||||
You may wonder: why not just have one lookup table for how ever many bits the
|
|
||||||
longest symbol is? The reason is that if you do that, you end up spending
|
|
||||||
more time filling in duplicate symbol entries than you do actually decoding.
|
|
||||||
At least for deflate's output that generates new trees every several 10's of
|
|
||||||
kbytes. You can imagine that filling in a 2^15 entry table for a 15-bit code
|
|
||||||
would take too long if you're only decoding several thousand symbols. At the
|
|
||||||
other extreme, you could make a new table for every bit in the code. In fact,
|
|
||||||
that's essentially a Huffman tree. But then you spend two much time
|
|
||||||
traversing the tree while decoding, even for short symbols.
|
|
||||||
|
|
||||||
So the number of bits for the first lookup table is a trade of the time to
|
|
||||||
fill out the table vs. the time spent looking at the second level and above of
|
|
||||||
the table.
|
|
||||||
|
|
||||||
Here is an example, scaled down:
|
|
||||||
|
|
||||||
The code being decoded, with 10 symbols, from 1 to 6 bits long:
|
|
||||||
|
|
||||||
A: 0
|
|
||||||
B: 10
|
|
||||||
C: 1100
|
|
||||||
D: 11010
|
|
||||||
E: 11011
|
|
||||||
F: 11100
|
|
||||||
G: 11101
|
|
||||||
H: 11110
|
|
||||||
I: 111110
|
|
||||||
J: 111111
|
|
||||||
|
|
||||||
Let's make the first table three bits long (eight entries):
|
|
||||||
|
|
||||||
000: A,1
|
|
||||||
001: A,1
|
|
||||||
010: A,1
|
|
||||||
011: A,1
|
|
||||||
100: B,2
|
|
||||||
101: B,2
|
|
||||||
110: -> table X (gobble 3 bits)
|
|
||||||
111: -> table Y (gobble 3 bits)
|
|
||||||
|
|
||||||
Each entry is what the bits decode as and how many bits that is, i.e. how
|
|
||||||
many bits to gobble. Or the entry points to another table, with the number of
|
|
||||||
bits to gobble implicit in the size of the table.
|
|
||||||
|
|
||||||
Table X is two bits long since the longest code starting with 110 is five bits
|
|
||||||
long:
|
|
||||||
|
|
||||||
00: C,1
|
|
||||||
01: C,1
|
|
||||||
10: D,2
|
|
||||||
11: E,2
|
|
||||||
|
|
||||||
Table Y is three bits long since the longest code starting with 111 is six
|
|
||||||
bits long:
|
|
||||||
|
|
||||||
000: F,2
|
|
||||||
001: F,2
|
|
||||||
010: G,2
|
|
||||||
011: G,2
|
|
||||||
100: H,2
|
|
||||||
101: H,2
|
|
||||||
110: I,3
|
|
||||||
111: J,3
|
|
||||||
|
|
||||||
So what we have here are three tables with a total of 20 entries that had to
|
|
||||||
be constructed. That's compared to 64 entries for a single table. Or
|
|
||||||
compared to 16 entries for a Huffman tree (six two entry tables and one four
|
|
||||||
entry table). Assuming that the code ideally represents the probability of
|
|
||||||
the symbols, it takes on the average 1.25 lookups per symbol. That's compared
|
|
||||||
to one lookup for the single table, or 1.66 lookups per symbol for the
|
|
||||||
Huffman tree.
|
|
||||||
|
|
||||||
There, I think that gives you a picture of what's going on. For inflate, the
|
|
||||||
meaning of a particular symbol is often more than just a letter. It can be a
|
|
||||||
byte (a "literal"), or it can be either a length or a distance which
|
|
||||||
indicates a base value and a number of bits to fetch after the code that is
|
|
||||||
added to the base value. Or it might be the special end-of-block code. The
|
|
||||||
data structures created in inftrees.c try to encode all that information
|
|
||||||
compactly in the tables.
|
|
||||||
|
|
||||||
|
|
||||||
Jean-loup Gailly Mark Adler
|
|
||||||
jloup@gzip.org madler@alumni.caltech.edu
|
|
||||||
|
|
||||||
|
|
||||||
References:
|
|
||||||
|
|
||||||
[LZ77] Ziv J., Lempel A., ``A Universal Algorithm for Sequential Data
|
|
||||||
Compression,'' IEEE Transactions on Information Theory, Vol. 23, No. 3,
|
|
||||||
pp. 337-343.
|
|
||||||
|
|
||||||
``DEFLATE Compressed Data Format Specification'' available in
|
|
||||||
http://www.ietf.org/rfc/rfc1951.txt
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* compress.c -- compress a memory buffer
|
/* compress.c -- compress a memory buffer
|
||||||
* Copyright (C) 1995-2003 Jean-loup Gailly.
|
* Copyright (C) 1995-2005 Jean-loup Gailly.
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -75,5 +75,6 @@ int ZEXPORT compress (dest, destLen, source, sourceLen)
|
||||||
uLong ZEXPORT compressBound (sourceLen)
|
uLong ZEXPORT compressBound (sourceLen)
|
||||||
uLong sourceLen;
|
uLong sourceLen;
|
||||||
{
|
{
|
||||||
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + 11;
|
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
|
||||||
|
(sourceLen >> 25) + 13;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,132 @@
|
||||||
|
/* crypt.h -- base code for crypt/uncrypt ZIPfile
|
||||||
|
|
||||||
|
|
||||||
|
Version 1.01e, February 12th, 2005
|
||||||
|
|
||||||
|
Copyright (C) 1998-2005 Gilles Vollant
|
||||||
|
|
||||||
|
This code is a modified version of crypting code in Infozip distribution
|
||||||
|
|
||||||
|
The encryption/decryption parts of this source code (as opposed to the
|
||||||
|
non-echoing password parts) were originally written in Europe. The
|
||||||
|
whole source package can be freely distributed, including from the USA.
|
||||||
|
(Prior to January 2000, re-export from the US was a violation of US law.)
|
||||||
|
|
||||||
|
This encryption code is a direct transcription of the algorithm from
|
||||||
|
Roger Schlafly, described by Phil Katz in the file appnote.txt. This
|
||||||
|
file (appnote.txt) is distributed with the PKZIP program (even in the
|
||||||
|
version without encryption capabilities).
|
||||||
|
|
||||||
|
If you don't need crypting in your application, just define symbols
|
||||||
|
NOCRYPT and NOUNCRYPT.
|
||||||
|
|
||||||
|
This code support the "Traditional PKWARE Encryption".
|
||||||
|
|
||||||
|
The new AES encryption added on Zip format by Winzip (see the page
|
||||||
|
http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong
|
||||||
|
Encryption is not supported.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define CRC32(c, b) ((*(pcrc_32_tab+(((int)(c) ^ (b)) & 0xff))) ^ ((c) >> 8))
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* Return the next byte in the pseudo-random sequence
|
||||||
|
*/
|
||||||
|
static int decrypt_byte(unsigned long* pkeys, const unsigned long* pcrc_32_tab)
|
||||||
|
{
|
||||||
|
unsigned temp; /* POTENTIAL BUG: temp*(temp^1) may overflow in an
|
||||||
|
* unpredictable manner on 16-bit systems; not a problem
|
||||||
|
* with any known compiler so far, though */
|
||||||
|
|
||||||
|
temp = ((unsigned)(*(pkeys+2)) & 0xffff) | 2;
|
||||||
|
return (int)(((temp * (temp ^ 1)) >> 8) & 0xff);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* Update the encryption keys with the next byte of plain text
|
||||||
|
*/
|
||||||
|
static int update_keys(unsigned long* pkeys,const unsigned long* pcrc_32_tab,int c)
|
||||||
|
{
|
||||||
|
(*(pkeys+0)) = CRC32((*(pkeys+0)), c);
|
||||||
|
(*(pkeys+1)) += (*(pkeys+0)) & 0xff;
|
||||||
|
(*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
|
||||||
|
{
|
||||||
|
register int keyshift = (int)((*(pkeys+1)) >> 24);
|
||||||
|
(*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
|
||||||
|
}
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* Initialize the encryption keys and the random header according to
|
||||||
|
* the given password.
|
||||||
|
*/
|
||||||
|
static void init_keys(const char* passwd,unsigned long* pkeys,const unsigned long* pcrc_32_tab)
|
||||||
|
{
|
||||||
|
*(pkeys+0) = 305419896L;
|
||||||
|
*(pkeys+1) = 591751049L;
|
||||||
|
*(pkeys+2) = 878082192L;
|
||||||
|
while (*passwd != '\0') {
|
||||||
|
update_keys(pkeys,pcrc_32_tab,(int)*passwd);
|
||||||
|
passwd++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#define zdecode(pkeys,pcrc_32_tab,c) \
|
||||||
|
(update_keys(pkeys,pcrc_32_tab,c ^= decrypt_byte(pkeys,pcrc_32_tab)))
|
||||||
|
|
||||||
|
#define zencode(pkeys,pcrc_32_tab,c,t) \
|
||||||
|
(t=decrypt_byte(pkeys,pcrc_32_tab), update_keys(pkeys,pcrc_32_tab,c), t^(c))
|
||||||
|
|
||||||
|
#ifdef INCLUDECRYPTINGCODE_IFCRYPTALLOWED
|
||||||
|
|
||||||
|
#define RAND_HEAD_LEN 12
|
||||||
|
/* "last resort" source for second part of crypt seed pattern */
|
||||||
|
# ifndef ZCR_SEED2
|
||||||
|
# define ZCR_SEED2 3141592654UL /* use PI as default pattern */
|
||||||
|
# endif
|
||||||
|
|
||||||
|
static int crypthead(passwd, buf, bufSize, pkeys, pcrc_32_tab, crcForCrypting)
|
||||||
|
const char *passwd; /* password string */
|
||||||
|
unsigned char *buf; /* where to write header */
|
||||||
|
int bufSize;
|
||||||
|
unsigned long* pkeys;
|
||||||
|
const unsigned long* pcrc_32_tab;
|
||||||
|
unsigned long crcForCrypting;
|
||||||
|
{
|
||||||
|
int n; /* index in random header */
|
||||||
|
int t; /* temporary */
|
||||||
|
int c; /* random byte */
|
||||||
|
unsigned char header[RAND_HEAD_LEN-2]; /* random header */
|
||||||
|
static unsigned calls = 0; /* ensure different random header each time */
|
||||||
|
|
||||||
|
if (bufSize<RAND_HEAD_LEN)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* First generate RAND_HEAD_LEN-2 random bytes. We encrypt the
|
||||||
|
* output of rand() to get less predictability, since rand() is
|
||||||
|
* often poorly implemented.
|
||||||
|
*/
|
||||||
|
if (++calls == 1)
|
||||||
|
{
|
||||||
|
srand((unsigned)(time(NULL) ^ ZCR_SEED2));
|
||||||
|
}
|
||||||
|
init_keys(passwd, pkeys, pcrc_32_tab);
|
||||||
|
for (n = 0; n < RAND_HEAD_LEN-2; n++)
|
||||||
|
{
|
||||||
|
c = (rand() >> 7) & 0xff;
|
||||||
|
header[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, c, t);
|
||||||
|
}
|
||||||
|
/* Encrypt random header (last two bytes is high word of crc) */
|
||||||
|
init_keys(passwd, pkeys, pcrc_32_tab);
|
||||||
|
for (n = 0; n < RAND_HEAD_LEN-2; n++)
|
||||||
|
{
|
||||||
|
buf[n] = (unsigned char)zencode(pkeys, pcrc_32_tab, header[n], t);
|
||||||
|
}
|
||||||
|
buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 16) & 0xff, t);
|
||||||
|
buf[n++] = zencode(pkeys, pcrc_32_tab, (int)(crcForCrypting >> 24) & 0xff, t);
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,180 @@
|
||||||
|
/* ioapi.c -- IO base function header for compress/uncompress .zip
|
||||||
|
files using zlib + zip or unzip API
|
||||||
|
|
||||||
|
Version 1.01e, February 12th, 2005
|
||||||
|
|
||||||
|
Copyright (C) 1998-2005 Gilles Vollant
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#if defined(USE_SYSTEM_ZLIB)
|
||||||
|
#include <zlib.h>
|
||||||
|
#else
|
||||||
|
#include "../../zlib.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "ioapi.h"
|
||||||
|
|
||||||
|
/* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */
|
||||||
|
|
||||||
|
#ifndef SEEK_CUR
|
||||||
|
#define SEEK_CUR 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SEEK_END
|
||||||
|
#define SEEK_END 2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef SEEK_SET
|
||||||
|
#define SEEK_SET 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
voidpf ZCALLBACK fopen_file_func OF((
|
||||||
|
voidpf opaque,
|
||||||
|
const char* filename,
|
||||||
|
int mode));
|
||||||
|
|
||||||
|
uLong ZCALLBACK fread_file_func OF((
|
||||||
|
voidpf opaque,
|
||||||
|
voidpf stream,
|
||||||
|
void* buf,
|
||||||
|
uLong size));
|
||||||
|
|
||||||
|
uLong ZCALLBACK fwrite_file_func OF((
|
||||||
|
voidpf opaque,
|
||||||
|
voidpf stream,
|
||||||
|
const void* buf,
|
||||||
|
uLong size));
|
||||||
|
|
||||||
|
long ZCALLBACK ftell_file_func OF((
|
||||||
|
voidpf opaque,
|
||||||
|
voidpf stream));
|
||||||
|
|
||||||
|
long ZCALLBACK fseek_file_func OF((
|
||||||
|
voidpf opaque,
|
||||||
|
voidpf stream,
|
||||||
|
uLong offset,
|
||||||
|
int origin));
|
||||||
|
|
||||||
|
int ZCALLBACK fclose_file_func OF((
|
||||||
|
voidpf opaque,
|
||||||
|
voidpf stream));
|
||||||
|
|
||||||
|
int ZCALLBACK ferror_file_func OF((
|
||||||
|
voidpf opaque,
|
||||||
|
voidpf stream));
|
||||||
|
|
||||||
|
|
||||||
|
voidpf ZCALLBACK fopen_file_func (opaque, filename, mode)
|
||||||
|
voidpf opaque;
|
||||||
|
const char* filename;
|
||||||
|
int mode;
|
||||||
|
{
|
||||||
|
FILE* file = NULL;
|
||||||
|
const char* mode_fopen = NULL;
|
||||||
|
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
|
||||||
|
mode_fopen = "rb";
|
||||||
|
else
|
||||||
|
if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
|
||||||
|
mode_fopen = "r+b";
|
||||||
|
else
|
||||||
|
if (mode & ZLIB_FILEFUNC_MODE_CREATE)
|
||||||
|
mode_fopen = "wb";
|
||||||
|
|
||||||
|
if ((filename!=NULL) && (mode_fopen != NULL))
|
||||||
|
file = fopen(filename, mode_fopen);
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uLong ZCALLBACK fread_file_func (opaque, stream, buf, size)
|
||||||
|
voidpf opaque;
|
||||||
|
voidpf stream;
|
||||||
|
void* buf;
|
||||||
|
uLong size;
|
||||||
|
{
|
||||||
|
uLong ret;
|
||||||
|
ret = (uLong)fread(buf, 1, (size_t)size, (FILE *)stream);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uLong ZCALLBACK fwrite_file_func (opaque, stream, buf, size)
|
||||||
|
voidpf opaque;
|
||||||
|
voidpf stream;
|
||||||
|
const void* buf;
|
||||||
|
uLong size;
|
||||||
|
{
|
||||||
|
uLong ret;
|
||||||
|
ret = (uLong)fwrite(buf, 1, (size_t)size, (FILE *)stream);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
long ZCALLBACK ftell_file_func (opaque, stream)
|
||||||
|
voidpf opaque;
|
||||||
|
voidpf stream;
|
||||||
|
{
|
||||||
|
long ret;
|
||||||
|
ret = ftell((FILE *)stream);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
long ZCALLBACK fseek_file_func (opaque, stream, offset, origin)
|
||||||
|
voidpf opaque;
|
||||||
|
voidpf stream;
|
||||||
|
uLong offset;
|
||||||
|
int origin;
|
||||||
|
{
|
||||||
|
int fseek_origin=0;
|
||||||
|
long ret;
|
||||||
|
switch (origin)
|
||||||
|
{
|
||||||
|
case ZLIB_FILEFUNC_SEEK_CUR :
|
||||||
|
fseek_origin = SEEK_CUR;
|
||||||
|
break;
|
||||||
|
case ZLIB_FILEFUNC_SEEK_END :
|
||||||
|
fseek_origin = SEEK_END;
|
||||||
|
break;
|
||||||
|
case ZLIB_FILEFUNC_SEEK_SET :
|
||||||
|
fseek_origin = SEEK_SET;
|
||||||
|
break;
|
||||||
|
default: return -1;
|
||||||
|
}
|
||||||
|
ret = 0;
|
||||||
|
fseek((FILE *)stream, offset, fseek_origin);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZCALLBACK fclose_file_func (opaque, stream)
|
||||||
|
voidpf opaque;
|
||||||
|
voidpf stream;
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
ret = fclose((FILE *)stream);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZCALLBACK ferror_file_func (opaque, stream)
|
||||||
|
voidpf opaque;
|
||||||
|
voidpf stream;
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
ret = ferror((FILE *)stream);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void fill_fopen_filefunc (pzlib_filefunc_def)
|
||||||
|
zlib_filefunc_def* pzlib_filefunc_def;
|
||||||
|
{
|
||||||
|
pzlib_filefunc_def->zopen_file = fopen_file_func;
|
||||||
|
pzlib_filefunc_def->zread_file = fread_file_func;
|
||||||
|
pzlib_filefunc_def->zwrite_file = fwrite_file_func;
|
||||||
|
pzlib_filefunc_def->ztell_file = ftell_file_func;
|
||||||
|
pzlib_filefunc_def->zseek_file = fseek_file_func;
|
||||||
|
pzlib_filefunc_def->zclose_file = fclose_file_func;
|
||||||
|
pzlib_filefunc_def->zerror_file = ferror_file_func;
|
||||||
|
pzlib_filefunc_def->opaque = NULL;
|
||||||
|
}
|
|
@ -0,0 +1,75 @@
|
||||||
|
/* ioapi.h -- IO base function header for compress/uncompress .zip
|
||||||
|
files using zlib + zip or unzip API
|
||||||
|
|
||||||
|
Version 1.01e, February 12th, 2005
|
||||||
|
|
||||||
|
Copyright (C) 1998-2005 Gilles Vollant
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _ZLIBIOAPI_H
|
||||||
|
#define _ZLIBIOAPI_H
|
||||||
|
|
||||||
|
|
||||||
|
#define ZLIB_FILEFUNC_SEEK_CUR (1)
|
||||||
|
#define ZLIB_FILEFUNC_SEEK_END (2)
|
||||||
|
#define ZLIB_FILEFUNC_SEEK_SET (0)
|
||||||
|
|
||||||
|
#define ZLIB_FILEFUNC_MODE_READ (1)
|
||||||
|
#define ZLIB_FILEFUNC_MODE_WRITE (2)
|
||||||
|
#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
|
||||||
|
|
||||||
|
#define ZLIB_FILEFUNC_MODE_EXISTING (4)
|
||||||
|
#define ZLIB_FILEFUNC_MODE_CREATE (8)
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef ZCALLBACK
|
||||||
|
|
||||||
|
#if (defined(WIN32) || defined (WINDOWS) || defined (_WINDOWS)) && defined(CALLBACK) && defined (USEWINDOWS_CALLBACK)
|
||||||
|
#define ZCALLBACK CALLBACK
|
||||||
|
#else
|
||||||
|
#define ZCALLBACK
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef voidpf (ZCALLBACK *open_file_func) OF((voidpf opaque, const char* filename, int mode));
|
||||||
|
typedef uLong (ZCALLBACK *read_file_func) OF((voidpf opaque, voidpf stream, void* buf, uLong size));
|
||||||
|
typedef uLong (ZCALLBACK *write_file_func) OF((voidpf opaque, voidpf stream, const void* buf, uLong size));
|
||||||
|
typedef long (ZCALLBACK *tell_file_func) OF((voidpf opaque, voidpf stream));
|
||||||
|
typedef long (ZCALLBACK *seek_file_func) OF((voidpf opaque, voidpf stream, uLong offset, int origin));
|
||||||
|
typedef int (ZCALLBACK *close_file_func) OF((voidpf opaque, voidpf stream));
|
||||||
|
typedef int (ZCALLBACK *testerror_file_func) OF((voidpf opaque, voidpf stream));
|
||||||
|
|
||||||
|
typedef struct zlib_filefunc_def_s
|
||||||
|
{
|
||||||
|
open_file_func zopen_file;
|
||||||
|
read_file_func zread_file;
|
||||||
|
write_file_func zwrite_file;
|
||||||
|
tell_file_func ztell_file;
|
||||||
|
seek_file_func zseek_file;
|
||||||
|
close_file_func zclose_file;
|
||||||
|
testerror_file_func zerror_file;
|
||||||
|
voidpf opaque;
|
||||||
|
} zlib_filefunc_def;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void fill_fopen_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
|
||||||
|
|
||||||
|
#define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size))
|
||||||
|
#define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size))
|
||||||
|
#define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream))
|
||||||
|
#define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode))
|
||||||
|
#define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream))
|
||||||
|
#define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream))
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,270 @@
|
||||||
|
/* iowin32.c -- IO base function header for compress/uncompress .zip
|
||||||
|
files using zlib + zip or unzip API
|
||||||
|
This IO API version uses the Win32 API (for Microsoft Windows)
|
||||||
|
|
||||||
|
Version 1.01e, February 12th, 2005
|
||||||
|
|
||||||
|
Copyright (C) 1998-2005 Gilles Vollant
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "../../zlib.h"
|
||||||
|
#include "ioapi.h"
|
||||||
|
#include "iowin32.h"
|
||||||
|
|
||||||
|
#ifndef INVALID_HANDLE_VALUE
|
||||||
|
#define INVALID_HANDLE_VALUE (0xFFFFFFFF)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef INVALID_SET_FILE_POINTER
|
||||||
|
#define INVALID_SET_FILE_POINTER ((DWORD)-1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
voidpf ZCALLBACK win32_open_file_func OF((
|
||||||
|
voidpf opaque,
|
||||||
|
const char* filename,
|
||||||
|
int mode));
|
||||||
|
|
||||||
|
uLong ZCALLBACK win32_read_file_func OF((
|
||||||
|
voidpf opaque,
|
||||||
|
voidpf stream,
|
||||||
|
void* buf,
|
||||||
|
uLong size));
|
||||||
|
|
||||||
|
uLong ZCALLBACK win32_write_file_func OF((
|
||||||
|
voidpf opaque,
|
||||||
|
voidpf stream,
|
||||||
|
const void* buf,
|
||||||
|
uLong size));
|
||||||
|
|
||||||
|
long ZCALLBACK win32_tell_file_func OF((
|
||||||
|
voidpf opaque,
|
||||||
|
voidpf stream));
|
||||||
|
|
||||||
|
long ZCALLBACK win32_seek_file_func OF((
|
||||||
|
voidpf opaque,
|
||||||
|
voidpf stream,
|
||||||
|
uLong offset,
|
||||||
|
int origin));
|
||||||
|
|
||||||
|
int ZCALLBACK win32_close_file_func OF((
|
||||||
|
voidpf opaque,
|
||||||
|
voidpf stream));
|
||||||
|
|
||||||
|
int ZCALLBACK win32_error_file_func OF((
|
||||||
|
voidpf opaque,
|
||||||
|
voidpf stream));
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
HANDLE hf;
|
||||||
|
int error;
|
||||||
|
} WIN32FILE_IOWIN;
|
||||||
|
|
||||||
|
voidpf ZCALLBACK win32_open_file_func (opaque, filename, mode)
|
||||||
|
voidpf opaque;
|
||||||
|
const char* filename;
|
||||||
|
int mode;
|
||||||
|
{
|
||||||
|
const char* mode_fopen = NULL;
|
||||||
|
DWORD dwDesiredAccess,dwCreationDisposition,dwShareMode,dwFlagsAndAttributes ;
|
||||||
|
HANDLE hFile = 0;
|
||||||
|
voidpf ret=NULL;
|
||||||
|
|
||||||
|
dwDesiredAccess = dwShareMode = dwFlagsAndAttributes = 0;
|
||||||
|
|
||||||
|
if ((mode & ZLIB_FILEFUNC_MODE_READWRITEFILTER)==ZLIB_FILEFUNC_MODE_READ)
|
||||||
|
{
|
||||||
|
dwDesiredAccess = GENERIC_READ;
|
||||||
|
dwCreationDisposition = OPEN_EXISTING;
|
||||||
|
dwShareMode = FILE_SHARE_READ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (mode & ZLIB_FILEFUNC_MODE_EXISTING)
|
||||||
|
{
|
||||||
|
dwDesiredAccess = GENERIC_WRITE | GENERIC_READ;
|
||||||
|
dwCreationDisposition = OPEN_EXISTING;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (mode & ZLIB_FILEFUNC_MODE_CREATE)
|
||||||
|
{
|
||||||
|
dwDesiredAccess = GENERIC_WRITE | GENERIC_READ;
|
||||||
|
dwCreationDisposition = CREATE_ALWAYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((filename!=NULL) && (dwDesiredAccess != 0))
|
||||||
|
hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL,
|
||||||
|
dwCreationDisposition, dwFlagsAndAttributes, NULL);
|
||||||
|
|
||||||
|
if (hFile == INVALID_HANDLE_VALUE)
|
||||||
|
hFile = NULL;
|
||||||
|
|
||||||
|
if (hFile != NULL)
|
||||||
|
{
|
||||||
|
WIN32FILE_IOWIN w32fiow;
|
||||||
|
w32fiow.hf = hFile;
|
||||||
|
w32fiow.error = 0;
|
||||||
|
ret = malloc(sizeof(WIN32FILE_IOWIN));
|
||||||
|
if (ret==NULL)
|
||||||
|
CloseHandle(hFile);
|
||||||
|
else *((WIN32FILE_IOWIN*)ret) = w32fiow;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uLong ZCALLBACK win32_read_file_func (opaque, stream, buf, size)
|
||||||
|
voidpf opaque;
|
||||||
|
voidpf stream;
|
||||||
|
void* buf;
|
||||||
|
uLong size;
|
||||||
|
{
|
||||||
|
uLong ret=0;
|
||||||
|
HANDLE hFile = NULL;
|
||||||
|
if (stream!=NULL)
|
||||||
|
hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
|
||||||
|
if (hFile != NULL)
|
||||||
|
if (!ReadFile(hFile, buf, size, &ret, NULL))
|
||||||
|
{
|
||||||
|
DWORD dwErr = GetLastError();
|
||||||
|
if (dwErr == ERROR_HANDLE_EOF)
|
||||||
|
dwErr = 0;
|
||||||
|
((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uLong ZCALLBACK win32_write_file_func (opaque, stream, buf, size)
|
||||||
|
voidpf opaque;
|
||||||
|
voidpf stream;
|
||||||
|
const void* buf;
|
||||||
|
uLong size;
|
||||||
|
{
|
||||||
|
uLong ret=0;
|
||||||
|
HANDLE hFile = NULL;
|
||||||
|
if (stream!=NULL)
|
||||||
|
hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
|
||||||
|
|
||||||
|
if (hFile !=NULL)
|
||||||
|
if (!WriteFile(hFile, buf, size, &ret, NULL))
|
||||||
|
{
|
||||||
|
DWORD dwErr = GetLastError();
|
||||||
|
if (dwErr == ERROR_HANDLE_EOF)
|
||||||
|
dwErr = 0;
|
||||||
|
((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
long ZCALLBACK win32_tell_file_func (opaque, stream)
|
||||||
|
voidpf opaque;
|
||||||
|
voidpf stream;
|
||||||
|
{
|
||||||
|
long ret=-1;
|
||||||
|
HANDLE hFile = NULL;
|
||||||
|
if (stream!=NULL)
|
||||||
|
hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
|
||||||
|
if (hFile != NULL)
|
||||||
|
{
|
||||||
|
DWORD dwSet = SetFilePointer(hFile, 0, NULL, FILE_CURRENT);
|
||||||
|
if (dwSet == INVALID_SET_FILE_POINTER)
|
||||||
|
{
|
||||||
|
DWORD dwErr = GetLastError();
|
||||||
|
((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ret=(long)dwSet;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
long ZCALLBACK win32_seek_file_func (opaque, stream, offset, origin)
|
||||||
|
voidpf opaque;
|
||||||
|
voidpf stream;
|
||||||
|
uLong offset;
|
||||||
|
int origin;
|
||||||
|
{
|
||||||
|
DWORD dwMoveMethod=0xFFFFFFFF;
|
||||||
|
HANDLE hFile = NULL;
|
||||||
|
|
||||||
|
long ret=-1;
|
||||||
|
if (stream!=NULL)
|
||||||
|
hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
|
||||||
|
switch (origin)
|
||||||
|
{
|
||||||
|
case ZLIB_FILEFUNC_SEEK_CUR :
|
||||||
|
dwMoveMethod = FILE_CURRENT;
|
||||||
|
break;
|
||||||
|
case ZLIB_FILEFUNC_SEEK_END :
|
||||||
|
dwMoveMethod = FILE_END;
|
||||||
|
break;
|
||||||
|
case ZLIB_FILEFUNC_SEEK_SET :
|
||||||
|
dwMoveMethod = FILE_BEGIN;
|
||||||
|
break;
|
||||||
|
default: return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hFile != NULL)
|
||||||
|
{
|
||||||
|
DWORD dwSet = SetFilePointer(hFile, offset, NULL, dwMoveMethod);
|
||||||
|
if (dwSet == INVALID_SET_FILE_POINTER)
|
||||||
|
{
|
||||||
|
DWORD dwErr = GetLastError();
|
||||||
|
((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
|
||||||
|
ret = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
ret=0;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZCALLBACK win32_close_file_func (opaque, stream)
|
||||||
|
voidpf opaque;
|
||||||
|
voidpf stream;
|
||||||
|
{
|
||||||
|
int ret=-1;
|
||||||
|
|
||||||
|
if (stream!=NULL)
|
||||||
|
{
|
||||||
|
HANDLE hFile;
|
||||||
|
hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
|
||||||
|
if (hFile != NULL)
|
||||||
|
{
|
||||||
|
CloseHandle(hFile);
|
||||||
|
ret=0;
|
||||||
|
}
|
||||||
|
free(stream);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ZCALLBACK win32_error_file_func (opaque, stream)
|
||||||
|
voidpf opaque;
|
||||||
|
voidpf stream;
|
||||||
|
{
|
||||||
|
int ret=-1;
|
||||||
|
if (stream!=NULL)
|
||||||
|
{
|
||||||
|
ret = ((WIN32FILE_IOWIN*)stream) -> error;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void fill_win32_filefunc (pzlib_filefunc_def)
|
||||||
|
zlib_filefunc_def* pzlib_filefunc_def;
|
||||||
|
{
|
||||||
|
pzlib_filefunc_def->zopen_file = win32_open_file_func;
|
||||||
|
pzlib_filefunc_def->zread_file = win32_read_file_func;
|
||||||
|
pzlib_filefunc_def->zwrite_file = win32_write_file_func;
|
||||||
|
pzlib_filefunc_def->ztell_file = win32_tell_file_func;
|
||||||
|
pzlib_filefunc_def->zseek_file = win32_seek_file_func;
|
||||||
|
pzlib_filefunc_def->zclose_file = win32_close_file_func;
|
||||||
|
pzlib_filefunc_def->zerror_file = win32_error_file_func;
|
||||||
|
pzlib_filefunc_def->opaque=NULL;
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
/* iowin32.h -- IO base function header for compress/uncompress .zip
|
||||||
|
files using zlib + zip or unzip API
|
||||||
|
This IO API version uses the Win32 API (for Microsoft Windows)
|
||||||
|
|
||||||
|
Version 1.01e, February 12th, 2005
|
||||||
|
|
||||||
|
Copyright (C) 1998-2005 Gilles Vollant
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void fill_win32_filefunc OF((zlib_filefunc_def* pzlib_filefunc_def));
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -0,0 +1,585 @@
|
||||||
|
/*
|
||||||
|
miniunz.c
|
||||||
|
Version 1.01e, February 12th, 2005
|
||||||
|
|
||||||
|
Copyright (C) 1998-2005 Gilles Vollant
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#ifdef unix
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <utime.h>
|
||||||
|
#else
|
||||||
|
# include <direct.h>
|
||||||
|
# include <io.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "unzip.h"
|
||||||
|
|
||||||
|
#define CASESENSITIVITY (0)
|
||||||
|
#define WRITEBUFFERSIZE (8192)
|
||||||
|
#define MAXFILENAME (256)
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#define USEWIN32IOAPI
|
||||||
|
#include "iowin32.h"
|
||||||
|
#endif
|
||||||
|
/*
|
||||||
|
mini unzip, demo of unzip package
|
||||||
|
|
||||||
|
usage :
|
||||||
|
Usage : miniunz [-exvlo] file.zip [file_to_extract] [-d extractdir]
|
||||||
|
|
||||||
|
list the file in the zipfile, and print the content of FILE_ID.ZIP or README.TXT
|
||||||
|
if it exists
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* change_file_date : change the date/time of a file
|
||||||
|
filename : the filename of the file where date/time must be modified
|
||||||
|
dosdate : the new date at the MSDos format (4 bytes)
|
||||||
|
tmu_date : the SAME new date at the tm_unz format */
|
||||||
|
void change_file_date(filename,dosdate,tmu_date)
|
||||||
|
const char *filename;
|
||||||
|
uLong dosdate;
|
||||||
|
tm_unz tmu_date;
|
||||||
|
{
|
||||||
|
#ifdef WIN32
|
||||||
|
HANDLE hFile;
|
||||||
|
FILETIME ftm,ftLocal,ftCreate,ftLastAcc,ftLastWrite;
|
||||||
|
|
||||||
|
hFile = CreateFile(filename,GENERIC_READ | GENERIC_WRITE,
|
||||||
|
0,NULL,OPEN_EXISTING,0,NULL);
|
||||||
|
GetFileTime(hFile,&ftCreate,&ftLastAcc,&ftLastWrite);
|
||||||
|
DosDateTimeToFileTime((WORD)(dosdate>>16),(WORD)dosdate,&ftLocal);
|
||||||
|
LocalFileTimeToFileTime(&ftLocal,&ftm);
|
||||||
|
SetFileTime(hFile,&ftm,&ftLastAcc,&ftm);
|
||||||
|
CloseHandle(hFile);
|
||||||
|
#else
|
||||||
|
#ifdef unix
|
||||||
|
struct utimbuf ut;
|
||||||
|
struct tm newdate;
|
||||||
|
newdate.tm_sec = tmu_date.tm_sec;
|
||||||
|
newdate.tm_min=tmu_date.tm_min;
|
||||||
|
newdate.tm_hour=tmu_date.tm_hour;
|
||||||
|
newdate.tm_mday=tmu_date.tm_mday;
|
||||||
|
newdate.tm_mon=tmu_date.tm_mon;
|
||||||
|
if (tmu_date.tm_year > 1900)
|
||||||
|
newdate.tm_year=tmu_date.tm_year - 1900;
|
||||||
|
else
|
||||||
|
newdate.tm_year=tmu_date.tm_year ;
|
||||||
|
newdate.tm_isdst=-1;
|
||||||
|
|
||||||
|
ut.actime=ut.modtime=mktime(&newdate);
|
||||||
|
utime(filename,&ut);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* mymkdir and change_file_date are not 100 % portable
|
||||||
|
As I don't know well Unix, I wait feedback for the unix portion */
|
||||||
|
|
||||||
|
int mymkdir(dirname)
|
||||||
|
const char* dirname;
|
||||||
|
{
|
||||||
|
int ret=0;
|
||||||
|
#ifdef WIN32
|
||||||
|
ret = mkdir(dirname);
|
||||||
|
#else
|
||||||
|
#ifdef unix
|
||||||
|
ret = mkdir (dirname,0775);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int makedir (newdir)
|
||||||
|
char *newdir;
|
||||||
|
{
|
||||||
|
char *buffer ;
|
||||||
|
char *p;
|
||||||
|
int len = (int)strlen(newdir);
|
||||||
|
|
||||||
|
if (len <= 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
buffer = (char*)malloc(len+1);
|
||||||
|
strcpy(buffer,newdir);
|
||||||
|
|
||||||
|
if (buffer[len-1] == '/') {
|
||||||
|
buffer[len-1] = '\0';
|
||||||
|
}
|
||||||
|
if (mymkdir(buffer) == 0)
|
||||||
|
{
|
||||||
|
free(buffer);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = buffer+1;
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
char hold;
|
||||||
|
|
||||||
|
while(*p && *p != '\\' && *p != '/')
|
||||||
|
p++;
|
||||||
|
hold = *p;
|
||||||
|
*p = 0;
|
||||||
|
if ((mymkdir(buffer) == -1) && (errno == ENOENT))
|
||||||
|
{
|
||||||
|
printf("couldn't create directory %s\n",buffer);
|
||||||
|
free(buffer);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (hold == 0)
|
||||||
|
break;
|
||||||
|
*p++ = hold;
|
||||||
|
}
|
||||||
|
free(buffer);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void do_banner()
|
||||||
|
{
|
||||||
|
printf("MiniUnz 1.01b, demo of zLib + Unz package written by Gilles Vollant\n");
|
||||||
|
printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void do_help()
|
||||||
|
{
|
||||||
|
printf("Usage : miniunz [-e] [-x] [-v] [-l] [-o] [-p password] file.zip [file_to_extr.] [-d extractdir]\n\n" \
|
||||||
|
" -e Extract without pathname (junk paths)\n" \
|
||||||
|
" -x Extract with pathname\n" \
|
||||||
|
" -v list files\n" \
|
||||||
|
" -l list files\n" \
|
||||||
|
" -d directory to extract into\n" \
|
||||||
|
" -o overwrite files without prompting\n" \
|
||||||
|
" -p extract crypted file using password\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int do_list(uf)
|
||||||
|
unzFile uf;
|
||||||
|
{
|
||||||
|
uLong i;
|
||||||
|
unz_global_info gi;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = unzGetGlobalInfo (uf,&gi);
|
||||||
|
if (err!=UNZ_OK)
|
||||||
|
printf("error %d with zipfile in unzGetGlobalInfo \n",err);
|
||||||
|
printf(" Length Method Size Ratio Date Time CRC-32 Name\n");
|
||||||
|
printf(" ------ ------ ---- ----- ---- ---- ------ ----\n");
|
||||||
|
for (i=0;i<gi.number_entry;i++)
|
||||||
|
{
|
||||||
|
char filename_inzip[256];
|
||||||
|
unz_file_info file_info;
|
||||||
|
uLong ratio=0;
|
||||||
|
const char *string_method;
|
||||||
|
char charCrypt=' ';
|
||||||
|
err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
|
||||||
|
if (err!=UNZ_OK)
|
||||||
|
{
|
||||||
|
printf("error %d with zipfile in unzGetCurrentFileInfo\n",err);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (file_info.uncompressed_size>0)
|
||||||
|
ratio = (file_info.compressed_size*100)/file_info.uncompressed_size;
|
||||||
|
|
||||||
|
/* display a '*' if the file is crypted */
|
||||||
|
if ((file_info.flag & 1) != 0)
|
||||||
|
charCrypt='*';
|
||||||
|
|
||||||
|
if (file_info.compression_method==0)
|
||||||
|
string_method="Stored";
|
||||||
|
else
|
||||||
|
if (file_info.compression_method==Z_DEFLATED)
|
||||||
|
{
|
||||||
|
uInt iLevel=(uInt)((file_info.flag & 0x6)/2);
|
||||||
|
if (iLevel==0)
|
||||||
|
string_method="Defl:N";
|
||||||
|
else if (iLevel==1)
|
||||||
|
string_method="Defl:X";
|
||||||
|
else if ((iLevel==2) || (iLevel==3))
|
||||||
|
string_method="Defl:F"; /* 2:fast , 3 : extra fast*/
|
||||||
|
}
|
||||||
|
else
|
||||||
|
string_method="Unkn. ";
|
||||||
|
|
||||||
|
printf("%7lu %6s%c%7lu %3lu%% %2.2lu-%2.2lu-%2.2lu %2.2lu:%2.2lu %8.8lx %s\n",
|
||||||
|
file_info.uncompressed_size,string_method,
|
||||||
|
charCrypt,
|
||||||
|
file_info.compressed_size,
|
||||||
|
ratio,
|
||||||
|
(uLong)file_info.tmu_date.tm_mon + 1,
|
||||||
|
(uLong)file_info.tmu_date.tm_mday,
|
||||||
|
(uLong)file_info.tmu_date.tm_year % 100,
|
||||||
|
(uLong)file_info.tmu_date.tm_hour,(uLong)file_info.tmu_date.tm_min,
|
||||||
|
(uLong)file_info.crc,filename_inzip);
|
||||||
|
if ((i+1)<gi.number_entry)
|
||||||
|
{
|
||||||
|
err = unzGoToNextFile(uf);
|
||||||
|
if (err!=UNZ_OK)
|
||||||
|
{
|
||||||
|
printf("error %d with zipfile in unzGoToNextFile\n",err);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int do_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
|
||||||
|
unzFile uf;
|
||||||
|
const int* popt_extract_without_path;
|
||||||
|
int* popt_overwrite;
|
||||||
|
const char* password;
|
||||||
|
{
|
||||||
|
char filename_inzip[256];
|
||||||
|
char* filename_withoutpath;
|
||||||
|
char* p;
|
||||||
|
int err=UNZ_OK;
|
||||||
|
FILE *fout=NULL;
|
||||||
|
void* buf;
|
||||||
|
uInt size_buf;
|
||||||
|
|
||||||
|
unz_file_info file_info;
|
||||||
|
uLong ratio=0;
|
||||||
|
err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
|
||||||
|
|
||||||
|
if (err!=UNZ_OK)
|
||||||
|
{
|
||||||
|
printf("error %d with zipfile in unzGetCurrentFileInfo\n",err);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_buf = WRITEBUFFERSIZE;
|
||||||
|
buf = (void*)malloc(size_buf);
|
||||||
|
if (buf==NULL)
|
||||||
|
{
|
||||||
|
printf("Error allocating memory\n");
|
||||||
|
return UNZ_INTERNALERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
p = filename_withoutpath = filename_inzip;
|
||||||
|
while ((*p) != '\0')
|
||||||
|
{
|
||||||
|
if (((*p)=='/') || ((*p)=='\\'))
|
||||||
|
filename_withoutpath = p+1;
|
||||||
|
p++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((*filename_withoutpath)=='\0')
|
||||||
|
{
|
||||||
|
if ((*popt_extract_without_path)==0)
|
||||||
|
{
|
||||||
|
printf("creating directory: %s\n",filename_inzip);
|
||||||
|
mymkdir(filename_inzip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const char* write_filename;
|
||||||
|
int skip=0;
|
||||||
|
|
||||||
|
if ((*popt_extract_without_path)==0)
|
||||||
|
write_filename = filename_inzip;
|
||||||
|
else
|
||||||
|
write_filename = filename_withoutpath;
|
||||||
|
|
||||||
|
err = unzOpenCurrentFilePassword(uf,password);
|
||||||
|
if (err!=UNZ_OK)
|
||||||
|
{
|
||||||
|
printf("error %d with zipfile in unzOpenCurrentFilePassword\n",err);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (((*popt_overwrite)==0) && (err==UNZ_OK))
|
||||||
|
{
|
||||||
|
char rep=0;
|
||||||
|
FILE* ftestexist;
|
||||||
|
ftestexist = fopen(write_filename,"rb");
|
||||||
|
if (ftestexist!=NULL)
|
||||||
|
{
|
||||||
|
fclose(ftestexist);
|
||||||
|
do
|
||||||
|
{
|
||||||
|
char answer[128];
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
printf("The file %s exists. Overwrite ? [y]es, [n]o, [A]ll: ",write_filename);
|
||||||
|
ret = scanf("%1s",answer);
|
||||||
|
if (ret != 1)
|
||||||
|
{
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
rep = answer[0] ;
|
||||||
|
if ((rep>='a') && (rep<='z'))
|
||||||
|
rep -= 0x20;
|
||||||
|
}
|
||||||
|
while ((rep!='Y') && (rep!='N') && (rep!='A'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rep == 'N')
|
||||||
|
skip = 1;
|
||||||
|
|
||||||
|
if (rep == 'A')
|
||||||
|
*popt_overwrite=1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((skip==0) && (err==UNZ_OK))
|
||||||
|
{
|
||||||
|
fout=fopen(write_filename,"wb");
|
||||||
|
|
||||||
|
/* some zipfile don't contain directory alone before file */
|
||||||
|
if ((fout==NULL) && ((*popt_extract_without_path)==0) &&
|
||||||
|
(filename_withoutpath!=(char*)filename_inzip))
|
||||||
|
{
|
||||||
|
char c=*(filename_withoutpath-1);
|
||||||
|
*(filename_withoutpath-1)='\0';
|
||||||
|
makedir(write_filename);
|
||||||
|
*(filename_withoutpath-1)=c;
|
||||||
|
fout=fopen(write_filename,"wb");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fout==NULL)
|
||||||
|
{
|
||||||
|
printf("error opening %s\n",write_filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fout!=NULL)
|
||||||
|
{
|
||||||
|
printf(" extracting: %s\n",write_filename);
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
err = unzReadCurrentFile(uf,buf,size_buf);
|
||||||
|
if (err<0)
|
||||||
|
{
|
||||||
|
printf("error %d with zipfile in unzReadCurrentFile\n",err);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (err>0)
|
||||||
|
if (fwrite(buf,err,1,fout)!=1)
|
||||||
|
{
|
||||||
|
printf("error in writing extracted file\n");
|
||||||
|
err=UNZ_ERRNO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (err>0);
|
||||||
|
if (fout)
|
||||||
|
fclose(fout);
|
||||||
|
|
||||||
|
if (err==0)
|
||||||
|
change_file_date(write_filename,file_info.dosDate,
|
||||||
|
file_info.tmu_date);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err==UNZ_OK)
|
||||||
|
{
|
||||||
|
err = unzCloseCurrentFile (uf);
|
||||||
|
if (err!=UNZ_OK)
|
||||||
|
{
|
||||||
|
printf("error %d with zipfile in unzCloseCurrentFile\n",err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
unzCloseCurrentFile(uf); /* don't lose the error */
|
||||||
|
}
|
||||||
|
|
||||||
|
free(buf);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int do_extract(uf,opt_extract_without_path,opt_overwrite,password)
|
||||||
|
unzFile uf;
|
||||||
|
int opt_extract_without_path;
|
||||||
|
int opt_overwrite;
|
||||||
|
const char* password;
|
||||||
|
{
|
||||||
|
uLong i;
|
||||||
|
unz_global_info gi;
|
||||||
|
int err;
|
||||||
|
FILE* fout=NULL;
|
||||||
|
|
||||||
|
err = unzGetGlobalInfo (uf,&gi);
|
||||||
|
if (err!=UNZ_OK)
|
||||||
|
printf("error %d with zipfile in unzGetGlobalInfo \n",err);
|
||||||
|
|
||||||
|
for (i=0;i<gi.number_entry;i++)
|
||||||
|
{
|
||||||
|
if (do_extract_currentfile(uf,&opt_extract_without_path,
|
||||||
|
&opt_overwrite,
|
||||||
|
password) != UNZ_OK)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if ((i+1)<gi.number_entry)
|
||||||
|
{
|
||||||
|
err = unzGoToNextFile(uf);
|
||||||
|
if (err!=UNZ_OK)
|
||||||
|
{
|
||||||
|
printf("error %d with zipfile in unzGoToNextFile\n",err);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int do_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password)
|
||||||
|
unzFile uf;
|
||||||
|
const char* filename;
|
||||||
|
int opt_extract_without_path;
|
||||||
|
int opt_overwrite;
|
||||||
|
const char* password;
|
||||||
|
{
|
||||||
|
int err = UNZ_OK;
|
||||||
|
if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK)
|
||||||
|
{
|
||||||
|
printf("file %s not found in the zipfile\n",filename);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (do_extract_currentfile(uf,&opt_extract_without_path,
|
||||||
|
&opt_overwrite,
|
||||||
|
password) == UNZ_OK)
|
||||||
|
return 0;
|
||||||
|
else
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int main(argc,argv)
|
||||||
|
int argc;
|
||||||
|
char *argv[];
|
||||||
|
{
|
||||||
|
const char *zipfilename=NULL;
|
||||||
|
const char *filename_to_extract=NULL;
|
||||||
|
const char *password=NULL;
|
||||||
|
char filename_try[MAXFILENAME+16] = "";
|
||||||
|
int i;
|
||||||
|
int opt_do_list=0;
|
||||||
|
int opt_do_extract=1;
|
||||||
|
int opt_do_extract_withoutpath=0;
|
||||||
|
int opt_overwrite=0;
|
||||||
|
int opt_extractdir=0;
|
||||||
|
const char *dirname=NULL;
|
||||||
|
unzFile uf=NULL;
|
||||||
|
|
||||||
|
do_banner();
|
||||||
|
if (argc==1)
|
||||||
|
{
|
||||||
|
do_help();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (i=1;i<argc;i++)
|
||||||
|
{
|
||||||
|
if ((*argv[i])=='-')
|
||||||
|
{
|
||||||
|
const char *p=argv[i]+1;
|
||||||
|
|
||||||
|
while ((*p)!='\0')
|
||||||
|
{
|
||||||
|
char c=*(p++);;
|
||||||
|
if ((c=='l') || (c=='L'))
|
||||||
|
opt_do_list = 1;
|
||||||
|
if ((c=='v') || (c=='V'))
|
||||||
|
opt_do_list = 1;
|
||||||
|
if ((c=='x') || (c=='X'))
|
||||||
|
opt_do_extract = 1;
|
||||||
|
if ((c=='e') || (c=='E'))
|
||||||
|
opt_do_extract = opt_do_extract_withoutpath = 1;
|
||||||
|
if ((c=='o') || (c=='O'))
|
||||||
|
opt_overwrite=1;
|
||||||
|
if ((c=='d') || (c=='D'))
|
||||||
|
{
|
||||||
|
opt_extractdir=1;
|
||||||
|
dirname=argv[i+1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (((c=='p') || (c=='P')) && (i+1<argc))
|
||||||
|
{
|
||||||
|
password=argv[i+1];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (zipfilename == NULL)
|
||||||
|
zipfilename = argv[i];
|
||||||
|
else if ((filename_to_extract==NULL) && (!opt_extractdir))
|
||||||
|
filename_to_extract = argv[i] ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zipfilename!=NULL)
|
||||||
|
{
|
||||||
|
|
||||||
|
# ifdef USEWIN32IOAPI
|
||||||
|
zlib_filefunc_def ffunc;
|
||||||
|
# endif
|
||||||
|
|
||||||
|
strncpy(filename_try, zipfilename,MAXFILENAME-1);
|
||||||
|
/* strncpy doesnt append the trailing NULL, of the string is too long. */
|
||||||
|
filename_try[ MAXFILENAME ] = '\0';
|
||||||
|
|
||||||
|
# ifdef USEWIN32IOAPI
|
||||||
|
fill_win32_filefunc(&ffunc);
|
||||||
|
uf = unzOpen2(zipfilename,&ffunc);
|
||||||
|
# else
|
||||||
|
uf = unzOpen(zipfilename);
|
||||||
|
# endif
|
||||||
|
if (uf==NULL)
|
||||||
|
{
|
||||||
|
strcat(filename_try,".zip");
|
||||||
|
# ifdef USEWIN32IOAPI
|
||||||
|
uf = unzOpen2(filename_try,&ffunc);
|
||||||
|
# else
|
||||||
|
uf = unzOpen(filename_try);
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (uf==NULL)
|
||||||
|
{
|
||||||
|
printf("Cannot open %s or %s.zip\n",zipfilename,zipfilename);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
printf("%s opened\n",filename_try);
|
||||||
|
|
||||||
|
if (opt_do_list==1)
|
||||||
|
return do_list(uf);
|
||||||
|
else if (opt_do_extract==1)
|
||||||
|
{
|
||||||
|
if (opt_extractdir && chdir(dirname))
|
||||||
|
{
|
||||||
|
printf("Error changing into %s, aborting\n", dirname);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (filename_to_extract == NULL)
|
||||||
|
return do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,password);
|
||||||
|
else
|
||||||
|
return do_extract_onefile(uf,filename_to_extract,
|
||||||
|
opt_do_extract_withoutpath,opt_overwrite,password);
|
||||||
|
}
|
||||||
|
unzCloseCurrentFile(uf);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,420 @@
|
||||||
|
/*
|
||||||
|
minizip.c
|
||||||
|
Version 1.01e, February 12th, 2005
|
||||||
|
|
||||||
|
Copyright (C) 1998-2005 Gilles Vollant
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#ifdef unix
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <utime.h>
|
||||||
|
# include <sys/types.h>
|
||||||
|
# include <sys/stat.h>
|
||||||
|
#else
|
||||||
|
# include <direct.h>
|
||||||
|
# include <io.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "zip.h"
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
#define USEWIN32IOAPI
|
||||||
|
#include "iowin32.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define WRITEBUFFERSIZE (16384)
|
||||||
|
#define MAXFILENAME (256)
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
uLong filetime(f, tmzip, dt)
|
||||||
|
TCHAR *f; /* name of file to get info on */
|
||||||
|
tm_zip *tmzip; /* return value: access, modific. and creation times */
|
||||||
|
uLong *dt; /* dostime */
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
{
|
||||||
|
FILETIME ftLocal;
|
||||||
|
HANDLE hFind;
|
||||||
|
WIN32_FIND_DATA ff32;
|
||||||
|
|
||||||
|
hFind = FindFirstFile(f,&ff32);
|
||||||
|
if (hFind != INVALID_HANDLE_VALUE)
|
||||||
|
{
|
||||||
|
FileTimeToLocalFileTime(&(ff32.ftLastWriteTime),&ftLocal);
|
||||||
|
FileTimeToDosDateTime(&ftLocal,((LPWORD)dt)+1,((LPWORD)dt)+0);
|
||||||
|
FindClose(hFind);
|
||||||
|
ret = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#ifdef unix
|
||||||
|
uLong filetime(f, tmzip, dt)
|
||||||
|
char *f; /* name of file to get info on */
|
||||||
|
tm_zip *tmzip; /* return value: access, modific. and creation times */
|
||||||
|
uLong *dt; /* dostime */
|
||||||
|
{
|
||||||
|
int ret=0;
|
||||||
|
struct stat s; /* results of stat() */
|
||||||
|
struct tm* filedate;
|
||||||
|
time_t tm_t=0;
|
||||||
|
|
||||||
|
if (strcmp(f,"-")!=0)
|
||||||
|
{
|
||||||
|
char name[MAXFILENAME+1];
|
||||||
|
int len = strlen(f);
|
||||||
|
if (len > MAXFILENAME)
|
||||||
|
len = MAXFILENAME;
|
||||||
|
|
||||||
|
strncpy(name, f,MAXFILENAME-1);
|
||||||
|
/* strncpy doesnt append the trailing NULL, of the string is too long. */
|
||||||
|
name[ MAXFILENAME ] = '\0';
|
||||||
|
|
||||||
|
if (name[len - 1] == '/')
|
||||||
|
name[len - 1] = '\0';
|
||||||
|
/* not all systems allow stat'ing a file with / appended */
|
||||||
|
if (stat(name,&s)==0)
|
||||||
|
{
|
||||||
|
tm_t = s.st_mtime;
|
||||||
|
ret = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
filedate = localtime(&tm_t);
|
||||||
|
|
||||||
|
tmzip->tm_sec = filedate->tm_sec;
|
||||||
|
tmzip->tm_min = filedate->tm_min;
|
||||||
|
tmzip->tm_hour = filedate->tm_hour;
|
||||||
|
tmzip->tm_mday = filedate->tm_mday;
|
||||||
|
tmzip->tm_mon = filedate->tm_mon ;
|
||||||
|
tmzip->tm_year = filedate->tm_year;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
uLong filetime(f, tmzip, dt)
|
||||||
|
char *f; /* name of file to get info on */
|
||||||
|
tm_zip *tmzip; /* return value: access, modific. and creation times */
|
||||||
|
uLong *dt; /* dostime */
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int check_exist_file(filename)
|
||||||
|
const char* filename;
|
||||||
|
{
|
||||||
|
FILE* ftestexist;
|
||||||
|
int ret = 1;
|
||||||
|
ftestexist = fopen(filename,"rb");
|
||||||
|
if (ftestexist==NULL)
|
||||||
|
ret = 0;
|
||||||
|
else
|
||||||
|
fclose(ftestexist);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void do_banner()
|
||||||
|
{
|
||||||
|
printf("MiniZip 1.01b, demo of zLib + Zip package written by Gilles Vollant\n");
|
||||||
|
printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void do_help()
|
||||||
|
{
|
||||||
|
printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] file.zip [files_to_add]\n\n" \
|
||||||
|
" -o Overwrite existing file.zip\n" \
|
||||||
|
" -a Append to existing file.zip\n" \
|
||||||
|
" -0 Store only\n" \
|
||||||
|
" -1 Compress faster\n" \
|
||||||
|
" -9 Compress better\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* calculate the CRC32 of a file,
|
||||||
|
because to encrypt a file, we need known the CRC32 of the file before */
|
||||||
|
int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc)
|
||||||
|
{
|
||||||
|
unsigned long calculate_crc=0;
|
||||||
|
int err=ZIP_OK;
|
||||||
|
FILE * fin = fopen(filenameinzip,"rb");
|
||||||
|
unsigned long size_read = 0;
|
||||||
|
unsigned long total_read = 0;
|
||||||
|
if (fin==NULL)
|
||||||
|
{
|
||||||
|
err = ZIP_ERRNO;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err == ZIP_OK)
|
||||||
|
do
|
||||||
|
{
|
||||||
|
err = ZIP_OK;
|
||||||
|
size_read = (int)fread(buf,1,size_buf,fin);
|
||||||
|
if (size_read < size_buf)
|
||||||
|
if (feof(fin)==0)
|
||||||
|
{
|
||||||
|
printf("error in reading %s\n",filenameinzip);
|
||||||
|
err = ZIP_ERRNO;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (size_read>0)
|
||||||
|
calculate_crc = crc32(calculate_crc,buf,size_read);
|
||||||
|
total_read += size_read;
|
||||||
|
|
||||||
|
} while ((err == ZIP_OK) && (size_read>0));
|
||||||
|
|
||||||
|
if (fin)
|
||||||
|
fclose(fin);
|
||||||
|
|
||||||
|
*result_crc=calculate_crc;
|
||||||
|
printf("file %s crc %x\n",filenameinzip,calculate_crc);
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(argc,argv)
|
||||||
|
int argc;
|
||||||
|
char *argv[];
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int opt_overwrite=0;
|
||||||
|
int opt_compress_level=Z_DEFAULT_COMPRESSION;
|
||||||
|
int zipfilenamearg = 0;
|
||||||
|
char filename_try[MAXFILENAME+16];
|
||||||
|
int zipok;
|
||||||
|
int err=0;
|
||||||
|
int size_buf=0;
|
||||||
|
void* buf=NULL;
|
||||||
|
const char* password=NULL;
|
||||||
|
|
||||||
|
|
||||||
|
do_banner();
|
||||||
|
if (argc==1)
|
||||||
|
{
|
||||||
|
do_help();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (i=1;i<argc;i++)
|
||||||
|
{
|
||||||
|
if ((*argv[i])=='-')
|
||||||
|
{
|
||||||
|
const char *p=argv[i]+1;
|
||||||
|
|
||||||
|
while ((*p)!='\0')
|
||||||
|
{
|
||||||
|
char c=*(p++);;
|
||||||
|
if ((c=='o') || (c=='O'))
|
||||||
|
opt_overwrite = 1;
|
||||||
|
if ((c=='a') || (c=='A'))
|
||||||
|
opt_overwrite = 2;
|
||||||
|
if ((c>='0') && (c<='9'))
|
||||||
|
opt_compress_level = c-'0';
|
||||||
|
|
||||||
|
if (((c=='p') || (c=='P')) && (i+1<argc))
|
||||||
|
{
|
||||||
|
password=argv[i+1];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (zipfilenamearg == 0)
|
||||||
|
zipfilenamearg = i ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
size_buf = WRITEBUFFERSIZE;
|
||||||
|
buf = (void*)malloc(size_buf);
|
||||||
|
if (buf==NULL)
|
||||||
|
{
|
||||||
|
printf("Error allocating memory\n");
|
||||||
|
return ZIP_INTERNALERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zipfilenamearg==0)
|
||||||
|
zipok=0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int i,len;
|
||||||
|
int dot_found=0;
|
||||||
|
|
||||||
|
zipok = 1 ;
|
||||||
|
strncpy(filename_try, argv[zipfilenamearg],MAXFILENAME-1);
|
||||||
|
/* strncpy doesnt append the trailing NULL, of the string is too long. */
|
||||||
|
filename_try[ MAXFILENAME ] = '\0';
|
||||||
|
|
||||||
|
len=(int)strlen(filename_try);
|
||||||
|
for (i=0;i<len;i++)
|
||||||
|
if (filename_try[i]=='.')
|
||||||
|
dot_found=1;
|
||||||
|
|
||||||
|
if (dot_found==0)
|
||||||
|
strcat(filename_try,".zip");
|
||||||
|
|
||||||
|
if (opt_overwrite==2)
|
||||||
|
{
|
||||||
|
/* if the file don't exist, we not append file */
|
||||||
|
if (check_exist_file(filename_try)==0)
|
||||||
|
opt_overwrite=1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (opt_overwrite==0)
|
||||||
|
if (check_exist_file(filename_try)!=0)
|
||||||
|
{
|
||||||
|
char rep=0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
char answer[128];
|
||||||
|
int ret;
|
||||||
|
printf("The file %s exists. Overwrite ? [y]es, [n]o, [a]ppend : ",filename_try);
|
||||||
|
ret = scanf("%1s",answer);
|
||||||
|
if (ret != 1)
|
||||||
|
{
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
rep = answer[0] ;
|
||||||
|
if ((rep>='a') && (rep<='z'))
|
||||||
|
rep -= 0x20;
|
||||||
|
}
|
||||||
|
while ((rep!='Y') && (rep!='N') && (rep!='A'));
|
||||||
|
if (rep=='N')
|
||||||
|
zipok = 0;
|
||||||
|
if (rep=='A')
|
||||||
|
opt_overwrite = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (zipok==1)
|
||||||
|
{
|
||||||
|
zipFile zf;
|
||||||
|
int errclose;
|
||||||
|
# ifdef USEWIN32IOAPI
|
||||||
|
zlib_filefunc_def ffunc;
|
||||||
|
fill_win32_filefunc(&ffunc);
|
||||||
|
zf = zipOpen2(filename_try,(opt_overwrite==2) ? 2 : 0,NULL,&ffunc);
|
||||||
|
# else
|
||||||
|
zf = zipOpen(filename_try,(opt_overwrite==2) ? 2 : 0);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
if (zf == NULL)
|
||||||
|
{
|
||||||
|
printf("error opening %s\n",filename_try);
|
||||||
|
err= ZIP_ERRNO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
printf("creating %s\n",filename_try);
|
||||||
|
|
||||||
|
for (i=zipfilenamearg+1;(i<argc) && (err==ZIP_OK);i++)
|
||||||
|
{
|
||||||
|
if (!((((*(argv[i]))=='-') || ((*(argv[i]))=='/')) &&
|
||||||
|
((argv[i][1]=='o') || (argv[i][1]=='O') ||
|
||||||
|
(argv[i][1]=='a') || (argv[i][1]=='A') ||
|
||||||
|
(argv[i][1]=='p') || (argv[i][1]=='P') ||
|
||||||
|
((argv[i][1]>='0') || (argv[i][1]<='9'))) &&
|
||||||
|
(strlen(argv[i]) == 2)))
|
||||||
|
{
|
||||||
|
FILE * fin;
|
||||||
|
int size_read;
|
||||||
|
const char* filenameinzip = argv[i];
|
||||||
|
zip_fileinfo zi;
|
||||||
|
unsigned long crcFile=0;
|
||||||
|
|
||||||
|
zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour =
|
||||||
|
zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0;
|
||||||
|
zi.dosDate = 0;
|
||||||
|
zi.internal_fa = 0;
|
||||||
|
zi.external_fa = 0;
|
||||||
|
filetime(filenameinzip,&zi.tmz_date,&zi.dosDate);
|
||||||
|
|
||||||
|
/*
|
||||||
|
err = zipOpenNewFileInZip(zf,filenameinzip,&zi,
|
||||||
|
NULL,0,NULL,0,NULL / * comment * /,
|
||||||
|
(opt_compress_level != 0) ? Z_DEFLATED : 0,
|
||||||
|
opt_compress_level);
|
||||||
|
*/
|
||||||
|
if ((password != NULL) && (err==ZIP_OK))
|
||||||
|
err = getFileCrc(filenameinzip,buf,size_buf,&crcFile);
|
||||||
|
|
||||||
|
err = zipOpenNewFileInZip3(zf,filenameinzip,&zi,
|
||||||
|
NULL,0,NULL,0,NULL /* comment*/,
|
||||||
|
(opt_compress_level != 0) ? Z_DEFLATED : 0,
|
||||||
|
opt_compress_level,0,
|
||||||
|
/* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */
|
||||||
|
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
|
||||||
|
password,crcFile);
|
||||||
|
|
||||||
|
if (err != ZIP_OK)
|
||||||
|
printf("error in opening %s in zipfile\n",filenameinzip);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fin = fopen(filenameinzip,"rb");
|
||||||
|
if (fin==NULL)
|
||||||
|
{
|
||||||
|
err=ZIP_ERRNO;
|
||||||
|
printf("error in opening %s for reading\n",filenameinzip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err == ZIP_OK)
|
||||||
|
do
|
||||||
|
{
|
||||||
|
err = ZIP_OK;
|
||||||
|
size_read = (int)fread(buf,1,size_buf,fin);
|
||||||
|
if (size_read < size_buf)
|
||||||
|
if (feof(fin)==0)
|
||||||
|
{
|
||||||
|
printf("error in reading %s\n",filenameinzip);
|
||||||
|
err = ZIP_ERRNO;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (size_read>0)
|
||||||
|
{
|
||||||
|
err = zipWriteInFileInZip (zf,buf,size_read);
|
||||||
|
if (err<0)
|
||||||
|
{
|
||||||
|
printf("error in writing %s in the zipfile\n",
|
||||||
|
filenameinzip);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} while ((err == ZIP_OK) && (size_read>0));
|
||||||
|
|
||||||
|
if (fin)
|
||||||
|
fclose(fin);
|
||||||
|
|
||||||
|
if (err<0)
|
||||||
|
err=ZIP_ERRNO;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
err = zipCloseFileInZip(zf);
|
||||||
|
if (err!=ZIP_OK)
|
||||||
|
printf("error in closing %s in the zipfile\n",
|
||||||
|
filenameinzip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
errclose = zipClose(zf,NULL);
|
||||||
|
if (errclose != ZIP_OK)
|
||||||
|
printf("error in closing %s\n",filename_try);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
do_help();
|
||||||
|
}
|
||||||
|
|
||||||
|
free(buf);
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -0,0 +1,286 @@
|
||||||
|
/*
|
||||||
|
Additional tools for Minizip
|
||||||
|
Code: Xavier Roche '2004
|
||||||
|
License: Same as ZLIB (www.gzip.org)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Code */
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#if defined(USE_SYSTEM_ZLIB)
|
||||||
|
#include <zlib.h>
|
||||||
|
#else
|
||||||
|
#include "../../zlib.h"
|
||||||
|
#endif
|
||||||
|
#include "unzip.h"
|
||||||
|
|
||||||
|
#define READ_8(adr) ((unsigned char)*(adr))
|
||||||
|
#define READ_16(adr) ( READ_8(adr) | (READ_8(adr+1) << 8) )
|
||||||
|
#define READ_32(adr) ( READ_16(adr) | (READ_16((adr)+2) << 16) )
|
||||||
|
|
||||||
|
#define WRITE_8(buff, n) do { \
|
||||||
|
*((unsigned char*)(buff)) = (unsigned char) ((n) & 0xff); \
|
||||||
|
} while(0)
|
||||||
|
#define WRITE_16(buff, n) do { \
|
||||||
|
WRITE_8((unsigned char*)(buff), n); \
|
||||||
|
WRITE_8(((unsigned char*)(buff)) + 1, (n) >> 8); \
|
||||||
|
} while(0)
|
||||||
|
#define WRITE_32(buff, n) do { \
|
||||||
|
WRITE_16((unsigned char*)(buff), (n) & 0xffff); \
|
||||||
|
WRITE_16((unsigned char*)(buff) + 2, (n) >> 16); \
|
||||||
|
} while(0)
|
||||||
|
|
||||||
|
extern int ZEXPORT unzRepair(file, fileOut, fileOutTmp, nRecovered, bytesRecovered)
|
||||||
|
const char* file;
|
||||||
|
const char* fileOut;
|
||||||
|
const char* fileOutTmp;
|
||||||
|
uLong* nRecovered;
|
||||||
|
uLong* bytesRecovered;
|
||||||
|
{
|
||||||
|
int err = Z_OK;
|
||||||
|
FILE* fpZip = fopen(file, "rb");
|
||||||
|
FILE* fpOut = fopen(fileOut, "wb");
|
||||||
|
FILE* fpOutCD = fopen(fileOutTmp, "wb");
|
||||||
|
if (fpZip != NULL && fpOut != NULL) {
|
||||||
|
int entries = 0;
|
||||||
|
uLong totalBytes = 0;
|
||||||
|
char header[30];
|
||||||
|
char filename[256];
|
||||||
|
char extra[1024];
|
||||||
|
int offset = 0;
|
||||||
|
int offsetCD = 0;
|
||||||
|
while ( fread(header, 1, 30, fpZip) == 30 ) {
|
||||||
|
int currentOffset = offset;
|
||||||
|
|
||||||
|
/* File entry */
|
||||||
|
if (READ_32(header) == 0x04034b50) {
|
||||||
|
unsigned int version = READ_16(header + 4);
|
||||||
|
unsigned int gpflag = READ_16(header + 6);
|
||||||
|
unsigned int method = READ_16(header + 8);
|
||||||
|
unsigned int filetime = READ_16(header + 10);
|
||||||
|
unsigned int filedate = READ_16(header + 12);
|
||||||
|
unsigned int crc = READ_32(header + 14); /* crc */
|
||||||
|
unsigned int cpsize = READ_32(header + 18); /* compressed size */
|
||||||
|
unsigned int uncpsize = READ_32(header + 22); /* uncompressed sz */
|
||||||
|
unsigned int fnsize = READ_16(header + 26); /* file name length */
|
||||||
|
unsigned int extsize = READ_16(header + 28); /* extra field length */
|
||||||
|
filename[0] = extra[0] = '\0';
|
||||||
|
|
||||||
|
/* Header */
|
||||||
|
if (fwrite(header, 1, 30, fpOut) == 30) {
|
||||||
|
offset += 30;
|
||||||
|
} else {
|
||||||
|
err = Z_ERRNO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Filename */
|
||||||
|
if (fnsize > 0) {
|
||||||
|
if (fread(filename, 1, fnsize, fpZip) == fnsize) {
|
||||||
|
if (fwrite(filename, 1, fnsize, fpOut) == fnsize) {
|
||||||
|
offset += fnsize;
|
||||||
|
} else {
|
||||||
|
err = Z_ERRNO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
err = Z_ERRNO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
err = Z_STREAM_ERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Extra field */
|
||||||
|
if (extsize > 0) {
|
||||||
|
if (fread(extra, 1, extsize, fpZip) == extsize) {
|
||||||
|
if (fwrite(extra, 1, extsize, fpOut) == extsize) {
|
||||||
|
offset += extsize;
|
||||||
|
} else {
|
||||||
|
err = Z_ERRNO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
err = Z_ERRNO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Data */
|
||||||
|
{
|
||||||
|
int dataSize = cpsize;
|
||||||
|
if (dataSize == 0) {
|
||||||
|
dataSize = uncpsize;
|
||||||
|
}
|
||||||
|
if (dataSize > 0) {
|
||||||
|
char* data = malloc(dataSize);
|
||||||
|
if (data != NULL) {
|
||||||
|
if ((int)fread(data, 1, dataSize, fpZip) == dataSize) {
|
||||||
|
if ((int)fwrite(data, 1, dataSize, fpOut) == dataSize) {
|
||||||
|
offset += dataSize;
|
||||||
|
totalBytes += dataSize;
|
||||||
|
} else {
|
||||||
|
err = Z_ERRNO;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
err = Z_ERRNO;
|
||||||
|
}
|
||||||
|
free(data);
|
||||||
|
if (err != Z_OK) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
err = Z_MEM_ERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Central directory entry */
|
||||||
|
{
|
||||||
|
char header[46];
|
||||||
|
char* comment = "";
|
||||||
|
int comsize = (int) strlen(comment);
|
||||||
|
WRITE_32(header, 0x02014b50);
|
||||||
|
WRITE_16(header + 4, version);
|
||||||
|
WRITE_16(header + 6, version);
|
||||||
|
WRITE_16(header + 8, gpflag);
|
||||||
|
WRITE_16(header + 10, method);
|
||||||
|
WRITE_16(header + 12, filetime);
|
||||||
|
WRITE_16(header + 14, filedate);
|
||||||
|
WRITE_32(header + 16, crc);
|
||||||
|
WRITE_32(header + 20, cpsize);
|
||||||
|
WRITE_32(header + 24, uncpsize);
|
||||||
|
WRITE_16(header + 28, fnsize);
|
||||||
|
WRITE_16(header + 30, extsize);
|
||||||
|
WRITE_16(header + 32, comsize);
|
||||||
|
WRITE_16(header + 34, 0); /* disk # */
|
||||||
|
WRITE_16(header + 36, 0); /* int attrb */
|
||||||
|
WRITE_32(header + 38, 0); /* ext attrb */
|
||||||
|
WRITE_32(header + 42, currentOffset);
|
||||||
|
/* Header */
|
||||||
|
if (fwrite(header, 1, 46, fpOutCD) == 46) {
|
||||||
|
offsetCD += 46;
|
||||||
|
|
||||||
|
/* Filename */
|
||||||
|
if (fnsize > 0) {
|
||||||
|
if (fwrite(filename, 1, fnsize, fpOutCD) == fnsize) {
|
||||||
|
offsetCD += fnsize;
|
||||||
|
} else {
|
||||||
|
err = Z_ERRNO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
err = Z_STREAM_ERROR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Extra field */
|
||||||
|
if (extsize > 0) {
|
||||||
|
if (fwrite(extra, 1, extsize, fpOutCD) == extsize) {
|
||||||
|
offsetCD += extsize;
|
||||||
|
} else {
|
||||||
|
err = Z_ERRNO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Comment field */
|
||||||
|
if (comsize > 0) {
|
||||||
|
if ((int)fwrite(comment, 1, comsize, fpOutCD) == comsize) {
|
||||||
|
offsetCD += comsize;
|
||||||
|
} else {
|
||||||
|
err = Z_ERRNO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
err = Z_ERRNO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Success */
|
||||||
|
entries++;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Final central directory */
|
||||||
|
{
|
||||||
|
int entriesZip = entries;
|
||||||
|
char header[22];
|
||||||
|
char* comment = ""; // "ZIP File recovered by zlib/minizip/mztools";
|
||||||
|
int comsize = (int) strlen(comment);
|
||||||
|
if (entriesZip > 0xffff) {
|
||||||
|
entriesZip = 0xffff;
|
||||||
|
}
|
||||||
|
WRITE_32(header, 0x06054b50);
|
||||||
|
WRITE_16(header + 4, 0); /* disk # */
|
||||||
|
WRITE_16(header + 6, 0); /* disk # */
|
||||||
|
WRITE_16(header + 8, entriesZip); /* hack */
|
||||||
|
WRITE_16(header + 10, entriesZip); /* hack */
|
||||||
|
WRITE_32(header + 12, offsetCD); /* size of CD */
|
||||||
|
WRITE_32(header + 16, offset); /* offset to CD */
|
||||||
|
WRITE_16(header + 20, comsize); /* comment */
|
||||||
|
|
||||||
|
/* Header */
|
||||||
|
if (fwrite(header, 1, 22, fpOutCD) == 22) {
|
||||||
|
|
||||||
|
/* Comment field */
|
||||||
|
if (comsize > 0) {
|
||||||
|
if ((int)fwrite(comment, 1, comsize, fpOutCD) != comsize) {
|
||||||
|
err = Z_ERRNO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
err = Z_ERRNO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Final merge (file + central directory) */
|
||||||
|
fclose(fpOutCD);
|
||||||
|
if (err == Z_OK) {
|
||||||
|
fpOutCD = fopen(fileOutTmp, "rb");
|
||||||
|
if (fpOutCD != NULL) {
|
||||||
|
int nRead;
|
||||||
|
char buffer[8192];
|
||||||
|
while ( (nRead = (int)fread(buffer, 1, sizeof(buffer), fpOutCD)) > 0) {
|
||||||
|
if ((int)fwrite(buffer, 1, nRead, fpOut) != nRead) {
|
||||||
|
err = Z_ERRNO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fclose(fpOutCD);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Close */
|
||||||
|
fclose(fpZip);
|
||||||
|
fclose(fpOut);
|
||||||
|
|
||||||
|
/* Wipe temporary file */
|
||||||
|
(void)remove(fileOutTmp);
|
||||||
|
|
||||||
|
/* Number of recovered entries */
|
||||||
|
if (err == Z_OK) {
|
||||||
|
if (nRecovered != NULL) {
|
||||||
|
*nRecovered = entries;
|
||||||
|
}
|
||||||
|
if (bytesRecovered != NULL) {
|
||||||
|
*bytesRecovered = totalBytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
err = Z_STREAM_ERROR;
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
Additional tools for Minizip
|
||||||
|
Code: Xavier Roche '2004
|
||||||
|
License: Same as ZLIB (www.gzip.org)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _zip_tools_H
|
||||||
|
#define _zip_tools_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(USE_SYSTEM_ZLIB)
|
||||||
|
#include <zlib.h>
|
||||||
|
#else
|
||||||
|
#include "third_party/zlib/zlib.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "unzip.h"
|
||||||
|
|
||||||
|
/* Repair a ZIP file (missing central directory)
|
||||||
|
file: file to recover
|
||||||
|
fileOut: output file after recovery
|
||||||
|
fileOutTmp: temporary file name used for recovery
|
||||||
|
*/
|
||||||
|
extern int ZEXPORT unzRepair(const char* file,
|
||||||
|
const char* fileOut,
|
||||||
|
const char* fileOutTmp,
|
||||||
|
uLong* nRecovered,
|
||||||
|
uLong* bytesRecovered);
|
||||||
|
|
||||||
|
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,356 @@
|
||||||
|
/* unzip.h -- IO for uncompress .zip files using zlib
|
||||||
|
Version 1.01e, February 12th, 2005
|
||||||
|
|
||||||
|
Copyright (C) 1998-2005 Gilles Vollant
|
||||||
|
|
||||||
|
This unzip package allow extract file from .ZIP file, compatible with PKZip 2.04g
|
||||||
|
WinZip, InfoZip tools and compatible.
|
||||||
|
|
||||||
|
Multi volume ZipFile (span) are not supported.
|
||||||
|
Encryption compatible with pkzip 2.04g only supported
|
||||||
|
Old compressions used by old PKZip 1.x are not supported
|
||||||
|
|
||||||
|
|
||||||
|
I WAIT FEEDBACK at mail info@winimage.com
|
||||||
|
Visit also http://www.winimage.com/zLibDll/unzip.htm for evolution
|
||||||
|
|
||||||
|
Condition of use and distribution are the same than zlib :
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* for more info about .ZIP format, see
|
||||||
|
http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip
|
||||||
|
http://www.info-zip.org/pub/infozip/doc/
|
||||||
|
PkWare has also a specification at :
|
||||||
|
ftp://ftp.pkware.com/probdesc.zip
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _unz_H
|
||||||
|
#define _unz_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(USE_SYSTEM_ZLIB)
|
||||||
|
#include <zlib.h>
|
||||||
|
#else
|
||||||
|
#include "../../zlib.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _ZLIBIOAPI_H
|
||||||
|
#include "ioapi.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
|
||||||
|
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
||||||
|
from (void*) without cast */
|
||||||
|
typedef struct TagunzFile__ { int unused; } unzFile__;
|
||||||
|
typedef unzFile__ *unzFile;
|
||||||
|
#else
|
||||||
|
typedef voidp unzFile;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define UNZ_OK (0)
|
||||||
|
#define UNZ_END_OF_LIST_OF_FILE (-100)
|
||||||
|
#define UNZ_ERRNO (Z_ERRNO)
|
||||||
|
#define UNZ_EOF (0)
|
||||||
|
#define UNZ_PARAMERROR (-102)
|
||||||
|
#define UNZ_BADZIPFILE (-103)
|
||||||
|
#define UNZ_INTERNALERROR (-104)
|
||||||
|
#define UNZ_CRCERROR (-105)
|
||||||
|
|
||||||
|
/* tm_unz contain date/time info */
|
||||||
|
typedef struct tm_unz_s
|
||||||
|
{
|
||||||
|
uInt tm_sec; /* seconds after the minute - [0,59] */
|
||||||
|
uInt tm_min; /* minutes after the hour - [0,59] */
|
||||||
|
uInt tm_hour; /* hours since midnight - [0,23] */
|
||||||
|
uInt tm_mday; /* day of the month - [1,31] */
|
||||||
|
uInt tm_mon; /* months since January - [0,11] */
|
||||||
|
uInt tm_year; /* years - [1980..2044] */
|
||||||
|
} tm_unz;
|
||||||
|
|
||||||
|
/* unz_global_info structure contain global data about the ZIPfile
|
||||||
|
These data comes from the end of central dir */
|
||||||
|
typedef struct unz_global_info_s
|
||||||
|
{
|
||||||
|
uLong number_entry; /* total number of entries in
|
||||||
|
the central dir on this disk */
|
||||||
|
uLong size_comment; /* size of the global comment of the zipfile */
|
||||||
|
} unz_global_info;
|
||||||
|
|
||||||
|
|
||||||
|
/* unz_file_info contain information about a file in the zipfile */
|
||||||
|
typedef struct unz_file_info_s
|
||||||
|
{
|
||||||
|
uLong version; /* version made by 2 bytes */
|
||||||
|
uLong version_needed; /* version needed to extract 2 bytes */
|
||||||
|
uLong flag; /* general purpose bit flag 2 bytes */
|
||||||
|
uLong compression_method; /* compression method 2 bytes */
|
||||||
|
uLong dosDate; /* last mod file date in Dos fmt 4 bytes */
|
||||||
|
uLong crc; /* crc-32 4 bytes */
|
||||||
|
uLong compressed_size; /* compressed size 4 bytes */
|
||||||
|
uLong uncompressed_size; /* uncompressed size 4 bytes */
|
||||||
|
uLong size_filename; /* filename length 2 bytes */
|
||||||
|
uLong size_file_extra; /* extra field length 2 bytes */
|
||||||
|
uLong size_file_comment; /* file comment length 2 bytes */
|
||||||
|
|
||||||
|
uLong disk_num_start; /* disk number start 2 bytes */
|
||||||
|
uLong internal_fa; /* internal file attributes 2 bytes */
|
||||||
|
uLong external_fa; /* external file attributes 4 bytes */
|
||||||
|
|
||||||
|
tm_unz tmu_date;
|
||||||
|
} unz_file_info;
|
||||||
|
|
||||||
|
extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
|
||||||
|
const char* fileName2,
|
||||||
|
int iCaseSensitivity));
|
||||||
|
/*
|
||||||
|
Compare two filename (fileName1,fileName2).
|
||||||
|
If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
|
||||||
|
If iCaseSenisivity = 2, comparision is not case sensitivity (like strcmpi
|
||||||
|
or strcasecmp)
|
||||||
|
If iCaseSenisivity = 0, case sensitivity is defaut of your operating system
|
||||||
|
(like 1 on Unix, 2 on Windows)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
extern unzFile ZEXPORT unzOpen OF((const char *path));
|
||||||
|
/*
|
||||||
|
Open a Zip file. path contain the full pathname (by example,
|
||||||
|
on a Windows XP computer "c:\\zlib\\zlib113.zip" or on an Unix computer
|
||||||
|
"zlib/zlib113.zip".
|
||||||
|
If the zipfile cannot be opened (file don't exist or in not valid), the
|
||||||
|
return value is NULL.
|
||||||
|
Else, the return value is a unzFile Handle, usable with other function
|
||||||
|
of this unzip package.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern unzFile ZEXPORT unzOpen2 OF((const char *path,
|
||||||
|
zlib_filefunc_def* pzlib_filefunc_def));
|
||||||
|
/*
|
||||||
|
Open a Zip file, like unzOpen, but provide a set of file low level API
|
||||||
|
for read/write the zip file (see ioapi.h)
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzClose OF((unzFile file));
|
||||||
|
/*
|
||||||
|
Close a ZipFile opened with unzipOpen.
|
||||||
|
If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
|
||||||
|
these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
|
||||||
|
return UNZ_OK if there is no problem. */
|
||||||
|
|
||||||
|
extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
|
||||||
|
unz_global_info *pglobal_info));
|
||||||
|
/*
|
||||||
|
Write info about the ZipFile in the *pglobal_info structure.
|
||||||
|
No preparation of the structure is needed
|
||||||
|
return UNZ_OK if there is no problem. */
|
||||||
|
|
||||||
|
|
||||||
|
extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
|
||||||
|
char *szComment,
|
||||||
|
uLong uSizeBuf));
|
||||||
|
/*
|
||||||
|
Get the global comment string of the ZipFile, in the szComment buffer.
|
||||||
|
uSizeBuf is the size of the szComment buffer.
|
||||||
|
return the number of byte copied or an error code <0
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/***************************************************************************/
|
||||||
|
/* Unzip package allow you browse the directory of the zipfile */
|
||||||
|
|
||||||
|
extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
|
||||||
|
/*
|
||||||
|
Set the current file of the zipfile to the first file.
|
||||||
|
return UNZ_OK if there is no problem
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzGoToNextFile OF((unzFile file));
|
||||||
|
/*
|
||||||
|
Set the current file of the zipfile to the next file.
|
||||||
|
return UNZ_OK if there is no problem
|
||||||
|
return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzLocateFile OF((unzFile file,
|
||||||
|
const char *szFileName,
|
||||||
|
int iCaseSensitivity));
|
||||||
|
/*
|
||||||
|
Try locate the file szFileName in the zipfile.
|
||||||
|
For the iCaseSensitivity signification, see unzStringFileNameCompare
|
||||||
|
|
||||||
|
return value :
|
||||||
|
UNZ_OK if the file is found. It becomes the current file.
|
||||||
|
UNZ_END_OF_LIST_OF_FILE if the file is not found
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/* ****************************************** */
|
||||||
|
/* Ryan supplied functions */
|
||||||
|
/* unz_file_info contain information about a file in the zipfile */
|
||||||
|
typedef struct unz_file_pos_s
|
||||||
|
{
|
||||||
|
uLong pos_in_zip_directory; /* offset in zip file directory */
|
||||||
|
uLong num_of_file; /* # of file */
|
||||||
|
} unz_file_pos;
|
||||||
|
|
||||||
|
extern int ZEXPORT unzGetFilePos(
|
||||||
|
unzFile file,
|
||||||
|
unz_file_pos* file_pos);
|
||||||
|
|
||||||
|
extern int ZEXPORT unzGoToFilePos(
|
||||||
|
unzFile file,
|
||||||
|
unz_file_pos* file_pos);
|
||||||
|
|
||||||
|
/* ****************************************** */
|
||||||
|
|
||||||
|
extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
|
||||||
|
unz_file_info *pfile_info,
|
||||||
|
char *szFileName,
|
||||||
|
uLong fileNameBufferSize,
|
||||||
|
void *extraField,
|
||||||
|
uLong extraFieldBufferSize,
|
||||||
|
char *szComment,
|
||||||
|
uLong commentBufferSize));
|
||||||
|
/*
|
||||||
|
Get Info about the current file
|
||||||
|
if pfile_info!=NULL, the *pfile_info structure will contain somes info about
|
||||||
|
the current file
|
||||||
|
if szFileName!=NULL, the filemane string will be copied in szFileName
|
||||||
|
(fileNameBufferSize is the size of the buffer)
|
||||||
|
if extraField!=NULL, the extra field information will be copied in extraField
|
||||||
|
(extraFieldBufferSize is the size of the buffer).
|
||||||
|
This is the Central-header version of the extra field
|
||||||
|
if szComment!=NULL, the comment string of the file will be copied in szComment
|
||||||
|
(commentBufferSize is the size of the buffer)
|
||||||
|
*/
|
||||||
|
|
||||||
|
/***************************************************************************/
|
||||||
|
/* for reading the content of the current zipfile, you can open it, read data
|
||||||
|
from it, and close it (you can close it before reading all the file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
|
||||||
|
/*
|
||||||
|
Open for reading data the current file in the zipfile.
|
||||||
|
If there is no error, the return value is UNZ_OK.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzOpenCurrentFilePassword OF((unzFile file,
|
||||||
|
const char* password));
|
||||||
|
/*
|
||||||
|
Open for reading data the current file in the zipfile.
|
||||||
|
password is a crypting password
|
||||||
|
If there is no error, the return value is UNZ_OK.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzOpenCurrentFile2 OF((unzFile file,
|
||||||
|
int* method,
|
||||||
|
int* level,
|
||||||
|
int raw));
|
||||||
|
/*
|
||||||
|
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
||||||
|
if raw==1
|
||||||
|
*method will receive method of compression, *level will receive level of
|
||||||
|
compression
|
||||||
|
note : you can set level parameter as NULL (if you did not want known level,
|
||||||
|
but you CANNOT set method parameter as NULL
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzOpenCurrentFile3 OF((unzFile file,
|
||||||
|
int* method,
|
||||||
|
int* level,
|
||||||
|
int raw,
|
||||||
|
const char* password));
|
||||||
|
/*
|
||||||
|
Same than unzOpenCurrentFile, but open for read raw the file (not uncompress)
|
||||||
|
if raw==1
|
||||||
|
*method will receive method of compression, *level will receive level of
|
||||||
|
compression
|
||||||
|
note : you can set level parameter as NULL (if you did not want known level,
|
||||||
|
but you CANNOT set method parameter as NULL
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
|
||||||
|
/*
|
||||||
|
Close the file in zip opened with unzOpenCurrentFile
|
||||||
|
Return UNZ_CRCERROR if all the file was read but the CRC is not good
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
|
||||||
|
voidp buf,
|
||||||
|
unsigned len));
|
||||||
|
/*
|
||||||
|
Read bytes from the current file (opened by unzOpenCurrentFile)
|
||||||
|
buf contain buffer where data must be copied
|
||||||
|
len the size of buf.
|
||||||
|
|
||||||
|
return the number of byte copied if somes bytes are copied
|
||||||
|
return 0 if the end of file was reached
|
||||||
|
return <0 with error code if there is an error
|
||||||
|
(UNZ_ERRNO for IO error, or zLib error for uncompress error)
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern z_off_t ZEXPORT unztell OF((unzFile file));
|
||||||
|
/*
|
||||||
|
Give the current position in uncompressed data
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzeof OF((unzFile file));
|
||||||
|
/*
|
||||||
|
return 1 if the end of file was reached, 0 elsewhere
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
|
||||||
|
voidp buf,
|
||||||
|
unsigned len));
|
||||||
|
/*
|
||||||
|
Read extra field from the current file (opened by unzOpenCurrentFile)
|
||||||
|
This is the local-header version of the extra field (sometimes, there is
|
||||||
|
more info in the local-header version than in the central-header)
|
||||||
|
|
||||||
|
if buf==NULL, it return the size of the local extra field
|
||||||
|
|
||||||
|
if buf!=NULL, len is the size of the buffer, the extra header is copied in
|
||||||
|
buf.
|
||||||
|
the return value is the number of bytes copied in buf, or (if <0)
|
||||||
|
the error code
|
||||||
|
*/
|
||||||
|
|
||||||
|
/***************************************************************************/
|
||||||
|
|
||||||
|
/* Get the current file offset */
|
||||||
|
extern uLong ZEXPORT unzGetOffset (unzFile file);
|
||||||
|
|
||||||
|
/* Set the current file offset */
|
||||||
|
extern int ZEXPORT unzSetOffset (unzFile file, uLong pos);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _unz_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,237 @@
|
||||||
|
/* zip.h -- IO for compress .zip files using zlib
|
||||||
|
Version 1.01e, February 12th, 2005
|
||||||
|
|
||||||
|
Copyright (C) 1998-2005 Gilles Vollant
|
||||||
|
|
||||||
|
This unzip package allow creates .ZIP file, compatible with PKZip 2.04g
|
||||||
|
WinZip, InfoZip tools and compatible.
|
||||||
|
Multi volume ZipFile (span) are not supported.
|
||||||
|
Encryption compatible with pkzip 2.04g only supported
|
||||||
|
Old compressions used by old PKZip 1.x are not supported
|
||||||
|
|
||||||
|
For uncompress .zip file, look at unzip.h
|
||||||
|
|
||||||
|
|
||||||
|
I WAIT FEEDBACK at mail info@winimage.com
|
||||||
|
Visit also http://www.winimage.com/zLibDll/unzip.html for evolution
|
||||||
|
|
||||||
|
Condition of use and distribution are the same than zlib :
|
||||||
|
|
||||||
|
This software is provided 'as-is', without any express or implied
|
||||||
|
warranty. In no event will the authors be held liable for any damages
|
||||||
|
arising from the use of this software.
|
||||||
|
|
||||||
|
Permission is granted to anyone to use this software for any purpose,
|
||||||
|
including commercial applications, and to alter it and redistribute it
|
||||||
|
freely, subject to the following restrictions:
|
||||||
|
|
||||||
|
1. The origin of this software must not be misrepresented; you must not
|
||||||
|
claim that you wrote the original software. If you use this software
|
||||||
|
in a product, an acknowledgment in the product documentation would be
|
||||||
|
appreciated but is not required.
|
||||||
|
2. Altered source versions must be plainly marked as such, and must not be
|
||||||
|
misrepresented as being the original software.
|
||||||
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* for more info about .ZIP format, see
|
||||||
|
http://www.info-zip.org/pub/infozip/doc/appnote-981119-iz.zip
|
||||||
|
http://www.info-zip.org/pub/infozip/doc/
|
||||||
|
PkWare has also a specification at :
|
||||||
|
ftp://ftp.pkware.com/probdesc.zip
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _zip_H
|
||||||
|
#define _zip_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(USE_SYSTEM_ZLIB)
|
||||||
|
#include <zlib.h>
|
||||||
|
#else
|
||||||
|
#include "../../zlib.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _ZLIBIOAPI_H
|
||||||
|
#include "ioapi.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(STRICTZIP) || defined(STRICTZIPUNZIP)
|
||||||
|
/* like the STRICT of WIN32, we define a pointer that cannot be converted
|
||||||
|
from (void*) without cast */
|
||||||
|
typedef struct TagzipFile__ { int unused; } zipFile__;
|
||||||
|
typedef zipFile__ *zipFile;
|
||||||
|
#else
|
||||||
|
typedef voidp zipFile;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ZIP_OK (0)
|
||||||
|
#define ZIP_EOF (0)
|
||||||
|
#define ZIP_ERRNO (Z_ERRNO)
|
||||||
|
#define ZIP_PARAMERROR (-102)
|
||||||
|
#define ZIP_BADZIPFILE (-103)
|
||||||
|
#define ZIP_INTERNALERROR (-104)
|
||||||
|
|
||||||
|
#ifndef DEF_MEM_LEVEL
|
||||||
|
# if MAX_MEM_LEVEL >= 8
|
||||||
|
# define DEF_MEM_LEVEL 8
|
||||||
|
# else
|
||||||
|
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
/* default memLevel */
|
||||||
|
|
||||||
|
/* tm_zip contain date/time info */
|
||||||
|
typedef struct tm_zip_s
|
||||||
|
{
|
||||||
|
uInt tm_sec; /* seconds after the minute - [0,59] */
|
||||||
|
uInt tm_min; /* minutes after the hour - [0,59] */
|
||||||
|
uInt tm_hour; /* hours since midnight - [0,23] */
|
||||||
|
uInt tm_mday; /* day of the month - [1,31] */
|
||||||
|
uInt tm_mon; /* months since January - [0,11] */
|
||||||
|
uInt tm_year; /* years - [1980..2044] */
|
||||||
|
} tm_zip;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
tm_zip tmz_date; /* date in understandable format */
|
||||||
|
uLong dosDate; /* if dos_date == 0, tmu_date is used */
|
||||||
|
/* uLong flag; */ /* general purpose bit flag 2 bytes */
|
||||||
|
|
||||||
|
uLong internal_fa; /* internal file attributes 2 bytes */
|
||||||
|
uLong external_fa; /* external file attributes 4 bytes */
|
||||||
|
} zip_fileinfo;
|
||||||
|
|
||||||
|
typedef const char* zipcharpc;
|
||||||
|
|
||||||
|
|
||||||
|
#define APPEND_STATUS_CREATE (0)
|
||||||
|
#define APPEND_STATUS_CREATEAFTER (1)
|
||||||
|
#define APPEND_STATUS_ADDINZIP (2)
|
||||||
|
|
||||||
|
extern zipFile ZEXPORT zipOpen OF((const char *pathname, int append));
|
||||||
|
/*
|
||||||
|
Create a zipfile.
|
||||||
|
pathname contain on Windows XP a filename like "c:\\zlib\\zlib113.zip" or on
|
||||||
|
an Unix computer "zlib/zlib113.zip".
|
||||||
|
if the file pathname exist and append==APPEND_STATUS_CREATEAFTER, the zip
|
||||||
|
will be created at the end of the file.
|
||||||
|
(useful if the file contain a self extractor code)
|
||||||
|
if the file pathname exist and append==APPEND_STATUS_ADDINZIP, we will
|
||||||
|
add files in existing zip (be sure you don't add file that doesn't exist)
|
||||||
|
If the zipfile cannot be opened, the return value is NULL.
|
||||||
|
Else, the return value is a zipFile Handle, usable with other function
|
||||||
|
of this zip package.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Note : there is no delete function into a zipfile.
|
||||||
|
If you want delete file into a zipfile, you must open a zipfile, and create another
|
||||||
|
Of couse, you can use RAW reading and writing to copy the file you did not want delte
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern zipFile ZEXPORT zipOpen2 OF((const char *pathname,
|
||||||
|
int append,
|
||||||
|
zipcharpc* globalcomment,
|
||||||
|
zlib_filefunc_def* pzlib_filefunc_def));
|
||||||
|
|
||||||
|
extern int ZEXPORT zipOpenNewFileInZip OF((zipFile file,
|
||||||
|
const char* filename,
|
||||||
|
const zip_fileinfo* zipfi,
|
||||||
|
const void* extrafield_local,
|
||||||
|
uInt size_extrafield_local,
|
||||||
|
const void* extrafield_global,
|
||||||
|
uInt size_extrafield_global,
|
||||||
|
const char* comment,
|
||||||
|
int method,
|
||||||
|
int level));
|
||||||
|
/*
|
||||||
|
Open a file in the ZIP for writing.
|
||||||
|
filename : the filename in zip (if NULL, '-' without quote will be used
|
||||||
|
*zipfi contain supplemental information
|
||||||
|
if extrafield_local!=NULL and size_extrafield_local>0, extrafield_local
|
||||||
|
contains the extrafield data the the local header
|
||||||
|
if extrafield_global!=NULL and size_extrafield_global>0, extrafield_global
|
||||||
|
contains the extrafield data the the local header
|
||||||
|
if comment != NULL, comment contain the comment string
|
||||||
|
method contain the compression method (0 for store, Z_DEFLATED for deflate)
|
||||||
|
level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
extern int ZEXPORT zipOpenNewFileInZip2 OF((zipFile file,
|
||||||
|
const char* filename,
|
||||||
|
const zip_fileinfo* zipfi,
|
||||||
|
const void* extrafield_local,
|
||||||
|
uInt size_extrafield_local,
|
||||||
|
const void* extrafield_global,
|
||||||
|
uInt size_extrafield_global,
|
||||||
|
const char* comment,
|
||||||
|
int method,
|
||||||
|
int level,
|
||||||
|
int raw));
|
||||||
|
|
||||||
|
/*
|
||||||
|
Same than zipOpenNewFileInZip, except if raw=1, we write raw file
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT zipOpenNewFileInZip3 OF((zipFile file,
|
||||||
|
const char* filename,
|
||||||
|
const zip_fileinfo* zipfi,
|
||||||
|
const void* extrafield_local,
|
||||||
|
uInt size_extrafield_local,
|
||||||
|
const void* extrafield_global,
|
||||||
|
uInt size_extrafield_global,
|
||||||
|
const char* comment,
|
||||||
|
int method,
|
||||||
|
int level,
|
||||||
|
int raw,
|
||||||
|
int windowBits,
|
||||||
|
int memLevel,
|
||||||
|
int strategy,
|
||||||
|
const char* password,
|
||||||
|
uLong crcForCtypting));
|
||||||
|
|
||||||
|
/*
|
||||||
|
Same than zipOpenNewFileInZip2, except
|
||||||
|
windowBits,memLevel,,strategy : see parameter strategy in deflateInit2
|
||||||
|
password : crypting password (NULL for no crypting)
|
||||||
|
crcForCtypting : crc of file to compress (needed for crypting)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
extern int ZEXPORT zipWriteInFileInZip OF((zipFile file,
|
||||||
|
const void* buf,
|
||||||
|
unsigned len));
|
||||||
|
/*
|
||||||
|
Write data in the zipfile
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT zipCloseFileInZip OF((zipFile file));
|
||||||
|
/*
|
||||||
|
Close the current file in the zipfile
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT zipCloseFileInZipRaw OF((zipFile file,
|
||||||
|
uLong uncompressed_size,
|
||||||
|
uLong crc32));
|
||||||
|
/*
|
||||||
|
Close the current file in the zipfile, for fiel opened with
|
||||||
|
parameter raw=1 in zipOpenNewFileInZip2
|
||||||
|
uncompressed_size and crc32 are value for the uncompressed size
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern int ZEXPORT zipClose OF((zipFile file,
|
||||||
|
const char* global_comment));
|
||||||
|
/*
|
||||||
|
Close the zipfile
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _zip_H */
|
|
@ -1,5 +1,5 @@
|
||||||
/* crc32.c -- compute the CRC-32 of a data stream
|
/* crc32.c -- compute the CRC-32 of a data stream
|
||||||
* Copyright (C) 1995-2005 Mark Adler
|
* Copyright (C) 1995-2006, 2010 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*
|
*
|
||||||
* Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
|
* Thanks to Rodney Brown <rbrown64@csc.com.au> for his contribution of faster
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
|
|
||||||
/* Definitions for doing the crc four data bytes at a time. */
|
/* Definitions for doing the crc four data bytes at a time. */
|
||||||
#ifdef BYFOUR
|
#ifdef BYFOUR
|
||||||
# define REV(w) (((w)>>24)+(((w)>>8)&0xff00)+ \
|
# define REV(w) ((((w)>>24)&0xff)+(((w)>>8)&0xff00)+ \
|
||||||
(((w)&0xff00)<<8)+(((w)&0xff)<<24))
|
(((w)&0xff00)<<8)+(((w)&0xff)<<24))
|
||||||
local unsigned long crc32_little OF((unsigned long,
|
local unsigned long crc32_little OF((unsigned long,
|
||||||
const unsigned char FAR *, unsigned));
|
const unsigned char FAR *, unsigned));
|
||||||
|
@ -68,6 +68,8 @@
|
||||||
local unsigned long gf2_matrix_times OF((unsigned long *mat,
|
local unsigned long gf2_matrix_times OF((unsigned long *mat,
|
||||||
unsigned long vec));
|
unsigned long vec));
|
||||||
local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
|
local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat));
|
||||||
|
local uLong crc32_combine_(uLong crc1, uLong crc2, z_off64_t len2);
|
||||||
|
|
||||||
|
|
||||||
#ifdef DYNAMIC_CRC_TABLE
|
#ifdef DYNAMIC_CRC_TABLE
|
||||||
|
|
||||||
|
@ -219,7 +221,7 @@ const unsigned long FAR * ZEXPORT get_crc_table()
|
||||||
unsigned long ZEXPORT crc32(crc, buf, len)
|
unsigned long ZEXPORT crc32(crc, buf, len)
|
||||||
unsigned long crc;
|
unsigned long crc;
|
||||||
const unsigned char FAR *buf;
|
const unsigned char FAR *buf;
|
||||||
unsigned len;
|
uInt len;
|
||||||
{
|
{
|
||||||
if (buf == Z_NULL) return 0UL;
|
if (buf == Z_NULL) return 0UL;
|
||||||
|
|
||||||
|
@ -367,22 +369,22 @@ local void gf2_matrix_square(square, mat)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ========================================================================= */
|
/* ========================================================================= */
|
||||||
uLong ZEXPORT crc32_combine(crc1, crc2, len2)
|
local uLong crc32_combine_(crc1, crc2, len2)
|
||||||
uLong crc1;
|
uLong crc1;
|
||||||
uLong crc2;
|
uLong crc2;
|
||||||
z_off_t len2;
|
z_off64_t len2;
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
unsigned long row;
|
unsigned long row;
|
||||||
unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */
|
unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */
|
||||||
unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */
|
unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */
|
||||||
|
|
||||||
/* degenerate case */
|
/* degenerate case (also disallow negative lengths) */
|
||||||
if (len2 == 0)
|
if (len2 <= 0)
|
||||||
return crc1;
|
return crc1;
|
||||||
|
|
||||||
/* put operator for one zero bit in odd */
|
/* put operator for one zero bit in odd */
|
||||||
odd[0] = 0xedb88320L; /* CRC-32 polynomial */
|
odd[0] = 0xedb88320UL; /* CRC-32 polynomial */
|
||||||
row = 1;
|
row = 1;
|
||||||
for (n = 1; n < GF2_DIM; n++) {
|
for (n = 1; n < GF2_DIM; n++) {
|
||||||
odd[n] = row;
|
odd[n] = row;
|
||||||
|
@ -421,3 +423,20 @@ uLong ZEXPORT crc32_combine(crc1, crc2, len2)
|
||||||
crc1 ^= crc2;
|
crc1 ^= crc2;
|
||||||
return crc1;
|
return crc1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ========================================================================= */
|
||||||
|
uLong ZEXPORT crc32_combine(crc1, crc2, len2)
|
||||||
|
uLong crc1;
|
||||||
|
uLong crc2;
|
||||||
|
z_off_t len2;
|
||||||
|
{
|
||||||
|
return crc32_combine_(crc1, crc2, len2);
|
||||||
|
}
|
||||||
|
|
||||||
|
uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
|
||||||
|
uLong crc1;
|
||||||
|
uLong crc2;
|
||||||
|
z_off64_t len2;
|
||||||
|
{
|
||||||
|
return crc32_combine_(crc1, crc2, len2);
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* deflate.c -- compress data using the deflation algorithm
|
/* deflate.c -- compress data using the deflation algorithm
|
||||||
* Copyright (C) 1995-2005 Jean-loup Gailly.
|
* Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
#include "deflate.h"
|
#include "deflate.h"
|
||||||
|
|
||||||
const char deflate_copyright[] =
|
const char deflate_copyright[] =
|
||||||
" deflate 1.2.3 Copyright 1995-2005 Jean-loup Gailly ";
|
" deflate 1.2.5 Copyright 1995-2010 Jean-loup Gailly and Mark Adler ";
|
||||||
/*
|
/*
|
||||||
If you use the zlib library in a product, an acknowledgment is welcome
|
If you use the zlib library in a product, an acknowledgment is welcome
|
||||||
in the documentation of your product. If for some reason you cannot
|
in the documentation of your product. If for some reason you cannot
|
||||||
|
@ -79,19 +79,18 @@ local block_state deflate_fast OF((deflate_state *s, int flush));
|
||||||
#ifndef FASTEST
|
#ifndef FASTEST
|
||||||
local block_state deflate_slow OF((deflate_state *s, int flush));
|
local block_state deflate_slow OF((deflate_state *s, int flush));
|
||||||
#endif
|
#endif
|
||||||
|
local block_state deflate_rle OF((deflate_state *s, int flush));
|
||||||
|
local block_state deflate_huff OF((deflate_state *s, int flush));
|
||||||
local void lm_init OF((deflate_state *s));
|
local void lm_init OF((deflate_state *s));
|
||||||
local void putShortMSB OF((deflate_state *s, uInt b));
|
local void putShortMSB OF((deflate_state *s, uInt b));
|
||||||
local void flush_pending OF((z_streamp strm));
|
local void flush_pending OF((z_streamp strm));
|
||||||
local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
|
local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
|
||||||
#ifndef FASTEST
|
|
||||||
#ifdef ASMV
|
#ifdef ASMV
|
||||||
void match_init OF((void)); /* asm code initialization */
|
void match_init OF((void)); /* asm code initialization */
|
||||||
uInt longest_match OF((deflate_state *s, IPos cur_match));
|
uInt longest_match OF((deflate_state *s, IPos cur_match));
|
||||||
#else
|
#else
|
||||||
local uInt longest_match OF((deflate_state *s, IPos cur_match));
|
local uInt longest_match OF((deflate_state *s, IPos cur_match));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
local uInt longest_match_fast OF((deflate_state *s, IPos cur_match));
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
local void check_match OF((deflate_state *s, IPos start, IPos match,
|
local void check_match OF((deflate_state *s, IPos start, IPos match,
|
||||||
|
@ -110,11 +109,6 @@ local void check_match OF((deflate_state *s, IPos start, IPos match,
|
||||||
#endif
|
#endif
|
||||||
/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
|
/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */
|
||||||
|
|
||||||
#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
|
|
||||||
/* Minimum amount of lookahead, except at the end of the input file.
|
|
||||||
* See deflate.c for comments about the MIN_MATCH+1.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Values for max_lazy_match, good_match and max_chain_length, depending on
|
/* Values for max_lazy_match, good_match and max_chain_length, depending on
|
||||||
* the desired pack level (0..9). The values given below have been tuned to
|
* the desired pack level (0..9). The values given below have been tuned to
|
||||||
* exclude worst case performance for pathological files. Better values may be
|
* exclude worst case performance for pathological files. Better values may be
|
||||||
|
@ -288,6 +282,8 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
||||||
s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
|
s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
|
||||||
s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));
|
s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));
|
||||||
|
|
||||||
|
s->high_water = 0; /* nothing written to s->window yet */
|
||||||
|
|
||||||
s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
|
s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */
|
||||||
|
|
||||||
overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
|
overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2);
|
||||||
|
@ -332,8 +328,8 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
|
||||||
strm->adler = adler32(strm->adler, dictionary, dictLength);
|
strm->adler = adler32(strm->adler, dictionary, dictLength);
|
||||||
|
|
||||||
if (length < MIN_MATCH) return Z_OK;
|
if (length < MIN_MATCH) return Z_OK;
|
||||||
if (length > MAX_DIST(s)) {
|
if (length > s->w_size) {
|
||||||
length = MAX_DIST(s);
|
length = s->w_size;
|
||||||
dictionary += dictLength - length; /* use the tail of the dictionary */
|
dictionary += dictLength - length; /* use the tail of the dictionary */
|
||||||
}
|
}
|
||||||
zmemcpy(s->window, dictionary, length);
|
zmemcpy(s->window, dictionary, length);
|
||||||
|
@ -435,9 +431,10 @@ int ZEXPORT deflateParams(strm, level, strategy)
|
||||||
}
|
}
|
||||||
func = configuration_table[s->level].func;
|
func = configuration_table[s->level].func;
|
||||||
|
|
||||||
if (func != configuration_table[level].func && strm->total_in != 0) {
|
if ((strategy != s->strategy || func != configuration_table[level].func) &&
|
||||||
|
strm->total_in != 0) {
|
||||||
/* Flush the last buffer: */
|
/* Flush the last buffer: */
|
||||||
err = deflate(strm, Z_PARTIAL_FLUSH);
|
err = deflate(strm, Z_BLOCK);
|
||||||
}
|
}
|
||||||
if (s->level != level) {
|
if (s->level != level) {
|
||||||
s->level = level;
|
s->level = level;
|
||||||
|
@ -481,33 +478,66 @@ int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain)
|
||||||
* resulting from using fixed blocks instead of stored blocks, which deflate
|
* resulting from using fixed blocks instead of stored blocks, which deflate
|
||||||
* can emit on compressed data for some combinations of the parameters.
|
* can emit on compressed data for some combinations of the parameters.
|
||||||
*
|
*
|
||||||
* This function could be more sophisticated to provide closer upper bounds
|
* This function could be more sophisticated to provide closer upper bounds for
|
||||||
* for every combination of windowBits and memLevel, as well as wrap.
|
* every combination of windowBits and memLevel. But even the conservative
|
||||||
* But even the conservative upper bound of about 14% expansion does not
|
* upper bound of about 14% expansion does not seem onerous for output buffer
|
||||||
* seem onerous for output buffer allocation.
|
* allocation.
|
||||||
*/
|
*/
|
||||||
uLong ZEXPORT deflateBound(strm, sourceLen)
|
uLong ZEXPORT deflateBound(strm, sourceLen)
|
||||||
z_streamp strm;
|
z_streamp strm;
|
||||||
uLong sourceLen;
|
uLong sourceLen;
|
||||||
{
|
{
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
uLong destLen;
|
uLong complen, wraplen;
|
||||||
|
Bytef *str;
|
||||||
|
|
||||||
/* conservative upper bound */
|
/* conservative upper bound for compressed data */
|
||||||
destLen = sourceLen +
|
complen = sourceLen +
|
||||||
((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 11;
|
((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5;
|
||||||
|
|
||||||
/* if can't get parameters, return conservative bound */
|
/* if can't get parameters, return conservative bound plus zlib wrapper */
|
||||||
if (strm == Z_NULL || strm->state == Z_NULL)
|
if (strm == Z_NULL || strm->state == Z_NULL)
|
||||||
return destLen;
|
return complen + 6;
|
||||||
|
|
||||||
|
/* compute wrapper length */
|
||||||
|
s = strm->state;
|
||||||
|
switch (s->wrap) {
|
||||||
|
case 0: /* raw deflate */
|
||||||
|
wraplen = 0;
|
||||||
|
break;
|
||||||
|
case 1: /* zlib wrapper */
|
||||||
|
wraplen = 6 + (s->strstart ? 4 : 0);
|
||||||
|
break;
|
||||||
|
case 2: /* gzip wrapper */
|
||||||
|
wraplen = 18;
|
||||||
|
if (s->gzhead != Z_NULL) { /* user-supplied gzip header */
|
||||||
|
if (s->gzhead->extra != Z_NULL)
|
||||||
|
wraplen += 2 + s->gzhead->extra_len;
|
||||||
|
str = s->gzhead->name;
|
||||||
|
if (str != Z_NULL)
|
||||||
|
do {
|
||||||
|
wraplen++;
|
||||||
|
} while (*str++);
|
||||||
|
str = s->gzhead->comment;
|
||||||
|
if (str != Z_NULL)
|
||||||
|
do {
|
||||||
|
wraplen++;
|
||||||
|
} while (*str++);
|
||||||
|
if (s->gzhead->hcrc)
|
||||||
|
wraplen += 2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default: /* for compiler happiness */
|
||||||
|
wraplen = 6;
|
||||||
|
}
|
||||||
|
|
||||||
/* if not default parameters, return conservative bound */
|
/* if not default parameters, return conservative bound */
|
||||||
s = strm->state;
|
|
||||||
if (s->w_bits != 15 || s->hash_bits != 8 + 7)
|
if (s->w_bits != 15 || s->hash_bits != 8 + 7)
|
||||||
return destLen;
|
return complen + wraplen;
|
||||||
|
|
||||||
/* default settings: return tight bound for that case */
|
/* default settings: return tight bound for that case */
|
||||||
return compressBound(sourceLen);
|
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
|
||||||
|
(sourceLen >> 25) + 13 - 6 + wraplen;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* =========================================================================
|
/* =========================================================================
|
||||||
|
@ -557,7 +587,7 @@ int ZEXPORT deflate (strm, flush)
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
|
|
||||||
if (strm == Z_NULL || strm->state == Z_NULL ||
|
if (strm == Z_NULL || strm->state == Z_NULL ||
|
||||||
flush > Z_FINISH || flush < 0) {
|
flush > Z_BLOCK || flush < 0) {
|
||||||
return Z_STREAM_ERROR;
|
return Z_STREAM_ERROR;
|
||||||
}
|
}
|
||||||
s = strm->state;
|
s = strm->state;
|
||||||
|
@ -581,7 +611,7 @@ int ZEXPORT deflate (strm, flush)
|
||||||
put_byte(s, 31);
|
put_byte(s, 31);
|
||||||
put_byte(s, 139);
|
put_byte(s, 139);
|
||||||
put_byte(s, 8);
|
put_byte(s, 8);
|
||||||
if (s->gzhead == NULL) {
|
if (s->gzhead == Z_NULL) {
|
||||||
put_byte(s, 0);
|
put_byte(s, 0);
|
||||||
put_byte(s, 0);
|
put_byte(s, 0);
|
||||||
put_byte(s, 0);
|
put_byte(s, 0);
|
||||||
|
@ -608,7 +638,7 @@ int ZEXPORT deflate (strm, flush)
|
||||||
(s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
|
(s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ?
|
||||||
4 : 0));
|
4 : 0));
|
||||||
put_byte(s, s->gzhead->os & 0xff);
|
put_byte(s, s->gzhead->os & 0xff);
|
||||||
if (s->gzhead->extra != NULL) {
|
if (s->gzhead->extra != Z_NULL) {
|
||||||
put_byte(s, s->gzhead->extra_len & 0xff);
|
put_byte(s, s->gzhead->extra_len & 0xff);
|
||||||
put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);
|
put_byte(s, (s->gzhead->extra_len >> 8) & 0xff);
|
||||||
}
|
}
|
||||||
|
@ -650,7 +680,7 @@ int ZEXPORT deflate (strm, flush)
|
||||||
}
|
}
|
||||||
#ifdef GZIP
|
#ifdef GZIP
|
||||||
if (s->status == EXTRA_STATE) {
|
if (s->status == EXTRA_STATE) {
|
||||||
if (s->gzhead->extra != NULL) {
|
if (s->gzhead->extra != Z_NULL) {
|
||||||
uInt beg = s->pending; /* start of bytes to update crc */
|
uInt beg = s->pending; /* start of bytes to update crc */
|
||||||
|
|
||||||
while (s->gzindex < (s->gzhead->extra_len & 0xffff)) {
|
while (s->gzindex < (s->gzhead->extra_len & 0xffff)) {
|
||||||
|
@ -678,7 +708,7 @@ int ZEXPORT deflate (strm, flush)
|
||||||
s->status = NAME_STATE;
|
s->status = NAME_STATE;
|
||||||
}
|
}
|
||||||
if (s->status == NAME_STATE) {
|
if (s->status == NAME_STATE) {
|
||||||
if (s->gzhead->name != NULL) {
|
if (s->gzhead->name != Z_NULL) {
|
||||||
uInt beg = s->pending; /* start of bytes to update crc */
|
uInt beg = s->pending; /* start of bytes to update crc */
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
|
@ -709,7 +739,7 @@ int ZEXPORT deflate (strm, flush)
|
||||||
s->status = COMMENT_STATE;
|
s->status = COMMENT_STATE;
|
||||||
}
|
}
|
||||||
if (s->status == COMMENT_STATE) {
|
if (s->status == COMMENT_STATE) {
|
||||||
if (s->gzhead->comment != NULL) {
|
if (s->gzhead->comment != Z_NULL) {
|
||||||
uInt beg = s->pending; /* start of bytes to update crc */
|
uInt beg = s->pending; /* start of bytes to update crc */
|
||||||
int val;
|
int val;
|
||||||
|
|
||||||
|
@ -787,7 +817,9 @@ int ZEXPORT deflate (strm, flush)
|
||||||
(flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
|
(flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
|
||||||
block_state bstate;
|
block_state bstate;
|
||||||
|
|
||||||
bstate = (*(configuration_table[s->level].func))(s, flush);
|
bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :
|
||||||
|
(s->strategy == Z_RLE ? deflate_rle(s, flush) :
|
||||||
|
(*(configuration_table[s->level].func))(s, flush));
|
||||||
|
|
||||||
if (bstate == finish_started || bstate == finish_done) {
|
if (bstate == finish_started || bstate == finish_done) {
|
||||||
s->status = FINISH_STATE;
|
s->status = FINISH_STATE;
|
||||||
|
@ -808,13 +840,17 @@ int ZEXPORT deflate (strm, flush)
|
||||||
if (bstate == block_done) {
|
if (bstate == block_done) {
|
||||||
if (flush == Z_PARTIAL_FLUSH) {
|
if (flush == Z_PARTIAL_FLUSH) {
|
||||||
_tr_align(s);
|
_tr_align(s);
|
||||||
} else { /* FULL_FLUSH or SYNC_FLUSH */
|
} else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */
|
||||||
_tr_stored_block(s, (char*)0, 0L, 0);
|
_tr_stored_block(s, (char*)0, 0L, 0);
|
||||||
/* For a full flush, this empty block will be recognized
|
/* For a full flush, this empty block will be recognized
|
||||||
* as a special marker by inflate_sync().
|
* as a special marker by inflate_sync().
|
||||||
*/
|
*/
|
||||||
if (flush == Z_FULL_FLUSH) {
|
if (flush == Z_FULL_FLUSH) {
|
||||||
CLEAR_HASH(s); /* forget history */
|
CLEAR_HASH(s); /* forget history */
|
||||||
|
if (s->lookahead == 0) {
|
||||||
|
s->strstart = 0;
|
||||||
|
s->block_start = 0L;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
flush_pending(strm);
|
flush_pending(strm);
|
||||||
|
@ -1167,12 +1203,13 @@ local uInt longest_match(s, cur_match)
|
||||||
return s->lookahead;
|
return s->lookahead;
|
||||||
}
|
}
|
||||||
#endif /* ASMV */
|
#endif /* ASMV */
|
||||||
#endif /* FASTEST */
|
|
||||||
|
#else /* FASTEST */
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------------
|
/* ---------------------------------------------------------------------------
|
||||||
* Optimized version for level == 1 or strategy == Z_RLE only
|
* Optimized version for FASTEST only
|
||||||
*/
|
*/
|
||||||
local uInt longest_match_fast(s, cur_match)
|
local uInt longest_match(s, cur_match)
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
IPos cur_match; /* current match */
|
IPos cur_match; /* current match */
|
||||||
{
|
{
|
||||||
|
@ -1225,6 +1262,8 @@ local uInt longest_match_fast(s, cur_match)
|
||||||
return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead;
|
return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* FASTEST */
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Check that the match at match_start is indeed a match.
|
* Check that the match at match_start is indeed a match.
|
||||||
|
@ -1303,7 +1342,6 @@ local void fill_window(s)
|
||||||
later. (Using level 0 permanently is not an optimal usage of
|
later. (Using level 0 permanently is not an optimal usage of
|
||||||
zlib, so we don't care about this pathological case.)
|
zlib, so we don't care about this pathological case.)
|
||||||
*/
|
*/
|
||||||
/* %%% avoid this when Z_RLE */
|
|
||||||
n = s->hash_size;
|
n = s->hash_size;
|
||||||
p = &s->head[n];
|
p = &s->head[n];
|
||||||
do {
|
do {
|
||||||
|
@ -1355,27 +1393,61 @@ local void fill_window(s)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
} while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
|
} while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0);
|
||||||
|
|
||||||
|
/* If the WIN_INIT bytes after the end of the current data have never been
|
||||||
|
* written, then zero those bytes in order to avoid memory check reports of
|
||||||
|
* the use of uninitialized (or uninitialised as Julian writes) bytes by
|
||||||
|
* the longest match routines. Update the high water mark for the next
|
||||||
|
* time through here. WIN_INIT is set to MAX_MATCH since the longest match
|
||||||
|
* routines allow scanning to strstart + MAX_MATCH, ignoring lookahead.
|
||||||
|
*/
|
||||||
|
if (s->high_water < s->window_size) {
|
||||||
|
ulg curr = s->strstart + (ulg)(s->lookahead);
|
||||||
|
ulg init;
|
||||||
|
|
||||||
|
if (s->high_water < curr) {
|
||||||
|
/* Previous high water mark below current data -- zero WIN_INIT
|
||||||
|
* bytes or up to end of window, whichever is less.
|
||||||
|
*/
|
||||||
|
init = s->window_size - curr;
|
||||||
|
if (init > WIN_INIT)
|
||||||
|
init = WIN_INIT;
|
||||||
|
zmemzero(s->window + curr, (unsigned)init);
|
||||||
|
s->high_water = curr + init;
|
||||||
|
}
|
||||||
|
else if (s->high_water < (ulg)curr + WIN_INIT) {
|
||||||
|
/* High water mark at or above current data, but below current data
|
||||||
|
* plus WIN_INIT -- zero out to current data plus WIN_INIT, or up
|
||||||
|
* to end of window, whichever is less.
|
||||||
|
*/
|
||||||
|
init = (ulg)curr + WIN_INIT - s->high_water;
|
||||||
|
if (init > s->window_size - s->high_water)
|
||||||
|
init = s->window_size - s->high_water;
|
||||||
|
zmemzero(s->window + s->high_water, (unsigned)init);
|
||||||
|
s->high_water += init;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Flush the current block, with given end-of-file flag.
|
* Flush the current block, with given end-of-file flag.
|
||||||
* IN assertion: strstart is set to the end of the current match.
|
* IN assertion: strstart is set to the end of the current match.
|
||||||
*/
|
*/
|
||||||
#define FLUSH_BLOCK_ONLY(s, eof) { \
|
#define FLUSH_BLOCK_ONLY(s, last) { \
|
||||||
_tr_flush_block(s, (s->block_start >= 0L ? \
|
_tr_flush_block(s, (s->block_start >= 0L ? \
|
||||||
(charf *)&s->window[(unsigned)s->block_start] : \
|
(charf *)&s->window[(unsigned)s->block_start] : \
|
||||||
(charf *)Z_NULL), \
|
(charf *)Z_NULL), \
|
||||||
(ulg)((long)s->strstart - s->block_start), \
|
(ulg)((long)s->strstart - s->block_start), \
|
||||||
(eof)); \
|
(last)); \
|
||||||
s->block_start = s->strstart; \
|
s->block_start = s->strstart; \
|
||||||
flush_pending(s->strm); \
|
flush_pending(s->strm); \
|
||||||
Tracev((stderr,"[FLUSH]")); \
|
Tracev((stderr,"[FLUSH]")); \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Same but force premature exit if necessary. */
|
/* Same but force premature exit if necessary. */
|
||||||
#define FLUSH_BLOCK(s, eof) { \
|
#define FLUSH_BLOCK(s, last) { \
|
||||||
FLUSH_BLOCK_ONLY(s, eof); \
|
FLUSH_BLOCK_ONLY(s, last); \
|
||||||
if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \
|
if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
|
@ -1449,7 +1521,7 @@ local block_state deflate_fast(s, flush)
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
int flush;
|
int flush;
|
||||||
{
|
{
|
||||||
IPos hash_head = NIL; /* head of the hash chain */
|
IPos hash_head; /* head of the hash chain */
|
||||||
int bflush; /* set if current block must be flushed */
|
int bflush; /* set if current block must be flushed */
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
|
@ -1469,6 +1541,7 @@ local block_state deflate_fast(s, flush)
|
||||||
/* Insert the string window[strstart .. strstart+2] in the
|
/* Insert the string window[strstart .. strstart+2] in the
|
||||||
* dictionary, and set hash_head to the head of the hash chain:
|
* dictionary, and set hash_head to the head of the hash chain:
|
||||||
*/
|
*/
|
||||||
|
hash_head = NIL;
|
||||||
if (s->lookahead >= MIN_MATCH) {
|
if (s->lookahead >= MIN_MATCH) {
|
||||||
INSERT_STRING(s, s->strstart, hash_head);
|
INSERT_STRING(s, s->strstart, hash_head);
|
||||||
}
|
}
|
||||||
|
@ -1481,19 +1554,8 @@ local block_state deflate_fast(s, flush)
|
||||||
* of window index 0 (in particular we have to avoid a match
|
* of window index 0 (in particular we have to avoid a match
|
||||||
* of the string with itself at the start of the input file).
|
* of the string with itself at the start of the input file).
|
||||||
*/
|
*/
|
||||||
#ifdef FASTEST
|
s->match_length = longest_match (s, hash_head);
|
||||||
if ((s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) ||
|
/* longest_match() sets match_start */
|
||||||
(s->strategy == Z_RLE && s->strstart - hash_head == 1)) {
|
|
||||||
s->match_length = longest_match_fast (s, hash_head);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) {
|
|
||||||
s->match_length = longest_match (s, hash_head);
|
|
||||||
} else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) {
|
|
||||||
s->match_length = longest_match_fast (s, hash_head);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/* longest_match() or longest_match_fast() sets match_start */
|
|
||||||
}
|
}
|
||||||
if (s->match_length >= MIN_MATCH) {
|
if (s->match_length >= MIN_MATCH) {
|
||||||
check_match(s, s->strstart, s->match_start, s->match_length);
|
check_match(s, s->strstart, s->match_start, s->match_length);
|
||||||
|
@ -1555,7 +1617,7 @@ local block_state deflate_slow(s, flush)
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
int flush;
|
int flush;
|
||||||
{
|
{
|
||||||
IPos hash_head = NIL; /* head of hash chain */
|
IPos hash_head; /* head of hash chain */
|
||||||
int bflush; /* set if current block must be flushed */
|
int bflush; /* set if current block must be flushed */
|
||||||
|
|
||||||
/* Process the input block. */
|
/* Process the input block. */
|
||||||
|
@ -1576,6 +1638,7 @@ local block_state deflate_slow(s, flush)
|
||||||
/* Insert the string window[strstart .. strstart+2] in the
|
/* Insert the string window[strstart .. strstart+2] in the
|
||||||
* dictionary, and set hash_head to the head of the hash chain:
|
* dictionary, and set hash_head to the head of the hash chain:
|
||||||
*/
|
*/
|
||||||
|
hash_head = NIL;
|
||||||
if (s->lookahead >= MIN_MATCH) {
|
if (s->lookahead >= MIN_MATCH) {
|
||||||
INSERT_STRING(s, s->strstart, hash_head);
|
INSERT_STRING(s, s->strstart, hash_head);
|
||||||
}
|
}
|
||||||
|
@ -1591,12 +1654,8 @@ local block_state deflate_slow(s, flush)
|
||||||
* of window index 0 (in particular we have to avoid a match
|
* of window index 0 (in particular we have to avoid a match
|
||||||
* of the string with itself at the start of the input file).
|
* of the string with itself at the start of the input file).
|
||||||
*/
|
*/
|
||||||
if (s->strategy != Z_HUFFMAN_ONLY && s->strategy != Z_RLE) {
|
s->match_length = longest_match (s, hash_head);
|
||||||
s->match_length = longest_match (s, hash_head);
|
/* longest_match() sets match_start */
|
||||||
} else if (s->strategy == Z_RLE && s->strstart - hash_head == 1) {
|
|
||||||
s->match_length = longest_match_fast (s, hash_head);
|
|
||||||
}
|
|
||||||
/* longest_match() or longest_match_fast() sets match_start */
|
|
||||||
|
|
||||||
if (s->match_length <= 5 && (s->strategy == Z_FILTERED
|
if (s->match_length <= 5 && (s->strategy == Z_FILTERED
|
||||||
#if TOO_FAR <= 32767
|
#if TOO_FAR <= 32767
|
||||||
|
@ -1674,7 +1733,6 @@ local block_state deflate_slow(s, flush)
|
||||||
}
|
}
|
||||||
#endif /* FASTEST */
|
#endif /* FASTEST */
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* For Z_RLE, simply look for runs of bytes, generate matches only of distance
|
* For Z_RLE, simply look for runs of bytes, generate matches only of distance
|
||||||
* one. Do not maintain a hash table. (It will be regenerated if this run of
|
* one. Do not maintain a hash table. (It will be regenerated if this run of
|
||||||
|
@ -1684,11 +1742,9 @@ local block_state deflate_rle(s, flush)
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
int flush;
|
int flush;
|
||||||
{
|
{
|
||||||
int bflush; /* set if current block must be flushed */
|
int bflush; /* set if current block must be flushed */
|
||||||
uInt run; /* length of run */
|
uInt prev; /* byte at distance one to match */
|
||||||
uInt max; /* maximum length of run */
|
Bytef *scan, *strend; /* scan goes up to strend for length of run */
|
||||||
uInt prev; /* byte at distance one to match */
|
|
||||||
Bytef *scan; /* scan for end of run */
|
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
/* Make sure that we always have enough lookahead, except
|
/* Make sure that we always have enough lookahead, except
|
||||||
|
@ -1704,23 +1760,33 @@ local block_state deflate_rle(s, flush)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See how many times the previous byte repeats */
|
/* See how many times the previous byte repeats */
|
||||||
run = 0;
|
s->match_length = 0;
|
||||||
if (s->strstart > 0) { /* if there is a previous byte, that is */
|
if (s->lookahead >= MIN_MATCH && s->strstart > 0) {
|
||||||
max = s->lookahead < MAX_MATCH ? s->lookahead : MAX_MATCH;
|
|
||||||
scan = s->window + s->strstart - 1;
|
scan = s->window + s->strstart - 1;
|
||||||
prev = *scan++;
|
prev = *scan;
|
||||||
do {
|
if (prev == *++scan && prev == *++scan && prev == *++scan) {
|
||||||
if (*scan++ != prev)
|
strend = s->window + s->strstart + MAX_MATCH;
|
||||||
break;
|
do {
|
||||||
} while (++run < max);
|
} while (prev == *++scan && prev == *++scan &&
|
||||||
|
prev == *++scan && prev == *++scan &&
|
||||||
|
prev == *++scan && prev == *++scan &&
|
||||||
|
prev == *++scan && prev == *++scan &&
|
||||||
|
scan < strend);
|
||||||
|
s->match_length = MAX_MATCH - (int)(strend - scan);
|
||||||
|
if (s->match_length > s->lookahead)
|
||||||
|
s->match_length = s->lookahead;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Emit match if have run of MIN_MATCH or longer, else emit literal */
|
/* Emit match if have run of MIN_MATCH or longer, else emit literal */
|
||||||
if (run >= MIN_MATCH) {
|
if (s->match_length >= MIN_MATCH) {
|
||||||
check_match(s, s->strstart, s->strstart - 1, run);
|
check_match(s, s->strstart, s->strstart - 1, s->match_length);
|
||||||
_tr_tally_dist(s, 1, run - MIN_MATCH, bflush);
|
|
||||||
s->lookahead -= run;
|
_tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush);
|
||||||
s->strstart += run;
|
|
||||||
|
s->lookahead -= s->match_length;
|
||||||
|
s->strstart += s->match_length;
|
||||||
|
s->match_length = 0;
|
||||||
} else {
|
} else {
|
||||||
/* No match, output a literal byte */
|
/* No match, output a literal byte */
|
||||||
Tracevv((stderr,"%c", s->window[s->strstart]));
|
Tracevv((stderr,"%c", s->window[s->strstart]));
|
||||||
|
@ -1733,4 +1799,36 @@ local block_state deflate_rle(s, flush)
|
||||||
FLUSH_BLOCK(s, flush == Z_FINISH);
|
FLUSH_BLOCK(s, flush == Z_FINISH);
|
||||||
return flush == Z_FINISH ? finish_done : block_done;
|
return flush == Z_FINISH ? finish_done : block_done;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
/* ===========================================================================
|
||||||
|
* For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table.
|
||||||
|
* (It will be regenerated if this run of deflate switches away from Huffman.)
|
||||||
|
*/
|
||||||
|
local block_state deflate_huff(s, flush)
|
||||||
|
deflate_state *s;
|
||||||
|
int flush;
|
||||||
|
{
|
||||||
|
int bflush; /* set if current block must be flushed */
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
/* Make sure that we have a literal to write. */
|
||||||
|
if (s->lookahead == 0) {
|
||||||
|
fill_window(s);
|
||||||
|
if (s->lookahead == 0) {
|
||||||
|
if (flush == Z_NO_FLUSH)
|
||||||
|
return need_more;
|
||||||
|
break; /* flush the current block */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Output a literal byte */
|
||||||
|
s->match_length = 0;
|
||||||
|
Tracevv((stderr,"%c", s->window[s->strstart]));
|
||||||
|
_tr_tally_lit (s, s->window[s->strstart], bflush);
|
||||||
|
s->lookahead--;
|
||||||
|
s->strstart++;
|
||||||
|
if (bflush) FLUSH_BLOCK(s, 0);
|
||||||
|
}
|
||||||
|
FLUSH_BLOCK(s, flush == Z_FINISH);
|
||||||
|
return flush == Z_FINISH ? finish_done : block_done;
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* deflate.h -- internal compression state
|
/* deflate.h -- internal compression state
|
||||||
* Copyright (C) 1995-2004 Jean-loup Gailly
|
* Copyright (C) 1995-2010 Jean-loup Gailly
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -260,6 +260,13 @@ typedef struct internal_state {
|
||||||
* are always zero.
|
* are always zero.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
ulg high_water;
|
||||||
|
/* High water mark offset in window for initialized bytes -- bytes above
|
||||||
|
* this are set to zero in order to avoid memory check warnings when
|
||||||
|
* longest match routines access bytes past the input. This is then
|
||||||
|
* updated to the new high water mark.
|
||||||
|
*/
|
||||||
|
|
||||||
} FAR deflate_state;
|
} FAR deflate_state;
|
||||||
|
|
||||||
/* Output a byte on the stream.
|
/* Output a byte on the stream.
|
||||||
|
@ -278,14 +285,18 @@ typedef struct internal_state {
|
||||||
* distances are limited to MAX_DIST instead of WSIZE.
|
* distances are limited to MAX_DIST instead of WSIZE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define WIN_INIT MAX_MATCH
|
||||||
|
/* Number of bytes after end of data in window to initialize in order to avoid
|
||||||
|
memory checker errors from longest match routines */
|
||||||
|
|
||||||
/* in trees.c */
|
/* in trees.c */
|
||||||
void _tr_init OF((deflate_state *s));
|
void ZLIB_INTERNAL _tr_init OF((deflate_state *s));
|
||||||
int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
|
int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
|
||||||
void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len,
|
void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,
|
||||||
int eof));
|
ulg stored_len, int last));
|
||||||
void _tr_align OF((deflate_state *s));
|
void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
|
||||||
void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
|
void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
|
||||||
int eof));
|
ulg stored_len, int last));
|
||||||
|
|
||||||
#define d_code(dist) \
|
#define d_code(dist) \
|
||||||
((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
|
((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
|
||||||
|
@ -298,11 +309,11 @@ void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
|
||||||
/* Inline versions of _tr_tally for speed: */
|
/* Inline versions of _tr_tally for speed: */
|
||||||
|
|
||||||
#if defined(GEN_TREES_H) || !defined(STDC)
|
#if defined(GEN_TREES_H) || !defined(STDC)
|
||||||
extern uch _length_code[];
|
extern uch ZLIB_INTERNAL _length_code[];
|
||||||
extern uch _dist_code[];
|
extern uch ZLIB_INTERNAL _dist_code[];
|
||||||
#else
|
#else
|
||||||
extern const uch _length_code[];
|
extern const uch ZLIB_INTERNAL _length_code[];
|
||||||
extern const uch _dist_code[];
|
extern const uch ZLIB_INTERNAL _dist_code[];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# define _tr_tally_lit(s, c, flush) \
|
# define _tr_tally_lit(s, c, flush) \
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
/* gzclose.c -- zlib gzclose() function
|
||||||
|
* Copyright (C) 2004, 2010 Mark Adler
|
||||||
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gzguts.h"
|
||||||
|
|
||||||
|
/* gzclose() is in a separate file so that it is linked in only if it is used.
|
||||||
|
That way the other gzclose functions can be used instead to avoid linking in
|
||||||
|
unneeded compression or decompression routines. */
|
||||||
|
int ZEXPORT gzclose(file)
|
||||||
|
gzFile file;
|
||||||
|
{
|
||||||
|
#ifndef NO_GZCOMPRESS
|
||||||
|
gz_statep state;
|
||||||
|
|
||||||
|
if (file == NULL)
|
||||||
|
return Z_STREAM_ERROR;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
|
||||||
|
return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file);
|
||||||
|
#else
|
||||||
|
return gzclose_r(file);
|
||||||
|
#endif
|
||||||
|
}
|
|
@ -0,0 +1,132 @@
|
||||||
|
/* gzguts.h -- zlib internal header definitions for gz* operations
|
||||||
|
* Copyright (C) 2004, 2005, 2010 Mark Adler
|
||||||
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef _LARGEFILE64_SOURCE
|
||||||
|
# ifndef _LARGEFILE_SOURCE
|
||||||
|
# define _LARGEFILE_SOURCE 1
|
||||||
|
# endif
|
||||||
|
# ifdef _FILE_OFFSET_BITS
|
||||||
|
# undef _FILE_OFFSET_BITS
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)
|
||||||
|
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
|
||||||
|
#else
|
||||||
|
# define ZLIB_INTERNAL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "zlib.h"
|
||||||
|
#ifdef STDC
|
||||||
|
# include <string.h>
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <limits.h>
|
||||||
|
#endif
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#ifdef NO_DEFLATE /* for compatibility with old definition */
|
||||||
|
# define NO_GZCOMPRESS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# include <io.h>
|
||||||
|
# define vsnprintf _vsnprintf
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef local
|
||||||
|
# define local static
|
||||||
|
#endif
|
||||||
|
/* compile with -Dlocal if your debugger can't find static symbols */
|
||||||
|
|
||||||
|
/* gz* functions always use library allocation functions */
|
||||||
|
#ifndef STDC
|
||||||
|
extern voidp malloc OF((uInt size));
|
||||||
|
extern void free OF((voidpf ptr));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* get errno and strerror definition */
|
||||||
|
#if defined UNDER_CE
|
||||||
|
# include <windows.h>
|
||||||
|
# define zstrerror() gz_strwinerror((DWORD)GetLastError())
|
||||||
|
#else
|
||||||
|
# ifdef STDC
|
||||||
|
# include <errno.h>
|
||||||
|
# define zstrerror() strerror(errno)
|
||||||
|
# else
|
||||||
|
# define zstrerror() "stdio error (consult errno)"
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* provide prototypes for these when building zlib without LFS */
|
||||||
|
#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
|
||||||
|
ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
|
||||||
|
ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int));
|
||||||
|
ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile));
|
||||||
|
ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* default i/o buffer size -- double this for output when reading */
|
||||||
|
#define GZBUFSIZE 8192
|
||||||
|
|
||||||
|
/* gzip modes, also provide a little integrity check on the passed structure */
|
||||||
|
#define GZ_NONE 0
|
||||||
|
#define GZ_READ 7247
|
||||||
|
#define GZ_WRITE 31153
|
||||||
|
#define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */
|
||||||
|
|
||||||
|
/* values for gz_state how */
|
||||||
|
#define LOOK 0 /* look for a gzip header */
|
||||||
|
#define COPY 1 /* copy input directly */
|
||||||
|
#define GZIP 2 /* decompress a gzip stream */
|
||||||
|
|
||||||
|
/* internal gzip file state data structure */
|
||||||
|
typedef struct {
|
||||||
|
/* used for both reading and writing */
|
||||||
|
int mode; /* see gzip modes above */
|
||||||
|
int fd; /* file descriptor */
|
||||||
|
char *path; /* path or fd for error messages */
|
||||||
|
z_off64_t pos; /* current position in uncompressed data */
|
||||||
|
unsigned size; /* buffer size, zero if not allocated yet */
|
||||||
|
unsigned want; /* requested buffer size, default is GZBUFSIZE */
|
||||||
|
unsigned char *in; /* input buffer */
|
||||||
|
unsigned char *out; /* output buffer (double-sized when reading) */
|
||||||
|
unsigned char *next; /* next output data to deliver or write */
|
||||||
|
/* just for reading */
|
||||||
|
unsigned have; /* amount of output data unused at next */
|
||||||
|
int eof; /* true if end of input file reached */
|
||||||
|
z_off64_t start; /* where the gzip data started, for rewinding */
|
||||||
|
z_off64_t raw; /* where the raw data started, for seeking */
|
||||||
|
int how; /* 0: get header, 1: copy, 2: decompress */
|
||||||
|
int direct; /* true if last read direct, false if gzip */
|
||||||
|
/* just for writing */
|
||||||
|
int level; /* compression level */
|
||||||
|
int strategy; /* compression strategy */
|
||||||
|
/* seek request */
|
||||||
|
z_off64_t skip; /* amount to skip (already rewound if backwards) */
|
||||||
|
int seek; /* true if seek request pending */
|
||||||
|
/* error information */
|
||||||
|
int err; /* error code */
|
||||||
|
char *msg; /* error message */
|
||||||
|
/* zlib inflate or deflate stream */
|
||||||
|
z_stream strm; /* stream structure in-place (not a pointer) */
|
||||||
|
} gz_state;
|
||||||
|
typedef gz_state FAR *gz_statep;
|
||||||
|
|
||||||
|
/* shared functions */
|
||||||
|
void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *));
|
||||||
|
#if defined UNDER_CE
|
||||||
|
char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t
|
||||||
|
value -- needed when comparing unsigned to z_off64_t, which is signed
|
||||||
|
(possible z_off64_t types off_t, off64_t, and long are all signed) */
|
||||||
|
#ifdef INT_MAX
|
||||||
|
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX)
|
||||||
|
#else
|
||||||
|
unsigned ZLIB_INTERNAL gz_intmax OF((void));
|
||||||
|
# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax())
|
||||||
|
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,537 @@
|
||||||
|
/* gzlib.c -- zlib functions common to reading and writing gzip files
|
||||||
|
* Copyright (C) 2004, 2010 Mark Adler
|
||||||
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gzguts.h"
|
||||||
|
|
||||||
|
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
|
||||||
|
# define LSEEK lseek64
|
||||||
|
#else
|
||||||
|
# define LSEEK _lseek
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Local functions */
|
||||||
|
local void gz_reset OF((gz_statep));
|
||||||
|
local gzFile gz_open OF((const char *, int, const char *));
|
||||||
|
|
||||||
|
#if defined UNDER_CE
|
||||||
|
|
||||||
|
/* Map the Windows error number in ERROR to a locale-dependent error message
|
||||||
|
string and return a pointer to it. Typically, the values for ERROR come
|
||||||
|
from GetLastError.
|
||||||
|
|
||||||
|
The string pointed to shall not be modified by the application, but may be
|
||||||
|
overwritten by a subsequent call to gz_strwinerror
|
||||||
|
|
||||||
|
The gz_strwinerror function does not change the current setting of
|
||||||
|
GetLastError. */
|
||||||
|
char ZLIB_INTERNAL *gz_strwinerror (error)
|
||||||
|
DWORD error;
|
||||||
|
{
|
||||||
|
static char buf[1024];
|
||||||
|
|
||||||
|
wchar_t *msgbuf;
|
||||||
|
DWORD lasterr = GetLastError();
|
||||||
|
DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM
|
||||||
|
| FORMAT_MESSAGE_ALLOCATE_BUFFER,
|
||||||
|
NULL,
|
||||||
|
error,
|
||||||
|
0, /* Default language */
|
||||||
|
(LPVOID)&msgbuf,
|
||||||
|
0,
|
||||||
|
NULL);
|
||||||
|
if (chars != 0) {
|
||||||
|
/* If there is an \r\n appended, zap it. */
|
||||||
|
if (chars >= 2
|
||||||
|
&& msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') {
|
||||||
|
chars -= 2;
|
||||||
|
msgbuf[chars] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (chars > sizeof (buf) - 1) {
|
||||||
|
chars = sizeof (buf) - 1;
|
||||||
|
msgbuf[chars] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
wcstombs(buf, msgbuf, chars + 1);
|
||||||
|
LocalFree(msgbuf);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sprintf(buf, "unknown win32 error (%ld)", error);
|
||||||
|
}
|
||||||
|
|
||||||
|
SetLastError(lasterr);
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* UNDER_CE */
|
||||||
|
|
||||||
|
/* Reset gzip file state */
|
||||||
|
local void gz_reset(state)
|
||||||
|
gz_statep state;
|
||||||
|
{
|
||||||
|
if (state->mode == GZ_READ) { /* for reading ... */
|
||||||
|
state->have = 0; /* no output data available */
|
||||||
|
state->eof = 0; /* not at end of file */
|
||||||
|
state->how = LOOK; /* look for gzip header */
|
||||||
|
state->direct = 1; /* default for empty file */
|
||||||
|
}
|
||||||
|
state->seek = 0; /* no seek request pending */
|
||||||
|
gz_error(state, Z_OK, NULL); /* clear error */
|
||||||
|
state->pos = 0; /* no uncompressed data yet */
|
||||||
|
state->strm.avail_in = 0; /* no input data yet */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Open a gzip file either by name or file descriptor. */
|
||||||
|
local gzFile gz_open(path, fd, mode)
|
||||||
|
const char *path;
|
||||||
|
int fd;
|
||||||
|
const char *mode;
|
||||||
|
{
|
||||||
|
gz_statep state;
|
||||||
|
|
||||||
|
/* allocate gzFile structure to return */
|
||||||
|
state = malloc(sizeof(gz_state));
|
||||||
|
if (state == NULL)
|
||||||
|
return NULL;
|
||||||
|
state->size = 0; /* no buffers allocated yet */
|
||||||
|
state->want = GZBUFSIZE; /* requested buffer size */
|
||||||
|
state->msg = NULL; /* no error message yet */
|
||||||
|
|
||||||
|
/* interpret mode */
|
||||||
|
state->mode = GZ_NONE;
|
||||||
|
state->level = Z_DEFAULT_COMPRESSION;
|
||||||
|
state->strategy = Z_DEFAULT_STRATEGY;
|
||||||
|
while (*mode) {
|
||||||
|
if (*mode >= '0' && *mode <= '9')
|
||||||
|
state->level = *mode - '0';
|
||||||
|
else
|
||||||
|
switch (*mode) {
|
||||||
|
case 'r':
|
||||||
|
state->mode = GZ_READ;
|
||||||
|
break;
|
||||||
|
#ifndef NO_GZCOMPRESS
|
||||||
|
case 'w':
|
||||||
|
state->mode = GZ_WRITE;
|
||||||
|
break;
|
||||||
|
case 'a':
|
||||||
|
state->mode = GZ_APPEND;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
case '+': /* can't read and write at the same time */
|
||||||
|
free(state);
|
||||||
|
return NULL;
|
||||||
|
case 'b': /* ignore -- will request binary anyway */
|
||||||
|
break;
|
||||||
|
case 'f':
|
||||||
|
state->strategy = Z_FILTERED;
|
||||||
|
break;
|
||||||
|
case 'h':
|
||||||
|
state->strategy = Z_HUFFMAN_ONLY;
|
||||||
|
break;
|
||||||
|
case 'R':
|
||||||
|
state->strategy = Z_RLE;
|
||||||
|
break;
|
||||||
|
case 'F':
|
||||||
|
state->strategy = Z_FIXED;
|
||||||
|
default: /* could consider as an error, but just ignore */
|
||||||
|
;
|
||||||
|
}
|
||||||
|
mode++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* must provide an "r", "w", or "a" */
|
||||||
|
if (state->mode == GZ_NONE) {
|
||||||
|
free(state);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* save the path name for error messages */
|
||||||
|
state->path = malloc(strlen(path) + 1);
|
||||||
|
if (state->path == NULL) {
|
||||||
|
free(state);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
strcpy(state->path, path);
|
||||||
|
|
||||||
|
/* open the file with the appropriate mode (or just use fd) */
|
||||||
|
state->fd = fd != -1 ? fd :
|
||||||
|
_open(path,
|
||||||
|
#ifdef O_LARGEFILE
|
||||||
|
O_LARGEFILE |
|
||||||
|
#endif
|
||||||
|
#ifdef O_BINARY
|
||||||
|
O_BINARY |
|
||||||
|
#endif
|
||||||
|
(state->mode == GZ_READ ?
|
||||||
|
O_RDONLY :
|
||||||
|
(O_WRONLY | O_CREAT | (
|
||||||
|
state->mode == GZ_WRITE ?
|
||||||
|
O_TRUNC :
|
||||||
|
O_APPEND))),
|
||||||
|
0666);
|
||||||
|
if (state->fd == -1) {
|
||||||
|
free(state->path);
|
||||||
|
free(state);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (state->mode == GZ_APPEND)
|
||||||
|
state->mode = GZ_WRITE; /* simplify later checks */
|
||||||
|
|
||||||
|
/* save the current position for rewinding (only if reading) */
|
||||||
|
if (state->mode == GZ_READ) {
|
||||||
|
state->start = LSEEK(state->fd, 0, SEEK_CUR);
|
||||||
|
if (state->start == -1) state->start = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* initialize stream */
|
||||||
|
gz_reset(state);
|
||||||
|
|
||||||
|
/* return stream */
|
||||||
|
return (gzFile)state;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
gzFile ZEXPORT gzopen(path, mode)
|
||||||
|
const char *path;
|
||||||
|
const char *mode;
|
||||||
|
{
|
||||||
|
return gz_open(path, -1, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
gzFile ZEXPORT gzopen64(path, mode)
|
||||||
|
const char *path;
|
||||||
|
const char *mode;
|
||||||
|
{
|
||||||
|
return gz_open(path, -1, mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
gzFile ZEXPORT gzdopen(fd, mode)
|
||||||
|
int fd;
|
||||||
|
const char *mode;
|
||||||
|
{
|
||||||
|
char *path; /* identifier for error messages */
|
||||||
|
gzFile gz;
|
||||||
|
|
||||||
|
if (fd == -1 || (path = malloc(7 + 3 * sizeof(int))) == NULL)
|
||||||
|
return NULL;
|
||||||
|
sprintf(path, "<fd:%d>", fd); /* for debugging */
|
||||||
|
gz = gz_open(path, fd, mode);
|
||||||
|
free(path);
|
||||||
|
return gz;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
int ZEXPORT gzbuffer(file, size)
|
||||||
|
gzFile file;
|
||||||
|
unsigned size;
|
||||||
|
{
|
||||||
|
gz_statep state;
|
||||||
|
|
||||||
|
/* get internal structure and check integrity */
|
||||||
|
if (file == NULL)
|
||||||
|
return -1;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
if (state->mode != GZ_READ && state->mode != GZ_WRITE)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* make sure we haven't already allocated memory */
|
||||||
|
if (state->size != 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* check and set requested size */
|
||||||
|
if (size == 0)
|
||||||
|
return -1;
|
||||||
|
state->want = size;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
int ZEXPORT gzrewind(file)
|
||||||
|
gzFile file;
|
||||||
|
{
|
||||||
|
gz_statep state;
|
||||||
|
|
||||||
|
/* get internal structure */
|
||||||
|
if (file == NULL)
|
||||||
|
return -1;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
|
||||||
|
/* check that we're reading and that there's no error */
|
||||||
|
if (state->mode != GZ_READ || state->err != Z_OK)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* back up and start over */
|
||||||
|
if (LSEEK(state->fd, state->start, SEEK_SET) == -1)
|
||||||
|
return -1;
|
||||||
|
gz_reset(state);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
z_off64_t ZEXPORT gzseek64(file, offset, whence)
|
||||||
|
gzFile file;
|
||||||
|
z_off64_t offset;
|
||||||
|
int whence;
|
||||||
|
{
|
||||||
|
unsigned n;
|
||||||
|
z_off64_t ret;
|
||||||
|
gz_statep state;
|
||||||
|
|
||||||
|
/* get internal structure and check integrity */
|
||||||
|
if (file == NULL)
|
||||||
|
return -1;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
if (state->mode != GZ_READ && state->mode != GZ_WRITE)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* check that there's no error */
|
||||||
|
if (state->err != Z_OK)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* can only seek from start or relative to current position */
|
||||||
|
if (whence != SEEK_SET && whence != SEEK_CUR)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* normalize offset to a SEEK_CUR specification */
|
||||||
|
if (whence == SEEK_SET)
|
||||||
|
offset -= state->pos;
|
||||||
|
else if (state->seek)
|
||||||
|
offset += state->skip;
|
||||||
|
state->seek = 0;
|
||||||
|
|
||||||
|
/* if within raw area while reading, just go there */
|
||||||
|
if (state->mode == GZ_READ && state->how == COPY &&
|
||||||
|
state->pos + offset >= state->raw) {
|
||||||
|
ret = LSEEK(state->fd, offset - state->have, SEEK_CUR);
|
||||||
|
if (ret == -1)
|
||||||
|
return -1;
|
||||||
|
state->have = 0;
|
||||||
|
state->eof = 0;
|
||||||
|
state->seek = 0;
|
||||||
|
gz_error(state, Z_OK, NULL);
|
||||||
|
state->strm.avail_in = 0;
|
||||||
|
state->pos += offset;
|
||||||
|
return state->pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* calculate skip amount, rewinding if needed for back seek when reading */
|
||||||
|
if (offset < 0) {
|
||||||
|
if (state->mode != GZ_READ) /* writing -- can't go backwards */
|
||||||
|
return -1;
|
||||||
|
offset += state->pos;
|
||||||
|
if (offset < 0) /* before start of file! */
|
||||||
|
return -1;
|
||||||
|
if (gzrewind(file) == -1) /* rewind, then skip to offset */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if reading, skip what's in output buffer (one less gzgetc() check) */
|
||||||
|
if (state->mode == GZ_READ) {
|
||||||
|
n = GT_OFF(state->have) || (z_off64_t)state->have > offset ?
|
||||||
|
(unsigned)offset : state->have;
|
||||||
|
state->have -= n;
|
||||||
|
state->next += n;
|
||||||
|
state->pos += n;
|
||||||
|
offset -= n;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* request skip (if not zero) */
|
||||||
|
if (offset) {
|
||||||
|
state->seek = 1;
|
||||||
|
state->skip = offset;
|
||||||
|
}
|
||||||
|
return state->pos + offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
z_off_t ZEXPORT gzseek(file, offset, whence)
|
||||||
|
gzFile file;
|
||||||
|
z_off_t offset;
|
||||||
|
int whence;
|
||||||
|
{
|
||||||
|
z_off64_t ret;
|
||||||
|
|
||||||
|
ret = gzseek64(file, (z_off64_t)offset, whence);
|
||||||
|
return ret == (z_off_t)ret ? (z_off_t)ret : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
z_off64_t ZEXPORT gztell64(file)
|
||||||
|
gzFile file;
|
||||||
|
{
|
||||||
|
gz_statep state;
|
||||||
|
|
||||||
|
/* get internal structure and check integrity */
|
||||||
|
if (file == NULL)
|
||||||
|
return -1;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
if (state->mode != GZ_READ && state->mode != GZ_WRITE)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* return position */
|
||||||
|
return state->pos + (state->seek ? state->skip : 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
z_off_t ZEXPORT gztell(file)
|
||||||
|
gzFile file;
|
||||||
|
{
|
||||||
|
z_off64_t ret;
|
||||||
|
|
||||||
|
ret = gztell64(file);
|
||||||
|
return ret == (z_off_t)ret ? (z_off_t)ret : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
z_off64_t ZEXPORT gzoffset64(file)
|
||||||
|
gzFile file;
|
||||||
|
{
|
||||||
|
z_off64_t offset;
|
||||||
|
gz_statep state;
|
||||||
|
|
||||||
|
/* get internal structure and check integrity */
|
||||||
|
if (file == NULL)
|
||||||
|
return -1;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
if (state->mode != GZ_READ && state->mode != GZ_WRITE)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* compute and return effective offset in file */
|
||||||
|
offset = LSEEK(state->fd, 0, SEEK_CUR);
|
||||||
|
if (offset == -1)
|
||||||
|
return -1;
|
||||||
|
if (state->mode == GZ_READ) /* reading */
|
||||||
|
offset -= state->strm.avail_in; /* don't count buffered input */
|
||||||
|
return offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
z_off_t ZEXPORT gzoffset(file)
|
||||||
|
gzFile file;
|
||||||
|
{
|
||||||
|
z_off64_t ret;
|
||||||
|
|
||||||
|
ret = gzoffset64(file);
|
||||||
|
return ret == (z_off_t)ret ? (z_off_t)ret : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
int ZEXPORT gzeof(file)
|
||||||
|
gzFile file;
|
||||||
|
{
|
||||||
|
gz_statep state;
|
||||||
|
|
||||||
|
/* get internal structure and check integrity */
|
||||||
|
if (file == NULL)
|
||||||
|
return 0;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
if (state->mode != GZ_READ && state->mode != GZ_WRITE)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* return end-of-file state */
|
||||||
|
return state->mode == GZ_READ ?
|
||||||
|
(state->eof && state->strm.avail_in == 0 && state->have == 0) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
const char * ZEXPORT gzerror(file, errnum)
|
||||||
|
gzFile file;
|
||||||
|
int *errnum;
|
||||||
|
{
|
||||||
|
gz_statep state;
|
||||||
|
|
||||||
|
/* get internal structure and check integrity */
|
||||||
|
if (file == NULL)
|
||||||
|
return NULL;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
if (state->mode != GZ_READ && state->mode != GZ_WRITE)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
/* return error information */
|
||||||
|
if (errnum != NULL)
|
||||||
|
*errnum = state->err;
|
||||||
|
return state->msg == NULL ? "" : state->msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
void ZEXPORT gzclearerr(file)
|
||||||
|
gzFile file;
|
||||||
|
{
|
||||||
|
gz_statep state;
|
||||||
|
|
||||||
|
/* get internal structure and check integrity */
|
||||||
|
if (file == NULL)
|
||||||
|
return;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
if (state->mode != GZ_READ && state->mode != GZ_WRITE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* clear error and end-of-file */
|
||||||
|
if (state->mode == GZ_READ)
|
||||||
|
state->eof = 0;
|
||||||
|
gz_error(state, Z_OK, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create an error message in allocated memory and set state->err and
|
||||||
|
state->msg accordingly. Free any previous error message already there. Do
|
||||||
|
not try to free or allocate space if the error is Z_MEM_ERROR (out of
|
||||||
|
memory). Simply save the error message as a static string. If there is an
|
||||||
|
allocation failure constructing the error message, then convert the error to
|
||||||
|
out of memory. */
|
||||||
|
void ZLIB_INTERNAL gz_error(state, err, msg)
|
||||||
|
gz_statep state;
|
||||||
|
int err;
|
||||||
|
const char *msg;
|
||||||
|
{
|
||||||
|
/* free previously allocated message and clear */
|
||||||
|
if (state->msg != NULL) {
|
||||||
|
if (state->err != Z_MEM_ERROR)
|
||||||
|
free(state->msg);
|
||||||
|
state->msg = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set error code, and if no message, then done */
|
||||||
|
state->err = err;
|
||||||
|
if (msg == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* for an out of memory error, save as static string */
|
||||||
|
if (err == Z_MEM_ERROR) {
|
||||||
|
state->msg = (char *)msg;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* construct error message with path */
|
||||||
|
if ((state->msg = malloc(strlen(state->path) + strlen(msg) + 3)) == NULL) {
|
||||||
|
state->err = Z_MEM_ERROR;
|
||||||
|
state->msg = (char *)"out of memory";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
strcpy(state->msg, state->path);
|
||||||
|
strcat(state->msg, ": ");
|
||||||
|
strcat(state->msg, msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef INT_MAX
|
||||||
|
/* portably return maximum value for an int (when limits.h presumed not
|
||||||
|
available) -- we need to do this to cover cases where 2's complement not
|
||||||
|
used, since C standard permits 1's complement and sign-bit representations,
|
||||||
|
otherwise we could just use ((unsigned)-1) >> 1 */
|
||||||
|
unsigned ZLIB_INTERNAL gz_intmax()
|
||||||
|
{
|
||||||
|
unsigned p, q;
|
||||||
|
|
||||||
|
p = 1;
|
||||||
|
do {
|
||||||
|
q = p;
|
||||||
|
p <<= 1;
|
||||||
|
p++;
|
||||||
|
} while (p > q);
|
||||||
|
return q >> 1;
|
||||||
|
}
|
||||||
|
#endif
|
|
@ -0,0 +1,653 @@
|
||||||
|
/* gzread.c -- zlib functions for reading gzip files
|
||||||
|
* Copyright (C) 2004, 2005, 2010 Mark Adler
|
||||||
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gzguts.h"
|
||||||
|
|
||||||
|
/* Local functions */
|
||||||
|
local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *));
|
||||||
|
local int gz_avail OF((gz_statep));
|
||||||
|
local int gz_next4 OF((gz_statep, unsigned long *));
|
||||||
|
local int gz_head OF((gz_statep));
|
||||||
|
local int gz_decomp OF((gz_statep));
|
||||||
|
local int gz_make OF((gz_statep));
|
||||||
|
local int gz_skip OF((gz_statep, z_off64_t));
|
||||||
|
|
||||||
|
/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from
|
||||||
|
state->fd, and update state->eof, state->err, and state->msg as appropriate.
|
||||||
|
This function needs to loop on read(), since read() is not guaranteed to
|
||||||
|
read the number of bytes requested, depending on the type of descriptor. */
|
||||||
|
local int gz_load(state, buf, len, have)
|
||||||
|
gz_statep state;
|
||||||
|
unsigned char *buf;
|
||||||
|
unsigned len;
|
||||||
|
unsigned *have;
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
*have = 0;
|
||||||
|
do {
|
||||||
|
ret = _read(state->fd, buf + *have, len - *have);
|
||||||
|
if (ret <= 0)
|
||||||
|
break;
|
||||||
|
*have += ret;
|
||||||
|
} while (*have < len);
|
||||||
|
if (ret < 0) {
|
||||||
|
gz_error(state, Z_ERRNO, zstrerror());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (ret == 0)
|
||||||
|
state->eof = 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Load up input buffer and set eof flag if last data loaded -- return -1 on
|
||||||
|
error, 0 otherwise. Note that the eof flag is set when the end of the input
|
||||||
|
file is reached, even though there may be unused data in the buffer. Once
|
||||||
|
that data has been used, no more attempts will be made to read the file.
|
||||||
|
gz_avail() assumes that strm->avail_in == 0. */
|
||||||
|
local int gz_avail(state)
|
||||||
|
gz_statep state;
|
||||||
|
{
|
||||||
|
z_streamp strm = &(state->strm);
|
||||||
|
|
||||||
|
if (state->err != Z_OK)
|
||||||
|
return -1;
|
||||||
|
if (state->eof == 0) {
|
||||||
|
if (gz_load(state, state->in, state->size,
|
||||||
|
(unsigned *)&(strm->avail_in)) == -1)
|
||||||
|
return -1;
|
||||||
|
strm->next_in = state->in;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get next byte from input, or -1 if end or error. */
|
||||||
|
#define NEXT() ((strm->avail_in == 0 && gz_avail(state) == -1) ? -1 : \
|
||||||
|
(strm->avail_in == 0 ? -1 : \
|
||||||
|
(strm->avail_in--, *(strm->next_in)++)))
|
||||||
|
|
||||||
|
/* Get a four-byte little-endian integer and return 0 on success and the value
|
||||||
|
in *ret. Otherwise -1 is returned and *ret is not modified. */
|
||||||
|
local int gz_next4(state, ret)
|
||||||
|
gz_statep state;
|
||||||
|
unsigned long *ret;
|
||||||
|
{
|
||||||
|
int ch;
|
||||||
|
unsigned long val;
|
||||||
|
z_streamp strm = &(state->strm);
|
||||||
|
|
||||||
|
val = NEXT();
|
||||||
|
val += (unsigned)NEXT() << 8;
|
||||||
|
val += (unsigned long)NEXT() << 16;
|
||||||
|
ch = NEXT();
|
||||||
|
if (ch == -1)
|
||||||
|
return -1;
|
||||||
|
val += (unsigned long)ch << 24;
|
||||||
|
*ret = val;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Look for gzip header, set up for inflate or copy. state->have must be zero.
|
||||||
|
If this is the first time in, allocate required memory. state->how will be
|
||||||
|
left unchanged if there is no more input data available, will be set to COPY
|
||||||
|
if there is no gzip header and direct copying will be performed, or it will
|
||||||
|
be set to GZIP for decompression, and the gzip header will be skipped so
|
||||||
|
that the next available input data is the raw deflate stream. If direct
|
||||||
|
copying, then leftover input data from the input buffer will be copied to
|
||||||
|
the output buffer. In that case, all further file reads will be directly to
|
||||||
|
either the output buffer or a user buffer. If decompressing, the inflate
|
||||||
|
state and the check value will be initialized. gz_head() will return 0 on
|
||||||
|
success or -1 on failure. Failures may include read errors or gzip header
|
||||||
|
errors. */
|
||||||
|
local int gz_head(state)
|
||||||
|
gz_statep state;
|
||||||
|
{
|
||||||
|
z_streamp strm = &(state->strm);
|
||||||
|
int flags;
|
||||||
|
unsigned len;
|
||||||
|
|
||||||
|
/* allocate read buffers and inflate memory */
|
||||||
|
if (state->size == 0) {
|
||||||
|
/* allocate buffers */
|
||||||
|
state->in = malloc(state->want);
|
||||||
|
state->out = malloc(state->want << 1);
|
||||||
|
if (state->in == NULL || state->out == NULL) {
|
||||||
|
if (state->out != NULL)
|
||||||
|
free(state->out);
|
||||||
|
if (state->in != NULL)
|
||||||
|
free(state->in);
|
||||||
|
gz_error(state, Z_MEM_ERROR, "out of memory");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
state->size = state->want;
|
||||||
|
|
||||||
|
/* allocate inflate memory */
|
||||||
|
state->strm.zalloc = Z_NULL;
|
||||||
|
state->strm.zfree = Z_NULL;
|
||||||
|
state->strm.opaque = Z_NULL;
|
||||||
|
state->strm.avail_in = 0;
|
||||||
|
state->strm.next_in = Z_NULL;
|
||||||
|
if (inflateInit2(&(state->strm), -15) != Z_OK) { /* raw inflate */
|
||||||
|
free(state->out);
|
||||||
|
free(state->in);
|
||||||
|
state->size = 0;
|
||||||
|
gz_error(state, Z_MEM_ERROR, "out of memory");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get some data in the input buffer */
|
||||||
|
if (strm->avail_in == 0) {
|
||||||
|
if (gz_avail(state) == -1)
|
||||||
|
return -1;
|
||||||
|
if (strm->avail_in == 0)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* look for the gzip magic header bytes 31 and 139 */
|
||||||
|
if (strm->next_in[0] == 31) {
|
||||||
|
strm->avail_in--;
|
||||||
|
strm->next_in++;
|
||||||
|
if (strm->avail_in == 0 && gz_avail(state) == -1)
|
||||||
|
return -1;
|
||||||
|
if (strm->avail_in && strm->next_in[0] == 139) {
|
||||||
|
/* we have a gzip header, woo hoo! */
|
||||||
|
strm->avail_in--;
|
||||||
|
strm->next_in++;
|
||||||
|
|
||||||
|
/* skip rest of header */
|
||||||
|
if (NEXT() != 8) { /* compression method */
|
||||||
|
gz_error(state, Z_DATA_ERROR, "unknown compression method");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
flags = NEXT();
|
||||||
|
if (flags & 0xe0) { /* reserved flag bits */
|
||||||
|
gz_error(state, Z_DATA_ERROR, "unknown header flags set");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
NEXT(); /* modification time */
|
||||||
|
NEXT();
|
||||||
|
NEXT();
|
||||||
|
NEXT();
|
||||||
|
NEXT(); /* extra flags */
|
||||||
|
NEXT(); /* operating system */
|
||||||
|
if (flags & 4) { /* extra field */
|
||||||
|
len = (unsigned)NEXT();
|
||||||
|
len += (unsigned)NEXT() << 8;
|
||||||
|
while (len--)
|
||||||
|
if (NEXT() < 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (flags & 8) /* file name */
|
||||||
|
while (NEXT() > 0)
|
||||||
|
;
|
||||||
|
if (flags & 16) /* comment */
|
||||||
|
while (NEXT() > 0)
|
||||||
|
;
|
||||||
|
if (flags & 2) { /* header crc */
|
||||||
|
NEXT();
|
||||||
|
NEXT();
|
||||||
|
}
|
||||||
|
/* an unexpected end of file is not checked for here -- it will be
|
||||||
|
noticed on the first request for uncompressed data */
|
||||||
|
|
||||||
|
/* set up for decompression */
|
||||||
|
inflateReset(strm);
|
||||||
|
strm->adler = crc32(0L, Z_NULL, 0);
|
||||||
|
state->how = GZIP;
|
||||||
|
state->direct = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* not a gzip file -- save first byte (31) and fall to raw i/o */
|
||||||
|
state->out[0] = 31;
|
||||||
|
state->have = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* doing raw i/o, save start of raw data for seeking, copy any leftover
|
||||||
|
input to output -- this assumes that the output buffer is larger than
|
||||||
|
the input buffer, which also assures space for gzungetc() */
|
||||||
|
state->raw = state->pos;
|
||||||
|
state->next = state->out;
|
||||||
|
if (strm->avail_in) {
|
||||||
|
memcpy(state->next + state->have, strm->next_in, strm->avail_in);
|
||||||
|
state->have += strm->avail_in;
|
||||||
|
strm->avail_in = 0;
|
||||||
|
}
|
||||||
|
state->how = COPY;
|
||||||
|
state->direct = 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Decompress from input to the provided next_out and avail_out in the state.
|
||||||
|
If the end of the compressed data is reached, then verify the gzip trailer
|
||||||
|
check value and length (modulo 2^32). state->have and state->next are set
|
||||||
|
to point to the just decompressed data, and the crc is updated. If the
|
||||||
|
trailer is verified, state->how is reset to LOOK to look for the next gzip
|
||||||
|
stream or raw data, once state->have is depleted. Returns 0 on success, -1
|
||||||
|
on failure. Failures may include invalid compressed data or a failed gzip
|
||||||
|
trailer verification. */
|
||||||
|
local int gz_decomp(state)
|
||||||
|
gz_statep state;
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
unsigned had;
|
||||||
|
unsigned long crc, len;
|
||||||
|
z_streamp strm = &(state->strm);
|
||||||
|
|
||||||
|
/* fill output buffer up to end of deflate stream */
|
||||||
|
had = strm->avail_out;
|
||||||
|
do {
|
||||||
|
/* get more input for inflate() */
|
||||||
|
if (strm->avail_in == 0 && gz_avail(state) == -1)
|
||||||
|
return -1;
|
||||||
|
if (strm->avail_in == 0) {
|
||||||
|
gz_error(state, Z_DATA_ERROR, "unexpected end of file");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* decompress and handle errors */
|
||||||
|
ret = inflate(strm, Z_NO_FLUSH);
|
||||||
|
if (ret == Z_STREAM_ERROR || ret == Z_NEED_DICT) {
|
||||||
|
gz_error(state, Z_STREAM_ERROR,
|
||||||
|
"internal error: inflate stream corrupt");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (ret == Z_MEM_ERROR) {
|
||||||
|
gz_error(state, Z_MEM_ERROR, "out of memory");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (ret == Z_DATA_ERROR) { /* deflate stream invalid */
|
||||||
|
gz_error(state, Z_DATA_ERROR,
|
||||||
|
strm->msg == NULL ? "compressed data error" : strm->msg);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
} while (strm->avail_out && ret != Z_STREAM_END);
|
||||||
|
|
||||||
|
/* update available output and crc check value */
|
||||||
|
state->have = had - strm->avail_out;
|
||||||
|
state->next = strm->next_out - state->have;
|
||||||
|
strm->adler = crc32(strm->adler, state->next, state->have);
|
||||||
|
|
||||||
|
/* check gzip trailer if at end of deflate stream */
|
||||||
|
if (ret == Z_STREAM_END) {
|
||||||
|
if (gz_next4(state, &crc) == -1 || gz_next4(state, &len) == -1) {
|
||||||
|
gz_error(state, Z_DATA_ERROR, "unexpected end of file");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (crc != strm->adler) {
|
||||||
|
gz_error(state, Z_DATA_ERROR, "incorrect data check");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (len != (strm->total_out & 0xffffffffL)) {
|
||||||
|
gz_error(state, Z_DATA_ERROR, "incorrect length check");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
state->how = LOOK; /* ready for next stream, once have is 0 (leave
|
||||||
|
state->direct unchanged to remember how) */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* good decompression */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make data and put in the output buffer. Assumes that state->have == 0.
|
||||||
|
Data is either copied from the input file or decompressed from the input
|
||||||
|
file depending on state->how. If state->how is LOOK, then a gzip header is
|
||||||
|
looked for (and skipped if found) to determine wither to copy or decompress.
|
||||||
|
Returns -1 on error, otherwise 0. gz_make() will leave state->have as COPY
|
||||||
|
or GZIP unless the end of the input file has been reached and all data has
|
||||||
|
been processed. */
|
||||||
|
local int gz_make(state)
|
||||||
|
gz_statep state;
|
||||||
|
{
|
||||||
|
z_streamp strm = &(state->strm);
|
||||||
|
|
||||||
|
if (state->how == LOOK) { /* look for gzip header */
|
||||||
|
if (gz_head(state) == -1)
|
||||||
|
return -1;
|
||||||
|
if (state->have) /* got some data from gz_head() */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (state->how == COPY) { /* straight copy */
|
||||||
|
if (gz_load(state, state->out, state->size << 1, &(state->have)) == -1)
|
||||||
|
return -1;
|
||||||
|
state->next = state->out;
|
||||||
|
}
|
||||||
|
else if (state->how == GZIP) { /* decompress */
|
||||||
|
strm->avail_out = state->size << 1;
|
||||||
|
strm->next_out = state->out;
|
||||||
|
if (gz_decomp(state) == -1)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */
|
||||||
|
local int gz_skip(state, len)
|
||||||
|
gz_statep state;
|
||||||
|
z_off64_t len;
|
||||||
|
{
|
||||||
|
unsigned n;
|
||||||
|
|
||||||
|
/* skip over len bytes or reach end-of-file, whichever comes first */
|
||||||
|
while (len)
|
||||||
|
/* skip over whatever is in output buffer */
|
||||||
|
if (state->have) {
|
||||||
|
n = GT_OFF(state->have) || (z_off64_t)state->have > len ?
|
||||||
|
(unsigned)len : state->have;
|
||||||
|
state->have -= n;
|
||||||
|
state->next += n;
|
||||||
|
state->pos += n;
|
||||||
|
len -= n;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* output buffer empty -- return if we're at the end of the input */
|
||||||
|
else if (state->eof && state->strm.avail_in == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* need more data to skip -- load up output buffer */
|
||||||
|
else {
|
||||||
|
/* get more output, looking for header if required */
|
||||||
|
if (gz_make(state) == -1)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
int ZEXPORT gzread(file, buf, len)
|
||||||
|
gzFile file;
|
||||||
|
voidp buf;
|
||||||
|
unsigned len;
|
||||||
|
{
|
||||||
|
unsigned got, n;
|
||||||
|
gz_statep state;
|
||||||
|
z_streamp strm;
|
||||||
|
|
||||||
|
/* get internal structure */
|
||||||
|
if (file == NULL)
|
||||||
|
return -1;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
strm = &(state->strm);
|
||||||
|
|
||||||
|
/* check that we're reading and that there's no error */
|
||||||
|
if (state->mode != GZ_READ || state->err != Z_OK)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* since an int is returned, make sure len fits in one, otherwise return
|
||||||
|
with an error (this avoids the flaw in the interface) */
|
||||||
|
if ((int)len < 0) {
|
||||||
|
gz_error(state, Z_BUF_ERROR, "requested length does not fit in int");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if len is zero, avoid unnecessary operations */
|
||||||
|
if (len == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* process a skip request */
|
||||||
|
if (state->seek) {
|
||||||
|
state->seek = 0;
|
||||||
|
if (gz_skip(state, state->skip) == -1)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get len bytes to buf, or less than len if at the end */
|
||||||
|
got = 0;
|
||||||
|
do {
|
||||||
|
/* first just try copying data from the output buffer */
|
||||||
|
if (state->have) {
|
||||||
|
n = state->have > len ? len : state->have;
|
||||||
|
memcpy(buf, state->next, n);
|
||||||
|
state->next += n;
|
||||||
|
state->have -= n;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* output buffer empty -- return if we're at the end of the input */
|
||||||
|
else if (state->eof && strm->avail_in == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* need output data -- for small len or new stream load up our output
|
||||||
|
buffer */
|
||||||
|
else if (state->how == LOOK || len < (state->size << 1)) {
|
||||||
|
/* get more output, looking for header if required */
|
||||||
|
if (gz_make(state) == -1)
|
||||||
|
return -1;
|
||||||
|
continue; /* no progress yet -- go back to memcpy() above */
|
||||||
|
/* the copy above assures that we will leave with space in the
|
||||||
|
output buffer, allowing at least one gzungetc() to succeed */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* large len -- read directly into user buffer */
|
||||||
|
else if (state->how == COPY) { /* read directly */
|
||||||
|
if (gz_load(state, buf, len, &n) == -1)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* large len -- decompress directly into user buffer */
|
||||||
|
else { /* state->how == GZIP */
|
||||||
|
strm->avail_out = len;
|
||||||
|
strm->next_out = buf;
|
||||||
|
if (gz_decomp(state) == -1)
|
||||||
|
return -1;
|
||||||
|
n = state->have;
|
||||||
|
state->have = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* update progress */
|
||||||
|
len -= n;
|
||||||
|
buf = (char *)buf + n;
|
||||||
|
got += n;
|
||||||
|
state->pos += n;
|
||||||
|
} while (len);
|
||||||
|
|
||||||
|
/* return number of bytes read into user buffer (will fit in int) */
|
||||||
|
return (int)got;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
int ZEXPORT gzgetc(file)
|
||||||
|
gzFile file;
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
unsigned char buf[1];
|
||||||
|
gz_statep state;
|
||||||
|
|
||||||
|
/* get internal structure */
|
||||||
|
if (file == NULL)
|
||||||
|
return -1;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
|
||||||
|
/* check that we're reading and that there's no error */
|
||||||
|
if (state->mode != GZ_READ || state->err != Z_OK)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* try output buffer (no need to check for skip request) */
|
||||||
|
if (state->have) {
|
||||||
|
state->have--;
|
||||||
|
state->pos++;
|
||||||
|
return *(state->next)++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* nothing there -- try gzread() */
|
||||||
|
ret = gzread(file, buf, 1);
|
||||||
|
return ret < 1 ? -1 : buf[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
int ZEXPORT gzungetc(c, file)
|
||||||
|
int c;
|
||||||
|
gzFile file;
|
||||||
|
{
|
||||||
|
gz_statep state;
|
||||||
|
|
||||||
|
/* get internal structure */
|
||||||
|
if (file == NULL)
|
||||||
|
return -1;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
|
||||||
|
/* check that we're reading and that there's no error */
|
||||||
|
if (state->mode != GZ_READ || state->err != Z_OK)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* process a skip request */
|
||||||
|
if (state->seek) {
|
||||||
|
state->seek = 0;
|
||||||
|
if (gz_skip(state, state->skip) == -1)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* can't push EOF */
|
||||||
|
if (c < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* if output buffer empty, put byte at end (allows more pushing) */
|
||||||
|
if (state->have == 0) {
|
||||||
|
state->have = 1;
|
||||||
|
state->next = state->out + (state->size << 1) - 1;
|
||||||
|
state->next[0] = c;
|
||||||
|
state->pos--;
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if no room, give up (must have already done a gzungetc()) */
|
||||||
|
if (state->have == (state->size << 1)) {
|
||||||
|
gz_error(state, Z_BUF_ERROR, "out of room to push characters");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* slide output data if needed and insert byte before existing data */
|
||||||
|
if (state->next == state->out) {
|
||||||
|
unsigned char *src = state->out + state->have;
|
||||||
|
unsigned char *dest = state->out + (state->size << 1);
|
||||||
|
while (src > state->out)
|
||||||
|
*--dest = *--src;
|
||||||
|
state->next = dest;
|
||||||
|
}
|
||||||
|
state->have++;
|
||||||
|
state->next--;
|
||||||
|
state->next[0] = c;
|
||||||
|
state->pos--;
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
char * ZEXPORT gzgets(file, buf, len)
|
||||||
|
gzFile file;
|
||||||
|
char *buf;
|
||||||
|
int len;
|
||||||
|
{
|
||||||
|
unsigned left, n;
|
||||||
|
char *str;
|
||||||
|
unsigned char *eol;
|
||||||
|
gz_statep state;
|
||||||
|
|
||||||
|
/* check parameters and get internal structure */
|
||||||
|
if (file == NULL || buf == NULL || len < 1)
|
||||||
|
return NULL;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
|
||||||
|
/* check that we're reading and that there's no error */
|
||||||
|
if (state->mode != GZ_READ || state->err != Z_OK)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
/* process a skip request */
|
||||||
|
if (state->seek) {
|
||||||
|
state->seek = 0;
|
||||||
|
if (gz_skip(state, state->skip) == -1)
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* copy output bytes up to new line or len - 1, whichever comes first --
|
||||||
|
append a terminating zero to the string (we don't check for a zero in
|
||||||
|
the contents, let the user worry about that) */
|
||||||
|
str = buf;
|
||||||
|
left = (unsigned)len - 1;
|
||||||
|
if (left) do {
|
||||||
|
/* assure that something is in the output buffer */
|
||||||
|
if (state->have == 0) {
|
||||||
|
if (gz_make(state) == -1)
|
||||||
|
return NULL; /* error */
|
||||||
|
if (state->have == 0) { /* end of file */
|
||||||
|
if (buf == str) /* got bupkus */
|
||||||
|
return NULL;
|
||||||
|
break; /* got something -- return it */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* look for end-of-line in current output buffer */
|
||||||
|
n = state->have > left ? left : state->have;
|
||||||
|
eol = memchr(state->next, '\n', n);
|
||||||
|
if (eol != NULL)
|
||||||
|
n = (unsigned)(eol - state->next) + 1;
|
||||||
|
|
||||||
|
/* copy through end-of-line, or remainder if not found */
|
||||||
|
memcpy(buf, state->next, n);
|
||||||
|
state->have -= n;
|
||||||
|
state->next += n;
|
||||||
|
state->pos += n;
|
||||||
|
left -= n;
|
||||||
|
buf += n;
|
||||||
|
} while (left && eol == NULL);
|
||||||
|
|
||||||
|
/* found end-of-line or out of space -- terminate string and return it */
|
||||||
|
buf[0] = 0;
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
int ZEXPORT gzdirect(file)
|
||||||
|
gzFile file;
|
||||||
|
{
|
||||||
|
gz_statep state;
|
||||||
|
|
||||||
|
/* get internal structure */
|
||||||
|
if (file == NULL)
|
||||||
|
return 0;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
|
||||||
|
/* check that we're reading */
|
||||||
|
if (state->mode != GZ_READ)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* if the state is not known, but we can find out, then do so (this is
|
||||||
|
mainly for right after a gzopen() or gzdopen()) */
|
||||||
|
if (state->how == LOOK && state->have == 0)
|
||||||
|
(void)gz_head(state);
|
||||||
|
|
||||||
|
/* return 1 if reading direct, 0 if decompressing a gzip stream */
|
||||||
|
return state->direct;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
int ZEXPORT gzclose_r(file)
|
||||||
|
gzFile file;
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
gz_statep state;
|
||||||
|
|
||||||
|
/* get internal structure */
|
||||||
|
if (file == NULL)
|
||||||
|
return Z_STREAM_ERROR;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
|
||||||
|
/* check that we're reading */
|
||||||
|
if (state->mode != GZ_READ)
|
||||||
|
return Z_STREAM_ERROR;
|
||||||
|
|
||||||
|
/* free memory and close file */
|
||||||
|
if (state->size) {
|
||||||
|
inflateEnd(&(state->strm));
|
||||||
|
free(state->out);
|
||||||
|
free(state->in);
|
||||||
|
}
|
||||||
|
gz_error(state, Z_OK, NULL);
|
||||||
|
free(state->path);
|
||||||
|
ret = _close(state->fd);
|
||||||
|
free(state);
|
||||||
|
return ret ? Z_ERRNO : Z_OK;
|
||||||
|
}
|
|
@ -0,0 +1,531 @@
|
||||||
|
/* gzwrite.c -- zlib functions for writing gzip files
|
||||||
|
* Copyright (C) 2004, 2005, 2010 Mark Adler
|
||||||
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gzguts.h"
|
||||||
|
|
||||||
|
/* Local functions */
|
||||||
|
local int gz_init OF((gz_statep));
|
||||||
|
local int gz_comp OF((gz_statep, int));
|
||||||
|
local int gz_zero OF((gz_statep, z_off64_t));
|
||||||
|
|
||||||
|
/* Initialize state for writing a gzip file. Mark initialization by setting
|
||||||
|
state->size to non-zero. Return -1 on failure or 0 on success. */
|
||||||
|
local int gz_init(state)
|
||||||
|
gz_statep state;
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
z_streamp strm = &(state->strm);
|
||||||
|
|
||||||
|
/* allocate input and output buffers */
|
||||||
|
state->in = malloc(state->want);
|
||||||
|
state->out = malloc(state->want);
|
||||||
|
if (state->in == NULL || state->out == NULL) {
|
||||||
|
if (state->out != NULL)
|
||||||
|
free(state->out);
|
||||||
|
if (state->in != NULL)
|
||||||
|
free(state->in);
|
||||||
|
gz_error(state, Z_MEM_ERROR, "out of memory");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* allocate deflate memory, set up for gzip compression */
|
||||||
|
strm->zalloc = Z_NULL;
|
||||||
|
strm->zfree = Z_NULL;
|
||||||
|
strm->opaque = Z_NULL;
|
||||||
|
ret = deflateInit2(strm, state->level, Z_DEFLATED,
|
||||||
|
15 + 16, 8, state->strategy);
|
||||||
|
if (ret != Z_OK) {
|
||||||
|
free(state->in);
|
||||||
|
gz_error(state, Z_MEM_ERROR, "out of memory");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* mark state as initialized */
|
||||||
|
state->size = state->want;
|
||||||
|
|
||||||
|
/* initialize write buffer */
|
||||||
|
strm->avail_out = state->size;
|
||||||
|
strm->next_out = state->out;
|
||||||
|
state->next = strm->next_out;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Compress whatever is at avail_in and next_in and write to the output file.
|
||||||
|
Return -1 if there is an error writing to the output file, otherwise 0.
|
||||||
|
flush is assumed to be a valid deflate() flush value. If flush is Z_FINISH,
|
||||||
|
then the deflate() state is reset to start a new gzip stream. */
|
||||||
|
local int gz_comp(state, flush)
|
||||||
|
gz_statep state;
|
||||||
|
int flush;
|
||||||
|
{
|
||||||
|
int ret, got;
|
||||||
|
unsigned have;
|
||||||
|
z_streamp strm = &(state->strm);
|
||||||
|
|
||||||
|
/* allocate memory if this is the first time through */
|
||||||
|
if (state->size == 0 && gz_init(state) == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* run deflate() on provided input until it produces no more output */
|
||||||
|
ret = Z_OK;
|
||||||
|
do {
|
||||||
|
/* write out current buffer contents if full, or if flushing, but if
|
||||||
|
doing Z_FINISH then don't write until we get to Z_STREAM_END */
|
||||||
|
if (strm->avail_out == 0 || (flush != Z_NO_FLUSH &&
|
||||||
|
(flush != Z_FINISH || ret == Z_STREAM_END))) {
|
||||||
|
have = (unsigned)(strm->next_out - state->next);
|
||||||
|
if (have && ((got = _write(state->fd, state->next, have)) < 0 ||
|
||||||
|
(unsigned)got != have)) {
|
||||||
|
gz_error(state, Z_ERRNO, zstrerror());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (strm->avail_out == 0) {
|
||||||
|
strm->avail_out = state->size;
|
||||||
|
strm->next_out = state->out;
|
||||||
|
}
|
||||||
|
state->next = strm->next_out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* compress */
|
||||||
|
have = strm->avail_out;
|
||||||
|
ret = deflate(strm, flush);
|
||||||
|
if (ret == Z_STREAM_ERROR) {
|
||||||
|
gz_error(state, Z_STREAM_ERROR,
|
||||||
|
"internal error: deflate stream corrupt");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
have -= strm->avail_out;
|
||||||
|
} while (have);
|
||||||
|
|
||||||
|
/* if that completed a deflate stream, allow another to start */
|
||||||
|
if (flush == Z_FINISH)
|
||||||
|
deflateReset(strm);
|
||||||
|
|
||||||
|
/* all done, no errors */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Compress len zeros to output. Return -1 on error, 0 on success. */
|
||||||
|
local int gz_zero(state, len)
|
||||||
|
gz_statep state;
|
||||||
|
z_off64_t len;
|
||||||
|
{
|
||||||
|
int first;
|
||||||
|
unsigned n;
|
||||||
|
z_streamp strm = &(state->strm);
|
||||||
|
|
||||||
|
/* consume whatever's left in the input buffer */
|
||||||
|
if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* compress len zeros (len guaranteed > 0) */
|
||||||
|
first = 1;
|
||||||
|
while (len) {
|
||||||
|
n = GT_OFF(state->size) || (z_off64_t)state->size > len ?
|
||||||
|
(unsigned)len : state->size;
|
||||||
|
if (first) {
|
||||||
|
memset(state->in, 0, n);
|
||||||
|
first = 0;
|
||||||
|
}
|
||||||
|
strm->avail_in = n;
|
||||||
|
strm->next_in = state->in;
|
||||||
|
state->pos += n;
|
||||||
|
if (gz_comp(state, Z_NO_FLUSH) == -1)
|
||||||
|
return -1;
|
||||||
|
len -= n;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
int ZEXPORT gzwrite(file, buf, len)
|
||||||
|
gzFile file;
|
||||||
|
voidpc buf;
|
||||||
|
unsigned len;
|
||||||
|
{
|
||||||
|
unsigned put = len;
|
||||||
|
unsigned n;
|
||||||
|
gz_statep state;
|
||||||
|
z_streamp strm;
|
||||||
|
|
||||||
|
/* get internal structure */
|
||||||
|
if (file == NULL)
|
||||||
|
return 0;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
strm = &(state->strm);
|
||||||
|
|
||||||
|
/* check that we're writing and that there's no error */
|
||||||
|
if (state->mode != GZ_WRITE || state->err != Z_OK)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* since an int is returned, make sure len fits in one, otherwise return
|
||||||
|
with an error (this avoids the flaw in the interface) */
|
||||||
|
if ((int)len < 0) {
|
||||||
|
gz_error(state, Z_BUF_ERROR, "requested length does not fit in int");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* if len is zero, avoid unnecessary operations */
|
||||||
|
if (len == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* allocate memory if this is the first time through */
|
||||||
|
if (state->size == 0 && gz_init(state) == -1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* check for seek request */
|
||||||
|
if (state->seek) {
|
||||||
|
state->seek = 0;
|
||||||
|
if (gz_zero(state, state->skip) == -1)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* for small len, copy to input buffer, otherwise compress directly */
|
||||||
|
if (len < state->size) {
|
||||||
|
/* copy to input buffer, compress when full */
|
||||||
|
do {
|
||||||
|
if (strm->avail_in == 0)
|
||||||
|
strm->next_in = state->in;
|
||||||
|
n = state->size - strm->avail_in;
|
||||||
|
if (n > len)
|
||||||
|
n = len;
|
||||||
|
memcpy(strm->next_in + strm->avail_in, buf, n);
|
||||||
|
strm->avail_in += n;
|
||||||
|
state->pos += n;
|
||||||
|
buf = (char *)buf + n;
|
||||||
|
len -= n;
|
||||||
|
if (len && gz_comp(state, Z_NO_FLUSH) == -1)
|
||||||
|
return 0;
|
||||||
|
} while (len);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* consume whatever's left in the input buffer */
|
||||||
|
if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* directly compress user buffer to file */
|
||||||
|
strm->avail_in = len;
|
||||||
|
strm->next_in = (voidp)buf;
|
||||||
|
state->pos += len;
|
||||||
|
if (gz_comp(state, Z_NO_FLUSH) == -1)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* input was all buffered or compressed (put will fit in int) */
|
||||||
|
return (int)put;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
int ZEXPORT gzputc(file, c)
|
||||||
|
gzFile file;
|
||||||
|
int c;
|
||||||
|
{
|
||||||
|
unsigned char buf[1];
|
||||||
|
gz_statep state;
|
||||||
|
z_streamp strm;
|
||||||
|
|
||||||
|
/* get internal structure */
|
||||||
|
if (file == NULL)
|
||||||
|
return -1;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
strm = &(state->strm);
|
||||||
|
|
||||||
|
/* check that we're writing and that there's no error */
|
||||||
|
if (state->mode != GZ_WRITE || state->err != Z_OK)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
/* check for seek request */
|
||||||
|
if (state->seek) {
|
||||||
|
state->seek = 0;
|
||||||
|
if (gz_zero(state, state->skip) == -1)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* try writing to input buffer for speed (state->size == 0 if buffer not
|
||||||
|
initialized) */
|
||||||
|
if (strm->avail_in < state->size) {
|
||||||
|
if (strm->avail_in == 0)
|
||||||
|
strm->next_in = state->in;
|
||||||
|
strm->next_in[strm->avail_in++] = c;
|
||||||
|
state->pos++;
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* no room in buffer or not initialized, use gz_write() */
|
||||||
|
buf[0] = c;
|
||||||
|
if (gzwrite(file, buf, 1) != 1)
|
||||||
|
return -1;
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
int ZEXPORT gzputs(file, str)
|
||||||
|
gzFile file;
|
||||||
|
const char *str;
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
unsigned len;
|
||||||
|
|
||||||
|
/* write string */
|
||||||
|
len = (unsigned)strlen(str);
|
||||||
|
ret = gzwrite(file, str, len);
|
||||||
|
return ret == 0 && len != 0 ? -1 : ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef STDC
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
int ZEXPORTVA gzprintf (gzFile file, const char *format, ...)
|
||||||
|
{
|
||||||
|
int size, len;
|
||||||
|
gz_statep state;
|
||||||
|
z_streamp strm;
|
||||||
|
va_list va;
|
||||||
|
|
||||||
|
/* get internal structure */
|
||||||
|
if (file == NULL)
|
||||||
|
return -1;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
strm = &(state->strm);
|
||||||
|
|
||||||
|
/* check that we're writing and that there's no error */
|
||||||
|
if (state->mode != GZ_WRITE || state->err != Z_OK)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* make sure we have some buffer space */
|
||||||
|
if (state->size == 0 && gz_init(state) == -1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* check for seek request */
|
||||||
|
if (state->seek) {
|
||||||
|
state->seek = 0;
|
||||||
|
if (gz_zero(state, state->skip) == -1)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* consume whatever's left in the input buffer */
|
||||||
|
if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* do the printf() into the input buffer, put length in len */
|
||||||
|
size = (int)(state->size);
|
||||||
|
state->in[size - 1] = 0;
|
||||||
|
va_start(va, format);
|
||||||
|
#ifdef NO_vsnprintf
|
||||||
|
# ifdef HAS_vsprintf_void
|
||||||
|
(void)vsprintf(state->in, format, va);
|
||||||
|
va_end(va);
|
||||||
|
for (len = 0; len < size; len++)
|
||||||
|
if (state->in[len] == 0) break;
|
||||||
|
# else
|
||||||
|
len = vsprintf(state->in, format, va);
|
||||||
|
va_end(va);
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# ifdef HAS_vsnprintf_void
|
||||||
|
(void)vsnprintf(state->in, size, format, va);
|
||||||
|
va_end(va);
|
||||||
|
len = strlen(state->in);
|
||||||
|
# else
|
||||||
|
len = vsnprintf((char *)(state->in), size, format, va);
|
||||||
|
va_end(va);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* check that printf() results fit in buffer */
|
||||||
|
if (len <= 0 || len >= (int)size || state->in[size - 1] != 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* update buffer and position, defer compression until needed */
|
||||||
|
strm->avail_in = (unsigned)len;
|
||||||
|
strm->next_in = state->in;
|
||||||
|
state->pos += len;
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else /* !STDC */
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
|
||||||
|
a11, a12, a13, a14, a15, a16, a17, a18, a19, a20)
|
||||||
|
gzFile file;
|
||||||
|
const char *format;
|
||||||
|
int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,
|
||||||
|
a11, a12, a13, a14, a15, a16, a17, a18, a19, a20;
|
||||||
|
{
|
||||||
|
int size, len;
|
||||||
|
gz_statep state;
|
||||||
|
z_streamp strm;
|
||||||
|
|
||||||
|
/* get internal structure */
|
||||||
|
if (file == NULL)
|
||||||
|
return -1;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
strm = &(state->strm);
|
||||||
|
|
||||||
|
/* check that we're writing and that there's no error */
|
||||||
|
if (state->mode != GZ_WRITE || state->err != Z_OK)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* make sure we have some buffer space */
|
||||||
|
if (state->size == 0 && gz_init(state) == -1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* check for seek request */
|
||||||
|
if (state->seek) {
|
||||||
|
state->seek = 0;
|
||||||
|
if (gz_zero(state, state->skip) == -1)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* consume whatever's left in the input buffer */
|
||||||
|
if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* do the printf() into the input buffer, put length in len */
|
||||||
|
size = (int)(state->size);
|
||||||
|
state->in[size - 1] = 0;
|
||||||
|
#ifdef NO_snprintf
|
||||||
|
# ifdef HAS_sprintf_void
|
||||||
|
sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8,
|
||||||
|
a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
|
||||||
|
for (len = 0; len < size; len++)
|
||||||
|
if (state->in[len] == 0) break;
|
||||||
|
# else
|
||||||
|
len = sprintf(state->in, format, a1, a2, a3, a4, a5, a6, a7, a8,
|
||||||
|
a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# ifdef HAS_snprintf_void
|
||||||
|
snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8,
|
||||||
|
a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
|
||||||
|
len = strlen(state->in);
|
||||||
|
# else
|
||||||
|
len = snprintf(state->in, size, format, a1, a2, a3, a4, a5, a6, a7, a8,
|
||||||
|
a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* check that printf() results fit in buffer */
|
||||||
|
if (len <= 0 || len >= (int)size || state->in[size - 1] != 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* update buffer and position, defer compression until needed */
|
||||||
|
strm->avail_in = (unsigned)len;
|
||||||
|
strm->next_in = state->in;
|
||||||
|
state->pos += len;
|
||||||
|
return len;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
int ZEXPORT gzflush(file, flush)
|
||||||
|
gzFile file;
|
||||||
|
int flush;
|
||||||
|
{
|
||||||
|
gz_statep state;
|
||||||
|
|
||||||
|
/* get internal structure */
|
||||||
|
if (file == NULL)
|
||||||
|
return -1;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
|
||||||
|
/* check that we're writing and that there's no error */
|
||||||
|
if (state->mode != GZ_WRITE || state->err != Z_OK)
|
||||||
|
return Z_STREAM_ERROR;
|
||||||
|
|
||||||
|
/* check flush parameter */
|
||||||
|
if (flush < 0 || flush > Z_FINISH)
|
||||||
|
return Z_STREAM_ERROR;
|
||||||
|
|
||||||
|
/* check for seek request */
|
||||||
|
if (state->seek) {
|
||||||
|
state->seek = 0;
|
||||||
|
if (gz_zero(state, state->skip) == -1)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* compress remaining data with requested flush */
|
||||||
|
gz_comp(state, flush);
|
||||||
|
return state->err;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
int ZEXPORT gzsetparams(file, level, strategy)
|
||||||
|
gzFile file;
|
||||||
|
int level;
|
||||||
|
int strategy;
|
||||||
|
{
|
||||||
|
gz_statep state;
|
||||||
|
z_streamp strm;
|
||||||
|
|
||||||
|
/* get internal structure */
|
||||||
|
if (file == NULL)
|
||||||
|
return Z_STREAM_ERROR;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
strm = &(state->strm);
|
||||||
|
|
||||||
|
/* check that we're writing and that there's no error */
|
||||||
|
if (state->mode != GZ_WRITE || state->err != Z_OK)
|
||||||
|
return Z_STREAM_ERROR;
|
||||||
|
|
||||||
|
/* if no change is requested, then do nothing */
|
||||||
|
if (level == state->level && strategy == state->strategy)
|
||||||
|
return Z_OK;
|
||||||
|
|
||||||
|
/* check for seek request */
|
||||||
|
if (state->seek) {
|
||||||
|
state->seek = 0;
|
||||||
|
if (gz_zero(state, state->skip) == -1)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* change compression parameters for subsequent input */
|
||||||
|
if (state->size) {
|
||||||
|
/* flush previous input with previous parameters before changing */
|
||||||
|
if (strm->avail_in && gz_comp(state, Z_PARTIAL_FLUSH) == -1)
|
||||||
|
return state->err;
|
||||||
|
deflateParams(strm, level, strategy);
|
||||||
|
}
|
||||||
|
state->level = level;
|
||||||
|
state->strategy = strategy;
|
||||||
|
return Z_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* -- see zlib.h -- */
|
||||||
|
int ZEXPORT gzclose_w(file)
|
||||||
|
gzFile file;
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
gz_statep state;
|
||||||
|
|
||||||
|
/* get internal structure */
|
||||||
|
if (file == NULL)
|
||||||
|
return Z_STREAM_ERROR;
|
||||||
|
state = (gz_statep)file;
|
||||||
|
|
||||||
|
/* check that we're writing */
|
||||||
|
if (state->mode != GZ_WRITE)
|
||||||
|
return Z_STREAM_ERROR;
|
||||||
|
|
||||||
|
/* check for seek request */
|
||||||
|
if (state->seek) {
|
||||||
|
state->seek = 0;
|
||||||
|
ret += gz_zero(state, state->skip);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* flush, free memory, and close file */
|
||||||
|
ret += gz_comp(state, Z_FINISH);
|
||||||
|
(void)deflateEnd(&(state->strm));
|
||||||
|
free(state->out);
|
||||||
|
free(state->in);
|
||||||
|
gz_error(state, Z_OK, NULL);
|
||||||
|
free(state->path);
|
||||||
|
ret += _close(state->fd);
|
||||||
|
free(state);
|
||||||
|
return ret ? Z_ERRNO : Z_OK;
|
||||||
|
}
|
|
@ -1,5 +1,5 @@
|
||||||
/* infback.c -- inflate using a call-back interface
|
/* infback.c -- inflate using a call-back interface
|
||||||
* Copyright (C) 1995-2005 Mark Adler
|
* Copyright (C) 1995-2009 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ int stream_size;
|
||||||
state->wbits = windowBits;
|
state->wbits = windowBits;
|
||||||
state->wsize = 1U << windowBits;
|
state->wsize = 1U << windowBits;
|
||||||
state->window = window;
|
state->window = window;
|
||||||
state->write = 0;
|
state->wnext = 0;
|
||||||
state->whave = 0;
|
state->whave = 0;
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ void FAR *out_desc;
|
||||||
unsigned bits; /* bits in bit buffer */
|
unsigned bits; /* bits in bit buffer */
|
||||||
unsigned copy; /* number of stored or match bytes to copy */
|
unsigned copy; /* number of stored or match bytes to copy */
|
||||||
unsigned char FAR *from; /* where to copy match bytes from */
|
unsigned char FAR *from; /* where to copy match bytes from */
|
||||||
code this; /* current decoding table entry */
|
code here; /* current decoding table entry */
|
||||||
code last; /* parent table entry */
|
code last; /* parent table entry */
|
||||||
unsigned len; /* length to copy for repeats, bits to drop */
|
unsigned len; /* length to copy for repeats, bits to drop */
|
||||||
int ret; /* return code */
|
int ret; /* return code */
|
||||||
|
@ -389,19 +389,19 @@ void FAR *out_desc;
|
||||||
state->have = 0;
|
state->have = 0;
|
||||||
while (state->have < state->nlen + state->ndist) {
|
while (state->have < state->nlen + state->ndist) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
this = state->lencode[BITS(state->lenbits)];
|
here = state->lencode[BITS(state->lenbits)];
|
||||||
if ((unsigned)(this.bits) <= bits) break;
|
if ((unsigned)(here.bits) <= bits) break;
|
||||||
PULLBYTE();
|
PULLBYTE();
|
||||||
}
|
}
|
||||||
if (this.val < 16) {
|
if (here.val < 16) {
|
||||||
NEEDBITS(this.bits);
|
NEEDBITS(here.bits);
|
||||||
DROPBITS(this.bits);
|
DROPBITS(here.bits);
|
||||||
state->lens[state->have++] = this.val;
|
state->lens[state->have++] = here.val;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (this.val == 16) {
|
if (here.val == 16) {
|
||||||
NEEDBITS(this.bits + 2);
|
NEEDBITS(here.bits + 2);
|
||||||
DROPBITS(this.bits);
|
DROPBITS(here.bits);
|
||||||
if (state->have == 0) {
|
if (state->have == 0) {
|
||||||
strm->msg = (char *)"invalid bit length repeat";
|
strm->msg = (char *)"invalid bit length repeat";
|
||||||
state->mode = BAD;
|
state->mode = BAD;
|
||||||
|
@ -411,16 +411,16 @@ void FAR *out_desc;
|
||||||
copy = 3 + BITS(2);
|
copy = 3 + BITS(2);
|
||||||
DROPBITS(2);
|
DROPBITS(2);
|
||||||
}
|
}
|
||||||
else if (this.val == 17) {
|
else if (here.val == 17) {
|
||||||
NEEDBITS(this.bits + 3);
|
NEEDBITS(here.bits + 3);
|
||||||
DROPBITS(this.bits);
|
DROPBITS(here.bits);
|
||||||
len = 0;
|
len = 0;
|
||||||
copy = 3 + BITS(3);
|
copy = 3 + BITS(3);
|
||||||
DROPBITS(3);
|
DROPBITS(3);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
NEEDBITS(this.bits + 7);
|
NEEDBITS(here.bits + 7);
|
||||||
DROPBITS(this.bits);
|
DROPBITS(here.bits);
|
||||||
len = 0;
|
len = 0;
|
||||||
copy = 11 + BITS(7);
|
copy = 11 + BITS(7);
|
||||||
DROPBITS(7);
|
DROPBITS(7);
|
||||||
|
@ -438,7 +438,16 @@ void FAR *out_desc;
|
||||||
/* handle error breaks in while */
|
/* handle error breaks in while */
|
||||||
if (state->mode == BAD) break;
|
if (state->mode == BAD) break;
|
||||||
|
|
||||||
/* build code tables */
|
/* check for end-of-block code (better have one) */
|
||||||
|
if (state->lens[256] == 0) {
|
||||||
|
strm->msg = (char *)"invalid code -- missing end-of-block";
|
||||||
|
state->mode = BAD;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* build code tables -- note: do not change the lenbits or distbits
|
||||||
|
values here (9 and 6) without reading the comments in inftrees.h
|
||||||
|
concerning the ENOUGH constants, which depend on those values */
|
||||||
state->next = state->codes;
|
state->next = state->codes;
|
||||||
state->lencode = (code const FAR *)(state->next);
|
state->lencode = (code const FAR *)(state->next);
|
||||||
state->lenbits = 9;
|
state->lenbits = 9;
|
||||||
|
@ -474,28 +483,28 @@ void FAR *out_desc;
|
||||||
|
|
||||||
/* get a literal, length, or end-of-block code */
|
/* get a literal, length, or end-of-block code */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
this = state->lencode[BITS(state->lenbits)];
|
here = state->lencode[BITS(state->lenbits)];
|
||||||
if ((unsigned)(this.bits) <= bits) break;
|
if ((unsigned)(here.bits) <= bits) break;
|
||||||
PULLBYTE();
|
PULLBYTE();
|
||||||
}
|
}
|
||||||
if (this.op && (this.op & 0xf0) == 0) {
|
if (here.op && (here.op & 0xf0) == 0) {
|
||||||
last = this;
|
last = here;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
this = state->lencode[last.val +
|
here = state->lencode[last.val +
|
||||||
(BITS(last.bits + last.op) >> last.bits)];
|
(BITS(last.bits + last.op) >> last.bits)];
|
||||||
if ((unsigned)(last.bits + this.bits) <= bits) break;
|
if ((unsigned)(last.bits + here.bits) <= bits) break;
|
||||||
PULLBYTE();
|
PULLBYTE();
|
||||||
}
|
}
|
||||||
DROPBITS(last.bits);
|
DROPBITS(last.bits);
|
||||||
}
|
}
|
||||||
DROPBITS(this.bits);
|
DROPBITS(here.bits);
|
||||||
state->length = (unsigned)this.val;
|
state->length = (unsigned)here.val;
|
||||||
|
|
||||||
/* process literal */
|
/* process literal */
|
||||||
if (this.op == 0) {
|
if (here.op == 0) {
|
||||||
Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
|
Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
|
||||||
"inflate: literal '%c'\n" :
|
"inflate: literal '%c'\n" :
|
||||||
"inflate: literal 0x%02x\n", this.val));
|
"inflate: literal 0x%02x\n", here.val));
|
||||||
ROOM();
|
ROOM();
|
||||||
*put++ = (unsigned char)(state->length);
|
*put++ = (unsigned char)(state->length);
|
||||||
left--;
|
left--;
|
||||||
|
@ -504,21 +513,21 @@ void FAR *out_desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* process end of block */
|
/* process end of block */
|
||||||
if (this.op & 32) {
|
if (here.op & 32) {
|
||||||
Tracevv((stderr, "inflate: end of block\n"));
|
Tracevv((stderr, "inflate: end of block\n"));
|
||||||
state->mode = TYPE;
|
state->mode = TYPE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* invalid code */
|
/* invalid code */
|
||||||
if (this.op & 64) {
|
if (here.op & 64) {
|
||||||
strm->msg = (char *)"invalid literal/length code";
|
strm->msg = (char *)"invalid literal/length code";
|
||||||
state->mode = BAD;
|
state->mode = BAD;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* length code -- get extra bits, if any */
|
/* length code -- get extra bits, if any */
|
||||||
state->extra = (unsigned)(this.op) & 15;
|
state->extra = (unsigned)(here.op) & 15;
|
||||||
if (state->extra != 0) {
|
if (state->extra != 0) {
|
||||||
NEEDBITS(state->extra);
|
NEEDBITS(state->extra);
|
||||||
state->length += BITS(state->extra);
|
state->length += BITS(state->extra);
|
||||||
|
@ -528,30 +537,30 @@ void FAR *out_desc;
|
||||||
|
|
||||||
/* get distance code */
|
/* get distance code */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
this = state->distcode[BITS(state->distbits)];
|
here = state->distcode[BITS(state->distbits)];
|
||||||
if ((unsigned)(this.bits) <= bits) break;
|
if ((unsigned)(here.bits) <= bits) break;
|
||||||
PULLBYTE();
|
PULLBYTE();
|
||||||
}
|
}
|
||||||
if ((this.op & 0xf0) == 0) {
|
if ((here.op & 0xf0) == 0) {
|
||||||
last = this;
|
last = here;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
this = state->distcode[last.val +
|
here = state->distcode[last.val +
|
||||||
(BITS(last.bits + last.op) >> last.bits)];
|
(BITS(last.bits + last.op) >> last.bits)];
|
||||||
if ((unsigned)(last.bits + this.bits) <= bits) break;
|
if ((unsigned)(last.bits + here.bits) <= bits) break;
|
||||||
PULLBYTE();
|
PULLBYTE();
|
||||||
}
|
}
|
||||||
DROPBITS(last.bits);
|
DROPBITS(last.bits);
|
||||||
}
|
}
|
||||||
DROPBITS(this.bits);
|
DROPBITS(here.bits);
|
||||||
if (this.op & 64) {
|
if (here.op & 64) {
|
||||||
strm->msg = (char *)"invalid distance code";
|
strm->msg = (char *)"invalid distance code";
|
||||||
state->mode = BAD;
|
state->mode = BAD;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
state->offset = (unsigned)this.val;
|
state->offset = (unsigned)here.val;
|
||||||
|
|
||||||
/* get distance extra bits, if any */
|
/* get distance extra bits, if any */
|
||||||
state->extra = (unsigned)(this.op) & 15;
|
state->extra = (unsigned)(here.op) & 15;
|
||||||
if (state->extra != 0) {
|
if (state->extra != 0) {
|
||||||
NEEDBITS(state->extra);
|
NEEDBITS(state->extra);
|
||||||
state->offset += BITS(state->extra);
|
state->offset += BITS(state->extra);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* inffast.c -- fast decoding
|
/* inffast.c -- fast decoding
|
||||||
* Copyright (C) 1995-2004 Mark Adler
|
* Copyright (C) 1995-2008, 2010 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
requires strm->avail_out >= 258 for each loop to avoid checking for
|
requires strm->avail_out >= 258 for each loop to avoid checking for
|
||||||
output space.
|
output space.
|
||||||
*/
|
*/
|
||||||
void inflate_fast(strm, start)
|
void ZLIB_INTERNAL inflate_fast(strm, start)
|
||||||
z_streamp strm;
|
z_streamp strm;
|
||||||
unsigned start; /* inflate()'s starting value for strm->avail_out */
|
unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||||
{
|
{
|
||||||
|
@ -79,7 +79,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||||
#endif
|
#endif
|
||||||
unsigned wsize; /* window size or zero if not using window */
|
unsigned wsize; /* window size or zero if not using window */
|
||||||
unsigned whave; /* valid bytes in the window */
|
unsigned whave; /* valid bytes in the window */
|
||||||
unsigned write; /* window write index */
|
unsigned wnext; /* window write index */
|
||||||
unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */
|
unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */
|
||||||
unsigned long hold; /* local strm->hold */
|
unsigned long hold; /* local strm->hold */
|
||||||
unsigned bits; /* local strm->bits */
|
unsigned bits; /* local strm->bits */
|
||||||
|
@ -87,7 +87,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||||
code const FAR *dcode; /* local strm->distcode */
|
code const FAR *dcode; /* local strm->distcode */
|
||||||
unsigned lmask; /* mask for first level of length codes */
|
unsigned lmask; /* mask for first level of length codes */
|
||||||
unsigned dmask; /* mask for first level of distance codes */
|
unsigned dmask; /* mask for first level of distance codes */
|
||||||
code this; /* retrieved table entry */
|
code here; /* retrieved table entry */
|
||||||
unsigned op; /* code bits, operation, extra bits, or */
|
unsigned op; /* code bits, operation, extra bits, or */
|
||||||
/* window position, window bytes to copy */
|
/* window position, window bytes to copy */
|
||||||
unsigned len; /* match length, unused bytes */
|
unsigned len; /* match length, unused bytes */
|
||||||
|
@ -106,7 +106,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||||
#endif
|
#endif
|
||||||
wsize = state->wsize;
|
wsize = state->wsize;
|
||||||
whave = state->whave;
|
whave = state->whave;
|
||||||
write = state->write;
|
wnext = state->wnext;
|
||||||
window = state->window;
|
window = state->window;
|
||||||
hold = state->hold;
|
hold = state->hold;
|
||||||
bits = state->bits;
|
bits = state->bits;
|
||||||
|
@ -124,20 +124,20 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||||
hold += (unsigned long)(PUP(in)) << bits;
|
hold += (unsigned long)(PUP(in)) << bits;
|
||||||
bits += 8;
|
bits += 8;
|
||||||
}
|
}
|
||||||
this = lcode[hold & lmask];
|
here = lcode[hold & lmask];
|
||||||
dolen:
|
dolen:
|
||||||
op = (unsigned)(this.bits);
|
op = (unsigned)(here.bits);
|
||||||
hold >>= op;
|
hold >>= op;
|
||||||
bits -= op;
|
bits -= op;
|
||||||
op = (unsigned)(this.op);
|
op = (unsigned)(here.op);
|
||||||
if (op == 0) { /* literal */
|
if (op == 0) { /* literal */
|
||||||
Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
|
Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
|
||||||
"inflate: literal '%c'\n" :
|
"inflate: literal '%c'\n" :
|
||||||
"inflate: literal 0x%02x\n", this.val));
|
"inflate: literal 0x%02x\n", here.val));
|
||||||
PUP(out) = (unsigned char)(this.val);
|
PUP(out) = (unsigned char)(here.val);
|
||||||
}
|
}
|
||||||
else if (op & 16) { /* length base */
|
else if (op & 16) { /* length base */
|
||||||
len = (unsigned)(this.val);
|
len = (unsigned)(here.val);
|
||||||
op &= 15; /* number of extra bits */
|
op &= 15; /* number of extra bits */
|
||||||
if (op) {
|
if (op) {
|
||||||
if (bits < op) {
|
if (bits < op) {
|
||||||
|
@ -155,14 +155,14 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||||
hold += (unsigned long)(PUP(in)) << bits;
|
hold += (unsigned long)(PUP(in)) << bits;
|
||||||
bits += 8;
|
bits += 8;
|
||||||
}
|
}
|
||||||
this = dcode[hold & dmask];
|
here = dcode[hold & dmask];
|
||||||
dodist:
|
dodist:
|
||||||
op = (unsigned)(this.bits);
|
op = (unsigned)(here.bits);
|
||||||
hold >>= op;
|
hold >>= op;
|
||||||
bits -= op;
|
bits -= op;
|
||||||
op = (unsigned)(this.op);
|
op = (unsigned)(here.op);
|
||||||
if (op & 16) { /* distance base */
|
if (op & 16) { /* distance base */
|
||||||
dist = (unsigned)(this.val);
|
dist = (unsigned)(here.val);
|
||||||
op &= 15; /* number of extra bits */
|
op &= 15; /* number of extra bits */
|
||||||
if (bits < op) {
|
if (bits < op) {
|
||||||
hold += (unsigned long)(PUP(in)) << bits;
|
hold += (unsigned long)(PUP(in)) << bits;
|
||||||
|
@ -187,12 +187,34 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||||
if (dist > op) { /* see if copy from window */
|
if (dist > op) { /* see if copy from window */
|
||||||
op = dist - op; /* distance back in window */
|
op = dist - op; /* distance back in window */
|
||||||
if (op > whave) {
|
if (op > whave) {
|
||||||
strm->msg = (char *)"invalid distance too far back";
|
if (state->sane) {
|
||||||
state->mode = BAD;
|
strm->msg =
|
||||||
break;
|
(char *)"invalid distance too far back";
|
||||||
|
state->mode = BAD;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
|
||||||
|
if (len <= op - whave) {
|
||||||
|
do {
|
||||||
|
PUP(out) = 0;
|
||||||
|
} while (--len);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
len -= op - whave;
|
||||||
|
do {
|
||||||
|
PUP(out) = 0;
|
||||||
|
} while (--op > whave);
|
||||||
|
if (op == 0) {
|
||||||
|
from = out - dist;
|
||||||
|
do {
|
||||||
|
PUP(out) = PUP(from);
|
||||||
|
} while (--len);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
from = window - OFF;
|
from = window - OFF;
|
||||||
if (write == 0) { /* very common case */
|
if (wnext == 0) { /* very common case */
|
||||||
from += wsize - op;
|
from += wsize - op;
|
||||||
if (op < len) { /* some from window */
|
if (op < len) { /* some from window */
|
||||||
len -= op;
|
len -= op;
|
||||||
|
@ -202,17 +224,17 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||||
from = out - dist; /* rest from output */
|
from = out - dist; /* rest from output */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (write < op) { /* wrap around window */
|
else if (wnext < op) { /* wrap around window */
|
||||||
from += wsize + write - op;
|
from += wsize + wnext - op;
|
||||||
op -= write;
|
op -= wnext;
|
||||||
if (op < len) { /* some from end of window */
|
if (op < len) { /* some from end of window */
|
||||||
len -= op;
|
len -= op;
|
||||||
do {
|
do {
|
||||||
PUP(out) = PUP(from);
|
PUP(out) = PUP(from);
|
||||||
} while (--op);
|
} while (--op);
|
||||||
from = window - OFF;
|
from = window - OFF;
|
||||||
if (write < len) { /* some from start of window */
|
if (wnext < len) { /* some from start of window */
|
||||||
op = write;
|
op = wnext;
|
||||||
len -= op;
|
len -= op;
|
||||||
do {
|
do {
|
||||||
PUP(out) = PUP(from);
|
PUP(out) = PUP(from);
|
||||||
|
@ -222,7 +244,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else { /* contiguous in window */
|
else { /* contiguous in window */
|
||||||
from += write - op;
|
from += wnext - op;
|
||||||
if (op < len) { /* some from window */
|
if (op < len) { /* some from window */
|
||||||
len -= op;
|
len -= op;
|
||||||
do {
|
do {
|
||||||
|
@ -259,7 +281,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((op & 64) == 0) { /* 2nd level distance code */
|
else if ((op & 64) == 0) { /* 2nd level distance code */
|
||||||
this = dcode[this.val + (hold & ((1U << op) - 1))];
|
here = dcode[here.val + (hold & ((1U << op) - 1))];
|
||||||
goto dodist;
|
goto dodist;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -269,7 +291,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((op & 64) == 0) { /* 2nd level length code */
|
else if ((op & 64) == 0) { /* 2nd level length code */
|
||||||
this = lcode[this.val + (hold & ((1U << op) - 1))];
|
here = lcode[here.val + (hold & ((1U << op) - 1))];
|
||||||
goto dolen;
|
goto dolen;
|
||||||
}
|
}
|
||||||
else if (op & 32) { /* end-of-block */
|
else if (op & 32) { /* end-of-block */
|
||||||
|
@ -305,7 +327,7 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||||
inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe):
|
inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe):
|
||||||
- Using bit fields for code structure
|
- Using bit fields for code structure
|
||||||
- Different op definition to avoid & for extra bits (do & for table bits)
|
- Different op definition to avoid & for extra bits (do & for table bits)
|
||||||
- Three separate decoding do-loops for direct, window, and write == 0
|
- Three separate decoding do-loops for direct, window, and wnext == 0
|
||||||
- Special case for distance > 1 copies to do overlapped load and store copy
|
- Special case for distance > 1 copies to do overlapped load and store copy
|
||||||
- Explicit branch predictions (based on measured branch probabilities)
|
- Explicit branch predictions (based on measured branch probabilities)
|
||||||
- Deferring match copy and interspersed it with decoding subsequent codes
|
- Deferring match copy and interspersed it with decoding subsequent codes
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* inffast.h -- header to use inffast.c
|
/* inffast.h -- header to use inffast.c
|
||||||
* Copyright (C) 1995-2003 Mark Adler
|
* Copyright (C) 1995-2003, 2010 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -8,4 +8,4 @@
|
||||||
subject to change. Applications should only use zlib.h.
|
subject to change. Applications should only use zlib.h.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void inflate_fast OF((z_streamp strm, unsigned start));
|
void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start));
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* inflate.c -- zlib decompression
|
/* inflate.c -- zlib decompression
|
||||||
* Copyright (C) 1995-2005 Mark Adler
|
* Copyright (C) 1995-2010 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
* - Rearrange window copies in inflate_fast() for speed and simplification
|
* - Rearrange window copies in inflate_fast() for speed and simplification
|
||||||
* - Unroll last copy for window match in inflate_fast()
|
* - Unroll last copy for window match in inflate_fast()
|
||||||
* - Use local copies of window variables in inflate_fast() for speed
|
* - Use local copies of window variables in inflate_fast() for speed
|
||||||
* - Pull out common write == 0 case for speed in inflate_fast()
|
* - Pull out common wnext == 0 case for speed in inflate_fast()
|
||||||
* - Make op and len in inflate_fast() unsigned for consistency
|
* - Make op and len in inflate_fast() unsigned for consistency
|
||||||
* - Add FAR to lcode and dcode declarations in inflate_fast()
|
* - Add FAR to lcode and dcode declarations in inflate_fast()
|
||||||
* - Simplified bad distance check in inflate_fast()
|
* - Simplified bad distance check in inflate_fast()
|
||||||
|
@ -117,28 +117,52 @@ z_streamp strm;
|
||||||
state->head = Z_NULL;
|
state->head = Z_NULL;
|
||||||
state->wsize = 0;
|
state->wsize = 0;
|
||||||
state->whave = 0;
|
state->whave = 0;
|
||||||
state->write = 0;
|
state->wnext = 0;
|
||||||
state->hold = 0;
|
state->hold = 0;
|
||||||
state->bits = 0;
|
state->bits = 0;
|
||||||
state->lencode = state->distcode = state->next = state->codes;
|
state->lencode = state->distcode = state->next = state->codes;
|
||||||
|
state->sane = 1;
|
||||||
|
state->back = -1;
|
||||||
Tracev((stderr, "inflate: reset\n"));
|
Tracev((stderr, "inflate: reset\n"));
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflatePrime(strm, bits, value)
|
int ZEXPORT inflateReset2(strm, windowBits)
|
||||||
z_streamp strm;
|
z_streamp strm;
|
||||||
int bits;
|
int windowBits;
|
||||||
int value;
|
|
||||||
{
|
{
|
||||||
|
int wrap;
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
|
/* get the state */
|
||||||
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
|
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
|
||||||
state = (struct inflate_state FAR *)strm->state;
|
state = (struct inflate_state FAR *)strm->state;
|
||||||
if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;
|
|
||||||
value &= (1L << bits) - 1;
|
/* extract wrap request from windowBits parameter */
|
||||||
state->hold += value << state->bits;
|
if (windowBits < 0) {
|
||||||
state->bits += bits;
|
wrap = 0;
|
||||||
return Z_OK;
|
windowBits = -windowBits;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
wrap = (windowBits >> 4) + 1;
|
||||||
|
#ifdef GUNZIP
|
||||||
|
if (windowBits < 48)
|
||||||
|
windowBits &= 15;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set number of window bits, free window if different */
|
||||||
|
if (windowBits && (windowBits < 8 || windowBits > 15))
|
||||||
|
return Z_STREAM_ERROR;
|
||||||
|
if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
|
||||||
|
ZFREE(strm, state->window);
|
||||||
|
state->window = Z_NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* update state and reset the rest of it */
|
||||||
|
state->wrap = wrap;
|
||||||
|
state->wbits = (unsigned)windowBits;
|
||||||
|
return inflateReset(strm);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
|
int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size)
|
||||||
|
@ -147,6 +171,7 @@ int windowBits;
|
||||||
const char *version;
|
const char *version;
|
||||||
int stream_size;
|
int stream_size;
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
struct inflate_state FAR *state;
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
|
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
|
||||||
|
@ -164,24 +189,13 @@ int stream_size;
|
||||||
if (state == Z_NULL) return Z_MEM_ERROR;
|
if (state == Z_NULL) return Z_MEM_ERROR;
|
||||||
Tracev((stderr, "inflate: allocated\n"));
|
Tracev((stderr, "inflate: allocated\n"));
|
||||||
strm->state = (struct internal_state FAR *)state;
|
strm->state = (struct internal_state FAR *)state;
|
||||||
if (windowBits < 0) {
|
state->window = Z_NULL;
|
||||||
state->wrap = 0;
|
ret = inflateReset2(strm, windowBits);
|
||||||
windowBits = -windowBits;
|
if (ret != Z_OK) {
|
||||||
}
|
|
||||||
else {
|
|
||||||
state->wrap = (windowBits >> 4) + 1;
|
|
||||||
#ifdef GUNZIP
|
|
||||||
if (windowBits < 48) windowBits &= 15;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
if (windowBits < 8 || windowBits > 15) {
|
|
||||||
ZFREE(strm, state);
|
ZFREE(strm, state);
|
||||||
strm->state = Z_NULL;
|
strm->state = Z_NULL;
|
||||||
return Z_STREAM_ERROR;
|
|
||||||
}
|
}
|
||||||
state->wbits = (unsigned)windowBits;
|
return ret;
|
||||||
state->window = Z_NULL;
|
|
||||||
return inflateReset(strm);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ZEXPORT inflateInit_(strm, version, stream_size)
|
int ZEXPORT inflateInit_(strm, version, stream_size)
|
||||||
|
@ -192,6 +206,27 @@ int stream_size;
|
||||||
return inflateInit2_(strm, DEF_WBITS, version, stream_size);
|
return inflateInit2_(strm, DEF_WBITS, version, stream_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ZEXPORT inflatePrime(strm, bits, value)
|
||||||
|
z_streamp strm;
|
||||||
|
int bits;
|
||||||
|
int value;
|
||||||
|
{
|
||||||
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
|
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
|
||||||
|
state = (struct inflate_state FAR *)strm->state;
|
||||||
|
if (bits < 0) {
|
||||||
|
state->hold = 0;
|
||||||
|
state->bits = 0;
|
||||||
|
return Z_OK;
|
||||||
|
}
|
||||||
|
if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;
|
||||||
|
value &= (1L << bits) - 1;
|
||||||
|
state->hold += value << state->bits;
|
||||||
|
state->bits += bits;
|
||||||
|
return Z_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Return state with length and distance decoding tables and index sizes set to
|
Return state with length and distance decoding tables and index sizes set to
|
||||||
fixed code decoding. Normally this returns fixed tables from inffixed.h.
|
fixed code decoding. Normally this returns fixed tables from inffixed.h.
|
||||||
|
@ -340,7 +375,7 @@ unsigned out;
|
||||||
/* if window not in use yet, initialize */
|
/* if window not in use yet, initialize */
|
||||||
if (state->wsize == 0) {
|
if (state->wsize == 0) {
|
||||||
state->wsize = 1U << state->wbits;
|
state->wsize = 1U << state->wbits;
|
||||||
state->write = 0;
|
state->wnext = 0;
|
||||||
state->whave = 0;
|
state->whave = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,22 +383,22 @@ unsigned out;
|
||||||
copy = out - strm->avail_out;
|
copy = out - strm->avail_out;
|
||||||
if (copy >= state->wsize) {
|
if (copy >= state->wsize) {
|
||||||
zmemcpy(state->window, strm->next_out - state->wsize, state->wsize);
|
zmemcpy(state->window, strm->next_out - state->wsize, state->wsize);
|
||||||
state->write = 0;
|
state->wnext = 0;
|
||||||
state->whave = state->wsize;
|
state->whave = state->wsize;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dist = state->wsize - state->write;
|
dist = state->wsize - state->wnext;
|
||||||
if (dist > copy) dist = copy;
|
if (dist > copy) dist = copy;
|
||||||
zmemcpy(state->window + state->write, strm->next_out - copy, dist);
|
zmemcpy(state->window + state->wnext, strm->next_out - copy, dist);
|
||||||
copy -= dist;
|
copy -= dist;
|
||||||
if (copy) {
|
if (copy) {
|
||||||
zmemcpy(state->window, strm->next_out - copy, copy);
|
zmemcpy(state->window, strm->next_out - copy, copy);
|
||||||
state->write = copy;
|
state->wnext = copy;
|
||||||
state->whave = state->wsize;
|
state->whave = state->wsize;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
state->write += dist;
|
state->wnext += dist;
|
||||||
if (state->write == state->wsize) state->write = 0;
|
if (state->wnext == state->wsize) state->wnext = 0;
|
||||||
if (state->whave < state->wsize) state->whave += dist;
|
if (state->whave < state->wsize) state->whave += dist;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -564,7 +599,7 @@ int flush;
|
||||||
unsigned in, out; /* save starting available input and output */
|
unsigned in, out; /* save starting available input and output */
|
||||||
unsigned copy; /* number of stored or match bytes to copy */
|
unsigned copy; /* number of stored or match bytes to copy */
|
||||||
unsigned char FAR *from; /* where to copy match bytes from */
|
unsigned char FAR *from; /* where to copy match bytes from */
|
||||||
code this; /* current decoding table entry */
|
code here; /* current decoding table entry */
|
||||||
code last; /* parent table entry */
|
code last; /* parent table entry */
|
||||||
unsigned len; /* length to copy for repeats, bits to drop */
|
unsigned len; /* length to copy for repeats, bits to drop */
|
||||||
int ret; /* return code */
|
int ret; /* return code */
|
||||||
|
@ -619,7 +654,9 @@ int flush;
|
||||||
}
|
}
|
||||||
DROPBITS(4);
|
DROPBITS(4);
|
||||||
len = BITS(4) + 8;
|
len = BITS(4) + 8;
|
||||||
if (len > state->wbits) {
|
if (state->wbits == 0)
|
||||||
|
state->wbits = len;
|
||||||
|
else if (len > state->wbits) {
|
||||||
strm->msg = (char *)"invalid window size";
|
strm->msg = (char *)"invalid window size";
|
||||||
state->mode = BAD;
|
state->mode = BAD;
|
||||||
break;
|
break;
|
||||||
|
@ -771,7 +808,7 @@ int flush;
|
||||||
strm->adler = state->check = adler32(0L, Z_NULL, 0);
|
strm->adler = state->check = adler32(0L, Z_NULL, 0);
|
||||||
state->mode = TYPE;
|
state->mode = TYPE;
|
||||||
case TYPE:
|
case TYPE:
|
||||||
if (flush == Z_BLOCK) goto inf_leave;
|
if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
|
||||||
case TYPEDO:
|
case TYPEDO:
|
||||||
if (state->last) {
|
if (state->last) {
|
||||||
BYTEBITS();
|
BYTEBITS();
|
||||||
|
@ -791,7 +828,11 @@ int flush;
|
||||||
fixedtables(state);
|
fixedtables(state);
|
||||||
Tracev((stderr, "inflate: fixed codes block%s\n",
|
Tracev((stderr, "inflate: fixed codes block%s\n",
|
||||||
state->last ? " (last)" : ""));
|
state->last ? " (last)" : ""));
|
||||||
state->mode = LEN; /* decode codes */
|
state->mode = LEN_; /* decode codes */
|
||||||
|
if (flush == Z_TREES) {
|
||||||
|
DROPBITS(2);
|
||||||
|
goto inf_leave;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 2: /* dynamic block */
|
case 2: /* dynamic block */
|
||||||
Tracev((stderr, "inflate: dynamic codes block%s\n",
|
Tracev((stderr, "inflate: dynamic codes block%s\n",
|
||||||
|
@ -816,6 +857,9 @@ int flush;
|
||||||
Tracev((stderr, "inflate: stored length %u\n",
|
Tracev((stderr, "inflate: stored length %u\n",
|
||||||
state->length));
|
state->length));
|
||||||
INITBITS();
|
INITBITS();
|
||||||
|
state->mode = COPY_;
|
||||||
|
if (flush == Z_TREES) goto inf_leave;
|
||||||
|
case COPY_:
|
||||||
state->mode = COPY;
|
state->mode = COPY;
|
||||||
case COPY:
|
case COPY:
|
||||||
copy = state->length;
|
copy = state->length;
|
||||||
|
@ -876,19 +920,19 @@ int flush;
|
||||||
case CODELENS:
|
case CODELENS:
|
||||||
while (state->have < state->nlen + state->ndist) {
|
while (state->have < state->nlen + state->ndist) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
this = state->lencode[BITS(state->lenbits)];
|
here = state->lencode[BITS(state->lenbits)];
|
||||||
if ((unsigned)(this.bits) <= bits) break;
|
if ((unsigned)(here.bits) <= bits) break;
|
||||||
PULLBYTE();
|
PULLBYTE();
|
||||||
}
|
}
|
||||||
if (this.val < 16) {
|
if (here.val < 16) {
|
||||||
NEEDBITS(this.bits);
|
NEEDBITS(here.bits);
|
||||||
DROPBITS(this.bits);
|
DROPBITS(here.bits);
|
||||||
state->lens[state->have++] = this.val;
|
state->lens[state->have++] = here.val;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (this.val == 16) {
|
if (here.val == 16) {
|
||||||
NEEDBITS(this.bits + 2);
|
NEEDBITS(here.bits + 2);
|
||||||
DROPBITS(this.bits);
|
DROPBITS(here.bits);
|
||||||
if (state->have == 0) {
|
if (state->have == 0) {
|
||||||
strm->msg = (char *)"invalid bit length repeat";
|
strm->msg = (char *)"invalid bit length repeat";
|
||||||
state->mode = BAD;
|
state->mode = BAD;
|
||||||
|
@ -898,16 +942,16 @@ int flush;
|
||||||
copy = 3 + BITS(2);
|
copy = 3 + BITS(2);
|
||||||
DROPBITS(2);
|
DROPBITS(2);
|
||||||
}
|
}
|
||||||
else if (this.val == 17) {
|
else if (here.val == 17) {
|
||||||
NEEDBITS(this.bits + 3);
|
NEEDBITS(here.bits + 3);
|
||||||
DROPBITS(this.bits);
|
DROPBITS(here.bits);
|
||||||
len = 0;
|
len = 0;
|
||||||
copy = 3 + BITS(3);
|
copy = 3 + BITS(3);
|
||||||
DROPBITS(3);
|
DROPBITS(3);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
NEEDBITS(this.bits + 7);
|
NEEDBITS(here.bits + 7);
|
||||||
DROPBITS(this.bits);
|
DROPBITS(here.bits);
|
||||||
len = 0;
|
len = 0;
|
||||||
copy = 11 + BITS(7);
|
copy = 11 + BITS(7);
|
||||||
DROPBITS(7);
|
DROPBITS(7);
|
||||||
|
@ -925,7 +969,16 @@ int flush;
|
||||||
/* handle error breaks in while */
|
/* handle error breaks in while */
|
||||||
if (state->mode == BAD) break;
|
if (state->mode == BAD) break;
|
||||||
|
|
||||||
/* build code tables */
|
/* check for end-of-block code (better have one) */
|
||||||
|
if (state->lens[256] == 0) {
|
||||||
|
strm->msg = (char *)"invalid code -- missing end-of-block";
|
||||||
|
state->mode = BAD;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* build code tables -- note: do not change the lenbits or distbits
|
||||||
|
values here (9 and 6) without reading the comments in inftrees.h
|
||||||
|
concerning the ENOUGH constants, which depend on those values */
|
||||||
state->next = state->codes;
|
state->next = state->codes;
|
||||||
state->lencode = (code const FAR *)(state->next);
|
state->lencode = (code const FAR *)(state->next);
|
||||||
state->lenbits = 9;
|
state->lenbits = 9;
|
||||||
|
@ -946,88 +999,102 @@ int flush;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Tracev((stderr, "inflate: codes ok\n"));
|
Tracev((stderr, "inflate: codes ok\n"));
|
||||||
|
state->mode = LEN_;
|
||||||
|
if (flush == Z_TREES) goto inf_leave;
|
||||||
|
case LEN_:
|
||||||
state->mode = LEN;
|
state->mode = LEN;
|
||||||
case LEN:
|
case LEN:
|
||||||
if (have >= 6 && left >= 258) {
|
if (have >= 6 && left >= 258) {
|
||||||
RESTORE();
|
RESTORE();
|
||||||
inflate_fast(strm, out);
|
inflate_fast(strm, out);
|
||||||
LOAD();
|
LOAD();
|
||||||
|
if (state->mode == TYPE)
|
||||||
|
state->back = -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
state->back = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
this = state->lencode[BITS(state->lenbits)];
|
here = state->lencode[BITS(state->lenbits)];
|
||||||
if ((unsigned)(this.bits) <= bits) break;
|
if ((unsigned)(here.bits) <= bits) break;
|
||||||
PULLBYTE();
|
PULLBYTE();
|
||||||
}
|
}
|
||||||
if (this.op && (this.op & 0xf0) == 0) {
|
if (here.op && (here.op & 0xf0) == 0) {
|
||||||
last = this;
|
last = here;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
this = state->lencode[last.val +
|
here = state->lencode[last.val +
|
||||||
(BITS(last.bits + last.op) >> last.bits)];
|
(BITS(last.bits + last.op) >> last.bits)];
|
||||||
if ((unsigned)(last.bits + this.bits) <= bits) break;
|
if ((unsigned)(last.bits + here.bits) <= bits) break;
|
||||||
PULLBYTE();
|
PULLBYTE();
|
||||||
}
|
}
|
||||||
DROPBITS(last.bits);
|
DROPBITS(last.bits);
|
||||||
|
state->back += last.bits;
|
||||||
}
|
}
|
||||||
DROPBITS(this.bits);
|
DROPBITS(here.bits);
|
||||||
state->length = (unsigned)this.val;
|
state->back += here.bits;
|
||||||
if ((int)(this.op) == 0) {
|
state->length = (unsigned)here.val;
|
||||||
Tracevv((stderr, this.val >= 0x20 && this.val < 0x7f ?
|
if ((int)(here.op) == 0) {
|
||||||
|
Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
|
||||||
"inflate: literal '%c'\n" :
|
"inflate: literal '%c'\n" :
|
||||||
"inflate: literal 0x%02x\n", this.val));
|
"inflate: literal 0x%02x\n", here.val));
|
||||||
state->mode = LIT;
|
state->mode = LIT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (this.op & 32) {
|
if (here.op & 32) {
|
||||||
Tracevv((stderr, "inflate: end of block\n"));
|
Tracevv((stderr, "inflate: end of block\n"));
|
||||||
|
state->back = -1;
|
||||||
state->mode = TYPE;
|
state->mode = TYPE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (this.op & 64) {
|
if (here.op & 64) {
|
||||||
strm->msg = (char *)"invalid literal/length code";
|
strm->msg = (char *)"invalid literal/length code";
|
||||||
state->mode = BAD;
|
state->mode = BAD;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
state->extra = (unsigned)(this.op) & 15;
|
state->extra = (unsigned)(here.op) & 15;
|
||||||
state->mode = LENEXT;
|
state->mode = LENEXT;
|
||||||
case LENEXT:
|
case LENEXT:
|
||||||
if (state->extra) {
|
if (state->extra) {
|
||||||
NEEDBITS(state->extra);
|
NEEDBITS(state->extra);
|
||||||
state->length += BITS(state->extra);
|
state->length += BITS(state->extra);
|
||||||
DROPBITS(state->extra);
|
DROPBITS(state->extra);
|
||||||
|
state->back += state->extra;
|
||||||
}
|
}
|
||||||
Tracevv((stderr, "inflate: length %u\n", state->length));
|
Tracevv((stderr, "inflate: length %u\n", state->length));
|
||||||
|
state->was = state->length;
|
||||||
state->mode = DIST;
|
state->mode = DIST;
|
||||||
case DIST:
|
case DIST:
|
||||||
for (;;) {
|
for (;;) {
|
||||||
this = state->distcode[BITS(state->distbits)];
|
here = state->distcode[BITS(state->distbits)];
|
||||||
if ((unsigned)(this.bits) <= bits) break;
|
if ((unsigned)(here.bits) <= bits) break;
|
||||||
PULLBYTE();
|
PULLBYTE();
|
||||||
}
|
}
|
||||||
if ((this.op & 0xf0) == 0) {
|
if ((here.op & 0xf0) == 0) {
|
||||||
last = this;
|
last = here;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
this = state->distcode[last.val +
|
here = state->distcode[last.val +
|
||||||
(BITS(last.bits + last.op) >> last.bits)];
|
(BITS(last.bits + last.op) >> last.bits)];
|
||||||
if ((unsigned)(last.bits + this.bits) <= bits) break;
|
if ((unsigned)(last.bits + here.bits) <= bits) break;
|
||||||
PULLBYTE();
|
PULLBYTE();
|
||||||
}
|
}
|
||||||
DROPBITS(last.bits);
|
DROPBITS(last.bits);
|
||||||
|
state->back += last.bits;
|
||||||
}
|
}
|
||||||
DROPBITS(this.bits);
|
DROPBITS(here.bits);
|
||||||
if (this.op & 64) {
|
state->back += here.bits;
|
||||||
|
if (here.op & 64) {
|
||||||
strm->msg = (char *)"invalid distance code";
|
strm->msg = (char *)"invalid distance code";
|
||||||
state->mode = BAD;
|
state->mode = BAD;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
state->offset = (unsigned)this.val;
|
state->offset = (unsigned)here.val;
|
||||||
state->extra = (unsigned)(this.op) & 15;
|
state->extra = (unsigned)(here.op) & 15;
|
||||||
state->mode = DISTEXT;
|
state->mode = DISTEXT;
|
||||||
case DISTEXT:
|
case DISTEXT:
|
||||||
if (state->extra) {
|
if (state->extra) {
|
||||||
NEEDBITS(state->extra);
|
NEEDBITS(state->extra);
|
||||||
state->offset += BITS(state->extra);
|
state->offset += BITS(state->extra);
|
||||||
DROPBITS(state->extra);
|
DROPBITS(state->extra);
|
||||||
|
state->back += state->extra;
|
||||||
}
|
}
|
||||||
#ifdef INFLATE_STRICT
|
#ifdef INFLATE_STRICT
|
||||||
if (state->offset > state->dmax) {
|
if (state->offset > state->dmax) {
|
||||||
|
@ -1036,11 +1103,6 @@ int flush;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (state->offset > state->whave + out - left) {
|
|
||||||
strm->msg = (char *)"invalid distance too far back";
|
|
||||||
state->mode = BAD;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Tracevv((stderr, "inflate: distance %u\n", state->offset));
|
Tracevv((stderr, "inflate: distance %u\n", state->offset));
|
||||||
state->mode = MATCH;
|
state->mode = MATCH;
|
||||||
case MATCH:
|
case MATCH:
|
||||||
|
@ -1048,12 +1110,32 @@ int flush;
|
||||||
copy = out - left;
|
copy = out - left;
|
||||||
if (state->offset > copy) { /* copy from window */
|
if (state->offset > copy) { /* copy from window */
|
||||||
copy = state->offset - copy;
|
copy = state->offset - copy;
|
||||||
if (copy > state->write) {
|
if (copy > state->whave) {
|
||||||
copy -= state->write;
|
if (state->sane) {
|
||||||
|
strm->msg = (char *)"invalid distance too far back";
|
||||||
|
state->mode = BAD;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
|
||||||
|
Trace((stderr, "inflate.c too far\n"));
|
||||||
|
copy -= state->whave;
|
||||||
|
if (copy > state->length) copy = state->length;
|
||||||
|
if (copy > left) copy = left;
|
||||||
|
left -= copy;
|
||||||
|
state->length -= copy;
|
||||||
|
do {
|
||||||
|
*put++ = 0;
|
||||||
|
} while (--copy);
|
||||||
|
if (state->length == 0) state->mode = LEN;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
if (copy > state->wnext) {
|
||||||
|
copy -= state->wnext;
|
||||||
from = state->window + (state->wsize - copy);
|
from = state->window + (state->wsize - copy);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
from = state->window + (state->write - copy);
|
from = state->window + (state->wnext - copy);
|
||||||
if (copy > state->length) copy = state->length;
|
if (copy > state->length) copy = state->length;
|
||||||
}
|
}
|
||||||
else { /* copy from output */
|
else { /* copy from output */
|
||||||
|
@ -1146,7 +1228,8 @@ int flush;
|
||||||
strm->adler = state->check =
|
strm->adler = state->check =
|
||||||
UPDATE(state->check, strm->next_out - out, out);
|
UPDATE(state->check, strm->next_out - out, out);
|
||||||
strm->data_type = state->bits + (state->last ? 64 : 0) +
|
strm->data_type = state->bits + (state->last ? 64 : 0) +
|
||||||
(state->mode == TYPE ? 128 : 0);
|
(state->mode == TYPE ? 128 : 0) +
|
||||||
|
(state->mode == LEN_ || state->mode == COPY_ ? 256 : 0);
|
||||||
if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
|
if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK)
|
||||||
ret = Z_BUF_ERROR;
|
ret = Z_BUF_ERROR;
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1366,3 +1449,32 @@ z_streamp source;
|
||||||
dest->state = (struct internal_state FAR *)copy;
|
dest->state = (struct internal_state FAR *)copy;
|
||||||
return Z_OK;
|
return Z_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ZEXPORT inflateUndermine(strm, subvert)
|
||||||
|
z_streamp strm;
|
||||||
|
int subvert;
|
||||||
|
{
|
||||||
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
|
if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR;
|
||||||
|
state = (struct inflate_state FAR *)strm->state;
|
||||||
|
state->sane = !subvert;
|
||||||
|
#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
|
||||||
|
return Z_OK;
|
||||||
|
#else
|
||||||
|
state->sane = 1;
|
||||||
|
return Z_DATA_ERROR;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
long ZEXPORT inflateMark(strm)
|
||||||
|
z_streamp strm;
|
||||||
|
{
|
||||||
|
struct inflate_state FAR *state;
|
||||||
|
|
||||||
|
if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;
|
||||||
|
state = (struct inflate_state FAR *)strm->state;
|
||||||
|
return ((long)(state->back) << 16) +
|
||||||
|
(state->mode == COPY ? state->length :
|
||||||
|
(state->mode == MATCH ? state->was - state->length : 0));
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* inflate.h -- internal inflate state definition
|
/* inflate.h -- internal inflate state definition
|
||||||
* Copyright (C) 1995-2004 Mark Adler
|
* Copyright (C) 1995-2009 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -32,11 +32,13 @@ typedef enum {
|
||||||
TYPE, /* i: waiting for type bits, including last-flag bit */
|
TYPE, /* i: waiting for type bits, including last-flag bit */
|
||||||
TYPEDO, /* i: same, but skip check to exit inflate on new block */
|
TYPEDO, /* i: same, but skip check to exit inflate on new block */
|
||||||
STORED, /* i: waiting for stored size (length and complement) */
|
STORED, /* i: waiting for stored size (length and complement) */
|
||||||
|
COPY_, /* i/o: same as COPY below, but only first time in */
|
||||||
COPY, /* i/o: waiting for input or output to copy stored block */
|
COPY, /* i/o: waiting for input or output to copy stored block */
|
||||||
TABLE, /* i: waiting for dynamic block table lengths */
|
TABLE, /* i: waiting for dynamic block table lengths */
|
||||||
LENLENS, /* i: waiting for code length code lengths */
|
LENLENS, /* i: waiting for code length code lengths */
|
||||||
CODELENS, /* i: waiting for length/lit and distance code lengths */
|
CODELENS, /* i: waiting for length/lit and distance code lengths */
|
||||||
LEN, /* i: waiting for length/lit code */
|
LEN_, /* i: same as LEN below, but only first time in */
|
||||||
|
LEN, /* i: waiting for length/lit/eob code */
|
||||||
LENEXT, /* i: waiting for length extra bits */
|
LENEXT, /* i: waiting for length extra bits */
|
||||||
DIST, /* i: waiting for distance code */
|
DIST, /* i: waiting for distance code */
|
||||||
DISTEXT, /* i: waiting for distance extra bits */
|
DISTEXT, /* i: waiting for distance extra bits */
|
||||||
|
@ -53,19 +55,21 @@ typedef enum {
|
||||||
/*
|
/*
|
||||||
State transitions between above modes -
|
State transitions between above modes -
|
||||||
|
|
||||||
(most modes can go to the BAD or MEM mode -- not shown for clarity)
|
(most modes can go to BAD or MEM on error -- not shown for clarity)
|
||||||
|
|
||||||
Process header:
|
Process header:
|
||||||
HEAD -> (gzip) or (zlib)
|
HEAD -> (gzip) or (zlib) or (raw)
|
||||||
(gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME
|
(gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT ->
|
||||||
NAME -> COMMENT -> HCRC -> TYPE
|
HCRC -> TYPE
|
||||||
(zlib) -> DICTID or TYPE
|
(zlib) -> DICTID or TYPE
|
||||||
DICTID -> DICT -> TYPE
|
DICTID -> DICT -> TYPE
|
||||||
|
(raw) -> TYPEDO
|
||||||
Read deflate blocks:
|
Read deflate blocks:
|
||||||
TYPE -> STORED or TABLE or LEN or CHECK
|
TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK
|
||||||
STORED -> COPY -> TYPE
|
STORED -> COPY_ -> COPY -> TYPE
|
||||||
TABLE -> LENLENS -> CODELENS -> LEN
|
TABLE -> LENLENS -> CODELENS -> LEN_
|
||||||
Read deflate codes:
|
LEN_ -> LEN
|
||||||
|
Read deflate codes in fixed or dynamic block:
|
||||||
LEN -> LENEXT or LIT or TYPE
|
LEN -> LENEXT or LIT or TYPE
|
||||||
LENEXT -> DIST -> DISTEXT -> MATCH -> LEN
|
LENEXT -> DIST -> DISTEXT -> MATCH -> LEN
|
||||||
LIT -> LEN
|
LIT -> LEN
|
||||||
|
@ -73,7 +77,7 @@ typedef enum {
|
||||||
CHECK -> LENGTH -> DONE
|
CHECK -> LENGTH -> DONE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* state maintained between inflate() calls. Approximately 7K bytes. */
|
/* state maintained between inflate() calls. Approximately 10K bytes. */
|
||||||
struct inflate_state {
|
struct inflate_state {
|
||||||
inflate_mode mode; /* current inflate mode */
|
inflate_mode mode; /* current inflate mode */
|
||||||
int last; /* true if processing last block */
|
int last; /* true if processing last block */
|
||||||
|
@ -88,7 +92,7 @@ struct inflate_state {
|
||||||
unsigned wbits; /* log base 2 of requested window size */
|
unsigned wbits; /* log base 2 of requested window size */
|
||||||
unsigned wsize; /* window size or zero if not using window */
|
unsigned wsize; /* window size or zero if not using window */
|
||||||
unsigned whave; /* valid bytes in the window */
|
unsigned whave; /* valid bytes in the window */
|
||||||
unsigned write; /* window write index */
|
unsigned wnext; /* window write index */
|
||||||
unsigned char FAR *window; /* allocated sliding window, if needed */
|
unsigned char FAR *window; /* allocated sliding window, if needed */
|
||||||
/* bit accumulator */
|
/* bit accumulator */
|
||||||
unsigned long hold; /* input bit accumulator */
|
unsigned long hold; /* input bit accumulator */
|
||||||
|
@ -112,4 +116,7 @@ struct inflate_state {
|
||||||
unsigned short lens[320]; /* temporary storage for code lengths */
|
unsigned short lens[320]; /* temporary storage for code lengths */
|
||||||
unsigned short work[288]; /* work area for code table building */
|
unsigned short work[288]; /* work area for code table building */
|
||||||
code codes[ENOUGH]; /* space for code tables */
|
code codes[ENOUGH]; /* space for code tables */
|
||||||
|
int sane; /* if false, allow invalid distance too far */
|
||||||
|
int back; /* bits back of last unprocessed length/lit */
|
||||||
|
unsigned was; /* initial length of match */
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* inftrees.c -- generate Huffman trees for efficient decoding
|
/* inftrees.c -- generate Huffman trees for efficient decoding
|
||||||
* Copyright (C) 1995-2005 Mark Adler
|
* Copyright (C) 1995-2010 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
#define MAXBITS 15
|
#define MAXBITS 15
|
||||||
|
|
||||||
const char inflate_copyright[] =
|
const char inflate_copyright[] =
|
||||||
" inflate 1.2.3 Copyright 1995-2005 Mark Adler ";
|
" inflate 1.2.5 Copyright 1995-2010 Mark Adler ";
|
||||||
/*
|
/*
|
||||||
If you use the zlib library in a product, an acknowledgment is welcome
|
If you use the zlib library in a product, an acknowledgment is welcome
|
||||||
in the documentation of your product. If for some reason you cannot
|
in the documentation of your product. If for some reason you cannot
|
||||||
|
@ -29,7 +29,7 @@ const char inflate_copyright[] =
|
||||||
table index bits. It will differ if the request is greater than the
|
table index bits. It will differ if the request is greater than the
|
||||||
longest code or if it is less than the shortest code.
|
longest code or if it is less than the shortest code.
|
||||||
*/
|
*/
|
||||||
int inflate_table(type, lens, codes, table, bits, work)
|
int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work)
|
||||||
codetype type;
|
codetype type;
|
||||||
unsigned short FAR *lens;
|
unsigned short FAR *lens;
|
||||||
unsigned codes;
|
unsigned codes;
|
||||||
|
@ -50,7 +50,7 @@ unsigned short FAR *work;
|
||||||
unsigned fill; /* index for replicating entries */
|
unsigned fill; /* index for replicating entries */
|
||||||
unsigned low; /* low bits for current root entry */
|
unsigned low; /* low bits for current root entry */
|
||||||
unsigned mask; /* mask for low root bits */
|
unsigned mask; /* mask for low root bits */
|
||||||
code this; /* table entry for duplication */
|
code here; /* table entry for duplication */
|
||||||
code FAR *next; /* next available space in table */
|
code FAR *next; /* next available space in table */
|
||||||
const unsigned short FAR *base; /* base value table to use */
|
const unsigned short FAR *base; /* base value table to use */
|
||||||
const unsigned short FAR *extra; /* extra bits table to use */
|
const unsigned short FAR *extra; /* extra bits table to use */
|
||||||
|
@ -62,7 +62,7 @@ unsigned short FAR *work;
|
||||||
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
|
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
|
||||||
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
|
||||||
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
|
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
|
||||||
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 201, 196};
|
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 73, 195};
|
||||||
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
|
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
|
||||||
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
|
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
|
||||||
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
|
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
|
||||||
|
@ -115,15 +115,15 @@ unsigned short FAR *work;
|
||||||
if (count[max] != 0) break;
|
if (count[max] != 0) break;
|
||||||
if (root > max) root = max;
|
if (root > max) root = max;
|
||||||
if (max == 0) { /* no symbols to code at all */
|
if (max == 0) { /* no symbols to code at all */
|
||||||
this.op = (unsigned char)64; /* invalid code marker */
|
here.op = (unsigned char)64; /* invalid code marker */
|
||||||
this.bits = (unsigned char)1;
|
here.bits = (unsigned char)1;
|
||||||
this.val = (unsigned short)0;
|
here.val = (unsigned short)0;
|
||||||
*(*table)++ = this; /* make a table to force an error */
|
*(*table)++ = here; /* make a table to force an error */
|
||||||
*(*table)++ = this;
|
*(*table)++ = here;
|
||||||
*bits = 1;
|
*bits = 1;
|
||||||
return 0; /* no symbols, but wait for decoding to report error */
|
return 0; /* no symbols, but wait for decoding to report error */
|
||||||
}
|
}
|
||||||
for (min = 1; min <= MAXBITS; min++)
|
for (min = 1; min < max; min++)
|
||||||
if (count[min] != 0) break;
|
if (count[min] != 0) break;
|
||||||
if (root < min) root = min;
|
if (root < min) root = min;
|
||||||
|
|
||||||
|
@ -166,11 +166,10 @@ unsigned short FAR *work;
|
||||||
entered in the tables.
|
entered in the tables.
|
||||||
|
|
||||||
used keeps track of how many table entries have been allocated from the
|
used keeps track of how many table entries have been allocated from the
|
||||||
provided *table space. It is checked when a LENS table is being made
|
provided *table space. It is checked for LENS and DIST tables against
|
||||||
against the space in *table, ENOUGH, minus the maximum space needed by
|
the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in
|
||||||
the worst case distance code, MAXD. This should never happen, but the
|
the initial root table size constants. See the comments in inftrees.h
|
||||||
sufficiency of ENOUGH has not been proven exhaustively, hence the check.
|
for more information.
|
||||||
This assumes that when type == LENS, bits == 9.
|
|
||||||
|
|
||||||
sym increments through all symbols, and the loop terminates when
|
sym increments through all symbols, and the loop terminates when
|
||||||
all codes of length max, i.e. all codes, have been processed. This
|
all codes of length max, i.e. all codes, have been processed. This
|
||||||
|
@ -209,24 +208,25 @@ unsigned short FAR *work;
|
||||||
mask = used - 1; /* mask for comparing low */
|
mask = used - 1; /* mask for comparing low */
|
||||||
|
|
||||||
/* check available table space */
|
/* check available table space */
|
||||||
if (type == LENS && used >= ENOUGH - MAXD)
|
if ((type == LENS && used >= ENOUGH_LENS) ||
|
||||||
|
(type == DISTS && used >= ENOUGH_DISTS))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* process all codes and make table entries */
|
/* process all codes and make table entries */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
/* create table entry */
|
/* create table entry */
|
||||||
this.bits = (unsigned char)(len - drop);
|
here.bits = (unsigned char)(len - drop);
|
||||||
if ((int)(work[sym]) < end) {
|
if ((int)(work[sym]) < end) {
|
||||||
this.op = (unsigned char)0;
|
here.op = (unsigned char)0;
|
||||||
this.val = work[sym];
|
here.val = work[sym];
|
||||||
}
|
}
|
||||||
else if ((int)(work[sym]) > end) {
|
else if ((int)(work[sym]) > end) {
|
||||||
this.op = (unsigned char)(extra[work[sym]]);
|
here.op = (unsigned char)(extra[work[sym]]);
|
||||||
this.val = base[work[sym]];
|
here.val = base[work[sym]];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.op = (unsigned char)(32 + 64); /* end of block */
|
here.op = (unsigned char)(32 + 64); /* end of block */
|
||||||
this.val = 0;
|
here.val = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* replicate for those indices with low len bits equal to huff */
|
/* replicate for those indices with low len bits equal to huff */
|
||||||
|
@ -235,7 +235,7 @@ unsigned short FAR *work;
|
||||||
min = fill; /* save offset to next table */
|
min = fill; /* save offset to next table */
|
||||||
do {
|
do {
|
||||||
fill -= incr;
|
fill -= incr;
|
||||||
next[(huff >> drop) + fill] = this;
|
next[(huff >> drop) + fill] = here;
|
||||||
} while (fill != 0);
|
} while (fill != 0);
|
||||||
|
|
||||||
/* backwards increment the len-bit code huff */
|
/* backwards increment the len-bit code huff */
|
||||||
|
@ -277,7 +277,8 @@ unsigned short FAR *work;
|
||||||
|
|
||||||
/* check for enough space */
|
/* check for enough space */
|
||||||
used += 1U << curr;
|
used += 1U << curr;
|
||||||
if (type == LENS && used >= ENOUGH - MAXD)
|
if ((type == LENS && used >= ENOUGH_LENS) ||
|
||||||
|
(type == DISTS && used >= ENOUGH_DISTS))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* point entry in root table to sub-table */
|
/* point entry in root table to sub-table */
|
||||||
|
@ -295,20 +296,20 @@ unsigned short FAR *work;
|
||||||
through high index bits. When the current sub-table is filled, the loop
|
through high index bits. When the current sub-table is filled, the loop
|
||||||
drops back to the root table to fill in any remaining entries there.
|
drops back to the root table to fill in any remaining entries there.
|
||||||
*/
|
*/
|
||||||
this.op = (unsigned char)64; /* invalid code marker */
|
here.op = (unsigned char)64; /* invalid code marker */
|
||||||
this.bits = (unsigned char)(len - drop);
|
here.bits = (unsigned char)(len - drop);
|
||||||
this.val = (unsigned short)0;
|
here.val = (unsigned short)0;
|
||||||
while (huff != 0) {
|
while (huff != 0) {
|
||||||
/* when done with sub-table, drop back to root table */
|
/* when done with sub-table, drop back to root table */
|
||||||
if (drop != 0 && (huff & mask) != low) {
|
if (drop != 0 && (huff & mask) != low) {
|
||||||
drop = 0;
|
drop = 0;
|
||||||
len = root;
|
len = root;
|
||||||
next = *table;
|
next = *table;
|
||||||
this.bits = (unsigned char)len;
|
here.bits = (unsigned char)len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* put invalid code marker in table */
|
/* put invalid code marker in table */
|
||||||
next[huff >> drop] = this;
|
next[huff >> drop] = here;
|
||||||
|
|
||||||
/* backwards increment the len-bit code huff */
|
/* backwards increment the len-bit code huff */
|
||||||
incr = 1U << (len - 1);
|
incr = 1U << (len - 1);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* inftrees.h -- header to use inftrees.c
|
/* inftrees.h -- header to use inftrees.c
|
||||||
* Copyright (C) 1995-2005 Mark Adler
|
* Copyright (C) 1995-2005, 2010 Mark Adler
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -35,21 +35,28 @@ typedef struct {
|
||||||
01000000 - invalid code
|
01000000 - invalid code
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Maximum size of dynamic tree. The maximum found in a long but non-
|
/* Maximum size of the dynamic table. The maximum number of code structures is
|
||||||
exhaustive search was 1444 code structures (852 for length/literals
|
1444, which is the sum of 852 for literal/length codes and 592 for distance
|
||||||
and 592 for distances, the latter actually the result of an
|
codes. These values were found by exhaustive searches using the program
|
||||||
exhaustive search). The true maximum is not known, but the value
|
examples/enough.c found in the zlib distribtution. The arguments to that
|
||||||
below is more than safe. */
|
program are the number of symbols, the initial root table size, and the
|
||||||
#define ENOUGH 2048
|
maximum bit length of a code. "enough 286 9 15" for literal/length codes
|
||||||
#define MAXD 592
|
returns returns 852, and "enough 30 6 15" for distance codes returns 592.
|
||||||
|
The initial root table size (9 or 6) is found in the fifth argument of the
|
||||||
|
inflate_table() calls in inflate.c and infback.c. If the root table size is
|
||||||
|
changed, then these maximum sizes would be need to be recalculated and
|
||||||
|
updated. */
|
||||||
|
#define ENOUGH_LENS 852
|
||||||
|
#define ENOUGH_DISTS 592
|
||||||
|
#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS)
|
||||||
|
|
||||||
/* Type of code to build for inftable() */
|
/* Type of code to build for inflate_table() */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
CODES,
|
CODES,
|
||||||
LENS,
|
LENS,
|
||||||
DISTS
|
DISTS
|
||||||
} codetype;
|
} codetype;
|
||||||
|
|
||||||
extern int inflate_table OF((codetype type, unsigned short FAR *lens,
|
int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens,
|
||||||
unsigned codes, code FAR * FAR *table,
|
unsigned codes, code FAR * FAR *table,
|
||||||
unsigned FAR *bits, unsigned short FAR *work));
|
unsigned FAR *bits, unsigned short FAR *work));
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
/* trees.c -- output deflated data using Huffman coding
|
/* trees.c -- output deflated data using Huffman coding
|
||||||
* Copyright (C) 1995-2005 Jean-loup Gailly
|
* Copyright (C) 1995-2010 Jean-loup Gailly
|
||||||
|
* detect_data_type() function provided freely by Cosmin Truta, 2006
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -152,7 +153,7 @@ local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
|
||||||
int blcodes));
|
int blcodes));
|
||||||
local void compress_block OF((deflate_state *s, ct_data *ltree,
|
local void compress_block OF((deflate_state *s, ct_data *ltree,
|
||||||
ct_data *dtree));
|
ct_data *dtree));
|
||||||
local void set_data_type OF((deflate_state *s));
|
local int detect_data_type OF((deflate_state *s));
|
||||||
local unsigned bi_reverse OF((unsigned value, int length));
|
local unsigned bi_reverse OF((unsigned value, int length));
|
||||||
local void bi_windup OF((deflate_state *s));
|
local void bi_windup OF((deflate_state *s));
|
||||||
local void bi_flush OF((deflate_state *s));
|
local void bi_flush OF((deflate_state *s));
|
||||||
|
@ -203,12 +204,12 @@ local void send_bits(s, value, length)
|
||||||
* unused bits in value.
|
* unused bits in value.
|
||||||
*/
|
*/
|
||||||
if (s->bi_valid > (int)Buf_size - length) {
|
if (s->bi_valid > (int)Buf_size - length) {
|
||||||
s->bi_buf |= (value << s->bi_valid);
|
s->bi_buf |= (ush)value << s->bi_valid;
|
||||||
put_short(s, s->bi_buf);
|
put_short(s, s->bi_buf);
|
||||||
s->bi_buf = (ush)value >> (Buf_size - s->bi_valid);
|
s->bi_buf = (ush)value >> (Buf_size - s->bi_valid);
|
||||||
s->bi_valid += length - Buf_size;
|
s->bi_valid += length - Buf_size;
|
||||||
} else {
|
} else {
|
||||||
s->bi_buf |= value << s->bi_valid;
|
s->bi_buf |= (ush)value << s->bi_valid;
|
||||||
s->bi_valid += length;
|
s->bi_valid += length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,12 +219,12 @@ local void send_bits(s, value, length)
|
||||||
{ int len = length;\
|
{ int len = length;\
|
||||||
if (s->bi_valid > (int)Buf_size - len) {\
|
if (s->bi_valid > (int)Buf_size - len) {\
|
||||||
int val = value;\
|
int val = value;\
|
||||||
s->bi_buf |= (val << s->bi_valid);\
|
s->bi_buf |= (ush)val << s->bi_valid;\
|
||||||
put_short(s, s->bi_buf);\
|
put_short(s, s->bi_buf);\
|
||||||
s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
|
s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\
|
||||||
s->bi_valid += len - Buf_size;\
|
s->bi_valid += len - Buf_size;\
|
||||||
} else {\
|
} else {\
|
||||||
s->bi_buf |= (value) << s->bi_valid;\
|
s->bi_buf |= (ush)(value) << s->bi_valid;\
|
||||||
s->bi_valid += len;\
|
s->bi_valid += len;\
|
||||||
}\
|
}\
|
||||||
}
|
}
|
||||||
|
@ -250,11 +251,13 @@ local void tr_static_init()
|
||||||
if (static_init_done) return;
|
if (static_init_done) return;
|
||||||
|
|
||||||
/* For some embedded targets, global variables are not initialized: */
|
/* For some embedded targets, global variables are not initialized: */
|
||||||
|
#ifdef NO_INIT_GLOBAL_POINTERS
|
||||||
static_l_desc.static_tree = static_ltree;
|
static_l_desc.static_tree = static_ltree;
|
||||||
static_l_desc.extra_bits = extra_lbits;
|
static_l_desc.extra_bits = extra_lbits;
|
||||||
static_d_desc.static_tree = static_dtree;
|
static_d_desc.static_tree = static_dtree;
|
||||||
static_d_desc.extra_bits = extra_dbits;
|
static_d_desc.extra_bits = extra_dbits;
|
||||||
static_bl_desc.extra_bits = extra_blbits;
|
static_bl_desc.extra_bits = extra_blbits;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Initialize the mapping length (0..255) -> length code (0..28) */
|
/* Initialize the mapping length (0..255) -> length code (0..28) */
|
||||||
length = 0;
|
length = 0;
|
||||||
|
@ -348,13 +351,14 @@ void gen_trees_header()
|
||||||
static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
|
static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5));
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n");
|
fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n");
|
||||||
for (i = 0; i < DIST_CODE_LEN; i++) {
|
for (i = 0; i < DIST_CODE_LEN; i++) {
|
||||||
fprintf(header, "%2u%s", _dist_code[i],
|
fprintf(header, "%2u%s", _dist_code[i],
|
||||||
SEPARATOR(i, DIST_CODE_LEN-1, 20));
|
SEPARATOR(i, DIST_CODE_LEN-1, 20));
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
|
fprintf(header,
|
||||||
|
"const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n");
|
||||||
for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
|
for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) {
|
||||||
fprintf(header, "%2u%s", _length_code[i],
|
fprintf(header, "%2u%s", _length_code[i],
|
||||||
SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
|
SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20));
|
||||||
|
@ -379,7 +383,7 @@ void gen_trees_header()
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Initialize the tree data structures for a new zlib stream.
|
* Initialize the tree data structures for a new zlib stream.
|
||||||
*/
|
*/
|
||||||
void _tr_init(s)
|
void ZLIB_INTERNAL _tr_init(s)
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
{
|
{
|
||||||
tr_static_init();
|
tr_static_init();
|
||||||
|
@ -864,13 +868,13 @@ local void send_all_trees(s, lcodes, dcodes, blcodes)
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Send a stored block
|
* Send a stored block
|
||||||
*/
|
*/
|
||||||
void _tr_stored_block(s, buf, stored_len, eof)
|
void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
charf *buf; /* input block */
|
charf *buf; /* input block */
|
||||||
ulg stored_len; /* length of input block */
|
ulg stored_len; /* length of input block */
|
||||||
int eof; /* true if this is the last block for a file */
|
int last; /* one if this is the last block for a file */
|
||||||
{
|
{
|
||||||
send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */
|
send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
|
s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L;
|
||||||
s->compressed_len += (stored_len + 4) << 3;
|
s->compressed_len += (stored_len + 4) << 3;
|
||||||
|
@ -889,7 +893,7 @@ void _tr_stored_block(s, buf, stored_len, eof)
|
||||||
* To simplify the code, we assume the worst case of last real code encoded
|
* To simplify the code, we assume the worst case of last real code encoded
|
||||||
* on one bit only.
|
* on one bit only.
|
||||||
*/
|
*/
|
||||||
void _tr_align(s)
|
void ZLIB_INTERNAL _tr_align(s)
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
{
|
{
|
||||||
send_bits(s, STATIC_TREES<<1, 3);
|
send_bits(s, STATIC_TREES<<1, 3);
|
||||||
|
@ -918,11 +922,11 @@ void _tr_align(s)
|
||||||
* Determine the best encoding for the current block: dynamic trees, static
|
* Determine the best encoding for the current block: dynamic trees, static
|
||||||
* trees or store, and output the encoded block to the zip file.
|
* trees or store, and output the encoded block to the zip file.
|
||||||
*/
|
*/
|
||||||
void _tr_flush_block(s, buf, stored_len, eof)
|
void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
charf *buf; /* input block, or NULL if too old */
|
charf *buf; /* input block, or NULL if too old */
|
||||||
ulg stored_len; /* length of input block */
|
ulg stored_len; /* length of input block */
|
||||||
int eof; /* true if this is the last block for a file */
|
int last; /* one if this is the last block for a file */
|
||||||
{
|
{
|
||||||
ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
|
ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */
|
||||||
int max_blindex = 0; /* index of last bit length code of non zero freq */
|
int max_blindex = 0; /* index of last bit length code of non zero freq */
|
||||||
|
@ -931,8 +935,8 @@ void _tr_flush_block(s, buf, stored_len, eof)
|
||||||
if (s->level > 0) {
|
if (s->level > 0) {
|
||||||
|
|
||||||
/* Check if the file is binary or text */
|
/* Check if the file is binary or text */
|
||||||
if (stored_len > 0 && s->strm->data_type == Z_UNKNOWN)
|
if (s->strm->data_type == Z_UNKNOWN)
|
||||||
set_data_type(s);
|
s->strm->data_type = detect_data_type(s);
|
||||||
|
|
||||||
/* Construct the literal and distance trees */
|
/* Construct the literal and distance trees */
|
||||||
build_tree(s, (tree_desc *)(&(s->l_desc)));
|
build_tree(s, (tree_desc *)(&(s->l_desc)));
|
||||||
|
@ -978,20 +982,20 @@ void _tr_flush_block(s, buf, stored_len, eof)
|
||||||
* successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
|
* successful. If LIT_BUFSIZE <= WSIZE, it is never too late to
|
||||||
* transform a block into a stored block.
|
* transform a block into a stored block.
|
||||||
*/
|
*/
|
||||||
_tr_stored_block(s, buf, stored_len, eof);
|
_tr_stored_block(s, buf, stored_len, last);
|
||||||
|
|
||||||
#ifdef FORCE_STATIC
|
#ifdef FORCE_STATIC
|
||||||
} else if (static_lenb >= 0) { /* force static trees */
|
} else if (static_lenb >= 0) { /* force static trees */
|
||||||
#else
|
#else
|
||||||
} else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
|
} else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
|
||||||
#endif
|
#endif
|
||||||
send_bits(s, (STATIC_TREES<<1)+eof, 3);
|
send_bits(s, (STATIC_TREES<<1)+last, 3);
|
||||||
compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
|
compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
s->compressed_len += 3 + s->static_len;
|
s->compressed_len += 3 + s->static_len;
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
send_bits(s, (DYN_TREES<<1)+eof, 3);
|
send_bits(s, (DYN_TREES<<1)+last, 3);
|
||||||
send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
|
send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
|
||||||
max_blindex+1);
|
max_blindex+1);
|
||||||
compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
|
compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
|
||||||
|
@ -1005,21 +1009,21 @@ void _tr_flush_block(s, buf, stored_len, eof)
|
||||||
*/
|
*/
|
||||||
init_block(s);
|
init_block(s);
|
||||||
|
|
||||||
if (eof) {
|
if (last) {
|
||||||
bi_windup(s);
|
bi_windup(s);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
s->compressed_len += 7; /* align on byte boundary */
|
s->compressed_len += 7; /* align on byte boundary */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
|
Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
|
||||||
s->compressed_len-7*eof));
|
s->compressed_len-7*last));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Save the match info and tally the frequency counts. Return true if
|
* Save the match info and tally the frequency counts. Return true if
|
||||||
* the current block must be flushed.
|
* the current block must be flushed.
|
||||||
*/
|
*/
|
||||||
int _tr_tally (s, dist, lc)
|
int ZLIB_INTERNAL _tr_tally (s, dist, lc)
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
unsigned dist; /* distance of matched string */
|
unsigned dist; /* distance of matched string */
|
||||||
unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
|
unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */
|
||||||
|
@ -1118,24 +1122,45 @@ local void compress_block(s, ltree, dtree)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
* Set the data type to BINARY or TEXT, using a crude approximation:
|
* Check if the data type is TEXT or BINARY, using the following algorithm:
|
||||||
* set it to Z_TEXT if all symbols are either printable characters (33 to 255)
|
* - TEXT if the two conditions below are satisfied:
|
||||||
* or white spaces (9 to 13, or 32); or set it to Z_BINARY otherwise.
|
* a) There are no non-portable control characters belonging to the
|
||||||
|
* "black list" (0..6, 14..25, 28..31).
|
||||||
|
* b) There is at least one printable character belonging to the
|
||||||
|
* "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
|
||||||
|
* - BINARY otherwise.
|
||||||
|
* - The following partially-portable control characters form a
|
||||||
|
* "gray list" that is ignored in this detection algorithm:
|
||||||
|
* (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).
|
||||||
* IN assertion: the fields Freq of dyn_ltree are set.
|
* IN assertion: the fields Freq of dyn_ltree are set.
|
||||||
*/
|
*/
|
||||||
local void set_data_type(s)
|
local int detect_data_type(s)
|
||||||
deflate_state *s;
|
deflate_state *s;
|
||||||
{
|
{
|
||||||
|
/* black_mask is the bit mask of black-listed bytes
|
||||||
|
* set bits 0..6, 14..25, and 28..31
|
||||||
|
* 0xf3ffc07f = binary 11110011111111111100000001111111
|
||||||
|
*/
|
||||||
|
unsigned long black_mask = 0xf3ffc07fUL;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
for (n = 0; n < 9; n++)
|
/* Check for non-textual ("black-listed") bytes. */
|
||||||
|
for (n = 0; n <= 31; n++, black_mask >>= 1)
|
||||||
|
if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0))
|
||||||
|
return Z_BINARY;
|
||||||
|
|
||||||
|
/* Check for textual ("white-listed") bytes. */
|
||||||
|
if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0
|
||||||
|
|| s->dyn_ltree[13].Freq != 0)
|
||||||
|
return Z_TEXT;
|
||||||
|
for (n = 32; n < LITERALS; n++)
|
||||||
if (s->dyn_ltree[n].Freq != 0)
|
if (s->dyn_ltree[n].Freq != 0)
|
||||||
break;
|
return Z_TEXT;
|
||||||
if (n == 9)
|
|
||||||
for (n = 14; n < 32; n++)
|
/* There are no "black-listed" or "white-listed" bytes:
|
||||||
if (s->dyn_ltree[n].Freq != 0)
|
* this stream either is empty or has tolerated ("gray-listed") bytes only.
|
||||||
break;
|
*/
|
||||||
s->strm->data_type = (n == 32) ? Z_TEXT : Z_BINARY;
|
return Z_BINARY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
|
|
|
@ -70,7 +70,7 @@ local const ct_data static_dtree[D_CODES] = {
|
||||||
{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
|
{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
|
||||||
};
|
};
|
||||||
|
|
||||||
const uch _dist_code[DIST_CODE_LEN] = {
|
const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {
|
||||||
0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
|
0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
|
||||||
8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
|
8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
|
||||||
10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
|
10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
|
||||||
|
@ -99,7 +99,7 @@ const uch _dist_code[DIST_CODE_LEN] = {
|
||||||
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
|
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
|
||||||
};
|
};
|
||||||
|
|
||||||
const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {
|
const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {
|
||||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12,
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12,
|
||||||
13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
|
13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
|
||||||
17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
|
17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* uncompr.c -- decompress a memory buffer
|
/* uncompr.c -- decompress a memory buffer
|
||||||
* Copyright (C) 1995-2003 Jean-loup Gailly.
|
* Copyright (C) 1995-2003, 2010 Jean-loup Gailly.
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -16,8 +16,6 @@
|
||||||
been saved previously by the compressor and transmitted to the decompressor
|
been saved previously by the compressor and transmitted to the decompressor
|
||||||
by some mechanism outside the scope of this compression library.)
|
by some mechanism outside the scope of this compression library.)
|
||||||
Upon exit, destLen is the actual size of the compressed buffer.
|
Upon exit, destLen is the actual size of the compressed buffer.
|
||||||
This function can be used to decompress a whole file at once if the
|
|
||||||
input file is mmap'ed.
|
|
||||||
|
|
||||||
uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
|
uncompress returns Z_OK if success, Z_MEM_ERROR if there was not
|
||||||
enough memory, Z_BUF_ERROR if there was not enough room in the output
|
enough memory, Z_BUF_ERROR if there was not enough room in the output
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* zconf.h -- configuration of the zlib compression library
|
/* zconf.h -- configuration of the zlib compression library
|
||||||
* Copyright (C) 1995-2005 Jean-loup Gailly.
|
* Copyright (C) 1995-2010 Jean-loup Gailly.
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -11,52 +11,124 @@
|
||||||
/*
|
/*
|
||||||
* If you *really* need a unique prefix for all types and library functions,
|
* If you *really* need a unique prefix for all types and library functions,
|
||||||
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
|
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
|
||||||
|
* Even better than compiling with -DZ_PREFIX would be to use configure to set
|
||||||
|
* this permanently in zconf.h using "./configure --zprefix".
|
||||||
*/
|
*/
|
||||||
#ifdef Z_PREFIX
|
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
|
||||||
# define deflateInit_ z_deflateInit_
|
|
||||||
# define deflate z_deflate
|
/* all linked symbols */
|
||||||
# define deflateEnd z_deflateEnd
|
# define _dist_code z__dist_code
|
||||||
# define inflateInit_ z_inflateInit_
|
# define _length_code z__length_code
|
||||||
# define inflate z_inflate
|
# define _tr_align z__tr_align
|
||||||
# define inflateEnd z_inflateEnd
|
# define _tr_flush_block z__tr_flush_block
|
||||||
# define deflateInit2_ z_deflateInit2_
|
# define _tr_init z__tr_init
|
||||||
# define deflateSetDictionary z_deflateSetDictionary
|
# define _tr_stored_block z__tr_stored_block
|
||||||
# define deflateCopy z_deflateCopy
|
# define _tr_tally z__tr_tally
|
||||||
# define deflateReset z_deflateReset
|
# define adler32 z_adler32
|
||||||
# define deflateParams z_deflateParams
|
# define adler32_combine z_adler32_combine
|
||||||
# define deflateBound z_deflateBound
|
# define adler32_combine64 z_adler32_combine64
|
||||||
# define deflatePrime z_deflatePrime
|
|
||||||
# define inflateInit2_ z_inflateInit2_
|
|
||||||
# define inflateSetDictionary z_inflateSetDictionary
|
|
||||||
# define inflateSync z_inflateSync
|
|
||||||
# define inflateSyncPoint z_inflateSyncPoint
|
|
||||||
# define inflateCopy z_inflateCopy
|
|
||||||
# define inflateReset z_inflateReset
|
|
||||||
# define inflateBack z_inflateBack
|
|
||||||
# define inflateBackEnd z_inflateBackEnd
|
|
||||||
# define compress z_compress
|
# define compress z_compress
|
||||||
# define compress2 z_compress2
|
# define compress2 z_compress2
|
||||||
# define compressBound z_compressBound
|
# define compressBound z_compressBound
|
||||||
# define uncompress z_uncompress
|
|
||||||
# define adler32 z_adler32
|
|
||||||
# define crc32 z_crc32
|
# define crc32 z_crc32
|
||||||
|
# define crc32_combine z_crc32_combine
|
||||||
|
# define crc32_combine64 z_crc32_combine64
|
||||||
|
# define deflate z_deflate
|
||||||
|
# define deflateBound z_deflateBound
|
||||||
|
# define deflateCopy z_deflateCopy
|
||||||
|
# define deflateEnd z_deflateEnd
|
||||||
|
# define deflateInit2_ z_deflateInit2_
|
||||||
|
# define deflateInit_ z_deflateInit_
|
||||||
|
# define deflateParams z_deflateParams
|
||||||
|
# define deflatePrime z_deflatePrime
|
||||||
|
# define deflateReset z_deflateReset
|
||||||
|
# define deflateSetDictionary z_deflateSetDictionary
|
||||||
|
# define deflateSetHeader z_deflateSetHeader
|
||||||
|
# define deflateTune z_deflateTune
|
||||||
|
# define deflate_copyright z_deflate_copyright
|
||||||
# define get_crc_table z_get_crc_table
|
# define get_crc_table z_get_crc_table
|
||||||
|
# define gz_error z_gz_error
|
||||||
|
# define gz_intmax z_gz_intmax
|
||||||
|
# define gz_strwinerror z_gz_strwinerror
|
||||||
|
# define gzbuffer z_gzbuffer
|
||||||
|
# define gzclearerr z_gzclearerr
|
||||||
|
# define gzclose z_gzclose
|
||||||
|
# define gzclose_r z_gzclose_r
|
||||||
|
# define gzclose_w z_gzclose_w
|
||||||
|
# define gzdirect z_gzdirect
|
||||||
|
# define gzdopen z_gzdopen
|
||||||
|
# define gzeof z_gzeof
|
||||||
|
# define gzerror z_gzerror
|
||||||
|
# define gzflush z_gzflush
|
||||||
|
# define gzgetc z_gzgetc
|
||||||
|
# define gzgets z_gzgets
|
||||||
|
# define gzoffset z_gzoffset
|
||||||
|
# define gzoffset64 z_gzoffset64
|
||||||
|
# define gzopen z_gzopen
|
||||||
|
# define gzopen64 z_gzopen64
|
||||||
|
# define gzprintf z_gzprintf
|
||||||
|
# define gzputc z_gzputc
|
||||||
|
# define gzputs z_gzputs
|
||||||
|
# define gzread z_gzread
|
||||||
|
# define gzrewind z_gzrewind
|
||||||
|
# define gzseek z_gzseek
|
||||||
|
# define gzseek64 z_gzseek64
|
||||||
|
# define gzsetparams z_gzsetparams
|
||||||
|
# define gztell z_gztell
|
||||||
|
# define gztell64 z_gztell64
|
||||||
|
# define gzungetc z_gzungetc
|
||||||
|
# define gzwrite z_gzwrite
|
||||||
|
# define inflate z_inflate
|
||||||
|
# define inflateBack z_inflateBack
|
||||||
|
# define inflateBackEnd z_inflateBackEnd
|
||||||
|
# define inflateBackInit_ z_inflateBackInit_
|
||||||
|
# define inflateCopy z_inflateCopy
|
||||||
|
# define inflateEnd z_inflateEnd
|
||||||
|
# define inflateGetHeader z_inflateGetHeader
|
||||||
|
# define inflateInit2_ z_inflateInit2_
|
||||||
|
# define inflateInit_ z_inflateInit_
|
||||||
|
# define inflateMark z_inflateMark
|
||||||
|
# define inflatePrime z_inflatePrime
|
||||||
|
# define inflateReset z_inflateReset
|
||||||
|
# define inflateReset2 z_inflateReset2
|
||||||
|
# define inflateSetDictionary z_inflateSetDictionary
|
||||||
|
# define inflateSync z_inflateSync
|
||||||
|
# define inflateSyncPoint z_inflateSyncPoint
|
||||||
|
# define inflateUndermine z_inflateUndermine
|
||||||
|
# define inflate_copyright z_inflate_copyright
|
||||||
|
# define inflate_fast z_inflate_fast
|
||||||
|
# define inflate_table z_inflate_table
|
||||||
|
# define uncompress z_uncompress
|
||||||
# define zError z_zError
|
# define zError z_zError
|
||||||
|
# define zcalloc z_zcalloc
|
||||||
|
# define zcfree z_zcfree
|
||||||
|
# define zlibCompileFlags z_zlibCompileFlags
|
||||||
|
# define zlibVersion z_zlibVersion
|
||||||
|
|
||||||
# define alloc_func z_alloc_func
|
/* all zlib typedefs in zlib.h and zconf.h */
|
||||||
# define free_func z_free_func
|
|
||||||
# define in_func z_in_func
|
|
||||||
# define out_func z_out_func
|
|
||||||
# define Byte z_Byte
|
# define Byte z_Byte
|
||||||
# define uInt z_uInt
|
|
||||||
# define uLong z_uLong
|
|
||||||
# define Bytef z_Bytef
|
# define Bytef z_Bytef
|
||||||
|
# define alloc_func z_alloc_func
|
||||||
# define charf z_charf
|
# define charf z_charf
|
||||||
|
# define free_func z_free_func
|
||||||
|
# define gzFile z_gzFile
|
||||||
|
# define gz_header z_gz_header
|
||||||
|
# define gz_headerp z_gz_headerp
|
||||||
|
# define in_func z_in_func
|
||||||
# define intf z_intf
|
# define intf z_intf
|
||||||
|
# define out_func z_out_func
|
||||||
|
# define uInt z_uInt
|
||||||
# define uIntf z_uIntf
|
# define uIntf z_uIntf
|
||||||
|
# define uLong z_uLong
|
||||||
# define uLongf z_uLongf
|
# define uLongf z_uLongf
|
||||||
# define voidpf z_voidpf
|
|
||||||
# define voidp z_voidp
|
# define voidp z_voidp
|
||||||
|
# define voidpc z_voidpc
|
||||||
|
# define voidpf z_voidpf
|
||||||
|
|
||||||
|
/* all zlib structs in zlib.h and zconf.h */
|
||||||
|
# define gz_header_s z_gz_header_s
|
||||||
|
# define internal_state z_internal_state
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__MSDOS__) && !defined(MSDOS)
|
#if defined(__MSDOS__) && !defined(MSDOS)
|
||||||
|
@ -284,49 +356,73 @@ typedef uLong FAR uLongf;
|
||||||
typedef Byte *voidp;
|
typedef Byte *voidp;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
|
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
|
||||||
# include <sys/types.h> /* for off_t */
|
# define Z_HAVE_UNISTD_H
|
||||||
# include <unistd.h> /* for SEEK_* and off_t */
|
|
||||||
# ifdef VMS
|
|
||||||
# include <unixio.h> /* for off_t */
|
|
||||||
# endif
|
|
||||||
# define z_off_t off_t
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef STDC
|
||||||
|
# include <sys/types.h> /* for off_t */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
|
||||||
|
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
|
||||||
|
* though the former does not conform to the LFS document), but considering
|
||||||
|
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
|
||||||
|
* equivalently requesting no 64-bit operations
|
||||||
|
*/
|
||||||
|
#if -_LARGEFILE64_SOURCE - -1 == 1
|
||||||
|
# undef _LARGEFILE64_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
|
||||||
|
# include <unistd.h> /* for SEEK_* and off_t */
|
||||||
|
# ifdef VMS
|
||||||
|
# include <unixio.h> /* for off_t */
|
||||||
|
# endif
|
||||||
|
# ifndef z_off_t
|
||||||
|
# define z_off_t off_t
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef SEEK_SET
|
#ifndef SEEK_SET
|
||||||
# define SEEK_SET 0 /* Seek from beginning of file. */
|
# define SEEK_SET 0 /* Seek from beginning of file. */
|
||||||
# define SEEK_CUR 1 /* Seek from current position. */
|
# define SEEK_CUR 1 /* Seek from current position. */
|
||||||
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
|
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef z_off_t
|
#ifndef z_off_t
|
||||||
# define z_off_t long
|
# define z_off_t long
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
|
||||||
|
# define z_off64_t off64_t
|
||||||
|
#else
|
||||||
|
# define z_off64_t z_off_t
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__OS400__)
|
#if defined(__OS400__)
|
||||||
# define NO_vsnprintf
|
# define NO_vsnprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__MVS__)
|
#if defined(__MVS__)
|
||||||
# define NO_vsnprintf
|
# define NO_vsnprintf
|
||||||
# ifdef FAR
|
|
||||||
# undef FAR
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* MVS linker does not support external names larger than 8 bytes */
|
/* MVS linker does not support external names larger than 8 bytes */
|
||||||
#if defined(__MVS__)
|
#if defined(__MVS__)
|
||||||
# pragma map(deflateInit_,"DEIN")
|
#pragma map(deflateInit_,"DEIN")
|
||||||
# pragma map(deflateInit2_,"DEIN2")
|
#pragma map(deflateInit2_,"DEIN2")
|
||||||
# pragma map(deflateEnd,"DEEND")
|
#pragma map(deflateEnd,"DEEND")
|
||||||
# pragma map(deflateBound,"DEBND")
|
#pragma map(deflateBound,"DEBND")
|
||||||
# pragma map(inflateInit_,"ININ")
|
#pragma map(inflateInit_,"ININ")
|
||||||
# pragma map(inflateInit2_,"ININ2")
|
#pragma map(inflateInit2_,"ININ2")
|
||||||
# pragma map(inflateEnd,"INEND")
|
#pragma map(inflateEnd,"INEND")
|
||||||
# pragma map(inflateSync,"INSY")
|
#pragma map(inflateSync,"INSY")
|
||||||
# pragma map(inflateSetDictionary,"INSEDI")
|
#pragma map(inflateSetDictionary,"INSEDI")
|
||||||
# pragma map(compressBound,"CMBND")
|
#pragma map(compressBound,"CMBND")
|
||||||
# pragma map(inflate_table,"INTABL")
|
#pragma map(inflate_table,"INTABL")
|
||||||
# pragma map(inflate_fast,"INFA")
|
#pragma map(inflate_fast,"INFA")
|
||||||
# pragma map(inflate_copyright,"INCOPY")
|
#pragma map(inflate_copyright,"INCOPY")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* ZCONF_H */
|
#endif /* ZCONF_H */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* zconf.h -- configuration of the zlib compression library
|
/* zconf.h -- configuration of the zlib compression library
|
||||||
* Copyright (C) 1995-2005 Jean-loup Gailly.
|
* Copyright (C) 1995-2010 Jean-loup Gailly.
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -11,52 +11,124 @@
|
||||||
/*
|
/*
|
||||||
* If you *really* need a unique prefix for all types and library functions,
|
* If you *really* need a unique prefix for all types and library functions,
|
||||||
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
|
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
|
||||||
|
* Even better than compiling with -DZ_PREFIX would be to use configure to set
|
||||||
|
* this permanently in zconf.h using "./configure --zprefix".
|
||||||
*/
|
*/
|
||||||
#ifdef Z_PREFIX
|
#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */
|
||||||
# define deflateInit_ z_deflateInit_
|
|
||||||
# define deflate z_deflate
|
/* all linked symbols */
|
||||||
# define deflateEnd z_deflateEnd
|
# define _dist_code z__dist_code
|
||||||
# define inflateInit_ z_inflateInit_
|
# define _length_code z__length_code
|
||||||
# define inflate z_inflate
|
# define _tr_align z__tr_align
|
||||||
# define inflateEnd z_inflateEnd
|
# define _tr_flush_block z__tr_flush_block
|
||||||
# define deflateInit2_ z_deflateInit2_
|
# define _tr_init z__tr_init
|
||||||
# define deflateSetDictionary z_deflateSetDictionary
|
# define _tr_stored_block z__tr_stored_block
|
||||||
# define deflateCopy z_deflateCopy
|
# define _tr_tally z__tr_tally
|
||||||
# define deflateReset z_deflateReset
|
# define adler32 z_adler32
|
||||||
# define deflateParams z_deflateParams
|
# define adler32_combine z_adler32_combine
|
||||||
# define deflateBound z_deflateBound
|
# define adler32_combine64 z_adler32_combine64
|
||||||
# define deflatePrime z_deflatePrime
|
|
||||||
# define inflateInit2_ z_inflateInit2_
|
|
||||||
# define inflateSetDictionary z_inflateSetDictionary
|
|
||||||
# define inflateSync z_inflateSync
|
|
||||||
# define inflateSyncPoint z_inflateSyncPoint
|
|
||||||
# define inflateCopy z_inflateCopy
|
|
||||||
# define inflateReset z_inflateReset
|
|
||||||
# define inflateBack z_inflateBack
|
|
||||||
# define inflateBackEnd z_inflateBackEnd
|
|
||||||
# define compress z_compress
|
# define compress z_compress
|
||||||
# define compress2 z_compress2
|
# define compress2 z_compress2
|
||||||
# define compressBound z_compressBound
|
# define compressBound z_compressBound
|
||||||
# define uncompress z_uncompress
|
|
||||||
# define adler32 z_adler32
|
|
||||||
# define crc32 z_crc32
|
# define crc32 z_crc32
|
||||||
|
# define crc32_combine z_crc32_combine
|
||||||
|
# define crc32_combine64 z_crc32_combine64
|
||||||
|
# define deflate z_deflate
|
||||||
|
# define deflateBound z_deflateBound
|
||||||
|
# define deflateCopy z_deflateCopy
|
||||||
|
# define deflateEnd z_deflateEnd
|
||||||
|
# define deflateInit2_ z_deflateInit2_
|
||||||
|
# define deflateInit_ z_deflateInit_
|
||||||
|
# define deflateParams z_deflateParams
|
||||||
|
# define deflatePrime z_deflatePrime
|
||||||
|
# define deflateReset z_deflateReset
|
||||||
|
# define deflateSetDictionary z_deflateSetDictionary
|
||||||
|
# define deflateSetHeader z_deflateSetHeader
|
||||||
|
# define deflateTune z_deflateTune
|
||||||
|
# define deflate_copyright z_deflate_copyright
|
||||||
# define get_crc_table z_get_crc_table
|
# define get_crc_table z_get_crc_table
|
||||||
|
# define gz_error z_gz_error
|
||||||
|
# define gz_intmax z_gz_intmax
|
||||||
|
# define gz_strwinerror z_gz_strwinerror
|
||||||
|
# define gzbuffer z_gzbuffer
|
||||||
|
# define gzclearerr z_gzclearerr
|
||||||
|
# define gzclose z_gzclose
|
||||||
|
# define gzclose_r z_gzclose_r
|
||||||
|
# define gzclose_w z_gzclose_w
|
||||||
|
# define gzdirect z_gzdirect
|
||||||
|
# define gzdopen z_gzdopen
|
||||||
|
# define gzeof z_gzeof
|
||||||
|
# define gzerror z_gzerror
|
||||||
|
# define gzflush z_gzflush
|
||||||
|
# define gzgetc z_gzgetc
|
||||||
|
# define gzgets z_gzgets
|
||||||
|
# define gzoffset z_gzoffset
|
||||||
|
# define gzoffset64 z_gzoffset64
|
||||||
|
# define gzopen z_gzopen
|
||||||
|
# define gzopen64 z_gzopen64
|
||||||
|
# define gzprintf z_gzprintf
|
||||||
|
# define gzputc z_gzputc
|
||||||
|
# define gzputs z_gzputs
|
||||||
|
# define gzread z_gzread
|
||||||
|
# define gzrewind z_gzrewind
|
||||||
|
# define gzseek z_gzseek
|
||||||
|
# define gzseek64 z_gzseek64
|
||||||
|
# define gzsetparams z_gzsetparams
|
||||||
|
# define gztell z_gztell
|
||||||
|
# define gztell64 z_gztell64
|
||||||
|
# define gzungetc z_gzungetc
|
||||||
|
# define gzwrite z_gzwrite
|
||||||
|
# define inflate z_inflate
|
||||||
|
# define inflateBack z_inflateBack
|
||||||
|
# define inflateBackEnd z_inflateBackEnd
|
||||||
|
# define inflateBackInit_ z_inflateBackInit_
|
||||||
|
# define inflateCopy z_inflateCopy
|
||||||
|
# define inflateEnd z_inflateEnd
|
||||||
|
# define inflateGetHeader z_inflateGetHeader
|
||||||
|
# define inflateInit2_ z_inflateInit2_
|
||||||
|
# define inflateInit_ z_inflateInit_
|
||||||
|
# define inflateMark z_inflateMark
|
||||||
|
# define inflatePrime z_inflatePrime
|
||||||
|
# define inflateReset z_inflateReset
|
||||||
|
# define inflateReset2 z_inflateReset2
|
||||||
|
# define inflateSetDictionary z_inflateSetDictionary
|
||||||
|
# define inflateSync z_inflateSync
|
||||||
|
# define inflateSyncPoint z_inflateSyncPoint
|
||||||
|
# define inflateUndermine z_inflateUndermine
|
||||||
|
# define inflate_copyright z_inflate_copyright
|
||||||
|
# define inflate_fast z_inflate_fast
|
||||||
|
# define inflate_table z_inflate_table
|
||||||
|
# define uncompress z_uncompress
|
||||||
# define zError z_zError
|
# define zError z_zError
|
||||||
|
# define zcalloc z_zcalloc
|
||||||
|
# define zcfree z_zcfree
|
||||||
|
# define zlibCompileFlags z_zlibCompileFlags
|
||||||
|
# define zlibVersion z_zlibVersion
|
||||||
|
|
||||||
# define alloc_func z_alloc_func
|
/* all zlib typedefs in zlib.h and zconf.h */
|
||||||
# define free_func z_free_func
|
|
||||||
# define in_func z_in_func
|
|
||||||
# define out_func z_out_func
|
|
||||||
# define Byte z_Byte
|
# define Byte z_Byte
|
||||||
# define uInt z_uInt
|
|
||||||
# define uLong z_uLong
|
|
||||||
# define Bytef z_Bytef
|
# define Bytef z_Bytef
|
||||||
|
# define alloc_func z_alloc_func
|
||||||
# define charf z_charf
|
# define charf z_charf
|
||||||
|
# define free_func z_free_func
|
||||||
|
# define gzFile z_gzFile
|
||||||
|
# define gz_header z_gz_header
|
||||||
|
# define gz_headerp z_gz_headerp
|
||||||
|
# define in_func z_in_func
|
||||||
# define intf z_intf
|
# define intf z_intf
|
||||||
|
# define out_func z_out_func
|
||||||
|
# define uInt z_uInt
|
||||||
# define uIntf z_uIntf
|
# define uIntf z_uIntf
|
||||||
|
# define uLong z_uLong
|
||||||
# define uLongf z_uLongf
|
# define uLongf z_uLongf
|
||||||
# define voidpf z_voidpf
|
|
||||||
# define voidp z_voidp
|
# define voidp z_voidp
|
||||||
|
# define voidpc z_voidpc
|
||||||
|
# define voidpf z_voidpf
|
||||||
|
|
||||||
|
/* all zlib structs in zlib.h and zconf.h */
|
||||||
|
# define gz_header_s z_gz_header_s
|
||||||
|
# define internal_state z_internal_state
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__MSDOS__) && !defined(MSDOS)
|
#if defined(__MSDOS__) && !defined(MSDOS)
|
||||||
|
@ -284,49 +356,73 @@ typedef uLong FAR uLongf;
|
||||||
typedef Byte *voidp;
|
typedef Byte *voidp;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
|
#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */
|
||||||
# include <sys/types.h> /* for off_t */
|
# define Z_HAVE_UNISTD_H
|
||||||
# include <unistd.h> /* for SEEK_* and off_t */
|
|
||||||
# ifdef VMS
|
|
||||||
# include <unixio.h> /* for off_t */
|
|
||||||
# endif
|
|
||||||
# define z_off_t off_t
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef STDC
|
||||||
|
# include <sys/types.h> /* for off_t */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and
|
||||||
|
* "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even
|
||||||
|
* though the former does not conform to the LFS document), but considering
|
||||||
|
* both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as
|
||||||
|
* equivalently requesting no 64-bit operations
|
||||||
|
*/
|
||||||
|
#if -_LARGEFILE64_SOURCE - -1 == 1
|
||||||
|
# undef _LARGEFILE64_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE)
|
||||||
|
# include <unistd.h> /* for SEEK_* and off_t */
|
||||||
|
# ifdef VMS
|
||||||
|
# include <unixio.h> /* for off_t */
|
||||||
|
# endif
|
||||||
|
# ifndef z_off_t
|
||||||
|
# define z_off_t off_t
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef SEEK_SET
|
#ifndef SEEK_SET
|
||||||
# define SEEK_SET 0 /* Seek from beginning of file. */
|
# define SEEK_SET 0 /* Seek from beginning of file. */
|
||||||
# define SEEK_CUR 1 /* Seek from current position. */
|
# define SEEK_CUR 1 /* Seek from current position. */
|
||||||
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
|
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef z_off_t
|
#ifndef z_off_t
|
||||||
# define z_off_t long
|
# define z_off_t long
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0
|
||||||
|
# define z_off64_t off64_t
|
||||||
|
#else
|
||||||
|
# define z_off64_t z_off_t
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__OS400__)
|
#if defined(__OS400__)
|
||||||
# define NO_vsnprintf
|
# define NO_vsnprintf
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(__MVS__)
|
#if defined(__MVS__)
|
||||||
# define NO_vsnprintf
|
# define NO_vsnprintf
|
||||||
# ifdef FAR
|
|
||||||
# undef FAR
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* MVS linker does not support external names larger than 8 bytes */
|
/* MVS linker does not support external names larger than 8 bytes */
|
||||||
#if defined(__MVS__)
|
#if defined(__MVS__)
|
||||||
# pragma map(deflateInit_,"DEIN")
|
#pragma map(deflateInit_,"DEIN")
|
||||||
# pragma map(deflateInit2_,"DEIN2")
|
#pragma map(deflateInit2_,"DEIN2")
|
||||||
# pragma map(deflateEnd,"DEEND")
|
#pragma map(deflateEnd,"DEEND")
|
||||||
# pragma map(deflateBound,"DEBND")
|
#pragma map(deflateBound,"DEBND")
|
||||||
# pragma map(inflateInit_,"ININ")
|
#pragma map(inflateInit_,"ININ")
|
||||||
# pragma map(inflateInit2_,"ININ2")
|
#pragma map(inflateInit2_,"ININ2")
|
||||||
# pragma map(inflateEnd,"INEND")
|
#pragma map(inflateEnd,"INEND")
|
||||||
# pragma map(inflateSync,"INSY")
|
#pragma map(inflateSync,"INSY")
|
||||||
# pragma map(inflateSetDictionary,"INSEDI")
|
#pragma map(inflateSetDictionary,"INSEDI")
|
||||||
# pragma map(compressBound,"CMBND")
|
#pragma map(compressBound,"CMBND")
|
||||||
# pragma map(inflate_table,"INTABL")
|
#pragma map(inflate_table,"INTABL")
|
||||||
# pragma map(inflate_fast,"INFA")
|
#pragma map(inflate_fast,"INFA")
|
||||||
# pragma map(inflate_copyright,"INCOPY")
|
#pragma map(inflate_copyright,"INCOPY")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* ZCONF_H */
|
#endif /* ZCONF_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -5,7 +5,6 @@
|
||||||
Name="zlib"
|
Name="zlib"
|
||||||
ProjectGUID="{731BD205-2826-4631-B7AF-117658E88DBC}"
|
ProjectGUID="{731BD205-2826-4631-B7AF-117658E88DBC}"
|
||||||
RootNamespace="zlib"
|
RootNamespace="zlib"
|
||||||
Keyword="MFCProj"
|
|
||||||
TargetFrameworkVersion="0"
|
TargetFrameworkVersion="0"
|
||||||
>
|
>
|
||||||
<Platforms>
|
<Platforms>
|
||||||
|
@ -18,12 +17,8 @@
|
||||||
<Configurations>
|
<Configurations>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|Win32"
|
Name="Debug|Win32"
|
||||||
OutputDirectory="$(SolutionDir)bin/$(ConfigurationName)/lib"
|
|
||||||
IntermediateDirectory="$(SolutionDir)build/$(ConfigurationName)/$(ProjectName)"
|
|
||||||
ConfigurationType="4"
|
ConfigurationType="4"
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
InheritedPropertySheets="..\..\..\PropertySheets\Win32.Debug.vsprops"
|
||||||
UseOfMFC="2"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
|
@ -42,28 +37,20 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
UsePrecompiledHeader="0"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
RuntimeTypeInfo="false"
|
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
SuppressStartupBanner="true"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
PreprocessorDefinitions="_DEBUG"
|
|
||||||
Culture="2057"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLibrarianTool"
|
Name="VCLibrarianTool"
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCALinkTool"
|
Name="VCALinkTool"
|
||||||
|
@ -73,8 +60,6 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCBscMakeTool"
|
Name="VCBscMakeTool"
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Debug/zlib.bsc"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCFxCopTool"
|
Name="VCFxCopTool"
|
||||||
|
@ -142,8 +127,6 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCBscMakeTool"
|
Name="VCBscMakeTool"
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\Release/zlib.bsc"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCFxCopTool"
|
Name="VCFxCopTool"
|
||||||
|
@ -163,242 +146,62 @@
|
||||||
<File
|
<File
|
||||||
RelativePath="adler32.c"
|
RelativePath="adler32.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="compress.c"
|
RelativePath="compress.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="crc32.c"
|
RelativePath="crc32.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="deflate.c"
|
RelativePath="deflate.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="gzio.c"
|
RelativePath=".\gzclose.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\gzlib.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\gzread.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\gzwrite.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="infback.c"
|
RelativePath="infback.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="inffast.c"
|
RelativePath="inffast.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="inflate.c"
|
RelativePath="inflate.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="inftrees.c"
|
RelativePath="inftrees.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="trees.c"
|
RelativePath="trees.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="uncompr.c"
|
RelativePath="uncompr.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="zutil.c"
|
RelativePath="zutil.c"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;$(NoInherit)"
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
|
@ -413,6 +216,10 @@
|
||||||
RelativePath="deflate.h"
|
RelativePath="deflate.h"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\gzguts.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="inffast.h"
|
RelativePath="inffast.h"
|
||||||
>
|
>
|
||||||
|
@ -455,6 +262,58 @@
|
||||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
|
Filter="ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
|
||||||
>
|
>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter
|
||||||
|
Name="Minizip"
|
||||||
|
>
|
||||||
|
<File
|
||||||
|
RelativePath=".\contrib\minizip\crypt.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\contrib\minizip\ioapi.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\contrib\minizip\ioapi.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\contrib\minizip\iowin32.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\contrib\minizip\iowin32.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\contrib\minizip\minizip.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\contrib\minizip\mztools.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\contrib\minizip\mztools.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\contrib\minizip\unzip.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\contrib\minizip\unzip.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\contrib\minizip\zip.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\contrib\minizip\zip.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
</Filter>
|
||||||
</Files>
|
</Files>
|
||||||
<Globals>
|
<Globals>
|
||||||
</Globals>
|
</Globals>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* zutil.c -- target dependent utility functions for the compression library
|
/* zutil.c -- target dependent utility functions for the compression library
|
||||||
* Copyright (C) 1995-2005 Jean-loup Gailly.
|
* Copyright (C) 1995-2005, 2010 Jean-loup Gailly.
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -34,25 +34,25 @@ uLong ZEXPORT zlibCompileFlags()
|
||||||
uLong flags;
|
uLong flags;
|
||||||
|
|
||||||
flags = 0;
|
flags = 0;
|
||||||
switch (sizeof(uInt)) {
|
switch ((int)(sizeof(uInt))) {
|
||||||
case 2: break;
|
case 2: break;
|
||||||
case 4: flags += 1; break;
|
case 4: flags += 1; break;
|
||||||
case 8: flags += 2; break;
|
case 8: flags += 2; break;
|
||||||
default: flags += 3;
|
default: flags += 3;
|
||||||
}
|
}
|
||||||
switch (sizeof(uLong)) {
|
switch ((int)(sizeof(uLong))) {
|
||||||
case 2: break;
|
case 2: break;
|
||||||
case 4: flags += 1 << 2; break;
|
case 4: flags += 1 << 2; break;
|
||||||
case 8: flags += 2 << 2; break;
|
case 8: flags += 2 << 2; break;
|
||||||
default: flags += 3 << 2;
|
default: flags += 3 << 2;
|
||||||
}
|
}
|
||||||
switch (sizeof(voidpf)) {
|
switch ((int)(sizeof(voidpf))) {
|
||||||
case 2: break;
|
case 2: break;
|
||||||
case 4: flags += 1 << 4; break;
|
case 4: flags += 1 << 4; break;
|
||||||
case 8: flags += 2 << 4; break;
|
case 8: flags += 2 << 4; break;
|
||||||
default: flags += 3 << 4;
|
default: flags += 3 << 4;
|
||||||
}
|
}
|
||||||
switch (sizeof(z_off_t)) {
|
switch ((int)(sizeof(z_off_t))) {
|
||||||
case 2: break;
|
case 2: break;
|
||||||
case 4: flags += 1 << 6; break;
|
case 4: flags += 1 << 6; break;
|
||||||
case 8: flags += 2 << 6; break;
|
case 8: flags += 2 << 6; break;
|
||||||
|
@ -117,9 +117,9 @@ uLong ZEXPORT zlibCompileFlags()
|
||||||
# ifndef verbose
|
# ifndef verbose
|
||||||
# define verbose 0
|
# define verbose 0
|
||||||
# endif
|
# endif
|
||||||
int z_verbose = verbose;
|
int ZLIB_INTERNAL z_verbose = verbose;
|
||||||
|
|
||||||
void z_error (m)
|
void ZLIB_INTERNAL z_error (m)
|
||||||
char *m;
|
char *m;
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s\n", m);
|
fprintf(stderr, "%s\n", m);
|
||||||
|
@ -146,7 +146,7 @@ const char * ZEXPORT zError(err)
|
||||||
|
|
||||||
#ifndef HAVE_MEMCPY
|
#ifndef HAVE_MEMCPY
|
||||||
|
|
||||||
void zmemcpy(dest, source, len)
|
void ZLIB_INTERNAL zmemcpy(dest, source, len)
|
||||||
Bytef* dest;
|
Bytef* dest;
|
||||||
const Bytef* source;
|
const Bytef* source;
|
||||||
uInt len;
|
uInt len;
|
||||||
|
@ -157,7 +157,7 @@ void zmemcpy(dest, source, len)
|
||||||
} while (--len != 0);
|
} while (--len != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int zmemcmp(s1, s2, len)
|
int ZLIB_INTERNAL zmemcmp(s1, s2, len)
|
||||||
const Bytef* s1;
|
const Bytef* s1;
|
||||||
const Bytef* s2;
|
const Bytef* s2;
|
||||||
uInt len;
|
uInt len;
|
||||||
|
@ -170,7 +170,7 @@ int zmemcmp(s1, s2, len)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void zmemzero(dest, len)
|
void ZLIB_INTERNAL zmemzero(dest, len)
|
||||||
Bytef* dest;
|
Bytef* dest;
|
||||||
uInt len;
|
uInt len;
|
||||||
{
|
{
|
||||||
|
@ -213,7 +213,7 @@ local ptr_table table[MAX_PTR];
|
||||||
* a protected system like OS/2. Use Microsoft C instead.
|
* a protected system like OS/2. Use Microsoft C instead.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
|
voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size)
|
||||||
{
|
{
|
||||||
voidpf buf = opaque; /* just to make some compilers happy */
|
voidpf buf = opaque; /* just to make some compilers happy */
|
||||||
ulg bsize = (ulg)items*size;
|
ulg bsize = (ulg)items*size;
|
||||||
|
@ -237,7 +237,7 @@ voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void zcfree (voidpf opaque, voidpf ptr)
|
void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
if (*(ush*)&ptr != 0) { /* object < 64K */
|
if (*(ush*)&ptr != 0) { /* object < 64K */
|
||||||
|
@ -272,13 +272,13 @@ void zcfree (voidpf opaque, voidpf ptr)
|
||||||
# define _hfree hfree
|
# define _hfree hfree
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
voidpf zcalloc (voidpf opaque, unsigned items, unsigned size)
|
voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size)
|
||||||
{
|
{
|
||||||
if (opaque) opaque = 0; /* to make compiler happy */
|
if (opaque) opaque = 0; /* to make compiler happy */
|
||||||
return _halloc((long)items, size);
|
return _halloc((long)items, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void zcfree (voidpf opaque, voidpf ptr)
|
void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr)
|
||||||
{
|
{
|
||||||
if (opaque) opaque = 0; /* to make compiler happy */
|
if (opaque) opaque = 0; /* to make compiler happy */
|
||||||
_hfree(ptr);
|
_hfree(ptr);
|
||||||
|
@ -297,7 +297,7 @@ extern voidp calloc OF((uInt items, uInt size));
|
||||||
extern void free OF((voidpf ptr));
|
extern void free OF((voidpf ptr));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
voidpf zcalloc (opaque, items, size)
|
voidpf ZLIB_INTERNAL zcalloc (opaque, items, size)
|
||||||
voidpf opaque;
|
voidpf opaque;
|
||||||
unsigned items;
|
unsigned items;
|
||||||
unsigned size;
|
unsigned size;
|
||||||
|
@ -307,7 +307,7 @@ voidpf zcalloc (opaque, items, size)
|
||||||
(voidpf)calloc(items, size);
|
(voidpf)calloc(items, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void zcfree (opaque, ptr)
|
void ZLIB_INTERNAL zcfree (opaque, ptr)
|
||||||
voidpf opaque;
|
voidpf opaque;
|
||||||
voidpf ptr;
|
voidpf ptr;
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* zutil.h -- internal interface and configuration of the compression library
|
/* zutil.h -- internal interface and configuration of the compression library
|
||||||
* Copyright (C) 1995-2005 Jean-loup Gailly.
|
* Copyright (C) 1995-2010 Jean-loup Gailly.
|
||||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -13,31 +13,21 @@
|
||||||
#ifndef ZUTIL_H
|
#ifndef ZUTIL_H
|
||||||
#define ZUTIL_H
|
#define ZUTIL_H
|
||||||
|
|
||||||
#define ZLIB_INTERNAL
|
#if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33) && !defined(NO_VIZ)
|
||||||
|
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
|
||||||
|
#else
|
||||||
|
# define ZLIB_INTERNAL
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "zlib.h"
|
#include "zlib.h"
|
||||||
|
|
||||||
#ifdef STDC
|
#ifdef STDC
|
||||||
# ifndef _WIN32_WCE
|
# if !(defined(_WIN32_WCE) && defined(_MSC_VER))
|
||||||
# include <stddef.h>
|
# include <stddef.h>
|
||||||
# endif
|
# endif
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef NO_ERRNO_H
|
|
||||||
# ifdef _WIN32_WCE
|
|
||||||
/* The Microsoft C Run-Time Library for Windows CE doesn't have
|
|
||||||
* errno. We define it as a global variable to simplify porting.
|
|
||||||
* Its value is always 0 and should not be used. We rename it to
|
|
||||||
* avoid conflict with other libraries that use the same workaround.
|
|
||||||
*/
|
|
||||||
# define errno z_errno
|
|
||||||
# endif
|
|
||||||
extern int errno;
|
|
||||||
#else
|
|
||||||
# ifndef _WIN32_WCE
|
|
||||||
# include <errno.h>
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef local
|
#ifndef local
|
||||||
# define local static
|
# define local static
|
||||||
|
@ -89,7 +79,7 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||||
#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
|
#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
|
||||||
# define OS_CODE 0x00
|
# define OS_CODE 0x00
|
||||||
# if defined(__TURBOC__) || defined(__BORLANDC__)
|
# if defined(__TURBOC__) || defined(__BORLANDC__)
|
||||||
# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
|
# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
|
||||||
/* Allow compilation with ANSI keywords only enabled */
|
/* Allow compilation with ANSI keywords only enabled */
|
||||||
void _Cdecl farfree( void *block );
|
void _Cdecl farfree( void *block );
|
||||||
void *_Cdecl farmalloc( unsigned long nbytes );
|
void *_Cdecl farmalloc( unsigned long nbytes );
|
||||||
|
@ -118,7 +108,7 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||||
#ifdef OS2
|
#ifdef OS2
|
||||||
# define OS_CODE 0x06
|
# define OS_CODE 0x06
|
||||||
# ifdef M_I86
|
# ifdef M_I86
|
||||||
#include <malloc.h>
|
# include <malloc.h>
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -151,7 +141,7 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
# define fdopen(fd,mode) NULL /* No fdopen() */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(_MSC_VER) && (_MSC_VER > 600))
|
#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
|
||||||
# if defined(_WIN32_WCE)
|
# if defined(_WIN32_WCE)
|
||||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
# define fdopen(fd,mode) NULL /* No fdopen() */
|
||||||
# ifndef _PTRDIFF_T_DEFINED
|
# ifndef _PTRDIFF_T_DEFINED
|
||||||
|
@ -163,6 +153,18 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__BORLANDC__)
|
||||||
|
#pragma warn -8004
|
||||||
|
#pragma warn -8008
|
||||||
|
#pragma warn -8066
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* provide prototypes for these when building zlib without LFS */
|
||||||
|
#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0
|
||||||
|
ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t));
|
||||||
|
ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t));
|
||||||
|
#endif
|
||||||
|
|
||||||
/* common defaults */
|
/* common defaults */
|
||||||
|
|
||||||
#ifndef OS_CODE
|
#ifndef OS_CODE
|
||||||
|
@ -197,7 +199,9 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||||
# ifdef WIN32
|
# ifdef WIN32
|
||||||
/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
|
/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
|
||||||
# if !defined(vsnprintf) && !defined(NO_vsnprintf)
|
# if !defined(vsnprintf) && !defined(NO_vsnprintf)
|
||||||
# define vsnprintf _vsnprintf
|
# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 )
|
||||||
|
# define vsnprintf _vsnprintf
|
||||||
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# ifdef __SASC
|
# ifdef __SASC
|
||||||
|
@ -232,16 +236,16 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||||
# define zmemzero(dest, len) memset(dest, 0, len)
|
# define zmemzero(dest, len) memset(dest, 0, len)
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
|
void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
|
||||||
extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
|
int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
|
||||||
extern void zmemzero OF((Bytef* dest, uInt len));
|
void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Diagnostic functions */
|
/* Diagnostic functions */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
extern int z_verbose;
|
extern int ZLIB_INTERNAL z_verbose;
|
||||||
extern void z_error OF((char *m));
|
extern void ZLIB_INTERNAL z_error OF((char *m));
|
||||||
# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
|
# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
|
||||||
# define Trace(x) {if (z_verbose>=0) fprintf x ;}
|
# define Trace(x) {if (z_verbose>=0) fprintf x ;}
|
||||||
# define Tracev(x) {if (z_verbose>0) fprintf x ;}
|
# define Tracev(x) {if (z_verbose>0) fprintf x ;}
|
||||||
|
@ -258,8 +262,9 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
|
voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items,
|
||||||
void zcfree OF((voidpf opaque, voidpf ptr));
|
unsigned size));
|
||||||
|
void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr));
|
||||||
|
|
||||||
#define ZALLOC(strm, items, size) \
|
#define ZALLOC(strm, items, size) \
|
||||||
(*((strm)->zalloc))((strm)->opaque, (items), (size))
|
(*((strm)->zalloc))((strm)->opaque, (items), (size))
|
||||||
|
|
|
@ -17,13 +17,8 @@
|
||||||
<Configurations>
|
<Configurations>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|Win32"
|
Name="Debug|Win32"
|
||||||
OutputDirectory="$(SolutionDir)bin/$(ConfigurationName)/lib"
|
|
||||||
IntermediateDirectory="$(SolutionDir)build/$(ConfigurationName)/$(ProjectName)"
|
|
||||||
ConfigurationType="4"
|
ConfigurationType="4"
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
InheritedPropertySheets="$(SolutionDir)PropertySheets/Win32.Debug.vsprops"
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
|
@ -42,34 +37,18 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
|
|
||||||
StringPooling="true"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
ForceConformanceInForLoopScope="true"
|
|
||||||
RuntimeTypeInfo="false"
|
|
||||||
UsePrecompiledHeader="2"
|
|
||||||
PrecompiledHeaderThrough="stdafx.h"
|
|
||||||
WarningLevel="3"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
PreprocessorDefinitions="_DEBUG"
|
|
||||||
Culture="3081"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLibrarianTool"
|
Name="VCLibrarianTool"
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCALinkTool"
|
Name="VCALinkTool"
|
||||||
|
@ -79,80 +58,6 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCBscMakeTool"
|
Name="VCBscMakeTool"
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\../../Build/Common/Debug/Common.bsc"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCFxCopTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPostBuildEventTool"
|
|
||||||
/>
|
|
||||||
</Configuration>
|
|
||||||
<Configuration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
OutputDirectory="$(SolutionDir)bin/$(ConfigurationName)/lib"
|
|
||||||
IntermediateDirectory="$(SolutionDir)build/$(ConfigurationName)/$(ProjectName)"
|
|
||||||
ConfigurationType="4"
|
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreBuildEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCustomBuildTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXMLDataGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCWebServiceProxyGeneratorTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCMIDLTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
Optimization="2"
|
|
||||||
InlineFunctionExpansion="1"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
|
|
||||||
StringPooling="true"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
ForceConformanceInForLoopScope="true"
|
|
||||||
RuntimeTypeInfo="false"
|
|
||||||
WarningLevel="3"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCManagedResourceCompilerTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
Culture="3081"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCPreLinkEventTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCLibrarianTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCALinkTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCXDCMakeTool"
|
|
||||||
/>
|
|
||||||
<Tool
|
|
||||||
Name="VCBscMakeTool"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\../../Bin/External/Common.bsc"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCFxCopTool"
|
Name="VCFxCopTool"
|
||||||
|
@ -163,13 +68,8 @@
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
OutputDirectory="$(SolutionDir)bin/$(ConfigurationName)/lib"
|
|
||||||
IntermediateDirectory="$(SolutionDir)build/$(ConfigurationName)/$(ProjectName)"
|
|
||||||
ConfigurationType="4"
|
ConfigurationType="4"
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
InheritedPropertySheets="$(SolutionDir)PropertySheets/Win32.Release.vsprops"
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
|
@ -188,33 +88,18 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="2"
|
|
||||||
InlineFunctionExpansion="1"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
|
|
||||||
StringPooling="true"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
BufferSecurityCheck="false"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
ForceConformanceInForLoopScope="true"
|
|
||||||
RuntimeTypeInfo="false"
|
|
||||||
WarningLevel="3"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
Culture="3081"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLibrarianTool"
|
Name="VCLibrarianTool"
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCALinkTool"
|
Name="VCALinkTool"
|
||||||
|
@ -224,8 +109,6 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCBscMakeTool"
|
Name="VCBscMakeTool"
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\../../Build/Common/Release/Common.bsc"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCFxCopTool"
|
Name="VCFxCopTool"
|
||||||
|
@ -245,254 +128,38 @@
|
||||||
<File
|
<File
|
||||||
RelativePath="File Class.cpp"
|
RelativePath="File Class.cpp"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="Ini File Class.cpp"
|
RelativePath="Ini File Class.cpp"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="Log Class.cpp"
|
RelativePath="Log Class.cpp"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="md5.cpp"
|
RelativePath="md5.cpp"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="MemTest.cpp"
|
RelativePath="MemTest.cpp"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="osversion.cpp"
|
RelativePath="osversion.cpp"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="path.cpp"
|
RelativePath="path.cpp"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="registry.cpp"
|
RelativePath="registry.cpp"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="std string.cpp"
|
RelativePath="std string.cpp"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="stdafx.cpp"
|
RelativePath="stdafx.cpp"
|
||||||
|
@ -502,82 +169,25 @@
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
PreprocessorDefinitions=""
|
|
||||||
UsePrecompiledHeader="1"
|
UsePrecompiledHeader="1"
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
<FileConfiguration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
PreprocessorDefinitions=""
|
UsePrecompiledHeader="1"
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="Trace.cpp"
|
RelativePath="Trace.cpp"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="Version.cpp"
|
RelativePath="Version.cpp"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="External Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
|
|
|
@ -379,7 +379,7 @@ int CCheats::ApplyCheatEntry (CMipsMemory * _MMU, const CODES & CodeEntry, int C
|
||||||
case 0x82000000:
|
case 0x82000000:
|
||||||
case 0x84000000:
|
case 0x84000000:
|
||||||
Address = 0x80000000 | (Code.Command & 0xFFFFFF);
|
Address = 0x80000000 | (Code.Command & 0xFFFFFF);
|
||||||
if (Execute) { _MMU->SB_VAddr(Address,Code.Value); }
|
if (Execute) { _MMU->SB_VAddr(Address,(BYTE)Code.Value); }
|
||||||
break;
|
break;
|
||||||
case 0x31000000:
|
case 0x31000000:
|
||||||
case 0x83000000:
|
case 0x83000000:
|
||||||
|
@ -397,7 +397,7 @@ int CCheats::ApplyCheatEntry (CMipsMemory * _MMU, const CODES & CodeEntry, int C
|
||||||
break;
|
break;
|
||||||
case 0xC8000000:
|
case 0xC8000000:
|
||||||
Address = 0xA0000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF);
|
Address = 0xA0000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF);
|
||||||
if (Execute) { _MMU->SB_VAddr(Address,Code.Value); }
|
if (Execute) { _MMU->SB_VAddr(Address,(BYTE)Code.Value); }
|
||||||
break;
|
break;
|
||||||
case 0xC9000000:
|
case 0xC9000000:
|
||||||
Address = 0xA0000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF);
|
Address = 0xA0000000 | (ConvertXP64Address(Code.Command) & 0xFFFFFF);
|
||||||
|
|
|
@ -5084,6 +5084,7 @@ void CRecompilerOps::EnterCodeBlock ( void )
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
Push(x86_ESI);
|
Push(x86_ESI);
|
||||||
#else
|
#else
|
||||||
|
Push(x86_EDI);
|
||||||
Push(x86_ESI);
|
Push(x86_ESI);
|
||||||
Push(x86_EBX);
|
Push(x86_EBX);
|
||||||
#endif
|
#endif
|
||||||
|
@ -5096,6 +5097,7 @@ void CRecompilerOps::ExitCodeBlock ( void )
|
||||||
#else
|
#else
|
||||||
Pop(x86_EBX);
|
Pop(x86_EBX);
|
||||||
Pop(x86_ESI);
|
Pop(x86_ESI);
|
||||||
|
Pop(x86_EDI);
|
||||||
#endif
|
#endif
|
||||||
Ret();
|
Ret();
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1598,8 +1598,10 @@ void CRomBrowser::ShowRomList (void) {
|
||||||
m_Visible = true;
|
m_Visible = true;
|
||||||
|
|
||||||
RECT rcWindow;
|
RECT rcWindow;
|
||||||
GetClientRect((HWND)m_MainWindow,&rcWindow);
|
if (GetClientRect((HWND)m_MainWindow,&rcWindow))
|
||||||
ResizeRomList((WORD)rcWindow.right,(WORD)rcWindow.bottom);
|
{
|
||||||
|
ResizeRomList((WORD)rcWindow.right,(WORD)rcWindow.bottom);
|
||||||
|
}
|
||||||
|
|
||||||
InvalidateRect((HWND)m_hRomList,NULL,TRUE);
|
InvalidateRect((HWND)m_hRomList,NULL,TRUE);
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "Plugin.h"
|
#include "Plugin.h"
|
||||||
#include "Support.h"
|
#include "Support.h"
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <mmsystem.h>
|
||||||
#include "Validate Binary.h"
|
#include "Validate Binary.h"
|
||||||
#include <Aclapi.h>
|
#include <Aclapi.h>
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ enum {
|
||||||
Set_ReOrdering, Set_GPRConstants, Set_Flags, Set_AlignVector,
|
Set_ReOrdering, Set_GPRConstants, Set_Flags, Set_AlignVector,
|
||||||
};
|
};
|
||||||
|
|
||||||
ULONG Set_AudioHle = 0, Set_GraphicsHle = 0;
|
short Set_AudioHle = 0, Set_GraphicsHle = 0;
|
||||||
|
|
||||||
/************ DLL info **************/
|
/************ DLL info **************/
|
||||||
const char * AppName ( void )
|
const char * AppName ( void )
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <shellapi.h>
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "profiling.h"
|
#include "profiling.h"
|
||||||
}
|
}
|
||||||
|
@ -129,8 +130,8 @@ public:
|
||||||
//sort the list with a basic bubble sort
|
//sort the list with a basic bubble sort
|
||||||
if (ItemList.size() > 0)
|
if (ItemList.size() > 0)
|
||||||
{
|
{
|
||||||
for (int OuterPass = 0; OuterPass < (ItemList.size() - 1); OuterPass++ ) {
|
for (size_t OuterPass = 0; OuterPass < (ItemList.size() - 1); OuterPass++ ) {
|
||||||
for (int InnerPass = 0; InnerPass < (ItemList.size() - 1); InnerPass++ ) {
|
for (size_t InnerPass = 0; InnerPass < (ItemList.size() - 1); InnerPass++ ) {
|
||||||
if (ItemList[InnerPass]->second < ItemList[InnerPass + 1]->second) {
|
if (ItemList[InnerPass]->second < ItemList[InnerPass + 1]->second) {
|
||||||
PROFILE_VALUE * TempPtr = ItemList[InnerPass];
|
PROFILE_VALUE * TempPtr = ItemList[InnerPass];
|
||||||
ItemList[InnerPass] = ItemList[InnerPass + 1];
|
ItemList[InnerPass] = ItemList[InnerPass + 1];
|
||||||
|
@ -147,9 +148,9 @@ public:
|
||||||
{Timer_RDP_Running, "RDP: Running"},
|
{Timer_RDP_Running, "RDP: Running"},
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int count =0; count < ItemList.size(); count++ ) {
|
for (size_t count = 0; count < ItemList.size(); count++ ) {
|
||||||
char Buffer[255];
|
char Buffer[255];
|
||||||
float CpuUsage = ((double)ItemList[count]->second / (double)TotalTime) * 100;
|
float CpuUsage = (float)(((double)ItemList[count]->second / (double)TotalTime) * 100);
|
||||||
if (CpuUsage <= 0.2) { continue; }
|
if (CpuUsage <= 0.2) { continue; }
|
||||||
sprintf(Buffer,"Func 0x%08X",ItemList[count]->first);
|
sprintf(Buffer,"Func 0x%08X",ItemList[count]->first);
|
||||||
for (int NameID = 0; NameID < (sizeof(TimerNames) / sizeof(TIMER_NAME)); NameID++) {
|
for (int NameID = 0; NameID < (sizeof(TimerNames) / sizeof(TIMER_NAME)); NameID++) {
|
||||||
|
|
|
@ -17,13 +17,8 @@
|
||||||
<Configurations>
|
<Configurations>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|Win32"
|
Name="Debug|Win32"
|
||||||
OutputDirectory="$(SolutionDir)bin/$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(SolutionDir)build/$(ConfigurationName)/$(ProjectName)"
|
|
||||||
ConfigurationType="2"
|
ConfigurationType="2"
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
InheritedPropertySheets="$(SolutionDir)PropertySheets/Win32.Debug.vsprops"
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
|
@ -39,51 +34,23 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCMIDLTool"
|
Name="VCMIDLTool"
|
||||||
PreprocessorDefinitions="_DEBUG"
|
|
||||||
MkTypLibCompatible="true"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
TargetEnvironment="1"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
UsePrecompiledHeader="0"
|
||||||
AdditionalIncludeDirectories="../,./"
|
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;RSP_EXPORTS"
|
|
||||||
StringPooling="true"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
ExceptionHandling="0"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
BufferSecurityCheck="false"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
RuntimeTypeInfo="false"
|
|
||||||
WarningLevel="3"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
PreprocessorDefinitions="_DEBUG"
|
|
||||||
Culture="1033"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
OutputFile="$(SolutionDir)bin\Release\Plugin\RSP\RSP_d 1.7.dll"
|
OutputFile="$(OutDir)\Plugin\RSP\RSP_d.dll"
|
||||||
LinkIncremental="1"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
ProgramDatabaseFile="$(SolutionDir)bin\Release\pdb\$(TargetName).pdb"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
ImportLibrary="$(SolutionDir)bin\Release\lib\$(TargetName).lib"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCALinkTool"
|
Name="VCALinkTool"
|
||||||
|
@ -110,13 +77,8 @@
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
OutputDirectory="$(SolutionDir)bin/$(ConfigurationName)"
|
|
||||||
IntermediateDirectory="$(SolutionDir)build/$(ConfigurationName)/$(ProjectName)"
|
|
||||||
ConfigurationType="2"
|
ConfigurationType="2"
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
InheritedPropertySheets="$(SolutionDir)PropertySheets/Win32.Release.vsprops"
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
|
@ -132,35 +94,16 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCMIDLTool"
|
Name="VCMIDLTool"
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
MkTypLibCompatible="true"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
TargetEnvironment="1"
|
|
||||||
TypeLibraryName=".\../../Build/RSP/Release/RSP.tlb"
|
|
||||||
HeaderFileName=""
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="2"
|
UsePrecompiledHeader="0"
|
||||||
InlineFunctionExpansion="1"
|
|
||||||
AdditionalIncludeDirectories="../,./"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;RSP_EXPORTS"
|
|
||||||
StringPooling="true"
|
|
||||||
ExceptionHandling="0"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
BufferSecurityCheck="false"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
RuntimeTypeInfo="false"
|
|
||||||
WarningLevel="3"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
Culture="1033"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
|
@ -168,14 +111,6 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLinkerTool"
|
Name="VCLinkerTool"
|
||||||
OutputFile="$(OutDir)\Plugin\RSP\RSP 1.7.dll"
|
OutputFile="$(OutDir)\Plugin\RSP\RSP 1.7.dll"
|
||||||
LinkIncremental="1"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
GenerateDebugInformation="true"
|
|
||||||
ProgramDatabaseFile="$(OutDir)\pdb\$(TargetName).pdb"
|
|
||||||
RandomizedBaseAddress="1"
|
|
||||||
DataExecutionPrevention="0"
|
|
||||||
ImportLibrary="$(OutDir)\lib\$(TargetName).lib"
|
|
||||||
TargetMachine="1"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCALinkTool"
|
Name="VCALinkTool"
|
||||||
|
@ -188,8 +123,6 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCBscMakeTool"
|
Name="VCBscMakeTool"
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\../../Build/RSP/Release/RSP.bsc"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCFxCopTool"
|
Name="VCFxCopTool"
|
||||||
|
@ -209,406 +142,78 @@
|
||||||
Name="Source Files"
|
Name="Source Files"
|
||||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||||
>
|
>
|
||||||
|
<File
|
||||||
|
RelativePath="breakpoint.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="Cpu.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="dma.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="Interpreter CPU.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="Interpreter Ops.c"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="log.cpp"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="Main.cpp"
|
RelativePath="Main.cpp"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
<Filter
|
<File
|
||||||
Name="RSP Source Files"
|
RelativePath="memory.c"
|
||||||
>
|
>
|
||||||
<File
|
</File>
|
||||||
RelativePath="breakpoint.c"
|
<File
|
||||||
>
|
RelativePath="Mmx.c"
|
||||||
<FileConfiguration
|
>
|
||||||
Name="Debug|Win32"
|
</File>
|
||||||
>
|
<File
|
||||||
<Tool
|
RelativePath="Profiling.cpp"
|
||||||
Name="VCCLCompilerTool"
|
>
|
||||||
AdditionalIncludeDirectories=""
|
</File>
|
||||||
PreprocessorDefinitions=""
|
<File
|
||||||
/>
|
RelativePath="Recompiler Analysis.c"
|
||||||
</FileConfiguration>
|
>
|
||||||
<FileConfiguration
|
</File>
|
||||||
Name="Release|Win32"
|
<File
|
||||||
>
|
RelativePath="Recompiler CPU.c"
|
||||||
<Tool
|
>
|
||||||
Name="VCCLCompilerTool"
|
</File>
|
||||||
AdditionalIncludeDirectories=""
|
<File
|
||||||
PreprocessorDefinitions=""
|
RelativePath="Recompiler Ops.c"
|
||||||
/>
|
>
|
||||||
</FileConfiguration>
|
</File>
|
||||||
</File>
|
<File
|
||||||
<File
|
RelativePath="Recompiler Sections.c"
|
||||||
RelativePath="Cpu.c"
|
>
|
||||||
>
|
</File>
|
||||||
<FileConfiguration
|
<File
|
||||||
Name="Debug|Win32"
|
RelativePath="RSP Command.c"
|
||||||
>
|
>
|
||||||
<Tool
|
</File>
|
||||||
Name="VCCLCompilerTool"
|
<File
|
||||||
AdditionalIncludeDirectories=""
|
RelativePath="RSP Register.c"
|
||||||
PreprocessorDefinitions=""
|
>
|
||||||
/>
|
</File>
|
||||||
</FileConfiguration>
|
<File
|
||||||
<FileConfiguration
|
RelativePath="Sse.c"
|
||||||
Name="Release|Win32"
|
>
|
||||||
>
|
</File>
|
||||||
<Tool
|
<File
|
||||||
Name="VCCLCompilerTool"
|
RelativePath="X86.c"
|
||||||
AdditionalIncludeDirectories=""
|
>
|
||||||
PreprocessorDefinitions=""
|
</File>
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="dma.c"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="Interpreter CPU.c"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="Interpreter Ops.c"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="log.cpp"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="memory.c"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="Mmx.c"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="Profiling.cpp"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="Recompiler Analysis.c"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="Recompiler CPU.c"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="Recompiler Ops.c"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="Recompiler Sections.c"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="RSP Command.c"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="RSP Register.c"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="Sse.c"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
|
||||||
RelativePath="X86.c"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
</Filter>
|
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="Header Files"
|
Name="Header Files"
|
||||||
|
@ -730,22 +335,6 @@
|
||||||
<File
|
<File
|
||||||
RelativePath="RSP.rc"
|
RelativePath="RSP.rc"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCResourceCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
</Files>
|
</Files>
|
||||||
|
|
|
@ -189,7 +189,7 @@ DWORD WriteToAccum2 (int Location, int PC, BOOL RecursiveCall) {
|
||||||
break;
|
break;
|
||||||
case RSP_J:
|
case RSP_J:
|
||||||
/* there is no way a loopback is going to use accumulator */
|
/* there is no way a loopback is going to use accumulator */
|
||||||
if (Compiler.bAudioUcode && (RspOp.target << 2) < PC) {
|
if (Compiler.bAudioUcode && ((int)(RspOp.target << 2) < PC)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
/* rarely occurs let them have their way */
|
/* rarely occurs let them have their way */
|
||||||
|
@ -215,7 +215,7 @@ DWORD WriteToAccum2 (int Location, int PC, BOOL RecursiveCall) {
|
||||||
/* if the opcode 8 bytes before the dest is a J backward than ignore this */
|
/* if the opcode 8 bytes before the dest is a J backward than ignore this */
|
||||||
BranchImmed = (PC + ((short)RspOp.offset << 2) + 4) & 0xFFC;
|
BranchImmed = (PC + ((short)RspOp.offset << 2) + 4) & 0xFFC;
|
||||||
RSP_LW_IMEM(BranchImmed - 8, &NextOp.Hex);
|
RSP_LW_IMEM(BranchImmed - 8, &NextOp.Hex);
|
||||||
if (RspOp.op == RSP_J && (RspOp.target << 2) < PC) {
|
if (RspOp.op == RSP_J && (int)(RspOp.target << 2) < PC) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -486,7 +486,7 @@ BOOL WriteToVectorDest2 (DWORD DestReg, int PC, BOOL RecursiveCall) {
|
||||||
break;
|
break;
|
||||||
case RSP_J:
|
case RSP_J:
|
||||||
/* there is no way a loopback is going to use accumulator */
|
/* there is no way a loopback is going to use accumulator */
|
||||||
if (Compiler.bAudioUcode && (RspOp.target << 2) < PC) {
|
if (Compiler.bAudioUcode && (int)(RspOp.target << 2) < PC) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
/* rarely occurs let them have their way */
|
/* rarely occurs let them have their way */
|
||||||
|
@ -511,7 +511,7 @@ BOOL WriteToVectorDest2 (DWORD DestReg, int PC, BOOL RecursiveCall) {
|
||||||
/* if the opcode 8 bytes before the dest is a J backward than ignore this */
|
/* if the opcode 8 bytes before the dest is a J backward than ignore this */
|
||||||
BranchImmed = (PC + ((short)RspOp.offset << 2) + 4) & 0xFFC;
|
BranchImmed = (PC + ((short)RspOp.offset << 2) + 4) & 0xFFC;
|
||||||
RSP_LW_IMEM(BranchImmed - 8, &NextOp.Hex);
|
RSP_LW_IMEM(BranchImmed - 8, &NextOp.Hex);
|
||||||
if (RspOp.op == RSP_J && (RspOp.target << 2) < PC) {
|
if (RspOp.op == RSP_J && (int)(RspOp.target << 2) < PC) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include "RSP.h"
|
#include "RSP.h"
|
||||||
#include "Cpu.h"
|
#include "Cpu.h"
|
||||||
#include "Recompiler CPU.h"
|
#include "Recompiler CPU.h"
|
||||||
|
@ -752,7 +753,7 @@ void CompilerLinkBlocks(void) {
|
||||||
|
|
||||||
void CompilerRSPBlock ( void ) {
|
void CompilerRSPBlock ( void ) {
|
||||||
DWORD Count, Padding, X86BaseAddress = (DWORD)RecompPos;
|
DWORD Count, Padding, X86BaseAddress = (DWORD)RecompPos;
|
||||||
BYTE * IMEM_SAVE = malloc(0x1000);
|
BYTE * IMEM_SAVE = (BYTE *)malloc(0x1000);
|
||||||
|
|
||||||
NextInstruction = NORMAL;
|
NextInstruction = NORMAL;
|
||||||
CompilePC = *PrgCount;
|
CompilePC = *PrgCount;
|
||||||
|
|
|
@ -123,7 +123,7 @@ void RegisterSetting ( short SettingID, SETTING_DATA_TYPE Type, const char *
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG FindSystemSettingId ( const char * Name )
|
short FindSystemSettingId ( const char * Name )
|
||||||
{
|
{
|
||||||
if (g_PluginSettings2.FindSystemSettingId && g_PluginSettings.handle)
|
if (g_PluginSettings2.FindSystemSettingId && g_PluginSettings.handle)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,7 @@ BOOL SettingsInitilized ( void );
|
||||||
void SetModuleName ( const char * Name );
|
void SetModuleName ( const char * Name );
|
||||||
void RegisterSetting ( short SettingID, SETTING_DATA_TYPE Type, const char * Name, const char * Category,
|
void RegisterSetting ( short SettingID, SETTING_DATA_TYPE Type, const char * Name, const char * Category,
|
||||||
unsigned int DefaultDW, const char * DefaultStr );
|
unsigned int DefaultDW, const char * DefaultStr );
|
||||||
ULONG FindSystemSettingId ( const char * Name );
|
short FindSystemSettingId ( const char * Name );
|
||||||
|
|
||||||
// this must be implemented to be notified when a setting is used but has not been set up
|
// this must be implemented to be notified when a setting is used but has not been set up
|
||||||
void UseUnregisteredSetting (int SettingID);
|
void UseUnregisteredSetting (int SettingID);
|
||||||
|
|
|
@ -17,13 +17,8 @@
|
||||||
<Configurations>
|
<Configurations>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|Win32"
|
Name="Debug|Win32"
|
||||||
OutputDirectory="$(SolutionDir)bin/$(ConfigurationName)/lib"
|
|
||||||
IntermediateDirectory="$(SolutionDir)build/$(ConfigurationName)/$(ProjectName)"
|
|
||||||
ConfigurationType="4"
|
ConfigurationType="4"
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
InheritedPropertySheets="$(SolutionDir)PropertySheets/Win32.Debug.vsprops"
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
|
@ -42,29 +37,19 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
UsePrecompiledHeader="0"
|
||||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
|
|
||||||
MinimalRebuild="true"
|
|
||||||
BasicRuntimeChecks="3"
|
|
||||||
RuntimeLibrary="1"
|
|
||||||
WarningLevel="3"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
DebugInformationFormat="3"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
PreprocessorDefinitions="_DEBUG"
|
|
||||||
Culture="3081"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLibrarianTool"
|
Name="VCLibrarianTool"
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCALinkTool"
|
Name="VCALinkTool"
|
||||||
|
@ -74,8 +59,6 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCBscMakeTool"
|
Name="VCBscMakeTool"
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\../../Build/Settings/Debug/Settings.bsc"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCFxCopTool"
|
Name="VCFxCopTool"
|
||||||
|
@ -86,13 +69,8 @@
|
||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
OutputDirectory="$(SolutionDir)bin/$(ConfigurationName)/lib"
|
|
||||||
IntermediateDirectory="$(SolutionDir)build/$(ConfigurationName)/$(ProjectName)"
|
|
||||||
ConfigurationType="4"
|
ConfigurationType="4"
|
||||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
|
InheritedPropertySheets="$(SolutionDir)PropertySheets/Win32.Release.vsprops"
|
||||||
UseOfMFC="0"
|
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
|
||||||
CharacterSet="2"
|
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
|
@ -111,30 +89,19 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="2"
|
UsePrecompiledHeader="0"
|
||||||
InlineFunctionExpansion="1"
|
|
||||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS"
|
|
||||||
StringPooling="true"
|
|
||||||
RuntimeLibrary="0"
|
|
||||||
BufferSecurityCheck="false"
|
|
||||||
EnableFunctionLevelLinking="true"
|
|
||||||
WarningLevel="3"
|
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCManagedResourceCompilerTool"
|
Name="VCManagedResourceCompilerTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCResourceCompilerTool"
|
Name="VCResourceCompilerTool"
|
||||||
PreprocessorDefinitions="NDEBUG"
|
|
||||||
Culture="3081"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreLinkEventTool"
|
Name="VCPreLinkEventTool"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCLibrarianTool"
|
Name="VCLibrarianTool"
|
||||||
SuppressStartupBanner="true"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCALinkTool"
|
Name="VCALinkTool"
|
||||||
|
@ -144,8 +111,6 @@
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCBscMakeTool"
|
Name="VCBscMakeTool"
|
||||||
SuppressStartupBanner="true"
|
|
||||||
OutputFile=".\../../Build/Settings/Release/Settings.bsc"
|
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCFxCopTool"
|
Name="VCFxCopTool"
|
||||||
|
@ -165,22 +130,6 @@
|
||||||
<File
|
<File
|
||||||
RelativePath="Settings.cpp"
|
RelativePath="Settings.cpp"
|
||||||
>
|
>
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
</File>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
|
|
Loading…
Reference in New Issue