Update to 7-Zip 16.03

This commit is contained in:
Tino Reichardt
2016-09-29 20:02:18 +02:00
parent a2f0a60c42
commit 0e6c1206d2
87 changed files with 1201 additions and 386 deletions

View File

@@ -749,11 +749,10 @@ static int main2(int numArgs, const char *args[])
}
}
if (!stdOutMode)
Print_Size("Output size: ", outStreamSpec->ProcessedSize);
if (outStreamSpec)
{
if (!stdOutMode)
Print_Size("Output size: ", outStreamSpec->ProcessedSize);
if (outStreamSpec->Close() != S_OK)
throw "File closing error";
}

View File

@@ -804,6 +804,15 @@ SOURCE=..\..\..\..\C\Delta.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\DllSecur.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\DllSecur.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\Lzma2Dec.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File

View File

@@ -24,6 +24,8 @@
#include "../../MyVersion.h"
#include "../../../../C/DllSecur.h"
using namespace NWindows;
using namespace NFile;
using namespace NDir;
@@ -103,7 +105,7 @@ static const wchar_t *kUniversalWildcard = L"*";
static const int kCommandIndex = 0;
static const char *kHelpString =
"\nUsage: 7zSFX [<command>] [<switches>...]\n"
"\nUsage: 7zSFX [<command>] [<switches>...] [<file_name>...]\n"
"\n"
"<Commands>\n"
// " l: List contents of archive\n"
@@ -222,13 +224,6 @@ void AddCommandLineWildcardToCensor(NWildcard::CCensor &wildcardCensor,
ShowMessageAndThrowException(kIncorrectWildcardInCommandLine, NExitCode::kUserError);
}
void AddToCensorFromNonSwitchesStrings(NWildcard::CCensor &wildcardCensor,
const UStringVector & /* nonSwitchStrings */, NRecursedType::EEnum type,
bool /* thereAreSwitchIncludeWildcards */)
{
AddCommandLineWildcardToCensor(wildcardCensor, kUniversalWildcard, true, type);
}
#ifndef _WIN32
static void GetArguments(int numArgs, const char *args[], UStringVector &parts)
@@ -248,6 +243,11 @@ int Main2(
#endif
)
{
#ifdef _WIN32
// do we need load Security DLLs for console program?
LoadSecurityDlls();
#endif
#if defined(_WIN32) && !defined(UNDER_CE)
SetFileApisToOEM();
#endif
@@ -283,9 +283,16 @@ int Main2(
commandStrings.Delete(0);
NCommandLineParser::CParser parser(kNumSwitches);
try
{
parser.ParseStrings(kSwitchForms, commandStrings);
if (!parser.ParseStrings(kSwitchForms, commandStrings))
{
g_StdOut << "Command line error:" << endl
<< parser.ErrorMessage << endl
<< parser.ErrorLine << endl;
return NExitCode::kUserError;
}
}
catch(...)
{
@@ -297,19 +304,23 @@ int Main2(
PrintHelp();
return 0;
}
const UStringVector &nonSwitchStrings = parser.NonSwitchStrings;
int numNonSwitchStrings = nonSwitchStrings.Size();
unsigned curCommandIndex = 0;
CArchiveCommand command;
if (numNonSwitchStrings == 0)
if (nonSwitchStrings.IsEmpty())
command.CommandType = NCommandType::kFullExtract;
else
{
if (numNonSwitchStrings > 1)
PrintHelpAndExit();
if (!ParseArchiveCommand(nonSwitchStrings[kCommandIndex], command))
PrintHelpAndExit();
const UString &cmd = nonSwitchStrings[curCommandIndex];
if (!ParseArchiveCommand(cmd, command))
{
g_StdOut << "ERROR: Unknown command:" << endl << cmd << endl;
return NExitCode::kUserError;
}
curCommandIndex = 1;
}
@@ -318,11 +329,17 @@ int Main2(
NWildcard::CCensor wildcardCensor;
bool thereAreSwitchIncludeWildcards;
thereAreSwitchIncludeWildcards = false;
AddToCensorFromNonSwitchesStrings(wildcardCensor, nonSwitchStrings, recursedType,
thereAreSwitchIncludeWildcards);
{
if (nonSwitchStrings.Size() == curCommandIndex)
AddCommandLineWildcardToCensor(wildcardCensor, kUniversalWildcard, true, recursedType);
for (; curCommandIndex < nonSwitchStrings.Size(); curCommandIndex++)
{
const UString &s = nonSwitchStrings[curCommandIndex];
if (s.IsEmpty())
throw "Empty file path";
AddCommandLineWildcardToCensor(wildcardCensor, s, true, recursedType);
}
}
bool yesToAll = parser[NKey::kYes].ThereIs;

View File

@@ -4,6 +4,7 @@ CFLAGS = $(CFLAGS) \
-DEXTRACT_ONLY \
-DNO_READ_FROM_CODER \
-D_SFX \
-D_CONSOLE \
CURRENT_OBJS = \
$O\SfxCon.obj \
@@ -114,6 +115,7 @@ C_OBJS = \
$O\BraIA64.obj \
$O\CpuArch.obj \
$O\Delta.obj \
$O\DllSecur.obj \
$O\Lzma2Dec.obj \
$O\LzmaDec.obj \
$O\Ppmd7.obj \

View File

@@ -55,8 +55,7 @@ struct CThreadExtracting
Result = ArchiveLink.Open2(options, ExtractCallbackSpec);
if (Result != S_OK)
{
if (Result != S_OK)
ErrorMessage = kCantOpenArchive;
ErrorMessage = kCantOpenArchive;
return;
}

View File

@@ -706,6 +706,15 @@ SOURCE=..\..\..\..\C\Delta.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\DllSecur.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\DllSecur.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\Lzma2Dec.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File

View File

@@ -23,6 +23,8 @@
#include "ExtractEngine.h"
#include "../../../../C/DllSecur.h"
#include "resource.h"
using namespace NWindows;
@@ -135,6 +137,10 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
NT_CHECK
#ifdef _WIN32
LoadSecurityDlls();
#endif
// InitCommonControls();
UString archiveName, switches;

View File

@@ -100,6 +100,7 @@ C_OBJS = \
$O\BraIA64.obj \
$O\CpuArch.obj \
$O\Delta.obj \
$O\DllSecur.obj \
$O\Lzma2Dec.obj \
$O\LzmaDec.obj \
$O\Threads.obj \

View File

@@ -888,6 +888,15 @@ SOURCE=..\..\..\..\C\Delta.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\DllSecur.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\DllSecur.h
# End Source File
# Begin Source File
SOURCE=..\..\..\..\C\Lzma2Dec.c
# SUBTRACT CPP /YX /Yc /Yu
# End Source File

View File

@@ -28,6 +28,8 @@
#include "../../UI/GUI/ExtractGUI.h"
#include "../../UI/GUI/ExtractRes.h"
#include "../../../../C/DllSecur.h"
using namespace NWindows;
using namespace NFile;
using namespace NDir;
@@ -220,6 +222,10 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /* hPrevInstance */,
try
{
#ifdef _WIN32
LoadSecurityDlls();
#endif
return WinMain2();
}
catch(const CNewException &)

View File

@@ -131,8 +131,9 @@ C_OBJS = \
$O\Bra.obj \
$O\Bra86.obj \
$O\BraIA64.obj \
$O\Delta.obj \
$O\CpuArch.obj \
$O\Delta.obj \
$O\DllSecur.obj \
$O\Lzma2Dec.obj \
$O\LzmaDec.obj \
$O\Ppmd7.obj \