diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2009-12-14 03:00:00 +0300 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:16:01 +0300 |
commit | 1fbaf0aac5000ca563a1ee2bb15ba6821a08e468 (patch) | |
tree | ec079944edffd096355ecb0c499f889364aefb4b /CPP/7zip/Archive/7z | |
parent | 2fed8721946901375d21d4a506fe8b114045b397 (diff) |
9.09 beta
Diffstat (limited to 'CPP/7zip/Archive/7z')
-rwxr-xr-x | CPP/7zip/Archive/7z/7z.dsp | 14 | ||||
-rwxr-xr-x | CPP/7zip/Archive/7z/7zCompressionMode.h | 4 | ||||
-rwxr-xr-x | CPP/7zip/Archive/7z/7zDecode.cpp | 4 | ||||
-rwxr-xr-x | CPP/7zip/Archive/7z/7zDecode.h | 2 | ||||
-rwxr-xr-x | CPP/7zip/Archive/7z/7zEncode.cpp | 3 | ||||
-rwxr-xr-x | CPP/7zip/Archive/7z/7zExtract.cpp | 2 | ||||
-rwxr-xr-x | CPP/7zip/Archive/7z/7zHandler.cpp | 17 | ||||
-rwxr-xr-x | CPP/7zip/Archive/7z/7zHandler.h | 6 | ||||
-rwxr-xr-x | CPP/7zip/Archive/7z/7zHandlerOut.cpp | 12 | ||||
-rwxr-xr-x | CPP/7zip/Archive/7z/7zIn.cpp | 2 | ||||
-rwxr-xr-x | CPP/7zip/Archive/7z/7zItem.h | 10 | ||||
-rwxr-xr-x | CPP/7zip/Archive/7z/7zOut.cpp | 10 | ||||
-rwxr-xr-x | CPP/7zip/Archive/7z/7zRegister.cpp | 2 | ||||
-rwxr-xr-x | CPP/7zip/Archive/7z/7zUpdate.cpp | 20 | ||||
-rwxr-xr-x | CPP/7zip/Archive/7z/makefile | 9 |
15 files changed, 58 insertions, 59 deletions
diff --git a/CPP/7zip/Archive/7z/7z.dsp b/CPP/7zip/Archive/7z/7z.dsp index cf7aa975..0484228d 100755 --- a/CPP/7zip/Archive/7z/7z.dsp +++ b/CPP/7zip/Archive/7z/7z.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /YX /FD /c -# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "COMPRESS_MT" /D "EXTERNAL_CODECS" /Yu"StdAfx.h" /FD /c +# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "..\..\..\\" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "EXTERNAL_CODECS" /Yu"StdAfx.h" /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x419 /d "NDEBUG" @@ -70,7 +70,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "COMPRESS_MT" /D "EXTERNAL_CODECS" /Yu"StdAfx.h" /FD /GZ /c +# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "..\..\..\\" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "MY7Z_EXPORTS" /D "EXTERNAL_CODECS" /Yu"StdAfx.h" /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x419 /d "_DEBUG" @@ -619,6 +619,11 @@ SOURCE=..\..\..\..\C\7zCrc.h # End Source File # Begin Source File +SOURCE=..\..\..\..\C\7zCrcOpt.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + SOURCE=..\..\..\..\C\Alloc.c # SUBTRACT CPP /YX /Yc /Yu # End Source File @@ -628,6 +633,11 @@ SOURCE=..\..\..\..\C\Alloc.h # End Source File # Begin Source File +SOURCE=..\..\..\..\C\CpuArch.c +# SUBTRACT CPP /YX /Yc /Yu +# End Source File +# Begin Source File + SOURCE=..\..\..\..\C\Threads.c # SUBTRACT CPP /YX /Yc /Yu # End Source File diff --git a/CPP/7zip/Archive/7z/7zCompressionMode.h b/CPP/7zip/Archive/7z/7zCompressionMode.h index a7cf999c..55bbc68e 100755 --- a/CPP/7zip/Archive/7z/7zCompressionMode.h +++ b/CPP/7zip/Archive/7z/7zCompressionMode.h @@ -31,7 +31,7 @@ struct CCompressionMethodMode { CObjectVector<CMethodFull> Methods; CRecordVector<CBind> Binds; - #ifdef COMPRESS_MT + #ifndef _7ZIP_ST UInt32 NumThreads; #endif bool PasswordIsDefined; @@ -39,7 +39,7 @@ struct CCompressionMethodMode bool IsEmpty() const { return (Methods.IsEmpty() && !PasswordIsDefined); } CCompressionMethodMode(): PasswordIsDefined(false) - #ifdef COMPRESS_MT + #ifndef _7ZIP_ST , NumThreads(1) #endif {} diff --git a/CPP/7zip/Archive/7z/7zDecode.cpp b/CPP/7zip/Archive/7z/7zDecode.cpp index 2d25ff2e..ab3db913 100755 --- a/CPP/7zip/Archive/7z/7zDecode.cpp +++ b/CPP/7zip/Archive/7z/7zDecode.cpp @@ -97,7 +97,7 @@ HRESULT CDecoder::Decode( #ifndef _NO_CRYPTO , ICryptoGetTextPassword *getTextPassword, bool &passwordIsDefined #endif - #ifdef COMPRESS_MT + #if !defined(_7ZIP_ST) && !defined(_SFX) , bool mtMode, UInt32 numThreads #endif ) @@ -239,7 +239,7 @@ HRESULT CDecoder::Decode( } } - #ifdef COMPRESS_MT + #if !defined(_7ZIP_ST) && !defined(_SFX) if (mtMode) { CMyComPtr<ICompressSetCoderMt> setCoderMt; diff --git a/CPP/7zip/Archive/7z/7zDecode.h b/CPP/7zip/Archive/7z/7zDecode.h index 1057a525..d8a424a3 100755 --- a/CPP/7zip/Archive/7z/7zDecode.h +++ b/CPP/7zip/Archive/7z/7zDecode.h @@ -57,7 +57,7 @@ public: #ifndef _NO_CRYPTO , ICryptoGetTextPassword *getTextPasswordSpec, bool &passwordIsDefined #endif - #ifdef COMPRESS_MT + #if !defined(_7ZIP_ST) && !defined(_SFX) , bool mtMode, UInt32 numThreads #endif ); diff --git a/CPP/7zip/Archive/7z/7zEncode.cpp b/CPP/7zip/Archive/7z/7zEncode.cpp index 86753acd..ec0b5af4 100755 --- a/CPP/7zip/Archive/7z/7zEncode.cpp +++ b/CPP/7zip/Archive/7z/7zEncode.cpp @@ -15,7 +15,6 @@ static const UInt64 k_Delta = 0x03; static const UInt64 k_BCJ = 0x03030103; static const UInt64 k_BCJ2 = 0x0303011B; -static const UInt64 k_AES = 0x06F10701; namespace NArchive { namespace N7z { @@ -76,7 +75,7 @@ HRESULT CEncoder::CreateMixerCoder( CMyComPtr<IUnknown> encoderCommon = encoder ? (IUnknown *)encoder : (IUnknown *)encoder2; - #ifdef COMPRESS_MT + #ifndef _7ZIP_ST { CMyComPtr<ICompressSetCoderMt> setCoderMt; encoderCommon.QueryInterface(IID_ICompressSetCoderMt, &setCoderMt); diff --git a/CPP/7zip/Archive/7z/7zExtract.cpp b/CPP/7zip/Archive/7z/7zExtract.cpp index 1b0f9ea1..6913d8fb 100755 --- a/CPP/7zip/Archive/7z/7zExtract.cpp +++ b/CPP/7zip/Archive/7z/7zExtract.cpp @@ -237,7 +237,7 @@ STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems, #ifndef _NO_CRYPTO , getTextPassword, passwordIsDefined #endif - #ifdef COMPRESS_MT + #if !defined(_7ZIP_ST) && !defined(_SFX) , true, _numThreads #endif ); diff --git a/CPP/7zip/Archive/7z/7zHandler.cpp b/CPP/7zip/Archive/7z/7zHandler.cpp index 136d0c5f..4ab7afa8 100755 --- a/CPP/7zip/Archive/7z/7zHandler.cpp +++ b/CPP/7zip/Archive/7z/7zHandler.cpp @@ -7,7 +7,7 @@ #include "../../../Common/ComTry.h" #include "../../../Common/IntToString.h" -#ifdef COMPRESS_MT +#ifndef __7Z_SET_PROPERTIES #include "../../../Windows/System.h" #endif @@ -38,7 +38,7 @@ CHandler::CHandler() #endif #ifdef EXTRACT_ONLY - #ifdef COMPRESS_MT + #ifdef __7Z_SET_PROPERTIES _numThreads = NSystem::GetNumberOfProcessors(); #endif #else @@ -190,18 +190,11 @@ static inline void AddHexToString(UString &res, Byte value) #endif -static const UInt64 k_AES = 0x06F10701; - bool CHandler::IsEncrypted(UInt32 index2) const { CNum folderIndex = _db.FileIndexToFolderIndexMap[index2]; if (folderIndex != kNumNoIndex) - { - const CFolder &folderInfo = _db.Folders[folderIndex]; - for (int i = folderInfo.Coders.Size() - 1; i >= 0; i--) - if (folderInfo.Coders[i].MethodID == k_AES) - return true; - } + return _db.Folders[folderIndex].IsEncrypted(); return false; } @@ -454,10 +447,8 @@ STDMETHODIMP CHandler::Close() STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties) { COM_TRY_BEGIN - #ifdef COMPRESS_MT const UInt32 numProcessors = NSystem::GetNumberOfProcessors(); _numThreads = numProcessors; - #endif for (int i = 0; i < numProperties; i++) { @@ -472,9 +463,7 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v { if(name.Left(2).CompareNoCase(L"MT") == 0) { - #ifdef COMPRESS_MT RINOK(ParseMtProp(name.Mid(2), value, numProcessors, _numThreads)); - #endif continue; } else diff --git a/CPP/7zip/Archive/7z/7zHandler.h b/CPP/7zip/Archive/7z/7zHandler.h index 68fb034f..56062d46 100755 --- a/CPP/7zip/Archive/7z/7zHandler.h +++ b/CPP/7zip/Archive/7z/7zHandler.h @@ -21,7 +21,7 @@ namespace N7z { #ifndef __7Z_SET_PROPERTIES #ifdef EXTRACT_ONLY -#ifdef COMPRESS_MT +#if !defined(_7ZIP_ST) && !defined(_SFX) #define __7Z_SET_PROPERTIES #endif #else @@ -80,7 +80,7 @@ private: #ifdef EXTRACT_ONLY - #ifdef COMPRESS_MT + #ifdef __7Z_SET_PROPERTIES UInt32 _numThreads; #endif @@ -92,7 +92,7 @@ private: HRESULT SetCompressionMethod(CCompressionMethodMode &method, CObjectVector<COneMethodInfo> &methodsInfo - #ifdef COMPRESS_MT + #ifndef _7ZIP_ST , UInt32 numThreads #endif ); diff --git a/CPP/7zip/Archive/7z/7zHandlerOut.cpp b/CPP/7zip/Archive/7z/7zHandlerOut.cpp index 813510c8..a8ccab6d 100755 --- a/CPP/7zip/Archive/7z/7zHandlerOut.cpp +++ b/CPP/7zip/Archive/7z/7zHandlerOut.cpp @@ -51,7 +51,7 @@ HRESULT CHandler::SetCompressionMethod( CCompressionMethodMode &headerMethod) { HRESULT res = SetCompressionMethod(methodMode, _methods - #ifdef COMPRESS_MT + #ifndef _7ZIP_ST , _numThreads #endif ); @@ -91,8 +91,8 @@ HRESULT CHandler::SetCompressionMethod( } headerMethodInfoVector.Add(oneMethodInfo); HRESULT res = SetCompressionMethod(headerMethod, headerMethodInfoVector - #ifdef COMPRESS_MT - ,1 + #ifndef _7ZIP_ST + , 1 #endif ); RINOK(res); @@ -103,7 +103,7 @@ HRESULT CHandler::SetCompressionMethod( HRESULT CHandler::SetCompressionMethod( CCompressionMethodMode &methodMode, CObjectVector<COneMethodInfo> &methodsInfo - #ifdef COMPRESS_MT + #ifndef _7ZIP_ST , UInt32 numThreads #endif ) @@ -122,7 +122,7 @@ HRESULT CHandler::SetCompressionMethod( { COneMethodInfo &oneMethodInfo = methodsInfo[i]; SetCompressionMethod2(oneMethodInfo - #ifdef COMPRESS_MT + #ifndef _7ZIP_ST , numThreads #endif ); @@ -327,7 +327,7 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt CCompressionMethodMode methodMode, headerMethod; RINOK(SetCompressionMethod(methodMode, headerMethod)); - #ifdef COMPRESS_MT + #ifndef _7ZIP_ST methodMode.NumThreads = _numThreads; headerMethod.NumThreads = 1; #endif diff --git a/CPP/7zip/Archive/7z/7zIn.cpp b/CPP/7zip/Archive/7z/7zIn.cpp index f1458e0c..79d60fc5 100755 --- a/CPP/7zip/Archive/7z/7zIn.cpp +++ b/CPP/7zip/Archive/7z/7zIn.cpp @@ -823,7 +823,7 @@ HRESULT CInArchive::ReadAndDecodePackedStreams( #ifndef _NO_CRYPTO , getTextPassword, passwordIsDefined #endif - #ifdef COMPRESS_MT + #if !defined(_7ZIP_ST) && !defined(_SFX) , false, 1 #endif ); diff --git a/CPP/7zip/Archive/7z/7zItem.h b/CPP/7zip/Archive/7z/7zItem.h index 1c3068bb..34f10775 100755 --- a/CPP/7zip/Archive/7z/7zItem.h +++ b/CPP/7zip/Archive/7z/7zItem.h @@ -13,6 +13,8 @@ namespace NArchive { namespace N7z { +const UInt64 k_AES = 0x06F10701; + typedef UInt32 CNum; const CNum kNumMax = 0x7FFFFFFF; const CNum kNumNoIndex = 0xFFFFFFFF; @@ -83,6 +85,14 @@ struct CFolder return -1; } + bool IsEncrypted() const + { + for (int i = Coders.Size() - 1; i >= 0; i--) + if (Coders[i].MethodID == k_AES) + return true; + return false; + } + bool CheckStructure() const; }; diff --git a/CPP/7zip/Archive/7z/7zOut.cpp b/CPP/7zip/Archive/7z/7zOut.cpp index 8d241d74..0c8aa7e8 100755 --- a/CPP/7zip/Archive/7z/7zOut.cpp +++ b/CPP/7zip/Archive/7z/7zOut.cpp @@ -502,9 +502,11 @@ void COutArchive::SkipAlign(unsigned pos, unsigned alignSize) } */ +static inline unsigned Bv_GetSizeInBytes(const CBoolVector &v) { return ((unsigned)v.Size() + 7) / 8; } + void COutArchive::WriteAlignedBoolHeader(const CBoolVector &v, int numDefined, Byte type, unsigned itemSize) { - const UInt64 bvSize = (numDefined == v.Size()) ? 0 : (v.Size() + 7) / 8; + const unsigned bvSize = (numDefined == v.Size()) ? 0 : Bv_GetSizeInBytes(v); const UInt64 dataSize = (UInt64)numDefined * itemSize + bvSize + 2; SkipAlign(3 + (unsigned)bvSize + (unsigned)GetBigNumberSize(dataSize), itemSize); @@ -631,7 +633,7 @@ void COutArchive::WriteHeader( if (numEmptyStreams > 0) { WriteByte(NID::kEmptyStream); - WriteNumber((emptyStreamVector.Size() + 7) / 8); + WriteNumber(Bv_GetSizeInBytes(emptyStreamVector)); WriteBoolVector(emptyStreamVector); CBoolVector emptyFileVector, antiVector; @@ -656,14 +658,14 @@ void COutArchive::WriteHeader( if (numEmptyFiles > 0) { WriteByte(NID::kEmptyFile); - WriteNumber((emptyFileVector.Size() + 7) / 8); + WriteNumber(Bv_GetSizeInBytes(emptyFileVector)); WriteBoolVector(emptyFileVector); } if (numAntiItems > 0) { WriteByte(NID::kAnti); - WriteNumber((antiVector.Size() + 7) / 8); + WriteNumber(Bv_GetSizeInBytes(antiVector)); WriteBoolVector(antiVector); } } diff --git a/CPP/7zip/Archive/7z/7zRegister.cpp b/CPP/7zip/Archive/7z/7zRegister.cpp index af59b644..6e9bf6b9 100755 --- a/CPP/7zip/Archive/7z/7zRegister.cpp +++ b/CPP/7zip/Archive/7z/7zRegister.cpp @@ -15,4 +15,4 @@ static IOutArchive *CreateArcOut() { return new NArchive::N7z::CHandler; } static CArcInfo g_ArcInfo = { L"7z", L"7z", 0, 7, {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C}, 6, false, CreateArc, CreateArcOut }; -REGISTER_ARC_DEC_SIG(7z) +REGISTER_ARC(7z) diff --git a/CPP/7zip/Archive/7z/7zUpdate.cpp b/CPP/7zip/Archive/7z/7zUpdate.cpp index d1082808..7b9e49e1 100755 --- a/CPP/7zip/Archive/7z/7zUpdate.cpp +++ b/CPP/7zip/Archive/7z/7zUpdate.cpp @@ -27,7 +27,6 @@ namespace N7z { static const UInt64 k_LZMA = 0x030101; static const UInt64 k_BCJ = 0x03030103; static const UInt64 k_BCJ2 = 0x0303011B; -static const UInt64 k_AES = 0x06F10701; static const wchar_t *kMatchFinderForBCJ2_LZMA = L"BT2"; static const UInt32 kDictionaryForBCJ2_LZMA = 1 << 20; @@ -580,7 +579,7 @@ public: DECL_EXTERNAL_CODECS_VARS CDecoder Decoder; - #ifdef COMPRESS_MT + #ifndef _7ZIP_ST bool MtMode; UInt32 NumThreads; #endif @@ -588,7 +587,7 @@ public: CThreadDecoder(): Decoder(true) { - #ifdef COMPRESS_MT + #ifndef _7ZIP_ST MtMode = false; NumThreads = 1; #endif @@ -617,7 +616,7 @@ void CThreadDecoder::Execute() #ifndef _NO_CRYPTO , GetTextPassword, passwordIsDefined #endif - #ifdef COMPRESS_MT + #ifndef _7ZIP_ST , MtMode, NumThreads #endif ); @@ -642,17 +641,6 @@ bool static Is86FilteredFolder(const CFolder &f) return false; } -bool static IsEncryptedFolder(const CFolder &f) -{ - for (int i = 0; i < f.Coders.Size(); i++) - { - CMethodId m = f.Coders[i].MethodID; - if (m == k_AES) - return true; - } - return false; -} - #ifndef _NO_CRYPTO class CCryptoGetTextPassword: @@ -760,7 +748,7 @@ HRESULT Update( rep.FolderIndex = i; rep.NumCopyFiles = numCopyItems; const CFolder &f = db->Folders[i]; - bool isEncrypted = IsEncryptedFolder(f); + bool isEncrypted = f.IsEncrypted(); rep.Group = GetGroupIndex(isEncrypted, Is86FilteredFolder(f)); folderRefs.Add(rep); if (numCopyItems == numUnpackStreams) diff --git a/CPP/7zip/Archive/7z/makefile b/CPP/7zip/Archive/7z/makefile index baedf862..0abb3756 100755 --- a/CPP/7zip/Archive/7z/makefile +++ b/CPP/7zip/Archive/7z/makefile @@ -1,7 +1,6 @@ PROG = 7z.dll DEF_FILE = ../Archive.def CFLAGS = $(CFLAGS) -I ../../../ \ - -DCOMPRESS_MT \ -DEXTERNAL_CODECS \ AR_OBJS = \ @@ -71,9 +70,10 @@ AR_COMMON_OBJS = \ C_OBJS = \ $O\Alloc.obj \ + $O\CpuArch.obj \ $O\Threads.obj \ -!include "../../Crc2.mak" +!include "../../Crc.mak" OBJS = \ $O\StdAfx.obj \ @@ -85,7 +85,7 @@ OBJS = \ $(AR_COMMON_OBJS) \ $O\CopyCoder.obj \ $(C_OBJS) \ - $(CRC_OBJS) \ + $(ASM_OBJS) \ $O\resource.res !include "../../../Build.mak" @@ -106,4 +106,5 @@ $O\CopyCoder.obj: ../../Compress/$(*B).cpp $(COMPL) $(C_OBJS): ../../../../C/$(*B).c $(COMPL_O2) -!include "../../Crc.mak" + +!include "../../Asm.mak" |