Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/MSVC9/untgz.sln
- --- /dev/null Thu Jan 01 00:00:00 1970 +0000
- +++ b/common/windows/nsis/plugins/untgz/MSVC9/untgz.sln Wed Nov 21 10:34:41 2012 +0100
- @@ -0,0 +1,20 @@
- +
- +Microsoft Visual Studio Solution File, Format Version 10.00
- +# Visual Studio 2008
- +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "untgz", "untgz.vcproj", "{85D0D38F-6037-4435-9FFE-96570F86763A}"
- +EndProject
- +Global
- + GlobalSection(SolutionConfigurationPlatforms) = preSolution
- + Debug|Win32 = Debug|Win32
- + Release|Win32 = Release|Win32
- + EndGlobalSection
- + GlobalSection(ProjectConfigurationPlatforms) = postSolution
- + {85D0D38F-6037-4435-9FFE-96570F86763A}.Debug|Win32.ActiveCfg = Debug|Win32
- + {85D0D38F-6037-4435-9FFE-96570F86763A}.Debug|Win32.Build.0 = Debug|Win32
- + {85D0D38F-6037-4435-9FFE-96570F86763A}.Release|Win32.ActiveCfg = Release|Win32
- + {85D0D38F-6037-4435-9FFE-96570F86763A}.Release|Win32.Build.0 = Release|Win32
- + EndGlobalSection
- + GlobalSection(SolutionProperties) = preSolution
- + HideSolutionNode = FALSE
- + EndGlobalSection
- +EndGlobal
- diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/MSVC9/untgz.vcproj
- --- /dev/null Thu Jan 01 00:00:00 1970 +0000
- +++ b/common/windows/nsis/plugins/untgz/MSVC9/untgz.vcproj Wed Nov 21 10:34:41 2012 +0100
- @@ -0,0 +1,625 @@
- +<?xml version="1.0" encoding="Windows-1252"?>
- +<VisualStudioProject
- + ProjectType="Visual C++"
- + Version="9,00"
- + Name="untgz"
- + ProjectGUID="{85D0D38F-6037-4435-9FFE-96570F86763A}"
- + RootNamespace="untgz"
- + TargetFrameworkVersion="131072"
- + >
- + <Platforms>
- + <Platform
- + Name="Win32"
- + />
- + </Platforms>
- + <ToolFiles>
- + </ToolFiles>
- + <Configurations>
- + <Configuration
- + Name="Debug|Win32"
- + OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- + IntermediateDirectory="$(ConfigurationName)"
- + ConfigurationType="2"
- + UseOfMFC="0"
- + ATLMinimizesCRunTimeLibraryUsage="false"
- + CharacterSet="1"
- + >
- + <Tool
- + Name="VCPreBuildEventTool"
- + />
- + <Tool
- + Name="VCCustomBuildTool"
- + />
- + <Tool
- + Name="VCXMLDataGeneratorTool"
- + />
- + <Tool
- + Name="VCWebServiceProxyGeneratorTool"
- + />
- + <Tool
- + Name="VCMIDLTool"
- + PreprocessorDefinitions="_DEBUG"
- + SuppressStartupBanner="true"
- + TargetEnvironment="1"
- + HeaderFileName=""
- + />
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalOptions="/Gs16000"
- + Optimization="0"
- + AdditionalIncludeDirectories="./lzma;./bz2;./zlib"
- + PreprocessorDefinitions="_DEBUG;_WIN32;EXEHEAD;WIN32;_WINDOWS;NSIS_COMPRESS_USE_ZLIB"
- + MinimalRebuild="true"
- + ExceptionHandling="0"
- + RuntimeLibrary="3"
- + BufferSecurityCheck="false"
- + BrowseInformation="1"
- + WarningLevel="3"
- + SuppressStartupBanner="true"
- + DebugInformationFormat="4"
- + OmitDefaultLibName="true"
- + />
- + <Tool
- + Name="VCManagedResourceCompilerTool"
- + />
- + <Tool
- + Name="VCResourceCompilerTool"
- + PreprocessorDefinitions="_DEBUG"
- + Culture="0"
- + />
- + <Tool
- + Name="VCPreLinkEventTool"
- + />
- + <Tool
- + Name="VCLinkerTool"
- + IgnoreImportLibrary="true"
- + AdditionalDependencies="user32.lib"
- + LinkIncremental="2"
- + SuppressStartupBanner="true"
- + IgnoreAllDefaultLibraries="true"
- + GenerateDebugInformation="true"
- + OptimizeForWindows98="0"
- + RandomizedBaseAddress="1"
- + DataExecutionPrevention="0"
- + TargetMachine="1"
- + />
- + <Tool
- + Name="VCALinkTool"
- + />
- + <Tool
- + Name="VCManifestTool"
- + />
- + <Tool
- + Name="VCXDCMakeTool"
- + />
- + <Tool
- + Name="VCBscMakeTool"
- + />
- + <Tool
- + Name="VCFxCopTool"
- + />
- + <Tool
- + Name="VCAppVerifierTool"
- + />
- + <Tool
- + Name="VCPostBuildEventTool"
- + />
- + </Configuration>
- + <Configuration
- + Name="Release|Win32"
- + OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- + IntermediateDirectory="$(ConfigurationName)"
- + ConfigurationType="2"
- + UseOfMFC="0"
- + ATLMinimizesCRunTimeLibraryUsage="false"
- + CharacterSet="1"
- + >
- + <Tool
- + Name="VCPreBuildEventTool"
- + />
- + <Tool
- + Name="VCCustomBuildTool"
- + />
- + <Tool
- + Name="VCXMLDataGeneratorTool"
- + />
- + <Tool
- + Name="VCWebServiceProxyGeneratorTool"
- + />
- + <Tool
- + Name="VCMIDLTool"
- + PreprocessorDefinitions="NDEBUG"
- + SuppressStartupBanner="true"
- + TargetEnvironment="1"
- + HeaderFileName=""
- + />
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalOptions="/Gs16000"
- + Optimization="1"
- + EnableIntrinsicFunctions="true"
- + WholeProgramOptimization="true"
- + AdditionalIncludeDirectories="./lzma;./bz2;./zlib"
- + PreprocessorDefinitions="NDEBUG;_WIN32;EXEHEAD;WIN32;_WINDOWS;NSIS_COMPRESS_USE_ZLIB"
- + RuntimeLibrary="2"
- + BufferSecurityCheck="false"
- + EnableFunctionLevelLinking="true"
- + WarningLevel="3"
- + DebugInformationFormat="3"
- + />
- + <Tool
- + Name="VCManagedResourceCompilerTool"
- + />
- + <Tool
- + Name="VCResourceCompilerTool"
- + PreprocessorDefinitions="NDEBUG"
- + Culture="0"
- + />
- + <Tool
- + Name="VCPreLinkEventTool"
- + />
- + <Tool
- + Name="VCLinkerTool"
- + IgnoreImportLibrary="false"
- + AdditionalDependencies="user32.lib"
- + LinkIncremental="0"
- + SuppressStartupBanner="true"
- + IgnoreAllDefaultLibraries="false"
- + GenerateDebugInformation="true"
- + OptimizeReferences="2"
- + EnableCOMDATFolding="2"
- + OptimizeForWindows98="0"
- + RandomizedBaseAddress="2"
- + DataExecutionPrevention="2"
- + TargetMachine="1"
- + />
- + <Tool
- + Name="VCALinkTool"
- + />
- + <Tool
- + Name="VCManifestTool"
- + />
- + <Tool
- + Name="VCXDCMakeTool"
- + />
- + <Tool
- + Name="VCBscMakeTool"
- + />
- + <Tool
- + Name="VCFxCopTool"
- + />
- + <Tool
- + Name="VCAppVerifierTool"
- + />
- + <Tool
- + Name="VCPostBuildEventTool"
- + />
- + </Configuration>
- + </Configurations>
- + <References>
- + </References>
- + <Files>
- + <Filter
- + Name="Source Files"
- + Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
- + >
- + <File
- + RelativePath="..\zlib\adler32.c"
- + >
- + <FileConfiguration
- + Name="Debug|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + <FileConfiguration
- + Name="Release|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + </File>
- + <File
- + RelativePath="..\bz2\blocksort.c"
- + >
- + </File>
- + <File
- + RelativePath="..\bz2\bzlib.c"
- + >
- + </File>
- + <File
- + RelativePath="..\zlib\crc32.c"
- + >
- + <FileConfiguration
- + Name="Debug|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + <FileConfiguration
- + Name="Release|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + </File>
- + <File
- + RelativePath="..\bz2\crctable.c"
- + >
- + </File>
- + <File
- + RelativePath="..\bz2\decompress.c"
- + >
- + </File>
- + <File
- + RelativePath="..\filetype.cpp"
- + >
- + </File>
- + <File
- + RelativePath="..\zlib\gzio.c"
- + >
- + <FileConfiguration
- + Name="Debug|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + <FileConfiguration
- + Name="Release|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + </File>
- + <File
- + RelativePath="..\bz2\huffman.c"
- + >
- + <FileConfiguration
- + Name="Debug|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + OmitFramePointers="false"
- + SmallerTypeCheck="false"
- + OmitDefaultLibName="true"
- + />
- + </FileConfiguration>
- + </File>
- + <File
- + RelativePath="..\zlib\inffast.c"
- + >
- + <FileConfiguration
- + Name="Debug|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + <FileConfiguration
- + Name="Release|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + </File>
- + <File
- + RelativePath="..\zlib\inflate.c"
- + >
- + <FileConfiguration
- + Name="Debug|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + <FileConfiguration
- + Name="Release|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + </File>
- + <File
- + RelativePath="..\zlib\inftrees.c"
- + >
- + <FileConfiguration
- + Name="Debug|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + <FileConfiguration
- + Name="Release|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + </File>
- + <File
- + RelativePath="..\lzma\lzma.c"
- + >
- + <FileConfiguration
- + Name="Debug|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + <FileConfiguration
- + Name="Release|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + </File>
- + <File
- + RelativePath="..\lzma\LzmaDecode.c"
- + >
- + <FileConfiguration
- + Name="Debug|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + <FileConfiguration
- + Name="Release|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + </File>
- + <File
- + RelativePath="..\miniclib.c"
- + >
- + <FileConfiguration
- + Name="Debug|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + <FileConfiguration
- + Name="Release|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + WholeProgramOptimization="false"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + </File>
- + <File
- + RelativePath="..\nsisUtils.c"
- + >
- + <FileConfiguration
- + Name="Debug|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + <FileConfiguration
- + Name="Release|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + </File>
- + <File
- + RelativePath="..\bz2\randtable.c"
- + >
- + </File>
- + <File
- + RelativePath="..\untar.c"
- + >
- + <FileConfiguration
- + Name="Debug|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + <FileConfiguration
- + Name="Release|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + </File>
- + <File
- + RelativePath="..\untgz.cpp"
- + >
- + <FileConfiguration
- + Name="Debug|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + <FileConfiguration
- + Name="Release|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + </File>
- + <File
- + RelativePath="..\zlib\zutil.c"
- + >
- + <FileConfiguration
- + Name="Debug|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + <FileConfiguration
- + Name="Release|Win32"
- + >
- + <Tool
- + Name="VCCLCompilerTool"
- + AdditionalIncludeDirectories=""
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + </File>
- + </Filter>
- + <Filter
- + Name="Header Files"
- + Filter="h;hpp;hxx;hm;inl"
- + >
- + <File
- + RelativePath="..\bz2\bz2.h"
- + >
- + </File>
- + <File
- + RelativePath="..\bz2\bzlib_private.h"
- + >
- + </File>
- + <File
- + RelativePath="..\zlib\crc32.h"
- + >
- + </File>
- + <File
- + RelativePath="..\zlib\inffast.h"
- + >
- + </File>
- + <File
- + RelativePath="..\zlib\inffixed.h"
- + >
- + </File>
- + <File
- + RelativePath="..\zlib\inflate.h"
- + >
- + </File>
- + <File
- + RelativePath="..\zlib\inftrees.h"
- + >
- + </File>
- + <File
- + RelativePath="..\lzma\lzma.h"
- + >
- + </File>
- + <File
- + RelativePath="..\lzma\LzmaDecode.h"
- + >
- + </File>
- + <File
- + RelativePath="..\miniclib.h"
- + >
- + </File>
- + <File
- + RelativePath="..\nsisUtils.h"
- + >
- + </File>
- + <File
- + RelativePath="..\untar.h"
- + >
- + </File>
- + <File
- + RelativePath="..\zlib\zconf.h"
- + >
- + </File>
- + <File
- + RelativePath="..\zlib\zlib.h"
- + >
- + </File>
- + <File
- + RelativePath="..\zlib\zutil.h"
- + >
- + </File>
- + </Filter>
- + <Filter
- + Name="Resource Files"
- + Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
- + >
- + <File
- + RelativePath="..\untgz.rc"
- + >
- + <FileConfiguration
- + Name="Debug|Win32"
- + >
- + <Tool
- + Name="VCResourceCompilerTool"
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + <FileConfiguration
- + Name="Release|Win32"
- + >
- + <Tool
- + Name="VCResourceCompilerTool"
- + PreprocessorDefinitions=""
- + />
- + </FileConfiguration>
- + </File>
- + </Filter>
- + </Files>
- + <Globals>
- + </Globals>
- +</VisualStudioProject>
- diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/filetype.cpp
- --- a/common/windows/nsis/plugins/untgz/filetype.cpp Wed Nov 21 10:28:12 2012 +0100
- +++ b/common/windows/nsis/plugins/untgz/filetype.cpp Wed Nov 21 10:34:41 2012 +0100
- @@ -14,6 +14,23 @@
- otherwise if 1st byte valid PROPERTY return CM_LZMA else CM_GZ
- */
- +unsigned long getFileSize(const char *fname)
- +{
- + FILE *f = NULL;
- + size_t size = 0;
- +
- + if ((f = fopen(fname, "rb")) != NULL)
- + {
- + fseek(f, 0, SEEK_END); // seek to end of file
- + size = ftell(f); // get current file pointer
- + fseek(f, 0, SEEK_SET);
- +
- + fclose(f);
- + }
- +
- + return static_cast<unsigned long>(size);
- +}
- +
- int getFileType(const char *fname)
- {
- /* read in chunk of data and try to make determination */
- diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/lzma/lzma.c
- --- a/common/windows/nsis/plugins/untgz/lzma/lzma.c Wed Nov 21 10:28:12 2012 +0100
- +++ b/common/windows/nsis/plugins/untgz/lzma/lzma.c Wed Nov 21 10:34:41 2012 +0100
- @@ -1,6 +1,7 @@
- #include "lzma.h"
- #include "../miniclib.h"
- +tmpRead = 0;
- /* !!!USER SUPPLIED!!! */
- /* wrap around whatever you want to send error messages to user, c function */
- @@ -31,6 +32,7 @@
- LZMAFile *b = (LZMAFile *)object;
- *buffer = b->Buffer;
- *size = (SizeT)gzread(b->File, b->Buffer, kInBufferSize);
- + totalRead += *size;
- return LZMA_RESULT_OK;
- }
- @@ -40,7 +42,7 @@
- register long len = gzread(file, data, size);
- if (len != size)
- {
- - PrintMessage("lzma: Can not read input file.");
- + PrintMessage(_T2A("lzma: Can not read input file."));
- return 0;
- }
- return 1;
- @@ -62,11 +64,15 @@
- int lzma_init(gzFile infile, struct LZMAFile **lzmaFile)
- {
- LZMAFile *inBuffer;
- +
- + totalRead = 0;
- +
- *lzmaFile = inBuffer = (LZMAFile *)malloc(sizeof(struct LZMAFile));
- if (inBuffer == NULL) return -1;
- memset(inBuffer, 0, sizeof(LZMAFile));
- inBuffer->File = infile;
- +
- inBuffer->InCallback.Read = LzmaReadCompressed;
- inBuffer->waitEOS = 1;
- @@ -95,7 +101,7 @@
- /* Decode LZMA properties and allocate memory */
- if (LzmaDecodeProperties(&(inBuffer->state.Properties), inBuffer->properties, LZMA_PROPERTIES_SIZE) != LZMA_RESULT_OK)
- {
- - PrintMessage("Incorrect stream properties");
- + PrintMessage(_T2A("Incorrect stream properties"));
- return -1;
- }
- inBuffer->state.Probs = (CProb *)malloc(LzmaGetNumProbs(&(inBuffer->state.Properties)) * sizeof(CProb));
- @@ -122,7 +128,8 @@
- long lzma_read(struct LZMAFile *lzmaFile,
- unsigned char *buffer,
- - unsigned len)
- + unsigned len,
- + unsigned int *bytesRead)
- {
- SizeT outProcessed;
- SizeT outAvail = len;
- @@ -134,9 +141,12 @@
- res = LzmaDecode(&(lzmaFile->state),
- &(lzmaFile->InCallback),
- buffer, outAvail, &outProcessed);
- +
- + *bytesRead = totalRead;
- +
- if (res != 0)
- {
- - PrintMessage("lzma_read: Decoding error (%d)", res);
- + PrintMessage(_T2A("lzma_read: Decoding error (%d)"), res);
- return -1;
- }
- @@ -149,7 +159,7 @@
- {
- if (!lzmaFile->waitEOS && (lzmaFile->outSize != 0 || lzmaFile->outSizeHigh != 0))
- {
- - PrintMessage("lzma_read: Unexpected EOS");
- + PrintMessage(_T2A("lzma_read: Unexpected EOS"));
- return -1;
- }
- }
- diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/lzma/lzma.h
- --- a/common/windows/nsis/plugins/untgz/lzma/lzma.h Wed Nov 21 10:28:12 2012 +0100
- +++ b/common/windows/nsis/plugins/untgz/lzma/lzma.h Wed Nov 21 10:34:41 2012 +0100
- @@ -7,6 +7,8 @@
- typedef void * gzFile;
- int gzread(gzFile file, void * buf, unsigned len);
- +SizeT totalRead;
- +
- /* holds any information needed about stream */
- struct LZMAFile;
- typedef struct LZMAFile LZMAFile;
- @@ -16,6 +18,7 @@
- void lzma_cleanup(struct LZMAFile *lzmaFile);
- long lzma_read(struct LZMAFile *lzmaFile,
- unsigned char *buffer,
- - unsigned len);
- + unsigned len,
- + unsigned int *bytesRead);
- #endif /* _LZMA_H_ */
- diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/miniclib.c
- --- a/common/windows/nsis/plugins/untgz/miniclib.c Wed Nov 21 10:28:12 2012 +0100
- +++ b/common/windows/nsis/plugins/untgz/miniclib.c Wed Nov 21 10:34:41 2012 +0100
- @@ -331,9 +331,9 @@
- unsigned char staticCnvBuffer[1024*2]; /* temp buffer, holds ASCII & UNICODE string after conversion */
- #ifdef UNICODE
- -char * _T2A(unsigned short *wideStr)
- +char * _T2A(void *wideStr)
- {
- - WideCharToMultiByte(CP_ACP, 0, wideStr, -1, staticCnvBuffer, sizeof(staticCnvBuffer), NULL, NULL);
- + WideCharToMultiByte(CP_ACP, 0, (unsigned short*)wideStr, -1, staticCnvBuffer, sizeof(staticCnvBuffer), NULL, NULL);
- return (char *)staticCnvBuffer;
- }
- #endif
- diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/miniclib.h
- --- a/common/windows/nsis/plugins/untgz/miniclib.h Wed Nov 21 10:28:12 2012 +0100
- +++ b/common/windows/nsis/plugins/untgz/miniclib.h Wed Nov 21 10:34:41 2012 +0100
- @@ -33,7 +33,7 @@
- #define _T(x) __T(x)
- #define _TEXT(x) __T(x)
- #endif
- -char * _T2A(unsigned short *str);
- +char * _T2A(void *str);
- #define _A2T(x) _A2U(x)
- #define _tcscat wcscat
- #define _tcscpy wcscpy
- diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/nsisUtils.c
- --- a/common/windows/nsis/plugins/untgz/nsisUtils.c Wed Nov 21 10:28:12 2012 +0100
- +++ b/common/windows/nsis/plugins/untgz/nsisUtils.c Wed Nov 21 10:34:41 2012 +0100
- @@ -29,6 +29,8 @@
- static stack_t **g_stacktop;
- static TCHAR *g_variables;
- +static WPARAM g_beginRange;
- +static WPARAM g_endRange;
- #define EXDLL_INIT() { \
- g_stringsize=string_size; \
- @@ -81,6 +83,7 @@
- {
- g_hwndParent=hwndParent;
- g_hwndList = FindWindowEx(FindWindowEx(g_hwndParent,NULL,_T("#32770"),NULL),NULL,_T("SysListView32"),NULL);
- + g_hwndProgressBar = FindWindowEx(FindWindowEx(g_hwndParent,NULL,_T("#32770"),NULL),NULL,_T("msctls_progress32"),NULL);
- EXDLL_INIT();
- }
- @@ -98,6 +101,19 @@
- DetailPrint(buf);
- }
- +void _cdecl PrintProgressionBar(const unsigned long sofar, const unsigned long total)
- +{
- + unsigned long position = 0;
- + unsigned long range = 0;
- +
- + if (total!=0)
- + position = g_beginRange + MulDiv(g_endRange-g_beginRange, sofar, total);
- + else
- + position = g_endRange;
- +
- + SendMessage(g_hwndProgressBar, PBM_SETPOS, (WPARAM)position, 0);
- +}
- +
- /*
- // cheat a little with argument stack
- // copies current stack item to str, where current top of
- @@ -207,7 +223,13 @@
- }
- /* End KJD's Functions */
- -
- +/* GB Set the limits of the progression for extraction */
- +void InitProgressBarExtremities()
- +{
- + g_beginRange = SendMessage(g_hwndProgressBar, PBM_GETPOS, 0, 0);
- + g_endRange = SendMessage(g_hwndProgressBar, PBM_GETRANGE, 0, 0);
- + g_endRange -= MulDiv(1, g_endRange-g_beginRange, 11); // We left some range to finish the install
- +}
- /*
- The following portions from [based upon] code in ExtractDLL NSIS plugin:
- diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/nsisUtils.h
- --- a/common/windows/nsis/plugins/untgz/nsisUtils.h Wed Nov 21 10:28:12 2012 +0100
- +++ b/common/windows/nsis/plugins/untgz/nsisUtils.h Wed Nov 21 10:34:41 2012 +0100
- @@ -48,11 +48,14 @@
- /* global variables */
- extern HWND g_hwndParent;
- extern HWND g_hwndList;
- +extern HWND g_hwndProgressBar;
- extern unsigned int g_stringsize;
- extern stack_t **g_stacktop;
- extern TCHAR *g_variables;
- +extern WPARAM g_beginRange;
- +extern WPARAM g_endRange;
- /* For page showing plug-ins */
- #define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8)
- @@ -141,6 +144,13 @@
- */
- void _cdecl PrintMessage(const TCHAR *msg, ...);
- +void InitProgressBarExtremities();
- +
- +/*
- + *
- + */
- +void _cdecl PrintProgressionBar(const unsigned long sofar, const unsigned long total);
- +
- /*
- * Sets the status text
- */
- diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/untar.c
- --- a/common/windows/nsis/plugins/untgz/untar.c Wed Nov 21 10:28:12 2012 +0100
- +++ b/common/windows/nsis/plugins/untgz/untar.c Wed Nov 21 10:34:41 2012 +0100
- @@ -1,27 +1,27 @@
- /*
- - * tgz_extract functions based on code within zlib library
- - * No additional copyright added, KJD <jeremyd@computer.org>
- - *
- - * 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.
- - *
- - * untgz.c -- Display contents and/or extract file from
- - * a gzip'd TAR file
- - * written by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
- - * adaptation to Unix by Jean-loup Gailly <jloup@gzip.org>
- - * various fixes by Cosmin Truta <cosmint@cs.ubbcluj.ro>
- +* tgz_extract functions based on code within zlib library
- +* No additional copyright added, KJD <jeremyd@computer.org>
- +*
- +* 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.
- +*
- +* untgz.c -- Display contents and/or extract file from
- +* a gzip'd TAR file
- +* written by "Pedro A. Aranda Guti\irrez" <paag@tid.es>
- +* adaptation to Unix by Jean-loup Gailly <jloup@gzip.org>
- +* various fixes by Cosmin Truta <cosmint@cs.ubbcluj.ro>
- */
- /*
- - For tar format see
- - http://cdrecord.berlios.de/old/private/man/star/star.4.html
- - http://www.mkssoftware.com/docs/man4/tar.4.asp
- - http://www.delorie.com/gnu/docs/tar/tar_toc.html
- +For tar format see
- +http://cdrecord.berlios.de/old/private/man/star/star.4.html
- +http://www.mkssoftware.com/docs/man4/tar.4.asp
- +http://www.delorie.com/gnu/docs/tar/tar_toc.html
- - TODO:
- - without -j there is a security issue as no checking is done to directories
- - change to better support -d option, presently we just chdir there
- +TODO:
- +without -j there is a security issue as no checking is done to directories
- +change to better support -d option, presently we just chdir there
- */
- @@ -41,8 +41,8 @@
- #define DIRTYPE '5' /* directory */
- #define FIFOTYPE '6' /* FIFO special */
- #define CONTTYPE '7' /* reserved, for compatibility with gnu tar,
- - treat as regular file, where it represents
- - a regular file, but saved contiguously on disk */
- +treat as regular file, where it represents
- +a regular file, but saved contiguously on disk */
- /* GNU tar extensions */
- @@ -60,21 +60,21 @@
- unsigned long getoct(char *p,int width)
- {
- - unsigned long result = 0;
- - char c;
- -
- - while (width --)
- - {
- - c = *p++;
- - if (c == ' ') /* ignore padding */
- - continue;
- - if (c == 0) /* ignore padding, but also marks end of string */
- - break;
- - if (c < '0' || c > '7')
- - return result; /* really an error, but we just ignore invalid values */
- - result = result * 8 + (c - '0');
- - }
- - return result;
- + unsigned long result = 0;
- + char c;
- +
- + while (width --)
- + {
- + c = *p++;
- + if (c == ' ') /* ignore padding */
- + continue;
- + if (c == 0) /* ignore padding, but also marks end of string */
- + break;
- + if (c < '0' || c > '7')
- + return result; /* really an error, but we just ignore invalid values */
- + result = result * 8 + (c - '0');
- + }
- + return result;
- }
- /* regular expression matching */
- @@ -83,65 +83,65 @@
- int ExprMatch(char *string,char *expr)
- {
- - while (1)
- - {
- - if (ISSPECIAL(*expr))
- + while (1)
- {
- - if (*expr == '/')
- - {
- - if (*string != '\\' && *string != '/')
- - return 0;
- - string ++; expr++;
- - }
- - else if (*expr == '*')
- - {
- - if (*expr ++ == 0)
- - return 1;
- - while (*++string != *expr)
- - if (*string == 0)
- - return 0;
- - }
- + if (ISSPECIAL(*expr))
- + {
- + if (*expr == '/')
- + {
- + if (*string != '\\' && *string != '/')
- + return 0;
- + string ++; expr++;
- + }
- + else if (*expr == '*')
- + {
- + if (*expr ++ == 0)
- + return 1;
- + while (*++string != *expr)
- + if (*string == 0)
- + return 0;
- + }
- + }
- + else
- + {
- + if (*string != *expr)
- + return 0;
- + if (*expr++ == 0)
- + return 1;
- + string++;
- + }
- }
- - else
- - {
- - if (*string != *expr)
- - return 0;
- - if (*expr++ == 0)
- - return 1;
- - string++;
- - }
- - }
- }
- /* returns 0 on failed checksum, nonzero if probably ok
- - it was noted that some versions of tar compute
- - signed chksums, though unsigned appears to be the
- - standard; chksum is simple sum of all bytes in header
- - as integers (using at least 17 bits) with chksum
- - values treated as ASCII spaces.
- +it was noted that some versions of tar compute
- +signed chksums, though unsigned appears to be the
- +standard; chksum is simple sum of all bytes in header
- +as integers (using at least 17 bits) with chksum
- +values treated as ASCII spaces.
- */
- int valid_checksum(struct tar_header *header)
- {
- - unsigned hdrchksum = (unsigned)getoct(header->chksum,8);
- - signed schksum = 0;
- - unsigned uchksum = 0;
- - int i;
- + unsigned hdrchksum = (unsigned)getoct(header->chksum,8);
- + signed schksum = 0;
- + unsigned uchksum = 0;
- + int i;
- - for (i=0; i < sizeof(struct tar_header); i++)
- - {
- - unsigned char val = ((unsigned char *)header)[i];
- - if ((i >= 148) && (i < 156)) /* chksum */
- - {
- - val = ' ';
- - }
- - schksum += (signed char)val;
- - uchksum += val;
- - }
- + for (i=0; i < sizeof(struct tar_header); i++)
- + {
- + unsigned char val = ((unsigned char *)header)[i];
- + if ((i >= 148) && (i < 156)) /* chksum */
- + {
- + val = ' ';
- + }
- + schksum += (signed char)val;
- + uchksum += val;
- + }
- - if (hdrchksum == uchksum) return 1;
- - if ((int)hdrchksum == schksum) return 2;
- - return 0;
- + if (hdrchksum == uchksum) return 1;
- + if ((int)hdrchksum == schksum) return 2;
- + return 0;
- }
- @@ -154,46 +154,46 @@
- int makedir (char *newdir)
- {
- - char *buffer = strdup(newdir);
- - char *p;
- - int len = strlen(buffer);
- -
- - if (len <= 0) {
- - free(buffer);
- - return 0;
- - }
- - if (buffer[len-1] == '/') {
- - buffer[len-1] = '\0';
- - }
- - if (CreateDirectoryA(buffer, NULL) != 0)
- - {
- - free(buffer);
- - return 1;
- - }
- + char *buffer = strdup(newdir);
- + char *p;
- + int len = strlen(buffer);
- - p = buffer+1;
- - while (1)
- - {
- - char hold;
- -
- - while(*p && *p != '\\' && *p != '/')
- - p++;
- - hold = *p;
- - *p = 0;
- - //if ((mkdir(buffer, 0775) == -1) && (errno == ENOENT /* != EEXIST */))
- - if (!CreateDirectoryA(buffer, NULL) && !((GetLastError()==ERROR_FILE_EXISTS) || (GetLastError()==ERROR_ALREADY_EXISTS)) )
- - {
- - // fprintf(stderr,"Unable to create directory %s\n", buffer);
- - PrintMessage(_T("Unable to create directory %s\n"), _A2T(buffer));
- - free(buffer);
- - return 0;
- - }
- - if (hold == 0)
- - break;
- - *p++ = hold;
- - }
- - free(buffer);
- - return 1;
- + if (len <= 0) {
- + free(buffer);
- + return 0;
- + }
- + if (buffer[len-1] == '/') {
- + buffer[len-1] = '\0';
- + }
- + if (CreateDirectoryA(buffer, NULL) != 0)
- + {
- + free(buffer);
- + return 1;
- + }
- +
- + p = buffer+1;
- + while (1)
- + {
- + char hold;
- +
- + while(*p && *p != '\\' && *p != '/')
- + p++;
- + hold = *p;
- + *p = 0;
- + //if ((mkdir(buffer, 0775) == -1) && (errno == ENOENT /* != EEXIST */))
- + if (!CreateDirectoryA(buffer, NULL) && !((GetLastError()==ERROR_FILE_EXISTS) || (GetLastError()==ERROR_ALREADY_EXISTS)) )
- + {
- + // fprintf(stderr,"Unable to create directory %s\n", buffer);
- + PrintMessage(_T("Unable to create directory %s\n"), _A2T(buffer));
- + free(buffer);
- + return 0;
- + }
- + if (hold == 0)
- + break;
- + *p++ = hold;
- + }
- + free(buffer);
- + return 1;
- }
- @@ -219,34 +219,34 @@
- /* NOTE: This should be modified to perform whatever steps
- - deemed necessary to make embedded paths safe prior to
- - creating directory or file of given [path]filename.
- - Must modify fname in place, always leaving either
- - same or smaller strlen than current string.
- - Current version (if not #defined out) removes any
- - leading parent (..) or root (/)(\) references.
- +deemed necessary to make embedded paths safe prior to
- +creating directory or file of given [path]filename.
- +Must modify fname in place, always leaving either
- +same or smaller strlen than current string.
- +Current version (if not #defined out) removes any
- +leading parent (..) or root (/)(\) references.
- */
- void safetyStrip(char * fname)
- {
- #if 0
- - /* strip root from path */
- - if ((*fname == '/') || (*fname == '\\'))
- - {
- - MoveMemory(fname, fname+1, strlen(fname+1) + 1 );
- - }
- + /* strip root from path */
- + if ((*fname == '/') || (*fname == '\\'))
- + {
- + MoveMemory(fname, fname+1, strlen(fname+1) + 1 );
- + }
- - /* now strip leading ../ */
- - while ((*fname == '.') && (*(fname+1) == '.') && ((*(fname+2) == '/') || (*(fname+2) == '\\')) )
- - {
- - MoveMemory(fname, fname+3, strlen(fname+3) + 1 );
- - }
- + /* now strip leading ../ */
- + while ((*fname == '.') && (*(fname+1) == '.') && ((*(fname+2) == '/') || (*(fname+2) == '\\')) )
- + {
- + MoveMemory(fname, fname+3, strlen(fname+3) + 1 );
- + }
- #endif
- }
- /* combines elements from tar header to produce
- - * full [long] filename; prefix + [/] + name
- - */
- +* full [long] filename; prefix + [/] + name
- +*/
- void getFullName(union tar_buffer *buffer, char *fname)
- {
- int len = 0;
- @@ -274,60 +274,60 @@
- /* returns a pointer to a static buffer
- - * containing fname after removing all but
- - * path_sep_cnt path separators
- - * if there are less than path_sep_cnt
- - * separators then all will still be there.
- - */
- +* containing fname after removing all but
- +* path_sep_cnt path separators
- +* if there are less than path_sep_cnt
- +* separators then all will still be there.
- +*/
- char * stripPath(int path_sep_cnt, char *fname)
- {
- - static char buffer[1024];
- - char *fname_use = fname + strlen(fname);
- - register int i=path_sep_cnt;
- - do
- - {
- - if ( (*fname_use == '/') || (*fname_use == '\\') )
- - {
- - i--;
- - if (i < 0) fname_use++;
- - else fname_use--;
- - }
- - else
- - fname_use--;
- - } while ((i >= 0) && (fname_use > fname));
- -
- - strcpy(buffer, fname_use);
- - return buffer;
- + static char buffer[1024];
- + char *fname_use = fname + strlen(fname);
- + register int i=path_sep_cnt;
- + do
- + {
- + if ( (*fname_use == '/') || (*fname_use == '\\') )
- + {
- + i--;
- + if (i < 0) fname_use++;
- + else fname_use--;
- + }
- + else
- + fname_use--;
- + } while ((i >= 0) && (fname_use > fname));
- +
- + strcpy(buffer, fname_use);
- + return buffer;
- }
- /* returns 1 if fname in list else return 0
- - * returns 0 if list is NULL or cnt is < 0
- - */
- +* returns 0 if list is NULL or cnt is < 0
- +*/
- int matchname (char *fname, int cnt, char *list[], int junkPaths)
- {
- - register char *t;
- - int i;
- - int path_sep;
- + register char *t;
- + int i;
- + int path_sep;
- - /* if nothing to compare with then return failure */
- - if ((list == NULL) || (cnt <= 0))
- - return 0;
- + /* if nothing to compare with then return failure */
- + if ((list == NULL) || (cnt <= 0))
- + return 0;
- - for (i = 0; i < cnt; i++)
- - {
- - /* get count of path components in current filelist entry */
- - path_sep = 0;
- - if (!junkPaths)
- + for (i = 0; i < cnt; i++)
- {
- - for(t = list[i]; *t != '\0'; t++)
- - if ((*t == '/') || (*t == '\\'))
- - path_sep++;
- + /* get count of path components in current filelist entry */
- + path_sep = 0;
- + if (!junkPaths)
- + {
- + for(t = list[i]; *t != '\0'; t++)
- + if ((*t == '/') || (*t == '\\'))
- + path_sep++;
- + }
- + if (ExprMatch(stripPath(path_sep, fname), list[i]))
- + return 1;
- }
- - if (ExprMatch(stripPath(path_sep, fname), list[i]))
- - return 1;
- - }
- - return 0; /* no match */
- + return 0; /* no match */
- }
- @@ -341,25 +341,25 @@
- void cnv_tar2win_time(time_t tartime, FILETIME *ftm)
- {
- #ifdef HAS_LIBC_CAL_FUNCS
- - FILETIME ftLocal;
- - SYSTEMTIME st;
- - struct tm localt;
- -
- - localt = *localtime(&tartime);
- -
- - st.wYear = (WORD)localt.tm_year+1900;
- - st.wMonth = (WORD)localt.tm_mon+1; /* 1 based, not 0 based */
- - st.wDayOfWeek = (WORD)localt.tm_wday;
- - st.wDay = (WORD)localt.tm_mday;
- - st.wHour = (WORD)localt.tm_hour;
- - st.wMinute = (WORD)localt.tm_min;
- - st.wSecond = (WORD)localt.tm_sec;
- - st.wMilliseconds = 0;
- - SystemTimeToFileTime(&st,&ftLocal);
- - LocalFileTimeToFileTime(&ftLocal,ftm);
- + FILETIME ftLocal;
- + SYSTEMTIME st;
- + struct tm localt;
- +
- + localt = *localtime(&tartime);
- +
- + st.wYear = (WORD)localt.tm_year+1900;
- + st.wMonth = (WORD)localt.tm_mon+1; /* 1 based, not 0 based */
- + st.wDayOfWeek = (WORD)localt.tm_wday;
- + st.wDay = (WORD)localt.tm_mday;
- + st.wHour = (WORD)localt.tm_hour;
- + st.wMinute = (WORD)localt.tm_min;
- + st.wSecond = (WORD)localt.tm_sec;
- + st.wMilliseconds = 0;
- + SystemTimeToFileTime(&st,&ftLocal);
- + LocalFileTimeToFileTime(&ftLocal,ftm);
- #else
- // avoid casts further below
- - LONGLONG *t = (LONGLONG *)ftm;
- + LONGLONG *t = (LONGLONG *)ftm;
- // tartime == number of seconds since midnight Jan 1 1970 (00:00:00)
- // convert to equivalent 100 nanosecond intervals
- @@ -384,389 +384,399 @@
- gzFile infile;
- /* Initialize decompression library (if needed)
- - 0=success, nonzero means error during initialization
- - */
- +0=success, nonzero means error during initialization
- +*/
- int cm_init(gzFile in, int cm)
- {
- - infile = in; /* save gzFile for reading/cleanup */
- + infile = in; /* save gzFile for reading/cleanup */
- - switch (cm)
- - {
- + switch (cm)
- + {
- #ifdef ENABLE_BZ2
- - case CM_BZ2:
- - bzfile = BZ2_bzReadOpen(&bzerror, in, 0, 0, NULL, 0);
- - return bzerror;
- + case CM_BZ2:
- + bzfile = BZ2_bzReadOpen(&bzerror, in, 0, 0, NULL, 0);
- + return bzerror;
- #endif
- #ifdef ENABLE_LZMA
- - case CM_LZMA:
- - return lzma_init(in, &lzmaFile);
- + case CM_LZMA:
- + return lzma_init(in, &lzmaFile);
- #endif
- - default: /* CM_NONE, CM_GZ */
- - return 0; /* success */
- - }
- + default: /* CM_NONE, CM_GZ */
- + return 0; /* success */
- + }
- }
- /* properly cleanup any resources decompression library allocated
- - */
- +*/
- void cm_cleanup(int cm)
- {
- - switch (cm)
- - {
- + switch (cm)
- + {
- #ifdef ENABLE_BZ2
- - case CM_BZ2:
- - BZ2_bzReadClose(&bzerror, bzfile);
- - break;
- + case CM_BZ2:
- + BZ2_bzReadClose(&bzerror, bzfile);
- + break;
- #endif
- #ifdef ENABLE_LZMA
- - case CM_LZMA:
- - lzma_cleanup(lzmaFile);
- - break;
- + case CM_LZMA:
- + lzma_cleanup(lzmaFile);
- + break;
- #endif
- - default: /* CM_NONE, CM_GZ */
- - break;
- - }
- + default: /* CM_NONE, CM_GZ */
- + break;
- + }
- - /* close the input stream */
- - if (gzclose(infile) != Z_OK)
- - {
- - PrintMessage(_T("failed gzclose"));
- - /* return -1; */
- - }
- + /* close the input stream */
- + if (gzclose(infile) != Z_OK)
- + {
- + PrintMessage(_T("failed gzclose"));
- + /* return -1; */
- + }
- }
- /* Reads in a single TAR block
- - */
- -long readBlock(int cm, void *buffer)
- +*/
- +long readBlock(int cm, void *buffer, unsigned int *bytesBlockRead)
- {
- - long len = -1;
- - switch (cm)
- - {
- + long len = -1;
- + unsigned int bytesRead = 0;
- + switch (cm)
- + {
- #ifdef ENABLE_BZ2
- - case CM_BZ2:
- - len = BZ2_bzRead(&bzerror, bzfile, buffer, BLOCKSIZE);
- - break;
- + case CM_BZ2:
- + len = BZ2_bzRead(&bzerror, bzfile, buffer, BLOCKSIZE);
- + break;
- #endif
- #ifdef ENABLE_LZMA
- - case CM_LZMA:
- - len = lzma_read(lzmaFile, buffer, BLOCKSIZE);
- - break;
- + case CM_LZMA:
- + len = lzma_read(lzmaFile, buffer, BLOCKSIZE, &bytesRead);
- + break;
- #endif
- - default: /* CM_NONE, CM_GZ */
- - len = gzread(infile, buffer, BLOCKSIZE);
- - break;
- - }
- + default: /* CM_NONE, CM_GZ */
- + len = gzread(infile, buffer, BLOCKSIZE);
- + break;
- + }
- - /* check for read errors and abort */
- - if (len < 0)
- - {
- - PrintMessage(_T("gzread: error decompressing"));
- - cm_cleanup(cm);
- - return -1;
- - }
- - /*
- - * Always expect complete blocks to process
- - * the tar information.
- - */
- - if (len != BLOCKSIZE)
- - {
- - PrintMessage(_T("gzread: incomplete block read"));
- - cm_cleanup(cm);
- - return -1;
- - }
- + /* check for read errors and abort */
- + if (len < 0)
- + {
- + PrintMessage(_T("gzread: error decompressing"));
- + cm_cleanup(cm);
- + return -1;
- + }
- + /*
- + * Always expect complete blocks to process
- + * the tar information.
- + */
- + if (len != BLOCKSIZE)
- + {
- + PrintMessage(_T("gzread: incomplete block read"));
- + cm_cleanup(cm);
- + return -1;
- + }
- - return len; /* success */
- + *bytesBlockRead = bytesRead;
- + return len; /* success */
- }
- /* Tar file extraction
- - * gzFile in, handle of input tarball opened with gzopen
- - * int cm, compressionMethod
- - * int junkPaths, nonzero indicates to ignore stored path (don't create directories)
- - * enum KeepMode keep, indicates to perform if file exists
- - * int iCnt, char *iList[], argv style list of files to extract, {0,NULL} for all
- - * int xCnt, char *xList[], argv style list of files NOT to extract, {0,NULL} for none
- - * int failOnHardLinks, if nonzero then will treat failure to create a hard link same as
- - * failure to create a regular file, 0 prints a warning if fails - note that hardlinks
- - * will always fail on Windows prior to NT 5 (Win 2000) or later and non NTFS file systems.
- - *
- - * returns 0 (or positive value) on success
- - * returns negative value on error, where
- - * -1 means error reading from tarball
- - * -2 means error extracting file from tarball
- - * -3 means error creating hard link
- - */
- -int tgz_extract(gzFile in, int cm, int junkPaths, enum KeepMode keep, int iCnt, char *iList[], int xCnt, char *xList[], int failOnHardLinks)
- +* gzFile in, handle of input tarball opened with gzopen
- +* int cm, compressionMethod
- +* int junkPaths, nonzero indicates to ignore stored path (don't create directories)
- +* enum KeepMode keep, indicates to perform if file exists
- +* int iCnt, char *iList[], argv style list of files to extract, {0,NULL} for all
- +* int xCnt, char *xList[], argv style list of files NOT to extract, {0,NULL} for none
- +* int failOnHardLinks, if nonzero then will treat failure to create a hard link same as
- +* failure to create a regular file, 0 prints a warning if fails - note that hardlinks
- +* will always fail on Windows prior to NT 5 (Win 2000) or later and non NTFS file systems.
- +*
- +* returns 0 (or positive value) on success
- +* returns negative value on error, where
- +* -1 means error reading from tarball
- +* -2 means error extracting file from tarball
- +* -3 means error creating hard link
- +*/
- +int tgz_extract(gzFile in, int cm, int junkPaths, enum KeepMode keep, unsigned long totalSize, int iCnt, char *iList[], int xCnt, char *xList[], int failOnHardLinks)
- {
- - int getheader = 1; /* assume initial input has a tar header */
- - HANDLE outfile = INVALID_HANDLE_VALUE;
- + int getheader = 1; /* assume initial input has a tar header */
- + HANDLE outfile = INVALID_HANDLE_VALUE;
- - union tar_buffer buffer;
- - unsigned long remaining;
- - char fname[BLOCKSIZE]; /* must be >= BLOCKSIZE bytes */
- - time_t tartime;
- + union tar_buffer buffer;
- + unsigned long remaining;
- + char fname[BLOCKSIZE]; /* must be >= BLOCKSIZE bytes */
- + time_t tartime;
- + long bytesRead = 0;
- + unsigned int bytesReadSofar = 0;
- + unsigned int bytesReadThisTime = 0;
- - /* do any prep work for extracting from compressed TAR file */
- - if (cm_init(in, cm))
- - {
- - PrintMessage(_T("tgz_extract: unable to initialize decompression method."));
- - cm_cleanup(cm);
- - return -1;
- - }
- -
- - while (1)
- - {
- - if (readBlock(cm, &buffer) < 0) return -1;
- -
- - /*
- - * If we have to get a tar header
- - */
- - if (getheader >= 1)
- - {
- - /*
- - * if we met the end of the tar
- - * or the end-of-tar block,
- - * we are done
- - */
- - if (/* (len == 0) || */ (buffer.header.name[0]== 0)) break;
- + InitProgressBarExtremities();
- - /* compute and check header checksum, support signed or unsigned */
- - if (!valid_checksum(&(buffer.header)))
- - {
- - PrintMessage(_T("tgz_extract: bad header checksum"));
- - cm_cleanup(cm);
- - return -1;
- - }
- + /* do any prep work for extracting from compressed TAR file */
- + if (cm_init(in, cm))
- + {
- + PrintMessage(_T("tgz_extract: unable to initialize decompression method."));
- + cm_cleanup(cm);
- + return -1;
- + }
- - /* store time, so we can set the timestamp on files */
- - tartime = (time_t)getoct(buffer.header.mtime,12);
- + while (1)
- + {
- + if ( (bytesRead = readBlock(cm, &buffer, &bytesReadThisTime)) < 0)
- + return -1;
- - /* copy over filename chunk from header, avoiding overruns */
- - if (getheader == 1) /* use normal (short or posix long) filename from header */
- - {
- - /* NOTE: prepends any prefix, including separator, and ensures terminated */
- - getFullName(&buffer, fname);
- - }
- - else /* use (GNU) long filename that preceeded this header */
- - {
- + bytesReadSofar = bytesReadThisTime;
- + /*
- + * If we have to get a tar header
- + */
- + if (getheader >= 1)
- + {
- + /*
- + * if we met the end of the tar
- + * or the end-of-tar block,
- + * we are done
- + */
- + if (/* (len == 0) || */ (buffer.header.name[0]== 0)) break;
- +
- + /* compute and check header checksum, support signed or unsigned */
- + if (!valid_checksum(&(buffer.header)))
- + {
- + PrintMessage(_T("tgz_extract: bad header checksum"));
- + cm_cleanup(cm);
- + return -1;
- + }
- +
- + /* store time, so we can set the timestamp on files */
- + tartime = (time_t)getoct(buffer.header.mtime,12);
- +
- + /* copy over filename chunk from header, avoiding overruns */
- + if (getheader == 1) /* use normal (short or posix long) filename from header */
- + {
- + /* NOTE: prepends any prefix, including separator, and ensures terminated */
- + getFullName(&buffer, fname);
- + }
- + else /* use (GNU) long filename that preceeded this header */
- + {
- #if 0
- - /* if (strncmp(fname,buffer.header.name,SHORTNAMESIZE-1) != 0) */
- - char fs[SHORTNAMESIZE]; /* force strings to same max len, then compare */
- - lstrcpyn(fs, fname, SHORTNAMESIZE);
- - fs[SHORTNAMESIZE-1] = '\0';
- - buffer.header.name[SHORTNAMESIZE-1] = '\0';
- - if (lstrcmp(fs, buffer.header.name) != 0)
- - {
- - PrintMessage(_T("tgz_extract: mismatched long filename"));
- - cm_cleanup(cm);
- - return -1;
- - }
- + /* if (strncmp(fname,buffer.header.name,SHORTNAMESIZE-1) != 0) */
- + char fs[SHORTNAMESIZE]; /* force strings to same max len, then compare */
- + lstrcpyn(fs, fname, SHORTNAMESIZE);
- + fs[SHORTNAMESIZE-1] = '\0';
- + buffer.header.name[SHORTNAMESIZE-1] = '\0';
- + if (lstrcmp(fs, buffer.header.name) != 0)
- + {
- + PrintMessage(_T("tgz_extract: mismatched long filename"));
- + cm_cleanup(cm);
- + return -1;
- + }
- #else
- - PrintMessage(_T("tgz_extract: using GNU long filename [%s]"), _A2T(fname));
- + PrintMessage(_T("tgz_extract: using GNU long filename [%s]"), _A2T(fname));
- #endif
- - }
- - /* LogMessage("buffer.header.name is:"); LogMessage(fname); */
- + }
- + /* LogMessage("buffer.header.name is:"); LogMessage(fname); */
- - switch (buffer.header.typeflag)
- - {
- - case DIRTYPE:
- - dirEntry:
- - if (!junkPaths)
- - {
- - safetyStrip(fname);
- - makedir(fname);
- - }
- - break;
- - case LNKTYPE: /* hard link */
- - case CONTTYPE: /* contiguous file, for compatibility treat as normal */
- - case REGTYPE:
- - case AREGTYPE:
- - /* Note: a file ending with a / may actually be a BSD tar directory entry */
- - if (fname[strlen(fname)-1] == '/')
- - goto dirEntry;
- + switch (buffer.header.typeflag)
- + {
- + case DIRTYPE:
- +dirEntry:
- + if (!junkPaths)
- + {
- + safetyStrip(fname);
- + makedir(fname);
- + }
- + break;
- + case LNKTYPE: /* hard link */
- + case CONTTYPE: /* contiguous file, for compatibility treat as normal */
- + case REGTYPE:
- + case AREGTYPE:
- + /* Note: a file ending with a / may actually be a BSD tar directory entry */
- + if (fname[strlen(fname)-1] == '/')
- + goto dirEntry;
- - remaining = getoct(buffer.header.size,12);
- - if ( /* add (remaining > 0) && to ignore 0 zero byte files */
- - ( (iList == NULL) || (matchname(fname, iCnt, iList, junkPaths)) ) &&
- - (!matchname(fname, xCnt, xList, junkPaths))
- - )
- - {
- - if (!junkPaths) /* if we want to use paths as stored */
- + remaining = getoct(buffer.header.size,12);
- + if ( /* add (remaining > 0) && to ignore 0 zero byte files */
- + ( (iList == NULL) || (matchname(fname, iCnt, iList, junkPaths)) ) &&
- + (!matchname(fname, xCnt, xList, junkPaths))
- + )
- + {
- + if (!junkPaths) /* if we want to use paths as stored */
- {
- - /* try creating directory */
- - char *p = strrchr(fname, '/');
- - if (p != NULL)
- - {
- - *p = '\0';
- - makedir(fname);
- - *p = '/';
- - }
- + /* try creating directory */
- + char *p = strrchr(fname, '/');
- + if (p != NULL)
- + {
- + *p = '\0';
- + makedir(fname);
- + *p = '/';
- + }
- }
- - else
- + else
- {
- - /* try ignoring directory */
- - char *p = strrchr(fname, '/');
- - if (p != NULL)
- - {
- - /* be sure terminating '\0' is copied and */
- - /* use ansi memcpy equivalent that handles overlapping regions */
- - MoveMemory(fname, p+1, strlen(p+1) + 1 );
- - }
- - }
- - if (*fname) /* if after stripping path a fname still exists */
- - {
- - /* Attempt to open the output file and report action taken to user */
- - const TCHAR szERRMsg[] = _T("Error: Could not create file "),
- - szSUCMsg[] = _T("Writing "),
- - szSKPMsg[] = _T("Skipping ");
- - const TCHAR * szMsg = szSUCMsg;
- + /* try ignoring directory */
- + char *p = strrchr(fname, '/');
- + if (p != NULL)
- + {
- + /* be sure terminating '\0' is copied and */
- + /* use ansi memcpy equivalent that handles overlapping regions */
- + MoveMemory(fname, p+1, strlen(p+1) + 1 );
- + }
- + }
- + if (*fname) /* if after stripping path a fname still exists */
- + {
- + /* Attempt to open the output file and report action taken to user */
- + const TCHAR szERRMsg[] = _T("Error: Could not create file "),
- + szSUCMsg[] = _T("Writing "),
- + szSKPMsg[] = _T("Skipping ");
- + const TCHAR * szMsg = szSUCMsg;
- - safetyStrip(fname);
- + safetyStrip(fname);
- - if (buffer.header.typeflag == LNKTYPE)
- - {
- - outfile = INVALID_HANDLE_VALUE;
- - /* create a hardlink if possible, else produce just a warning unless failOnHardLinks is true */
- - if (!MakeHardLink(fname, buffer.header.linkname))
- - {
- - PrintMessage(_T("Warning: unable to create hard link %s [%d]"), _A2T(fname), GetLastError());
- - if (failOnHardLinks)
- + if (buffer.header.typeflag == LNKTYPE)
- {
- - cm_cleanup(cm);
- - return -3;
- + outfile = INVALID_HANDLE_VALUE;
- + /* create a hardlink if possible, else produce just a warning unless failOnHardLinks is true */
- + if (!MakeHardLink(fname, buffer.header.linkname))
- + {
- + PrintMessage(_T("Warning: unable to create hard link %s [%d]"), _A2T(fname), GetLastError());
- + if (failOnHardLinks)
- + {
- + cm_cleanup(cm);
- + return -3;
- + }
- + }
- + else
- + {
- + outfile = CreateFileA(fname,GENERIC_WRITE,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
- + goto setTimeAndCloseFile;
- + }
- + } else
- + {
- + /* Open the file for writing mode, creating if doesn't exist and truncating if exists and overwrite mode */
- + outfile = CreateFileA(fname,GENERIC_WRITE,FILE_SHARE_READ,NULL,(keep==OVERWRITE)?CREATE_ALWAYS:CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL);
- +
- + /* failed to open file, either valid error (like open) or it already exists and in a keep mode */
- + if (outfile == INVALID_HANDLE_VALUE)
- + {
- + /* if skip existing or only update existing and failed to open becauses exists */
- + if ((keep!=OVERWRITE) && (GetLastError()==ERROR_FILE_EXISTS))
- + {
- + /* assume skipping initially (mode==SKIP or ==UPDATE with existing file newer) */
- + szMsg = szSKPMsg; /* and update output message accordingly */
- +
- + /* if in update mode, check filetimes and reopen in overwrite mode */
- + if (keep == UPDATE)
- + {
- + FILETIME ftm_a;
- + HANDLE h;
- + WIN32_FIND_DATAA ffData;
- +
- + cnv_tar2win_time(tartime, &ftm_a); /* archive file time */
- + h = FindFirstFileA(fname, &ffData); /* existing file time */
- +
- + if (h!=INVALID_HANDLE_VALUE)
- + FindClose(h); /* cleanup search handle */
- + else
- + goto ERR_OPENING;
- +
- + /* compare date+times, is one in tarball newer? */
- + if (*((LONGLONG *)&ftm_a) > *((LONGLONG *)&(ffData.ftLastWriteTime)))
- + {
- + outfile = CreateFileA(fname,GENERIC_WRITE,FILE_SHARE_READ,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
- + if (outfile == INVALID_HANDLE_VALUE) goto ERR_OPENING;
- + szMsg = szSUCMsg;
- + }
- + }
- + }
- + else /* in overwrite mode or failed for some other error than exists */
- + {
- +ERR_OPENING:
- + PrintMessage(_T("%s%s [%d]"), szERRMsg, _A2T(fname), GetLastError());
- + cm_cleanup(cm);
- + return -2;
- + }
- + }
- +
- + /* Inform user of current extraction action (writing, skipping file XYZ) */
- + PrintMessage(_T("%s%s"), szMsg, _A2T(fname));
- + PrintProgressionBar(bytesReadSofar, totalSize); // Ajout de GB
- }
- }
- - else
- + }
- + else
- + outfile = INVALID_HANDLE_VALUE;
- +
- + /*
- + * could have no contents, in which case we close the file and set the times
- + */
- + if (remaining > 0)
- + getheader = 0;
- + else
- + {
- +setTimeAndCloseFile:
- + getheader = 1;
- + if (outfile != INVALID_HANDLE_VALUE)
- {
- - outfile = CreateFileA(fname,GENERIC_WRITE,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
- - goto setTimeAndCloseFile;
- + FILETIME ftm;
- +
- + cnv_tar2win_time(tartime, &ftm);
- + SetFileTime(outfile,&ftm,NULL,&ftm);
- + CloseHandle(outfile);
- + outfile = INVALID_HANDLE_VALUE;
- }
- - } else
- + }
- +
- + break;
- + case GNUTYPE_LONGLINK:
- + case GNUTYPE_LONGNAME:
- {
- - /* Open the file for writing mode, creating if doesn't exist and truncating if exists and overwrite mode */
- - outfile = CreateFileA(fname,GENERIC_WRITE,FILE_SHARE_READ,NULL,(keep==OVERWRITE)?CREATE_ALWAYS:CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL);
- + remaining = getoct(buffer.header.size,12);
- + if (readBlock(cm, fname, &bytesReadThisTime) < 0) return -1;
- + fname[BLOCKSIZE-1] = '\0';
- + if ((remaining >= BLOCKSIZE) || ((unsigned)strlen(fname) > remaining))
- + {
- + PrintMessage(_T("tgz_extract: invalid long name"));
- + cm_cleanup(cm);
- + return -1;
- + }
- + getheader = 2;
- + break;
- + }
- + default:
- + /*
- + if (action == TGZ_LIST)
- + printf(" %s <---> %s\n",strtime(&tartime),fname);
- + */
- + break;
- + }
- + }
- + else /* (getheader == 0) */
- + {
- + unsigned int bytes = (remaining > BLOCKSIZE) ? BLOCKSIZE : remaining;
- + unsigned long bwritten;
- - /* failed to open file, either valid error (like open) or it already exists and in a keep mode */
- - if (outfile == INVALID_HANDLE_VALUE)
- - {
- - /* if skip existing or only update existing and failed to open becauses exists */
- - if ((keep!=OVERWRITE) && (GetLastError()==ERROR_FILE_EXISTS))
- - {
- - /* assume skipping initially (mode==SKIP or ==UPDATE with existing file newer) */
- - szMsg = szSKPMsg; /* and update output message accordingly */
- + if (outfile != INVALID_HANDLE_VALUE)
- + {
- + WriteFile(outfile,buffer.buffer,bytes,&bwritten,NULL);
- + if (bwritten != bytes)
- + {
- + PrintMessage(_T("Error: write failed for %s"), _A2T(fname));
- + CloseHandle(outfile);
- + DeleteFileA(fname);
- - /* if in update mode, check filetimes and reopen in overwrite mode */
- - if (keep == UPDATE)
- - {
- - FILETIME ftm_a;
- - HANDLE h;
- - WIN32_FIND_DATAA ffData;
- -
- - cnv_tar2win_time(tartime, &ftm_a); /* archive file time */
- - h = FindFirstFileA(fname, &ffData); /* existing file time */
- + cm_cleanup(cm);
- + return -2;
- + }
- + }
- + remaining -= bytes;
- + if (remaining == 0) goto setTimeAndCloseFile;
- + }
- + } /* while(1) */
- - if (h!=INVALID_HANDLE_VALUE)
- - FindClose(h); /* cleanup search handle */
- - else
- - goto ERR_OPENING;
- + cm_cleanup(cm);
- - /* compare date+times, is one in tarball newer? */
- - if (*((LONGLONG *)&ftm_a) > *((LONGLONG *)&(ffData.ftLastWriteTime)))
- - {
- - outfile = CreateFileA(fname,GENERIC_WRITE,FILE_SHARE_READ,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
- - if (outfile == INVALID_HANDLE_VALUE) goto ERR_OPENING;
- - szMsg = szSUCMsg;
- - }
- - }
- - }
- - else /* in overwrite mode or failed for some other error than exists */
- - {
- - ERR_OPENING:
- - PrintMessage(_T("%s%s [%d]"), szERRMsg, _A2T(fname), GetLastError());
- - cm_cleanup(cm);
- - return -2;
- - }
- - }
- -
- - /* Inform user of current extraction action (writing, skipping file XYZ) */
- - PrintMessage(_T("%s%s"), szMsg, _A2T(fname));
- - }
- - }
- - }
- - else
- - outfile = INVALID_HANDLE_VALUE;
- -
- - /*
- - * could have no contents, in which case we close the file and set the times
- - */
- - if (remaining > 0)
- - getheader = 0;
- - else
- - {
- - setTimeAndCloseFile:
- - getheader = 1;
- - if (outfile != INVALID_HANDLE_VALUE)
- - {
- - FILETIME ftm;
- -
- - cnv_tar2win_time(tartime, &ftm);
- - SetFileTime(outfile,&ftm,NULL,&ftm);
- - CloseHandle(outfile);
- - outfile = INVALID_HANDLE_VALUE;
- - }
- - }
- -
- - break;
- - case GNUTYPE_LONGLINK:
- - case GNUTYPE_LONGNAME:
- - {
- - remaining = getoct(buffer.header.size,12);
- - if (readBlock(cm, fname) < 0) return -1;
- - fname[BLOCKSIZE-1] = '\0';
- - if ((remaining >= BLOCKSIZE) || ((unsigned)strlen(fname) > remaining))
- - {
- - PrintMessage(_T("tgz_extract: invalid long name"));
- - cm_cleanup(cm);
- - return -1;
- - }
- - getheader = 2;
- - break;
- - }
- - default:
- -/*
- - if (action == TGZ_LIST)
- - printf(" %s <---> %s\n",strtime(&tartime),fname);
- -*/
- - break;
- - }
- - }
- - else /* (getheader == 0) */
- - {
- - unsigned int bytes = (remaining > BLOCKSIZE) ? BLOCKSIZE : remaining;
- - unsigned long bwritten;
- -
- - if (outfile != INVALID_HANDLE_VALUE)
- - {
- - WriteFile(outfile,buffer.buffer,bytes,&bwritten,NULL);
- - if (bwritten != bytes)
- - {
- - PrintMessage(_T("Error: write failed for %s"), _A2T(fname));
- - CloseHandle(outfile);
- - DeleteFileA(fname);
- -
- - cm_cleanup(cm);
- - return -2;
- - }
- - }
- - remaining -= bytes;
- - if (remaining == 0) goto setTimeAndCloseFile;
- - }
- - } /* while(1) */
- -
- - cm_cleanup(cm);
- -
- - return 0;
- + return 0;
- }
- diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/untar.h
- --- a/common/windows/nsis/plugins/untgz/untar.h Wed Nov 21 10:28:12 2012 +0100
- +++ b/common/windows/nsis/plugins/untgz/untar.h Wed Nov 21 10:34:41 2012 +0100
- @@ -43,7 +43,7 @@
- };
- /* actual extraction routine */
- -int tgz_extract(gzFile tgzFile, int cm, int junkPaths, enum KeepMode keep, int iCnt, char *iList[], int xCnt, char *xList[], int failOnHardLinks);
- +int tgz_extract(gzFile tgzFile, int cm, int junkPaths, enum KeepMode keep, unsigned long totalSize, int iCnt, char *iList[], int xCnt, char *xList[], int failOnHardLinks);
- /* recursive make directory */
- /* abort if you get an ENOENT errno somewhere in the middle */
- @@ -95,6 +95,7 @@
- /* uses filename & file contents and returns best guess of file type CM_* */
- int getFileType(const char *fname);
- +unsigned long getFileSize(const char *fname);
- /* !!!USER SUPPLIED!!! */
- diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/untgz.cpp
- --- a/common/windows/nsis/plugins/untgz/untgz.cpp Wed Nov 21 10:28:12 2012 +0100
- +++ b/common/windows/nsis/plugins/untgz/untgz.cpp Wed Nov 21 10:34:41 2012 +0100
- @@ -116,6 +116,7 @@
- HWND g_hwndParent;
- HWND g_hwndList;
- +HWND g_hwndProgressBar;
- // DLL entry point
- @@ -194,7 +195,7 @@
- void argParse(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop,
- - TCHAR *cmd, TCHAR *cmdline, gzFile *tgzFile, int *compressionMethod,
- + TCHAR *cmd, TCHAR *cmdline, gzFile *tgzFile, int *compressionMethod, unsigned long *fileSize,
- int *junkPaths, enum KeepMode *keep, TCHAR *basePath, int *failOnHardLinks)
- {
- TCHAR buf[1024]; /* used for argument processor or other temp buffer */
- @@ -216,6 +217,7 @@
- /* initialize optional arguments to their general defaults */
- *tgzFile = 0;
- *compressionMethod = CM_AUTO;
- + *fileSize = 0;
- *failOnHardLinks = 0; /* default to warn only */
- *keep = OVERWRITE;
- *junkPaths = 0; /* keep path information by default */
- @@ -282,6 +284,8 @@
- _tcscat(cmdline, buf);
- _tcscat(cmdline, _T("' "));
- + *fileSize = getFileSize(_T2A(buf));
- +
- /* if auto type specified then determine type */
- if (*compressionMethod == CM_AUTO)
- *compressionMethod = getFileType(_T2A(buf));
- @@ -334,6 +338,7 @@
- TCHAR cmdline[1024]; /* just used to display to user */
- int junkPaths; /* default to extracting with paths -- highly insecure */
- int compressionMethod; /* gzip or other compressed tar file */
- + unsigned long fileSize;
- int failOnHardLinks;
- enum KeepMode keep; /* overwrite mode */
- gzFile tgzFile = NULL; /* the opened tarball (assuming argParse returns successfully) */
- @@ -345,7 +350,7 @@
- /* do common stuff including parsing arguments up to filename to extract */
- argParse(hwndParent, string_size, variables, stacktop,
- - funcName[mode], cmdline, &tgzFile, &compressionMethod, &junkPaths, &keep, NULL, &failOnHardLinks);
- + funcName[mode], cmdline, &tgzFile, &compressionMethod, &fileSize, &junkPaths, &keep, NULL, &failOnHardLinks);
- /* check if everything up to now processed ok, exit if not */
- if (_tcscmp(getuservariable(INST_R0), ERR_SUCCESS) != 0) return;
- @@ -417,10 +422,10 @@
- /* show user cmdline */
- - PrintMessage(cmdline);
- + //Non user friendly PrintMessage(cmdline);
- /* actually perform the extraction */
- - if ((result = tgz_extract(tgzFile, compressionMethod, junkPaths, keep, iCnt, iList, xCnt, xList, failOnHardLinks)) < 0)
- + if ((result = tgz_extract(tgzFile, compressionMethod, junkPaths, keep, fileSize, iCnt, iList, xCnt, xList, failOnHardLinks)) < 0)
- {
- switch (result)
- {
- diff -r 08cb0da42323 -r 2e21c45e75b8 common/windows/nsis/plugins/untgz/untgz.dll
- Binary file common/windows/nsis/plugins/untgz/untgz.dll has changed
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement