This commit is contained in:
Igor Pavlov
2022-06-23 11:43:16 +01:00
committed by Kornel
parent c3529a41f5
commit ec44a8a070
1248 changed files with 15242 additions and 2443 deletions

0
CPP/7zip/Archive/Common/CoderMixer2.cpp Normal file → Executable file
View File

0
CPP/7zip/Archive/Common/CoderMixer2.h Normal file → Executable file
View File

0
CPP/7zip/Archive/Common/DummyOutStream.cpp Normal file → Executable file
View File

0
CPP/7zip/Archive/Common/DummyOutStream.h Normal file → Executable file
View File

0
CPP/7zip/Archive/Common/FindSignature.cpp Normal file → Executable file
View File

0
CPP/7zip/Archive/Common/FindSignature.h Normal file → Executable file
View File

77
CPP/7zip/Archive/Common/HandlerOut.cpp Normal file → Executable file
View File

@@ -240,34 +240,42 @@ void CSingleMethodProps::Init()
}
HRESULT CSingleMethodProps::SetProperty(const wchar_t *name2, const PROPVARIANT &value)
{
// processed = false;
UString name = name2;
name.MakeLower_Ascii();
if (name.IsEmpty())
return E_INVALIDARG;
if (name.IsPrefixedBy_Ascii_NoCase("x"))
{
UInt32 a = 9;
RINOK(ParsePropToUInt32(name.Ptr(1), value, a));
_level = a;
AddProp_Level(a);
// processed = true;
return S_OK;
}
{
HRESULT hres;
if (SetCommonProperty(name, value, hres))
{
// processed = true;
return S_OK;
}
}
RINOK(ParseMethodFromPROPVARIANT(name, value));
return S_OK;
}
HRESULT CSingleMethodProps::SetProperties(const wchar_t * const *names, const PROPVARIANT *values, UInt32 numProps)
{
Init();
for (UInt32 i = 0; i < numProps; i++)
{
UString name = names[i];
name.MakeLower_Ascii();
if (name.IsEmpty())
return E_INVALIDARG;
const PROPVARIANT &value = values[i];
if (name[0] == L'x')
{
UInt32 a = 9;
RINOK(ParsePropToUInt32(name.Ptr(1), value, a));
_level = a;
AddProp_Level(a);
continue;
}
{
HRESULT hres;
if (SetCommonProperty(name, value, hres))
{
RINOK(hres)
continue;
}
}
RINOK(ParseMethodFromPROPVARIANT(names[i], value));
RINOK(SetProperty(names[i], values[i]));
}
return S_OK;
@@ -275,4 +283,29 @@ HRESULT CSingleMethodProps::SetProperties(const wchar_t * const *names, const PR
#endif
static HRESULT PROPVARIANT_to_BoolPair(const PROPVARIANT &prop, CBoolPair &dest)
{
RINOK(PROPVARIANT_to_bool(prop, dest.Val));
dest.Def = true;
return S_OK;
}
HRESULT CHandlerTimeOptions::Parse(const UString &name, const PROPVARIANT &prop, bool &processed)
{
processed = true;
if (name.IsEqualTo_Ascii_NoCase("tm")) { return PROPVARIANT_to_BoolPair(prop, Write_MTime); }
if (name.IsEqualTo_Ascii_NoCase("ta")) { return PROPVARIANT_to_BoolPair(prop, Write_ATime); }
if (name.IsEqualTo_Ascii_NoCase("tc")) { return PROPVARIANT_to_BoolPair(prop, Write_CTime); }
if (name.IsPrefixedBy_Ascii_NoCase("tp"))
{
UInt32 v = 0;
RINOK(ParsePropToUInt32(name.Ptr(2), prop, v));
Prec = v;
return S_OK;
}
processed = false;
return S_OK;
}
}

26
CPP/7zip/Archive/Common/HandlerOut.h Normal file → Executable file
View File

@@ -16,6 +16,7 @@ class CCommonMethodProps
protected:
void InitCommon()
{
// _Write_MTime = true;
#ifndef _7ZIP_ST
_numProcessors = _numThreads = NWindows::NSystem::GetNumberOfProcessors();
_numThreads_WasForced = false;
@@ -118,11 +119,36 @@ public:
CSingleMethodProps() { InitSingle(); }
int GetLevel() const { return _level == (UInt32)(Int32)-1 ? 5 : (int)_level; }
HRESULT SetProperty(const wchar_t *name, const PROPVARIANT &values);
HRESULT SetProperties(const wchar_t * const *names, const PROPVARIANT *values, UInt32 numProps);
};
#endif
struct CHandlerTimeOptions
{
CBoolPair Write_MTime;
CBoolPair Write_ATime;
CBoolPair Write_CTime;
UInt32 Prec;
void Init()
{
Write_MTime.Init();
Write_MTime.Val = true;
Write_ATime.Init();
Write_CTime.Init();
Prec = (UInt32)(Int32)-1;
}
CHandlerTimeOptions()
{
Init();
}
HRESULT Parse(const UString &name, const PROPVARIANT &prop, bool &processed);
};
}
#endif

