mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-13 10:11:34 -06:00
4.56 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
b67ffe691b
commit
acd742622d
@@ -5,8 +5,6 @@
|
|||||||
|
|
||||||
#include "../../Types.h"
|
#include "../../Types.h"
|
||||||
|
|
||||||
#define HUFFMAN_TEMP_SIZE(num) (num * 2)
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Conditions:
|
Conditions:
|
||||||
num <= 1024 = 2 ^ NUM_BITS
|
num <= 1024 = 2 ^ NUM_BITS
|
||||||
|
|||||||
@@ -503,7 +503,7 @@ UInt32 Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
|
|||||||
if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
|
if (delta2 < p->cyclicBufferSize && *(cur - delta2) == *cur)
|
||||||
{
|
{
|
||||||
for (; maxLen != lenLimit; maxLen++)
|
for (; maxLen != lenLimit; maxLen++)
|
||||||
if (cur[(size_t)maxLen - delta2] != cur[maxLen])
|
if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
|
||||||
break;
|
break;
|
||||||
distances[0] = maxLen;
|
distances[0] = maxLen;
|
||||||
distances[1] = delta2 - 1;
|
distances[1] = delta2 - 1;
|
||||||
@@ -550,7 +550,7 @@ UInt32 Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
|
|||||||
if (offset != 0)
|
if (offset != 0)
|
||||||
{
|
{
|
||||||
for (; maxLen != lenLimit; maxLen++)
|
for (; maxLen != lenLimit; maxLen++)
|
||||||
if (cur[(size_t)maxLen - delta2] != cur[maxLen])
|
if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
|
||||||
break;
|
break;
|
||||||
distances[offset - 2] = maxLen;
|
distances[offset - 2] = maxLen;
|
||||||
if (maxLen == lenLimit)
|
if (maxLen == lenLimit)
|
||||||
@@ -597,7 +597,7 @@ UInt32 Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
|
|||||||
if (offset != 0)
|
if (offset != 0)
|
||||||
{
|
{
|
||||||
for (; maxLen != lenLimit; maxLen++)
|
for (; maxLen != lenLimit; maxLen++)
|
||||||
if (cur[(size_t)maxLen - delta2] != cur[maxLen])
|
if (cur[(ptrdiff_t)maxLen - delta2] != cur[maxLen])
|
||||||
break;
|
break;
|
||||||
distances[offset - 2] = maxLen;
|
distances[offset - 2] = maxLen;
|
||||||
if (maxLen == lenLimit)
|
if (maxLen == lenLimit)
|
||||||
|
|||||||
@@ -142,18 +142,11 @@ void MtSync_Init(CMtSync *p) { p->needStart = True; }
|
|||||||
|
|
||||||
#define kMtMaxValForNormalize 0xFFFFFFFF
|
#define kMtMaxValForNormalize 0xFFFFFFFF
|
||||||
|
|
||||||
/*
|
|
||||||
Notes:
|
|
||||||
instead of "size_t pos" we can use "UInt32 pos".
|
|
||||||
But MSVC++ compilers have BUG:
|
|
||||||
sometimes they use signed extending: (size_t)pos was compiled to "movsxd r10, edx"
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define DEF_GetHeads(name, v) \
|
#define DEF_GetHeads(name, v) \
|
||||||
static void GetHeads ## name(const Byte *p, size_t pos, \
|
static void GetHeads ## name(const Byte *p, UInt32 pos, \
|
||||||
UInt32 *hash, UInt32 hashMask, UInt32 *heads, UInt32 numHeads) { \
|
UInt32 *hash, UInt32 hashMask, UInt32 *heads, UInt32 numHeads) { \
|
||||||
for (; numHeads != 0; numHeads--) { \
|
for (; numHeads != 0; numHeads--) { \
|
||||||
const UInt32 value = (v); p++; *heads++ = (UInt32)pos - hash[value]; hash[value] = (UInt32)(pos++); } }
|
const UInt32 value = (v); p++; *heads++ = pos - hash[value]; hash[value] = pos++; } }
|
||||||
|
|
||||||
DEF_GetHeads(2, (p[0] | ((UInt32)p[1] << 8)) & hashMask)
|
DEF_GetHeads(2, (p[0] | ((UInt32)p[1] << 8)) & hashMask)
|
||||||
DEF_GetHeads(3, (g_CrcTable[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8)) & hashMask)
|
DEF_GetHeads(3, (g_CrcTable[p[0]] ^ p[1] ^ ((UInt32)p[2] << 8)) & hashMask)
|
||||||
@@ -586,7 +579,7 @@ UInt32 * MixMatches2(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
|
|||||||
hash[hash2Value] = lzPos;
|
hash[hash2Value] = lzPos;
|
||||||
|
|
||||||
if (curMatch2 >= matchMinPos)
|
if (curMatch2 >= matchMinPos)
|
||||||
if (cur[(size_t)curMatch2 - lzPos] == cur[0])
|
if (cur[(ptrdiff_t)curMatch2 - lzPos] == cur[0])
|
||||||
{
|
{
|
||||||
*distances++ = 2;
|
*distances++ = 2;
|
||||||
*distances++ = lzPos - curMatch2 - 1;
|
*distances++ = lzPos - curMatch2 - 1;
|
||||||
@@ -609,10 +602,10 @@ UInt32 * MixMatches3(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
|
|||||||
hash[kFix3HashSize + hash3Value] =
|
hash[kFix3HashSize + hash3Value] =
|
||||||
lzPos;
|
lzPos;
|
||||||
|
|
||||||
if (curMatch2 >= matchMinPos && cur[(size_t)curMatch2 - lzPos] == cur[0])
|
if (curMatch2 >= matchMinPos && cur[(ptrdiff_t)curMatch2 - lzPos] == cur[0])
|
||||||
{
|
{
|
||||||
distances[1] = lzPos - curMatch2 - 1;
|
distances[1] = lzPos - curMatch2 - 1;
|
||||||
if (cur[(size_t)curMatch2 - lzPos + 2] == cur[2])
|
if (cur[(ptrdiff_t)curMatch2 - lzPos + 2] == cur[2])
|
||||||
{
|
{
|
||||||
distances[0] = 3;
|
distances[0] = 3;
|
||||||
return distances + 2;
|
return distances + 2;
|
||||||
@@ -620,7 +613,7 @@ UInt32 * MixMatches3(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
|
|||||||
distances[0] = 2;
|
distances[0] = 2;
|
||||||
distances += 2;
|
distances += 2;
|
||||||
}
|
}
|
||||||
if (curMatch3 >= matchMinPos && cur[(size_t)curMatch3 - lzPos] == cur[0])
|
if (curMatch3 >= matchMinPos && cur[(ptrdiff_t)curMatch3 - lzPos] == cur[0])
|
||||||
{
|
{
|
||||||
*distances++ = 3;
|
*distances++ = 3;
|
||||||
*distances++ = lzPos - curMatch3 - 1;
|
*distances++ = lzPos - curMatch3 - 1;
|
||||||
@@ -646,21 +639,21 @@ UInt32 *MixMatches4(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
|
|||||||
hash[kFix4HashSize + hash4Value] =
|
hash[kFix4HashSize + hash4Value] =
|
||||||
lzPos;
|
lzPos;
|
||||||
|
|
||||||
if (curMatch2 >= matchMinPos && cur[(size_t)curMatch2 - lzPos] == cur[0])
|
if (curMatch2 >= matchMinPos && cur[(ptrdiff_t)curMatch2 - lzPos] == cur[0])
|
||||||
{
|
{
|
||||||
distances[1] = lzPos - curMatch2 - 1;
|
distances[1] = lzPos - curMatch2 - 1;
|
||||||
if (cur[(size_t)curMatch2 - lzPos + 2] == cur[2])
|
if (cur[(ptrdiff_t)curMatch2 - lzPos + 2] == cur[2])
|
||||||
{
|
{
|
||||||
distances[0] = (cur[(size_t)curMatch2 - lzPos + 3] == cur[3]) ? 4 : 3;
|
distances[0] = (cur[(ptrdiff_t)curMatch2 - lzPos + 3] == cur[3]) ? 4 : 3;
|
||||||
return distances + 2;
|
return distances + 2;
|
||||||
}
|
}
|
||||||
distances[0] = 2;
|
distances[0] = 2;
|
||||||
distances += 2;
|
distances += 2;
|
||||||
}
|
}
|
||||||
if (curMatch3 >= matchMinPos && cur[(size_t)curMatch3 - lzPos] == cur[0])
|
if (curMatch3 >= matchMinPos && cur[(ptrdiff_t)curMatch3 - lzPos] == cur[0])
|
||||||
{
|
{
|
||||||
distances[1] = lzPos - curMatch3 - 1;
|
distances[1] = lzPos - curMatch3 - 1;
|
||||||
if (cur[(size_t)curMatch3 - lzPos + 3] == cur[3])
|
if (cur[(ptrdiff_t)curMatch3 - lzPos + 3] == cur[3])
|
||||||
{
|
{
|
||||||
distances[0] = 4;
|
distances[0] = 4;
|
||||||
return distances + 2;
|
return distances + 2;
|
||||||
@@ -671,8 +664,8 @@ UInt32 *MixMatches4(CMatchFinderMt *p, UInt32 matchMinPos, UInt32 *distances)
|
|||||||
|
|
||||||
if (curMatch4 >= matchMinPos)
|
if (curMatch4 >= matchMinPos)
|
||||||
if (
|
if (
|
||||||
cur[(size_t)curMatch4 - lzPos] == cur[0] &&
|
cur[(ptrdiff_t)curMatch4 - lzPos] == cur[0] &&
|
||||||
cur[(size_t)curMatch4 - lzPos + 3] == cur[3]
|
cur[(ptrdiff_t)curMatch4 - lzPos + 3] == cur[3]
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
*distances++ = 4;
|
*distances++ = 4;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ typedef UInt32 * (*Mf_Mix_Matches)(void *p, UInt32 matchMinPos, UInt32 *distance
|
|||||||
/* kMtCacheLineDummy must be >= size_of_CPU_cache_line */
|
/* kMtCacheLineDummy must be >= size_of_CPU_cache_line */
|
||||||
#define kMtCacheLineDummy 128
|
#define kMtCacheLineDummy 128
|
||||||
|
|
||||||
typedef void (*Mf_GetHeads)(const Byte *buffer, size_t pos,
|
typedef void (*Mf_GetHeads)(const Byte *buffer, UInt32 pos,
|
||||||
UInt32 *hash, UInt32 hashMask, UInt32 *heads, UInt32 numHeads);
|
UInt32 *hash, UInt32 hashMask, UInt32 *heads, UInt32 numHeads);
|
||||||
|
|
||||||
typedef struct _CMatchFinderMt
|
typedef struct _CMatchFinderMt
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ STDMETHODIMP CHandler::Extract(const UInt32* indices, UInt32 numItems,
|
|||||||
0,
|
0,
|
||||||
#endif
|
#endif
|
||||||
startIndex,
|
startIndex,
|
||||||
&efi.ExtractStatuses, extractCallback, testMode);
|
&efi.ExtractStatuses, extractCallback, testMode, _crcSize != 0);
|
||||||
|
|
||||||
RINOK(result);
|
RINOK(result);
|
||||||
|
|
||||||
|
|||||||
@@ -113,13 +113,14 @@ STDMETHODIMP CFolderInStream::Read(void *data, UInt32 size, UInt32 *processedSiz
|
|||||||
STDMETHODIMP CFolderInStream::GetSubStreamSize(UInt64 subStream, UInt64 *value)
|
STDMETHODIMP CFolderInStream::GetSubStreamSize(UInt64 subStream, UInt64 *value)
|
||||||
{
|
{
|
||||||
*value = 0;
|
*value = 0;
|
||||||
if (subStream < Sizes.Size())
|
int subStreamIndex = (int)subStream;
|
||||||
|
if (subStreamIndex < 0 || subStream > Sizes.Size())
|
||||||
|
return E_FAIL;
|
||||||
|
if (subStreamIndex < Sizes.Size())
|
||||||
{
|
{
|
||||||
*value= Sizes[(int)(size_t)subStream];
|
*value= Sizes[subStreamIndex];
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
if (subStream > Sizes.Size())
|
|
||||||
return E_FAIL;
|
|
||||||
if (!_currentSizeIsDefined)
|
if (!_currentSizeIsDefined)
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
*value = _currentSize;
|
*value = _currentSize;
|
||||||
|
|||||||
@@ -19,7 +19,8 @@ HRESULT CFolderOutStream::Init(
|
|||||||
UInt32 startIndex,
|
UInt32 startIndex,
|
||||||
const CBoolVector *extractStatuses,
|
const CBoolVector *extractStatuses,
|
||||||
IArchiveExtractCallback *extractCallback,
|
IArchiveExtractCallback *extractCallback,
|
||||||
bool testMode)
|
bool testMode,
|
||||||
|
bool checkCrc)
|
||||||
{
|
{
|
||||||
_archiveDatabase = archiveDatabase;
|
_archiveDatabase = archiveDatabase;
|
||||||
_ref2Offset = ref2Offset;
|
_ref2Offset = ref2Offset;
|
||||||
@@ -29,6 +30,8 @@ HRESULT CFolderOutStream::Init(
|
|||||||
_extractCallback = extractCallback;
|
_extractCallback = extractCallback;
|
||||||
_testMode = testMode;
|
_testMode = testMode;
|
||||||
|
|
||||||
|
_checkCrc = checkCrc;
|
||||||
|
|
||||||
_currentIndex = 0;
|
_currentIndex = 0;
|
||||||
_fileIsOpen = false;
|
_fileIsOpen = false;
|
||||||
return WriteEmptyFiles();
|
return WriteEmptyFiles();
|
||||||
@@ -49,7 +52,7 @@ HRESULT CFolderOutStream::OpenFile()
|
|||||||
RINOK(_extractCallback->GetStream(_ref2Offset + index, &realOutStream, askMode));
|
RINOK(_extractCallback->GetStream(_ref2Offset + index, &realOutStream, askMode));
|
||||||
|
|
||||||
_outStreamWithHashSpec->SetStream(realOutStream);
|
_outStreamWithHashSpec->SetStream(realOutStream);
|
||||||
_outStreamWithHashSpec->Init();
|
_outStreamWithHashSpec->Init(_checkCrc);
|
||||||
if (askMode == NArchive::NExtract::NAskMode::kExtract &&
|
if (askMode == NArchive::NExtract::NAskMode::kExtract &&
|
||||||
(!realOutStream))
|
(!realOutStream))
|
||||||
{
|
{
|
||||||
@@ -100,7 +103,7 @@ STDMETHODIMP CFolderOutStream::Write(const void *data,
|
|||||||
if (_filePos == fileSize)
|
if (_filePos == fileSize)
|
||||||
{
|
{
|
||||||
bool digestsAreEqual;
|
bool digestsAreEqual;
|
||||||
if (fileInfo.IsFileCRCDefined)
|
if (fileInfo.IsFileCRCDefined && _checkCrc)
|
||||||
digestsAreEqual = fileInfo.FileCRC == _outStreamWithHashSpec->GetCRC();
|
digestsAreEqual = fileInfo.FileCRC == _outStreamWithHashSpec->GetCRC();
|
||||||
else
|
else
|
||||||
digestsAreEqual = true;
|
digestsAreEqual = true;
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ private:
|
|||||||
bool _testMode;
|
bool _testMode;
|
||||||
|
|
||||||
bool _fileIsOpen;
|
bool _fileIsOpen;
|
||||||
|
|
||||||
|
bool _checkCrc;
|
||||||
UInt64 _filePos;
|
UInt64 _filePos;
|
||||||
|
|
||||||
HRESULT OpenFile();
|
HRESULT OpenFile();
|
||||||
@@ -47,7 +49,8 @@ public:
|
|||||||
UInt32 startIndex,
|
UInt32 startIndex,
|
||||||
const CBoolVector *extractStatuses,
|
const CBoolVector *extractStatuses,
|
||||||
IArchiveExtractCallback *extractCallback,
|
IArchiveExtractCallback *extractCallback,
|
||||||
bool testMode);
|
bool testMode,
|
||||||
|
bool checkCrc);
|
||||||
HRESULT FlushCorrupted(Int32 resultEOperationResult);
|
HRESULT FlushCorrupted(Int32 resultEOperationResult);
|
||||||
HRESULT WasWritingFinished();
|
HRESULT WasWritingFinished();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ namespace N7z {
|
|||||||
|
|
||||||
CHandler::CHandler()
|
CHandler::CHandler()
|
||||||
{
|
{
|
||||||
|
_crcSize = 4;
|
||||||
|
|
||||||
#ifdef EXTRACT_ONLY
|
#ifdef EXTRACT_ONLY
|
||||||
#ifdef COMPRESS_MT
|
#ifdef COMPRESS_MT
|
||||||
_numThreads = NWindows::NSystem::GetNumberOfProcessors();
|
_numThreads = NWindows::NSystem::GetNumberOfProcessors();
|
||||||
|
|||||||
@@ -110,7 +110,9 @@ private:
|
|||||||
#ifdef COMPRESS_MT
|
#ifdef COMPRESS_MT
|
||||||
UInt32 _numThreads;
|
UInt32 _numThreads;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
UInt32 _crcSize;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
CRecordVector<CBind> _binds;
|
CRecordVector<CBind> _binds;
|
||||||
|
|||||||
@@ -6,3 +6,4 @@ EXPORTS
|
|||||||
CreateObject PRIVATE
|
CreateObject PRIVATE
|
||||||
GetNumberOfMethods PRIVATE
|
GetNumberOfMethods PRIVATE
|
||||||
GetMethodProperty PRIVATE
|
GetMethodProperty PRIVATE
|
||||||
|
SetLargePageMode PRIVATE
|
||||||
|
|||||||
@@ -759,9 +759,23 @@ HRESULT CInArchive::OpenHighLevel(IInStream *inStream, CFilesDatabase &database)
|
|||||||
li.ResetInterval = ReadUInt32();
|
li.ResetInterval = ReadUInt32();
|
||||||
li.WindowSize = ReadUInt32();
|
li.WindowSize = ReadUInt32();
|
||||||
li.CacheSize = ReadUInt32();
|
li.CacheSize = ReadUInt32();
|
||||||
if (li.ResetInterval != 2 && li.ResetInterval != 4)
|
if (
|
||||||
|
li.ResetInterval != 1 &&
|
||||||
|
li.ResetInterval != 2 &&
|
||||||
|
li.ResetInterval != 4 &&
|
||||||
|
li.ResetInterval != 8 &&
|
||||||
|
li.ResetInterval != 16 &&
|
||||||
|
li.ResetInterval != 32 &&
|
||||||
|
li.ResetInterval != 64)
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
if (li.WindowSize != 2 && li.WindowSize != 4)
|
if (
|
||||||
|
li.WindowSize != 1 &&
|
||||||
|
li.WindowSize != 2 &&
|
||||||
|
li.WindowSize != 4 &&
|
||||||
|
li.WindowSize != 8 &&
|
||||||
|
li.WindowSize != 16 &&
|
||||||
|
li.WindowSize != 32 &&
|
||||||
|
li.WindowSize != 64)
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
numDWORDS -= 5;
|
numDWORDS -= 5;
|
||||||
while (numDWORDS-- != 0)
|
while (numDWORDS-- != 0)
|
||||||
|
|||||||
@@ -468,6 +468,7 @@ void COutHandler::Init()
|
|||||||
_level = 5;
|
_level = 5;
|
||||||
_autoFilter = true;
|
_autoFilter = true;
|
||||||
_volumeMode = false;
|
_volumeMode = false;
|
||||||
|
_crcSize = 4;
|
||||||
InitSolid();
|
InitSolid();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -481,6 +482,7 @@ void COutHandler::BeforeSetProperty()
|
|||||||
mainDicSize = 0xFFFFFFFF;
|
mainDicSize = 0xFFFFFFFF;
|
||||||
mainDicMethodIndex = 0xFFFFFFFF;
|
mainDicMethodIndex = 0xFFFFFFFF;
|
||||||
minNumber = 0;
|
minNumber = 0;
|
||||||
|
_crcSize = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT COutHandler::SetProperty(const wchar_t *nameSpec, const PROPVARIANT &value)
|
HRESULT COutHandler::SetProperty(const wchar_t *nameSpec, const PROPVARIANT &value)
|
||||||
@@ -507,6 +509,13 @@ HRESULT COutHandler::SetProperty(const wchar_t *nameSpec, const PROPVARIANT &val
|
|||||||
return SetSolidSettings(name);
|
return SetSolidSettings(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (name == L"CRC")
|
||||||
|
{
|
||||||
|
_crcSize = 4;
|
||||||
|
name.Delete(0, 3);
|
||||||
|
return ParsePropValue(name, value, _crcSize);
|
||||||
|
}
|
||||||
|
|
||||||
UInt32 number;
|
UInt32 number;
|
||||||
int index = ParseStringToUInt32(name, number);
|
int index = ParseStringToUInt32(name, number);
|
||||||
UString realName = name.Mid(index);
|
UString realName = name.Mid(index);
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ public:
|
|||||||
UInt32 _numThreads;
|
UInt32 _numThreads;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
UInt32 _crcSize;
|
||||||
|
|
||||||
CObjectVector<COneMethodInfo> _methods;
|
CObjectVector<COneMethodInfo> _methods;
|
||||||
bool _removeSfxBlock;
|
bool _removeSfxBlock;
|
||||||
|
|
||||||
|
|||||||
@@ -33,9 +33,6 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
|
|||||||
#ifndef _UNICODE
|
#ifndef _UNICODE
|
||||||
g_IsNT = IsItWindowsNT();
|
g_IsNT = IsItWindowsNT();
|
||||||
#endif
|
#endif
|
||||||
#if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
|
|
||||||
SetLargePageSize();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -50,3 +47,10 @@ STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
|
|||||||
return CreateArchiver(clsid, iid, outObject);
|
return CreateArchiver(clsid, iid, outObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STDAPI SetLargePageMode()
|
||||||
|
{
|
||||||
|
#if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
|
||||||
|
SetLargePageSize();
|
||||||
|
#endif
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|||||||
@@ -43,9 +43,6 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
|
|||||||
g_IsNT = IsItWindowsNT();
|
g_IsNT = IsItWindowsNT();
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
|
|
||||||
SetLargePageSize();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -76,3 +73,10 @@ STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
|
|||||||
// COM_TRY_END
|
// COM_TRY_END
|
||||||
}
|
}
|
||||||
|
|
||||||
|
STDAPI SetLargePageMode()
|
||||||
|
{
|
||||||
|
#if defined(_WIN32) && defined(_7ZIP_LARGE_PAGES)
|
||||||
|
SetLargePageSize();
|
||||||
|
#endif
|
||||||
|
return S_OK;
|
||||||
|
}
|
||||||
|
|||||||
@@ -240,7 +240,10 @@ STDMETHODIMP CExtractCallbackImp::SetOperationResult(Int32 resultEOperationResul
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(_outFileStream != NULL)
|
if(_outFileStream != NULL)
|
||||||
|
{
|
||||||
_outFileStreamSpec->SetLastWriteTime(&_processedFileInfo.UTCLastWriteTime);
|
_outFileStreamSpec->SetLastWriteTime(&_processedFileInfo.UTCLastWriteTime);
|
||||||
|
RINOK(_outFileStreamSpec->Close());
|
||||||
|
}
|
||||||
_outFileStream.Release();
|
_outFileStream.Release();
|
||||||
if (_extractMode)
|
if (_extractMode)
|
||||||
NDirectory::MySetFileAttributes(_diskFilePath, _processedFileInfo.Attributes);
|
NDirectory::MySetFileAttributes(_diskFilePath, _processedFileInfo.Attributes);
|
||||||
|
|||||||
@@ -145,6 +145,11 @@ STDMETHODIMP CInFileStream::GetSize(UInt64 *size)
|
|||||||
//////////////////////////
|
//////////////////////////
|
||||||
// COutFileStream
|
// COutFileStream
|
||||||
|
|
||||||
|
HRESULT COutFileStream::Close()
|
||||||
|
{
|
||||||
|
return ConvertBoolToHRESULT(File.Close());
|
||||||
|
}
|
||||||
|
|
||||||
STDMETHODIMP COutFileStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
|
STDMETHODIMP COutFileStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
|
||||||
{
|
{
|
||||||
#ifdef USE_WIN_FILE
|
#ifdef USE_WIN_FILE
|
||||||
|
|||||||
@@ -103,6 +103,8 @@ public:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
HRESULT Close();
|
||||||
|
|
||||||
UInt64 ProcessedSize;
|
UInt64 ProcessedSize;
|
||||||
|
|
||||||
|
|||||||
@@ -282,10 +282,10 @@ NO_INLINE void CCoder::GetMatches()
|
|||||||
{
|
{
|
||||||
UInt32 numAvail = Inline_MatchFinder_GetNumAvailableBytes(&_lzInWindow) + 1;
|
UInt32 numAvail = Inline_MatchFinder_GetNumAvailableBytes(&_lzInWindow) + 1;
|
||||||
const Byte *pby = Inline_MatchFinder_GetPointerToCurrentPos(&_lzInWindow) - 1;
|
const Byte *pby = Inline_MatchFinder_GetPointerToCurrentPos(&_lzInWindow) - 1;
|
||||||
UInt32 distance = distanceTmp[numPairs - 1] + 1;
|
const Byte *pby2 = pby - (distanceTmp[numPairs - 1] + 1);
|
||||||
if (numAvail > m_MatchMaxLen)
|
if (numAvail > m_MatchMaxLen)
|
||||||
numAvail = m_MatchMaxLen;
|
numAvail = m_MatchMaxLen;
|
||||||
for (; len < numAvail && pby[len] == pby[(size_t)len - distance]; len++);
|
for (; len < numAvail && pby[len] == pby2[len]; len++);
|
||||||
m_MatchDistances[i - 1] = (UInt16)len;
|
m_MatchDistances[i - 1] = (UInt16)len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -610,15 +610,14 @@ UInt32 CEncoder::GetOptimum(UInt32 position, UInt32 &backRes)
|
|||||||
for(i = 0; i < kNumRepDistances; i++)
|
for(i = 0; i < kNumRepDistances; i++)
|
||||||
{
|
{
|
||||||
reps[i] = _repDistances[i];
|
reps[i] = _repDistances[i];
|
||||||
UInt32 backOffset = reps[i] + 1;
|
const Byte *data2 = data - (reps[i] + 1);
|
||||||
if (data[0] != data[(size_t)0 - backOffset] || data[1] != data[(size_t)1 - backOffset])
|
if (data[0] != data2[0] || data[1] != data2[1])
|
||||||
{
|
{
|
||||||
repLens[i] = 0;
|
repLens[i] = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
UInt32 lenTest;
|
UInt32 lenTest;
|
||||||
for (lenTest = 2; lenTest < numAvailableBytes &&
|
for (lenTest = 2; lenTest < numAvailableBytes && data[lenTest] == data2[lenTest]; lenTest++);
|
||||||
data[lenTest] == data[(size_t)lenTest - backOffset]; lenTest++);
|
|
||||||
repLens[i] = lenTest;
|
repLens[i] = lenTest;
|
||||||
if (lenTest > repLens[repMaxIndex])
|
if (lenTest > repLens[repMaxIndex])
|
||||||
repMaxIndex = i;
|
repMaxIndex = i;
|
||||||
@@ -639,7 +638,7 @@ UInt32 CEncoder::GetOptimum(UInt32 position, UInt32 &backRes)
|
|||||||
return lenMain;
|
return lenMain;
|
||||||
}
|
}
|
||||||
Byte currentByte = *data;
|
Byte currentByte = *data;
|
||||||
Byte matchByte = data[(size_t)0 - reps[0] - 1];
|
Byte matchByte = *(data - (reps[0] + 1));
|
||||||
|
|
||||||
if(lenMain < 2 && currentByte != matchByte && repLens[repMaxIndex] < 2)
|
if(lenMain < 2 && currentByte != matchByte && repLens[repMaxIndex] < 2)
|
||||||
{
|
{
|
||||||
@@ -821,13 +820,13 @@ UInt32 CEncoder::GetOptimum(UInt32 position, UInt32 &backRes)
|
|||||||
UInt32 curPrice = curOptimum.Price;
|
UInt32 curPrice = curOptimum.Price;
|
||||||
const Byte *data = _matchFinder.GetPointerToCurrentPos(_matchFinderObj) - 1;
|
const Byte *data = _matchFinder.GetPointerToCurrentPos(_matchFinderObj) - 1;
|
||||||
const Byte currentByte = *data;
|
const Byte currentByte = *data;
|
||||||
const Byte matchByte = data[(size_t)0 - reps[0] - 1];
|
const Byte matchByte = *(data - (reps[0] + 1));
|
||||||
|
|
||||||
UInt32 posState = (position & _posStateMask);
|
UInt32 posState = (position & _posStateMask);
|
||||||
|
|
||||||
UInt32 curAnd1Price = curPrice +
|
UInt32 curAnd1Price = curPrice +
|
||||||
_isMatch[state.Index][posState].GetPrice0() +
|
_isMatch[state.Index][posState].GetPrice0() +
|
||||||
_literalEncoder.GetSubCoder(position, data[(size_t)0 - 1])->GetPrice(!state.IsCharState(), matchByte, currentByte);
|
_literalEncoder.GetSubCoder(position, *(data - 1))->GetPrice(!state.IsCharState(), matchByte, currentByte);
|
||||||
|
|
||||||
COptimal &nextOptimum = _optimum[cur + 1];
|
COptimal &nextOptimum = _optimum[cur + 1];
|
||||||
|
|
||||||
@@ -870,11 +869,10 @@ UInt32 CEncoder::GetOptimum(UInt32 position, UInt32 &backRes)
|
|||||||
if (!nextIsChar && matchByte != currentByte) // speed optimization
|
if (!nextIsChar && matchByte != currentByte) // speed optimization
|
||||||
{
|
{
|
||||||
// try Literal + rep0
|
// try Literal + rep0
|
||||||
UInt32 backOffset = reps[0] + 1;
|
const Byte *data2 = data - (reps[0] + 1);
|
||||||
UInt32 limit = MyMin(numAvailableBytesFull, _numFastBytes + 1);
|
UInt32 limit = MyMin(numAvailableBytesFull, _numFastBytes + 1);
|
||||||
UInt32 temp;
|
UInt32 temp;
|
||||||
for (temp = 1; temp < limit &&
|
for (temp = 1; temp < limit && data[temp] == data2[temp]; temp++);
|
||||||
data[temp] == data[(size_t)temp - backOffset]; temp++);
|
|
||||||
UInt32 lenTest2 = temp - 1;
|
UInt32 lenTest2 = temp - 1;
|
||||||
if (lenTest2 >= 2)
|
if (lenTest2 >= 2)
|
||||||
{
|
{
|
||||||
@@ -908,13 +906,11 @@ UInt32 CEncoder::GetOptimum(UInt32 position, UInt32 &backRes)
|
|||||||
for(UInt32 repIndex = 0; repIndex < kNumRepDistances; repIndex++)
|
for(UInt32 repIndex = 0; repIndex < kNumRepDistances; repIndex++)
|
||||||
{
|
{
|
||||||
// UInt32 repLen = _matchFinder.GetMatchLen(0 - 1, reps[repIndex], newLen); // test it;
|
// UInt32 repLen = _matchFinder.GetMatchLen(0 - 1, reps[repIndex], newLen); // test it;
|
||||||
UInt32 backOffset = reps[repIndex] + 1;
|
const Byte *data2 = data - (reps[repIndex] + 1);
|
||||||
if (data[0] != data[(size_t)0 - backOffset] ||
|
if (data[0] != data2[0] || data[1] != data2[1])
|
||||||
data[1] != data[(size_t)1 - backOffset])
|
|
||||||
continue;
|
continue;
|
||||||
UInt32 lenTest;
|
UInt32 lenTest;
|
||||||
for (lenTest = 2; lenTest < numAvailableBytes &&
|
for (lenTest = 2; lenTest < numAvailableBytes && data[lenTest] == data2[lenTest]; lenTest++);
|
||||||
data[lenTest] == data[(size_t)lenTest - backOffset]; lenTest++);
|
|
||||||
while(lenEnd < cur + lenTest)
|
while(lenEnd < cur + lenTest)
|
||||||
_optimum[++lenEnd].Price = kIfinityPrice;
|
_optimum[++lenEnd].Price = kIfinityPrice;
|
||||||
UInt32 lenTestTemp = lenTest;
|
UInt32 lenTestTemp = lenTest;
|
||||||
@@ -941,8 +937,7 @@ UInt32 CEncoder::GetOptimum(UInt32 position, UInt32 &backRes)
|
|||||||
{
|
{
|
||||||
UInt32 lenTest2 = lenTest + 1;
|
UInt32 lenTest2 = lenTest + 1;
|
||||||
UInt32 limit = MyMin(numAvailableBytesFull, lenTest2 + _numFastBytes);
|
UInt32 limit = MyMin(numAvailableBytesFull, lenTest2 + _numFastBytes);
|
||||||
for (; lenTest2 < limit &&
|
for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++);
|
||||||
data[lenTest2] == data[(size_t)lenTest2 - backOffset]; lenTest2++);
|
|
||||||
lenTest2 -= lenTest + 1;
|
lenTest2 -= lenTest + 1;
|
||||||
if (lenTest2 >= 2)
|
if (lenTest2 >= 2)
|
||||||
{
|
{
|
||||||
@@ -952,8 +947,8 @@ UInt32 CEncoder::GetOptimum(UInt32 position, UInt32 &backRes)
|
|||||||
UInt32 curAndLenCharPrice =
|
UInt32 curAndLenCharPrice =
|
||||||
price + _repMatchLenEncoder.GetPrice(lenTest - 2, posState) +
|
price + _repMatchLenEncoder.GetPrice(lenTest - 2, posState) +
|
||||||
_isMatch[state2.Index][posStateNext].GetPrice0() +
|
_isMatch[state2.Index][posStateNext].GetPrice0() +
|
||||||
_literalEncoder.GetSubCoder(position + lenTest, data[(size_t)lenTest - 1])->GetPrice(
|
_literalEncoder.GetSubCoder(position + lenTest, data[lenTest - 1])->GetPrice(
|
||||||
true, data[(size_t)lenTest - backOffset], data[lenTest]);
|
true, data2[lenTest], data[lenTest]);
|
||||||
state2.UpdateChar();
|
state2.UpdateChar();
|
||||||
posStateNext = (position + lenTest + 1) & _posStateMask;
|
posStateNext = (position + lenTest + 1) & _posStateMask;
|
||||||
UInt32 nextRepMatchPrice = curAndLenCharPrice +
|
UInt32 nextRepMatchPrice = curAndLenCharPrice +
|
||||||
@@ -1025,11 +1020,10 @@ UInt32 CEncoder::GetOptimum(UInt32 position, UInt32 &backRes)
|
|||||||
if (/*_maxMode && */lenTest == matchDistances[offs])
|
if (/*_maxMode && */lenTest == matchDistances[offs])
|
||||||
{
|
{
|
||||||
// Try Match + Literal + Rep0
|
// Try Match + Literal + Rep0
|
||||||
UInt32 backOffset = curBack + 1;
|
const Byte *data2 = data - (curBack + 1);
|
||||||
UInt32 lenTest2 = lenTest + 1;
|
UInt32 lenTest2 = lenTest + 1;
|
||||||
UInt32 limit = MyMin(numAvailableBytesFull, lenTest2 + _numFastBytes);
|
UInt32 limit = MyMin(numAvailableBytesFull, lenTest2 + _numFastBytes);
|
||||||
for (; lenTest2 < limit &&
|
for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++);
|
||||||
data[lenTest2] == data[(size_t)lenTest2 - backOffset]; lenTest2++);
|
|
||||||
lenTest2 -= lenTest + 1;
|
lenTest2 -= lenTest + 1;
|
||||||
if (lenTest2 >= 2)
|
if (lenTest2 >= 2)
|
||||||
{
|
{
|
||||||
@@ -1038,8 +1032,8 @@ UInt32 CEncoder::GetOptimum(UInt32 position, UInt32 &backRes)
|
|||||||
UInt32 posStateNext = (position + lenTest) & _posStateMask;
|
UInt32 posStateNext = (position + lenTest) & _posStateMask;
|
||||||
UInt32 curAndLenCharPrice = curAndLenPrice +
|
UInt32 curAndLenCharPrice = curAndLenPrice +
|
||||||
_isMatch[state2.Index][posStateNext].GetPrice0() +
|
_isMatch[state2.Index][posStateNext].GetPrice0() +
|
||||||
_literalEncoder.GetSubCoder(position + lenTest, data[(size_t)lenTest - 1])->GetPrice(
|
_literalEncoder.GetSubCoder(position + lenTest, data[lenTest - 1])->GetPrice(
|
||||||
true, data[(size_t)lenTest - backOffset], data[lenTest]);
|
true, data2[lenTest], data[lenTest]);
|
||||||
state2.UpdateChar();
|
state2.UpdateChar();
|
||||||
posStateNext = (posStateNext + 1) & _posStateMask;
|
posStateNext = (posStateNext + 1) & _posStateMask;
|
||||||
UInt32 nextRepMatchPrice = curAndLenCharPrice +
|
UInt32 nextRepMatchPrice = curAndLenCharPrice +
|
||||||
@@ -1105,7 +1099,9 @@ UInt32 CEncoder::ReadMatchDistances(UInt32 &numDistancePairs)
|
|||||||
UInt32 distance = _matchDistances[numDistancePairs - 1] + 1;
|
UInt32 distance = _matchDistances[numDistancePairs - 1] + 1;
|
||||||
if (numAvail > kMatchMaxLen)
|
if (numAvail > kMatchMaxLen)
|
||||||
numAvail = kMatchMaxLen;
|
numAvail = kMatchMaxLen;
|
||||||
for (; lenRes < numAvail && pby[lenRes] == pby[(size_t)lenRes - distance]; lenRes++);
|
|
||||||
|
const Byte *pby2 = pby - distance;
|
||||||
|
for (; lenRes < numAvail && pby[lenRes] == pby2[lenRes]; lenRes++);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_additionalOffset++;
|
_additionalOffset++;
|
||||||
@@ -1141,14 +1137,14 @@ UInt32 CEncoder::GetOptimumFast(UInt32 &backRes)
|
|||||||
|
|
||||||
for(UInt32 i = 0; i < kNumRepDistances; i++)
|
for(UInt32 i = 0; i < kNumRepDistances; i++)
|
||||||
{
|
{
|
||||||
UInt32 backOffset = _repDistances[i] + 1;
|
const Byte *data2 = data - (_repDistances[i] + 1);
|
||||||
if (data[0] != data[(size_t)0 - backOffset] || data[1] != data[(size_t)1 - backOffset])
|
if (data[0] != data2[0] || data[1] != data2[1])
|
||||||
{
|
{
|
||||||
repLens[i] = 0;
|
repLens[i] = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
UInt32 len;
|
UInt32 len;
|
||||||
for (len = 2; len < numAvailableBytes && data[len] == data[(size_t)len - backOffset]; len++);
|
for (len = 2; len < numAvailableBytes && data[len] == data2[len]; len++);
|
||||||
if(len >= _numFastBytes)
|
if(len >= _numFastBytes)
|
||||||
{
|
{
|
||||||
backRes = i;
|
backRes = i;
|
||||||
@@ -1216,14 +1212,14 @@ UInt32 CEncoder::GetOptimumFast(UInt32 &backRes)
|
|||||||
data = _matchFinder.GetPointerToCurrentPos(_matchFinderObj) - 1;
|
data = _matchFinder.GetPointerToCurrentPos(_matchFinderObj) - 1;
|
||||||
for(UInt32 i = 0; i < kNumRepDistances; i++)
|
for(UInt32 i = 0; i < kNumRepDistances; i++)
|
||||||
{
|
{
|
||||||
UInt32 backOffset = _repDistances[i] + 1;
|
const Byte *data2 = data - (_repDistances[i] + 1);
|
||||||
if (data[1] != data[(size_t)1 - backOffset] || data[2] != data[(size_t)2 - backOffset])
|
if (data[1] != data2[1] || data[2] != data2[2])
|
||||||
{
|
{
|
||||||
repLens[i] = 0;
|
repLens[i] = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
UInt32 len;
|
UInt32 len;
|
||||||
for (len = 2; len < numAvailableBytes && data[len] == data[(size_t)len - backOffset]; len++);
|
for (len = 2; len < numAvailableBytes && data[len] == data2[len]; len++);
|
||||||
if (len + 1 >= lenMain)
|
if (len + 1 >= lenMain)
|
||||||
{
|
{
|
||||||
_longestMatchWasFound = true;
|
_longestMatchWasFound = true;
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ int main2(int n, const char *args[])
|
|||||||
g_IsNT = IsItWindowsNT();
|
g_IsNT = IsItWindowsNT();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fprintf(stderr, "\nLZMA 4.54 Copyright (c) 1999-2007 Igor Pavlov 2007-09-04\n");
|
fprintf(stderr, "\nLZMA 4.56 Copyright (c) 1999-2007 Igor Pavlov 2007-10-19\n");
|
||||||
|
|
||||||
if (n == 1)
|
if (n == 1)
|
||||||
{
|
{
|
||||||
@@ -276,6 +276,7 @@ int main2(int n, const char *args[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
CMyComPtr<ISequentialOutStream> outStream;
|
CMyComPtr<ISequentialOutStream> outStream;
|
||||||
|
COutFileStream *outStreamSpec = NULL;
|
||||||
if (stdOutMode)
|
if (stdOutMode)
|
||||||
{
|
{
|
||||||
outStream = new CStdOutFileStream;
|
outStream = new CStdOutFileStream;
|
||||||
@@ -286,7 +287,7 @@ int main2(int n, const char *args[])
|
|||||||
if (paramIndex >= nonSwitchStrings.Size())
|
if (paramIndex >= nonSwitchStrings.Size())
|
||||||
IncorrectCommand();
|
IncorrectCommand();
|
||||||
const UString &outputName = nonSwitchStrings[paramIndex++];
|
const UString &outputName = nonSwitchStrings[paramIndex++];
|
||||||
COutFileStream *outStreamSpec = new COutFileStream;
|
outStreamSpec = new COutFileStream;
|
||||||
outStream = outStreamSpec;
|
outStream = outStreamSpec;
|
||||||
if (!outStreamSpec->Create(GetSystemString(outputName), true))
|
if (!outStreamSpec->Create(GetSystemString(outputName), true))
|
||||||
{
|
{
|
||||||
@@ -368,8 +369,7 @@ int main2(int n, const char *args[])
|
|||||||
UInt64 fileSize;
|
UInt64 fileSize;
|
||||||
if (encodeMode)
|
if (encodeMode)
|
||||||
{
|
{
|
||||||
NCompress::NLZMA::CEncoder *encoderSpec =
|
NCompress::NLZMA::CEncoder *encoderSpec = new NCompress::NLZMA::CEncoder;
|
||||||
new NCompress::NLZMA::CEncoder;
|
|
||||||
CMyComPtr<ICompressCoder> encoder = encoderSpec;
|
CMyComPtr<ICompressCoder> encoder = encoderSpec;
|
||||||
|
|
||||||
if (!dictionaryIsDefined)
|
if (!dictionaryIsDefined)
|
||||||
@@ -483,8 +483,7 @@ int main2(int n, const char *args[])
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NCompress::NLZMA::CDecoder *decoderSpec =
|
NCompress::NLZMA::CDecoder *decoderSpec = new NCompress::NLZMA::CDecoder;
|
||||||
new NCompress::NLZMA::CDecoder;
|
|
||||||
CMyComPtr<ICompressCoder> decoder = decoderSpec;
|
CMyComPtr<ICompressCoder> decoder = decoderSpec;
|
||||||
const UInt32 kPropertiesSize = 5;
|
const UInt32 kPropertiesSize = 5;
|
||||||
Byte properties[kPropertiesSize];
|
Byte properties[kPropertiesSize];
|
||||||
@@ -526,6 +525,14 @@ int main2(int n, const char *args[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (outStreamSpec != NULL)
|
||||||
|
{
|
||||||
|
if (outStreamSpec->Close() != S_OK)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "File closing error");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#define MY_VER_MAJOR 4
|
#define MY_VER_MAJOR 4
|
||||||
#define MY_VER_MINOR 55
|
#define MY_VER_MINOR 56
|
||||||
#define MY_VER_BUILD 0
|
#define MY_VER_BUILD 0
|
||||||
#define MY_VERSION "4.55 beta"
|
#define MY_VERSION "4.56 beta"
|
||||||
#define MY_7ZIP_VERSION "7-Zip 4.55 beta"
|
#define MY_7ZIP_VERSION "7-Zip 4.56 beta"
|
||||||
#define MY_DATE "2007-09-05"
|
#define MY_DATE "2007-10-24"
|
||||||
#define MY_COPYRIGHT "Copyright (c) 1999-2007 Igor Pavlov"
|
#define MY_COPYRIGHT "Copyright (c) 1999-2007 Igor Pavlov"
|
||||||
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE
|
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE
|
||||||
|
|||||||
@@ -299,7 +299,8 @@ STDMETHODIMP CAgent::DoOperation(
|
|||||||
RINOK(CopyBlock(sfxStream, outStream));
|
RINOK(CopyBlock(sfxStream, outStream));
|
||||||
}
|
}
|
||||||
|
|
||||||
return outArchive->UpdateItems(outStream, updatePairs2.Size(),updateCallback);
|
RINOK(outArchive->UpdateItems(outStream, updatePairs2.Size(),updateCallback));
|
||||||
|
return outStreamSpec->Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
STDMETHODIMP CAgent::DoOperation2(
|
STDMETHODIMP CAgent::DoOperation2(
|
||||||
@@ -362,7 +363,8 @@ HRESULT CAgent::CommonUpdate(
|
|||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return outArchive->UpdateItems(outStream, numUpdateItems, updateCallback);
|
RINOK(outArchive->UpdateItems(outStream, numUpdateItems, updateCallback));
|
||||||
|
return outStreamSpec->Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -79,6 +79,13 @@ void PrintStringLn(const AString &s)
|
|||||||
PrintNewLine();
|
PrintNewLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PrintError(const AString &s)
|
||||||
|
{
|
||||||
|
PrintNewLine();
|
||||||
|
PrintString(s);
|
||||||
|
PrintNewLine();
|
||||||
|
}
|
||||||
|
|
||||||
static HRESULT IsArchiveItemProp(IInArchive *archive, UInt32 index, PROPID propID, bool &result)
|
static HRESULT IsArchiveItemProp(IInArchive *archive, UInt32 index, PROPID propID, bool &result)
|
||||||
{
|
{
|
||||||
NCOM::CPropVariant prop;
|
NCOM::CPropVariant prop;
|
||||||
@@ -141,7 +148,7 @@ STDMETHODIMP CArchiveOpenCallback::CryptoGetTextPassword(BSTR *password)
|
|||||||
// You can ask real password here from user
|
// You can ask real password here from user
|
||||||
// Password = GetPassword(OutStream);
|
// Password = GetPassword(OutStream);
|
||||||
// PasswordIsDefined = true;
|
// PasswordIsDefined = true;
|
||||||
PrintStringLn("Password is not defined");
|
PrintError("Password is not defined");
|
||||||
return E_ABORT;
|
return E_ABORT;
|
||||||
}
|
}
|
||||||
CMyComBSTR tempName(Password);
|
CMyComBSTR tempName(Password);
|
||||||
@@ -396,8 +403,12 @@ STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 operationResult)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_outFileStream != NULL && _processedFileInfo.UTCLastWriteTimeIsDefined)
|
if (_outFileStream != NULL)
|
||||||
_outFileStreamSpec->SetLastWriteTime(&_processedFileInfo.UTCLastWriteTime);
|
{
|
||||||
|
if (_processedFileInfo.UTCLastWriteTimeIsDefined)
|
||||||
|
_outFileStreamSpec->SetLastWriteTime(&_processedFileInfo.UTCLastWriteTime);
|
||||||
|
RINOK(_outFileStreamSpec->Close());
|
||||||
|
}
|
||||||
_outFileStream.Release();
|
_outFileStream.Release();
|
||||||
if (_extractMode && _processedFileInfo.AttributesAreDefined)
|
if (_extractMode && _processedFileInfo.AttributesAreDefined)
|
||||||
NFile::NDirectory::MySetFileAttributes(_diskFilePath, _processedFileInfo.Attributes);
|
NFile::NDirectory::MySetFileAttributes(_diskFilePath, _processedFileInfo.Attributes);
|
||||||
@@ -413,7 +424,7 @@ STDMETHODIMP CArchiveExtractCallback::CryptoGetTextPassword(BSTR *password)
|
|||||||
// You can ask real password here from user
|
// You can ask real password here from user
|
||||||
// Password = GetPassword(OutStream);
|
// Password = GetPassword(OutStream);
|
||||||
// PasswordIsDefined = true;
|
// PasswordIsDefined = true;
|
||||||
PrintStringLn("Password is not defined");
|
PrintError("Password is not defined");
|
||||||
return E_ABORT;
|
return E_ABORT;
|
||||||
}
|
}
|
||||||
CMyComBSTR tempName(Password);
|
CMyComBSTR tempName(Password);
|
||||||
@@ -603,7 +614,7 @@ STDMETHODIMP CArchiveUpdateCallback::GetStream(UInt32 index, ISequentialInStream
|
|||||||
// if (systemError == ERROR_SHARING_VIOLATION)
|
// if (systemError == ERROR_SHARING_VIOLATION)
|
||||||
{
|
{
|
||||||
PrintNewLine();
|
PrintNewLine();
|
||||||
PrintStringLn("WARNING: can't open file");
|
PrintError("WARNING: can't open file");
|
||||||
// PrintString(NError::MyFormatMessageW(systemError));
|
// PrintString(NError::MyFormatMessageW(systemError));
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
}
|
}
|
||||||
@@ -658,7 +669,7 @@ STDMETHODIMP CArchiveUpdateCallback::CryptoGetTextPassword2(Int32 *passwordIsDef
|
|||||||
// You can ask real password here from user
|
// You can ask real password here from user
|
||||||
// Password = GetPassword(OutStream);
|
// Password = GetPassword(OutStream);
|
||||||
// PasswordIsDefined = true;
|
// PasswordIsDefined = true;
|
||||||
PrintStringLn("Password is not defined");
|
PrintError("Password is not defined");
|
||||||
return E_ABORT;
|
return E_ABORT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -695,13 +706,13 @@ main(int argc, char* argv[])
|
|||||||
NWindows::NDLL::CLibrary library;
|
NWindows::NDLL::CLibrary library;
|
||||||
if (!library.Load(TEXT(kDllName)))
|
if (!library.Load(TEXT(kDllName)))
|
||||||
{
|
{
|
||||||
PrintStringLn("Can not load library");
|
PrintError("Can not load library");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
CreateObjectFunc createObjectFunc = (CreateObjectFunc)library.GetProcAddress("CreateObject");
|
CreateObjectFunc createObjectFunc = (CreateObjectFunc)library.GetProcAddress("CreateObject");
|
||||||
if (createObjectFunc == 0)
|
if (createObjectFunc == 0)
|
||||||
{
|
{
|
||||||
PrintStringLn("Can not get CreateObject");
|
PrintError("Can not get CreateObject");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -742,14 +753,14 @@ main(int argc, char* argv[])
|
|||||||
CMyComPtr<IOutStream> outFileStream = outFileStreamSpec;
|
CMyComPtr<IOutStream> outFileStream = outFileStreamSpec;
|
||||||
if (!outFileStreamSpec->Create(archiveName, false))
|
if (!outFileStreamSpec->Create(archiveName, false))
|
||||||
{
|
{
|
||||||
PrintStringLn("can't create archive file");
|
PrintError("can't create archive file");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
CMyComPtr<IOutArchive> outArchive;
|
CMyComPtr<IOutArchive> outArchive;
|
||||||
if (createObjectFunc(&CLSID_CFormat7z, &IID_IOutArchive, (void **)&outArchive) != S_OK)
|
if (createObjectFunc(&CLSID_CFormat7z, &IID_IOutArchive, (void **)&outArchive) != S_OK)
|
||||||
{
|
{
|
||||||
PrintStringLn("Can not get class object");
|
PrintError("Can not get class object");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -763,7 +774,7 @@ main(int argc, char* argv[])
|
|||||||
updateCallbackSpec->Finilize();
|
updateCallbackSpec->Finilize();
|
||||||
if (result != S_OK)
|
if (result != S_OK)
|
||||||
{
|
{
|
||||||
PrintStringLn("Update Error");
|
PrintError("Update Error");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
for (i = 0; i < updateCallbackSpec->FailedFiles.Size(); i++)
|
for (i = 0; i < updateCallbackSpec->FailedFiles.Size(); i++)
|
||||||
@@ -789,14 +800,14 @@ main(int argc, char* argv[])
|
|||||||
listCommand = false;
|
listCommand = false;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PrintStringLn("incorrect command");
|
PrintError("incorrect command");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
CMyComPtr<IInArchive> archive;
|
CMyComPtr<IInArchive> archive;
|
||||||
if (createObjectFunc(&CLSID_CFormat7z, &IID_IInArchive, (void **)&archive) != S_OK)
|
if (createObjectFunc(&CLSID_CFormat7z, &IID_IInArchive, (void **)&archive) != S_OK)
|
||||||
{
|
{
|
||||||
PrintStringLn("Can not get class object");
|
PrintError("Can not get class object");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -805,7 +816,7 @@ main(int argc, char* argv[])
|
|||||||
|
|
||||||
if (!fileSpec->Open(archiveName))
|
if (!fileSpec->Open(archiveName))
|
||||||
{
|
{
|
||||||
PrintStringLn("Can not open archive file");
|
PrintError("Can not open archive file");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -818,7 +829,7 @@ main(int argc, char* argv[])
|
|||||||
|
|
||||||
if (archive->Open(file, 0, openCallback) != S_OK)
|
if (archive->Open(file, 0, openCallback) != S_OK)
|
||||||
{
|
{
|
||||||
PrintStringLn("Can not open archive");
|
PrintError("Can not open archive");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -857,7 +868,12 @@ main(int argc, char* argv[])
|
|||||||
extractCallbackSpec->PasswordIsDefined = false;
|
extractCallbackSpec->PasswordIsDefined = false;
|
||||||
// extractCallbackSpec->PasswordIsDefined = true;
|
// extractCallbackSpec->PasswordIsDefined = true;
|
||||||
// extractCallbackSpec->Password = L"1";
|
// extractCallbackSpec->Password = L"1";
|
||||||
archive->Extract(NULL, (UInt32)(Int32)(-1), false, extractCallback);
|
HRESULT result = archive->Extract(NULL, (UInt32)(Int32)(-1), false, extractCallback);
|
||||||
|
if (result != S_OK)
|
||||||
|
{
|
||||||
|
PrintError("Extract Error");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -434,6 +434,7 @@ STDMETHODIMP CArchiveExtractCallback::SetOperationResult(Int32 operationResult)
|
|||||||
(WriteAccessed && _processedFileInfo.IsLastAccessTimeDefined) ? &_processedFileInfo.LastAccessTime : NULL,
|
(WriteAccessed && _processedFileInfo.IsLastAccessTimeDefined) ? &_processedFileInfo.LastAccessTime : NULL,
|
||||||
(WriteModified && _processedFileInfo.IsLastWriteTimeDefined) ? &_processedFileInfo.LastWriteTime : &_utcLastWriteTimeDefault);
|
(WriteModified && _processedFileInfo.IsLastWriteTimeDefined) ? &_processedFileInfo.LastWriteTime : &_utcLastWriteTimeDefault);
|
||||||
_curSize = _outFileStreamSpec->ProcessedSize;
|
_curSize = _outFileStreamSpec->ProcessedSize;
|
||||||
|
RINOK(_outFileStreamSpec->Close());
|
||||||
_outFileStream.Release();
|
_outFileStream.Release();
|
||||||
}
|
}
|
||||||
UnpackSize += _curSize;
|
UnpackSize += _curSize;
|
||||||
|
|||||||
@@ -93,7 +93,8 @@ typedef UInt32 (WINAPI *GetNumberOfMethodsFunc)(UInt32 *numMethods);
|
|||||||
typedef UInt32 (WINAPI *GetNumberOfFormatsFunc)(UInt32 *numFormats);
|
typedef UInt32 (WINAPI *GetNumberOfFormatsFunc)(UInt32 *numFormats);
|
||||||
typedef UInt32 (WINAPI *GetHandlerPropertyFunc)(PROPID propID, PROPVARIANT *value);
|
typedef UInt32 (WINAPI *GetHandlerPropertyFunc)(PROPID propID, PROPVARIANT *value);
|
||||||
typedef UInt32 (WINAPI *GetHandlerPropertyFunc2)(UInt32 index, PROPID propID, PROPVARIANT *value);
|
typedef UInt32 (WINAPI *GetHandlerPropertyFunc2)(UInt32 index, PROPID propID, PROPVARIANT *value);
|
||||||
typedef UINT32 (WINAPI *CreateObjectFunc)(const GUID *clsID, const GUID *iid, void **outObject);
|
typedef UInt32 (WINAPI *CreateObjectFunc)(const GUID *clsID, const GUID *iid, void **outObject);
|
||||||
|
typedef UInt32 (WINAPI *SetLargePageModeFunc)();
|
||||||
|
|
||||||
|
|
||||||
static HRESULT GetCoderClass(GetMethodPropertyFunc getMethodProperty, UInt32 index,
|
static HRESULT GetCoderClass(GetMethodPropertyFunc getMethodProperty, UInt32 index,
|
||||||
@@ -332,6 +333,13 @@ int CCodecLib::FindIconIndex(const UString &ext) const
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _7ZIP_LARGE_PAGES
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
extern SIZE_T g_LargePageSize;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
HRESULT CCodecs::LoadDll(const CSysString &dllPath)
|
HRESULT CCodecs::LoadDll(const CSysString &dllPath)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
@@ -351,6 +359,16 @@ HRESULT CCodecs::LoadDll(const CSysString &dllPath)
|
|||||||
#ifdef NEW_FOLDER_INTERFACE
|
#ifdef NEW_FOLDER_INTERFACE
|
||||||
lib.LoadIcons();
|
lib.LoadIcons();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef _7ZIP_LARGE_PAGES
|
||||||
|
if (g_LargePageSize != 0)
|
||||||
|
{
|
||||||
|
SetLargePageModeFunc setLargePageMode = (SetLargePageModeFunc)lib.Lib.GetProcAddress("SetLargePageMode");
|
||||||
|
if (setLargePageMode != 0)
|
||||||
|
setLargePageMode();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
lib.CreateObject = (CreateObjectFunc)lib.Lib.GetProcAddress("CreateObject");
|
lib.CreateObject = (CreateObjectFunc)lib.Lib.GetProcAddress("CreateObject");
|
||||||
if (lib.CreateObject != 0)
|
if (lib.CreateObject != 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ class COutMultiVolStream:
|
|||||||
|
|
||||||
struct CSubStreamInfo
|
struct CSubStreamInfo
|
||||||
{
|
{
|
||||||
|
COutFileStream *StreamSpec;
|
||||||
CMyComPtr<IOutStream> Stream;
|
CMyComPtr<IOutStream> Stream;
|
||||||
UString Name;
|
UString Name;
|
||||||
UInt64 Pos;
|
UInt64 Pos;
|
||||||
@@ -87,6 +88,8 @@ public:
|
|||||||
_length = 0;
|
_length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HRESULT Close();
|
||||||
|
|
||||||
MY_UNKNOWN_IMP1(IOutStream)
|
MY_UNKNOWN_IMP1(IOutStream)
|
||||||
|
|
||||||
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
|
STDMETHOD(Write)(const void *data, UInt32 size, UInt32 *processedSize);
|
||||||
@@ -96,6 +99,22 @@ public:
|
|||||||
|
|
||||||
// static NSynchronization::CCriticalSection g_TempPathsCS;
|
// static NSynchronization::CCriticalSection g_TempPathsCS;
|
||||||
|
|
||||||
|
HRESULT COutMultiVolStream::Close()
|
||||||
|
{
|
||||||
|
HRESULT res = S_OK;
|
||||||
|
for (int i = 0; i < Streams.Size(); i++)
|
||||||
|
{
|
||||||
|
CSubStreamInfo &s = Streams[i];
|
||||||
|
if (s.StreamSpec)
|
||||||
|
{
|
||||||
|
HRESULT res2 = s.StreamSpec->Close();
|
||||||
|
if (res2 != S_OK)
|
||||||
|
res = res2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
STDMETHODIMP COutMultiVolStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
|
STDMETHODIMP COutMultiVolStream::Write(const void *data, UInt32 size, UInt32 *processedSize)
|
||||||
{
|
{
|
||||||
if(processedSize != NULL)
|
if(processedSize != NULL)
|
||||||
@@ -112,9 +131,9 @@ STDMETHODIMP COutMultiVolStream::Write(const void *data, UInt32 size, UInt32 *pr
|
|||||||
while (res.Length() < 3)
|
while (res.Length() < 3)
|
||||||
res = UString(L'0') + res;
|
res = UString(L'0') + res;
|
||||||
UString name = Prefix + res;
|
UString name = Prefix + res;
|
||||||
COutFileStream *streamSpec = new COutFileStream;
|
subStream.StreamSpec = new COutFileStream;
|
||||||
subStream.Stream = streamSpec;
|
subStream.Stream = subStream.StreamSpec;
|
||||||
if(!streamSpec->Create(name, false))
|
if(!subStream.StreamSpec->Create(name, false))
|
||||||
return ::GetLastError();
|
return ::GetLastError();
|
||||||
{
|
{
|
||||||
// NSynchronization::CCriticalSectionLock lock(g_TempPathsCS);
|
// NSynchronization::CCriticalSectionLock lock(g_TempPathsCS);
|
||||||
@@ -362,13 +381,17 @@ static HRESULT Compress(
|
|||||||
throw 1417161;
|
throw 1417161;
|
||||||
NFile::NDirectory::CreateComplexDirectory(resultPath.Left(pos));
|
NFile::NDirectory::CreateComplexDirectory(resultPath.Left(pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
COutFileStream *outStreamSpec = NULL;
|
||||||
|
COutMultiVolStream *volStreamSpec = NULL;
|
||||||
|
|
||||||
if (volumesSizes.Size() == 0)
|
if (volumesSizes.Size() == 0)
|
||||||
{
|
{
|
||||||
if (stdOutMode)
|
if (stdOutMode)
|
||||||
outStream = new CStdOutFileStream;
|
outStream = new CStdOutFileStream;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
COutFileStream *outStreamSpec = new COutFileStream;
|
outStreamSpec = new COutFileStream;
|
||||||
outStream = outStreamSpec;
|
outStream = outStreamSpec;
|
||||||
bool isOK = false;
|
bool isOK = false;
|
||||||
UString realPath;
|
UString realPath;
|
||||||
@@ -410,7 +433,7 @@ static HRESULT Compress(
|
|||||||
{
|
{
|
||||||
if (stdOutMode)
|
if (stdOutMode)
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
COutMultiVolStream *volStreamSpec = new COutMultiVolStream;
|
volStreamSpec = new COutMultiVolStream;
|
||||||
outStream = volStreamSpec;
|
outStream = volStreamSpec;
|
||||||
volStreamSpec->Sizes = volumesSizes;
|
volStreamSpec->Sizes = volumesSizes;
|
||||||
volStreamSpec->Prefix = archivePath.GetFinalPath() + UString(L".");
|
volStreamSpec->Prefix = archivePath.GetFinalPath() + UString(L".");
|
||||||
@@ -440,11 +463,12 @@ static HRESULT Compress(
|
|||||||
}
|
}
|
||||||
|
|
||||||
CMyComPtr<ISequentialOutStream> sfxOutStream;
|
CMyComPtr<ISequentialOutStream> sfxOutStream;
|
||||||
|
COutFileStream *outStreamSpec = NULL;
|
||||||
if (volumesSizes.Size() == 0)
|
if (volumesSizes.Size() == 0)
|
||||||
sfxOutStream = outStream;
|
sfxOutStream = outStream;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
COutFileStream *outStreamSpec = new COutFileStream;
|
outStreamSpec = new COutFileStream;
|
||||||
sfxOutStream = outStreamSpec;
|
sfxOutStream = outStreamSpec;
|
||||||
UString realPath = archivePath.GetFinalPath();
|
UString realPath = archivePath.GetFinalPath();
|
||||||
if (!outStreamSpec->Create(realPath, false))
|
if (!outStreamSpec->Create(realPath, false))
|
||||||
@@ -456,10 +480,19 @@ static HRESULT Compress(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
RINOK(CopyBlock(sfxStream, sfxOutStream));
|
RINOK(CopyBlock(sfxStream, sfxOutStream));
|
||||||
|
if (outStreamSpec)
|
||||||
|
{
|
||||||
|
RINOK(outStreamSpec->Close());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT result = outArchive->UpdateItems(outStream, updatePairs2.Size(), updateCallback);
|
HRESULT result = outArchive->UpdateItems(outStream, updatePairs2.Size(), updateCallback);
|
||||||
callback->Finilize();
|
callback->Finilize();
|
||||||
|
RINOK(result);
|
||||||
|
if (outStreamSpec)
|
||||||
|
result = outStreamSpec->Close();
|
||||||
|
else if (volStreamSpec)
|
||||||
|
result = volStreamSpec->Close();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -407,15 +407,9 @@ int Main2(
|
|||||||
result = E_FAIL;
|
result = E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
stdStream << endl << endl << "Total:" << endl;
|
stdStream << endl;
|
||||||
if (ecs->NumArchives > 1)
|
if (ecs->NumArchives > 1)
|
||||||
stdStream << "Archives: " << ecs->NumArchives << endl;
|
stdStream << "Archives: " << ecs->NumArchives << endl;
|
||||||
{
|
|
||||||
stdStream << "Folders: " << stat.NumFolders << endl;
|
|
||||||
stdStream << "Files: " << stat.NumFiles << endl;
|
|
||||||
stdStream << "Size: " << stat.UnpackSize << endl;
|
|
||||||
stdStream << "Compressed: " << stat.PackSize << endl;
|
|
||||||
}
|
|
||||||
if (ecs->NumArchiveErrors != 0 || ecs->NumFileErrors != 0)
|
if (ecs->NumArchiveErrors != 0 || ecs->NumFileErrors != 0)
|
||||||
{
|
{
|
||||||
if (ecs->NumArchives > 1)
|
if (ecs->NumArchives > 1)
|
||||||
@@ -432,6 +426,13 @@ int Main2(
|
|||||||
}
|
}
|
||||||
if (result != S_OK)
|
if (result != S_OK)
|
||||||
throw CSystemException(result);
|
throw CSystemException(result);
|
||||||
|
if (stat.NumFolders != 0)
|
||||||
|
stdStream << "Folders: " << stat.NumFolders << endl;
|
||||||
|
if (stat.NumFiles != 1 || stat.NumFolders != 0)
|
||||||
|
stdStream << "Files: " << stat.NumFiles << endl;
|
||||||
|
stdStream
|
||||||
|
<< "Size: " << stat.UnpackSize << endl
|
||||||
|
<< "Compressed: " << stat.PackSize << endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -185,7 +185,6 @@ bool CFSFolder::LoadComments()
|
|||||||
file.Read(p, (UInt32)length, processedSize);
|
file.Read(p, (UInt32)length, processedSize);
|
||||||
p[length] = 0;
|
p[length] = 0;
|
||||||
s.ReleaseBuffer();
|
s.ReleaseBuffer();
|
||||||
s.Replace("\r\n", "\n");
|
|
||||||
if (processedSize != length)
|
if (processedSize != length)
|
||||||
return false;
|
return false;
|
||||||
file.Close();
|
file.Close();
|
||||||
@@ -218,7 +217,6 @@ bool CFSFolder::SaveComments()
|
|||||||
Byte bom [] = { 0xEF, 0xBB, 0xBF, 0x0D, 0x0A };
|
Byte bom [] = { 0xEF, 0xBB, 0xBF, 0x0D, 0x0A };
|
||||||
file.Write(bom , sizeof(bom), processedSize);
|
file.Write(bom , sizeof(bom), processedSize);
|
||||||
}
|
}
|
||||||
utfString.Replace("\n", "\r\n");
|
|
||||||
file.Write(utfString, utfString.Length(), processedSize);
|
file.Write(utfString, utfString.Length(), processedSize);
|
||||||
_commentsAreLoaded = false;
|
_commentsAreLoaded = false;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "ProgressDialog2Res.h"
|
#include "ProgressDialog2Res.h"
|
||||||
#include "../../GuiCommon.rc"
|
#include "../../GuiCommon.rc"
|
||||||
|
|
||||||
#define xSize2 300
|
#define xSize2 320
|
||||||
#define ySize2 98
|
#define ySize2 98
|
||||||
|
|
||||||
#define xSize (xSize2 + marg + marg)
|
#define xSize (xSize2 + marg + marg)
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
#define x0Size 90
|
#define x0Size 90
|
||||||
#define x1 (marg + x0Size)
|
#define x1 (marg + x0Size)
|
||||||
#define x1Size 40
|
#define x1Size 70
|
||||||
|
|
||||||
#define x3Size 40
|
#define x3Size 40
|
||||||
#define x3 (xSize - marg - x3Size)
|
#define x3 (xSize - marg - x3Size)
|
||||||
|
|||||||
@@ -22,6 +22,11 @@ static bool IsSeparatorChar(wchar_t c)
|
|||||||
return (c == kSpaceChar || c == kTabChar);
|
return (c == kSpaceChar || c == kTabChar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RemoveCr(UString &s)
|
||||||
|
{
|
||||||
|
s.Replace(L"\x0D", L"");
|
||||||
|
}
|
||||||
|
|
||||||
static UString GetIDString(const wchar_t *srcString, int &finishPos)
|
static UString GetIDString(const wchar_t *srcString, int &finishPos)
|
||||||
{
|
{
|
||||||
UString result;
|
UString result;
|
||||||
@@ -42,6 +47,7 @@ static UString GetIDString(const wchar_t *srcString, int &finishPos)
|
|||||||
result += c;
|
result += c;
|
||||||
}
|
}
|
||||||
result.Trim();
|
result.Trim();
|
||||||
|
RemoveCr(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,34 +65,28 @@ static UString GetValueString(const wchar_t *srcString, int &finishPos)
|
|||||||
result += c;
|
result += c;
|
||||||
}
|
}
|
||||||
result.Trim();
|
result.Trim();
|
||||||
|
RemoveCr(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool GetTextPairs(const UString &srcString, CObjectVector<CTextPair> &pairs)
|
static bool GetTextPairs(const UString &srcString, CObjectVector<CTextPair> &pairs)
|
||||||
{
|
{
|
||||||
pairs.Clear();
|
|
||||||
UString srcString2 = srcString;
|
|
||||||
srcString2.Replace(L"\x0D", L"");
|
|
||||||
|
|
||||||
pairs.Clear();
|
pairs.Clear();
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
/////////////////////
|
if (srcString.Length() > 0)
|
||||||
// read strings
|
|
||||||
|
|
||||||
if (srcString2.Length() > 0)
|
|
||||||
{
|
{
|
||||||
if (srcString2[0] == kBOM)
|
if (srcString[0] == kBOM)
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
while (pos < srcString2.Length())
|
while (pos < srcString.Length())
|
||||||
{
|
{
|
||||||
int finishPos;
|
int finishPos;
|
||||||
UString id = GetIDString((const wchar_t *)srcString2 + pos, finishPos);
|
UString id = GetIDString((const wchar_t *)srcString + pos, finishPos);
|
||||||
pos += finishPos;
|
pos += finishPos;
|
||||||
if (id.IsEmpty())
|
if (id.IsEmpty())
|
||||||
continue;
|
continue;
|
||||||
UString value = GetValueString((const wchar_t *)srcString2 + pos, finishPos);
|
UString value = GetValueString((const wchar_t *)srcString + pos, finishPos);
|
||||||
pos += finishPos;
|
pos += finishPos;
|
||||||
if (!id.IsEmpty())
|
if (!id.IsEmpty())
|
||||||
{
|
{
|
||||||
@@ -195,7 +195,7 @@ bool CPairsStorage::ReadFromString(const UString &text)
|
|||||||
Sort();
|
Sort();
|
||||||
else
|
else
|
||||||
Pairs.Clear();
|
Pairs.Clear();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPairsStorage::SaveToString(UString &text)
|
void CPairsStorage::SaveToString(UString &text)
|
||||||
@@ -211,6 +211,7 @@ void CPairsStorage::SaveToString(UString &text)
|
|||||||
text += L'\"';
|
text += L'\"';
|
||||||
text += L' ';
|
text += L' ';
|
||||||
text += pair.Value;
|
text += pair.Value;
|
||||||
|
text += L'\x0D';
|
||||||
text += L'\n';
|
text += L'\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,11 @@ bool COutFile::Create(const char *name, bool createAlways)
|
|||||||
return OpenBinary(name, O_CREAT | O_EXCL | O_WRONLY);
|
return OpenBinary(name, O_CREAT | O_EXCL | O_WRONLY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool COutFile::Open(const char *name, DWORD creationDisposition)
|
||||||
|
{
|
||||||
|
return Create(name, false);
|
||||||
|
}
|
||||||
|
|
||||||
ssize_t COutFile::Write(const void *data, size_t size)
|
ssize_t COutFile::Write(const void *data, size_t size)
|
||||||
{
|
{
|
||||||
return write(_handle, data, size);
|
return write(_handle, data, size);
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class COutFile: public CFileBase
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool Create(const char *name, bool createAlways);
|
bool Create(const char *name, bool createAlways);
|
||||||
|
bool Open(const char *name, DWORD creationDisposition);
|
||||||
ssize_t Write(const void *data, size_t size);
|
ssize_t Write(const void *data, size_t size);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
;Defines
|
;Defines
|
||||||
|
|
||||||
!define VERSION_MAJOR 4
|
!define VERSION_MAJOR 4
|
||||||
!define VERSION_MINOR 55
|
!define VERSION_MINOR 56
|
||||||
!define VERSION_POSTFIX_FULL " beta"
|
!define VERSION_POSTFIX_FULL " beta"
|
||||||
!ifdef WIN64
|
!ifdef WIN64
|
||||||
!ifdef IA64
|
!ifdef IA64
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
|
|
||||||
<?define VerMajor = "4" ?>
|
<?define VerMajor = "4" ?>
|
||||||
<?define VerMinor = "55" ?>
|
<?define VerMinor = "56" ?>
|
||||||
<?define VerBuild = "00" ?>
|
<?define VerBuild = "00" ?>
|
||||||
<?define MmVer = "$(var.VerMajor).$(var.VerMinor)" ?>
|
<?define MmVer = "$(var.VerMajor).$(var.VerMinor)" ?>
|
||||||
<?define MmHex = "0$(var.VerMajor)$(var.VerMinor)" ?>
|
<?define MmHex = "0$(var.VerMajor)$(var.VerMinor)" ?>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
7-Zip method IDs (4.45)
|
7-Zip method IDs (4.56)
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
Each compression or crypto method in 7z has unique binary value (ID).
|
Each compression or crypto method in 7z has unique binary value (ID).
|
||||||
@@ -57,6 +57,9 @@ List of defined IDs
|
|||||||
04 - PPMD
|
04 - PPMD
|
||||||
01 - Version
|
01 - Version
|
||||||
|
|
||||||
|
7F -
|
||||||
|
01 - experimental methods.
|
||||||
|
|
||||||
80 - reserved for independent developers
|
80 - reserved for independent developers
|
||||||
|
|
||||||
E0 - Random IDs
|
E0 - Random IDs
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
Sources history of the 7-Zip
|
Sources history of the 7-Zip
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
|
Version 4.56 beta 2007-09-13
|
||||||
|
--------------------------------------
|
||||||
|
- some fixes in LZ encoder (LZMA and Deflate) code.
|
||||||
|
size_t was replaces to ptrdiff_t.
|
||||||
|
size_t version worked incorrectly with some compilers.
|
||||||
|
|
||||||
|
|
||||||
Version 4.46 beta 2007-05-25
|
Version 4.46 beta 2007-05-25
|
||||||
--------------------------------------
|
--------------------------------------
|
||||||
- CPP Synchronization objects now return HRes (error code) instead of bool.
|
- CPP Synchronization objects now return HRes (error code) instead of bool.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
7-Zip 4.55 Sources
|
7-Zip 4.56 Sources
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
7-Zip is a file archiver for Windows 95/98/ME/NT/2000/2003/XP/Vista.
|
7-Zip is a file archiver for Windows 95/98/ME/NT/2000/2003/XP/Vista.
|
||||||
@@ -133,7 +133,11 @@ Windows Win32 wrappers
|
|||||||
SFXCon 7zCon.sfx: Console 7z SFX module
|
SFXCon 7zCon.sfx: Console 7z SFX module
|
||||||
SFXWin 7z.sfx: Windows 7z SFX module
|
SFXWin 7z.sfx: Windows 7z SFX module
|
||||||
SFXSetup 7zS.sfx: Windows 7z SFX module for Installers
|
SFXSetup 7zS.sfx: Windows 7z SFX module for Installers
|
||||||
Format7z 7za.dll: Standalone version of 7z.dll
|
Format7z 7za.dll: .7z support
|
||||||
|
Format7zExtract 7zxa.dll: .7z support, extracting only
|
||||||
|
Format7zR 7zr.dll: .7z support, LZMA/BCJ* only
|
||||||
|
Format7zExtractR 7zxr.dll: .7z support, LZMA/BCJ* only, extracting only
|
||||||
|
Format7zF 7z.dll: all formats
|
||||||
|
|
||||||
UI
|
UI
|
||||||
--
|
--
|
||||||
|
|||||||
Reference in New Issue
Block a user