Use corret name for length variable

This commit is contained in:
Don HO 2018-06-26 13:50:33 +02:00
parent 6326115662
commit ef13902206
1 changed files with 14 additions and 13 deletions

View File

@ -342,28 +342,29 @@ generic_string Buffer::getFileTime(fileTimeType ftt) const
FILETIME rawtime; FILETIME rawtime;
switch (ftt) switch (ftt)
{ {
case ft_created: case ft_created:
rawtime = attributes.ftCreationTime; rawtime = attributes.ftCreationTime;
break; break;
case ft_modified: case ft_modified:
rawtime = attributes.ftLastWriteTime; rawtime = attributes.ftLastWriteTime;
break; break;
default: default:
rawtime = attributes.ftLastAccessTime; rawtime = attributes.ftLastAccessTime;
break; break;
} }
SYSTEMTIME utcSystemTime, localSystemTime; SYSTEMTIME utcSystemTime, localSystemTime;
FileTimeToSystemTime(&rawtime, &utcSystemTime); FileTimeToSystemTime(&rawtime, &utcSystemTime);
SystemTimeToTzSpecificLocalTime(nullptr, &utcSystemTime, &localSystemTime); SystemTimeToTzSpecificLocalTime(nullptr, &utcSystemTime, &localSystemTime);
TCHAR bufDate[MAX_PATH]; const size_t dateTimeStrLen = 256;
GetDateFormat(LOCALE_USER_DEFAULT, 0, &localSystemTime, nullptr, bufDate, MAX_PATH); TCHAR bufDate[dateTimeStrLen] = {'\0'};
GetDateFormat(LOCALE_USER_DEFAULT, 0, &localSystemTime, nullptr, bufDate, dateTimeStrLen);
result += bufDate; result += bufDate;
result += ' '; result += ' ';
TCHAR bufTime[MAX_PATH]; TCHAR bufTime[dateTimeStrLen] = {'\0'};
GetTimeFormat(LOCALE_USER_DEFAULT, 0, &localSystemTime, nullptr, bufTime, MAX_PATH); GetTimeFormat(LOCALE_USER_DEFAULT, 0, &localSystemTime, nullptr, bufTime, dateTimeStrLen);
result += bufTime; result += bufTime;
} }
} }