0
CPP/7zip/Archive/Common/InStreamWithCRC.cpp Normal file → Executable file
View File

0
CPP/7zip/Archive/Common/InStreamWithCRC.h Normal file → Executable file
View File

23
CPP/7zip/Archive/Common/ItemNameUtils.cpp Normal file → Executable file
View File

@@ -79,6 +79,29 @@ void ReplaceToOsSlashes_Remove_TailSlash(UString &name, bool
}
void NormalizeSlashes_in_FileName_for_OsPath(wchar_t *name, unsigned len)
{
for (unsigned i = 0; i < len; i++)
{
wchar_t c = name[i];
if (c == L'/')
c = L'_';
#if WCHAR_PATH_SEPARATOR != L'/'
else if (c == L'\\')
c = WCHAR_IN_FILE_NAME_BACKSLASH_REPLACEMENT; // WSL scheme
#endif
else
continue;
name[i] = c;
}
}
void NormalizeSlashes_in_FileName_for_OsPath(UString &name)
{
NormalizeSlashes_in_FileName_for_OsPath(name.GetBuf(), name.Len());
}
bool HasTailSlash(const AString &name, UINT
#if defined(_WIN32) && !defined(UNDER_CE)
codePage

2
CPP/7zip/Archive/Common/ItemNameUtils.h Normal file → Executable file
View File

@@ -14,6 +14,8 @@ UString GetOsPath(const UString &name);
UString GetOsPath_Remove_TailSlash(const UString &name);
void ReplaceToOsSlashes_Remove_TailSlash(UString &name, bool useBackslashReplacement = false);
void NormalizeSlashes_in_FileName_for_OsPath(wchar_t *s, unsigned len);
void NormalizeSlashes_in_FileName_for_OsPath(UString &name);
bool HasTailSlash(const AString &name, UINT codePage);

0
CPP/7zip/Archive/Common/MultiStream.cpp Normal file → Executable file
View File

0
CPP/7zip/Archive/Common/MultiStream.h Normal file → Executable file
View File

0
CPP/7zip/Archive/Common/OutStreamWithCRC.cpp Normal file → Executable file
View File

0
CPP/7zip/Archive/Common/OutStreamWithCRC.h Normal file → Executable file
View File

0
CPP/7zip/Archive/Common/OutStreamWithSha1.cpp Normal file → Executable file
View File

0
CPP/7zip/Archive/Common/OutStreamWithSha1.h Normal file → Executable file
View File

0
CPP/7zip/Archive/Common/ParseProperties.cpp Normal file → Executable file
View File

0
CPP/7zip/Archive/Common/ParseProperties.h Normal file → Executable file
View File

0
CPP/7zip/Archive/Common/StdAfx.h Normal file → Executable file
View File