mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-08 00:06:59 -06:00
9.06 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
829409452d
commit
c99f3ebdd6
@@ -164,8 +164,7 @@ HRESULT CEncoder::Encode(
|
||||
}
|
||||
for (i = 1; i < _bindInfo.OutStreams.Size(); i++)
|
||||
{
|
||||
CSequentialOutTempBufferImp *tempBufferSpec =
|
||||
new CSequentialOutTempBufferImp;
|
||||
CSequentialOutTempBufferImp *tempBufferSpec = new CSequentialOutTempBufferImp;
|
||||
CMyComPtr<ISequentialOutStream> tempBuffer = tempBufferSpec;
|
||||
tempBufferSpec->Init(&inOutTempBuffers[i - 1]);
|
||||
tempBuffers.Add(tempBuffer);
|
||||
@@ -260,9 +259,7 @@ HRESULT CEncoder::Encode(
|
||||
for (i = 1; i < _bindInfo.OutStreams.Size(); i++)
|
||||
{
|
||||
CInOutTempBuffer &inOutTempBuffer = inOutTempBuffers[i - 1];
|
||||
inOutTempBuffer.FlushWrite();
|
||||
inOutTempBuffer.InitReading();
|
||||
inOutTempBuffer.WriteToStream(outStream);
|
||||
RINOK(inOutTempBuffer.WriteToStream(outStream));
|
||||
packSizes.Add(inOutTempBuffer.GetDataSize());
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ struct CExtractFolderInfo
|
||||
};
|
||||
};
|
||||
|
||||
STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
|
||||
STDMETHODIMP CHandler::Extract(const UInt32 *indices, UInt32 numItems,
|
||||
Int32 testModeSpec, IArchiveExtractCallback *extractCallbackSpec)
|
||||
{
|
||||
COM_TRY_BEGIN
|
||||
@@ -52,7 +52,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
|
||||
CMyComPtr<IArchiveExtractCallback> extractCallback = extractCallbackSpec;
|
||||
UInt64 importantTotalUnpacked = 0;
|
||||
|
||||
bool allFilesMode = (numItems == UInt32(-1));
|
||||
bool allFilesMode = (numItems == (UInt32)-1);
|
||||
if (allFilesMode)
|
||||
numItems =
|
||||
#ifdef _7Z_VOL
|
||||
@@ -244,25 +244,25 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
|
||||
|
||||
if (result == S_FALSE)
|
||||
{
|
||||
RINOK(folderOutStream->FlushCorrupted(NArchive::NExtract::NOperationResult::kDataError));
|
||||
RINOK(folderOutStream->FlushCorrupted(NExtract::NOperationResult::kDataError));
|
||||
continue;
|
||||
}
|
||||
if (result == E_NOTIMPL)
|
||||
{
|
||||
RINOK(folderOutStream->FlushCorrupted(NArchive::NExtract::NOperationResult::kUnSupportedMethod));
|
||||
RINOK(folderOutStream->FlushCorrupted(NExtract::NOperationResult::kUnSupportedMethod));
|
||||
continue;
|
||||
}
|
||||
if (result != S_OK)
|
||||
return result;
|
||||
if (folderOutStream->WasWritingFinished() != S_OK)
|
||||
{
|
||||
RINOK(folderOutStream->FlushCorrupted(NArchive::NExtract::NOperationResult::kDataError));
|
||||
RINOK(folderOutStream->FlushCorrupted(NExtract::NOperationResult::kDataError));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
RINOK(folderOutStream->FlushCorrupted(NArchive::NExtract::NOperationResult::kDataError));
|
||||
RINOK(folderOutStream->FlushCorrupted(NExtract::NOperationResult::kDataError));
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,9 +37,9 @@ HRESULT CFolderOutStream::Init(
|
||||
HRESULT CFolderOutStream::OpenFile()
|
||||
{
|
||||
Int32 askMode = ((*_extractStatuses)[_currentIndex]) ? (_testMode ?
|
||||
NArchive::NExtract::NAskMode::kTest :
|
||||
NArchive::NExtract::NAskMode::kExtract):
|
||||
NArchive::NExtract::NAskMode::kSkip;
|
||||
NExtract::NAskMode::kTest :
|
||||
NExtract::NAskMode::kExtract) :
|
||||
NExtract::NAskMode::kSkip;
|
||||
CMyComPtr<ISequentialOutStream> realOutStream;
|
||||
UInt32 index = _startIndex + _currentIndex;
|
||||
RINOK(_extractCallback->GetStream(_ref2Offset + index, &realOutStream, askMode));
|
||||
@@ -48,9 +48,9 @@ HRESULT CFolderOutStream::OpenFile()
|
||||
_fileIsOpen = true;
|
||||
const CFileItem &fi = _db->Files[index];
|
||||
_rem = fi.Size;
|
||||
if (askMode == NArchive::NExtract::NAskMode::kExtract && !realOutStream &&
|
||||
if (askMode == NExtract::NAskMode::kExtract && !realOutStream &&
|
||||
!_db->IsItemAnti(index) && !fi.IsDir)
|
||||
askMode = NArchive::NExtract::NAskMode::kSkip;
|
||||
askMode = NExtract::NAskMode::kSkip;
|
||||
return _extractCallback->PrepareOperation(askMode);
|
||||
}
|
||||
|
||||
@@ -67,8 +67,8 @@ HRESULT CFolderOutStream::CloseFileAndSetResult()
|
||||
const CFileItem &fi = _db->Files[_startIndex + _currentIndex];
|
||||
return CloseFileAndSetResult(
|
||||
(fi.IsDir || !fi.CrcDefined || !_checkCrc || fi.Crc == _crcStreamSpec->GetCRC()) ?
|
||||
NArchive::NExtract::NOperationResult::kOK :
|
||||
NArchive::NExtract::NOperationResult::kCRCError);
|
||||
NExtract::NOperationResult::kOK :
|
||||
NExtract::NOperationResult::kCRCError);
|
||||
}
|
||||
|
||||
HRESULT CFolderOutStream::ProcessEmptyFiles()
|
||||
|
||||
@@ -300,11 +300,11 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *va
|
||||
else if (coder.MethodID == k_PPMD && coder.Props.GetCapacity() == 5)
|
||||
{
|
||||
Byte order = *(const Byte *)coder.Props;
|
||||
methodsString += L'o';
|
||||
methodsString += ConvertUInt32ToString(order);
|
||||
methodsString += L":mem";
|
||||
propsString = L'o';
|
||||
propsString += ConvertUInt32ToString(order);
|
||||
propsString += L":mem";
|
||||
UInt32 dicSize = GetUi32((const Byte *)coder.Props + 1);
|
||||
propsString = GetStringForSizeValue(dicSize);
|
||||
propsString += GetStringForSizeValue(dicSize);
|
||||
}
|
||||
else if (coder.MethodID == k_AES && coder.Props.GetCapacity() >= 1)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,13 @@ static const wchar_t *kDefaultMethodName = kLZMAMethodName;
|
||||
|
||||
static const UInt32 kLzmaAlgorithmX5 = 1;
|
||||
static const wchar_t *kLzmaMatchFinderForHeaders = L"BT2";
|
||||
static const UInt32 kDictionaryForHeaders = 1 << 20;
|
||||
static const UInt32 kDictionaryForHeaders =
|
||||
#ifdef UNDER_CE
|
||||
1 << 18
|
||||
#else
|
||||
1 << 20
|
||||
#endif
|
||||
;
|
||||
static const UInt32 kNumFastBytesForHeaders = 273;
|
||||
static const UInt32 kAlgorithmForHeaders = kLzmaAlgorithmX5;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// 7z/Header.cpp
|
||||
// 7zHeader.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
#include "7zHeader.h"
|
||||
@@ -6,22 +6,9 @@
|
||||
namespace NArchive {
|
||||
namespace N7z {
|
||||
|
||||
Byte kSignature[kSignatureSize] = {'7' + 1, 'z', 0xBC, 0xAF, 0x27, 0x1C};
|
||||
Byte kSignature[kSignatureSize] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C};
|
||||
#ifdef _7Z_VOL
|
||||
Byte kFinishSignature[kSignatureSize] = {'7' + 1, 'z', 0xBC, 0xAF, 0x27, 0x1C + 1};
|
||||
Byte kFinishSignature[kSignatureSize] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C + 1};
|
||||
#endif
|
||||
|
||||
class SignatureInitializer
|
||||
{
|
||||
public:
|
||||
SignatureInitializer()
|
||||
{
|
||||
kSignature[0]--;
|
||||
#ifdef _7Z_VOL
|
||||
kFinishSignature[0]--;
|
||||
#endif
|
||||
};
|
||||
} g_SignatureInitializer;
|
||||
|
||||
}}
|
||||
|
||||
|
||||
@@ -541,16 +541,16 @@ void COutArchive::WriteUInt64DefVector(const CUInt64DefVector &v, Byte type)
|
||||
|
||||
HRESULT COutArchive::EncodeStream(
|
||||
DECL_EXTERNAL_CODECS_LOC_VARS
|
||||
CEncoder &encoder, const Byte *data, size_t dataSize,
|
||||
CEncoder &encoder, const CByteBuffer &data,
|
||||
CRecordVector<UInt64> &packSizes, CObjectVector<CFolder> &folders)
|
||||
{
|
||||
CSequentialInStreamImp *streamSpec = new CSequentialInStreamImp;
|
||||
CBufInStream *streamSpec = new CBufInStream;
|
||||
CMyComPtr<ISequentialInStream> stream = streamSpec;
|
||||
streamSpec->Init(data, dataSize);
|
||||
streamSpec->Init(data, data.GetCapacity());
|
||||
CFolder folderItem;
|
||||
folderItem.UnpackCRCDefined = true;
|
||||
folderItem.UnpackCRC = CrcCalc(data, dataSize);
|
||||
UInt64 dataSize64 = dataSize;
|
||||
folderItem.UnpackCRC = CrcCalc(data, data.GetCapacity());
|
||||
UInt64 dataSize64 = data.GetCapacity();
|
||||
RINOK(encoder.Encode(
|
||||
EXTERNAL_CODECS_LOC_VARS
|
||||
stream, NULL, &dataSize64, folderItem, SeqStream, packSizes, NULL))
|
||||
@@ -558,16 +558,6 @@ HRESULT COutArchive::EncodeStream(
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT COutArchive::EncodeStream(
|
||||
DECL_EXTERNAL_CODECS_LOC_VARS
|
||||
CEncoder &encoder, const CByteBuffer &data,
|
||||
CRecordVector<UInt64> &packSizes, CObjectVector<CFolder> &folders)
|
||||
{
|
||||
return EncodeStream(
|
||||
EXTERNAL_CODECS_LOC_VARS
|
||||
encoder, data, data.GetCapacity(), packSizes, folders);
|
||||
}
|
||||
|
||||
void COutArchive::WriteHeader(
|
||||
const CArchiveDatabase &db,
|
||||
const CHeaderOptions &headerOptions,
|
||||
@@ -804,8 +794,8 @@ HRESULT COutArchive::WriteDatabase(
|
||||
CObjectVector<CFolder> folders;
|
||||
RINOK(EncodeStream(
|
||||
EXTERNAL_CODECS_LOC_VARS
|
||||
encoder, (const Byte *)buf,
|
||||
_countSize, packSizes, folders));
|
||||
encoder, buf,
|
||||
packSizes, folders));
|
||||
|
||||
_writeToStream = true;
|
||||
|
||||
|
||||
@@ -98,10 +98,6 @@ class COutArchive
|
||||
void WriteAlignedBoolHeader(const CBoolVector &v, int numDefined, Byte type, unsigned itemSize);
|
||||
void WriteUInt64DefVector(const CUInt64DefVector &v, Byte type);
|
||||
|
||||
HRESULT EncodeStream(
|
||||
DECL_EXTERNAL_CODECS_LOC_VARS
|
||||
CEncoder &encoder, const Byte *data, size_t dataSize,
|
||||
CRecordVector<UInt64> &packSizes, CObjectVector<CFolder> &folders);
|
||||
HRESULT EncodeStream(
|
||||
DECL_EXTERNAL_CODECS_LOC_VARS
|
||||
CEncoder &encoder, const CByteBuffer &data,
|
||||
|
||||
@@ -5,14 +5,14 @@
|
||||
#include "../../Common/RegisterArc.h"
|
||||
|
||||
#include "7zHandler.h"
|
||||
static IInArchive *CreateArc() { return new NArchive::N7z::CHandler; }
|
||||
static IInArchive *CreateArc() { return new NArchive::N7z::CHandler; }
|
||||
#ifndef EXTRACT_ONLY
|
||||
static IOutArchive *CreateArcOut() { return new NArchive::N7z::CHandler; }
|
||||
static IOutArchive *CreateArcOut() { return new NArchive::N7z::CHandler; }
|
||||
#else
|
||||
#define CreateArcOut 0
|
||||
#endif
|
||||
|
||||
static CArcInfo g_ArcInfo =
|
||||
{ L"7z", L"7z", 0, 7, {'7' + 1 , 'z', 0xBC, 0xAF, 0x27, 0x1C}, 6, false, CreateArc, CreateArcOut };
|
||||
{ L"7z", L"7z", 0, 7, {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C}, 6, false, CreateArc, CreateArcOut };
|
||||
|
||||
REGISTER_ARC_DEC_SIG(7z)
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../../C/CpuArch.h"
|
||||
|
||||
#include "../../Common/LimitedStreams.h"
|
||||
#include "../../Common/ProgressUtils.h"
|
||||
|
||||
@@ -32,6 +34,10 @@ static const UInt32 kDictionaryForBCJ2_LZMA = 1 << 20;
|
||||
static const UInt32 kAlgorithmForBCJ2_LZMA = 1;
|
||||
static const UInt32 kNumFastBytesForBCJ2_LZMA = 64;
|
||||
|
||||
#ifdef MY_CPU_X86_OR_AMD64
|
||||
#define USE_86_FILTER
|
||||
#endif
|
||||
|
||||
static HRESULT WriteRange(IInStream *inStream, ISequentialOutStream *outStream,
|
||||
UInt64 position, UInt64 size, ICompressProgressInfo *progress)
|
||||
{
|
||||
@@ -122,7 +128,7 @@ static int CompareFiles(const CFileItem &f1, const CFileItem &f2)
|
||||
}
|
||||
*/
|
||||
|
||||
const struct CFolderRepack
|
||||
struct CFolderRepack
|
||||
{
|
||||
int FolderIndex;
|
||||
int Group;
|
||||
@@ -334,7 +340,9 @@ static bool IsExeExt(const UString &ext)
|
||||
return false;
|
||||
}
|
||||
|
||||
static void GetMethodFull(UInt64 methodID, UInt32 numInStreams, CMethodFull &methodResult)
|
||||
#ifdef USE_86_FILTER
|
||||
|
||||
static inline void GetMethodFull(UInt64 methodID, UInt32 numInStreams, CMethodFull &methodResult)
|
||||
{
|
||||
methodResult.Id = methodID;
|
||||
methodResult.NumInStreams = numInStreams;
|
||||
@@ -409,6 +417,8 @@ static void MakeExeMethod(const CCompressionMethodMode &method,
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void FromUpdateItemToFileItem(const CUpdateItem &ui,
|
||||
CFileItem &file, CFileItem2 &file2)
|
||||
{
|
||||
@@ -665,7 +675,9 @@ STDMETHODIMP CCryptoGetTextPassword::CryptoGetTextPassword(BSTR *password)
|
||||
|
||||
static const int kNumGroupsMax = 4;
|
||||
|
||||
#ifdef USE_86_FILTER
|
||||
static bool Is86Group(int group) { return (group & 1) != 0; }
|
||||
#endif
|
||||
static bool IsEncryptedGroup(int group) { return (group & 2) != 0; }
|
||||
static int GetGroupIndex(bool encrypted, int bcjFiltered)
|
||||
{ return (encrypted ? 2 : 0) + (bcjFiltered ? 1 : 0); }
|
||||
@@ -865,9 +877,11 @@ HRESULT Update(
|
||||
const CSolidGroup &group = groups[groupIndex];
|
||||
|
||||
CCompressionMethodMode method;
|
||||
#ifdef USE_86_FILTER
|
||||
if (Is86Group(groupIndex))
|
||||
MakeExeMethod(*options.Method, options.MaxFilter, method);
|
||||
else
|
||||
#endif
|
||||
method = *options.Method;
|
||||
|
||||
if (IsEncryptedGroup(groupIndex))
|
||||
|
||||
@@ -4,8 +4,6 @@ CFLAGS = $(CFLAGS) -I ../../../ \
|
||||
-DCOMPRESS_MT \
|
||||
-DEXTERNAL_CODECS \
|
||||
|
||||
LIBS = $(LIBS) oleaut32.lib user32.lib
|
||||
|
||||
AR_OBJS = \
|
||||
$O\ArchiveExports.obj \
|
||||
$O\DllExports.obj \
|
||||
|
||||
Reference in New Issue
Block a user