4.35 beta

This commit is contained in:
Igor Pavlov
2006-03-03 00:00:00 +00:00
committed by Kornel Lesiński
parent 0f60a4933b
commit 191cf6781a
16 changed files with 156 additions and 53 deletions

View File

@@ -6,6 +6,7 @@ CFLAGS = $(CFLAGS) -I ../../../ \
-DNO_REGISTRY \ -DNO_REGISTRY \
-D_NO_CRYPTO \ -D_NO_CRYPTO \
-DFORMAT_7Z \ -DFORMAT_7Z \
-DCOMPRESS_MT \
-DCOMPRESS_BCJ_X86 \ -DCOMPRESS_BCJ_X86 \
-DCOMPRESS_BCJ2 \ -DCOMPRESS_BCJ2 \
-DCOMPRESS_COPY \ -DCOMPRESS_COPY \
@@ -78,6 +79,7 @@ UI_COMMON_OBJS = \
$O\ExtractingFilePath.obj \ $O\ExtractingFilePath.obj \
$O\OpenArchive.obj \ $O\OpenArchive.obj \
$O\PropIDUtils.obj \ $O\PropIDUtils.obj \
$O\SetProperties.obj \
$O\SortUtils.obj \ $O\SortUtils.obj \
$O\TempFiles.obj \ $O\TempFiles.obj \
$O\Update.obj \ $O\Update.obj \
@@ -97,6 +99,7 @@ AR_COMMON_OBJS = \
$O\ItemNameUtils.obj \ $O\ItemNameUtils.obj \
$O\MultiStream.obj \ $O\MultiStream.obj \
$O\OutStreamWithCRC.obj \ $O\OutStreamWithCRC.obj \
$O\ParseProperties.obj \
7Z_OBJS = \ 7Z_OBJS = \

View File

@@ -459,7 +459,7 @@ int Main2(
HRESULT result = ListArchives( HRESULT result = ListArchives(
v1, v2, v1, v2,
wildcardCensorHead, wildcardCensorHead,
true, true, false,
passwordEnabled, passwordEnabled,
password); password);
if (result != S_OK) if (result != S_OK)

View File

@@ -27,9 +27,9 @@ public:
bool CopyBlock(UInt32 distance, UInt32 len) bool CopyBlock(UInt32 distance, UInt32 len)
{ {
UInt32 pos = _pos - distance - 1; UInt32 pos = _pos - distance - 1;
if (pos >= _bufferSize) if (distance >= _pos)
{ {
if (!_overDict) if (!_overDict || distance >= _bufferSize)
return false; return false;
pos += _bufferSize; pos += _bufferSize;
} }

View File

@@ -152,7 +152,7 @@ int main2(int n, const char *args[])
g_IsNT = IsItWindowsNT(); g_IsNT = IsItWindowsNT();
#endif #endif
fprintf(stderr, "\nLZMA 4.34 Copyright (c) 1999-2006 Igor Pavlov 2006-02-23\n"); fprintf(stderr, "\nLZMA 4.35 Copyright (c) 1999-2006 Igor Pavlov 2006-03-03\n");
if (n == 1) if (n == 1)
{ {

View File

@@ -287,7 +287,10 @@ STDMETHODIMP CDecoder::CodeReal(ISequentialInStream *inStream,
} }
else else
return S_FALSE; return S_FALSE;
CopyBackBlockOp(distance, length); m_RepDists[m_RepDistPtr++ & 3] = distance;
m_LastLength = length;
if (!m_OutWindowStream.CopyBlock(distance, length))
return S_FALSE;
pos += length; pos += length;
} }
} }

View File

@@ -56,16 +56,6 @@ class CDecoder :
void InitStructures(); void InitStructures();
bool ReadTables(); bool ReadTables();
bool ReadLastTables(); bool ReadLastTables();
void CopyBackBlockOp(UInt32 aDistance, UInt32 aLength)
{
/*
if(m_Position <= aDistance)
throw CDecoderException(CDecoderException::kData);
*/
m_RepDists[m_RepDistPtr++ & 3] = aDistance;
m_LastLength = aLength;
m_OutWindowStream.CopyBlock(aDistance, aLength);
}
public: public:
CDecoder(); CDecoder();

