mirror of
https://github.com/Xevion/easy7zip.git
synced 2026-01-31 06:24:13 -06:00
4.48 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
0b33f700a6
commit
fd8b1d78b4
+57
-16
@@ -290,6 +290,22 @@ SOURCE=..\..\..\Common\IntToString.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyString.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyString.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyVector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyVector.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\NewHandler.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -298,14 +314,6 @@ SOURCE=..\..\..\Common\NewHandler.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\String.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\String.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\StringConvert.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -320,14 +328,6 @@ SOURCE=..\..\..\Common\StringToInt.cpp
|
||||
|
||||
SOURCE=..\..\..\Common\StringToInt.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Vector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Vector.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Archive Common"
|
||||
|
||||
@@ -358,6 +358,14 @@ SOURCE=..\Common\CrossThreadProgress.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\HandlerOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\HandlerOut.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Common\InStreamWithCRC.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -450,6 +458,14 @@ SOURCE=..\..\Common\MethodId.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\MethodProps.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\MethodProps.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\OutBuffer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -496,6 +512,14 @@ SOURCE=..\..\Common\StreamUtils.cpp
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\VirtThread.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\VirtThread.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Windows"
|
||||
|
||||
@@ -558,6 +582,14 @@ SOURCE=..\..\..\Windows\Synchronization.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\System.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\System.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Thread.h
|
||||
# End Source File
|
||||
# End Group
|
||||
@@ -594,6 +626,15 @@ SOURCE=..\..\..\..\C\Alloc.c
|
||||
|
||||
SOURCE=..\..\..\..\C\Alloc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\C\Threads.c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\C\Threads.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
|
||||
@@ -3,28 +3,20 @@
|
||||
#ifndef __7Z_COMPRESSION_MODE_H
|
||||
#define __7Z_COMPRESSION_MODE_H
|
||||
|
||||
#include "../../../Common/String.h"
|
||||
#include "../../../Common/MyString.h"
|
||||
|
||||
#include "../../../Windows/PropVariant.h"
|
||||
|
||||
#include "../../Common/MethodId.h"
|
||||
#include "../../Common/MethodProps.h"
|
||||
|
||||
namespace NArchive {
|
||||
namespace N7z {
|
||||
|
||||
struct CProperty
|
||||
struct CMethodFull: public CMethod
|
||||
{
|
||||
PROPID PropID;
|
||||
NWindows::NCOM::CPropVariant Value;
|
||||
};
|
||||
|
||||
struct CMethodFull
|
||||
{
|
||||
CMethodId MethodID;
|
||||
UInt32 NumInStreams;
|
||||
UInt32 NumOutStreams;
|
||||
bool IsSimpleCoder() const { return (NumInStreams == 1) && (NumOutStreams == 1); }
|
||||
CObjectVector<CProperty> CoderProperties;
|
||||
};
|
||||
|
||||
struct CBind
|
||||
|
||||
@@ -22,7 +22,7 @@ static void ConvertFolderItemInfoToBindInfo(const CFolder &folder,
|
||||
int i;
|
||||
for (i = 0; i < folder.BindPairs.Size(); i++)
|
||||
{
|
||||
NCoderMixer2::CBindPair bindPair;
|
||||
NCoderMixer::CBindPair bindPair;
|
||||
bindPair.InIndex = (UInt32)folder.BindPairs[i].InIndex;
|
||||
bindPair.OutIndex = (UInt32)folder.BindPairs[i].OutIndex;
|
||||
bindInfo.BindPairs.Add(bindPair);
|
||||
@@ -30,7 +30,7 @@ static void ConvertFolderItemInfoToBindInfo(const CFolder &folder,
|
||||
UInt32 outStreamIndex = 0;
|
||||
for (i = 0; i < folder.Coders.Size(); i++)
|
||||
{
|
||||
NCoderMixer2::CCoderStreamsInfo coderStreamsInfo;
|
||||
NCoderMixer::CCoderStreamsInfo coderStreamsInfo;
|
||||
const CCoderInfo &coderInfo = folder.Coders[i];
|
||||
coderStreamsInfo.NumInStreams = (UInt32)coderInfo.NumInStreams;
|
||||
coderStreamsInfo.NumOutStreams = (UInt32)coderInfo.NumOutStreams;
|
||||
@@ -44,14 +44,14 @@ static void ConvertFolderItemInfoToBindInfo(const CFolder &folder,
|
||||
bindInfo.InStreams.Add((UInt32)folder.PackStreams[i]);
|
||||
}
|
||||
|
||||
static bool AreCodersEqual(const NCoderMixer2::CCoderStreamsInfo &a1,
|
||||
const NCoderMixer2::CCoderStreamsInfo &a2)
|
||||
static bool AreCodersEqual(const NCoderMixer::CCoderStreamsInfo &a1,
|
||||
const NCoderMixer::CCoderStreamsInfo &a2)
|
||||
{
|
||||
return (a1.NumInStreams == a2.NumInStreams) &&
|
||||
(a1.NumOutStreams == a2.NumOutStreams);
|
||||
}
|
||||
|
||||
static bool AreBindPairsEqual(const NCoderMixer2::CBindPair &a1, const NCoderMixer2::CBindPair &a2)
|
||||
static bool AreBindPairsEqual(const NCoderMixer::CBindPair &a1, const NCoderMixer::CBindPair &a2)
|
||||
{
|
||||
return (a1.InIndex == a2.InIndex) &&
|
||||
(a1.OutIndex == a2.OutIndex);
|
||||
@@ -145,14 +145,14 @@ HRESULT CDecoder::Decode(
|
||||
|
||||
if (_multiThread)
|
||||
{
|
||||
_mixerCoderMTSpec = new NCoderMixer2::CCoderMixer2MT;
|
||||
_mixerCoderMTSpec = new NCoderMixer::CCoderMixer2MT;
|
||||
_mixerCoder = _mixerCoderMTSpec;
|
||||
_mixerCoderCommon = _mixerCoderMTSpec;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef _ST_MODE
|
||||
_mixerCoderSTSpec = new NCoderMixer2::CCoderMixer2ST;
|
||||
_mixerCoderSTSpec = new NCoderMixer::CCoderMixer2ST;
|
||||
_mixerCoder = _mixerCoderSTSpec;
|
||||
_mixerCoderCommon = _mixerCoderSTSpec;
|
||||
#endif
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
namespace NArchive {
|
||||
namespace N7z {
|
||||
|
||||
struct CBindInfoEx: public NCoderMixer2::CBindInfo
|
||||
struct CBindInfoEx: public NCoderMixer::CBindInfo
|
||||
{
|
||||
CRecordVector<CMethodId> CoderMethodIDs;
|
||||
void Clear()
|
||||
@@ -36,10 +36,10 @@ class CDecoder
|
||||
|
||||
bool _multiThread;
|
||||
#ifdef _ST_MODE
|
||||
NCoderMixer2::CCoderMixer2ST *_mixerCoderSTSpec;
|
||||
NCoderMixer::CCoderMixer2ST *_mixerCoderSTSpec;
|
||||
#endif
|
||||
NCoderMixer2::CCoderMixer2MT *_mixerCoderMTSpec;
|
||||
NCoderMixer2::CCoderMixer2 *_mixerCoderCommon;
|
||||
NCoderMixer::CCoderMixer2MT *_mixerCoderMTSpec;
|
||||
NCoderMixer::CCoderMixer2 *_mixerCoderCommon;
|
||||
|
||||
CMyComPtr<ICompressCoder2> _mixerCoder;
|
||||
CObjectVector<CMyComPtr<IUnknown> > _decoders;
|
||||
|
||||
@@ -13,14 +13,12 @@
|
||||
#include "../../Common/CreateCoder.h"
|
||||
#include "../../Common/FilterCoder.h"
|
||||
|
||||
static UInt64 k_LZMA = 0x030101;
|
||||
// static UInt64 k_LZMA2 = 0x030102;
|
||||
static UInt64 k_AES = 0x06F10701;
|
||||
|
||||
namespace NArchive {
|
||||
namespace N7z {
|
||||
|
||||
static void ConvertBindInfoToFolderItemInfo(const NCoderMixer2::CBindInfo &bindInfo,
|
||||
static void ConvertBindInfoToFolderItemInfo(const NCoderMixer::CBindInfo &bindInfo,
|
||||
const CRecordVector<CMethodId> decompressionMethods,
|
||||
CFolder &folder)
|
||||
{
|
||||
@@ -40,7 +38,7 @@ static void ConvertBindInfoToFolderItemInfo(const NCoderMixer2::CBindInfo &bindI
|
||||
for (i = 0; i < bindInfo.Coders.Size(); i++)
|
||||
{
|
||||
CCoderInfo coderInfo;
|
||||
const NCoderMixer2::CCoderStreamsInfo &coderStreamsInfo = bindInfo.Coders[i];
|
||||
const NCoderMixer::CCoderStreamsInfo &coderStreamsInfo = bindInfo.Coders[i];
|
||||
coderInfo.NumInStreams = coderStreamsInfo.NumInStreams;
|
||||
coderInfo.NumOutStreams = coderStreamsInfo.NumOutStreams;
|
||||
coderInfo.MethodID = decompressionMethods[i];
|
||||
@@ -54,49 +52,25 @@ HRESULT CEncoder::CreateMixerCoder(
|
||||
DECL_EXTERNAL_CODECS_LOC_VARS
|
||||
const UInt64 *inSizeForReduce)
|
||||
{
|
||||
_mixerCoderSpec = new NCoderMixer2::CCoderMixer2MT;
|
||||
_mixerCoderSpec = new NCoderMixer::CCoderMixer2MT;
|
||||
_mixerCoder = _mixerCoderSpec;
|
||||
RINOK(_mixerCoderSpec->SetBindInfo(_bindInfo));
|
||||
for (int i = 0; i < _options.Methods.Size(); i++)
|
||||
{
|
||||
const CMethodFull &methodFull = _options.Methods[i];
|
||||
_codersInfo.Add(CCoderInfo());
|
||||
CCoderInfo &encodingInfo = _codersInfo.Back();
|
||||
// CCoderInfo &encodingInfo = _codersInfo.Back();
|
||||
CMyComPtr<ICompressCoder> encoder;
|
||||
CMyComPtr<ICompressCoder2> encoder2;
|
||||
|
||||
|
||||
RINOK(CreateCoder(
|
||||
EXTERNAL_CODECS_LOC_VARS
|
||||
methodFull.MethodID, encoder, encoder2, true));
|
||||
methodFull.Id, encoder, encoder2, true));
|
||||
|
||||
if (!encoder && !encoder2)
|
||||
return E_FAIL;
|
||||
|
||||
bool tryReduce = false;
|
||||
UInt32 reducedDictionarySize = 1 << 10;
|
||||
if (inSizeForReduce != 0 && (methodFull.MethodID == k_LZMA /* || methodFull.MethodID == k_LZMA2 */))
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
const UInt32 step = (reducedDictionarySize >> 1);
|
||||
if (reducedDictionarySize >= *inSizeForReduce)
|
||||
{
|
||||
tryReduce = true;
|
||||
break;
|
||||
}
|
||||
reducedDictionarySize += step;
|
||||
if (reducedDictionarySize >= *inSizeForReduce)
|
||||
{
|
||||
tryReduce = true;
|
||||
break;
|
||||
}
|
||||
if (reducedDictionarySize >= ((UInt32)11 << 30))
|
||||
break;
|
||||
reducedDictionarySize += step;
|
||||
}
|
||||
}
|
||||
|
||||
CMyComPtr<IUnknown> encoderCommon = encoder ? (IUnknown *)encoder : (IUnknown *)encoder2;
|
||||
|
||||
#ifdef COMPRESS_MT
|
||||
@@ -110,50 +84,17 @@ HRESULT CEncoder::CreateMixerCoder(
|
||||
}
|
||||
#endif
|
||||
|
||||
if (methodFull.CoderProperties.Size() > 0)
|
||||
|
||||
RINOK(SetMethodProperties(methodFull, inSizeForReduce, encoderCommon));
|
||||
|
||||
/*
|
||||
CMyComPtr<ICryptoResetSalt> resetSalt;
|
||||
encoderCommon.QueryInterface(IID_ICryptoResetSalt, (void **)&resetSalt);
|
||||
if (resetSalt != NULL)
|
||||
{
|
||||
CRecordVector<PROPID> propIDs;
|
||||
int numProperties = methodFull.CoderProperties.Size();
|
||||
NWindows::NCOM::CPropVariant *values = new NWindows::NCOM::CPropVariant[numProperties];
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < numProperties; i++)
|
||||
{
|
||||
const CProperty &property = methodFull.CoderProperties[i];
|
||||
propIDs.Add(property.PropID);
|
||||
NWindows::NCOM::CPropVariant value = property.Value;
|
||||
if (tryReduce && property.PropID == NCoderPropID::kDictionarySize && value.vt == VT_UI4 && reducedDictionarySize < value.ulVal)
|
||||
value.ulVal = reducedDictionarySize;
|
||||
values[i] = value;
|
||||
}
|
||||
CMyComPtr<ICompressSetCoderProperties> setCoderProperties;
|
||||
RINOK(encoderCommon.QueryInterface(IID_ICompressSetCoderProperties, &setCoderProperties));
|
||||
RINOK(setCoderProperties->SetCoderProperties(&propIDs.Front(), values, numProperties));
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
delete []values;
|
||||
throw;
|
||||
}
|
||||
delete []values;
|
||||
}
|
||||
|
||||
CMyComPtr<ICompressWriteCoderProperties> writeCoderProperties;
|
||||
|
||||
encoderCommon.QueryInterface(IID_ICompressWriteCoderProperties, &writeCoderProperties);
|
||||
|
||||
if (writeCoderProperties != NULL)
|
||||
{
|
||||
CSequentialOutStreamImp *outStreamSpec = new CSequentialOutStreamImp;
|
||||
CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
|
||||
outStreamSpec->Init();
|
||||
writeCoderProperties->WriteCoderProperties(outStream);
|
||||
|
||||
size_t size = outStreamSpec->GetSize();
|
||||
|
||||
encodingInfo.Properties.SetCapacity(size);
|
||||
memmove(encodingInfo.Properties, outStreamSpec->GetBuffer(), size);
|
||||
resetSalt->ResetSalt();
|
||||
}
|
||||
*/
|
||||
|
||||
#ifdef EXTERNAL_CODECS
|
||||
CMyComPtr<ISetCompressCodecsInfo> setCompressCodecsInfo;
|
||||
@@ -268,6 +209,31 @@ HRESULT CEncoder::Encode(
|
||||
outStreamPointers.Add(outStreamSizeCount);
|
||||
for (i = 1; i < _bindInfo.OutStreams.Size(); i++)
|
||||
outStreamPointers.Add(tempBuffers[i - 1]);
|
||||
|
||||
for (i = 0; i < _codersInfo.Size(); i++)
|
||||
{
|
||||
CCoderInfo &encodingInfo = _codersInfo[i];
|
||||
|
||||
CMyComPtr<ICryptoResetInitVector> resetInitVector;
|
||||
_mixerCoderSpec->_coders[i].QueryInterface(IID_ICryptoResetInitVector, (void **)&resetInitVector);
|
||||
if (resetInitVector != NULL)
|
||||
{
|
||||
resetInitVector->ResetInitVector();
|
||||
}
|
||||
|
||||
CMyComPtr<ICompressWriteCoderProperties> writeCoderProperties;
|
||||
_mixerCoderSpec->_coders[i].QueryInterface(IID_ICompressWriteCoderProperties, (void **)&writeCoderProperties);
|
||||
if (writeCoderProperties != NULL)
|
||||
{
|
||||
CSequentialOutStreamImp *outStreamSpec = new CSequentialOutStreamImp;
|
||||
CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
|
||||
outStreamSpec->Init();
|
||||
writeCoderProperties->WriteCoderProperties(outStream);
|
||||
size_t size = outStreamSpec->GetSize();
|
||||
encodingInfo.Properties.SetCapacity(size);
|
||||
memmove(encodingInfo.Properties, outStreamSpec->GetBuffer(), size);
|
||||
}
|
||||
}
|
||||
|
||||
RINOK(_mixerCoder->Code(&inStreamPointers.Front(), NULL, 1,
|
||||
&outStreamPointers.Front(), NULL, outStreamPointers.Size(), compressProgress));
|
||||
@@ -325,14 +291,14 @@ HRESULT CEncoder::EncoderConstr()
|
||||
throw 1;
|
||||
if (!_options.Binds.IsEmpty())
|
||||
throw 1;
|
||||
NCoderMixer2::CCoderStreamsInfo coderStreamsInfo;
|
||||
NCoderMixer::CCoderStreamsInfo coderStreamsInfo;
|
||||
CMethodFull method;
|
||||
|
||||
method.NumInStreams = 1;
|
||||
method.NumOutStreams = 1;
|
||||
coderStreamsInfo.NumInStreams = 1;
|
||||
coderStreamsInfo.NumOutStreams = 1;
|
||||
method.MethodID = k_AES;
|
||||
method.Id = k_AES;
|
||||
|
||||
_options.Methods.Add(method);
|
||||
_bindInfo.Coders.Add(coderStreamsInfo);
|
||||
@@ -348,14 +314,14 @@ HRESULT CEncoder::EncoderConstr()
|
||||
for (i = 0; i < _options.Methods.Size(); i++)
|
||||
{
|
||||
const CMethodFull &methodFull = _options.Methods[i];
|
||||
NCoderMixer2::CCoderStreamsInfo coderStreamsInfo;
|
||||
NCoderMixer::CCoderStreamsInfo coderStreamsInfo;
|
||||
coderStreamsInfo.NumInStreams = methodFull.NumOutStreams;
|
||||
coderStreamsInfo.NumOutStreams = methodFull.NumInStreams;
|
||||
if (_options.Binds.IsEmpty())
|
||||
{
|
||||
if (i < _options.Methods.Size() - 1)
|
||||
{
|
||||
NCoderMixer2::CBindPair bindPair;
|
||||
NCoderMixer::CBindPair bindPair;
|
||||
bindPair.InIndex = numInStreams + coderStreamsInfo.NumInStreams;
|
||||
bindPair.OutIndex = numOutStreams;
|
||||
_bindInfo.BindPairs.Add(bindPair);
|
||||
@@ -376,7 +342,7 @@ HRESULT CEncoder::EncoderConstr()
|
||||
{
|
||||
for (i = 0; i < _options.Binds.Size(); i++)
|
||||
{
|
||||
NCoderMixer2::CBindPair bindPair;
|
||||
NCoderMixer::CBindPair bindPair;
|
||||
const CBind &bind = _options.Binds[i];
|
||||
bindPair.InIndex = _bindInfo.GetCoderInStreamIndex(bind.InCoder) + bind.InStream;
|
||||
bindPair.OutIndex = _bindInfo.GetCoderOutStreamIndex(bind.OutCoder) + bind.OutStream;
|
||||
@@ -423,7 +389,7 @@ HRESULT CEncoder::EncoderConstr()
|
||||
|
||||
for (i = 0; i < numCryptoStreams; i++)
|
||||
{
|
||||
NCoderMixer2::CBindPair bindPair;
|
||||
NCoderMixer::CBindPair bindPair;
|
||||
bindPair.InIndex = numInStreams + i;
|
||||
bindPair.OutIndex = _bindInfo.OutStreams[i];
|
||||
_bindInfo.BindPairs.Add(bindPair);
|
||||
@@ -437,13 +403,13 @@ HRESULT CEncoder::EncoderConstr()
|
||||
|
||||
for (i = 0; i < numCryptoStreams; i++)
|
||||
{
|
||||
NCoderMixer2::CCoderStreamsInfo coderStreamsInfo;
|
||||
NCoderMixer::CCoderStreamsInfo coderStreamsInfo;
|
||||
CMethodFull method;
|
||||
method.NumInStreams = 1;
|
||||
method.NumOutStreams = 1;
|
||||
coderStreamsInfo.NumInStreams = method.NumOutStreams;
|
||||
coderStreamsInfo.NumOutStreams = method.NumInStreams;
|
||||
method.MethodID = k_AES;
|
||||
method.Id = k_AES;
|
||||
|
||||
_options.Methods.Add(method);
|
||||
_bindInfo.Coders.Add(coderStreamsInfo);
|
||||
@@ -456,10 +422,10 @@ HRESULT CEncoder::EncoderConstr()
|
||||
for (int i = _options.Methods.Size() - 1; i >= 0; i--)
|
||||
{
|
||||
const CMethodFull &methodFull = _options.Methods[i];
|
||||
_decompressionMethods.Add(methodFull.MethodID);
|
||||
_decompressionMethods.Add(methodFull.Id);
|
||||
}
|
||||
|
||||
_bindReverseConverter = new NCoderMixer2::CBindReverseConverter(_bindInfo);
|
||||
_bindReverseConverter = new NCoderMixer::CBindReverseConverter(_bindInfo);
|
||||
_bindReverseConverter->CreateReverseBindInfo(_decompressBindInfo);
|
||||
_constructed = true;
|
||||
return S_OK;
|
||||
|
||||
@@ -21,15 +21,15 @@ namespace N7z {
|
||||
|
||||
class CEncoder
|
||||
{
|
||||
NCoderMixer2::CCoderMixer2MT *_mixerCoderSpec;
|
||||
NCoderMixer::CCoderMixer2MT *_mixerCoderSpec;
|
||||
CMyComPtr<ICompressCoder2> _mixerCoder;
|
||||
|
||||
CObjectVector<CCoderInfo> _codersInfo;
|
||||
|
||||
CCompressionMethodMode _options;
|
||||
NCoderMixer2::CBindInfo _bindInfo;
|
||||
NCoderMixer2::CBindInfo _decompressBindInfo;
|
||||
NCoderMixer2::CBindReverseConverter *_bindReverseConverter;
|
||||
NCoderMixer::CBindInfo _bindInfo;
|
||||
NCoderMixer::CBindInfo _decompressBindInfo;
|
||||
NCoderMixer::CBindReverseConverter *_bindReverseConverter;
|
||||
CRecordVector<CMethodId> _decompressionMethods;
|
||||
|
||||
HRESULT CreateMixerCoder(DECL_EXTERNAL_CODECS_LOC_VARS
|
||||
|
||||
@@ -20,6 +20,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef COMPRESS_MT
|
||||
#include "../../../Windows/System.h"
|
||||
#endif
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
extern UString ConvertMethodIdToString(UInt64 id);
|
||||
@@ -29,10 +33,11 @@ namespace N7z {
|
||||
|
||||
CHandler::CHandler()
|
||||
{
|
||||
#ifdef EXTRACT_ONLY
|
||||
#ifdef COMPRESS_MT
|
||||
_numThreads = NWindows::NSystem::GetNumberOfProcessors();
|
||||
#endif
|
||||
#ifndef EXTRACT_ONLY
|
||||
#else
|
||||
Init();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
|
||||
#include "7zCompressionMode.h"
|
||||
|
||||
#ifdef COMPRESS_MT
|
||||
#include "../../../Windows/System.h"
|
||||
#endif
|
||||
|
||||
#include "../../Common/CreateCoder.h"
|
||||
|
||||
#ifndef EXTRACT_ONLY
|
||||
#include "../Common/HandlerOut.h"
|
||||
#endif
|
||||
|
||||
namespace NArchive {
|
||||
namespace N7z {
|
||||
|
||||
@@ -44,15 +44,6 @@ struct CVolume
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifndef EXTRACT_ONLY
|
||||
|
||||
struct COneMethodInfo
|
||||
{
|
||||
CObjectVector<CProperty> CoderProperties;
|
||||
UString MethodName;
|
||||
};
|
||||
#endif
|
||||
|
||||
// {23170F69-40C1-278A-1000-000110070000}
|
||||
DEFINE_GUID(CLSID_CFormat7z,
|
||||
0x23170F69, 0x40C1, 0x278A, 0x10, 0x00, 0x00, 0x01, 0x10, 0x07, 0x00, 0x00);
|
||||
@@ -71,6 +62,9 @@ DEFINE_GUID(CLSID_CFormat7z,
|
||||
|
||||
|
||||
class CHandler:
|
||||
#ifndef EXTRACT_ONLY
|
||||
public NArchive::COutHandler,
|
||||
#endif
|
||||
public IInArchive,
|
||||
#ifdef _7Z_VOL
|
||||
public IInArchiveGetStream,
|
||||
@@ -137,8 +131,6 @@ public:
|
||||
|
||||
// ISetProperties
|
||||
|
||||
HRESULT SetSolidSettings(const UString &s);
|
||||
HRESULT SetSolidSettings(const PROPVARIANT &value);
|
||||
#endif
|
||||
|
||||
DECL_ISetCompressCodecsInfo
|
||||
@@ -154,37 +146,15 @@ private:
|
||||
NArchive::N7z::CArchiveDatabaseEx _database;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef EXTRACT_ONLY
|
||||
|
||||
#ifdef COMPRESS_MT
|
||||
UInt32 _numThreads;
|
||||
#endif
|
||||
|
||||
#ifndef EXTRACT_ONLY
|
||||
CObjectVector<COneMethodInfo> _methods;
|
||||
|
||||
#else
|
||||
|
||||
CRecordVector<CBind> _binds;
|
||||
bool _removeSfxBlock;
|
||||
UInt64 _numSolidFiles;
|
||||
UInt64 _numSolidBytes;
|
||||
bool _numSolidBytesDefined;
|
||||
bool _solidExtension;
|
||||
|
||||
bool _compressHeaders;
|
||||
bool _encryptHeaders;
|
||||
|
||||
bool WriteModified;
|
||||
bool WriteCreated;
|
||||
bool WriteAccessed;
|
||||
|
||||
|
||||
bool _autoFilter;
|
||||
UInt32 _level;
|
||||
|
||||
bool _volumeMode;
|
||||
|
||||
DECL_EXTERNAL_CODECS_VARS
|
||||
|
||||
HRESULT SetParam(COneMethodInfo &oneMethodInfo, const UString &name, const UString &value);
|
||||
HRESULT SetParams(COneMethodInfo &oneMethodInfo, const UString &srcString);
|
||||
|
||||
HRESULT SetPassword(CCompressionMethodMode &methodMode, IArchiveUpdateCallback *updateCallback);
|
||||
|
||||
@@ -208,39 +178,6 @@ private:
|
||||
void FillPopIDs();
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef EXTRACT_ONLY
|
||||
|
||||
void InitSolidFiles() { _numSolidFiles = UInt64(Int64(-1)); }
|
||||
void InitSolidSize() { _numSolidBytes = UInt64(Int64(-1)); }
|
||||
void InitSolid()
|
||||
{
|
||||
InitSolidFiles();
|
||||
InitSolidSize();
|
||||
_solidExtension = false;
|
||||
_numSolidBytesDefined = false;
|
||||
}
|
||||
|
||||
void Init()
|
||||
{
|
||||
_removeSfxBlock = false;
|
||||
_compressHeaders = true;
|
||||
_encryptHeaders = false;
|
||||
|
||||
WriteModified = true;
|
||||
WriteCreated = false;
|
||||
WriteAccessed = false;
|
||||
|
||||
#ifdef COMPRESS_MT
|
||||
_numThreads = NWindows::NSystem::GetNumberOfProcessors();
|
||||
#endif
|
||||
|
||||
_level = 5;
|
||||
_autoFilter = true;
|
||||
_volumeMode = false;
|
||||
InitSolid();
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// 7z/OutHandler.cpp
|
||||
// 7zHandlerOut.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
@@ -21,90 +21,19 @@ using namespace NWindows;
|
||||
namespace NArchive {
|
||||
namespace N7z {
|
||||
|
||||
const wchar_t *kCopyMethod = L"Copy";
|
||||
const wchar_t *kLZMAMethodName = L"LZMA";
|
||||
const wchar_t *kLZMA2MethodName = L"LZMA2";
|
||||
const wchar_t *kBZip2MethodName = L"BZip2";
|
||||
const wchar_t *kPpmdMethodName = L"PPMd";
|
||||
const wchar_t *kDeflateMethodName = L"Deflate";
|
||||
const wchar_t *kDeflate64MethodName = L"Deflate64";
|
||||
static const wchar_t *kLZMAMethodName = L"LZMA";
|
||||
static const wchar_t *kCopyMethod = L"Copy";
|
||||
static const wchar_t *kDefaultMethodName = kLZMAMethodName;
|
||||
|
||||
static const wchar_t *kLzmaMatchFinderX1 = L"HC4";
|
||||
static const wchar_t *kLzmaMatchFinderX5 = L"BT4";
|
||||
|
||||
static const UInt32 kLzmaAlgorithmX1 = 0;
|
||||
static const UInt32 kLzmaAlgorithmX5 = 1;
|
||||
|
||||
static const UInt32 kLzmaDicSizeX1 = 1 << 16;
|
||||
static const UInt32 kLzmaDicSizeX3 = 1 << 20;
|
||||
static const UInt32 kLzmaDicSizeX5 = 1 << 24;
|
||||
static const UInt32 kLzmaDicSizeX7 = 1 << 25;
|
||||
static const UInt32 kLzmaDicSizeX9 = 1 << 26;
|
||||
|
||||
static const UInt32 kLzmaFastBytesX1 = 32;
|
||||
static const UInt32 kLzmaFastBytesX7 = 64;
|
||||
|
||||
static const UInt32 kPpmdMemSizeX1 = (1 << 22);
|
||||
static const UInt32 kPpmdMemSizeX5 = (1 << 24);
|
||||
static const UInt32 kPpmdMemSizeX7 = (1 << 26);
|
||||
static const UInt32 kPpmdMemSizeX9 = (192 << 20);
|
||||
|
||||
static const UInt32 kPpmdOrderX1 = 4;
|
||||
static const UInt32 kPpmdOrderX5 = 6;
|
||||
static const UInt32 kPpmdOrderX7 = 16;
|
||||
static const UInt32 kPpmdOrderX9 = 32;
|
||||
|
||||
static const UInt32 kDeflateAlgoX1 = 0;
|
||||
static const UInt32 kDeflateAlgoX5 = 1;
|
||||
|
||||
static const UInt32 kDeflateFastBytesX1 = 32;
|
||||
static const UInt32 kDeflateFastBytesX7 = 64;
|
||||
static const UInt32 kDeflateFastBytesX9 = 128;
|
||||
|
||||
static const UInt32 kDeflatePassesX1 = 1;
|
||||
static const UInt32 kDeflatePassesX7 = 3;
|
||||
static const UInt32 kDeflatePassesX9 = 10;
|
||||
|
||||
static const UInt32 kBZip2NumPassesX1 = 1;
|
||||
static const UInt32 kBZip2NumPassesX7 = 2;
|
||||
static const UInt32 kBZip2NumPassesX9 = 7;
|
||||
|
||||
static const UInt32 kBZip2DicSizeX1 = 100000;
|
||||
static const UInt32 kBZip2DicSizeX3 = 500000;
|
||||
static const UInt32 kBZip2DicSizeX5 = 900000;
|
||||
|
||||
const wchar_t *kDefaultMethodName = kLZMAMethodName;
|
||||
|
||||
static const wchar_t *kLzmaMatchFinderForHeaders = L"BT2";
|
||||
static const UInt32 kDictionaryForHeaders = 1 << 20;
|
||||
static const UInt32 kNumFastBytesForHeaders = 273;
|
||||
static const UInt32 kAlgorithmForHeaders = kLzmaAlgorithmX5;
|
||||
|
||||
static bool IsCopyMethod(const UString &methodName)
|
||||
static inline bool IsCopyMethod(const UString &methodName)
|
||||
{ return (methodName.CompareNoCase(kCopyMethod) == 0); }
|
||||
|
||||
static bool IsLZMAMethod(const UString &methodName)
|
||||
{
|
||||
return
|
||||
(methodName.CompareNoCase(kLZMAMethodName) == 0) ||
|
||||
(methodName.CompareNoCase(kLZMA2MethodName) == 0);
|
||||
}
|
||||
|
||||
/*
|
||||
static bool IsLZMethod(const UString &methodName)
|
||||
{ return IsLZMAMethod(methodName); }
|
||||
*/
|
||||
|
||||
static bool IsBZip2Method(const UString &methodName)
|
||||
{ return (methodName.CompareNoCase(kBZip2MethodName) == 0); }
|
||||
|
||||
static bool IsPpmdMethod(const UString &methodName)
|
||||
{ return (methodName.CompareNoCase(kPpmdMethodName) == 0); }
|
||||
|
||||
static bool IsDeflateMethod(const UString &methodName)
|
||||
{ return (methodName.CompareNoCase(kDeflateMethodName) == 0) ||
|
||||
(methodName.CompareNoCase(kDeflate64MethodName) == 0); }
|
||||
|
||||
STDMETHODIMP CHandler::GetFileTimeType(UInt32 *type)
|
||||
{
|
||||
*type = NFileTimeType::kWindows;
|
||||
@@ -136,60 +65,6 @@ HRESULT CHandler::SetPassword(CCompressionMethodMode &methodMode,
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
struct CNameToPropID
|
||||
{
|
||||
PROPID PropID;
|
||||
VARTYPE VarType;
|
||||
const wchar_t *Name;
|
||||
};
|
||||
|
||||
CNameToPropID g_NameToPropID[] =
|
||||
{
|
||||
{ NCoderPropID::kOrder, VT_UI4, L"O" },
|
||||
{ NCoderPropID::kPosStateBits, VT_UI4, L"PB" },
|
||||
{ NCoderPropID::kLitContextBits, VT_UI4, L"LC" },
|
||||
{ NCoderPropID::kLitPosBits, VT_UI4, L"LP" },
|
||||
|
||||
{ NCoderPropID::kNumPasses, VT_UI4, L"Pass" },
|
||||
{ NCoderPropID::kNumFastBytes, VT_UI4, L"fb" },
|
||||
{ NCoderPropID::kMatchFinderCycles, VT_UI4, L"mc" },
|
||||
{ NCoderPropID::kAlgorithm, VT_UI4, L"a" },
|
||||
{ NCoderPropID::kMatchFinder, VT_BSTR, L"mf" },
|
||||
{ NCoderPropID::kNumThreads, VT_UI4, L"mt" }
|
||||
};
|
||||
|
||||
bool ConvertProperty(PROPVARIANT srcProp, VARTYPE varType,
|
||||
NCOM::CPropVariant &destProp)
|
||||
{
|
||||
if (varType == srcProp.vt)
|
||||
{
|
||||
destProp = srcProp;
|
||||
return true;
|
||||
}
|
||||
if (varType == VT_UI1)
|
||||
{
|
||||
if(srcProp.vt == VT_UI4)
|
||||
{
|
||||
UInt32 value = srcProp.ulVal;
|
||||
if (value > 0xFF)
|
||||
return false;
|
||||
destProp = Byte(value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
const int kNumNameToPropIDItems = sizeof(g_NameToPropID) / sizeof(g_NameToPropID[0]);
|
||||
|
||||
int FindPropIdFromStringName(const UString &name)
|
||||
{
|
||||
for (int i = 0; i < kNumNameToPropIDItems; i++)
|
||||
if (name.CompareNoCase(g_NameToPropID[i].Name) == 0)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
HRESULT CHandler::SetCompressionMethod(
|
||||
CCompressionMethodMode &methodMode,
|
||||
CCompressionMethodMode &headerMethod)
|
||||
@@ -210,28 +85,28 @@ HRESULT CHandler::SetCompressionMethod(
|
||||
COneMethodInfo oneMethodInfo;
|
||||
oneMethodInfo.MethodName = kLZMAMethodName;
|
||||
{
|
||||
CProperty property;
|
||||
property.PropID = NCoderPropID::kMatchFinder;
|
||||
CProp property;
|
||||
property.Id = NCoderPropID::kMatchFinder;
|
||||
property.Value = kLzmaMatchFinderForHeaders;
|
||||
oneMethodInfo.CoderProperties.Add(property);
|
||||
oneMethodInfo.Properties.Add(property);
|
||||
}
|
||||
{
|
||||
CProperty property;
|
||||
property.PropID = NCoderPropID::kAlgorithm;
|
||||
CProp property;
|
||||
property.Id = NCoderPropID::kAlgorithm;
|
||||
property.Value = kAlgorithmForHeaders;
|
||||
oneMethodInfo.CoderProperties.Add(property);
|
||||
oneMethodInfo.Properties.Add(property);
|
||||
}
|
||||
{
|
||||
CProperty property;
|
||||
property.PropID = NCoderPropID::kNumFastBytes;
|
||||
CProp property;
|
||||
property.Id = NCoderPropID::kNumFastBytes;
|
||||
property.Value = UInt32(kNumFastBytesForHeaders);
|
||||
oneMethodInfo.CoderProperties.Add(property);
|
||||
oneMethodInfo.Properties.Add(property);
|
||||
}
|
||||
{
|
||||
CProperty property;
|
||||
property.PropID = NCoderPropID::kDictionarySize;
|
||||
CProp property;
|
||||
property.Id = NCoderPropID::kDictionarySize;
|
||||
property.Value = UInt32(kDictionaryForHeaders);
|
||||
oneMethodInfo.CoderProperties.Add(property);
|
||||
oneMethodInfo.Properties.Add(property);
|
||||
}
|
||||
headerMethodInfoVector.Add(oneMethodInfo);
|
||||
HRESULT res = SetCompressionMethod(headerMethod, headerMethodInfoVector
|
||||
@@ -244,21 +119,6 @@ HRESULT CHandler::SetCompressionMethod(
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static void SetOneMethodProp(COneMethodInfo &oneMethodInfo, PROPID propID,
|
||||
const NWindows::NCOM::CPropVariant &value)
|
||||
{
|
||||
int j;
|
||||
for (j = 0; j < oneMethodInfo.CoderProperties.Size(); j++)
|
||||
if (oneMethodInfo.CoderProperties[j].PropID == propID)
|
||||
break;
|
||||
if (j != oneMethodInfo.CoderProperties.Size())
|
||||
return;
|
||||
CProperty property;
|
||||
property.PropID = propID;
|
||||
property.Value = value;
|
||||
oneMethodInfo.CoderProperties.Add(property);
|
||||
}
|
||||
|
||||
HRESULT CHandler::SetCompressionMethod(
|
||||
CCompressionMethodMode &methodMode,
|
||||
CObjectVector<COneMethodInfo> &methodsInfo
|
||||
@@ -280,113 +140,31 @@ HRESULT CHandler::SetCompressionMethod(
|
||||
for(int i = 0; i < methodsInfo.Size(); i++)
|
||||
{
|
||||
COneMethodInfo &oneMethodInfo = methodsInfo[i];
|
||||
if (oneMethodInfo.MethodName.IsEmpty())
|
||||
oneMethodInfo.MethodName = kDefaultMethodName;
|
||||
SetCompressionMethod2(oneMethodInfo
|
||||
#ifdef COMPRESS_MT
|
||||
, numThreads
|
||||
#endif
|
||||
);
|
||||
|
||||
if (!IsCopyMethod(oneMethodInfo.MethodName))
|
||||
needSolid = true;
|
||||
|
||||
if (IsLZMAMethod(oneMethodInfo.MethodName))
|
||||
{
|
||||
UInt32 dicSize =
|
||||
(level >= 9 ? kLzmaDicSizeX9 :
|
||||
(level >= 7 ? kLzmaDicSizeX7 :
|
||||
(level >= 5 ? kLzmaDicSizeX5 :
|
||||
(level >= 3 ? kLzmaDicSizeX3 :
|
||||
kLzmaDicSizeX1))));
|
||||
|
||||
UInt32 algorithm =
|
||||
(level >= 5 ? kLzmaAlgorithmX5 :
|
||||
kLzmaAlgorithmX1);
|
||||
|
||||
UInt32 fastBytes =
|
||||
(level >= 7 ? kLzmaFastBytesX7 :
|
||||
kLzmaFastBytesX1);
|
||||
|
||||
const wchar_t *matchFinder =
|
||||
(level >= 5 ? kLzmaMatchFinderX5 :
|
||||
kLzmaMatchFinderX1);
|
||||
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kDictionarySize, dicSize);
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kAlgorithm, algorithm);
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumFastBytes, fastBytes);
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kMatchFinder, matchFinder);
|
||||
#ifdef COMPRESS_MT
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumThreads, numThreads);
|
||||
#endif
|
||||
}
|
||||
else if (IsDeflateMethod(oneMethodInfo.MethodName))
|
||||
{
|
||||
UInt32 fastBytes =
|
||||
(level >= 9 ? kDeflateFastBytesX9 :
|
||||
(level >= 7 ? kDeflateFastBytesX7 :
|
||||
kDeflateFastBytesX1));
|
||||
|
||||
UInt32 numPasses =
|
||||
(level >= 9 ? kDeflatePassesX9 :
|
||||
(level >= 7 ? kDeflatePassesX7 :
|
||||
kDeflatePassesX1));
|
||||
UInt32 algo =
|
||||
(level >= 5 ? kDeflateAlgoX5 :
|
||||
kDeflateAlgoX1);
|
||||
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kAlgorithm, algo);
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumFastBytes, fastBytes);
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumPasses, numPasses);
|
||||
}
|
||||
else if (IsBZip2Method(oneMethodInfo.MethodName))
|
||||
{
|
||||
UInt32 numPasses =
|
||||
(level >= 9 ? kBZip2NumPassesX9 :
|
||||
(level >= 7 ? kBZip2NumPassesX7 :
|
||||
kBZip2NumPassesX1));
|
||||
|
||||
UInt32 dicSize =
|
||||
(level >= 5 ? kBZip2DicSizeX5 :
|
||||
(level >= 3 ? kBZip2DicSizeX3 :
|
||||
kBZip2DicSizeX1));
|
||||
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumPasses, numPasses);
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kDictionarySize, dicSize);
|
||||
#ifdef COMPRESS_MT
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumThreads, numThreads);
|
||||
#endif
|
||||
}
|
||||
else if (IsPpmdMethod(oneMethodInfo.MethodName))
|
||||
{
|
||||
UInt32 useMemSize =
|
||||
(level >= 9 ? kPpmdMemSizeX9 :
|
||||
(level >= 7 ? kPpmdMemSizeX7 :
|
||||
(level >= 5 ? kPpmdMemSizeX5 :
|
||||
kPpmdMemSizeX1)));
|
||||
|
||||
UInt32 order =
|
||||
(level >= 9 ? kPpmdOrderX9 :
|
||||
(level >= 7 ? kPpmdOrderX7 :
|
||||
(level >= 5 ? kPpmdOrderX5 :
|
||||
kPpmdOrderX1)));
|
||||
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kUsedMemorySize, useMemSize);
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kOrder, order);
|
||||
}
|
||||
|
||||
|
||||
CMethodFull methodFull;
|
||||
|
||||
if (!FindMethod(
|
||||
EXTERNAL_CODECS_VARS
|
||||
oneMethodInfo.MethodName, methodFull.MethodID, methodFull.NumInStreams, methodFull.NumOutStreams))
|
||||
oneMethodInfo.MethodName, methodFull.Id, methodFull.NumInStreams, methodFull.NumOutStreams))
|
||||
return E_INVALIDARG;
|
||||
methodFull.CoderProperties = oneMethodInfo.CoderProperties;
|
||||
methodFull.Properties = oneMethodInfo.Properties;
|
||||
methodMode.Methods.Add(methodFull);
|
||||
|
||||
if (!_numSolidBytesDefined)
|
||||
{
|
||||
for (int j = 0; j < methodFull.CoderProperties.Size(); j++)
|
||||
for (int j = 0; j < methodFull.Properties.Size(); j++)
|
||||
{
|
||||
const CProperty &prop = methodFull.CoderProperties[j];
|
||||
if ((prop.PropID == NCoderPropID::kDictionarySize ||
|
||||
prop.PropID == NCoderPropID::kUsedMemorySize) && prop.Value.vt == VT_UI4)
|
||||
const CProp &prop = methodFull.Properties[j];
|
||||
if ((prop.Id == NCoderPropID::kDictionarySize ||
|
||||
prop.Id == NCoderPropID::kUsedMemorySize) && prop.Value.vt == VT_UI4)
|
||||
{
|
||||
_numSolidBytes = ((UInt64)prop.Value.ulVal) << 7;
|
||||
const UInt64 kMinSize = (1 << 24);
|
||||
@@ -652,198 +430,11 @@ static HRESULT GetBindInfo(UString &srcString, CBind &bind)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static void SplitParams(const UString &srcString, UStringVector &subStrings)
|
||||
{
|
||||
subStrings.Clear();
|
||||
UString name;
|
||||
int len = srcString.Length();
|
||||
if (len == 0)
|
||||
return;
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
wchar_t c = srcString[i];
|
||||
if (c == L':')
|
||||
{
|
||||
subStrings.Add(name);
|
||||
name.Empty();
|
||||
}
|
||||
else
|
||||
name += c;
|
||||
}
|
||||
subStrings.Add(name);
|
||||
}
|
||||
|
||||
static void SplitParam(const UString ¶m, UString &name, UString &value)
|
||||
{
|
||||
int eqPos = param.Find(L'=');
|
||||
if (eqPos >= 0)
|
||||
{
|
||||
name = param.Left(eqPos);
|
||||
value = param.Mid(eqPos + 1);
|
||||
return;
|
||||
}
|
||||
for(int i = 0; i < param.Length(); i++)
|
||||
{
|
||||
wchar_t c = param[i];
|
||||
if (c >= L'0' && c <= L'9')
|
||||
{
|
||||
name = param.Left(i);
|
||||
value = param.Mid(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
name = param;
|
||||
}
|
||||
|
||||
HRESULT CHandler::SetParam(COneMethodInfo &oneMethodInfo, const UString &name, const UString &value)
|
||||
{
|
||||
CProperty property;
|
||||
if (name.CompareNoCase(L"D") == 0 || name.CompareNoCase(L"MEM") == 0)
|
||||
{
|
||||
UInt32 dicSize;
|
||||
RINOK(ParsePropDictionaryValue(value, dicSize));
|
||||
if (name.CompareNoCase(L"D") == 0)
|
||||
property.PropID = NCoderPropID::kDictionarySize;
|
||||
else
|
||||
property.PropID = NCoderPropID::kUsedMemorySize;
|
||||
property.Value = dicSize;
|
||||
oneMethodInfo.CoderProperties.Add(property);
|
||||
}
|
||||
else
|
||||
{
|
||||
int index = FindPropIdFromStringName(name);
|
||||
if (index < 0)
|
||||
return E_INVALIDARG;
|
||||
|
||||
const CNameToPropID &nameToPropID = g_NameToPropID[index];
|
||||
property.PropID = nameToPropID.PropID;
|
||||
|
||||
NCOM::CPropVariant propValue;
|
||||
|
||||
|
||||
if (nameToPropID.VarType == VT_BSTR)
|
||||
propValue = value;
|
||||
else
|
||||
{
|
||||
UInt32 number;
|
||||
if (ParseStringToUInt32(value, number) == value.Length())
|
||||
propValue = number;
|
||||
else
|
||||
propValue = value;
|
||||
}
|
||||
|
||||
if (!ConvertProperty(propValue, nameToPropID.VarType, property.Value))
|
||||
return E_INVALIDARG;
|
||||
|
||||
oneMethodInfo.CoderProperties.Add(property);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CHandler::SetParams(COneMethodInfo &oneMethodInfo, const UString &srcString)
|
||||
{
|
||||
UStringVector params;
|
||||
SplitParams(srcString, params);
|
||||
if (params.Size() > 0)
|
||||
oneMethodInfo.MethodName = params[0];
|
||||
for (int i = 1; i < params.Size(); i++)
|
||||
{
|
||||
const UString ¶m = params[i];
|
||||
UString name, value;
|
||||
SplitParam(param, name, value);
|
||||
RINOK(SetParam(oneMethodInfo, name, value));
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CHandler::SetSolidSettings(const UString &s)
|
||||
{
|
||||
UString s2 = s;
|
||||
s2.MakeUpper();
|
||||
if (s2.IsEmpty() || s2.Compare(L"ON") == 0)
|
||||
{
|
||||
InitSolid();
|
||||
return S_OK;
|
||||
}
|
||||
if (s2.Compare(L"OFF") == 0)
|
||||
{
|
||||
_numSolidFiles = 1;
|
||||
return S_OK;
|
||||
}
|
||||
for (int i = 0; i < s2.Length();)
|
||||
{
|
||||
const wchar_t *start = ((const wchar_t *)s2) + i;
|
||||
const wchar_t *end;
|
||||
UInt64 v = ConvertStringToUInt64(start, &end);
|
||||
if (start == end)
|
||||
{
|
||||
if (s2[i++] != 'E')
|
||||
return E_INVALIDARG;
|
||||
_solidExtension = true;
|
||||
continue;
|
||||
}
|
||||
i += (int)(end - start);
|
||||
if (i == s2.Length())
|
||||
return E_INVALIDARG;
|
||||
wchar_t c = s2[i++];
|
||||
switch(c)
|
||||
{
|
||||
case 'F':
|
||||
if (v < 1)
|
||||
v = 1;
|
||||
_numSolidFiles = v;
|
||||
break;
|
||||
case 'B':
|
||||
_numSolidBytes = v;
|
||||
_numSolidBytesDefined = true;
|
||||
break;
|
||||
case 'K':
|
||||
_numSolidBytes = (v << 10);
|
||||
_numSolidBytesDefined = true;
|
||||
break;
|
||||
case 'M':
|
||||
_numSolidBytes = (v << 20);
|
||||
_numSolidBytesDefined = true;
|
||||
break;
|
||||
case 'G':
|
||||
_numSolidBytes = (v << 30);
|
||||
_numSolidBytesDefined = true;
|
||||
break;
|
||||
default:
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CHandler::SetSolidSettings(const PROPVARIANT &value)
|
||||
{
|
||||
switch(value.vt)
|
||||
{
|
||||
case VT_EMPTY:
|
||||
InitSolid();
|
||||
return S_OK;
|
||||
case VT_BSTR:
|
||||
return SetSolidSettings(value.bstrVal);
|
||||
default:
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
}
|
||||
|
||||
STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties)
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
_methods.Clear();
|
||||
_binds.Clear();
|
||||
Init();
|
||||
#ifdef COMPRESS_MT
|
||||
const UInt32 numProcessors = NSystem::GetNumberOfProcessors();
|
||||
#endif
|
||||
|
||||
UInt32 mainDicSize = 0xFFFFFFFF;
|
||||
UInt32 mainDicMethodIndex = 0xFFFFFFFF;
|
||||
|
||||
UInt32 minNumber = 0;
|
||||
BeforeSetProperty();
|
||||
|
||||
for (int i = 0; i < numProperties; i++)
|
||||
{
|
||||
@@ -854,14 +445,6 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v
|
||||
|
||||
const PROPVARIANT &value = values[i];
|
||||
|
||||
if (name[0] == 'X')
|
||||
{
|
||||
name.Delete(0);
|
||||
_level = 9;
|
||||
RINOK(ParsePropValue(name, value, _level));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (name[0] == 'B')
|
||||
{
|
||||
name.Delete(0);
|
||||
@@ -871,142 +454,7 @@ STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *v
|
||||
continue;
|
||||
}
|
||||
|
||||
if (name[0] == L'S')
|
||||
{
|
||||
name.Delete(0);
|
||||
if (name.IsEmpty())
|
||||
{
|
||||
RINOK(SetSolidSettings(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
RINOK(SetSolidSettings(name));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
UInt32 number;
|
||||
int index = ParseStringToUInt32(name, number);
|
||||
UString realName = name.Mid(index);
|
||||
if (index == 0)
|
||||
{
|
||||
if(name.Left(2).CompareNoCase(L"MT") == 0)
|
||||
{
|
||||
#ifdef COMPRESS_MT
|
||||
RINOK(ParseMtProp(name.Mid(2), value, numProcessors, _numThreads));
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
else if (name.CompareNoCase(L"RSFX") == 0)
|
||||
{
|
||||
RINOK(SetBoolProperty(_removeSfxBlock, value));
|
||||
continue;
|
||||
}
|
||||
else if (name.CompareNoCase(L"F") == 0)
|
||||
{
|
||||
RINOK(SetBoolProperty(_autoFilter, value));
|
||||
continue;
|
||||
}
|
||||
else if (name.CompareNoCase(L"HC") == 0)
|
||||
{
|
||||
RINOK(SetBoolProperty(_compressHeaders, value));
|
||||
continue;
|
||||
}
|
||||
else if (name.CompareNoCase(L"HCF") == 0)
|
||||
{
|
||||
bool compressHeadersFull = true;
|
||||
RINOK(SetBoolProperty(compressHeadersFull, value));
|
||||
if (!compressHeadersFull)
|
||||
return E_INVALIDARG;
|
||||
continue;
|
||||
}
|
||||
else if (name.CompareNoCase(L"HE") == 0)
|
||||
{
|
||||
RINOK(SetBoolProperty(_encryptHeaders, value));
|
||||
continue;
|
||||
}
|
||||
else if (name.CompareNoCase(L"TM") == 0)
|
||||
{
|
||||
RINOK(SetBoolProperty(WriteModified, value));
|
||||
continue;
|
||||
}
|
||||
else if (name.CompareNoCase(L"TC") == 0)
|
||||
{
|
||||
RINOK(SetBoolProperty(WriteCreated, value));
|
||||
continue;
|
||||
}
|
||||
else if (name.CompareNoCase(L"TA") == 0)
|
||||
{
|
||||
RINOK(SetBoolProperty(WriteAccessed, value));
|
||||
continue;
|
||||
}
|
||||
else if (name.CompareNoCase(L"V") == 0)
|
||||
{
|
||||
RINOK(SetBoolProperty(_volumeMode, value));
|
||||
continue;
|
||||
}
|
||||
number = 0;
|
||||
}
|
||||
if (number > 10000)
|
||||
return E_FAIL;
|
||||
if (number < minNumber)
|
||||
return E_INVALIDARG;
|
||||
number -= minNumber;
|
||||
for(int j = _methods.Size(); j <= (int)number; j++)
|
||||
{
|
||||
COneMethodInfo oneMethodInfo;
|
||||
_methods.Add(oneMethodInfo);
|
||||
}
|
||||
|
||||
COneMethodInfo &oneMethodInfo = _methods[number];
|
||||
|
||||
if (realName.Length() == 0)
|
||||
{
|
||||
if (value.vt != VT_BSTR)
|
||||
return E_INVALIDARG;
|
||||
|
||||
// oneMethodInfo.MethodName = UnicodeStringToMultiByte(UString(value.bstrVal));
|
||||
RINOK(SetParams(oneMethodInfo, value.bstrVal));
|
||||
}
|
||||
else
|
||||
{
|
||||
CProperty property;
|
||||
if (realName.Left(1).CompareNoCase(L"D") == 0)
|
||||
{
|
||||
UInt32 dicSize;
|
||||
RINOK(ParsePropDictionaryValue(realName.Mid(1), value, dicSize));
|
||||
property.PropID = NCoderPropID::kDictionarySize;
|
||||
property.Value = dicSize;
|
||||
oneMethodInfo.CoderProperties.Add(property);
|
||||
if (number <= mainDicMethodIndex)
|
||||
mainDicSize = dicSize;
|
||||
}
|
||||
else if (realName.Left(3).CompareNoCase(L"MEM") == 0)
|
||||
{
|
||||
UInt32 dicSize;
|
||||
RINOK(ParsePropDictionaryValue(realName.Mid(3), value, dicSize));
|
||||
property.PropID = NCoderPropID::kUsedMemorySize;
|
||||
property.Value = dicSize;
|
||||
oneMethodInfo.CoderProperties.Add(property);
|
||||
if (number <= mainDicMethodIndex)
|
||||
mainDicSize = dicSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
int index = FindPropIdFromStringName(realName);
|
||||
if (index < 0)
|
||||
return E_INVALIDARG;
|
||||
|
||||
const CNameToPropID &nameToPropID = g_NameToPropID[index];
|
||||
property.PropID = nameToPropID.PropID;
|
||||
|
||||
if (!ConvertProperty(value, nameToPropID.VarType, property.Value))
|
||||
return E_INVALIDARG;
|
||||
|
||||
oneMethodInfo.CoderProperties.Add(property);
|
||||
}
|
||||
}
|
||||
RINOK(SetProperty(name, value));
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
|
||||
@@ -7,12 +7,20 @@ namespace NArchive {
|
||||
namespace N7z {
|
||||
|
||||
Byte kSignature[kSignatureSize] = {'7' + 1, 'z', 0xBC, 0xAF, 0x27, 0x1C};
|
||||
#ifdef _7Z_VOL
|
||||
Byte kFinishSignature[kSignatureSize] = {'7' + 1, 'z', 0xBC, 0xAF, 0x27, 0x1C + 1};
|
||||
#endif
|
||||
|
||||
class SignatureInitializer
|
||||
{
|
||||
public:
|
||||
SignatureInitializer() { kSignature[0]--; kFinishSignature[0]--;};
|
||||
SignatureInitializer()
|
||||
{
|
||||
kSignature[0]--;
|
||||
#ifdef _7Z_VOL
|
||||
kFinishSignature[0]--;
|
||||
#endif
|
||||
};
|
||||
} g_SignatureInitializer;
|
||||
|
||||
}}
|
||||
|
||||
@@ -12,7 +12,9 @@ extern "C"
|
||||
}
|
||||
|
||||
// define FORMAT_7Z_RECOVERY if you want to recover multivolume archives with empty StartHeader
|
||||
// #define FORMAT_7Z_RECOVERY
|
||||
#ifndef _SFX
|
||||
#define FORMAT_7Z_RECOVERY
|
||||
#endif
|
||||
|
||||
namespace NArchive {
|
||||
namespace N7z {
|
||||
@@ -1268,13 +1270,13 @@ HRESULT CInArchive::ReadDatabase(
|
||||
return S_FALSE;
|
||||
nextHeaderSize = realProcessedSize - i;
|
||||
nextHeaderOffset = cur2 - cur + i;
|
||||
nextHeaderCRC = CCRC::CalculateDigest(buf + i, (size_t)nextHeaderSize);
|
||||
nextHeaderCRC = CrcCalc(buf + i, (size_t)nextHeaderSize);
|
||||
RINOK(_stream->Seek(cur, STREAM_SEEK_SET, &_position));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FORMAT_7Z_RECOVERY
|
||||
crcFromArchive = crc.GetDigest();
|
||||
crcFromArchive = CRC_GET_DIGEST(crc);
|
||||
#endif
|
||||
|
||||
#ifdef _7Z_VOL
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#define __7Z_ITEM_H
|
||||
|
||||
#include "../../../Common/Buffer.h"
|
||||
#include "../../../Common/String.h"
|
||||
#include "../../../Common/MyString.h"
|
||||
#include "../../Common/MethodId.h"
|
||||
#include "7zHeader.h"
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ HRESULT COutArchive::Create(ISequentialOutStream *stream, bool endMarker)
|
||||
{
|
||||
if (!Stream)
|
||||
return E_FAIL;
|
||||
WriteSignature();
|
||||
RINOK(WriteSignature());
|
||||
RINOK(Stream->Seek(0, STREAM_SEEK_CUR, &_prefixHeaderPos));
|
||||
}
|
||||
return S_OK;
|
||||
|
||||
@@ -357,7 +357,7 @@ static const UInt64 k_BCJ2 = 0x0303011B;
|
||||
static bool GetMethodFull(UInt64 methodID,
|
||||
UInt32 numInStreams, CMethodFull &methodResult)
|
||||
{
|
||||
methodResult.MethodID = methodID;
|
||||
methodResult.Id = methodID;
|
||||
methodResult.NumInStreams = numInStreams;
|
||||
methodResult.NumOutStreams = 1;
|
||||
return true;
|
||||
@@ -376,28 +376,28 @@ static bool MakeExeMethod(const CCompressionMethodMode &method,
|
||||
if (!GetMethodFull(k_LZMA, 1, methodFull))
|
||||
return false;
|
||||
{
|
||||
CProperty property;
|
||||
property.PropID = NCoderPropID::kAlgorithm;
|
||||
CProp property;
|
||||
property.Id = NCoderPropID::kAlgorithm;
|
||||
property.Value = kAlgorithmForBCJ2_LZMA;
|
||||
methodFull.CoderProperties.Add(property);
|
||||
methodFull.Properties.Add(property);
|
||||
}
|
||||
{
|
||||
CProperty property;
|
||||
property.PropID = NCoderPropID::kMatchFinder;
|
||||
CProp property;
|
||||
property.Id = NCoderPropID::kMatchFinder;
|
||||
property.Value = kMatchFinderForBCJ2_LZMA;
|
||||
methodFull.CoderProperties.Add(property);
|
||||
methodFull.Properties.Add(property);
|
||||
}
|
||||
{
|
||||
CProperty property;
|
||||
property.PropID = NCoderPropID::kDictionarySize;
|
||||
CProp property;
|
||||
property.Id = NCoderPropID::kDictionarySize;
|
||||
property.Value = kDictionaryForBCJ2_LZMA;
|
||||
methodFull.CoderProperties.Add(property);
|
||||
methodFull.Properties.Add(property);
|
||||
}
|
||||
{
|
||||
CProperty property;
|
||||
property.PropID = NCoderPropID::kNumFastBytes;
|
||||
CProp property;
|
||||
property.Id = NCoderPropID::kNumFastBytes;
|
||||
property.Value = kNumFastBytesForBCJ2_LZMA;
|
||||
methodFull.CoderProperties.Add(property);
|
||||
methodFull.Properties.Add(property);
|
||||
}
|
||||
|
||||
exeMethod.Methods.Add(methodFull);
|
||||
|
||||
@@ -31,10 +31,10 @@ COMMON_OBJS = \
|
||||
$O\CRC.obj \
|
||||
$O\IntToString.obj \
|
||||
$O\NewHandler.obj \
|
||||
$O\String.obj \
|
||||
$O\MyString.obj \
|
||||
$O\StringConvert.obj \
|
||||
$O\StringToInt.obj \
|
||||
$O\Vector.obj \
|
||||
$O\MyVector.obj \
|
||||
|
||||
WIN_OBJS = \
|
||||
$O\DLL.obj \
|
||||
@@ -42,7 +42,8 @@ WIN_OBJS = \
|
||||
$O\FileFind.obj \
|
||||
$O\FileIO.obj \
|
||||
$O\PropVariant.obj \
|
||||
$O\Synchronization.obj
|
||||
$O\Synchronization.obj \
|
||||
$O\System.obj \
|
||||
|
||||
7ZIP_COMMON_OBJS = \
|
||||
$O\CreateCoder.obj \
|
||||
@@ -51,16 +52,19 @@ WIN_OBJS = \
|
||||
$O\LimitedStreams.obj \
|
||||
$O\LockedStream.obj \
|
||||
$O\MethodId.obj \
|
||||
$O\MethodProps.obj \
|
||||
$O\OutBuffer.obj \
|
||||
$O\ProgressUtils.obj \
|
||||
$O\StreamBinder.obj \
|
||||
$O\StreamObjects.obj \
|
||||
$O\StreamUtils.obj \
|
||||
$O\VirtThread.obj \
|
||||
|
||||
AR_COMMON_OBJS = \
|
||||
$O\CoderMixer2.obj \
|
||||
$O\CoderMixer2MT.obj \
|
||||
$O\CrossThreadProgress.obj \
|
||||
$O\HandlerOut.obj \
|
||||
$O\InStreamWithCRC.obj \
|
||||
$O\ItemNameUtils.obj \
|
||||
$O\MultiStream.obj \
|
||||
@@ -69,6 +73,7 @@ AR_COMMON_OBJS = \
|
||||
|
||||
C_OBJS = \
|
||||
$O\Alloc.obj \
|
||||
$O\Threads.obj \
|
||||
|
||||
!include "../../Crc2.mak"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#define __ARCHIVE_ARJ_ITEM_H
|
||||
|
||||
#include "Common/Types.h"
|
||||
#include "Common/String.h"
|
||||
#include "Common/MyString.h"
|
||||
#include "ArjHeader.h"
|
||||
|
||||
namespace NArchive {
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
#include "BZip2Update.h"
|
||||
|
||||
#include "Common/Defs.h"
|
||||
#include "Common/String.h"
|
||||
|
||||
#include "Windows/PropVariant.h"
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#define __ARCHIVE_CAB_ITEM_H
|
||||
|
||||
#include "Common/Types.h"
|
||||
#include "Common/String.h"
|
||||
#include "Common/MyString.h"
|
||||
#include "CabHeader.h"
|
||||
|
||||
namespace NArchive {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#ifndef __ARCHIVE_CHM_IN_H
|
||||
#define __ARCHIVE_CHM_IN_H
|
||||
|
||||
#include "Common/String.h"
|
||||
#include "Common/MyString.h"
|
||||
#include "Common/Buffer.h"
|
||||
#include "../../IStream.h"
|
||||
#include "../../Common/InBuffer.h"
|
||||
|
||||
Executable
+19
@@ -0,0 +1,19 @@
|
||||
// CoderMixer.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "CoderMixer.h"
|
||||
|
||||
namespace NCoderMixer {
|
||||
|
||||
void CCoderInfo::SetCoderInfo(const UInt64 *inSize, const UInt64 *outSize)
|
||||
{
|
||||
InSizeAssigned = (inSize != 0);
|
||||
if (InSizeAssigned)
|
||||
InSizeValue = *inSize;
|
||||
OutSizeAssigned = (outSize != 0);
|
||||
if (OutSizeAssigned)
|
||||
OutSizeValue = *outSize;
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
// CoderMixer.h
|
||||
|
||||
#ifndef __CODER_MIXER_H
|
||||
#define __CODER_MIXER_H
|
||||
|
||||
#include "../../../Common/MyCom.h"
|
||||
#include "../../ICoder.h"
|
||||
|
||||
namespace NCoderMixer {
|
||||
|
||||
struct CCoderInfo
|
||||
{
|
||||
CMyComPtr<ICompressCoder> Coder;
|
||||
CMyComPtr<ISequentialInStream> InStream;
|
||||
CMyComPtr<ISequentialOutStream> OutStream;
|
||||
CMyComPtr<ICompressProgressInfo> Progress;
|
||||
|
||||
UInt64 InSizeValue;
|
||||
UInt64 OutSizeValue;
|
||||
bool InSizeAssigned;
|
||||
bool OutSizeAssigned;
|
||||
|
||||
void ReInit()
|
||||
{
|
||||
InSizeAssigned = OutSizeAssigned = false;
|
||||
}
|
||||
|
||||
void SetCoderInfo(const UInt64 *inSize, const UInt64 *outSize);
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "CoderMixer2.h"
|
||||
|
||||
namespace NCoderMixer2 {
|
||||
namespace NCoderMixer {
|
||||
|
||||
CBindReverseConverter::CBindReverseConverter(const CBindInfo &srcBindInfo):
|
||||
_srcBindInfo(srcBindInfo)
|
||||
@@ -81,7 +81,7 @@ void CBindReverseConverter::CreateReverseBindInfo(CBindInfo &destBindInfo)
|
||||
destBindInfo.InStreams.Add(_srcOutToDestInMap[_srcBindInfo.OutStreams[i]]);
|
||||
}
|
||||
|
||||
CCoderInfo::CCoderInfo(UInt32 numInStreams, UInt32 numOutStreams):
|
||||
CCoderInfo2::CCoderInfo2(UInt32 numInStreams, UInt32 numOutStreams):
|
||||
NumInStreams(numInStreams),
|
||||
NumOutStreams(numOutStreams)
|
||||
{
|
||||
@@ -111,7 +111,7 @@ static void SetSizes(const UInt64 **srcSizes, CRecordVector<UInt64> &sizes,
|
||||
}
|
||||
}
|
||||
|
||||
void CCoderInfo::SetCoderInfo(const UInt64 **inSizes,
|
||||
void CCoderInfo2::SetCoderInfo(const UInt64 **inSizes,
|
||||
const UInt64 **outSizes)
|
||||
{
|
||||
SetSizes(inSizes, InSizes, InSizePointers, NumInStreams);
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
#ifndef __CODER_MIXER2_H
|
||||
#define __CODER_MIXER2_H
|
||||
|
||||
#include "../../../Common/Vector.h"
|
||||
#include "../../../Common/MyVector.h"
|
||||
#include "../../../Common/Types.h"
|
||||
#include "../../../Common/MyCom.h"
|
||||
#include "../../ICoder.h"
|
||||
|
||||
namespace NCoderMixer2 {
|
||||
namespace NCoderMixer {
|
||||
|
||||
struct CBindPair
|
||||
{
|
||||
@@ -127,7 +127,7 @@ struct CBindInfo
|
||||
class CBindReverseConverter
|
||||
{
|
||||
UInt32 _numSrcOutStreams;
|
||||
NCoderMixer2::CBindInfo _srcBindInfo;
|
||||
NCoderMixer::CBindInfo _srcBindInfo;
|
||||
CRecordVector<UInt32> _srcInToDestOutMap;
|
||||
CRecordVector<UInt32> _srcOutToDestInMap;
|
||||
CRecordVector<UInt32> _destInToSrcOutMap;
|
||||
@@ -135,11 +135,11 @@ public:
|
||||
UInt32 NumSrcInStreams;
|
||||
CRecordVector<UInt32> DestOutToSrcInMap;
|
||||
|
||||
CBindReverseConverter(const NCoderMixer2::CBindInfo &srcBindInfo);
|
||||
void CreateReverseBindInfo(NCoderMixer2::CBindInfo &destBindInfo);
|
||||
CBindReverseConverter(const NCoderMixer::CBindInfo &srcBindInfo);
|
||||
void CreateReverseBindInfo(NCoderMixer::CBindInfo &destBindInfo);
|
||||
};
|
||||
|
||||
struct CCoderInfo
|
||||
struct CCoderInfo2
|
||||
{
|
||||
CMyComPtr<ICompressCoder> Coder;
|
||||
CMyComPtr<ICompressCoder2> Coder2;
|
||||
@@ -151,8 +151,14 @@ struct CCoderInfo
|
||||
CRecordVector<const UInt64 *> InSizePointers;
|
||||
CRecordVector<const UInt64 *> OutSizePointers;
|
||||
|
||||
CCoderInfo(UInt32 numInStreams, UInt32 numOutStreams);
|
||||
CCoderInfo2(UInt32 numInStreams, UInt32 numOutStreams);
|
||||
void SetCoderInfo(const UInt64 **inSizes, const UInt64 **outSizes);
|
||||
|
||||
HRESULT QueryInterface(REFGUID iid, void** pp) const
|
||||
{
|
||||
IUnknown *p = Coder ? (IUnknown *)Coder : (IUnknown *)Coder2;
|
||||
return p->QueryInterface(iid, pp);
|
||||
}
|
||||
};
|
||||
|
||||
class CCoderMixer2
|
||||
|
||||
@@ -3,16 +3,11 @@
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "CoderMixer2MT.h"
|
||||
#include "CrossThreadProgress.h"
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NSynchronization;
|
||||
namespace NCoderMixer {
|
||||
|
||||
namespace NCoderMixer2 {
|
||||
|
||||
CThreadCoderInfo::CThreadCoderInfo(UInt32 numInStreams, UInt32 numOutStreams):
|
||||
ExitEvent(NULL),
|
||||
CCoderInfo(numInStreams, numOutStreams)
|
||||
CCoder2::CCoder2(UInt32 numInStreams, UInt32 numOutStreams):
|
||||
CCoderInfo2(numInStreams, numOutStreams)
|
||||
{
|
||||
InStreams.Reserve(NumInStreams);
|
||||
InStreamPointers.Reserve(NumInStreams);
|
||||
@@ -20,62 +15,38 @@ CThreadCoderInfo::CThreadCoderInfo(UInt32 numInStreams, UInt32 numOutStreams):
|
||||
OutStreamPointers.Reserve(NumOutStreams);
|
||||
}
|
||||
|
||||
class CCoderInfoFlusher2
|
||||
void CCoder2::Execute() { Code(NULL); }
|
||||
|
||||
void CCoder2::Code(ICompressProgressInfo *progress)
|
||||
{
|
||||
CThreadCoderInfo *m_CoderInfo;
|
||||
public:
|
||||
CCoderInfoFlusher2(CThreadCoderInfo *coderInfo): m_CoderInfo(coderInfo) {}
|
||||
~CCoderInfoFlusher2()
|
||||
InStreamPointers.Clear();
|
||||
OutStreamPointers.Clear();
|
||||
UInt32 i;
|
||||
for (i = 0; i < NumInStreams; i++)
|
||||
{
|
||||
if (InSizePointers[i] != NULL)
|
||||
InSizePointers[i] = &InSizes[i];
|
||||
InStreamPointers.Add(InStreams[i]);
|
||||
}
|
||||
for (i = 0; i < NumOutStreams; i++)
|
||||
{
|
||||
if (OutSizePointers[i] != NULL)
|
||||
OutSizePointers[i] = &OutSizes[i];
|
||||
OutStreamPointers.Add(OutStreams[i]);
|
||||
}
|
||||
if (Coder)
|
||||
Result = Coder->Code(InStreamPointers[0], OutStreamPointers[0],
|
||||
InSizePointers[0], OutSizePointers[0], progress);
|
||||
else
|
||||
Result = Coder2->Code(&InStreamPointers.Front(), &InSizePointers.Front(), NumInStreams,
|
||||
&OutStreamPointers.Front(), &OutSizePointers.Front(), NumOutStreams, progress);
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < m_CoderInfo->InStreams.Size(); i++)
|
||||
m_CoderInfo->InStreams[i].Release();
|
||||
for (i = 0; i < m_CoderInfo->OutStreams.Size(); i++)
|
||||
m_CoderInfo->OutStreams[i].Release();
|
||||
m_CoderInfo->CompressionCompletedEvent.Set();
|
||||
for (i = 0; i < InStreams.Size(); i++)
|
||||
InStreams[i].Release();
|
||||
for (i = 0; i < OutStreams.Size(); i++)
|
||||
OutStreams[i].Release();
|
||||
}
|
||||
};
|
||||
|
||||
bool CThreadCoderInfo::WaitAndCode()
|
||||
{
|
||||
HANDLE events[2] = { ExitEvent, CompressEvent };
|
||||
DWORD waitResult = ::WaitForMultipleObjects(2, events, FALSE, INFINITE);
|
||||
if (waitResult == WAIT_OBJECT_0 + 0)
|
||||
return false;
|
||||
|
||||
{
|
||||
InStreamPointers.Clear();
|
||||
OutStreamPointers.Clear();
|
||||
UInt32 i;
|
||||
for (i = 0; i < NumInStreams; i++)
|
||||
{
|
||||
if (InSizePointers[i] != NULL)
|
||||
InSizePointers[i] = &InSizes[i];
|
||||
InStreamPointers.Add(InStreams[i]);
|
||||
}
|
||||
for (i = 0; i < NumOutStreams; i++)
|
||||
{
|
||||
if (OutSizePointers[i] != NULL)
|
||||
OutSizePointers[i] = &OutSizes[i];
|
||||
OutStreamPointers.Add(OutStreams[i]);
|
||||
}
|
||||
CCoderInfoFlusher2 coderInfoFlusher(this);
|
||||
if (Coder)
|
||||
Result = Coder->Code(InStreamPointers[0],
|
||||
OutStreamPointers[0],
|
||||
InSizePointers[0],
|
||||
OutSizePointers[0],
|
||||
Progress);
|
||||
else
|
||||
Result = Coder2->Code(&InStreamPointers.Front(),
|
||||
&InSizePointers.Front(),
|
||||
NumInStreams,
|
||||
&OutStreamPointers.Front(),
|
||||
&OutSizePointers.Front(),
|
||||
NumOutStreams,
|
||||
Progress);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void SetSizes(const UInt64 **srcSizes, CRecordVector<UInt64> &sizes,
|
||||
@@ -99,54 +70,15 @@ static void SetSizes(const UInt64 **srcSizes, CRecordVector<UInt64> &sizes,
|
||||
}
|
||||
|
||||
|
||||
void CThreadCoderInfo::SetCoderInfo(const UInt64 **inSizes,
|
||||
const UInt64 **outSizes, ICompressProgressInfo *progress)
|
||||
void CCoder2::SetCoderInfo(const UInt64 **inSizes, const UInt64 **outSizes)
|
||||
{
|
||||
Progress = progress;
|
||||
SetSizes(inSizes, InSizes, InSizePointers, NumInStreams);
|
||||
SetSizes(outSizes, OutSizes, OutSizePointers, NumOutStreams);
|
||||
}
|
||||
|
||||
static THREAD_FUNC_DECL CoderThread(void *threadCoderInfo)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
if (!((CThreadCoderInfo *)threadCoderInfo)->WaitAndCode())
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////
|
||||
// CCoderMixer2MT
|
||||
|
||||
static THREAD_FUNC_DECL MainCoderThread(void *threadCoderInfo)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
if (!((CCoderMixer2MT *)threadCoderInfo)->MyCode())
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
CCoderMixer2MT::CCoderMixer2MT()
|
||||
{
|
||||
if (CreateEvents() != S_OK)
|
||||
throw 271824;
|
||||
if (_mainThread.Create(MainCoderThread, this) != S_OK)
|
||||
throw 271825;
|
||||
}
|
||||
|
||||
CCoderMixer2MT::~CCoderMixer2MT()
|
||||
{
|
||||
_exitEvent.Set();
|
||||
_mainThread.Wait();
|
||||
for(int i = 0; i < _threads.Size(); i++)
|
||||
{
|
||||
_threads[i].Wait();
|
||||
_threads[i].Close();
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CCoderMixer2MT::SetBindInfo(const CBindInfo &bindInfo)
|
||||
{
|
||||
_bindInfo = bindInfo;
|
||||
@@ -161,48 +93,23 @@ HRESULT CCoderMixer2MT::SetBindInfo(const CBindInfo &bindInfo)
|
||||
|
||||
void CCoderMixer2MT::AddCoderCommon()
|
||||
{
|
||||
int index = _coderInfoVector.Size();
|
||||
const CCoderStreamsInfo &CoderStreamsInfo = _bindInfo.Coders[index];
|
||||
|
||||
CThreadCoderInfo threadCoderInfo(CoderStreamsInfo.NumInStreams,
|
||||
CoderStreamsInfo.NumOutStreams);
|
||||
_coderInfoVector.Add(threadCoderInfo);
|
||||
CThreadCoderInfo *tci = &_coderInfoVector.Back();
|
||||
tci->CreateEvents();
|
||||
tci->ExitEvent = _exitEvent;
|
||||
|
||||
NWindows::CThread newThread;
|
||||
_threads.Add(newThread);
|
||||
if (_threads.Back().Create(CoderThread, tci) != S_OK)
|
||||
throw 271824;
|
||||
const CCoderStreamsInfo &c = _bindInfo.Coders[_coders.Size()];
|
||||
CCoder2 threadCoderInfo(c.NumInStreams, c.NumOutStreams);
|
||||
_coders.Add(threadCoderInfo);
|
||||
}
|
||||
|
||||
void CCoderMixer2MT::AddCoder(ICompressCoder *coder)
|
||||
{
|
||||
AddCoderCommon();
|
||||
_coderInfoVector.Back().Coder = coder;
|
||||
_coders.Back().Coder = coder;
|
||||
}
|
||||
|
||||
void CCoderMixer2MT::AddCoder2(ICompressCoder2 *coder)
|
||||
{
|
||||
AddCoderCommon();
|
||||
_coderInfoVector.Back().Coder2 = coder;
|
||||
_coders.Back().Coder2 = coder;
|
||||
}
|
||||
|
||||
/*
|
||||
void CCoderMixer2MT::FinishAddingCoders()
|
||||
{
|
||||
for(int i = 0; i < _coderInfoVector.Size(); i++)
|
||||
{
|
||||
DWORD id;
|
||||
HANDLE newThread = ::CreateThread(NULL, 0, CoderThread,
|
||||
&_coderInfoVector[i], 0, &id);
|
||||
if (newThread == 0)
|
||||
throw 271824;
|
||||
_threads.Add(newThread);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void CCoderMixer2MT::ReInit()
|
||||
{
|
||||
@@ -211,17 +118,16 @@ void CCoderMixer2MT::ReInit()
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP CCoderMixer2MT::Init(ISequentialInStream **inStreams,
|
||||
ISequentialOutStream **outStreams)
|
||||
HRESULT CCoderMixer2MT::Init(ISequentialInStream **inStreams, ISequentialOutStream **outStreams)
|
||||
{
|
||||
/*
|
||||
if (_coderInfoVector.Size() != _bindInfo.Coders.Size())
|
||||
if (_coders.Size() != _bindInfo.Coders.Size())
|
||||
throw 0;
|
||||
*/
|
||||
int i;
|
||||
for(i = 0; i < _coderInfoVector.Size(); i++)
|
||||
for(i = 0; i < _coders.Size(); i++)
|
||||
{
|
||||
CThreadCoderInfo &coderInfo = _coderInfoVector[i];
|
||||
CCoder2 &coderInfo = _coders[i];
|
||||
const CCoderStreamsInfo &coderStreamsInfo = _bindInfo.Coders[i];
|
||||
coderInfo.InStreams.Clear();
|
||||
UInt32 j;
|
||||
@@ -241,45 +147,26 @@ STDMETHODIMP CCoderMixer2MT::Init(ISequentialInStream **inStreams,
|
||||
_bindInfo.FindOutStream(bindPair.OutIndex, outCoderIndex, outCoderStreamIndex);
|
||||
|
||||
_streamBinders[i].CreateStreams(
|
||||
&_coderInfoVector[inCoderIndex].InStreams[inCoderStreamIndex],
|
||||
&_coderInfoVector[outCoderIndex].OutStreams[outCoderStreamIndex]);
|
||||
&_coders[inCoderIndex].InStreams[inCoderStreamIndex],
|
||||
&_coders[outCoderIndex].OutStreams[outCoderStreamIndex]);
|
||||
}
|
||||
|
||||
for(i = 0; i < _bindInfo.InStreams.Size(); i++)
|
||||
{
|
||||
UInt32 inCoderIndex, inCoderStreamIndex;
|
||||
_bindInfo.FindInStream(_bindInfo.InStreams[i], inCoderIndex, inCoderStreamIndex);
|
||||
_coderInfoVector[inCoderIndex].InStreams[inCoderStreamIndex] = inStreams[i];
|
||||
_coders[inCoderIndex].InStreams[inCoderStreamIndex] = inStreams[i];
|
||||
}
|
||||
|
||||
for(i = 0; i < _bindInfo.OutStreams.Size(); i++)
|
||||
{
|
||||
UInt32 outCoderIndex, outCoderStreamIndex;
|
||||
_bindInfo.FindOutStream(_bindInfo.OutStreams[i], outCoderIndex, outCoderStreamIndex);
|
||||
_coderInfoVector[outCoderIndex].OutStreams[outCoderStreamIndex] = outStreams[i];
|
||||
_coders[outCoderIndex].OutStreams[outCoderStreamIndex] = outStreams[i];
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
bool CCoderMixer2MT::MyCode()
|
||||
{
|
||||
HANDLE events[2] = { _exitEvent, _startCompressingEvent };
|
||||
DWORD waitResult = ::WaitForMultipleObjects(2, events, FALSE, INFINITE);
|
||||
if (waitResult == WAIT_OBJECT_0 + 0)
|
||||
return false;
|
||||
|
||||
int i;
|
||||
for(i = 0; i < _coderInfoVector.Size(); i++)
|
||||
_coderInfoVector[i].CompressEvent.Set();
|
||||
for (i = 0; i < _coderInfoVector.Size(); i++)
|
||||
_coderInfoVector[i].CompressionCompletedEvent.Lock();
|
||||
|
||||
_compressingFinishedEvent.Set();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP CCoderMixer2MT::Code(ISequentialInStream **inStreams,
|
||||
const UInt64 ** /* inSizes */,
|
||||
UInt32 numInStreams,
|
||||
@@ -294,56 +181,48 @@ STDMETHODIMP CCoderMixer2MT::Code(ISequentialInStream **inStreams,
|
||||
|
||||
Init(inStreams, outStreams);
|
||||
|
||||
_compressingFinishedEvent.Reset(); // ?
|
||||
|
||||
CCrossThreadProgress *progressSpec = new CCrossThreadProgress;
|
||||
CMyComPtr<ICompressProgressInfo> crossProgress = progressSpec;
|
||||
RINOK(progressSpec->Create());
|
||||
progressSpec->Init();
|
||||
_coderInfoVector[_progressCoderIndex].Progress = crossProgress;
|
||||
|
||||
_startCompressingEvent.Set();
|
||||
|
||||
|
||||
for (;;)
|
||||
{
|
||||
HANDLE events[2] = {_compressingFinishedEvent, progressSpec->ProgressEvent };
|
||||
DWORD waitResult = ::WaitForMultipleObjects(2, events, FALSE, INFINITE);
|
||||
if (waitResult == WAIT_OBJECT_0 + 0)
|
||||
break;
|
||||
if (progress != NULL)
|
||||
progressSpec->Result = progress->SetRatioInfo(progressSpec->InSize,
|
||||
progressSpec->OutSize);
|
||||
else
|
||||
progressSpec->Result = S_OK;
|
||||
progressSpec->WaitEvent.Set();
|
||||
}
|
||||
|
||||
int i;
|
||||
for(i = 0; i < _coderInfoVector.Size(); i++)
|
||||
for (i = 0; i < _coders.Size(); i++)
|
||||
if (i != _progressCoderIndex)
|
||||
{
|
||||
RINOK(_coders[i].Create());
|
||||
}
|
||||
|
||||
for (i = 0; i < _coders.Size(); i++)
|
||||
if (i != _progressCoderIndex)
|
||||
_coders[i].Start();
|
||||
|
||||
_coders[_progressCoderIndex].Code(progress);
|
||||
|
||||
for (i = 0; i < _coders.Size(); i++)
|
||||
if (i != _progressCoderIndex)
|
||||
_coders[i].WaitFinish();
|
||||
|
||||
for (i = 0; i < _coders.Size(); i++)
|
||||
{
|
||||
HRESULT result = _coderInfoVector[i].Result;
|
||||
HRESULT result = _coders[i].Result;
|
||||
if (result == E_ABORT)
|
||||
return result;
|
||||
}
|
||||
for (i = 0; i < _coders.Size(); i++)
|
||||
{
|
||||
HRESULT result = _coders[i].Result;
|
||||
if (result == S_FALSE)
|
||||
return result;
|
||||
}
|
||||
for(i = 0; i < _coderInfoVector.Size(); i++)
|
||||
for (i = 0; i < _coders.Size(); i++)
|
||||
{
|
||||
HRESULT result = _coderInfoVector[i].Result;
|
||||
HRESULT result = _coders[i].Result;
|
||||
if (result != S_OK && result != E_FAIL)
|
||||
return result;
|
||||
}
|
||||
for(i = 0; i < _coderInfoVector.Size(); i++)
|
||||
for (i = 0; i < _coders.Size(); i++)
|
||||
{
|
||||
HRESULT result = _coderInfoVector[i].Result;
|
||||
HRESULT result = _coders[i].Result;
|
||||
if (result != S_OK)
|
||||
return result;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
UInt64 CCoderMixer2MT::GetWriteProcessedSize(UInt32 binderIndex) const
|
||||
{
|
||||
return _streamBinders[binderIndex].ProcessedSize;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,73 +5,55 @@
|
||||
|
||||
#include "CoderMixer2.h"
|
||||
#include "../../../Common/MyCom.h"
|
||||
#include "../../../Windows/Thread.h"
|
||||
#include "../../Common/StreamBinder.h"
|
||||
#include "../../Common/VirtThread.h"
|
||||
|
||||
namespace NCoderMixer2 {
|
||||
namespace NCoderMixer {
|
||||
|
||||
// CreateEvents();
|
||||
// {
|
||||
// SetCoderInfo()
|
||||
// Init Streams
|
||||
// set CompressEvent()
|
||||
// wait CompressionCompletedEvent
|
||||
// }
|
||||
|
||||
struct CThreadCoderInfo: public CCoderInfo
|
||||
struct CCoder2: public CCoderInfo2, public CVirtThread
|
||||
{
|
||||
NWindows::NSynchronization::CAutoResetEvent CompressEvent;
|
||||
HANDLE ExitEvent;
|
||||
NWindows::NSynchronization::CAutoResetEvent CompressionCompletedEvent;
|
||||
|
||||
HRESULT Result;
|
||||
CObjectVector< CMyComPtr<ISequentialInStream> > InStreams;
|
||||
CObjectVector< CMyComPtr<ISequentialOutStream> > OutStreams;
|
||||
CRecordVector<ISequentialInStream *> InStreamPointers;
|
||||
CRecordVector<ISequentialOutStream *> OutStreamPointers;
|
||||
CRecordVector<ISequentialInStream*> InStreamPointers;
|
||||
CRecordVector<ISequentialOutStream*> OutStreamPointers;
|
||||
|
||||
CMyComPtr<ICompressProgressInfo> Progress; // CMyComPtr
|
||||
HRESULT Result;
|
||||
|
||||
CThreadCoderInfo(UInt32 numInStreams, UInt32 numOutStreams);
|
||||
void SetCoderInfo(const UInt64 **inSizes,
|
||||
const UInt64 **outSizes, ICompressProgressInfo *progress);
|
||||
bool WaitAndCode();
|
||||
HRes CreateEvents()
|
||||
{
|
||||
RINOK(CompressEvent.CreateIfNotCreated());
|
||||
return CompressionCompletedEvent.CreateIfNotCreated();
|
||||
}
|
||||
CCoder2(UInt32 numInStreams, UInt32 numOutStreams);
|
||||
void SetCoderInfo(const UInt64 **inSizes, const UInt64 **outSizes);
|
||||
virtual void Execute();
|
||||
void Code(ICompressProgressInfo *progress);
|
||||
};
|
||||
|
||||
|
||||
// SetBindInfo()
|
||||
// for each coder
|
||||
// {
|
||||
// AddCoder[2]()
|
||||
// }
|
||||
//
|
||||
// for each file
|
||||
// {
|
||||
// ReInit()
|
||||
// for each coder
|
||||
// {
|
||||
// SetCoderInfo
|
||||
// }
|
||||
// SetProgressIndex(UInt32 coderIndex);
|
||||
// Code
|
||||
// }
|
||||
|
||||
/*
|
||||
SetBindInfo()
|
||||
for each coder
|
||||
AddCoder[2]()
|
||||
SetProgressIndex(UInt32 coderIndex);
|
||||
|
||||
for each file
|
||||
{
|
||||
ReInit()
|
||||
for each coder
|
||||
SetCoderInfo
|
||||
Code
|
||||
}
|
||||
*/
|
||||
|
||||
class CCoderMixer2MT:
|
||||
public ICompressCoder2,
|
||||
public CCoderMixer2,
|
||||
public CMyUnknownImp
|
||||
{
|
||||
MY_UNKNOWN_IMP
|
||||
CBindInfo _bindInfo;
|
||||
CObjectVector<CStreamBinder> _streamBinders;
|
||||
int _progressCoderIndex;
|
||||
|
||||
void AddCoderCommon();
|
||||
HRESULT Init(ISequentialInStream **inStreams, ISequentialOutStream **outStreams);
|
||||
public:
|
||||
STDMETHOD(Init)(ISequentialInStream **inStreams,
|
||||
ISequentialOutStream **outStreams);
|
||||
CObjectVector<CCoder2> _coders;
|
||||
MY_UNKNOWN_IMP
|
||||
|
||||
STDMETHOD(Code)(ISequentialInStream **inStreams,
|
||||
const UInt64 **inSizes,
|
||||
@@ -81,50 +63,17 @@ public:
|
||||
UInt32 numOutStreams,
|
||||
ICompressProgressInfo *progress);
|
||||
|
||||
|
||||
CCoderMixer2MT();
|
||||
~CCoderMixer2MT();
|
||||
void AddCoderCommon();
|
||||
HRESULT SetBindInfo(const CBindInfo &bindInfo);
|
||||
void AddCoder(ICompressCoder *coder);
|
||||
void AddCoder2(ICompressCoder2 *coder);
|
||||
void SetProgressCoderIndex(int coderIndex) { _progressCoderIndex = coderIndex; }
|
||||
|
||||
void ReInit();
|
||||
void SetCoderInfo(UInt32 coderIndex, const UInt64 **inSizes, const UInt64 **outSizes)
|
||||
{ _coderInfoVector[coderIndex].SetCoderInfo(inSizes, outSizes, NULL); }
|
||||
void SetProgressCoderIndex(UInt32 coderIndex)
|
||||
{ _progressCoderIndex = coderIndex; }
|
||||
|
||||
|
||||
UInt64 GetWriteProcessedSize(UInt32 binderIndex) const;
|
||||
|
||||
|
||||
bool MyCode();
|
||||
|
||||
private:
|
||||
CBindInfo _bindInfo;
|
||||
CObjectVector<CStreamBinder> _streamBinders;
|
||||
CObjectVector<CThreadCoderInfo> _coderInfoVector;
|
||||
CRecordVector<NWindows::CThread> _threads;
|
||||
NWindows::CThread _mainThread;
|
||||
|
||||
NWindows::NSynchronization::CAutoResetEvent _startCompressingEvent;
|
||||
NWindows::NSynchronization::CAutoResetEvent _compressingFinishedEvent;
|
||||
|
||||
NWindows::NSynchronization::CManualResetEvent _exitEvent;
|
||||
UInt32 _progressCoderIndex;
|
||||
|
||||
HRes CreateEvents()
|
||||
{
|
||||
RINOK(_startCompressingEvent.CreateIfNotCreated());
|
||||
RINOK(_compressingFinishedEvent.CreateIfNotCreated());
|
||||
return _exitEvent.CreateIfNotCreated();
|
||||
}
|
||||
|
||||
public:
|
||||
HRESULT SetBindInfo(const CBindInfo &bindInfo);
|
||||
|
||||
{ _coders[coderIndex].SetCoderInfo(inSizes, outSizes); }
|
||||
UInt64 GetWriteProcessedSize(UInt32 binderIndex) const
|
||||
{ return _streamBinders[binderIndex].ProcessedSize; }
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Executable
+97
@@ -0,0 +1,97 @@
|
||||
// CoderMixerMT.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "CoderMixerMT.h"
|
||||
|
||||
namespace NCoderMixer {
|
||||
|
||||
void CCoder::Execute() { Code(NULL); }
|
||||
|
||||
void CCoder::Code(ICompressProgressInfo *progress)
|
||||
{
|
||||
Result = Coder->Code(InStream, OutStream,
|
||||
InSizeAssigned ? &InSizeValue : NULL,
|
||||
OutSizeAssigned ? &OutSizeValue : NULL,
|
||||
progress);
|
||||
InStream.Release();
|
||||
OutStream.Release();
|
||||
}
|
||||
|
||||
void CCoderMixerMT::AddCoder(ICompressCoder *coder)
|
||||
{
|
||||
_coders.Add(CCoder());
|
||||
_coders.Back().Coder = coder;
|
||||
}
|
||||
|
||||
void CCoderMixerMT::ReInit()
|
||||
{
|
||||
for(int i = 0; i < _coders.Size(); i++)
|
||||
_coders[i].ReInit();
|
||||
}
|
||||
|
||||
STDMETHODIMP CCoderMixerMT::Code(ISequentialInStream *inStream,
|
||||
ISequentialOutStream *outStream,
|
||||
const UInt64 * /* inSize */, const UInt64 * /* outSize */,
|
||||
ICompressProgressInfo *progress)
|
||||
{
|
||||
_coders.Front().InStream = inStream;
|
||||
int i;
|
||||
_coders.Back().OutStream = outStream;
|
||||
|
||||
for (i = 0; i < _coders.Size(); i++)
|
||||
if (i != _progressCoderIndex)
|
||||
{
|
||||
RINOK(_coders[i].Create());
|
||||
}
|
||||
|
||||
while (_streamBinders.Size() + 1 < _coders.Size())
|
||||
{
|
||||
_streamBinders.Add(CStreamBinder());
|
||||
int i = _streamBinders.Size() - 1;
|
||||
CStreamBinder &sb = _streamBinders.Back();
|
||||
RINOK(sb.CreateEvents());
|
||||
sb.CreateStreams(&_coders[i + 1].InStream, &_coders[i].OutStream);
|
||||
}
|
||||
|
||||
for(i = 0; i < _streamBinders.Size(); i++)
|
||||
_streamBinders[i].ReInit();
|
||||
|
||||
for (i = 0; i < _coders.Size(); i++)
|
||||
if (i != _progressCoderIndex)
|
||||
_coders[i].Start();
|
||||
|
||||
_coders[_progressCoderIndex].Code(progress);
|
||||
|
||||
for (i = 0; i < _coders.Size(); i++)
|
||||
if (i != _progressCoderIndex)
|
||||
_coders[i].WaitFinish();
|
||||
|
||||
for (i = 0; i < _coders.Size(); i++)
|
||||
{
|
||||
HRESULT result = _coders[i].Result;
|
||||
if (result == E_ABORT)
|
||||
return result;
|
||||
}
|
||||
for (i = 0; i < _coders.Size(); i++)
|
||||
{
|
||||
HRESULT result = _coders[i].Result;
|
||||
if (result == S_FALSE)
|
||||
return result;
|
||||
}
|
||||
for (i = 0; i < _coders.Size(); i++)
|
||||
{
|
||||
HRESULT result = _coders[i].Result;
|
||||
if (result != S_OK && result != E_FAIL)
|
||||
return result;
|
||||
}
|
||||
for (i = 0; i < _coders.Size(); i++)
|
||||
{
|
||||
HRESULT result = _coders[i].Result;
|
||||
if (result != S_OK)
|
||||
return result;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+68
@@ -0,0 +1,68 @@
|
||||
// CoderMixerMT.h
|
||||
|
||||
#ifndef __CODER_MIXER_MT_H
|
||||
#define __CODER_MIXER_MT_H
|
||||
|
||||
#include "../../../Common/Vector.h"
|
||||
#include "../../../Common/MyCom.h"
|
||||
#include "../../ICoder.h"
|
||||
#include "../../Common/StreamBinder.h"
|
||||
#include "../../Common/VirtThread.h"
|
||||
#include "CoderMixer.h"
|
||||
|
||||
namespace NCoderMixer {
|
||||
|
||||
struct CCoder: public CCoderInfo, public CVirtThread
|
||||
{
|
||||
HRESULT Result;
|
||||
|
||||
virtual void Execute();
|
||||
void Code(ICompressProgressInfo *progress);
|
||||
};
|
||||
|
||||
/*
|
||||
for each coder
|
||||
AddCoder()
|
||||
SetProgressIndex(UInt32 coderIndex);
|
||||
|
||||
for each file
|
||||
{
|
||||
ReInit()
|
||||
for each coder
|
||||
SetCoderInfo
|
||||
Code
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
class CCoderMixerMT:
|
||||
public ICompressCoder,
|
||||
public CMyUnknownImp
|
||||
{
|
||||
CObjectVector<CStreamBinder> _streamBinders;
|
||||
int _progressCoderIndex;
|
||||
|
||||
public:
|
||||
CObjectVector<CCoder> _coders;
|
||||
MY_UNKNOWN_IMP
|
||||
|
||||
STDMETHOD(Code)(ISequentialInStream *inStream,
|
||||
ISequentialOutStream *outStream,
|
||||
const UInt64 *inSize, const UInt64 *outSize,
|
||||
ICompressProgressInfo *progress);
|
||||
|
||||
void AddCoder(ICompressCoder *coder);
|
||||
void SetProgressCoderIndex(int coderIndex) { _progressCoderIndex = coderIndex; }
|
||||
|
||||
void ReInit();
|
||||
void SetCoderInfo(UInt32 coderIndex, const UInt64 *inSize, const UInt64 *outSize)
|
||||
{ _coders[coderIndex].SetCoderInfo(inSize, outSize); }
|
||||
|
||||
/*
|
||||
UInt64 GetWriteProcessedSize(UInt32 binderIndex) const
|
||||
{ return _streamBinders[binderIndex].ProcessedSize; }
|
||||
*/
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
Executable
+609
@@ -0,0 +1,609 @@
|
||||
// HandlerOutCommon.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "HandlerOut.h"
|
||||
#include "../../../Windows/PropVariant.h"
|
||||
#include "../../../Common/StringToInt.h"
|
||||
#include "../../ICoder.h"
|
||||
#include "../Common/ParseProperties.h"
|
||||
|
||||
#ifdef COMPRESS_MT
|
||||
#include "../../../Windows/System.h"
|
||||
#endif
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
namespace NArchive {
|
||||
|
||||
static const wchar_t *kCopyMethod = L"Copy";
|
||||
static const wchar_t *kLZMAMethodName = L"LZMA";
|
||||
static const wchar_t *kLZMA2MethodName = L"LZMA2";
|
||||
static const wchar_t *kBZip2MethodName = L"BZip2";
|
||||
static const wchar_t *kPpmdMethodName = L"PPMd";
|
||||
static const wchar_t *kDeflateMethodName = L"Deflate";
|
||||
static const wchar_t *kDeflate64MethodName = L"Deflate64";
|
||||
|
||||
static const wchar_t *kLzmaMatchFinderX1 = L"HC4";
|
||||
static const wchar_t *kLzmaMatchFinderX5 = L"BT4";
|
||||
|
||||
static const UInt32 kLzmaAlgoX1 = 0;
|
||||
static const UInt32 kLzmaAlgoX5 = 1;
|
||||
|
||||
static const UInt32 kLzmaDicSizeX1 = 1 << 16;
|
||||
static const UInt32 kLzmaDicSizeX3 = 1 << 20;
|
||||
static const UInt32 kLzmaDicSizeX5 = 1 << 24;
|
||||
static const UInt32 kLzmaDicSizeX7 = 1 << 25;
|
||||
static const UInt32 kLzmaDicSizeX9 = 1 << 26;
|
||||
|
||||
static const UInt32 kLzmaFastBytesX1 = 32;
|
||||
static const UInt32 kLzmaFastBytesX7 = 64;
|
||||
|
||||
static const UInt32 kPpmdMemSizeX1 = (1 << 22);
|
||||
static const UInt32 kPpmdMemSizeX5 = (1 << 24);
|
||||
static const UInt32 kPpmdMemSizeX7 = (1 << 26);
|
||||
static const UInt32 kPpmdMemSizeX9 = (192 << 20);
|
||||
|
||||
static const UInt32 kPpmdOrderX1 = 4;
|
||||
static const UInt32 kPpmdOrderX5 = 6;
|
||||
static const UInt32 kPpmdOrderX7 = 16;
|
||||
static const UInt32 kPpmdOrderX9 = 32;
|
||||
|
||||
static const UInt32 kDeflateAlgoX1 = 0;
|
||||
static const UInt32 kDeflateAlgoX5 = 1;
|
||||
|
||||
static const UInt32 kDeflateFastBytesX1 = 32;
|
||||
static const UInt32 kDeflateFastBytesX7 = 64;
|
||||
static const UInt32 kDeflateFastBytesX9 = 128;
|
||||
|
||||
static const UInt32 kDeflatePassesX1 = 1;
|
||||
static const UInt32 kDeflatePassesX7 = 3;
|
||||
static const UInt32 kDeflatePassesX9 = 10;
|
||||
|
||||
static const UInt32 kBZip2NumPassesX1 = 1;
|
||||
static const UInt32 kBZip2NumPassesX7 = 2;
|
||||
static const UInt32 kBZip2NumPassesX9 = 7;
|
||||
|
||||
static const UInt32 kBZip2DicSizeX1 = 100000;
|
||||
static const UInt32 kBZip2DicSizeX3 = 500000;
|
||||
static const UInt32 kBZip2DicSizeX5 = 900000;
|
||||
|
||||
static const wchar_t *kDefaultMethodName = kLZMAMethodName;
|
||||
|
||||
static const wchar_t *kLzmaMatchFinderForHeaders = L"BT2";
|
||||
static const UInt32 kDictionaryForHeaders = 1 << 20;
|
||||
static const UInt32 kNumFastBytesForHeaders = 273;
|
||||
static const UInt32 kAlgorithmForHeaders = kLzmaAlgoX5;
|
||||
|
||||
static bool AreEqual(const UString &methodName, const wchar_t *s)
|
||||
{ return (methodName.CompareNoCase(s) == 0); }
|
||||
|
||||
static inline bool IsLZMAMethod(const UString &methodName)
|
||||
{
|
||||
return
|
||||
AreEqual(methodName, kLZMAMethodName) ||
|
||||
AreEqual(methodName, kLZMA2MethodName);
|
||||
}
|
||||
|
||||
static inline bool IsBZip2Method(const UString &methodName)
|
||||
{ return AreEqual(methodName, kBZip2MethodName); }
|
||||
|
||||
static inline bool IsPpmdMethod(const UString &methodName)
|
||||
{ return AreEqual(methodName, kPpmdMethodName); }
|
||||
|
||||
static inline bool IsDeflateMethod(const UString &methodName)
|
||||
{
|
||||
return
|
||||
AreEqual(methodName, kDeflateMethodName) ||
|
||||
AreEqual(methodName, kDeflate64MethodName);
|
||||
}
|
||||
|
||||
struct CNameToPropID
|
||||
{
|
||||
PROPID PropID;
|
||||
VARTYPE VarType;
|
||||
const wchar_t *Name;
|
||||
};
|
||||
|
||||
CNameToPropID g_NameToPropID[] =
|
||||
{
|
||||
{ NCoderPropID::kOrder, VT_UI4, L"O" },
|
||||
{ NCoderPropID::kPosStateBits, VT_UI4, L"PB" },
|
||||
{ NCoderPropID::kLitContextBits, VT_UI4, L"LC" },
|
||||
{ NCoderPropID::kLitPosBits, VT_UI4, L"LP" },
|
||||
{ NCoderPropID::kEndMarker, VT_BOOL, L"eos" },
|
||||
|
||||
{ NCoderPropID::kNumPasses, VT_UI4, L"Pass" },
|
||||
{ NCoderPropID::kNumFastBytes, VT_UI4, L"fb" },
|
||||
{ NCoderPropID::kMatchFinderCycles, VT_UI4, L"mc" },
|
||||
{ NCoderPropID::kAlgorithm, VT_UI4, L"a" },
|
||||
{ NCoderPropID::kMatchFinder, VT_BSTR, L"mf" },
|
||||
{ NCoderPropID::kNumThreads, VT_UI4, L"mt" }
|
||||
};
|
||||
|
||||
static bool ConvertProperty(PROPVARIANT srcProp, VARTYPE varType, NCOM::CPropVariant &destProp)
|
||||
{
|
||||
if (varType == srcProp.vt)
|
||||
{
|
||||
destProp = srcProp;
|
||||
return true;
|
||||
}
|
||||
if (varType == VT_UI1)
|
||||
{
|
||||
if (srcProp.vt == VT_UI4)
|
||||
{
|
||||
UInt32 value = srcProp.ulVal;
|
||||
if (value > 0xFF)
|
||||
return false;
|
||||
destProp = (Byte)value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (varType == VT_BOOL)
|
||||
{
|
||||
bool res;
|
||||
if (SetBoolProperty(res, srcProp) != S_OK)
|
||||
return false;
|
||||
destProp = res;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static int FindPropIdFromStringName(const UString &name)
|
||||
{
|
||||
for (int i = 0; i < sizeof(g_NameToPropID) / sizeof(g_NameToPropID[0]); i++)
|
||||
if (name.CompareNoCase(g_NameToPropID[i].Name) == 0)
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void SetOneMethodProp(COneMethodInfo &oneMethodInfo, PROPID propID,
|
||||
const NWindows::NCOM::CPropVariant &value)
|
||||
{
|
||||
for (int j = 0; j < oneMethodInfo.Properties.Size(); j++)
|
||||
if (oneMethodInfo.Properties[j].Id == propID)
|
||||
return;
|
||||
CProp property;
|
||||
property.Id = propID;
|
||||
property.Value = value;
|
||||
oneMethodInfo.Properties.Add(property);
|
||||
}
|
||||
|
||||
void COutHandler::SetCompressionMethod2(COneMethodInfo &oneMethodInfo
|
||||
#ifdef COMPRESS_MT
|
||||
, UInt32 numThreads
|
||||
#endif
|
||||
)
|
||||
{
|
||||
UInt32 level = _level;
|
||||
if (oneMethodInfo.MethodName.IsEmpty())
|
||||
oneMethodInfo.MethodName = kDefaultMethodName;
|
||||
|
||||
if (IsLZMAMethod(oneMethodInfo.MethodName))
|
||||
{
|
||||
UInt32 dicSize =
|
||||
(level >= 9 ? kLzmaDicSizeX9 :
|
||||
(level >= 7 ? kLzmaDicSizeX7 :
|
||||
(level >= 5 ? kLzmaDicSizeX5 :
|
||||
(level >= 3 ? kLzmaDicSizeX3 :
|
||||
kLzmaDicSizeX1))));
|
||||
|
||||
UInt32 algo =
|
||||
(level >= 5 ? kLzmaAlgoX5 :
|
||||
kLzmaAlgoX1);
|
||||
|
||||
UInt32 fastBytes =
|
||||
(level >= 7 ? kLzmaFastBytesX7 :
|
||||
kLzmaFastBytesX1);
|
||||
|
||||
const wchar_t *matchFinder =
|
||||
(level >= 5 ? kLzmaMatchFinderX5 :
|
||||
kLzmaMatchFinderX1);
|
||||
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kDictionarySize, dicSize);
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kAlgorithm, algo);
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumFastBytes, fastBytes);
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kMatchFinder, matchFinder);
|
||||
#ifdef COMPRESS_MT
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumThreads, numThreads);
|
||||
#endif
|
||||
}
|
||||
else if (IsDeflateMethod(oneMethodInfo.MethodName))
|
||||
{
|
||||
UInt32 fastBytes =
|
||||
(level >= 9 ? kDeflateFastBytesX9 :
|
||||
(level >= 7 ? kDeflateFastBytesX7 :
|
||||
kDeflateFastBytesX1));
|
||||
|
||||
UInt32 numPasses =
|
||||
(level >= 9 ? kDeflatePassesX9 :
|
||||
(level >= 7 ? kDeflatePassesX7 :
|
||||
kDeflatePassesX1));
|
||||
|
||||
UInt32 algo =
|
||||
(level >= 5 ? kDeflateAlgoX5 :
|
||||
kDeflateAlgoX1);
|
||||
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kAlgorithm, algo);
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumFastBytes, fastBytes);
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumPasses, numPasses);
|
||||
}
|
||||
else if (IsBZip2Method(oneMethodInfo.MethodName))
|
||||
{
|
||||
UInt32 numPasses =
|
||||
(level >= 9 ? kBZip2NumPassesX9 :
|
||||
(level >= 7 ? kBZip2NumPassesX7 :
|
||||
kBZip2NumPassesX1));
|
||||
|
||||
UInt32 dicSize =
|
||||
(level >= 5 ? kBZip2DicSizeX5 :
|
||||
(level >= 3 ? kBZip2DicSizeX3 :
|
||||
kBZip2DicSizeX1));
|
||||
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumPasses, numPasses);
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kDictionarySize, dicSize);
|
||||
#ifdef COMPRESS_MT
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kNumThreads, numThreads);
|
||||
#endif
|
||||
}
|
||||
else if (IsPpmdMethod(oneMethodInfo.MethodName))
|
||||
{
|
||||
UInt32 useMemSize =
|
||||
(level >= 9 ? kPpmdMemSizeX9 :
|
||||
(level >= 7 ? kPpmdMemSizeX7 :
|
||||
(level >= 5 ? kPpmdMemSizeX5 :
|
||||
kPpmdMemSizeX1)));
|
||||
|
||||
UInt32 order =
|
||||
(level >= 9 ? kPpmdOrderX9 :
|
||||
(level >= 7 ? kPpmdOrderX7 :
|
||||
(level >= 5 ? kPpmdOrderX5 :
|
||||
kPpmdOrderX1)));
|
||||
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kUsedMemorySize, useMemSize);
|
||||
SetOneMethodProp(oneMethodInfo, NCoderPropID::kOrder, order);
|
||||
}
|
||||
}
|
||||
|
||||
static void SplitParams(const UString &srcString, UStringVector &subStrings)
|
||||
{
|
||||
subStrings.Clear();
|
||||
UString name;
|
||||
int len = srcString.Length();
|
||||
if (len == 0)
|
||||
return;
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
wchar_t c = srcString[i];
|
||||
if (c == L':')
|
||||
{
|
||||
subStrings.Add(name);
|
||||
name.Empty();
|
||||
}
|
||||
else
|
||||
name += c;
|
||||
}
|
||||
subStrings.Add(name);
|
||||
}
|
||||
|
||||
static void SplitParam(const UString ¶m, UString &name, UString &value)
|
||||
{
|
||||
int eqPos = param.Find(L'=');
|
||||
if (eqPos >= 0)
|
||||
{
|
||||
name = param.Left(eqPos);
|
||||
value = param.Mid(eqPos + 1);
|
||||
return;
|
||||
}
|
||||
for(int i = 0; i < param.Length(); i++)
|
||||
{
|
||||
wchar_t c = param[i];
|
||||
if (c >= L'0' && c <= L'9')
|
||||
{
|
||||
name = param.Left(i);
|
||||
value = param.Mid(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
name = param;
|
||||
}
|
||||
|
||||
HRESULT COutHandler::SetParam(COneMethodInfo &oneMethodInfo, const UString &name, const UString &value)
|
||||
{
|
||||
CProp property;
|
||||
if (
|
||||
name.CompareNoCase(L"D") == 0 ||
|
||||
name.CompareNoCase(L"MEM") == 0)
|
||||
{
|
||||
UInt32 dicSize;
|
||||
RINOK(ParsePropDictionaryValue(value, dicSize));
|
||||
if (name.CompareNoCase(L"D") == 0)
|
||||
property.Id = NCoderPropID::kDictionarySize;
|
||||
else
|
||||
property.Id = NCoderPropID::kUsedMemorySize;
|
||||
property.Value = dicSize;
|
||||
oneMethodInfo.Properties.Add(property);
|
||||
}
|
||||
else
|
||||
{
|
||||
int index = FindPropIdFromStringName(name);
|
||||
if (index < 0)
|
||||
return E_INVALIDARG;
|
||||
|
||||
const CNameToPropID &nameToPropID = g_NameToPropID[index];
|
||||
property.Id = nameToPropID.PropID;
|
||||
|
||||
NCOM::CPropVariant propValue;
|
||||
|
||||
if (nameToPropID.VarType == VT_BSTR)
|
||||
propValue = value;
|
||||
else if (nameToPropID.VarType == VT_BOOL)
|
||||
{
|
||||
bool res;
|
||||
if (!StringToBool(value, res))
|
||||
return E_INVALIDARG;
|
||||
propValue = res;
|
||||
}
|
||||
else
|
||||
{
|
||||
UInt32 number;
|
||||
if (ParseStringToUInt32(value, number) == value.Length())
|
||||
propValue = number;
|
||||
else
|
||||
propValue = value;
|
||||
}
|
||||
|
||||
if (!ConvertProperty(propValue, nameToPropID.VarType, property.Value))
|
||||
return E_INVALIDARG;
|
||||
|
||||
oneMethodInfo.Properties.Add(property);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT COutHandler::SetParams(COneMethodInfo &oneMethodInfo, const UString &srcString)
|
||||
{
|
||||
UStringVector params;
|
||||
SplitParams(srcString, params);
|
||||
if (params.Size() > 0)
|
||||
oneMethodInfo.MethodName = params[0];
|
||||
for (int i = 1; i < params.Size(); i++)
|
||||
{
|
||||
const UString ¶m = params[i];
|
||||
UString name, value;
|
||||
SplitParam(param, name, value);
|
||||
RINOK(SetParam(oneMethodInfo, name, value));
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT COutHandler::SetSolidSettings(const UString &s)
|
||||
{
|
||||
bool res;
|
||||
if (StringToBool(s, res))
|
||||
{
|
||||
if (res)
|
||||
InitSolid();
|
||||
else
|
||||
_numSolidFiles = 1;
|
||||
return S_OK;
|
||||
}
|
||||
UString s2 = s;
|
||||
s2.MakeUpper();
|
||||
for (int i = 0; i < s2.Length();)
|
||||
{
|
||||
const wchar_t *start = ((const wchar_t *)s2) + i;
|
||||
const wchar_t *end;
|
||||
UInt64 v = ConvertStringToUInt64(start, &end);
|
||||
if (start == end)
|
||||
{
|
||||
if (s2[i++] != 'E')
|
||||
return E_INVALIDARG;
|
||||
_solidExtension = true;
|
||||
continue;
|
||||
}
|
||||
i += (int)(end - start);
|
||||
if (i == s2.Length())
|
||||
return E_INVALIDARG;
|
||||
wchar_t c = s2[i++];
|
||||
switch(c)
|
||||
{
|
||||
case 'F':
|
||||
if (v < 1)
|
||||
v = 1;
|
||||
_numSolidFiles = v;
|
||||
break;
|
||||
case 'B':
|
||||
_numSolidBytes = v;
|
||||
_numSolidBytesDefined = true;
|
||||
break;
|
||||
case 'K':
|
||||
_numSolidBytes = (v << 10);
|
||||
_numSolidBytesDefined = true;
|
||||
break;
|
||||
case 'M':
|
||||
_numSolidBytes = (v << 20);
|
||||
_numSolidBytesDefined = true;
|
||||
break;
|
||||
case 'G':
|
||||
_numSolidBytes = (v << 30);
|
||||
_numSolidBytesDefined = true;
|
||||
break;
|
||||
default:
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT COutHandler::SetSolidSettings(const PROPVARIANT &value)
|
||||
{
|
||||
switch(value.vt)
|
||||
{
|
||||
case VT_EMPTY:
|
||||
InitSolid();
|
||||
return S_OK;
|
||||
case VT_BSTR:
|
||||
return SetSolidSettings(value.bstrVal);
|
||||
default:
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
}
|
||||
|
||||
void COutHandler::Init()
|
||||
{
|
||||
_removeSfxBlock = false;
|
||||
_compressHeaders = true;
|
||||
_encryptHeaders = false;
|
||||
|
||||
WriteModified = true;
|
||||
WriteCreated = false;
|
||||
WriteAccessed = false;
|
||||
|
||||
#ifdef COMPRESS_MT
|
||||
_numThreads = NWindows::NSystem::GetNumberOfProcessors();
|
||||
#endif
|
||||
|
||||
_level = 5;
|
||||
_autoFilter = true;
|
||||
_volumeMode = false;
|
||||
InitSolid();
|
||||
}
|
||||
|
||||
void COutHandler::BeforeSetProperty()
|
||||
{
|
||||
Init();
|
||||
#ifdef COMPRESS_MT
|
||||
numProcessors = NSystem::GetNumberOfProcessors();
|
||||
#endif
|
||||
|
||||
mainDicSize = 0xFFFFFFFF;
|
||||
mainDicMethodIndex = 0xFFFFFFFF;
|
||||
minNumber = 0;
|
||||
}
|
||||
|
||||
HRESULT COutHandler::SetProperty(const wchar_t *nameSpec, const PROPVARIANT &value)
|
||||
{
|
||||
UString name = nameSpec;
|
||||
name.MakeUpper();
|
||||
if (name.IsEmpty())
|
||||
return E_INVALIDARG;
|
||||
|
||||
if (name[0] == 'X')
|
||||
{
|
||||
name.Delete(0);
|
||||
_level = 9;
|
||||
return ParsePropValue(name, value, _level);
|
||||
}
|
||||
|
||||
if (name[0] == L'S')
|
||||
{
|
||||
name.Delete(0);
|
||||
if (name.IsEmpty())
|
||||
return SetSolidSettings(value);
|
||||
if (value.vt != VT_EMPTY)
|
||||
return E_INVALIDARG;
|
||||
return SetSolidSettings(name);
|
||||
}
|
||||
|
||||
UInt32 number;
|
||||
int index = ParseStringToUInt32(name, number);
|
||||
UString realName = name.Mid(index);
|
||||
if (index == 0)
|
||||
{
|
||||
if(name.Left(2).CompareNoCase(L"MT") == 0)
|
||||
{
|
||||
#ifdef COMPRESS_MT
|
||||
RINOK(ParseMtProp(name.Mid(2), value, numProcessors, _numThreads));
|
||||
#endif
|
||||
return S_OK;
|
||||
}
|
||||
if (name.CompareNoCase(L"RSFX") == 0)
|
||||
return SetBoolProperty(_removeSfxBlock, value);
|
||||
if (name.CompareNoCase(L"F") == 0)
|
||||
return SetBoolProperty(_autoFilter, value);
|
||||
if (name.CompareNoCase(L"HC") == 0)
|
||||
return SetBoolProperty(_compressHeaders, value);
|
||||
if (name.CompareNoCase(L"HCF") == 0)
|
||||
{
|
||||
bool compressHeadersFull = true;
|
||||
RINOK(SetBoolProperty(compressHeadersFull, value));
|
||||
if (!compressHeadersFull)
|
||||
return E_INVALIDARG;
|
||||
return S_OK;
|
||||
}
|
||||
if (name.CompareNoCase(L"HE") == 0)
|
||||
return SetBoolProperty(_encryptHeaders, value);
|
||||
if (name.CompareNoCase(L"TM") == 0)
|
||||
return SetBoolProperty(WriteModified, value);
|
||||
if (name.CompareNoCase(L"TC") == 0)
|
||||
return SetBoolProperty(WriteCreated, value);
|
||||
if (name.CompareNoCase(L"TA") == 0)
|
||||
return SetBoolProperty(WriteAccessed, value);
|
||||
if (name.CompareNoCase(L"V") == 0)
|
||||
return SetBoolProperty(_volumeMode, value);
|
||||
number = 0;
|
||||
}
|
||||
if (number > 10000)
|
||||
return E_FAIL;
|
||||
if (number < minNumber)
|
||||
return E_INVALIDARG;
|
||||
number -= minNumber;
|
||||
for(int j = _methods.Size(); j <= (int)number; j++)
|
||||
{
|
||||
COneMethodInfo oneMethodInfo;
|
||||
_methods.Add(oneMethodInfo);
|
||||
}
|
||||
|
||||
COneMethodInfo &oneMethodInfo = _methods[number];
|
||||
|
||||
if (realName.Length() == 0)
|
||||
{
|
||||
if (value.vt != VT_BSTR)
|
||||
return E_INVALIDARG;
|
||||
|
||||
RINOK(SetParams(oneMethodInfo, value.bstrVal));
|
||||
}
|
||||
else
|
||||
{
|
||||
CProp property;
|
||||
if (realName.Left(1).CompareNoCase(L"D") == 0)
|
||||
{
|
||||
UInt32 dicSize;
|
||||
RINOK(ParsePropDictionaryValue(realName.Mid(1), value, dicSize));
|
||||
property.Id = NCoderPropID::kDictionarySize;
|
||||
property.Value = dicSize;
|
||||
oneMethodInfo.Properties.Add(property);
|
||||
if (number <= mainDicMethodIndex)
|
||||
mainDicSize = dicSize;
|
||||
}
|
||||
else if (realName.Left(3).CompareNoCase(L"MEM") == 0)
|
||||
{
|
||||
UInt32 dicSize;
|
||||
RINOK(ParsePropDictionaryValue(realName.Mid(3), value, dicSize));
|
||||
property.Id = NCoderPropID::kUsedMemorySize;
|
||||
property.Value = dicSize;
|
||||
oneMethodInfo.Properties.Add(property);
|
||||
if (number <= mainDicMethodIndex)
|
||||
mainDicSize = dicSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
int index = FindPropIdFromStringName(realName);
|
||||
if (index < 0)
|
||||
return E_INVALIDARG;
|
||||
|
||||
const CNameToPropID &nameToPropID = g_NameToPropID[index];
|
||||
property.Id = nameToPropID.PropID;
|
||||
|
||||
if (!ConvertProperty(value, nameToPropID.VarType, property.Value))
|
||||
return E_INVALIDARG;
|
||||
|
||||
oneMethodInfo.Properties.Add(property);
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+84
@@ -0,0 +1,84 @@
|
||||
// HandlerOut.h
|
||||
|
||||
#ifndef __HANDLER_OUT_H
|
||||
#define __HANDLER_OUT_H
|
||||
|
||||
#include "../../Common/MethodProps.h"
|
||||
#include "../../Common/CreateCoder.h"
|
||||
|
||||
namespace NArchive {
|
||||
|
||||
struct COneMethodInfo
|
||||
{
|
||||
CObjectVector<CProp> Properties;
|
||||
UString MethodName;
|
||||
};
|
||||
|
||||
class COutHandler
|
||||
{
|
||||
public:
|
||||
HRESULT SetProperty(const wchar_t *name, const PROPVARIANT &value);
|
||||
|
||||
HRESULT SetSolidSettings(const UString &s);
|
||||
HRESULT SetSolidSettings(const PROPVARIANT &value);
|
||||
|
||||
#ifdef COMPRESS_MT
|
||||
UInt32 _numThreads;
|
||||
#endif
|
||||
|
||||
CObjectVector<COneMethodInfo> _methods;
|
||||
bool _removeSfxBlock;
|
||||
|
||||
UInt64 _numSolidFiles;
|
||||
UInt64 _numSolidBytes;
|
||||
bool _numSolidBytesDefined;
|
||||
bool _solidExtension;
|
||||
|
||||
bool _compressHeaders;
|
||||
bool _encryptHeaders;
|
||||
|
||||
bool WriteModified;
|
||||
bool WriteCreated;
|
||||
bool WriteAccessed;
|
||||
|
||||
bool _autoFilter;
|
||||
UInt32 _level;
|
||||
|
||||
bool _volumeMode;
|
||||
|
||||
HRESULT SetParam(COneMethodInfo &oneMethodInfo, const UString &name, const UString &value);
|
||||
HRESULT SetParams(COneMethodInfo &oneMethodInfo, const UString &srcString);
|
||||
|
||||
void SetCompressionMethod2(COneMethodInfo &oneMethodInfo
|
||||
#ifdef COMPRESS_MT
|
||||
, UInt32 numThreads
|
||||
#endif
|
||||
);
|
||||
|
||||
void InitSolidFiles() { _numSolidFiles = (UInt64)(Int64)(-1); }
|
||||
void InitSolidSize() { _numSolidBytes = (UInt64)(Int64)(-1); }
|
||||
void InitSolid()
|
||||
{
|
||||
InitSolidFiles();
|
||||
InitSolidSize();
|
||||
_solidExtension = false;
|
||||
_numSolidBytesDefined = false;
|
||||
}
|
||||
|
||||
void Init();
|
||||
|
||||
COutHandler() { Init(); }
|
||||
|
||||
void BeforeSetProperty();
|
||||
|
||||
UInt32 minNumber;
|
||||
UInt32 numProcessors;
|
||||
UInt32 mainDicSize;
|
||||
UInt32 mainDicMethodIndex;
|
||||
|
||||
DECL_EXTERNAL_CODECS_VARS
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -3,7 +3,7 @@
|
||||
#ifndef __ARCHIVE_ITEMNAMEUTILS_H
|
||||
#define __ARCHIVE_ITEMNAMEUTILS_H
|
||||
|
||||
#include "../../../Common/String.h"
|
||||
#include "../../../Common/MyString.h"
|
||||
|
||||
namespace NArchive {
|
||||
namespace NItemName {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#define __MULTISTREAM_H
|
||||
|
||||
#include "../../../Common/MyCom.h"
|
||||
#include "../../../Common/Vector.h"
|
||||
#include "../../../Common/MyVector.h"
|
||||
#include "../../Archive/IArchive.h"
|
||||
|
||||
class CMultiStream:
|
||||
|
||||
@@ -97,34 +97,37 @@ HRESULT ParsePropDictionaryValue(const UString &name, const PROPVARIANT &prop, U
|
||||
return ParsePropDictionaryValue(name, resValue);
|
||||
}
|
||||
|
||||
bool StringToBool(const UString &s, bool &res)
|
||||
{
|
||||
if (s.IsEmpty() || s.CompareNoCase(L"ON") == 0)
|
||||
{
|
||||
res = true;
|
||||
return true;
|
||||
}
|
||||
if (s.CompareNoCase(L"OFF") == 0)
|
||||
{
|
||||
res = false;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
HRESULT SetBoolProperty(bool &dest, const PROPVARIANT &value)
|
||||
{
|
||||
switch(value.vt)
|
||||
{
|
||||
case VT_EMPTY:
|
||||
dest = true;
|
||||
break;
|
||||
return S_OK;
|
||||
/*
|
||||
case VT_UI4:
|
||||
dest = (value.ulVal != 0);
|
||||
break;
|
||||
*/
|
||||
case VT_BSTR:
|
||||
{
|
||||
UString valueString = value.bstrVal;
|
||||
valueString.MakeUpper();
|
||||
if (valueString.Compare(L"ON") == 0)
|
||||
dest = true;
|
||||
else if (valueString.Compare(L"OFF") == 0)
|
||||
dest = false;
|
||||
else
|
||||
return E_INVALIDARG;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return E_INVALIDARG;
|
||||
return StringToBool(value.bstrVal, dest) ? S_OK : E_INVALIDARG;
|
||||
}
|
||||
return S_OK;
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
|
||||
int ParseStringToUInt32(const UString &srcString, UInt32 &number)
|
||||
|
||||
@@ -3,13 +3,14 @@
|
||||
#ifndef __PARSEPROPERTIES_H
|
||||
#define __PARSEPROPERTIES_H
|
||||
|
||||
#include "Common/String.h"
|
||||
#include "Common/MyString.h"
|
||||
#include "Common/Types.h"
|
||||
|
||||
HRESULT ParsePropValue(const UString &name, const PROPVARIANT &prop, UInt32 &resValue);
|
||||
HRESULT ParsePropDictionaryValue(const UString &srcStringSpec, UInt32 &dicSize);
|
||||
HRESULT ParsePropDictionaryValue(const UString &name, const PROPVARIANT &prop, UInt32 &resValue);
|
||||
|
||||
bool StringToBool(const UString &s, bool &res);
|
||||
HRESULT SetBoolProperty(bool &dest, const PROPVARIANT &value);
|
||||
int ParseStringToUInt32(const UString &srcString, UInt32 &number);
|
||||
HRESULT ParseMtProp(const UString &name, const PROPVARIANT &prop, UInt32 defaultNumThreads, UInt32 &numThreads);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include "Common/Types.h"
|
||||
#include "Common/String.h"
|
||||
#include "Common/MyString.h"
|
||||
#include "CpioHeader.h"
|
||||
|
||||
namespace NArchive {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#define __ARCHIVE_DEB_ITEMINFO_H
|
||||
|
||||
#include "Common/Types.h"
|
||||
#include "Common/String.h"
|
||||
#include "Common/MyString.h"
|
||||
#include "DebHeader.h"
|
||||
|
||||
namespace NArchive {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#define __ARCHIVE_GZIP_ITEM_H
|
||||
|
||||
#include "Common/Types.h"
|
||||
#include "Common/String.h"
|
||||
#include "Common/MyString.h"
|
||||
#include "Common/Buffer.h"
|
||||
|
||||
namespace NArchive {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#define __ARCHIVE_ISO_ITEM_H
|
||||
|
||||
#include "Common/Types.h"
|
||||
#include "Common/String.h"
|
||||
#include "Common/MyString.h"
|
||||
#include "Common/Buffer.h"
|
||||
|
||||
#include "IsoHeader.h"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#define __ARCHIVE_LZH_ITEM_H
|
||||
|
||||
#include "Common/Types.h"
|
||||
#include "Common/String.h"
|
||||
#include "Common/MyString.h"
|
||||
#include "Common/Buffer.h"
|
||||
#include "LzhHeader.h"
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#define __ARCHIVE_RAR_IN_H
|
||||
|
||||
#include "Common/DynamicBuffer.h"
|
||||
#include "Common/Exception.h"
|
||||
#include "Common/MyCom.h"
|
||||
#include "../../IStream.h"
|
||||
#include "../../ICoder.h"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#define __ARCHIVE_RAR_ITEM_H
|
||||
|
||||
#include "Common/Types.h"
|
||||
#include "Common/String.h"
|
||||
#include "Common/MyString.h"
|
||||
|
||||
namespace NArchive{
|
||||
namespace NRar{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#define __SPLIT_HANDLER_H
|
||||
|
||||
#include "Common/MyCom.h"
|
||||
#include "Common/String.h"
|
||||
#include "Common/MyString.h"
|
||||
#include "../IArchive.h"
|
||||
|
||||
namespace NArchive {
|
||||
|
||||
@@ -113,8 +113,22 @@ STDMETHODIMP CHandler::Open(IInStream *stream,
|
||||
}
|
||||
}
|
||||
if (_items.Size() == 0)
|
||||
return S_FALSE;
|
||||
|
||||
{
|
||||
CMyComPtr<IArchiveOpenVolumeCallback> openVolumeCallback;
|
||||
if (!openArchiveCallback)
|
||||
return S_FALSE;
|
||||
openArchiveCallback->QueryInterface(IID_IArchiveOpenVolumeCallback, (void **)&openVolumeCallback);
|
||||
if (!openVolumeCallback)
|
||||
return S_FALSE;
|
||||
NCOM::CPropVariant propVariant;
|
||||
RINOK(openVolumeCallback->GetProperty(kpidName, &propVariant));
|
||||
if (propVariant.vt != VT_BSTR)
|
||||
return S_FALSE;
|
||||
UString baseName = propVariant.bstrVal;
|
||||
baseName = baseName.Right(4);
|
||||
if (baseName.CompareNoCase(L".tar") != 0)
|
||||
return S_FALSE;
|
||||
}
|
||||
_inStream = stream;
|
||||
}
|
||||
/*
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <time.h>
|
||||
|
||||
#include "Common/Types.h"
|
||||
#include "Common/String.h"
|
||||
#include "Common/MyString.h"
|
||||
|
||||
#include "../Common/ItemNameUtils.h"
|
||||
#include "TarHeader.h"
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
#ifndef __TAR_UPDATE_H
|
||||
#define __TAR_UPDATE_H
|
||||
|
||||
#include "Common/Vector.h"
|
||||
#include "Common/Types.h"
|
||||
#include "Common/String.h"
|
||||
|
||||
#include "../IArchive.h"
|
||||
#include "TarItem.h"
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@
|
||||
#ifndef __ZIP_COMPRESSIONMETHOD_H
|
||||
#define __ZIP_COMPRESSIONMETHOD_H
|
||||
|
||||
#include "Common/Vector.h"
|
||||
#include "Common/String.h"
|
||||
#include "Common/MyString.h"
|
||||
|
||||
namespace NArchive {
|
||||
namespace NZip {
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "../Common/ItemNameUtils.h"
|
||||
#include "../Common/ParseProperties.h"
|
||||
#include "../../Crypto/WzAES/WzAES.h"
|
||||
#include "../../Common/OutBuffer.h"
|
||||
|
||||
using namespace NWindows;
|
||||
using namespace NCOM;
|
||||
@@ -60,10 +61,15 @@ static bool IsAsciiString(const UString &s)
|
||||
return true;
|
||||
}
|
||||
|
||||
#define COM_TRY_BEGIN2 try {
|
||||
#define COM_TRY_END2 } \
|
||||
catch(const CSystemException &e) { return e.ErrorCode; } \
|
||||
catch(...) { return E_OUTOFMEMORY; }
|
||||
|
||||
STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numItems,
|
||||
IArchiveUpdateCallback *updateCallback)
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
COM_TRY_BEGIN2
|
||||
CObjectVector<CUpdateItem> updateItems;
|
||||
for(UInt32 i = 0; i < numItems; i++)
|
||||
{
|
||||
@@ -276,7 +282,7 @@ STDMETHODIMP CHandler::UpdateItems(ISequentialOutStream *outStream, UInt32 numIt
|
||||
EXTERNAL_CODECS_VARS
|
||||
m_Items, updateItems, outStream,
|
||||
m_ArchiveIsOpen ? &m_Archive : NULL, &options, updateCallback);
|
||||
COM_TRY_END
|
||||
COM_TRY_END2
|
||||
}
|
||||
|
||||
STDMETHODIMP CHandler::SetProperties(const wchar_t **names, const PROPVARIANT *values, Int32 numProperties)
|
||||
|
||||
@@ -341,11 +341,14 @@ HRESULT CInArchive::ReadLocalItemAfterCdItem(CItemEx &item)
|
||||
RINOK(ReadLocalItem(localItem));
|
||||
if (item.Flags != localItem.Flags)
|
||||
{
|
||||
if ((item.CompressionMethod != NFileHeader::NCompressionMethod::kDeflated ||
|
||||
(item.Flags & 0x7FFC) != (localItem.Flags & 0x7FFC)) &&
|
||||
((item.CompressionMethod != NFileHeader::NCompressionMethod::kStored ||
|
||||
(item.Flags & 0x7FFF) != (localItem.Flags & 0x7FFF))
|
||||
))
|
||||
if (
|
||||
(item.CompressionMethod != NFileHeader::NCompressionMethod::kDeflated ||
|
||||
(item.Flags & 0x7FF9) != (localItem.Flags & 0x7FF9)) &&
|
||||
(item.CompressionMethod != NFileHeader::NCompressionMethod::kStored ||
|
||||
(item.Flags & 0x7FFF) != (localItem.Flags & 0x7FFF)) &&
|
||||
(item.CompressionMethod != NFileHeader::NCompressionMethod::kImploded ||
|
||||
(item.Flags & 0x7FFF) != (localItem.Flags & 0x7FFF))
|
||||
)
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#define __ARCHIVE_ZIP_ITEM_H
|
||||
|
||||
#include "Common/Types.h"
|
||||
#include "Common/String.h"
|
||||
#include "Common/MyString.h"
|
||||
#include "Common/Buffer.h"
|
||||
|
||||
#include "ZipHeader.h"
|
||||
|
||||
@@ -12,7 +12,11 @@ namespace NZip {
|
||||
|
||||
void COutArchive::Create(IOutStream *outStream)
|
||||
{
|
||||
if (!m_OutBuffer.Create(1 << 16))
|
||||
throw CSystemException(E_OUTOFMEMORY);
|
||||
m_Stream = outStream;
|
||||
m_OutBuffer.SetStream(outStream);
|
||||
m_OutBuffer.Init();
|
||||
m_BasePosition = 0;
|
||||
}
|
||||
|
||||
@@ -47,11 +51,7 @@ void COutArchive::PrepareWriteCompressedData2(UInt16 fileNameLength, UInt64 unPa
|
||||
|
||||
void COutArchive::WriteBytes(const void *buffer, UInt32 size)
|
||||
{
|
||||
UInt32 processedSize;
|
||||
if(WriteStream(m_Stream, buffer, size, &processedSize) != S_OK)
|
||||
throw 0;
|
||||
if(processedSize != size)
|
||||
throw 0;
|
||||
m_OutBuffer.WriteBytes(buffer, size);
|
||||
m_BasePosition += size;
|
||||
}
|
||||
|
||||
@@ -101,9 +101,16 @@ void COutArchive::WriteExtra(const CExtraBlock &extra)
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT COutArchive::WriteLocalHeader(const CLocalItem &item)
|
||||
void COutArchive::SeekTo(UInt64 offset)
|
||||
{
|
||||
m_Stream->Seek(m_BasePosition, STREAM_SEEK_SET, NULL);
|
||||
HRESULT res = m_Stream->Seek(offset, STREAM_SEEK_SET, NULL);
|
||||
if (res != S_OK)
|
||||
throw CSystemException(res);
|
||||
}
|
||||
|
||||
void COutArchive::WriteLocalHeader(const CLocalItem &item)
|
||||
{
|
||||
SeekTo(m_BasePosition);
|
||||
|
||||
bool isZip64 = m_IsZip64 || item.PackSize >= 0xFFFFFFFF || item.UnPackSize >= 0xFFFFFFFF;
|
||||
|
||||
@@ -120,7 +127,7 @@ HRESULT COutArchive::WriteLocalHeader(const CLocalItem &item)
|
||||
{
|
||||
UInt16 localExtraSize = (UInt16)((isZip64 ? (4 + 16): 0) + item.LocalExtra.GetSize());
|
||||
if (localExtraSize > m_ExtraSize)
|
||||
return E_FAIL;
|
||||
throw CSystemException(E_FAIL);
|
||||
}
|
||||
WriteUInt16((UInt16)m_ExtraSize); // test it;
|
||||
WriteBytes((const char *)item.Name, item.Name.Length());
|
||||
@@ -140,14 +147,13 @@ HRESULT COutArchive::WriteLocalHeader(const CLocalItem &item)
|
||||
for (; extraPos < m_ExtraSize; extraPos++)
|
||||
WriteByte(0);
|
||||
|
||||
m_OutBuffer.FlushWithCheck();
|
||||
MoveBasePosition(item.PackSize);
|
||||
return m_Stream->Seek(m_BasePosition, STREAM_SEEK_SET, NULL);
|
||||
SeekTo(m_BasePosition);
|
||||
}
|
||||
|
||||
void COutArchive::WriteCentralHeader(const CItem &item)
|
||||
{
|
||||
m_Stream->Seek(m_BasePosition, STREAM_SEEK_SET, NULL);
|
||||
|
||||
bool isUnPack64 = item.UnPackSize >= 0xFFFFFFFF;
|
||||
bool isPack64 = item.PackSize >= 0xFFFFFFFF;
|
||||
bool isPosition64 = item.LocalHeaderPosition >= 0xFFFFFFFF;
|
||||
@@ -193,7 +199,7 @@ void COutArchive::WriteCentralHeader(const CItem &item)
|
||||
|
||||
void COutArchive::WriteCentralDir(const CObjectVector<CItem> &items, const CByteBuffer &comment)
|
||||
{
|
||||
m_Stream->Seek(m_BasePosition, STREAM_SEEK_SET, NULL);
|
||||
SeekTo(m_BasePosition);
|
||||
|
||||
UInt64 cdOffset = GetCurrentPosition();
|
||||
for(int i = 0; i < items.Size(); i++)
|
||||
@@ -234,6 +240,7 @@ void COutArchive::WriteCentralDir(const CObjectVector<CItem> &items, const CByte
|
||||
WriteUInt16(commentSize);
|
||||
if (commentSize > 0)
|
||||
WriteBytes((const Byte *)comment, commentSize);
|
||||
m_OutBuffer.FlushWithCheck();
|
||||
}
|
||||
|
||||
void COutArchive::CreateStreamForCompressing(IOutStream **outStream)
|
||||
@@ -246,7 +253,7 @@ void COutArchive::CreateStreamForCompressing(IOutStream **outStream)
|
||||
|
||||
void COutArchive::SeekToPackedDataPosition()
|
||||
{
|
||||
m_Stream->Seek(m_BasePosition + m_LocalFileHeaderSize, STREAM_SEEK_SET, NULL);
|
||||
SeekTo(m_BasePosition + m_LocalFileHeaderSize);
|
||||
}
|
||||
|
||||
void COutArchive::CreateStreamForCopying(ISequentialOutStream **outStream)
|
||||
|
||||
@@ -6,15 +6,19 @@
|
||||
#include "Common/MyCom.h"
|
||||
|
||||
#include "../../IStream.h"
|
||||
#include "../../Common/OutBuffer.h"
|
||||
|
||||
#include "ZipItem.h"
|
||||
|
||||
namespace NArchive {
|
||||
namespace NZip {
|
||||
|
||||
// can throw CSystemException and COutBufferException
|
||||
|
||||
class COutArchive
|
||||
{
|
||||
CMyComPtr<IOutStream> m_Stream;
|
||||
COutBuffer m_OutBuffer;
|
||||
|
||||
UInt64 m_BasePosition;
|
||||
UInt32 m_LocalFileHeaderSize;
|
||||
@@ -30,6 +34,7 @@ class COutArchive
|
||||
void WriteExtraHeader(const CItem &item);
|
||||
void WriteCentralHeader(const CItem &item);
|
||||
void WriteExtra(const CExtraBlock &extra);
|
||||
void SeekTo(UInt64 offset);
|
||||
public:
|
||||
void Create(IOutStream *outStream);
|
||||
void MoveBasePosition(UInt64 distanceToMove);
|
||||
@@ -37,7 +42,7 @@ public:
|
||||
void PrepareWriteCompressedDataZip64(UInt16 fileNameLength, bool isZip64, bool aesEncryption);
|
||||
void PrepareWriteCompressedData(UInt16 fileNameLength, UInt64 unPackSize, bool aesEncryption);
|
||||
void PrepareWriteCompressedData2(UInt16 fileNameLength, UInt64 unPackSize, UInt64 packSize, bool aesEncryption);
|
||||
HRESULT WriteLocalHeader(const CLocalItem &item);
|
||||
void WriteLocalHeader(const CLocalItem &item);
|
||||
|
||||
void WriteCentralDir(const CObjectVector<CItem> &items, const CByteBuffer &comment);
|
||||
|
||||
|
||||
@@ -282,12 +282,12 @@ static HRESULT UpdateItemOldData(COutArchive &archive,
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WriteDirHeader(COutArchive &archive, const CCompressionMethodMode *options,
|
||||
static void WriteDirHeader(COutArchive &archive, const CCompressionMethodMode *options,
|
||||
const CUpdateItem &updateItem, CItemEx &item)
|
||||
{
|
||||
SetFileHeader(archive, *options, updateItem, item);
|
||||
archive.PrepareWriteCompressedData((UInt16)item.Name.Length(), updateItem.Size, options->IsAesMode);
|
||||
return archive.WriteLocalHeader(item);
|
||||
archive.WriteLocalHeader(item);
|
||||
}
|
||||
|
||||
static HRESULT Update2St(
|
||||
@@ -330,7 +330,7 @@ static HRESULT Update2St(
|
||||
bool isDirectory = ((updateItem.NewProperties) ? updateItem.IsDirectory : item.IsDirectory());
|
||||
if (isDirectory)
|
||||
{
|
||||
RINOK(WriteDirHeader(archive, options, updateItem, item));
|
||||
WriteDirHeader(archive, options, updateItem, item);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -355,7 +355,7 @@ static HRESULT Update2St(
|
||||
EXTERNAL_CODECS_LOC_VARS
|
||||
fileInStream, outStream, compressProgress, compressingResult));
|
||||
SetItemInfoFromCompressingResult(compressingResult, options->IsAesMode, options->AesKeyMode, item);
|
||||
RINOK(archive.WriteLocalHeader(item));
|
||||
archive.WriteLocalHeader(item);
|
||||
RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK));
|
||||
complexity += item.UnPackSize;
|
||||
}
|
||||
@@ -611,7 +611,7 @@ static HRESULT Update2(
|
||||
bool isDirectory = ((updateItem.NewProperties) ? updateItem.IsDirectory : item.IsDirectory());
|
||||
if (isDirectory)
|
||||
{
|
||||
RINOK(WriteDirHeader(archive, options, updateItem, item));
|
||||
WriteDirHeader(archive, options, updateItem, item);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -632,7 +632,7 @@ static HRESULT Update2(
|
||||
SetItemInfoFromCompressingResult(memRef.CompressingResult,
|
||||
options->IsAesMode, options->AesKeyMode, item);
|
||||
SetFileHeader(archive, *options, updateItem, item);
|
||||
RINOK(archive.WriteLocalHeader(item));
|
||||
archive.WriteLocalHeader(item);
|
||||
complexity += item.UnPackSize;
|
||||
// RINOK(updateCallback->SetOperationResult(NArchive::NUpdate::NOperationResult::kOK));
|
||||
memRef.FreeOpt(&memManager);
|
||||
@@ -666,7 +666,7 @@ static HRESULT Update2(
|
||||
SetItemInfoFromCompressingResult(threadInfo.CompressingResult,
|
||||
options->IsAesMode, options->AesKeyMode, item);
|
||||
SetFileHeader(archive, *options, updateItem, item);
|
||||
RINOK(archive.WriteLocalHeader(item));
|
||||
archive.WriteLocalHeader(item);
|
||||
complexity += item.UnPackSize;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -3,9 +3,6 @@
|
||||
#ifndef __ZIP_UPDATE_H
|
||||
#define __ZIP_UPDATE_H
|
||||
|
||||
#include "Common/Vector.h"
|
||||
#include "Common/Types.h"
|
||||
|
||||
#include "../../ICoder.h"
|
||||
#include "../IArchive.h"
|
||||
|
||||
|
||||
@@ -237,14 +237,6 @@ SOURCE=.\StdAfx.h
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\AlignedBuffer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\AlignedBuffer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\AutoPtr.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -277,10 +269,6 @@ SOURCE=..\..\..\Common\DynamicBuffer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Exception.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\IntToString.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -301,6 +289,10 @@ SOURCE=..\..\..\Common\MyCom.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyException.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyGuidDef.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -309,10 +301,26 @@ SOURCE=..\..\..\Common\MyInitGuid.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyString.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyString.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyUnknown.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyVector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyVector.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyWindows.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -353,14 +361,6 @@ SOURCE=..\..\..\Common\StdOutStream.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\String.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\String.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\StringConvert.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -389,14 +389,6 @@ SOURCE=..\..\..\Common\UTFConvert.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Vector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Vector.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Wildcard.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -501,6 +493,14 @@ SOURCE=..\..\..\Windows\Synchronization.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\System.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\System.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Thread.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -613,6 +613,14 @@ SOURCE=..\..\Common\MethodId.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\MethodProps.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\MethodProps.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\MSBFDecoder.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -683,6 +691,14 @@ SOURCE=..\..\Common\StreamUtils.cpp
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\VirtThread.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\VirtThread.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Compress"
|
||||
|
||||
@@ -1705,14 +1721,6 @@ SOURCE=..\..\Archive\Common\CoderMixer2MT.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Archive\Common\CoderMixer2ST.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Archive\Common\CoderMixer2ST.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Archive\Common\DummyOutStream.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -1721,6 +1729,14 @@ SOURCE=..\..\Archive\Common\DummyOutStream.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Archive\Common\HandlerOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Archive\Common\HandlerOut.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Archive\Common\InStreamWithCRC.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -29,11 +29,11 @@ COMMON_OBJS = \
|
||||
$O\NewHandler.obj \
|
||||
$O\StdInStream.obj \
|
||||
$O\StdOutStream.obj \
|
||||
$O\String.obj \
|
||||
$O\MyString.obj \
|
||||
$O\StringConvert.obj \
|
||||
$O\StringToInt.obj \
|
||||
$O\UTFConvert.obj \
|
||||
$O\Vector.obj \
|
||||
$O\MyVector.obj \
|
||||
$O\Wildcard.obj \
|
||||
|
||||
WIN_OBJS = \
|
||||
@@ -46,7 +46,8 @@ WIN_OBJS = \
|
||||
$O\MemoryLock.obj \
|
||||
$O\PropVariant.obj \
|
||||
$O\PropVariantConversions.obj \
|
||||
$O\Synchronization.obj
|
||||
$O\Synchronization.obj \
|
||||
$O\System.obj \
|
||||
|
||||
7ZIP_COMMON_OBJS = \
|
||||
$O\CreateCoder.obj \
|
||||
@@ -61,6 +62,7 @@ WIN_OBJS = \
|
||||
$O\LSBFEncoder.obj \
|
||||
$O\MemBlocks.obj \
|
||||
$O\MethodId.obj \
|
||||
$O\MethodProps.obj \
|
||||
$O\OffsetStream.obj \
|
||||
$O\OutBuffer.obj \
|
||||
$O\OutMemStream.obj \
|
||||
@@ -69,6 +71,7 @@ WIN_OBJS = \
|
||||
$O\StreamBinder.obj \
|
||||
$O\StreamObjects.obj \
|
||||
$O\StreamUtils.obj \
|
||||
$O\VirtThread.obj \
|
||||
|
||||
UI_COMMON_OBJS = \
|
||||
$O\ArchiveCommandLine.obj \
|
||||
@@ -96,6 +99,7 @@ AR_COMMON_OBJS = \
|
||||
$O\CoderMixer2MT.obj \
|
||||
$O\CrossThreadProgress.obj \
|
||||
$O\DummyOutStream.obj \
|
||||
$O\HandlerOut.obj \
|
||||
$O\InStreamWithCRC.obj \
|
||||
$O\ItemNameUtils.obj \
|
||||
$O\MultiStream.obj \
|
||||
|
||||
@@ -237,14 +237,6 @@ SOURCE=.\StdAfx.h
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\AlignedBuffer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\AlignedBuffer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\AutoPtr.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -277,10 +269,6 @@ SOURCE=..\..\..\Common\DynamicBuffer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Exception.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\IntToString.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -301,6 +289,10 @@ SOURCE=..\..\..\Common\MyCom.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyException.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyGuidDef.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -309,10 +301,26 @@ SOURCE=..\..\..\Common\MyInitGuid.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyString.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyString.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyUnknown.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyVector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyVector.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyWindows.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -353,14 +361,6 @@ SOURCE=..\..\..\Common\StdOutStream.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\String.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\String.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\StringConvert.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -389,14 +389,6 @@ SOURCE=..\..\..\Common\UTFConvert.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Vector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Vector.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Wildcard.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -501,6 +493,14 @@ SOURCE=..\..\..\Windows\Synchronization.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\System.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\System.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Thread.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -609,6 +609,14 @@ SOURCE=..\..\Common\MethodId.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\MethodProps.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\MethodProps.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\MSBFDecoder.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -679,6 +687,14 @@ SOURCE=..\..\Common\StreamUtils.cpp
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\VirtThread.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\VirtThread.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Compress"
|
||||
|
||||
@@ -1054,14 +1070,6 @@ SOURCE=..\..\Archive\Common\CoderMixer2MT.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Archive\Common\CoderMixer2ST.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Archive\Common\CoderMixer2ST.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Archive\Common\DummyOutStream.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -1070,6 +1078,14 @@ SOURCE=..\..\Archive\Common\DummyOutStream.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Archive\Common\HandlerOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Archive\Common\HandlerOut.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Archive\Common\InStreamWithCRC.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -1199,6 +1215,10 @@ SOURCE=..\..\UI\Common\OpenArchive.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\UI\Common\Property.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\UI\Common\PropIDUtils.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -30,11 +30,11 @@ COMMON_OBJS = \
|
||||
$O\NewHandler.obj \
|
||||
$O\StdInStream.obj \
|
||||
$O\StdOutStream.obj \
|
||||
$O\String.obj \
|
||||
$O\MyString.obj \
|
||||
$O\StringConvert.obj \
|
||||
$O\StringToInt.obj \
|
||||
$O\UTFConvert.obj \
|
||||
$O\Vector.obj \
|
||||
$O\MyVector.obj \
|
||||
$O\Wildcard.obj \
|
||||
|
||||
WIN_OBJS = \
|
||||
@@ -47,7 +47,8 @@ WIN_OBJS = \
|
||||
$O\MemoryLock.obj \
|
||||
$O\PropVariant.obj \
|
||||
$O\PropVariantConversions.obj \
|
||||
$O\Synchronization.obj
|
||||
$O\Synchronization.obj \
|
||||
$O\System.obj \
|
||||
|
||||
7ZIP_COMMON_OBJS = \
|
||||
$O\CreateCoder.obj \
|
||||
@@ -59,12 +60,14 @@ WIN_OBJS = \
|
||||
$O\LimitedStreams.obj \
|
||||
$O\LockedStream.obj \
|
||||
$O\MethodId.obj \
|
||||
$O\MethodProps.obj \
|
||||
$O\OffsetStream.obj \
|
||||
$O\OutBuffer.obj \
|
||||
$O\ProgressUtils.obj \
|
||||
$O\StreamBinder.obj \
|
||||
$O\StreamObjects.obj \
|
||||
$O\StreamUtils.obj \
|
||||
$O\VirtThread.obj \
|
||||
|
||||
UI_COMMON_OBJS = \
|
||||
$O\ArchiveCommandLine.obj \
|
||||
@@ -92,6 +95,7 @@ AR_COMMON_OBJS = \
|
||||
$O\CoderMixer2MT.obj \
|
||||
$O\CrossThreadProgress.obj \
|
||||
$O\DummyOutStream.obj \
|
||||
$O\HandlerOut.obj \
|
||||
$O\InStreamWithCRC.obj \
|
||||
$O\ItemNameUtils.obj \
|
||||
$O\MultiStream.obj \
|
||||
|
||||
@@ -12,10 +12,10 @@ COMMON_OBJS = \
|
||||
$O\CRC.obj \
|
||||
$O\IntToString.obj \
|
||||
$O\NewHandler.obj \
|
||||
$O\String.obj \
|
||||
$O\MyString.obj \
|
||||
$O\StringConvert.obj \
|
||||
$O\StringToInt.obj \
|
||||
$O\Vector.obj \
|
||||
$O\MyVector.obj \
|
||||
$O\Wildcard.obj \
|
||||
|
||||
WIN_OBJS = \
|
||||
@@ -23,7 +23,8 @@ WIN_OBJS = \
|
||||
$O\FileFind.obj \
|
||||
$O\FileIO.obj \
|
||||
$O\PropVariant.obj \
|
||||
$O\Synchronization.obj
|
||||
$O\Synchronization.obj \
|
||||
$O\System.obj \
|
||||
|
||||
7ZIP_COMMON_OBJS = \
|
||||
$O\CreateCoder.obj \
|
||||
@@ -34,11 +35,13 @@ WIN_OBJS = \
|
||||
$O\LockedStream.obj \
|
||||
$O\LSBFDecoder.obj \
|
||||
$O\MethodId.obj \
|
||||
$O\MethodProps.obj \
|
||||
$O\OutBuffer.obj \
|
||||
$O\ProgressUtils.obj \
|
||||
$O\StreamBinder.obj \
|
||||
$O\StreamObjects.obj \
|
||||
$O\StreamUtils.obj \
|
||||
$O\VirtThread.obj \
|
||||
|
||||
AR_OBJS = \
|
||||
$O\ArchiveExports.obj \
|
||||
@@ -48,6 +51,7 @@ AR_COMMON_OBJS = \
|
||||
$O\CoderMixer2.obj \
|
||||
$O\CoderMixer2MT.obj \
|
||||
$O\CrossThreadProgress.obj \
|
||||
$O\HandlerOut.obj \
|
||||
$O\InStreamWithCRC.obj \
|
||||
$O\ItemNameUtils.obj \
|
||||
$O\OutStreamWithCRC.obj \
|
||||
@@ -134,6 +138,8 @@ AES_ORIG_OBJS = \
|
||||
$O\aestab.obj \
|
||||
|
||||
CRYPTO_HASH_OBJS = \
|
||||
$O\RandGen.obj \
|
||||
$O\Sha1.obj \
|
||||
$O\Sha256.obj \
|
||||
|
||||
C_OBJS = \
|
||||
|
||||
@@ -10,10 +10,10 @@ COMMON_OBJS = \
|
||||
$O\CRC.obj \
|
||||
$O\IntToString.obj \
|
||||
$O\NewHandler.obj \
|
||||
$O\String.obj \
|
||||
$O\MyString.obj \
|
||||
$O\StringConvert.obj \
|
||||
$O\StringToInt.obj \
|
||||
$O\Vector.obj \
|
||||
$O\MyVector.obj \
|
||||
$O\Wildcard.obj \
|
||||
|
||||
WIN_OBJS = \
|
||||
@@ -21,7 +21,8 @@ WIN_OBJS = \
|
||||
$O\FileFind.obj \
|
||||
$O\FileIO.obj \
|
||||
$O\PropVariant.obj \
|
||||
$O\Synchronization.obj
|
||||
$O\Synchronization.obj \
|
||||
$O\System.obj \
|
||||
|
||||
7ZIP_COMMON_OBJS = \
|
||||
$O\CreateCoder.obj \
|
||||
@@ -37,6 +38,7 @@ WIN_OBJS = \
|
||||
$O\StreamBinder.obj \
|
||||
$O\StreamObjects.obj \
|
||||
$O\StreamUtils.obj \
|
||||
$O\VirtThread.obj \
|
||||
|
||||
AR_OBJS = \
|
||||
$O\ArchiveExports.obj \
|
||||
|
||||
@@ -10,10 +10,10 @@ COMMON_OBJS = \
|
||||
$O\CRC.obj \
|
||||
$O\IntToString.obj \
|
||||
$O\NewHandler.obj \
|
||||
$O\String.obj \
|
||||
$O\MyString.obj \
|
||||
$O\StringConvert.obj \
|
||||
$O\StringToInt.obj \
|
||||
$O\Vector.obj \
|
||||
$O\MyVector.obj \
|
||||
$O\Wildcard.obj \
|
||||
|
||||
WIN_OBJS = \
|
||||
@@ -21,7 +21,8 @@ WIN_OBJS = \
|
||||
$O\FileFind.obj \
|
||||
$O\FileIO.obj \
|
||||
$O\PropVariant.obj \
|
||||
$O\Synchronization.obj
|
||||
$O\Synchronization.obj \
|
||||
$O\System.obj \
|
||||
|
||||
7ZIP_COMMON_OBJS = \
|
||||
$O\CreateCoder.obj \
|
||||
@@ -31,11 +32,13 @@ WIN_OBJS = \
|
||||
$O\LimitedStreams.obj \
|
||||
$O\LockedStream.obj \
|
||||
$O\MethodId.obj \
|
||||
$O\MethodProps.obj \
|
||||
$O\OutBuffer.obj \
|
||||
$O\ProgressUtils.obj \
|
||||
$O\StreamBinder.obj \
|
||||
$O\StreamObjects.obj \
|
||||
$O\StreamUtils.obj \
|
||||
$O\VirtThread.obj \
|
||||
|
||||
AR_OBJS = \
|
||||
$O\ArchiveExports.obj \
|
||||
@@ -45,6 +48,7 @@ AR_COMMON_OBJS = \
|
||||
$O\CoderMixer2.obj \
|
||||
$O\CoderMixer2MT.obj \
|
||||
$O\CrossThreadProgress.obj \
|
||||
$O\HandlerOut.obj \
|
||||
$O\ItemNameUtils.obj \
|
||||
$O\OutStreamWithCRC.obj \
|
||||
$O\ParseProperties.obj \
|
||||
|
||||
@@ -142,18 +142,30 @@ SOURCE=..\..\..\Common\IntToString.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyException.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyString.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyString.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyVector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyVector.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\NewHandler.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\String.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\String.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\StringConvert.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -178,14 +190,6 @@ SOURCE=..\..\..\Common\UTFConvert.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Vector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Vector.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Wildcard.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -238,6 +242,14 @@ SOURCE=..\..\..\Windows\Synchronization.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\System.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\System.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Thread.h
|
||||
# End Source File
|
||||
# End Group
|
||||
@@ -1160,6 +1172,14 @@ SOURCE=..\..\Common\MethodId.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\MethodProps.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\MethodProps.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\OffsetStream.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -1230,6 +1250,14 @@ SOURCE=..\..\Common\StreamUtils.cpp
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\VirtThread.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\VirtThread.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "C"
|
||||
|
||||
@@ -1411,7 +1439,7 @@ SOURCE=..\..\..\..\C\Compress\Branch\BranchX86.c
|
||||
|
||||
!IF "$(CFG)" == "7z - Win32 Release"
|
||||
|
||||
# ADD CPP /O2
|
||||
# ADD CPP /O2 /FAs
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "7z - Win32 Debug"
|
||||
@@ -1826,14 +1854,6 @@ SOURCE=..\..\Archive\Common\CoderMixer2MT.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Archive\Common\CrossThreadProgress.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Archive\Common\CrossThreadProgress.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Archive\Common\DummyOutStream.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -1842,6 +1862,14 @@ SOURCE=..\..\Archive\Common\DummyOutStream.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Archive\Common\HandlerOut.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Archive\Common\HandlerOut.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Archive\Common\InStreamWithCRC.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -12,10 +12,10 @@ COMMON_OBJS = \
|
||||
$O\CRC.obj \
|
||||
$O\IntToString.obj \
|
||||
$O\NewHandler.obj \
|
||||
$O\String.obj \
|
||||
$O\MyString.obj \
|
||||
$O\StringConvert.obj \
|
||||
$O\StringToInt.obj \
|
||||
$O\Vector.obj \
|
||||
$O\MyVector.obj \
|
||||
$O\UTFConvert.obj \
|
||||
$O\Wildcard.obj \
|
||||
|
||||
@@ -24,7 +24,8 @@ WIN_OBJS = \
|
||||
$O\FileFind.obj \
|
||||
$O\FileIO.obj \
|
||||
$O\PropVariant.obj \
|
||||
$O\Synchronization.obj
|
||||
$O\Synchronization.obj \
|
||||
$O\System.obj \
|
||||
|
||||
7ZIP_COMMON_OBJS = \
|
||||
$O\InBuffer.obj \
|
||||
@@ -36,6 +37,7 @@ WIN_OBJS = \
|
||||
$O\LSBFDecoder.obj \
|
||||
$O\LSBFEncoder.obj \
|
||||
$O\MethodId.obj \
|
||||
$O\MethodProps.obj \
|
||||
$O\MemBlocks.obj \
|
||||
$O\OffsetStream.obj \
|
||||
$O\OutBuffer.obj \
|
||||
@@ -45,6 +47,7 @@ WIN_OBJS = \
|
||||
$O\StreamBinder.obj \
|
||||
$O\StreamObjects.obj \
|
||||
$O\StreamUtils.obj \
|
||||
$O\VirtThread.obj \
|
||||
|
||||
AR_OBJS = \
|
||||
$O\ArchiveExports.obj \
|
||||
@@ -59,6 +62,7 @@ AR_COMMON_OBJS = \
|
||||
$O\ItemNameUtils.obj \
|
||||
$O\MultiStream.obj \
|
||||
$O\OutStreamWithCRC.obj \
|
||||
$O\HandlerOut.obj \
|
||||
$O\ParseProperties.obj \
|
||||
|
||||
|
||||
|
||||
@@ -10,10 +10,10 @@ COMMON_OBJS = \
|
||||
$O\CRC.obj \
|
||||
$O\IntToString.obj \
|
||||
$O\NewHandler.obj \
|
||||
$O\String.obj \
|
||||
$O\MyString.obj \
|
||||
$O\StringConvert.obj \
|
||||
$O\StringToInt.obj \
|
||||
$O\Vector.obj \
|
||||
$O\MyVector.obj \
|
||||
$O\Wildcard.obj \
|
||||
|
||||
WIN_OBJS = \
|
||||
@@ -21,7 +21,8 @@ WIN_OBJS = \
|
||||
$O\FileFind.obj \
|
||||
$O\FileIO.obj \
|
||||
$O\PropVariant.obj \
|
||||
$O\Synchronization.obj
|
||||
$O\Synchronization.obj \
|
||||
$O\System.obj \
|
||||
|
||||
7ZIP_COMMON_OBJS = \
|
||||
$O\CreateCoder.obj \
|
||||
@@ -31,11 +32,13 @@ WIN_OBJS = \
|
||||
$O\LimitedStreams.obj \
|
||||
$O\LockedStream.obj \
|
||||
$O\MethodId.obj \
|
||||
$O\MethodProps.obj \
|
||||
$O\OutBuffer.obj \
|
||||
$O\ProgressUtils.obj \
|
||||
$O\StreamBinder.obj \
|
||||
$O\StreamObjects.obj \
|
||||
$O\StreamUtils.obj \
|
||||
$O\VirtThread.obj \
|
||||
|
||||
AR_OBJS = \
|
||||
$O\ArchiveExports.obj \
|
||||
@@ -45,6 +48,7 @@ AR_COMMON_OBJS = \
|
||||
$O\CoderMixer2.obj \
|
||||
$O\CoderMixer2MT.obj \
|
||||
$O\CrossThreadProgress.obj \
|
||||
$O\HandlerOut.obj \
|
||||
$O\InStreamWithCRC.obj \
|
||||
$O\ItemNameUtils.obj \
|
||||
$O\OutStreamWithCRC.obj \
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "Common/Wildcard.h"
|
||||
#include "Common/StringConvert.h"
|
||||
#include "Common/MyCom.h"
|
||||
#include "Common/Exception.h"
|
||||
#include "Common/MyException.h"
|
||||
|
||||
#include "Windows/FileDir.h"
|
||||
#include "Windows/FileName.h"
|
||||
|
||||
@@ -512,6 +512,22 @@ SOURCE=..\..\..\Common\IntToString.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyString.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyString.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyVector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyVector.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\NewHandler.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -536,14 +552,6 @@ SOURCE=..\..\..\Common\StdOutStream.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\String.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\String.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\StringConvert.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -552,14 +560,6 @@ SOURCE=..\..\..\Common\StringConvert.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Vector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Vector.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Wildcard.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -674,6 +674,14 @@ SOURCE=..\..\Common\StreamUtils.cpp
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\VirtThread.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\VirtThread.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "UI"
|
||||
|
||||
|
||||
@@ -23,9 +23,9 @@ COMMON_OBJS = \
|
||||
$O\NewHandler.obj \
|
||||
$O\StdInStream.obj \
|
||||
$O\StdOutStream.obj \
|
||||
$O\String.obj \
|
||||
$O\MyString.obj \
|
||||
$O\StringConvert.obj \
|
||||
$O\Vector.obj \
|
||||
$O\MyVector.obj \
|
||||
$O\Wildcard.obj \
|
||||
|
||||
WIN_OBJS = \
|
||||
@@ -51,6 +51,7 @@ WIN_OBJS = \
|
||||
$O\StreamBinder.obj \
|
||||
$O\StreamObjects.obj \
|
||||
$O\StreamUtils.obj \
|
||||
$O\VirtThread.obj \
|
||||
|
||||
UI_COMMON_OBJS = \
|
||||
$O\ArchiveExtractCallback.obj \
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
#include "Common/String.h"
|
||||
#include "Windows/ResourceString.h"
|
||||
|
||||
#include "../../Archive/IArchive.h"
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#ifndef __EXTRACTENGINE_H
|
||||
#define __EXTRACTENGINE_H
|
||||
|
||||
#include "Common/String.h"
|
||||
#include "../../UI/GUI/OpenCallbackGUI.h"
|
||||
#include "../../UI/Common/LoadCodecs.h"
|
||||
|
||||
|
||||
@@ -341,6 +341,22 @@ SOURCE=..\..\..\Common\IntToString.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyString.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyString.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyVector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyVector.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\NewHandler.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -349,14 +365,6 @@ SOURCE=..\..\..\Common\NewHandler.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\String.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\String.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\StringConvert.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -381,14 +389,6 @@ SOURCE=..\..\..\Common\UTFConvert.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Vector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Vector.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Wildcard.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -583,6 +583,14 @@ SOURCE=..\..\Common\StreamUtils.cpp
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\VirtThread.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\VirtThread.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "UI"
|
||||
|
||||
|
||||
@@ -20,11 +20,11 @@ COMMON_OBJS = \
|
||||
$O\CRC.obj \
|
||||
$O\IntToString.obj \
|
||||
$O\NewHandler.obj \
|
||||
$O\String.obj \
|
||||
$O\MyString.obj \
|
||||
$O\StringConvert.obj \
|
||||
$O\TextConfig.obj \
|
||||
$O\UTFConvert.obj \
|
||||
$O\Vector.obj \
|
||||
$O\MyVector.obj \
|
||||
$O\Wildcard.obj \
|
||||
|
||||
WIN_OBJS = \
|
||||
@@ -54,6 +54,7 @@ WIN_CTRL_OBJS = \
|
||||
$O\StreamBinder.obj \
|
||||
$O\StreamObjects.obj \
|
||||
$O\StreamUtils.obj \
|
||||
$O\VirtThread.obj \
|
||||
|
||||
UI_COMMON_OBJS = \
|
||||
$O\ArchiveOpenCallback.obj \
|
||||
|
||||
@@ -550,6 +550,14 @@ SOURCE=..\..\Common\StreamUtils.cpp
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\VirtThread.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\VirtThread.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "File Manager"
|
||||
|
||||
@@ -712,6 +720,22 @@ SOURCE=..\..\..\Common\IntToString.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyString.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyString.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyVector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyVector.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\NewHandler.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -720,14 +744,6 @@ SOURCE=..\..\..\Common\NewHandler.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\String.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\String.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\StringConvert.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -736,14 +752,6 @@ SOURCE=..\..\..\Common\StringConvert.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Vector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Vector.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Wildcard.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@@ -19,9 +19,9 @@ COMMON_OBJS = \
|
||||
$O\CommandLineParser.obj \
|
||||
$O\IntToString.obj \
|
||||
$O\NewHandler.obj \
|
||||
$O\String.obj \
|
||||
$O\MyString.obj \
|
||||
$O\StringConvert.obj \
|
||||
$O\Vector.obj \
|
||||
$O\MyVector.obj \
|
||||
$O\Wildcard.obj \
|
||||
|
||||
WIN_OBJS = \
|
||||
@@ -54,6 +54,7 @@ WIN_CTRL_OBJS = \
|
||||
$O\StreamBinder.obj \
|
||||
$O\StreamObjects.obj \
|
||||
$O\StreamUtils.obj \
|
||||
$O\VirtThread.obj \
|
||||
|
||||
UI_COMMON_OBJS = \
|
||||
$O\ArchiveExtractCallback.obj \
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#define __CREATECODER_H
|
||||
|
||||
#include "Common/MyCom.h"
|
||||
#include "Common/String.h"
|
||||
#include "Common/MyString.h"
|
||||
#include "../ICoder.h"
|
||||
|
||||
#include "MethodId.h"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#ifndef __FILEPATHAUTORENAME_H
|
||||
#define __FILEPATHAUTORENAME_H
|
||||
|
||||
#include "Common/String.h"
|
||||
#include "Common/MyString.h"
|
||||
|
||||
bool AutoRenamePath(UString &fullProcessedPath);
|
||||
|
||||
|
||||
@@ -238,6 +238,18 @@ STDMETHODIMP CFilterCoder::WriteCoderProperties(ISequentialOutStream *outStream)
|
||||
{
|
||||
return _writeCoderProperties->WriteCoderProperties(outStream);
|
||||
}
|
||||
|
||||
/*
|
||||
STDMETHODIMP CFilterCoder::ResetSalt()
|
||||
{
|
||||
return _CryptoResetSalt->ResetSalt();
|
||||
}
|
||||
*/
|
||||
|
||||
STDMETHODIMP CFilterCoder::ResetInitVector()
|
||||
{
|
||||
return _CryptoResetInitVector->ResetInitVector();
|
||||
}
|
||||
#endif
|
||||
|
||||
STDMETHODIMP CFilterCoder::SetDecoderProperties2(const Byte *data, UInt32 size)
|
||||
|
||||
@@ -26,6 +26,8 @@ class CFilterCoder:
|
||||
#endif
|
||||
#ifndef EXTRACT_ONLY
|
||||
public ICompressWriteCoderProperties,
|
||||
// public ICryptoResetSalt,
|
||||
public ICryptoResetInitVector,
|
||||
#endif
|
||||
public ICompressSetDecoderProperties2,
|
||||
public CMyUnknownImp
|
||||
@@ -53,6 +55,8 @@ protected:
|
||||
CMyComPtr<ICryptoSetPassword> _setPassword;
|
||||
#ifndef EXTRACT_ONLY
|
||||
CMyComPtr<ICompressWriteCoderProperties> _writeCoderProperties;
|
||||
// CMyComPtr<ICryptoResetSalt> _CryptoResetSalt;
|
||||
CMyComPtr<ICryptoResetInitVector> _CryptoResetInitVector;
|
||||
#endif
|
||||
CMyComPtr<ICompressSetDecoderProperties2> _setDecoderProperties;
|
||||
public:
|
||||
@@ -82,6 +86,8 @@ public:
|
||||
|
||||
#ifndef EXTRACT_ONLY
|
||||
MY_QUERYINTERFACE_ENTRY_AG(ICompressWriteCoderProperties, Filter, _writeCoderProperties)
|
||||
// MY_QUERYINTERFACE_ENTRY_AG(ICryptoResetSalt, Filter, _CryptoResetSalt)
|
||||
MY_QUERYINTERFACE_ENTRY_AG(ICryptoResetInitVector, Filter, _CryptoResetInitVector)
|
||||
#endif
|
||||
|
||||
MY_QUERYINTERFACE_ENTRY_AG(ICompressSetDecoderProperties2, Filter, _setDecoderProperties)
|
||||
@@ -105,6 +111,8 @@ public:
|
||||
#endif
|
||||
#ifndef EXTRACT_ONLY
|
||||
STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream);
|
||||
// STDMETHOD(ResetSalt)();
|
||||
STDMETHOD(ResetInitVector)();
|
||||
#endif
|
||||
STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
|
||||
};
|
||||
|
||||
@@ -5,13 +5,12 @@
|
||||
|
||||
#include "../IStream.h"
|
||||
#include "../../Common/MyCom.h"
|
||||
#include "../../Common/MyException.h"
|
||||
|
||||
#ifndef _NO_EXCEPTIONS
|
||||
class CInBufferException
|
||||
struct CInBufferException: public CSystemException
|
||||
{
|
||||
public:
|
||||
HRESULT ErrorCode;
|
||||
CInBufferException(HRESULT errorCode): ErrorCode(errorCode) {}
|
||||
CInBufferException(HRESULT errorCode): CSystemException(errorCode) {}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ extern "C"
|
||||
}
|
||||
|
||||
#include "Common/Types.h"
|
||||
#include "Common/Vector.h"
|
||||
#include "Common/MyVector.h"
|
||||
|
||||
#include "Windows/Synchronization.h"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "MethodId.h"
|
||||
#include "../../Common/String.h"
|
||||
#include "../../Common/MyString.h"
|
||||
|
||||
static inline wchar_t GetHex(Byte value)
|
||||
{
|
||||
|
||||
Executable
+96
@@ -0,0 +1,96 @@
|
||||
// MethodProps.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "MethodProps.h"
|
||||
#include "../../Common/MyCom.h"
|
||||
|
||||
static UInt64 k_LZMA = 0x030101;
|
||||
// static UInt64 k_LZMA2 = 0x030102;
|
||||
|
||||
HRESULT SetMethodProperties(const CMethod &method, const UInt64 *inSizeForReduce, IUnknown *coder)
|
||||
{
|
||||
bool tryReduce = false;
|
||||
UInt32 reducedDictionarySize = 1 << 10;
|
||||
if (inSizeForReduce != 0 && (method.Id == k_LZMA /* || methodFull.MethodID == k_LZMA2 */))
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
const UInt32 step = (reducedDictionarySize >> 1);
|
||||
if (reducedDictionarySize >= *inSizeForReduce)
|
||||
{
|
||||
tryReduce = true;
|
||||
break;
|
||||
}
|
||||
reducedDictionarySize += step;
|
||||
if (reducedDictionarySize >= *inSizeForReduce)
|
||||
{
|
||||
tryReduce = true;
|
||||
break;
|
||||
}
|
||||
if (reducedDictionarySize >= ((UInt32)3 << 30))
|
||||
break;
|
||||
reducedDictionarySize += step;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
int numProperties = method.Properties.Size();
|
||||
CMyComPtr<ICompressSetCoderProperties> setCoderProperties;
|
||||
coder->QueryInterface(IID_ICompressSetCoderProperties, (void **)&setCoderProperties);
|
||||
if (setCoderProperties == NULL)
|
||||
{
|
||||
if (numProperties != 0)
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
else
|
||||
{
|
||||
CRecordVector<PROPID> propIDs;
|
||||
NWindows::NCOM::CPropVariant *values = new NWindows::NCOM::CPropVariant[numProperties];
|
||||
HRESULT res = S_OK;
|
||||
try
|
||||
{
|
||||
for (int i = 0; i < numProperties; i++)
|
||||
{
|
||||
const CProp &prop = method.Properties[i];
|
||||
propIDs.Add(prop.Id);
|
||||
NWindows::NCOM::CPropVariant &value = values[i];
|
||||
value = prop.Value;
|
||||
// if (tryReduce && prop.Id == NCoderPropID::kDictionarySize && value.vt == VT_UI4 && reducedDictionarySize < value.ulVal)
|
||||
if (tryReduce)
|
||||
if (prop.Id == NCoderPropID::kDictionarySize)
|
||||
if (value.vt == VT_UI4)
|
||||
if (reducedDictionarySize < value.ulVal)
|
||||
value.ulVal = reducedDictionarySize;
|
||||
}
|
||||
CMyComPtr<ICompressSetCoderProperties> setCoderProperties;
|
||||
coder->QueryInterface(IID_ICompressSetCoderProperties, (void **)&setCoderProperties);
|
||||
res = setCoderProperties->SetCoderProperties(&propIDs.Front(), values, numProperties);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
delete []values;
|
||||
throw;
|
||||
}
|
||||
delete []values;
|
||||
RINOK(res);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
CMyComPtr<ICompressWriteCoderProperties> writeCoderProperties;
|
||||
coder->QueryInterface(IID_ICompressWriteCoderProperties, (void **)&writeCoderProperties);
|
||||
if (writeCoderProperties != NULL)
|
||||
{
|
||||
CSequentialOutStreamImp *outStreamSpec = new CSequentialOutStreamImp;
|
||||
CMyComPtr<ISequentialOutStream> outStream(outStreamSpec);
|
||||
outStreamSpec->Init();
|
||||
RINOK(writeCoderProperties->WriteCoderProperties(outStream));
|
||||
size_t size = outStreamSpec->GetSize();
|
||||
filterProps.SetCapacity(size);
|
||||
memmove(filterProps, outStreamSpec->GetBuffer(), size);
|
||||
}
|
||||
*/
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
// MethodProps.h
|
||||
|
||||
#ifndef __7Z_METHOD_PROPS_H
|
||||
#define __7Z_METHOD_PROPS_H
|
||||
|
||||
#include "MethodId.h"
|
||||
|
||||
#include "../../Windows/PropVariant.h"
|
||||
#include "../../Common/MyVector.h"
|
||||
#include "../ICoder.h"
|
||||
|
||||
struct CProp
|
||||
{
|
||||
PROPID Id;
|
||||
NWindows::NCOM::CPropVariant Value;
|
||||
};
|
||||
|
||||
struct CMethod
|
||||
{
|
||||
CMethodId Id;
|
||||
CObjectVector<CProp> Properties;
|
||||
};
|
||||
|
||||
struct CMethodsMode
|
||||
{
|
||||
CObjectVector<CMethod> Methods;
|
||||
#ifdef COMPRESS_MT
|
||||
UInt32 NumThreads;
|
||||
#endif
|
||||
|
||||
CMethodsMode()
|
||||
#ifdef COMPRESS_MT
|
||||
: NumThreads(1)
|
||||
#endif
|
||||
{}
|
||||
bool IsEmpty() const { return Methods.IsEmpty() ; }
|
||||
};
|
||||
|
||||
HRESULT SetMethodProperties(const CMethod &method, const UInt64 *inSizeForReduce, IUnknown *coder);
|
||||
|
||||
#endif
|
||||
@@ -5,12 +5,12 @@
|
||||
|
||||
#include "../IStream.h"
|
||||
#include "../../Common/MyCom.h"
|
||||
#include "../../Common/MyException.h"
|
||||
|
||||
#ifndef _NO_EXCEPTIONS
|
||||
struct COutBufferException
|
||||
{
|
||||
HRESULT ErrorCode;
|
||||
COutBufferException(HRESULT errorCode): ErrorCode(errorCode) {}
|
||||
struct COutBufferException: public CSystemException
|
||||
{
|
||||
COutBufferException(HRESULT errorCode): CSystemException(errorCode) {}
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -28,7 +28,6 @@ protected:
|
||||
bool _overDict;
|
||||
|
||||
HRESULT FlushPart();
|
||||
void FlushWithCheck();
|
||||
public:
|
||||
#ifdef _NO_EXCEPTIONS
|
||||
HRESULT ErrorCode;
|
||||
@@ -44,6 +43,7 @@ public:
|
||||
void SetStream(ISequentialOutStream *stream);
|
||||
void Init();
|
||||
HRESULT Flush();
|
||||
void FlushWithCheck();
|
||||
void ReleaseStream() { _stream.Release(); }
|
||||
|
||||
void WriteByte(Byte b)
|
||||
|
||||
@@ -4,13 +4,12 @@
|
||||
#define __PROGRESSMT_H
|
||||
|
||||
#include "../../Common/MyCom.h"
|
||||
#include "../../Common/MyVector.h"
|
||||
#include "../../Windows/Synchronization.h"
|
||||
|
||||
#include "../ICoder.h"
|
||||
#include "../IProgress.h"
|
||||
|
||||
#include "Windows/Synchronization.h"
|
||||
#include "../../Common/Vector.h"
|
||||
|
||||
class CMtCompressProgressMixer
|
||||
{
|
||||
CMyComPtr<ICompressProgressInfo> _progress;
|
||||
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
// VirtThread.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "VirtThread.h"
|
||||
|
||||
static THREAD_FUNC_DECL CoderThread(void *p)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
CVirtThread *t = (CVirtThread *)p;
|
||||
t->StartEvent.Lock();
|
||||
if (t->ExitEvent)
|
||||
return 0;
|
||||
t->Execute();
|
||||
t->FinishedEvent.Set();
|
||||
}
|
||||
}
|
||||
|
||||
HRes CVirtThread::Create()
|
||||
{
|
||||
RINOK(StartEvent.CreateIfNotCreated());
|
||||
RINOK(FinishedEvent.CreateIfNotCreated());
|
||||
StartEvent.Reset();
|
||||
FinishedEvent.Reset();
|
||||
ExitEvent = false;
|
||||
if (Thread.IsCreated())
|
||||
return S_OK;
|
||||
return Thread.Create(CoderThread, this);
|
||||
}
|
||||
|
||||
void CVirtThread::Start()
|
||||
{
|
||||
ExitEvent = false;
|
||||
StartEvent.Set();
|
||||
}
|
||||
|
||||
CVirtThread::~CVirtThread()
|
||||
{
|
||||
ExitEvent = true;
|
||||
if (StartEvent.IsCreated())
|
||||
StartEvent.Set();
|
||||
Thread.Wait();
|
||||
}
|
||||
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
// VirtThread.h
|
||||
|
||||
#ifndef __VIRTTHREAD_H
|
||||
#define __VIRTTHREAD_H
|
||||
|
||||
#include "../../Windows/Synchronization.h"
|
||||
#include "../../Windows/Thread.h"
|
||||
|
||||
struct CVirtThread
|
||||
{
|
||||
NWindows::NSynchronization::CAutoResetEvent StartEvent;
|
||||
NWindows::NSynchronization::CAutoResetEvent FinishedEvent;
|
||||
NWindows::CThread Thread;
|
||||
bool ExitEvent;
|
||||
|
||||
~CVirtThread();
|
||||
HRes Create();
|
||||
void Start();
|
||||
void WaitFinish() { FinishedEvent.Lock(); }
|
||||
virtual void Execute() = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -5,9 +5,9 @@
|
||||
#include "../../Common/RegisterCodec.h"
|
||||
|
||||
#include "x86_2.h"
|
||||
static void *CreateCodec() { return (void *)(ICompressCoder2 *)(new CBCJ2_x86_Decoder()); }
|
||||
static void *CreateCodec() { return (void *)(ICompressCoder2 *)(new NCompress::NBcj2::CDecoder()); }
|
||||
#ifndef EXTRACT_ONLY
|
||||
static void *CreateCodecOut() { return (void *)(ICompressCoder2 *)(new CBCJ2_x86_Encoder()); }
|
||||
static void *CreateCodecOut() { return (void *)(ICompressCoder2 *)(new NCompress::NBcj2::CEncoder()); }
|
||||
#else
|
||||
#define CreateCodecOut 0
|
||||
#endif
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
|
||||
UInt32 CBCJ_x86_Encoder::SubFilter(Byte *data, UInt32 size)
|
||||
{
|
||||
return ::x86_Convert(data, size, _bufferPos, &_prevMask, &_prevPos, 1);
|
||||
return (UInt32)::x86_Convert(data, size, _bufferPos, &_prevMask, 1);
|
||||
}
|
||||
|
||||
UInt32 CBCJ_x86_Decoder::SubFilter(Byte *data, UInt32 size)
|
||||
{
|
||||
return ::x86_Convert(data, size, _bufferPos, &_prevMask, &_prevPos, 0);
|
||||
return (UInt32)::x86_Convert(data, size, _bufferPos, &_prevMask, 0);
|
||||
}
|
||||
|
||||
@@ -12,8 +12,7 @@ extern "C"
|
||||
struct CBranch86
|
||||
{
|
||||
UInt32 _prevMask;
|
||||
UInt32 _prevPos;
|
||||
void x86Init() { x86_Convert_Init(_prevMask, _prevPos); }
|
||||
void x86Init() { x86_Convert_Init(_prevMask); }
|
||||
};
|
||||
|
||||
MyClassB(BCJ_x86, 0x01, 3, CBranch86 ,
|
||||
|
||||
@@ -8,10 +8,12 @@ extern "C"
|
||||
#include "../../../../C/Alloc.h"
|
||||
}
|
||||
|
||||
inline bool IsJcc(Byte b0, Byte b1)
|
||||
{
|
||||
return (b0 == 0x0F && (b1 & 0xF0) == 0x80);
|
||||
}
|
||||
namespace NCompress {
|
||||
namespace NBcj2 {
|
||||
|
||||
inline bool IsJcc(Byte b0, Byte b1) { return (b0 == 0x0F && (b1 & 0xF0) == 0x80); }
|
||||
inline bool IsJ(Byte b0, Byte b1) { return ((b1 & 0xFE) == 0xE8 || IsJcc(b0, b1)); }
|
||||
inline unsigned GetIndex(Byte b0, Byte b1) { return ((b1 == 0xE8) ? b0 : ((b1 == 0xE9) ? 256 : 257)); }
|
||||
|
||||
#ifndef EXTRACT_ONLY
|
||||
|
||||
@@ -22,7 +24,7 @@ static bool inline Test86MSByte(Byte b)
|
||||
return (b == 0 || b == 0xFF);
|
||||
}
|
||||
|
||||
bool CBCJ2_x86_Encoder::Create()
|
||||
bool CEncoder::Create()
|
||||
{
|
||||
if (!_mainStream.Create(1 << 16))
|
||||
return false;
|
||||
@@ -41,12 +43,12 @@ bool CBCJ2_x86_Encoder::Create()
|
||||
return true;
|
||||
}
|
||||
|
||||
CBCJ2_x86_Encoder::~CBCJ2_x86_Encoder()
|
||||
CEncoder::~CEncoder()
|
||||
{
|
||||
::MidFree(_buffer);
|
||||
}
|
||||
|
||||
HRESULT CBCJ2_x86_Encoder::Flush()
|
||||
HRESULT CEncoder::Flush()
|
||||
{
|
||||
RINOK(_mainStream.Flush());
|
||||
RINOK(_callStream.Flush());
|
||||
@@ -57,7 +59,7 @@ HRESULT CBCJ2_x86_Encoder::Flush()
|
||||
|
||||
const UInt32 kDefaultLimit = (1 << 24);
|
||||
|
||||
HRESULT CBCJ2_x86_Encoder::CodeReal(ISequentialInStream **inStreams,
|
||||
HRESULT CEncoder::CodeReal(ISequentialInStream **inStreams,
|
||||
const UInt64 **inSizes,
|
||||
UInt32 numInStreams,
|
||||
ISequentialOutStream **outStreams,
|
||||
@@ -91,10 +93,8 @@ HRESULT CBCJ2_x86_Encoder::CodeReal(ISequentialInStream **inStreams,
|
||||
_jumpStream.Init();
|
||||
_rangeEncoder.SetStream(outStreams[3]);
|
||||
_rangeEncoder.Init();
|
||||
for (int i = 0; i < 256; i++)
|
||||
_statusE8Encoder[i].Init();
|
||||
_statusE9Encoder.Init();
|
||||
_statusJccEncoder.Init();
|
||||
for (int i = 0; i < 256 + 2; i++)
|
||||
_statusEncoder[i].Init();
|
||||
CCoderReleaser releaser(this);
|
||||
|
||||
CMyComPtr<ICompressGetSubStreamSize> getSubStreamSize;
|
||||
@@ -135,12 +135,19 @@ HRESULT CBCJ2_x86_Encoder::CodeReal(ISequentialInStream **inStreams,
|
||||
{
|
||||
Byte b = _buffer[bufferPos];
|
||||
_mainStream.WriteByte(b);
|
||||
UInt32 index;
|
||||
if (b == 0xE8)
|
||||
_statusE8Encoder[prevByte].Encode(&_rangeEncoder, 0);
|
||||
index = prevByte;
|
||||
else if (b == 0xE9)
|
||||
_statusE9Encoder.Encode(&_rangeEncoder, 0);
|
||||
index = 256;
|
||||
else if (IsJcc(prevByte, b))
|
||||
_statusJccEncoder.Encode(&_rangeEncoder, 0);
|
||||
index = 257;
|
||||
else
|
||||
{
|
||||
prevByte = b;
|
||||
continue;
|
||||
}
|
||||
_statusEncoder[index].Encode(&_rangeEncoder, 0);
|
||||
prevByte = b;
|
||||
}
|
||||
return Flush();
|
||||
@@ -153,7 +160,7 @@ HRESULT CBCJ2_x86_Encoder::CodeReal(ISequentialInStream **inStreams,
|
||||
{
|
||||
Byte b = _buffer[bufferPos];
|
||||
_mainStream.WriteByte(b);
|
||||
if (b != 0xE8 && b != 0xE9 && !IsJcc(prevByte, b))
|
||||
if (!IsJ(prevByte, b))
|
||||
{
|
||||
bufferPos++;
|
||||
prevByte = b;
|
||||
@@ -209,40 +216,19 @@ HRESULT CBCJ2_x86_Encoder::CodeReal(ISequentialInStream **inStreams,
|
||||
convert = (dest < inSize);
|
||||
else
|
||||
convert = Test86MSByte(nextByte);
|
||||
unsigned index = GetIndex(prevByte, b);
|
||||
if (convert)
|
||||
{
|
||||
if (b == 0xE8)
|
||||
_statusE8Encoder[prevByte].Encode(&_rangeEncoder, 1);
|
||||
else if (b == 0xE9)
|
||||
_statusE9Encoder.Encode(&_rangeEncoder, 1);
|
||||
else
|
||||
_statusJccEncoder.Encode(&_rangeEncoder, 1);
|
||||
|
||||
_statusEncoder[index].Encode(&_rangeEncoder, 1);
|
||||
bufferPos += 5;
|
||||
if (b == 0xE8)
|
||||
{
|
||||
_callStream.WriteByte((Byte)(dest >> 24));
|
||||
_callStream.WriteByte((Byte)(dest >> 16));
|
||||
_callStream.WriteByte((Byte)(dest >> 8));
|
||||
_callStream.WriteByte((Byte)(dest));
|
||||
}
|
||||
else
|
||||
{
|
||||
_jumpStream.WriteByte((Byte)(dest >> 24));
|
||||
_jumpStream.WriteByte((Byte)(dest >> 16));
|
||||
_jumpStream.WriteByte((Byte)(dest >> 8));
|
||||
_jumpStream.WriteByte((Byte)(dest));
|
||||
}
|
||||
COutBuffer &s = (b == 0xE8) ? _callStream : _jumpStream;
|
||||
for (int i = 24; i >= 0; i -= 8)
|
||||
s.WriteByte((Byte)(dest >> i));
|
||||
prevByte = nextByte;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (b == 0xE8)
|
||||
_statusE8Encoder[prevByte].Encode(&_rangeEncoder, 0);
|
||||
else if (b == 0xE9)
|
||||
_statusE9Encoder.Encode(&_rangeEncoder, 0);
|
||||
else
|
||||
_statusJccEncoder.Encode(&_rangeEncoder, 0);
|
||||
_statusEncoder[index].Encode(&_rangeEncoder, 0);
|
||||
bufferPos++;
|
||||
prevByte = b;
|
||||
}
|
||||
@@ -262,7 +248,7 @@ HRESULT CBCJ2_x86_Encoder::CodeReal(ISequentialInStream **inStreams,
|
||||
}
|
||||
}
|
||||
|
||||
STDMETHODIMP CBCJ2_x86_Encoder::Code(ISequentialInStream **inStreams,
|
||||
STDMETHODIMP CEncoder::Code(ISequentialInStream **inStreams,
|
||||
const UInt64 **inSizes,
|
||||
UInt32 numInStreams,
|
||||
ISequentialOutStream **outStreams,
|
||||
@@ -281,7 +267,7 @@ STDMETHODIMP CBCJ2_x86_Encoder::Code(ISequentialInStream **inStreams,
|
||||
|
||||
#endif
|
||||
|
||||
HRESULT CBCJ2_x86_Decoder::CodeReal(ISequentialInStream **inStreams,
|
||||
HRESULT CDecoder::CodeReal(ISequentialInStream **inStreams,
|
||||
const UInt64 ** /* inSizes */,
|
||||
UInt32 numInStreams,
|
||||
ISequentialOutStream **outStreams,
|
||||
@@ -315,10 +301,8 @@ HRESULT CBCJ2_x86_Decoder::CodeReal(ISequentialInStream **inStreams,
|
||||
_rangeDecoder.Init();
|
||||
_outStream.Init();
|
||||
|
||||
for (int i = 0; i < 256; i++)
|
||||
_statusE8Decoder[i].Init();
|
||||
_statusE9Decoder.Init();
|
||||
_statusJccDecoder.Init();
|
||||
for (int i = 0; i < 256 + 2; i++)
|
||||
_statusDecoder[i].Init();
|
||||
|
||||
CCoderReleaser releaser(this);
|
||||
|
||||
@@ -326,62 +310,38 @@ HRESULT CBCJ2_x86_Decoder::CodeReal(ISequentialInStream **inStreams,
|
||||
UInt32 processedBytes = 0;
|
||||
for (;;)
|
||||
{
|
||||
if (processedBytes > (1 << 20) && progress != NULL)
|
||||
if (processedBytes >= (1 << 20) && progress != NULL)
|
||||
{
|
||||
UInt64 nowPos64 = _outStream.GetProcessedSize();
|
||||
RINOK(progress->SetRatioInfo(NULL, &nowPos64));
|
||||
processedBytes = 0;
|
||||
}
|
||||
processedBytes++;
|
||||
Byte b;
|
||||
if (!_mainInStream.ReadByte(b))
|
||||
return Flush();
|
||||
_outStream.WriteByte(b);
|
||||
if (b != 0xE8 && b != 0xE9 && !IsJcc(prevByte, b))
|
||||
UInt32 i;
|
||||
Byte b = 0;
|
||||
const UInt32 kBurstSize = (1 << 18);
|
||||
for (i = 0; i < kBurstSize; i++)
|
||||
{
|
||||
if (!_mainInStream.ReadByte(b))
|
||||
return Flush();
|
||||
_outStream.WriteByte(b);
|
||||
if (IsJ(prevByte, b))
|
||||
break;
|
||||
prevByte = b;
|
||||
continue;
|
||||
}
|
||||
bool status;
|
||||
if (b == 0xE8)
|
||||
status = (_statusE8Decoder[prevByte].Decode(&_rangeDecoder) == 1);
|
||||
else if (b == 0xE9)
|
||||
status = (_statusE9Decoder.Decode(&_rangeDecoder) == 1);
|
||||
else
|
||||
status = (_statusJccDecoder.Decode(&_rangeDecoder) == 1);
|
||||
if (status)
|
||||
processedBytes += i;
|
||||
if (i == kBurstSize)
|
||||
continue;
|
||||
unsigned index = GetIndex(prevByte, b);
|
||||
if (_statusDecoder[index].Decode(&_rangeDecoder) == 1)
|
||||
{
|
||||
UInt32 src;
|
||||
if (b == 0xE8)
|
||||
UInt32 src = 0;
|
||||
CInBuffer &s = (b == 0xE8) ? _callStream : _jumpStream;
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Byte b0;
|
||||
if(!_callStream.ReadByte(b0))
|
||||
return S_FALSE;
|
||||
src = ((UInt32)b0) << 24;
|
||||
if(!_callStream.ReadByte(b0))
|
||||
return S_FALSE;
|
||||
src |= ((UInt32)b0) << 16;
|
||||
if(!_callStream.ReadByte(b0))
|
||||
return S_FALSE;
|
||||
src |= ((UInt32)b0) << 8;
|
||||
if(!_callStream.ReadByte(b0))
|
||||
return S_FALSE;
|
||||
src |= ((UInt32)b0);
|
||||
}
|
||||
else
|
||||
{
|
||||
Byte b0;
|
||||
if(!_jumpStream.ReadByte(b0))
|
||||
return S_FALSE;
|
||||
src = ((UInt32)b0) << 24;
|
||||
if(!_jumpStream.ReadByte(b0))
|
||||
return S_FALSE;
|
||||
src |= ((UInt32)b0) << 16;
|
||||
if(!_jumpStream.ReadByte(b0))
|
||||
return S_FALSE;
|
||||
src |= ((UInt32)b0) << 8;
|
||||
if(!_jumpStream.ReadByte(b0))
|
||||
if(!s.ReadByte(b0))
|
||||
return S_FALSE;
|
||||
src <<= 8;
|
||||
src |= ((UInt32)b0);
|
||||
}
|
||||
UInt32 dest = src - (UInt32(_outStream.GetProcessedSize()) + 4) ;
|
||||
@@ -397,7 +357,7 @@ HRESULT CBCJ2_x86_Decoder::CodeReal(ISequentialInStream **inStreams,
|
||||
}
|
||||
}
|
||||
|
||||
STDMETHODIMP CBCJ2_x86_Decoder::Code(ISequentialInStream **inStreams,
|
||||
STDMETHODIMP CDecoder::Code(ISequentialInStream **inStreams,
|
||||
const UInt64 **inSizes,
|
||||
UInt32 numInStreams,
|
||||
ISequentialOutStream **outStreams,
|
||||
@@ -410,6 +370,9 @@ STDMETHODIMP CBCJ2_x86_Decoder::Code(ISequentialInStream **inStreams,
|
||||
return CodeReal(inStreams, inSizes, numInStreams,
|
||||
outStreams, outSizes,numOutStreams, progress);
|
||||
}
|
||||
catch(const CInBufferException &e) { return e.ErrorCode; }
|
||||
catch(const COutBufferException &e) { return e.ErrorCode; }
|
||||
catch(...) { return S_FALSE; }
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
@@ -7,38 +7,28 @@
|
||||
#include "../RangeCoder/RangeCoderBit.h"
|
||||
#include "../../ICoder.h"
|
||||
|
||||
// {23170F69-40C1-278B-0303-010100000100}
|
||||
#define MyClass2_a(Name, id, subId, encodingId) \
|
||||
DEFINE_GUID(CLSID_CCompressConvert ## Name, \
|
||||
0x23170F69, 0x40C1, 0x278B, 0x03, 0x03, id, subId, 0x00, 0x00, encodingId, 0x00);
|
||||
|
||||
#define MyClass_a(Name, id, subId) \
|
||||
MyClass2_a(Name ## _Encoder, id, subId, 0x01) \
|
||||
MyClass2_a(Name ## _Decoder, id, subId, 0x00)
|
||||
|
||||
MyClass_a(BCJ2_x86, 0x01, 0x1B)
|
||||
namespace NCompress {
|
||||
namespace NBcj2 {
|
||||
|
||||
const int kNumMoveBits = 5;
|
||||
|
||||
#ifndef EXTRACT_ONLY
|
||||
|
||||
class CBCJ2_x86_Encoder:
|
||||
class CEncoder:
|
||||
public ICompressCoder2,
|
||||
public CMyUnknownImp
|
||||
{
|
||||
Byte *_buffer;
|
||||
public:
|
||||
CBCJ2_x86_Encoder(): _buffer(0) {};
|
||||
~CBCJ2_x86_Encoder();
|
||||
CEncoder(): _buffer(0) {};
|
||||
~CEncoder();
|
||||
bool Create();
|
||||
|
||||
COutBuffer _mainStream;
|
||||
COutBuffer _callStream;
|
||||
COutBuffer _jumpStream;
|
||||
NCompress::NRangeCoder::CEncoder _rangeEncoder;
|
||||
NCompress::NRangeCoder::CBitEncoder<kNumMoveBits> _statusE8Encoder[256];
|
||||
NCompress::NRangeCoder::CBitEncoder<kNumMoveBits> _statusE9Encoder;
|
||||
NCompress::NRangeCoder::CBitEncoder<kNumMoveBits> _statusJccEncoder;
|
||||
NCompress::NRangeCoder::CBitEncoder<kNumMoveBits> _statusEncoder[256 + 2];
|
||||
|
||||
HRESULT Flush();
|
||||
void ReleaseStreams()
|
||||
@@ -51,9 +41,9 @@ public:
|
||||
|
||||
class CCoderReleaser
|
||||
{
|
||||
CBCJ2_x86_Encoder *_coder;
|
||||
CEncoder *_coder;
|
||||
public:
|
||||
CCoderReleaser(CBCJ2_x86_Encoder *coder): _coder(coder) {}
|
||||
CCoderReleaser(CEncoder *coder): _coder(coder) {}
|
||||
~CCoderReleaser() { _coder->ReleaseStreams(); }
|
||||
};
|
||||
|
||||
@@ -79,7 +69,7 @@ public:
|
||||
|
||||
#endif
|
||||
|
||||
class CBCJ2_x86_Decoder:
|
||||
class CDecoder:
|
||||
public ICompressCoder2,
|
||||
public CMyUnknownImp
|
||||
{
|
||||
@@ -88,9 +78,7 @@ public:
|
||||
CInBuffer _callStream;
|
||||
CInBuffer _jumpStream;
|
||||
NCompress::NRangeCoder::CDecoder _rangeDecoder;
|
||||
NCompress::NRangeCoder::CBitDecoder<kNumMoveBits> _statusE8Decoder[256];
|
||||
NCompress::NRangeCoder::CBitDecoder<kNumMoveBits> _statusE9Decoder;
|
||||
NCompress::NRangeCoder::CBitDecoder<kNumMoveBits> _statusJccDecoder;
|
||||
NCompress::NRangeCoder::CBitDecoder<kNumMoveBits> _statusDecoder[256 + 2];
|
||||
|
||||
COutBuffer _outStream;
|
||||
|
||||
@@ -106,9 +94,9 @@ public:
|
||||
HRESULT Flush() { return _outStream.Flush(); }
|
||||
class CCoderReleaser
|
||||
{
|
||||
CBCJ2_x86_Decoder *_coder;
|
||||
CDecoder *_coder;
|
||||
public:
|
||||
CCoderReleaser(CBCJ2_x86_Decoder *coder): _coder(coder) {}
|
||||
CCoderReleaser(CDecoder *coder): _coder(coder) {}
|
||||
~CCoderReleaser() { _coder->ReleaseStreams(); }
|
||||
};
|
||||
|
||||
@@ -130,4 +118,6 @@ public:
|
||||
ICompressProgressInfo *progress);
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -52,5 +52,11 @@ STDMETHODIMP CCopyCoder::Code(ISequentialInStream *inStream,
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CCopyCoder::GetInStreamProcessedSize(UInt64 *value)
|
||||
{
|
||||
*value = TotalSize;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ namespace NCompress {
|
||||
|
||||
class CCopyCoder:
|
||||
public ICompressCoder,
|
||||
public ICompressGetInStreamProcessedSize,
|
||||
public CMyUnknownImp
|
||||
{
|
||||
Byte *_buffer;
|
||||
@@ -18,12 +19,13 @@ public:
|
||||
CCopyCoder(): TotalSize(0) , _buffer(0) {};
|
||||
~CCopyCoder();
|
||||
|
||||
MY_UNKNOWN_IMP
|
||||
MY_UNKNOWN_IMP1(ICompressGetInStreamProcessedSize)
|
||||
|
||||
STDMETHOD(Code)(ISequentialInStream *inStream,
|
||||
ISequentialOutStream *outStream,
|
||||
const UInt64 *inSize, const UInt64 *outSize,
|
||||
ICompressProgressInfo *progress);
|
||||
STDMETHOD(GetInStreamProcessedSize)(UInt64 *value);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -237,6 +237,14 @@ SOURCE=..\..\..\Windows\Synchronization.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\System.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\System.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Thread.h
|
||||
# End Source File
|
||||
# End Group
|
||||
@@ -277,6 +285,22 @@ SOURCE=..\..\..\Common\MyCom.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyString.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyString.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyVector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyVector.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyWindows.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -289,14 +313,6 @@ SOURCE=..\..\..\Common\NewHandler.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\String.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\String.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\StringConvert.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@@ -315,14 +331,6 @@ SOURCE=..\..\..\Common\StringToInt.h
|
||||
|
||||
SOURCE=..\..\..\Common\Types.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Vector.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Vector.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "7zip Common"
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include "LzmaRam.h"
|
||||
|
||||
#ifdef COMPRESS_MF_MT
|
||||
#include "Windows/System.h"
|
||||
#include "../../../Windows/System.h"
|
||||
#endif
|
||||
|
||||
extern "C"
|
||||
@@ -92,7 +92,7 @@ static const CSwitchForm kSwitchForms[] =
|
||||
{ L"EOS", NSwitchType::kSimple, false },
|
||||
{ L"SI", NSwitchType::kSimple, false },
|
||||
{ L"SO", NSwitchType::kSimple, false },
|
||||
{ L"F86", NSwitchType::kSimple, false }
|
||||
{ L"F86", NSwitchType::kPostChar, false, 0, 0, L"+" }
|
||||
};
|
||||
|
||||
static const int kNumSwitches = sizeof(kSwitchForms) / sizeof(kSwitchForms[0]);
|
||||
@@ -159,7 +159,7 @@ int main2(int n, const char *args[])
|
||||
g_IsNT = IsItWindowsNT();
|
||||
#endif
|
||||
|
||||
fprintf(stderr, "\nLZMA 4.45 Copyright (c) 1999-2007 Igor Pavlov 2007-04-03\n");
|
||||
fprintf(stderr, "\nLZMA 4.48 Copyright (c) 1999-2007 Igor Pavlov 2007-06-24\n");
|
||||
|
||||
if (n == 1)
|
||||
{
|
||||
@@ -335,7 +335,7 @@ int main2(int n, const char *args[])
|
||||
if (!dictionaryIsDefined)
|
||||
dictionary = 1 << 23;
|
||||
int res = LzmaRamEncode(inBuffer, inSize, outBuffer, outSize, &outSizeProcessed,
|
||||
dictionary, SZ_FILTER_AUTO);
|
||||
dictionary, parser[NKey::kFilter86].PostCharIndex == 0 ? SZ_FILTER_YES : SZ_FILTER_AUTO);
|
||||
if (res != 0)
|
||||
{
|
||||
fprintf(stderr, "\nEncoder error = %d\n", (int)res);
|
||||
|
||||
@@ -37,12 +37,12 @@ extern "C"
|
||||
#include "../../ICoder.h"
|
||||
|
||||
#ifdef BENCH_MT
|
||||
#include "Windows/Thread.h"
|
||||
#include "Windows/Synchronization.h"
|
||||
#include "../../../Windows/Thread.h"
|
||||
#include "../../../Windows/Synchronization.h"
|
||||
#endif
|
||||
|
||||
#ifdef EXTERNAL_LZMA
|
||||
#include "Windows/PropVariant.h"
|
||||
#include "../../../Windows/PropVariant.h"
|
||||
#else
|
||||
#include "../LZMA/LZMADecoder.h"
|
||||
#include "../LZMA/LZMAEncoder.h"
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
#include "LzmaBench.h"
|
||||
#include "LzmaBenchCon.h"
|
||||
#include "Common/IntToString.h"
|
||||
#include "../../../Common/IntToString.h"
|
||||
|
||||
#if defined(BENCH_MT) || defined(_WIN32)
|
||||
#include "Windows/System.h"
|
||||
#include "../../../Windows/System.h"
|
||||
#endif
|
||||
|
||||
#ifdef BREAK_HANDLER
|
||||
|
||||
@@ -169,10 +169,9 @@ int LzmaRamEncode(
|
||||
return SZ_RAM_E_OUTOFMEMORY;
|
||||
memmove(filteredStream, inBuffer, inSize);
|
||||
}
|
||||
UInt32 _prevMask;
|
||||
UInt32 _prevPos;
|
||||
x86_Convert_Init(_prevMask, _prevPos);
|
||||
x86_Convert(filteredStream, (UInt32)inSize, 0, &_prevMask, &_prevPos, 1);
|
||||
UInt32 x86State;
|
||||
x86_Convert_Init(x86State);
|
||||
x86_Convert(filteredStream, (SizeT)inSize, 0, &x86State, 1);
|
||||
}
|
||||
|
||||
size_t minSize = 0;
|
||||
|
||||
@@ -70,10 +70,9 @@ int LzmaRamDecompress(
|
||||
*outSizeProcessed = (size_t)outSizeProcessedLoc;
|
||||
if (useFilter == 1)
|
||||
{
|
||||
UInt32 _prevMask;
|
||||
UInt32 _prevPos;
|
||||
x86_Convert_Init(_prevMask, _prevPos);
|
||||
x86_Convert(outBuffer, (UInt32)outSizeProcessedLoc, 0, &_prevMask, &_prevPos, 0);
|
||||
UInt32 x86State;
|
||||
x86_Convert_Init(x86State);
|
||||
x86_Convert(outBuffer, (SizeT)outSizeProcessedLoc, 0, &x86State, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
PROG = lzma.exe
|
||||
CFLAGS = $(CFLAGS) -I ../../../ \
|
||||
CFLAGS = $(CFLAGS) \
|
||||
-DCOMPRESS_MF_MT \
|
||||
-DBENCH_MT \
|
||||
|
||||
@@ -53,10 +53,13 @@ COMMON_OBJS = \
|
||||
$O\CommandLineParser.obj \
|
||||
$O\CRC.obj \
|
||||
$O\IntToString.obj \
|
||||
$O\String.obj \
|
||||
$O\MyString.obj \
|
||||
$O\StringConvert.obj \
|
||||
$O\StringToInt.obj \
|
||||
$O\Vector.obj
|
||||
$O\MyVector.obj
|
||||
|
||||
WIN_OBJS = \
|
||||
$O\System.obj
|
||||
|
||||
7ZIP_COMMON_OBJS = \
|
||||
$O\InBuffer.obj \
|
||||
@@ -79,6 +82,7 @@ OBJS = \
|
||||
$(LZMA_OBJS) \
|
||||
$(LZMA_OPT_OBJS) \
|
||||
$(COMMON_OBJS) \
|
||||
$(WIN_OBJS) \
|
||||
$(7ZIP_COMMON_OBJS) \
|
||||
$(LZ_OBJS) \
|
||||
$(C_OBJS) \
|
||||
@@ -108,6 +112,8 @@ $(LZMA_OPT_OBJS): ../LZMA/$(*B).cpp
|
||||
$(COMPL_O2)
|
||||
$(COMMON_OBJS): ../../../Common/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(WIN_OBJS): ../../../Windows/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(LZ_OBJS): ../LZ/$(*B).cpp
|
||||
|
||||
@@ -3,7 +3,20 @@ CXX = g++ -O2 -Wall
|
||||
CXX_C = gcc -O2 -Wall
|
||||
LIB = -lm
|
||||
RM = rm -f
|
||||
CFLAGS = -c -I ../../../
|
||||
CFLAGS = -c
|
||||
|
||||
ifdef SystemDrive
|
||||
IS_MINGW = 1
|
||||
endif
|
||||
|
||||
ifdef IS_MINGW
|
||||
FILE_IO =FileIO
|
||||
FILE_IO_2 =Windows/$(FILE_IO)
|
||||
LIB2 = -luuid
|
||||
else
|
||||
FILE_IO =C_FileIO
|
||||
FILE_IO_2 =Common/$(FILE_IO)
|
||||
endif
|
||||
|
||||
OBJS = \
|
||||
LzmaAlone.o \
|
||||
@@ -18,14 +31,14 @@ OBJS = \
|
||||
OutBuffer.o \
|
||||
FileStreams.o \
|
||||
StreamUtils.o \
|
||||
C_FileIO.o \
|
||||
$(FILE_IO).o \
|
||||
CommandLineParser.o \
|
||||
CRC.o \
|
||||
IntToString.o \
|
||||
String.o \
|
||||
MyString.o \
|
||||
StringConvert.o \
|
||||
StringToInt.o \
|
||||
Vector.o \
|
||||
MyVector.o \
|
||||
7zCrc.o \
|
||||
Alloc.o \
|
||||
BranchX86.o \
|
||||
@@ -37,7 +50,7 @@ OBJS = \
|
||||
all: $(PROG)
|
||||
|
||||
$(PROG): $(OBJS)
|
||||
$(CXX) -o $(PROG) $(LDFLAGS) $(OBJS) $(LIB)
|
||||
$(CXX) -o $(PROG) $(LDFLAGS) $(OBJS) $(LIB) $(LIB2)
|
||||
|
||||
LzmaAlone.o: LzmaAlone.cpp
|
||||
$(CXX) $(CFLAGS) LzmaAlone.cpp
|
||||
@@ -75,8 +88,9 @@ FileStreams.o: ../../Common/FileStreams.cpp
|
||||
StreamUtils.o: ../../Common/StreamUtils.cpp
|
||||
$(CXX) $(CFLAGS) ../../Common/StreamUtils.cpp
|
||||
|
||||
C_FileIO.o: ../../../Common/C_FileIO.cpp
|
||||
$(CXX) $(CFLAGS) ../../../Common/C_FileIO.cpp
|
||||
$(FILE_IO).o: ../../../$(FILE_IO_2).cpp
|
||||
$(CXX) $(CFLAGS) ../../../$(FILE_IO_2).cpp
|
||||
|
||||
|
||||
CommandLineParser.o: ../../../Common/CommandLineParser.cpp
|
||||
$(CXX) $(CFLAGS) ../../../Common/CommandLineParser.cpp
|
||||
@@ -90,8 +104,8 @@ MyWindows.o: ../../../Common/MyWindows.cpp
|
||||
IntToString.o: ../../../Common/IntToString.cpp
|
||||
$(CXX) $(CFLAGS) ../../../Common/IntToString.cpp
|
||||
|
||||
String.o: ../../../Common/String.cpp
|
||||
$(CXX) $(CFLAGS) ../../../Common/String.cpp
|
||||
MyString.o: ../../../Common/MyString.cpp
|
||||
$(CXX) $(CFLAGS) ../../../Common/MyString.cpp
|
||||
|
||||
StringConvert.o: ../../../Common/StringConvert.cpp
|
||||
$(CXX) $(CFLAGS) ../../../Common/StringConvert.cpp
|
||||
@@ -99,8 +113,8 @@ StringConvert.o: ../../../Common/StringConvert.cpp
|
||||
StringToInt.o: ../../../Common/StringToInt.cpp
|
||||
$(CXX) $(CFLAGS) ../../../Common/StringToInt.cpp
|
||||
|
||||
Vector.o: ../../../Common/Vector.cpp
|
||||
$(CXX) $(CFLAGS) ../../../Common/Vector.cpp
|
||||
MyVector.o: ../../../Common/MyVector.cpp
|
||||
$(CXX) $(CFLAGS) ../../../Common/MyVector.cpp
|
||||
|
||||
7zCrc.o: ../../../../C/7zCrc.c
|
||||
$(CXX_C) $(CFLAGS) ../../../../C/7zCrc.c
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#define __RAR3VM_H
|
||||
|
||||
#include "Common/Types.h"
|
||||
#include "Common/Vector.h"
|
||||
#include "Common/MyVector.h"
|
||||
|
||||
#define RARVM_STANDARD_FILTERS
|
||||
#if defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64) || defined(__i386__) || defined(__x86_64__) // || defined(_M_IA64) || defined(__ia64__)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user