This commit is contained in:
Igor Pavlov
2017-08-29 20:49:43 +01:00
committed by Kornel
parent 2efa10565a
commit b5dc853b24
110 changed files with 4714 additions and 1700 deletions

View File

@@ -42,6 +42,14 @@ unsigned ParseStringToUInt32(const UString &srcString, UInt32 &number)
return (unsigned)(end - start);
}
static unsigned ParseStringToUInt64(const UString &srcString, UInt64 &number)
{
const wchar_t *start = srcString;
const wchar_t *end;
number = ConvertStringToUInt64(start, &end);
return (unsigned)(end - start);
}
HRESULT ParsePropToUInt32(const UString &name, const PROPVARIANT &prop, UInt32 &resValue)
{
// =VT_UI4
@@ -263,7 +271,11 @@ static const CNameToPropID g_NameToPropID[] =
{ VT_UI4, "mt" },
{ VT_BOOL, "eos" },
{ VT_UI4, "x" },
{ VT_UI4, "reduceSize" }
{ VT_UI8, "reduce" },
{ VT_UI8, "expect" },
{ VT_UI4, "b" },
{ VT_UI4, "check" },
{ VT_BSTR, "filter" }
};
static int FindPropIdExact(const UString &name)
@@ -345,7 +357,8 @@ static bool IsLogSizeProp(PROPID propid)
case NCoderPropID::kDictionarySize:
case NCoderPropID::kUsedMemorySize:
case NCoderPropID::kBlockSize:
case NCoderPropID::kReduceSize:
case NCoderPropID::kBlockSize2:
// case NCoderPropID::kReduceSize:
return true;
}
return false;
@@ -378,9 +391,22 @@ HRESULT CMethodProps::SetParam(const UString &name, const UString &value)
}
else if (!value.IsEmpty())
{
UInt32 number;
if (ParseStringToUInt32(value, number) == value.Len())
propValue = number;
if (nameToPropID.VarType == VT_UI4)
{
UInt32 number;
if (ParseStringToUInt32(value, number) == value.Len())
propValue = number;
else
propValue = value;
}
else if (nameToPropID.VarType == VT_UI8)
{
UInt64 number;
if (ParseStringToUInt64(value, number) == value.Len())
propValue = number;
else
propValue = value;
}
else
propValue = value;
}