This commit is contained in:
Igor Pavlov
2023-12-22 17:17:05 +00:00
committed by Kornel
parent ec44a8a070
commit a36c48cece
954 changed files with 42199 additions and 25482 deletions

View File

@@ -131,6 +131,8 @@ static const char * const kPropIdToName[] =
, "Group ID"
, "Device Major"
, "Device Minor"
, "Dev Major"
, "Dev Minor"
};
static const char kEmptyAttribChar = '.';
@@ -405,13 +407,13 @@ void CFieldPrinter::Init(const CFieldInfoInit *standardFieldTable, unsigned numI
for (k = 0; k < fii.PrefixSpacesWidth; k++)
LinesString.Add_Space();
for (k = 0; k < fii.Width; k++)
LinesString += '-';
LinesString.Add_Minus();
}
}
static void GetPropName(PROPID propID, const wchar_t *name, AString &nameA, UString &nameU)
{
if (propID < ARRAY_SIZE(kPropIdToName))
if (propID < Z7_ARRAY_SIZE(kPropIdToName))
{
nameA = kPropIdToName[propID];
return;
@@ -455,13 +457,13 @@ void CFieldPrinter::AddProp(const wchar_t *name, PROPID propID, bool isRawProp)
HRESULT CFieldPrinter::AddMainProps(IInArchive *archive)
{
UInt32 numProps;
RINOK(archive->GetNumberOfProperties(&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));
RINOK(archive->GetPropertyInfo(i, &name, &propID, &vt))
AddProp(name, propID, false);
}
return S_OK;
@@ -470,12 +472,12 @@ HRESULT CFieldPrinter::AddMainProps(IInArchive *archive)
HRESULT CFieldPrinter::AddRawProps(IArchiveGetRawProps *getRawProps)
{
UInt32 numProps;
RINOK(getRawProps->GetNumRawProps(&numProps));
RINOK(getRawProps->GetNumRawProps(&numProps))
for (UInt32 i = 0; i < numProps; i++)
{
CMyComBSTR name;
PROPID propID;
RINOK(getRawProps->GetRawPropInfo(i, &name, &propID));
RINOK(getRawProps->GetRawPropInfo(i, &name, &propID))
AddProp(name, propID, true);
}
return S_OK;
@@ -516,7 +518,7 @@ static void PrintTime(char *dest, const CListFileTimeDef &t, bool showNS)
ConvertUtcFileTimeToString2(t.FT, t.Ns100, dest, prec);
}
#ifndef _SFX
#ifndef Z7_SFX
static inline char GetHex(Byte value)
{
@@ -585,12 +587,12 @@ HRESULT CFieldPrinter::PrintItemInfo(UInt32 index, const CListStat &st)
if (f.IsRawProp)
{
#ifndef _SFX
#ifndef Z7_SFX
const void *data;
UInt32 dataSize;
UInt32 propType;
RINOK(Arc->GetRawProps->GetRawProp(index, f.PropID, &data, &dataSize, &propType));
RINOK(Arc->GetRawProps->GetRawProp(index, f.PropID, &data, &dataSize, &propType))
if (dataSize != 0)
{
@@ -600,7 +602,7 @@ HRESULT CFieldPrinter::PrintItemInfo(UInt32 index, const CListStat &st)
{
if (propType != NPropDataType::kRaw)
return E_FAIL;
#ifndef _SFX
#ifndef Z7_SFX
ConvertNtSecureToString((const Byte *)data, dataSize, TempAString);
g_StdOut << TempAString;
needPrint = false;
@@ -654,7 +656,7 @@ HRESULT CFieldPrinter::PrintItemInfo(UInt32 index, const CListStat &st)
break;
}
default:
RINOK(Arc->Archive->GetProperty(index, f.PropID, &prop));
RINOK(Arc->Archive->GetProperty(index, f.PropID, &prop))
}
if (f.PropID == kpidAttrib && (prop.vt == VT_EMPTY || prop.vt == VT_UI4))
{
@@ -786,7 +788,7 @@ static HRESULT GetUInt64Value(IInArchive *archive, UInt32 index, PROPID propID,
value.Val = 0;
value.Def = false;
CPropVariant prop;
RINOK(archive->GetProperty(index, propID, &prop));
RINOK(archive->GetProperty(index, propID, &prop))
value.Def = ConvertPropVariantToUInt64(prop, value.Val);
return S_OK;
}
@@ -798,7 +800,7 @@ static HRESULT GetItemMTime(IInArchive *archive, UInt32 index, CListFileTimeDef
t.Clear();
// t.Def = false;
CPropVariant prop;
RINOK(archive->GetProperty(index, kpidMTime, &prop));
RINOK(archive->GetProperty(index, kpidMTime, &prop))
if (prop.vt == VT_FILETIME)
t.Set_From_Prop(prop);
else if (prop.vt != VT_EMPTY)
@@ -815,7 +817,7 @@ static void PrintPropName_and_Eq(CStdOutStream &so, PROPID propID)
{
const char *s;
char temp[16];
if (propID < ARRAY_SIZE(kPropIdToName))
if (propID < Z7_ARRAY_SIZE(kPropIdToName))
s = kPropIdToName[propID];
else
{
@@ -868,7 +870,7 @@ static void PrintPropVal_MultiLine(CStdOutStream &so, const wchar_t *val)
so << "{";
so << endl;
UString_Replace_CRLF_to_LF(s);
so.Normalize_UString__LF_Allowed(s);
so.Normalize_UString_LF_Allowed(s);
so << s;
so << endl;
so << "}";
@@ -919,7 +921,7 @@ static void PrintPropertyPair2(CStdOutStream &so, PROPID propID, const wchar_t *
static HRESULT PrintArcProp(CStdOutStream &so, IInArchive *archive, PROPID propID, const wchar_t *name)
{
CPropVariant prop;
RINOK(archive->GetArchiveProperty(propID, &prop));
RINOK(archive->GetArchiveProperty(propID, &prop))
PrintPropertyPair2(so, propID, name, prop);
return S_OK;
}
@@ -973,20 +975,20 @@ HRESULT Print_OpenArchive_Props(CStdOutStream &so, const CCodecs *codecs, const
if (offset != 0)
PrintPropNameAndNumber_Signed(so, kpidOffset, offset);
IInArchive *archive = arc.Archive;
RINOK(PrintArcProp(so, archive, kpidPhySize, NULL));
RINOK(PrintArcProp(so, archive, kpidPhySize, NULL))
if (er.TailSize != 0)
PrintPropNameAndNumber(so, kpidTailSize, er.TailSize);
{
UInt32 numProps;
RINOK(archive->GetNumberOfArchiveProperties(&numProps));
RINOK(archive->GetNumberOfArchiveProperties(&numProps))
for (UInt32 j = 0; j < numProps; j++)
{
CMyComBSTR name;
PROPID propID;
VARTYPE vt;
RINOK(archive->GetArchivePropertyInfo(j, &name, &propID, &vt));
RINOK(PrintArcProp(so, archive, propID, name));
RINOK(archive->GetArchivePropertyInfo(j, &name, &propID, &vt))
RINOK(PrintArcProp(so, archive, propID, name))
}
}
@@ -1002,9 +1004,9 @@ HRESULT Print_OpenArchive_Props(CStdOutStream &so, const CCodecs *codecs, const
CMyComBSTR name;
PROPID propID;
VARTYPE vt;
RINOK(archive->GetPropertyInfo(j, &name, &propID, &vt));
RINOK(archive->GetPropertyInfo(j, &name, &propID, &vt))
CPropVariant prop;
RINOK(archive->GetProperty(mainIndex, propID, &prop));
RINOK(archive->GetProperty(mainIndex, propID, &prop))
PrintPropertyPair2(so, propID, name, prop);
}
}
@@ -1016,7 +1018,7 @@ HRESULT Print_OpenArchive_Props(CStdOutStream &so, const CCodecs *codecs, const
HRESULT Print_OpenArchive_Error(CStdOutStream &so, const CCodecs *codecs, const CArchiveLink &arcLink);
HRESULT Print_OpenArchive_Error(CStdOutStream &so, const CCodecs *codecs, const CArchiveLink &arcLink)
{
#ifndef _NO_CRYPTO
#ifndef Z7_NO_CRYPTO
if (arcLink.PasswordWasAsked)
so << "Cannot open encrypted archive. Wrong password?";
else
@@ -1051,10 +1053,10 @@ HRESULT ListArchives(
bool processAltStreams, bool showAltStreams,
const NWildcard::CCensorNode &wildcardCensor,
bool enableHeaders, bool techMode,
#ifndef _NO_CRYPTO
#ifndef Z7_NO_CRYPTO
bool &passwordEnabled, UString &password,
#endif
#ifndef _SFX
#ifndef Z7_SFX
const CObjectVector<CProperty> *props,
#endif
UInt64 &numErrors,
@@ -1067,7 +1069,7 @@ HRESULT ListArchives(
CFieldPrinter fp;
if (!techMode)
fp.Init(kStandardFieldTable, ARRAY_SIZE(kStandardFieldTable));
fp.Init(kStandardFieldTable, Z7_ARRAY_SIZE(kStandardFieldTable));
CListStat2 stat2total;
@@ -1128,7 +1130,7 @@ HRESULT ListArchives(
COpenCallbackConsole openCallback;
openCallback.Init(&g_StdOut, g_ErrStream, NULL);
#ifndef _NO_CRYPTO
#ifndef Z7_NO_CRYPTO
openCallback.PasswordIsDefined = passwordEnabled;
openCallback.Password = password;
@@ -1142,7 +1144,7 @@ HRESULT ListArchives(
*/
COpenOptions options;
#ifndef _SFX
#ifndef Z7_SFX
options.props = props;
#endif
options.codecs = codecs;
@@ -1229,7 +1231,7 @@ HRESULT ListArchives(
if (enableHeaders)
{
RINOK(Print_OpenArchive_Props(g_StdOut, codecs, arcLink));
RINOK(Print_OpenArchive_Props(g_StdOut, codecs, arcLink))
g_StdOut << endl;
if (techMode)
@@ -1251,17 +1253,17 @@ HRESULT ListArchives(
if (techMode)
{
fp.Clear();
RINOK(fp.AddMainProps(archive));
RINOK(fp.AddMainProps(archive))
if (arc.GetRawProps)
{
RINOK(fp.AddRawProps(arc.GetRawProps));
RINOK(fp.AddRawProps(arc.GetRawProps))
}
}
CListStat2 stat2;
UInt32 numItems;
RINOK(archive->GetNumberOfItems(&numItems));
RINOK(archive->GetNumberOfItems(&numItems))
CReadArcItem item;
UStringVector pathParts;
@@ -1275,12 +1277,12 @@ HRESULT ListArchives(
if (stdInMode && res == E_INVALIDARG)
break;
RINOK(res);
RINOK(res)
if (arc.Ask_Aux)
{
bool isAux;
RINOK(Archive_IsItem_Aux(archive, i, isAux));
RINOK(Archive_IsItem_Aux(archive, i, isAux))
if (isAux)
continue;
}
@@ -1288,12 +1290,12 @@ HRESULT ListArchives(
bool isAltStream = false;
if (arc.Ask_AltStream)
{
RINOK(Archive_IsItem_AltStream(archive, i, isAltStream));
RINOK(Archive_IsItem_AltStream(archive, i, isAltStream))
if (isAltStream && !processAltStreams)
continue;
}
RINOK(Archive_IsItem_Dir(archive, i, fp.IsDir));
RINOK(Archive_IsItem_Dir(archive, i, fp.IsDir))
if (fp.IsDir ? listOptions.ExcludeDirItems : listOptions.ExcludeFileItems)
continue;
@@ -1302,7 +1304,7 @@ HRESULT ListArchives(
{
if (isAltStream)
{
RINOK(arc.GetItem(i, item));
RINOK(arc.GetItem(i, item))
if (!CensorNode_CheckPath(wildcardCensor, item))
continue;
}
@@ -1319,9 +1321,9 @@ HRESULT ListArchives(
CListStat st;
RINOK(GetUInt64Value(archive, i, kpidSize, st.Size));
RINOK(GetUInt64Value(archive, i, kpidPackSize, st.PackSize));
RINOK(GetItemMTime(archive, i, st.MTime));
RINOK(GetUInt64Value(archive, i, kpidSize, st.Size))
RINOK(GetUInt64Value(archive, i, kpidPackSize, st.PackSize))
RINOK(GetItemMTime(archive, i, st.MTime))
if (fp.IsDir)
stat2.NumDirs++;
@@ -1331,7 +1333,7 @@ HRESULT ListArchives(
if (isAltStream && !showAltStreams)
continue;
RINOK(fp.PrintItemInfo(i, st));
RINOK(fp.PrintItemInfo(i, st))
}
UInt64 numStreams = stat2.GetNumStreams();