mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-10 06:07:07 -06:00
9.34
This commit is contained in:
committed by
Kornel Lesiński
parent
83f8ddcc5b
commit
f08f4dcc3c
77
CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp
Executable file → Normal file
77
CPP/7zip/Bundles/LzmaCon/LzmaAlone.cpp
Executable file → Normal file
@@ -69,27 +69,25 @@ enum Enum
|
||||
|
||||
static const CSwitchForm kSwitchForms[] =
|
||||
{
|
||||
{ L"?", NSwitchType::kSimple, false },
|
||||
{ L"H", NSwitchType::kSimple, false },
|
||||
{ L"MM", NSwitchType::kUnLimitedPostString, false, 1 },
|
||||
{ L"X", NSwitchType::kUnLimitedPostString, false, 1 },
|
||||
{ L"A", NSwitchType::kUnLimitedPostString, false, 1 },
|
||||
{ L"D", NSwitchType::kUnLimitedPostString, false, 1 },
|
||||
{ L"FB", NSwitchType::kUnLimitedPostString, false, 1 },
|
||||
{ L"MC", NSwitchType::kUnLimitedPostString, false, 1 },
|
||||
{ L"LC", NSwitchType::kUnLimitedPostString, false, 1 },
|
||||
{ L"LP", NSwitchType::kUnLimitedPostString, false, 1 },
|
||||
{ L"PB", NSwitchType::kUnLimitedPostString, false, 1 },
|
||||
{ L"MF", NSwitchType::kUnLimitedPostString, false, 1 },
|
||||
{ L"MT", NSwitchType::kUnLimitedPostString, false, 0 },
|
||||
{ L"EOS", NSwitchType::kSimple, false },
|
||||
{ L"SI", NSwitchType::kSimple, false },
|
||||
{ L"SO", NSwitchType::kSimple, false },
|
||||
{ L"F86", NSwitchType::kPostChar, false, 0, 0, L"+" }
|
||||
{ "?", NSwitchType::kSimple, false },
|
||||
{ "H", NSwitchType::kSimple, false },
|
||||
{ "MM", NSwitchType::kString, false, 1 },
|
||||
{ "X", NSwitchType::kString, false, 1 },
|
||||
{ "A", NSwitchType::kString, false, 1 },
|
||||
{ "D", NSwitchType::kString, false, 1 },
|
||||
{ "FB", NSwitchType::kString, false, 1 },
|
||||
{ "MC", NSwitchType::kString, false, 1 },
|
||||
{ "LC", NSwitchType::kString, false, 1 },
|
||||
{ "LP", NSwitchType::kString, false, 1 },
|
||||
{ "PB", NSwitchType::kString, false, 1 },
|
||||
{ "MF", NSwitchType::kString, false, 1 },
|
||||
{ "MT", NSwitchType::kString, false, 0 },
|
||||
{ "EOS", NSwitchType::kSimple, false },
|
||||
{ "SI", NSwitchType::kSimple, false },
|
||||
{ "SO", NSwitchType::kSimple, false },
|
||||
{ "F86", NSwitchType::kChar, false, 0, "+" }
|
||||
};
|
||||
|
||||
static const int kNumSwitches = sizeof(kSwitchForms) / sizeof(kSwitchForms[0]);
|
||||
|
||||
static void PrintMessage(const char *s)
|
||||
{
|
||||
fputs(s, stderr);
|
||||
@@ -138,19 +136,14 @@ static void WriteArgumentsToStringList(int numArgs, const char *args[], UStringV
|
||||
static bool GetNumber(const wchar_t *s, UInt32 &value)
|
||||
{
|
||||
value = 0;
|
||||
if (MyStringLen(s) == 0)
|
||||
if (*s == 0)
|
||||
return false;
|
||||
const wchar_t *end;
|
||||
UInt64 res = ConvertStringToUInt64(s, &end);
|
||||
if (*end != L'\0')
|
||||
return false;
|
||||
if (res > 0xFFFFFFFF)
|
||||
return false;
|
||||
value = UInt32(res);
|
||||
return true;
|
||||
value = ConvertStringToUInt32(s, &end);
|
||||
return *end == 0;
|
||||
}
|
||||
|
||||
static void ParseUInt32(const CParser &parser, int index, UInt32 &res)
|
||||
static void ParseUInt32(const CParser &parser, unsigned index, UInt32 &res)
|
||||
{
|
||||
if (parser[index].ThereIs)
|
||||
if (!GetNumber(parser[index].PostStrings[0], res))
|
||||
@@ -180,7 +173,8 @@ int main2(int numArgs, const char *args[])
|
||||
|
||||
UStringVector commandStrings;
|
||||
WriteArgumentsToStringList(numArgs, args, commandStrings);
|
||||
CParser parser(kNumSwitches);
|
||||
|
||||
CParser parser(ARRAY_SIZE(kSwitchForms));
|
||||
try
|
||||
{
|
||||
parser.ParseStrings(kSwitchForms, commandStrings);
|
||||
@@ -197,7 +191,7 @@ int main2(int numArgs, const char *args[])
|
||||
}
|
||||
const UStringVector &nonSwitchStrings = parser.NonSwitchStrings;
|
||||
|
||||
int paramIndex = 0;
|
||||
unsigned paramIndex = 0;
|
||||
if (paramIndex >= nonSwitchStrings.Size())
|
||||
IncorrectCommand();
|
||||
const UString &command = nonSwitchStrings[paramIndex++];
|
||||
@@ -259,11 +253,11 @@ int main2(int numArgs, const char *args[])
|
||||
IncorrectCommand();
|
||||
CProperty prop;
|
||||
prop.Name = L"m";
|
||||
prop.Value = s.Mid(1);
|
||||
prop.Value = s.Ptr(1);
|
||||
props.Add(prop);
|
||||
}
|
||||
|
||||
if (command.CompareNoCase(L"b") == 0)
|
||||
if (MyStringCompareNoCase(command, L"b") == 0)
|
||||
{
|
||||
const UInt32 kNumDefaultItereations = 1;
|
||||
UInt32 numIterations = kNumDefaultItereations;
|
||||
@@ -288,9 +282,9 @@ int main2(int numArgs, const char *args[])
|
||||
numThreads = 1;
|
||||
|
||||
bool encodeMode = false;
|
||||
if (command.CompareNoCase(L"e") == 0)
|
||||
if (MyStringCompareNoCase(command, L"e") == 0)
|
||||
encodeMode = true;
|
||||
else if (command.CompareNoCase(L"d") == 0)
|
||||
else if (MyStringCompareNoCase(command, L"d") == 0)
|
||||
encodeMode = false;
|
||||
else
|
||||
IncorrectCommand();
|
||||
@@ -456,7 +450,7 @@ int main2(int numArgs, const char *args[])
|
||||
NCoderPropID::kNumThreads,
|
||||
NCoderPropID::kMatchFinderCycles,
|
||||
};
|
||||
const int kNumPropsMax = sizeof(propIDs) / sizeof(propIDs[0]);
|
||||
const unsigned kNumPropsMax = ARRAY_SIZE(propIDs);
|
||||
|
||||
PROPVARIANT props[kNumPropsMax];
|
||||
for (int p = 0; p < 6; p++)
|
||||
@@ -482,7 +476,7 @@ int main2(int numArgs, const char *args[])
|
||||
props[9].vt = VT_UI4;
|
||||
props[9].ulVal = (UInt32)mc;
|
||||
|
||||
int numProps = kNumPropsMax;
|
||||
unsigned numProps = kNumPropsMax;
|
||||
if (!mcDefined)
|
||||
numProps--;
|
||||
|
||||
@@ -512,7 +506,7 @@ int main2(int numArgs, const char *args[])
|
||||
}
|
||||
else if (result != S_OK)
|
||||
{
|
||||
fprintf(stderr, "\nEncoder error = %X\n", (unsigned int)result);
|
||||
fprintf(stderr, "\nEncoder error = %X\n", (unsigned)result);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -537,11 +531,18 @@ int main2(int numArgs, const char *args[])
|
||||
for (int i = 0; i < 8; i++)
|
||||
fileSize |= ((UInt64)header[kPropertiesSize + i]) << (8 * i);
|
||||
|
||||
if (decoder->Code(inStream, outStream, 0, (fileSize == (UInt64)(Int64)-1) ? 0 : &fileSize, 0) != S_OK)
|
||||
bool isSizeDefined = (fileSize != (UInt64)(Int64)-1);
|
||||
HRESULT res = decoder->Code(inStream, outStream, 0, isSizeDefined ? &fileSize : NULL, 0) != S_OK;
|
||||
if (res != S_OK)
|
||||
{
|
||||
PrintMessage("Decoder error");
|
||||
return 1;
|
||||
}
|
||||
if (isSizeDefined && decoderSpec->GetOutputProcessedSize() != fileSize)
|
||||
{
|
||||
PrintMessage("Error: incorrect uncompressed size in header");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
if (outStreamSpec != NULL)
|
||||
{
|
||||
|
||||
8
CPP/7zip/Bundles/LzmaCon/LzmaCon.dsp
Executable file → Normal file
8
CPP/7zip/Bundles/LzmaCon/LzmaCon.dsp
Executable file → Normal file
@@ -42,7 +42,7 @@ RSC=rc.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /Gr /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"StdAfx.h" /FD /c
|
||||
# ADD CPP /nologo /Gr /MD /W4 /WX /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"StdAfx.h" /FD /c
|
||||
# ADD BASE RSC /l 0x419 /d "NDEBUG"
|
||||
# ADD RSC /l 0x419 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
@@ -66,7 +66,7 @@ LINK32=link.exe
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W4 /WX /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"StdAfx.h" /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x419 /d "_DEBUG"
|
||||
# ADD RSC /l 0x419 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
@@ -180,6 +180,10 @@ SOURCE=..\..\..\Common\CRC.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\CrcReg.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Defs.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
0
CPP/7zip/Bundles/LzmaCon/LzmaCon.dsw
Executable file → Normal file
0
CPP/7zip/Bundles/LzmaCon/LzmaCon.dsw
Executable file → Normal file
0
CPP/7zip/Bundles/LzmaCon/StdAfx.cpp
Executable file → Normal file
0
CPP/7zip/Bundles/LzmaCon/StdAfx.cpp
Executable file → Normal file
2
CPP/7zip/Bundles/LzmaCon/StdAfx.h
Executable file → Normal file
2
CPP/7zip/Bundles/LzmaCon/StdAfx.h
Executable file → Normal file
@@ -3,6 +3,6 @@
|
||||
#ifndef __STDAFX_H
|
||||
#define __STDAFX_H
|
||||
|
||||
#include "../../../Common/MyWindows.h"
|
||||
#include "../../../Common/Common.h"
|
||||
|
||||
#endif
|
||||
|
||||
38
CPP/7zip/Bundles/LzmaCon/makefile
Executable file → Normal file
38
CPP/7zip/Bundles/LzmaCon/makefile
Executable file → Normal file
@@ -2,7 +2,7 @@ PROG = lzma.exe
|
||||
MY_CONSOLE = 1
|
||||
CFLAGS = $(CFLAGS)
|
||||
|
||||
LZMA_OBJS = \
|
||||
CURRENT_OBJS = \
|
||||
$O\LzmaAlone.obj \
|
||||
|
||||
COMPRESS_OBJS = \
|
||||
@@ -13,8 +13,10 @@ COMPRESS_OBJS = \
|
||||
COMMON_OBJS = \
|
||||
$O\CommandLineParser.obj \
|
||||
$O\CRC.obj \
|
||||
$O\CrcReg.obj \
|
||||
$O\IntToString.obj \
|
||||
$O\MyString.obj \
|
||||
$O\NewHandler.obj \
|
||||
$O\StringConvert.obj \
|
||||
$O\StringToInt.obj \
|
||||
$O\MyVector.obj
|
||||
@@ -54,36 +56,4 @@ C_OBJS = \
|
||||
|
||||
!include "../../Crc.mak"
|
||||
|
||||
OBJS = \
|
||||
$O\StdAfx.obj \
|
||||
$(LZMA_OBJS) \
|
||||
$(COMPRESS_OBJS) \
|
||||
$(COMMON_OBJS) \
|
||||
$(WIN_OBJS) \
|
||||
$(7ZIP_COMMON_OBJS) \
|
||||
$(UI_COMMON_OBJS) \
|
||||
$(CONSOLE_OBJS) \
|
||||
$(C_OBJS) \
|
||||
$(ASM_OBJS) \
|
||||
|
||||
!include "../../../Build.mak"
|
||||
|
||||
|
||||
$(LZMA_OBJS): $(*B).cpp
|
||||
$(COMPL)
|
||||
$(COMPRESS_OBJS): ../../Compress/$(*B).cpp
|
||||
$(COMPL_O2)
|
||||
$(COMMON_OBJS): ../../../Common/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(WIN_OBJS): ../../../Windows/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(UI_COMMON_OBJS): ../../UI/Common/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(CONSOLE_OBJS): ../../UI/Console/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(C_OBJS): ../../../../C/$(*B).c
|
||||
$(COMPL_O2)
|
||||
|
||||
!include "../../Asm.mak"
|
||||
!include "../../7zip.mak"
|
||||
|
||||
4
CPP/7zip/Bundles/LzmaCon/makefile.gcc
Executable file → Normal file
4
CPP/7zip/Bundles/LzmaCon/makefile.gcc
Executable file → Normal file
@@ -35,6 +35,7 @@ OBJS = \
|
||||
$(FILE_IO).o \
|
||||
CommandLineParser.o \
|
||||
CRC.o \
|
||||
CrcReg.o \
|
||||
IntToString.o \
|
||||
MyString.o \
|
||||
MyVector.o \
|
||||
@@ -108,6 +109,9 @@ CommandLineParser.o: ../../../Common/CommandLineParser.cpp
|
||||
CRC.o: ../../../Common/CRC.cpp
|
||||
$(CXX) $(CFLAGS) ../../../Common/CRC.cpp
|
||||
|
||||
CrcReg.o: ../../../Common/CrcReg.cpp
|
||||
$(CXX) $(CFLAGS) ../../../Common/CrcReg.cpp
|
||||
|
||||
IntToString.o: ../../../Common/IntToString.cpp
|
||||
$(CXX) $(CFLAGS) ../../../Common/IntToString.cpp
|
||||
|
||||
|
||||
3
CPP/7zip/Bundles/LzmaCon/resource.rc
Normal file
3
CPP/7zip/Bundles/LzmaCon/resource.rc
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "../../MyVersionInfo.rc"
|
||||
|
||||
MY_VERSION_INFO_APP("LZMA", "lzma")
|
||||
Reference in New Issue
Block a user