mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-13 12:11:38 -06:00
21.02
This commit is contained in:
@@ -33,23 +33,8 @@ struct CExtraSubBlock
|
||||
bool ExtractNtfsTime(unsigned index, FILETIME &ft) const;
|
||||
bool ExtractUnixTime(bool isCentral, unsigned index, UInt32 &res) const;
|
||||
bool ExtractUnixExtraTime(unsigned index, UInt32 &res) const;
|
||||
|
||||
bool ExtractIzUnicode(UInt32 crc, AString &name) const
|
||||
{
|
||||
unsigned size = (unsigned)Data.Size();
|
||||
if (size < 1 + 4)
|
||||
return false;
|
||||
const Byte *p = (const Byte *)Data;
|
||||
if (p[0] > 1)
|
||||
return false;
|
||||
if (crc != GetUi32(p + 1))
|
||||
return false;
|
||||
size -= 5;
|
||||
name.SetFrom_CalcLen((const char *)p + 5, size);
|
||||
if (size != name.Len())
|
||||
return false;
|
||||
return CheckUTF8(name, false);
|
||||
}
|
||||
|
||||
bool CheckIzUnicode(const AString &s) const;
|
||||
|
||||
void PrintInfo(AString &s) const;
|
||||
};
|
||||
@@ -202,8 +187,14 @@ struct CExtraBlock
|
||||
for (unsigned i = SubBlocks.Size(); i != 0;)
|
||||
{
|
||||
i--;
|
||||
if (SubBlocks[i].ID != NFileHeader::NExtraID::kWzAES)
|
||||
SubBlocks.Delete(i);
|
||||
switch (SubBlocks[i].ID)
|
||||
{
|
||||
case NFileHeader::NExtraID::kStrongEncrypt:
|
||||
case NFileHeader::NExtraID::kWzAES:
|
||||
break;
|
||||
default:
|
||||
SubBlocks.Delete(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -266,9 +257,9 @@ private:
|
||||
void SetFlag(unsigned bitMask, bool enable)
|
||||
{
|
||||
if (enable)
|
||||
Flags |= bitMask;
|
||||
Flags = (UInt16)(Flags | bitMask);
|
||||
else
|
||||
Flags &= ~bitMask;
|
||||
Flags = (UInt16)(Flags & ~bitMask);
|
||||
}
|
||||
|
||||
public:
|
||||
@@ -279,7 +270,12 @@ public:
|
||||
// void SetFlag_AltStream(bool isAltStream) { SetFlag(NFileHeader::NFlags::kAltStream, isAltStream); }
|
||||
void SetDescriptorMode(bool useDescriptor) { SetFlag(NFileHeader::NFlags::kDescriptorUsedMask, useDescriptor); }
|
||||
|
||||
UINT GetCodePage() const { return CP_OEMCP; }
|
||||
UINT GetCodePage() const
|
||||
{
|
||||
if (IsUtf8())
|
||||
return CP_UTF8;
|
||||
return CP_OEMCP;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -330,10 +326,19 @@ public:
|
||||
}
|
||||
return (Crc != 0 || !IsDir());
|
||||
}
|
||||
|
||||
bool Is_MadeBy_Unix() const
|
||||
{
|
||||
if (!FromCentral)
|
||||
return false;
|
||||
return (MadeByVersion.HostOS == NFileHeader::NHostOS::kUnix);
|
||||
}
|
||||
|
||||
UINT GetCodePage() const
|
||||
{
|
||||
// 18.06: now we use HostOS only from Central::MadeByVersion
|
||||
if (IsUtf8())
|
||||
return CP_UTF8;
|
||||
if (!FromCentral)
|
||||
return CP_OEMCP;
|
||||
Byte hostOS = MadeByVersion.HostOS;
|
||||
|
||||
Reference in New Issue
Block a user