mirror of
https://github.com/aaru-dps/Aaru.Compression.Native.git
synced 2025-12-16 19:24:31 +00:00
Update to lzma 23.01.
This commit is contained in:
68
3rdparty/lzma/CPP/Windows/PropVariantConv.cpp
vendored
68
3rdparty/lzma/CPP/Windows/PropVariantConv.cpp
vendored
@@ -9,7 +9,7 @@
|
||||
|
||||
#define UINT_TO_STR_2(c, val) { s[0] = (c); s[1] = (char)('0' + (val) / 10); s[2] = (char)('0' + (val) % 10); s += 3; }
|
||||
|
||||
bool ConvertUtcFileTimeToString(const FILETIME &utc, char *s, int level) throw()
|
||||
bool ConvertUtcFileTimeToString2(const FILETIME &utc, unsigned ns100, char *s, int level) throw()
|
||||
{
|
||||
*s = 0;
|
||||
FILETIME ft;
|
||||
@@ -18,7 +18,10 @@ bool ConvertUtcFileTimeToString(const FILETIME &utc, char *s, int level) throw()
|
||||
|
||||
SYSTEMTIME st;
|
||||
if (!BOOLToBool(FileTimeToSystemTime(&ft, &st)))
|
||||
{
|
||||
// win10 : that function doesn't work, if bit 63 of 64-bit FILETIME is set.
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
unsigned val = st.wYear;
|
||||
@@ -33,17 +36,17 @@ bool ConvertUtcFileTimeToString(const FILETIME &utc, char *s, int level) throw()
|
||||
s[0] = (char)('0' + val / 10);
|
||||
s += 4;
|
||||
}
|
||||
UINT_TO_STR_2('-', st.wMonth);
|
||||
UINT_TO_STR_2('-', st.wDay);
|
||||
UINT_TO_STR_2('-', st.wMonth)
|
||||
UINT_TO_STR_2('-', st.wDay)
|
||||
|
||||
if (level > kTimestampPrintLevel_DAY)
|
||||
{
|
||||
UINT_TO_STR_2(' ', st.wHour);
|
||||
UINT_TO_STR_2(':', st.wMinute);
|
||||
UINT_TO_STR_2(' ', st.wHour)
|
||||
UINT_TO_STR_2(':', st.wMinute)
|
||||
|
||||
if (level >= kTimestampPrintLevel_SEC)
|
||||
{
|
||||
UINT_TO_STR_2(':', st.wSecond);
|
||||
UINT_TO_STR_2(':', st.wSecond)
|
||||
|
||||
if (level > kTimestampPrintLevel_SEC)
|
||||
{
|
||||
@@ -71,6 +74,12 @@ bool ConvertUtcFileTimeToString(const FILETIME &utc, char *s, int level) throw()
|
||||
numDigits = (unsigned)level;
|
||||
s += numDigits;
|
||||
}
|
||||
if (level >= kTimestampPrintLevel_NTFS + 1)
|
||||
{
|
||||
*s++ = (char)('0' + (ns100 / 10));
|
||||
if (level >= kTimestampPrintLevel_NTFS + 2)
|
||||
*s++ = (char)('0' + (ns100 % 10));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,6 +89,25 @@ bool ConvertUtcFileTimeToString(const FILETIME &utc, char *s, int level) throw()
|
||||
}
|
||||
|
||||
|
||||
bool ConvertUtcFileTimeToString(const FILETIME &utc, char *s, int level) throw()
|
||||
{
|
||||
return ConvertUtcFileTimeToString2(utc, 0, s, level);
|
||||
}
|
||||
|
||||
bool ConvertUtcFileTimeToString2(const FILETIME &ft, unsigned ns100, wchar_t *dest, int level) throw()
|
||||
{
|
||||
char s[32];
|
||||
bool res = ConvertUtcFileTimeToString2(ft, ns100, s, level);
|
||||
for (unsigned i = 0;; i++)
|
||||
{
|
||||
Byte c = (Byte)s[i];
|
||||
dest[i] = c;
|
||||
if (c == 0)
|
||||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
bool ConvertUtcFileTimeToString(const FILETIME &ft, wchar_t *dest, int level) throw()
|
||||
{
|
||||
char s[32];
|
||||
@@ -106,7 +134,19 @@ void ConvertPropVariantToShortString(const PROPVARIANT &prop, char *dest) throw(
|
||||
case VT_UI2: ConvertUInt32ToString(prop.uiVal, dest); return;
|
||||
case VT_UI4: ConvertUInt32ToString(prop.ulVal, dest); return;
|
||||
case VT_UI8: ConvertUInt64ToString(prop.uhVal.QuadPart, dest); return;
|
||||
case VT_FILETIME: ConvertUtcFileTimeToString(prop.filetime, dest); return;
|
||||
case VT_FILETIME:
|
||||
{
|
||||
// const unsigned prec = prop.wReserved1;
|
||||
int level = 0;
|
||||
/*
|
||||
if (prec == 0)
|
||||
level = 7;
|
||||
else if (prec > 16 && prec <= 16 + 9)
|
||||
level = prec - 16;
|
||||
*/
|
||||
ConvertUtcFileTimeToString(prop.filetime, dest, level);
|
||||
return;
|
||||
}
|
||||
// case VT_I1: return ConvertInt64ToString(prop.cVal, dest); return;
|
||||
case VT_I2: ConvertInt64ToString(prop.iVal, dest); return;
|
||||
case VT_I4: ConvertInt64ToString(prop.lVal, dest); return;
|
||||
@@ -127,7 +167,19 @@ void ConvertPropVariantToShortString(const PROPVARIANT &prop, wchar_t *dest) thr
|
||||
case VT_UI2: ConvertUInt32ToString(prop.uiVal, dest); return;
|
||||
case VT_UI4: ConvertUInt32ToString(prop.ulVal, dest); return;
|
||||
case VT_UI8: ConvertUInt64ToString(prop.uhVal.QuadPart, dest); return;
|
||||
case VT_FILETIME: ConvertUtcFileTimeToString(prop.filetime, dest); return;
|
||||
case VT_FILETIME:
|
||||
{
|
||||
// const unsigned prec = prop.wReserved1;
|
||||
int level = 0;
|
||||
/*
|
||||
if (prec == 0)
|
||||
level = 7;
|
||||
else if (prec > 16 && prec <= 16 + 9)
|
||||
level = prec - 16;
|
||||
*/
|
||||
ConvertUtcFileTimeToString(prop.filetime, dest, level);
|
||||
return;
|
||||
}
|
||||
// case VT_I1: return ConvertInt64ToString(prop.cVal, dest); return;
|
||||
case VT_I2: ConvertInt64ToString(prop.iVal, dest); return;
|
||||
case VT_I4: ConvertInt64ToString(prop.lVal, dest); return;
|
||||
|
||||
Reference in New Issue
Block a user