mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-06 15:14:59 -06:00
17.00
This commit is contained in:
@@ -8,27 +8,32 @@
|
||||
|
||||
using namespace NWindows;
|
||||
|
||||
static AString GetHex(UInt32 v)
|
||||
static void AddHex(AString &s, UInt32 v)
|
||||
{
|
||||
char sz[16];
|
||||
sz[0] = '0';
|
||||
sz[1] = 'x';
|
||||
ConvertUInt32ToHex(v, sz + 2);
|
||||
return sz;
|
||||
s += sz;
|
||||
}
|
||||
|
||||
|
||||
AString TypePairToString(const CUInt32PCharPair *pairs, unsigned num, UInt32 value)
|
||||
{
|
||||
AString s;
|
||||
char sz[16];
|
||||
const char *p = NULL;
|
||||
for (unsigned i = 0; i < num; i++)
|
||||
{
|
||||
const CUInt32PCharPair &p = pairs[i];
|
||||
if (p.Value == value)
|
||||
s = p.Name;
|
||||
const CUInt32PCharPair &pair = pairs[i];
|
||||
if (pair.Value == value)
|
||||
p = pair.Name;
|
||||
}
|
||||
if (s.IsEmpty())
|
||||
s = GetHex(value);
|
||||
return s;
|
||||
if (!p)
|
||||
{
|
||||
ConvertUInt32ToString(value, sz);
|
||||
p = sz;
|
||||
}
|
||||
return (AString)p;
|
||||
}
|
||||
|
||||
void PairToProp(const CUInt32PCharPair *pairs, unsigned num, UInt32 value, NCOM::CPropVariant &prop)
|
||||
@@ -39,14 +44,30 @@ void PairToProp(const CUInt32PCharPair *pairs, unsigned num, UInt32 value, NCOM:
|
||||
|
||||
AString TypeToString(const char * const table[], unsigned num, UInt32 value)
|
||||
{
|
||||
char sz[16];
|
||||
const char *p = NULL;
|
||||
if (value < num)
|
||||
return table[value];
|
||||
return GetHex(value);
|
||||
p = table[value];
|
||||
if (!p)
|
||||
{
|
||||
ConvertUInt32ToString(value, sz);
|
||||
p = sz;
|
||||
}
|
||||
return (AString)p;
|
||||
}
|
||||
|
||||
void TypeToProp(const char * const table[], unsigned num, UInt32 value, NCOM::CPropVariant &prop)
|
||||
void TypeToProp(const char * const table[], unsigned num, UInt32 value, NWindows::NCOM::CPropVariant &prop)
|
||||
{
|
||||
prop = TypeToString(table, num, value);
|
||||
char sz[16];
|
||||
const char *p = NULL;
|
||||
if (value < num)
|
||||
p = table[value];
|
||||
if (!p)
|
||||
{
|
||||
ConvertUInt32ToString(value, sz);
|
||||
p = sz;
|
||||
}
|
||||
prop = p;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,20 +80,17 @@ AString FlagsToString(const char * const *names, unsigned num, UInt32 flags)
|
||||
if ((flags & flag) != 0)
|
||||
{
|
||||
const char *name = names[i];
|
||||
if (name != 0 && name[0] != 0)
|
||||
if (name && name[0] != 0)
|
||||
{
|
||||
if (!s.IsEmpty())
|
||||
s += ' ';
|
||||
s += name;
|
||||
s.Add_OptSpaced(name);
|
||||
flags &= ~flag;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flags != 0)
|
||||
{
|
||||
if (!s.IsEmpty())
|
||||
s += ' ';
|
||||
s += GetHex(flags);
|
||||
s.Add_Space_if_NotEmpty();
|
||||
AddHex(s, flags);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
@@ -87,23 +105,23 @@ AString FlagsToString(const CUInt32PCharPair *pairs, unsigned num, UInt32 flags)
|
||||
if ((flags & flag) != 0)
|
||||
{
|
||||
if (p.Name[0] != 0)
|
||||
{
|
||||
if (!s.IsEmpty())
|
||||
s += ' ';
|
||||
s += p.Name;
|
||||
}
|
||||
s.Add_OptSpaced(p.Name);
|
||||
}
|
||||
flags &= ~flag;
|
||||
}
|
||||
if (flags != 0)
|
||||
{
|
||||
if (!s.IsEmpty())
|
||||
s += ' ';
|
||||
s += GetHex(flags);
|
||||
s.Add_Space_if_NotEmpty();
|
||||
AddHex(s, flags);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
void FlagsToProp(const char * const *names, unsigned num, UInt32 flags, NCOM::CPropVariant &prop)
|
||||
{
|
||||
prop = FlagsToString(names, num, flags);
|
||||
}
|
||||
|
||||
void FlagsToProp(const CUInt32PCharPair *pairs, unsigned num, UInt32 flags, NCOM::CPropVariant &prop)
|
||||
{
|
||||
prop = FlagsToString(pairs, num, flags);
|
||||
@@ -120,24 +138,18 @@ AString Flags64ToString(const CUInt32PCharPair *pairs, unsigned num, UInt64 flag
|
||||
if ((flags & flag) != 0)
|
||||
{
|
||||
if (p.Name[0] != 0)
|
||||
{
|
||||
if (!s.IsEmpty())
|
||||
s += ' ';
|
||||
s += p.Name;
|
||||
}
|
||||
s.Add_OptSpaced(p.Name);
|
||||
}
|
||||
flags &= ~flag;
|
||||
}
|
||||
if (flags != 0)
|
||||
{
|
||||
if (!s.IsEmpty())
|
||||
s += ' ';
|
||||
{
|
||||
char sz[32];
|
||||
sz[0] = '0';
|
||||
sz[1] = 'x';
|
||||
ConvertUInt64ToHex(flags, sz + 2);
|
||||
s += sz;
|
||||
s.Add_OptSpaced(sz);
|
||||
}
|
||||
}
|
||||
return s;
|
||||
|
||||
Reference in New Issue
Block a user