Update to 7-Zip 17.00 Beta

This commit is contained in:
Tino Reichardt
2017-04-30 14:14:14 +02:00
parent 54389d6e2f
commit aa5ba75da0
451 changed files with 15746 additions and 8574 deletions

View File

@@ -37,6 +37,7 @@ namespace NMacho {
#define CPU_TYPE_PPC64 (CPU_ARCH_ABI64 | CPU_TYPE_PPC)
#define CPU_TYPE_AMD64 (CPU_ARCH_ABI64 | CPU_TYPE_386)
#define CPU_TYPE_ARM64 (CPU_ARCH_ABI64 | CPU_TYPE_ARM)
#define CPU_SUBTYPE_LIB64 (1 << 31)
@@ -60,6 +61,8 @@ static const char * const k_PowerPc_SubTypes[] =
static const CUInt32PCharPair g_CpuPairs[] =
{
{ CPU_TYPE_AMD64, "x64" },
{ CPU_TYPE_ARM64, "ARM64" },
{ CPU_TYPE_386, "x86" },
{ CPU_TYPE_ARM, "ARM" },
{ CPU_TYPE_SPARC, "SPARC" },
@@ -168,7 +171,7 @@ static const CUInt32PCharPair g_Flags[] =
{ 8, "LOC_RELOC" }
};
static const int kNameSize = 16;
static const unsigned kNameSize = 16;
struct CSegment
{
@@ -255,16 +258,16 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
AString s;
char temp[16];
UInt32 cpu = _cpuType & ~(UInt32)CPU_ARCH_ABI64;
if (_cpuType == CPU_TYPE_AMD64)
s = "x64";
else
UInt32 flag64 = _cpuType & (UInt32)CPU_ARCH_ABI64;
{
const char *n = NULL;
for (unsigned i = 0; i < ARRAY_SIZE(g_CpuPairs); i++)
{
const CUInt32PCharPair &pair = g_CpuPairs[i];
if (pair.Value == cpu)
if (pair.Value == cpu || pair.Value == _cpuType)
{
if (pair.Value == _cpuType)
flag64 = 0;
n = pair.Name;
break;
}
@@ -276,10 +279,10 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
}
s = n;
if (_cpuType & CPU_ARCH_ABI64)
if (flag64 != 0)
s += " 64-bit";
else if (_cpuSubType & CPU_SUBTYPE_LIB64)
s += " 64-bit lib";
else if ((_cpuSubType & CPU_SUBTYPE_LIB64) && _cpuType != CPU_TYPE_AMD64)
s += " 64-bit-lib";
}
UInt32 t = _cpuSubType & ~(UInt32)CPU_SUBTYPE_LIB64;
if (t != 0 && (t != CPU_SUBTYPE_I386_ALL || cpu != CPU_TYPE_386))
@@ -306,8 +309,8 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value)
case kpidCharacts:
{
// TYPE_TO_PROP(g_FileTypes, _type, prop); break;
AString res = TypeToString(g_FileTypes, ARRAY_SIZE(g_FileTypes), _type);
AString s = FlagsToString(g_ArcFlags, ARRAY_SIZE(g_ArcFlags), _flags);
AString res (TypeToString(g_FileTypes, ARRAY_SIZE(g_FileTypes), _type));
AString s (FlagsToString(g_ArcFlags, ARRAY_SIZE(g_ArcFlags), _flags));
if (!s.IsEmpty())
{
res.Add_Space();
@@ -345,20 +348,9 @@ static AString GetName(const char *name)
char res[kNameSize + 1];
memcpy(res, name, kNameSize);
res[kNameSize] = 0;
return res;
return (AString)res;
}
static AString SectFlagsToString(UInt32 flags)
{
AString res = TypeToString(g_SectTypes, ARRAY_SIZE(g_SectTypes), flags & SECT_TYPE_MASK);
AString s = FlagsToString(g_Flags, ARRAY_SIZE(g_Flags), flags & SECT_ATTR_MASK);
if (!s.IsEmpty())
{
res.Add_Space();
res += s;
}
return res;
}
STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *value)
{
@@ -369,7 +361,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
{
case kpidPath:
{
AString s = GetName(_segments[item.SegmentIndex].Name);
AString s (GetName(_segments[item.SegmentIndex].Name));
if (!item.IsDummy)
s += GetName(item.Name);
prop = MultiByteToUnicodeString(s);
@@ -377,7 +369,19 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
}
case kpidSize: /* prop = (UInt64)item.VSize; break; */
case kpidPackSize: prop = (UInt64)item.GetPackSize(); break;
case kpidCharacts: if (!item.IsDummy) prop = SectFlagsToString(item.Flags); break;
case kpidCharacts:
if (!item.IsDummy)
{
AString res (TypeToString(g_SectTypes, ARRAY_SIZE(g_SectTypes), item.Flags & SECT_TYPE_MASK));
AString s (FlagsToString(g_Flags, ARRAY_SIZE(g_Flags), item.Flags & SECT_ATTR_MASK));
if (!s.IsEmpty())
{
res.Add_Space();
res += s;
}
prop = res;
}
break;
case kpidOffset: prop = item.Pa; break;
case kpidVa: prop = item.Va; break;
}
@@ -386,6 +390,7 @@ STDMETHODIMP CHandler::GetProperty(UInt32 index, PROPID propID, PROPVARIANT *val
COM_TRY_END
}
HRESULT CHandler::Open2(ISequentialInStream *stream)
{
const UInt32 kStartHeaderSize = 7 * 4;
@@ -402,6 +407,9 @@ HRESULT CHandler::Open2(ISequentialInStream *stream)
default: return S_FALSE;
}
_mode64 = mode64;
_be = be;
UInt32 numCommands = Get32(header + 0x10, be);
UInt32 commandsSize = Get32(header + 0x14, be);