Use automatic variable with static size instead of dynamical allocation
This commit is contained in:
parent
a9d203a60a
commit
6326115662
|
@ -357,25 +357,14 @@ generic_string Buffer::getFileTime(fileTimeType ftt) const
|
||||||
FileTimeToSystemTime(&rawtime, &utcSystemTime);
|
FileTimeToSystemTime(&rawtime, &utcSystemTime);
|
||||||
SystemTimeToTzSpecificLocalTime(nullptr, &utcSystemTime, &localSystemTime);
|
SystemTimeToTzSpecificLocalTime(nullptr, &utcSystemTime, &localSystemTime);
|
||||||
|
|
||||||
int cbSize = GetDateFormat(LOCALE_USER_DEFAULT, 0, &localSystemTime, nullptr, nullptr, 0);
|
TCHAR bufDate[MAX_PATH];
|
||||||
if (cbSize != 0)
|
GetDateFormat(LOCALE_USER_DEFAULT, 0, &localSystemTime, nullptr, bufDate, MAX_PATH);
|
||||||
{
|
result += bufDate;
|
||||||
TCHAR* buf = new TCHAR[cbSize];
|
|
||||||
GetDateFormat(LOCALE_USER_DEFAULT, 0, &localSystemTime, nullptr, buf, cbSize);
|
|
||||||
result += buf;
|
|
||||||
delete[] buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
result += ' ';
|
result += ' ';
|
||||||
|
|
||||||
cbSize = GetTimeFormat(LOCALE_USER_DEFAULT, 0, &localSystemTime, nullptr, nullptr, 0);
|
TCHAR bufTime[MAX_PATH];
|
||||||
if (cbSize != 0)
|
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &localSystemTime, nullptr, bufTime, MAX_PATH);
|
||||||
{
|
result += bufTime;
|
||||||
TCHAR* buf = new TCHAR[cbSize];
|
|
||||||
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &localSystemTime, nullptr, buf, cbSize);
|
|
||||||
result += buf;
|
|
||||||
delete[] buf;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in New Issue