View File

@@ -1,7 +1,7 @@
#define MY_VER_MAJOR 4 #define MY_VER_MAJOR 4
#define MY_VER_MINOR 34 #define MY_VER_MINOR 35
#define MY_VERSION "4.34 beta" #define MY_VERSION "4.35 beta"
#define MY_7ZIP_VERSION "7-Zip 4.34 beta" #define MY_7ZIP_VERSION "7-Zip 4.35 beta"
#define MY_DATE "2006-02-27" #define MY_DATE "2006-03-03"
#define MY_COPYRIGHT "Copyright (c) 1999-2006 Igor Pavlov" #define MY_COPYRIGHT "Copyright (c) 1999-2006 Igor Pavlov"
#define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE #define MY_VERSION_COPYRIGHT_DATE MY_VERSION " " MY_COPYRIGHT " " MY_DATE

View File

@@ -27,7 +27,7 @@ using namespace NCommandLineParser;
using namespace NWindows; using namespace NWindows;
using namespace NFile; using namespace NFile;
static const int kNumSwitches = 26; static const int kNumSwitches = 27;
namespace NKey { namespace NKey {
enum Enum enum Enum
@@ -57,7 +57,8 @@ enum Enum
kEmail, kEmail,
kShowDialog, kShowDialog,
kLargePages, kLargePages,
kCharSet kCharSet,
kTechMode
}; };
} }
@@ -121,7 +122,8 @@ static const CSwitchForm kSwitchForms[kNumSwitches] =
{ L"SEML", NSwitchType::kUnLimitedPostString, false, 0}, { L"SEML", NSwitchType::kUnLimitedPostString, false, 0},
{ L"AD", NSwitchType::kSimple, false }, { L"AD", NSwitchType::kSimple, false },
{ L"SLP", NSwitchType::kUnLimitedPostString, false, 0}, { L"SLP", NSwitchType::kUnLimitedPostString, false, 0},
{ L"SCS", NSwitchType::kUnLimitedPostString, false, 0} { L"SCS", NSwitchType::kUnLimitedPostString, false, 0},
{ L"SLT", NSwitchType::kSimple, false }
}; };
static const int kNumCommandForms = 7; static const int kNumCommandForms = 7;
@@ -236,7 +238,7 @@ static bool AddNameToCensor(NWildcard::CCensor &wildcardCensor,
return true; return true;
} }
static inline GetCurrentCodePage() { return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; } static inline UINT GetCurrentCodePage() { return ::AreFileApisANSI() ? CP_ACP : CP_OEMCP; }
static void AddToCensorFromListFile(NWildcard::CCensor &wildcardCensor, static void AddToCensorFromListFile(NWildcard::CCensor &wildcardCensor,
LPCWSTR fileName, bool include, NRecursedType::EEnum type, UINT codePage) LPCWSTR fileName, bool include, NRecursedType::EEnum type, UINT codePage)
@@ -747,6 +749,8 @@ void CArchiveCommandLineParser::Parse2(CArchiveCommandLineOptions &options)
if (!ParseArchiveCommand(nonSwitchStrings[kCommandIndex], options.Command)) if (!ParseArchiveCommand(nonSwitchStrings[kCommandIndex], options.Command))
throw kUserErrorMessage; throw kUserErrorMessage;
options.TechMode = parser[NKey::kTechMode].ThereIs;
NRecursedType::EEnum recursedType; NRecursedType::EEnum recursedType;
if (parser[NKey::kRecursed].ThereIs) if (parser[NKey::kRecursed].ThereIs)
recursedType = GetRecursedTypeFromIndex(parser[NKey::kRecursed].PostCharIndex); recursedType = GetRecursedTypeFromIndex(parser[NKey::kRecursed].PostCharIndex);

View File

@@ -62,6 +62,7 @@ struct CArchiveCommandLineOptions
bool PasswordEnabled; bool PasswordEnabled;
UString Password; UString Password;
bool TechMode;
// Extract // Extract
bool AppendName; bool AppendName;
UString OutputDir; UString OutputDir;

View File

@@ -24,6 +24,42 @@
using namespace NWindows; using namespace NWindows;
struct CPropIdToName
{
PROPID PropID;
const wchar_t *Name;
};
static CPropIdToName kPropIdToName[] =
{
{ kpidPath, L"Path" },
{ kpidName, L"Name" },
{ kpidIsFolder, L"Folder" },
{ kpidSize, L"Size" },
{ kpidPackedSize, L"Packed Size" },
{ kpidAttributes, L"Attributes" },
{ kpidCreationTime, L"Created" },
{ kpidLastAccessTime, L"Accessed" },
{ kpidLastWriteTime, L"Modified" },
{ kpidSolid, L"Solid" },
{ kpidCommented, L"Commented" },
{ kpidEncrypted, L"Encrypted" },
{ kpidSplitBefore, L"Split Before" },
{ kpidSplitAfter, L"Split After" },
{ kpidDictionarySize, L"Dictionary Size" },
{ kpidCRC, L"CRC" },
{ kpidType, L"Type" },
{ kpidIsAnti, L"Anti" },
{ kpidMethod, L"Method" },
{ kpidHostOS, L"Host OS" },
{ kpidFileSystem, L"File System" },
{ kpidUser, L"User" },
{ kpidGroup, L"Group" },
{ kpidBlock, L"Block" },
{ kpidComment, L"Comment" },
{ kpidPosition, L"Position" }
};
static const char kEmptyAttributeChar = '.'; static const char kEmptyAttributeChar = '.';
static const char kDirectoryAttributeChar = 'D'; static const char kDirectoryAttributeChar = 'D';
static const char kReadonlyAttributeChar = 'R'; static const char kReadonlyAttributeChar = 'R';
@@ -116,19 +152,23 @@ class CFieldPrinter
{ {
CObjectVector<CFieldInfo> _fields; CObjectVector<CFieldInfo> _fields;
public: public:
void Clear() { _fields.Clear(); }
void Init(const CFieldInfoInit *standardFieldTable, int numItems); void Init(const CFieldInfoInit *standardFieldTable, int numItems);
HRESULT Init(IInArchive *archive);
void PrintTitle(); void PrintTitle();
void PrintTitleLines(); void PrintTitleLines();
HRESULT PrintItemInfo(IInArchive *archive, HRESULT PrintItemInfo(IInArchive *archive,
const UString &defaultItemName, const UString &defaultItemName,
const NWindows::NFile::NFind::CFileInfoW &archiveFileInfo, const NWindows::NFile::NFind::CFileInfoW &archiveFileInfo,
UInt32 index); UInt32 index,
bool techMode);
HRESULT PrintSummaryInfo(UInt64 numFiles, const UInt64 *size, HRESULT PrintSummaryInfo(UInt64 numFiles, const UInt64 *size,
const UInt64 *compressedSize); const UInt64 *compressedSize);
}; };
void CFieldPrinter::Init(const CFieldInfoInit *standardFieldTable, int numItems) void CFieldPrinter::Init(const CFieldInfoInit *standardFieldTable, int numItems)
{ {
Clear();
for (int i = 0; i < numItems; i++) for (int i = 0; i < numItems; i++)
{ {
CFieldInfo fieldInfo; CFieldInfo fieldInfo;
@@ -143,6 +183,38 @@ void CFieldPrinter::Init(const CFieldInfoInit *standardFieldTable, int numItems)
} }
} }
HRESULT CFieldPrinter::Init(IInArchive *archive)
{
Clear();
UInt32 numProps;
RINOK(archive->GetNumberOfProperties(&numProps));
for (UInt32 i = 0; i < numProps; i++)
{
CMyComBSTR name;
PROPID propID;
VARTYPE vt;
RINOK(archive->GetPropertyInfo(i, &name, &propID, &vt));
CFieldInfo fieldInfo;
fieldInfo.PropID = propID;
if (name != NULL)
fieldInfo.Name = name;
else
{
fieldInfo.Name = L"Unknown";
for (int i = 0; i < sizeof(kPropIdToName) / sizeof(kPropIdToName[0]); i++)
{
const CPropIdToName &propIdToName = kPropIdToName[i];
if (propIdToName.PropID == propID)
{
fieldInfo.Name = propIdToName.Name;
break;
}
}
}
_fields.Add(fieldInfo);
}
return S_OK;
}
void CFieldPrinter::PrintTitle() void CFieldPrinter::PrintTitle()
{ {
@@ -195,15 +267,29 @@ void PrintTime(const NCOM::CPropVariant &propVariant)
HRESULT CFieldPrinter::PrintItemInfo(IInArchive *archive, HRESULT CFieldPrinter::PrintItemInfo(IInArchive *archive,
const UString &defaultItemName, const UString &defaultItemName,
const NWindows::NFile::NFind::CFileInfoW &archiveFileInfo, const NWindows::NFile::NFind::CFileInfoW &archiveFileInfo,
UInt32 index) UInt32 index,
bool techMode)
{ {
/*
if (techMode)
{
g_StdOut << "Index = ";
g_StdOut << (UInt64)index;
g_StdOut << endl;
}
*/
for (int i = 0; i < _fields.Size(); i++) for (int i = 0; i < _fields.Size(); i++)
{ {
const CFieldInfo &fieldInfo = _fields[i]; const CFieldInfo &fieldInfo = _fields[i];
if (!techMode)
PrintSpaces(fieldInfo.PrefixSpacesWidth); PrintSpaces(fieldInfo.PrefixSpacesWidth);
NCOM::CPropVariant propVariant; NCOM::CPropVariant propVariant;
RINOK(archive->GetProperty(index, fieldInfo.PropID, &propVariant)); RINOK(archive->GetProperty(index, fieldInfo.PropID, &propVariant));
if (techMode)
{
g_StdOut << fieldInfo.Name << " = ";
}
int width = (fieldInfo.PropID == kpidPath) ? 0: fieldInfo.Width; int width = (fieldInfo.PropID == kpidPath) ? 0: fieldInfo.Width;
if (propVariant.vt == VT_EMPTY) if (propVariant.vt == VT_EMPTY)
{ {
@@ -216,17 +302,18 @@ HRESULT CFieldPrinter::PrintItemInfo(IInArchive *archive,
propVariant = archiveFileInfo.LastWriteTime; propVariant = archiveFileInfo.LastWriteTime;
break; break;
default: default:
if (techMode)
g_StdOut << endl;
else
PrintSpaces(width); PrintSpaces(width);
continue; continue;
} }
} }
if (fieldInfo.PropID == kpidLastWriteTime) if (fieldInfo.PropID == kpidLastWriteTime)
{ {
PrintTime(propVariant); PrintTime(propVariant);
continue;
} }
if (fieldInfo.PropID == kpidAttributes) else if (fieldInfo.PropID == kpidAttributes)
{ {
if (propVariant.vt != VT_UI4) if (propVariant.vt != VT_UI4)
throw "incorrect item"; throw "incorrect item";
@@ -236,16 +323,24 @@ HRESULT CFieldPrinter::PrintItemInfo(IInArchive *archive,
char s[8]; char s[8];
GetAttributesString(attributes, isFolder, s); GetAttributesString(attributes, isFolder, s);
g_StdOut << s; g_StdOut << s;
continue;
} }
else if (propVariant.vt == VT_BSTR)
if (propVariant.vt == VT_BSTR)
{ {
if (techMode)
g_StdOut << propVariant.bstrVal;
else
PrintString(fieldInfo.TextAdjustment, width, propVariant.bstrVal); PrintString(fieldInfo.TextAdjustment, width, propVariant.bstrVal);
continue;
} }
PrintString(fieldInfo.TextAdjustment, width, else
ConvertPropertyToString(propVariant, fieldInfo.PropID)); {
UString s = ConvertPropertyToString(propVariant, fieldInfo.PropID);
if (techMode)
g_StdOut << s;
else
PrintString(fieldInfo.TextAdjustment, width, s);
}
if (techMode)
g_StdOut << endl;
} }
return S_OK; return S_OK;
} }
@@ -299,9 +394,10 @@ bool GetUInt64Value(IInArchive *archive, UInt32 index, PROPID propID, UInt64 &va
HRESULT ListArchives(UStringVector &archivePaths, UStringVector &archivePathsFull, HRESULT ListArchives(UStringVector &archivePaths, UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor, const NWildcard::CCensorNode &wildcardCensor,
bool enableHeaders, bool &passwordEnabled, UString &password) bool enableHeaders, bool techMode, bool &passwordEnabled, UString &password)
{ {
CFieldPrinter fieldPrinter; CFieldPrinter fieldPrinter;
if (!techMode)
fieldPrinter.Init(kStandardFieldTable, sizeof(kStandardFieldTable) / sizeof(kStandardFieldTable[0])); fieldPrinter.Init(kStandardFieldTable, sizeof(kStandardFieldTable) / sizeof(kStandardFieldTable[0]));
UInt64 numFiles2 = 0, totalPackSize2 = 0, totalUnPackSize2 = 0; UInt64 numFiles2 = 0, totalPackSize2 = 0, totalUnPackSize2 = 0;
@@ -355,7 +451,7 @@ HRESULT ListArchives(UStringVector &archivePaths, UStringVector &archivePathsFul
if (enableHeaders) if (enableHeaders)
g_StdOut << endl << kListing << archiveName << endl << endl; g_StdOut << endl << kListing << archiveName << endl << endl;
if (enableHeaders) if (enableHeaders && !techMode)
{ {
fieldPrinter.PrintTitle(); fieldPrinter.PrintTitle();
g_StdOut << endl; g_StdOut << endl;
@@ -363,6 +459,10 @@ HRESULT ListArchives(UStringVector &archivePaths, UStringVector &archivePathsFul
g_StdOut << endl; g_StdOut << endl;
} }
if (techMode)
{
RINOK(fieldPrinter.Init(archive));
}
UInt64 numFiles = 0, totalPackSize = 0, totalUnPackSize = 0; UInt64 numFiles = 0, totalPackSize = 0, totalUnPackSize = 0;
UInt64 *totalPackSizePointer = 0, *totalUnPackSizePointer = 0; UInt64 *totalPackSizePointer = 0, *totalUnPackSizePointer = 0;
UInt32 numItems; UInt32 numItems;
@@ -380,7 +480,7 @@ HRESULT ListArchives(UStringVector &archivePaths, UStringVector &archivePathsFul
if (!wildcardCensor.CheckPath(filePath, !isFolder)) if (!wildcardCensor.CheckPath(filePath, !isFolder))
continue; continue;
fieldPrinter.PrintItemInfo(archive, defaultItemName, archiveFileInfo, i); fieldPrinter.PrintItemInfo(archive, defaultItemName, archiveFileInfo, i, techMode);
UInt64 packSize, unpackSize; UInt64 packSize, unpackSize;
if (!GetUInt64Value(archive, i, kpidSize, unpackSize)) if (!GetUInt64Value(archive, i, kpidSize, unpackSize))
@@ -398,7 +498,7 @@ HRESULT ListArchives(UStringVector &archivePaths, UStringVector &archivePathsFul
totalPackSize += packSize; totalPackSize += packSize;
totalUnPackSize += unpackSize; totalUnPackSize += unpackSize;
} }
if (enableHeaders) if (enableHeaders && !techMode)
{ {
fieldPrinter.PrintTitleLines(); fieldPrinter.PrintTitleLines();
g_StdOut << endl; g_StdOut << endl;
@@ -417,7 +517,7 @@ HRESULT ListArchives(UStringVector &archivePaths, UStringVector &archivePathsFul
} }
numFiles2 += numFiles; numFiles2 += numFiles;
} }
if (enableHeaders && archivePaths.Size() > 1) if (enableHeaders && !techMode && archivePaths.Size() > 1)
{ {
g_StdOut << endl; g_StdOut << endl;
fieldPrinter.PrintTitleLines(); fieldPrinter.PrintTitleLines();

View File

@@ -7,7 +7,7 @@
HRESULT ListArchives(UStringVector &archivePaths, UStringVector &archivePathsFull, HRESULT ListArchives(UStringVector &archivePaths, UStringVector &archivePathsFull,
const NWildcard::CCensorNode &wildcardCensor, const NWildcard::CCensorNode &wildcardCensor,
bool enableHeaders, bool &passwordEnabled, UString &password); bool enableHeaders, bool techMode, bool &passwordEnabled, UString &password);
#endif #endif

View File

@@ -257,6 +257,7 @@ int Main2(
options.ArchivePathsFullSorted, options.ArchivePathsFullSorted,
options.WildcardCensor.Pairs.Front().Head, options.WildcardCensor.Pairs.Front().Head,
options.EnableHeaders, options.EnableHeaders,
options.TechMode,
options.PasswordEnabled, options.PasswordEnabled,
options.Password); options.Password);
if (result != S_OK) if (result != S_OK)

View File

@@ -40,12 +40,12 @@ You must download 7-Zip program from www.7-zip.org.
You can create .7z archive with 7z.exe or 7za.exe: You can create .7z archive with 7z.exe or 7za.exe:
7za.exe a archive.7z *.htm -r -mx -m0fb=255 7za.exe a archive.7z *.htm -r -mx -m0fb=255 -mf=off
If you have big number of files in archive, and you need fast extracting, If you have big number of files in archive, and you need fast extracting,
you can use partly-solid archives: you can use partly-solid archives:
7za.exe a archive.7z *.htm -ms=512K -r -mx -m0fb=255 -m0d=512K 7za.exe a archive.7z *.htm -ms=512K -r -mx -m0fb=255 -m0d=512K -mf=off
In that example 7-Zip will use 512KB solid blocks. So it needs to decompress only In that example 7-Zip will use 512KB solid blocks. So it needs to decompress only
512KB for extracting one file from such archive. 512KB for extracting one file from such archive.

View File

@@ -2,7 +2,7 @@
;Defines ;Defines
!define VERSION_MAJOR 4 !define VERSION_MAJOR 4
!define VERSION_MINOR 34 !define VERSION_MINOR 35
!define VERSION_POSTFIX_FULL " beta" !define VERSION_POSTFIX_FULL " beta"
!ifdef WIN64 !ifdef WIN64
!ifdef IA64 !ifdef IA64
@@ -14,7 +14,7 @@
!define VERSION_SYS_POSTFIX_FULL "" !define VERSION_SYS_POSTFIX_FULL ""
!endif !endif
!define NAME_FULL "7-Zip ${VERSION_MAJOR}.${VERSION_MINOR}${VERSION_POSTFIX_FULL}${VERSION_SYS_POSTFIX_FULL}" !define NAME_FULL "7-Zip ${VERSION_MAJOR}.${VERSION_MINOR}${VERSION_POSTFIX_FULL}${VERSION_SYS_POSTFIX_FULL}"
!define VERSION_POSTFIX "b" !define VERSION_POSTFIX ""
!ifdef WIN64 !ifdef WIN64
!ifdef IA64 !ifdef IA64
!define VERSION_SYS_POSTFIX "-ia64" !define VERSION_SYS_POSTFIX "-ia64"

View File

@@ -1,7 +1,7 @@
LZMA SDK 4.34 LZMA SDK 4.35
------------- -------------
LZMA SDK 4.34 Copyright (C) 1999-2006 Igor Pavlov LZMA SDK Copyright (C) 1999-2006 Igor Pavlov
LZMA SDK provides the documentation, samples, header files, libraries, LZMA SDK provides the documentation, samples, header files, libraries,
and tools you need to develop applications that use LZMA compression. and tools you need to develop applications that use LZMA compression.

View File

@@ -1,4 +1,4 @@
7-Zip 4.33 Sources 7-Zip 4.35 Sources
------------------ ------------------
7-Zip is a file archiver for Windows 95/98/ME/NT/2000/2003/XP. 7-Zip is a file archiver for Windows 95/98/ME/NT/2000/2003/XP.
@@ -170,6 +170,7 @@ Windows Win32 wrappers
Bundle Modules that are bundles of other modules Bundle Modules that are bundles of other modules
------ ------
Alone 7za.exe: Standalone version of 7z Alone 7za.exe: Standalone version of 7z
Alone7z 7zr.exe: Standalone version of 7z that supports only 7z/LZMA/BCJ/BCJ2
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