address windows compiler warnings
All checks were successful
BlockStorage/repertory_osx_builds/pipeline/head This commit looks good
BlockStorage/repertory_linux_builds/pipeline/head This commit looks good

This commit is contained in:
2023-12-12 14:48:52 -06:00
parent aafa7e112a
commit 63a6b3bdba
4 changed files with 26 additions and 24 deletions

View File

@@ -170,16 +170,16 @@ auto download_type_to_string(const download_type &type) -> std::string {
// https://www.frenk.com/2009/12/convert-filetime-to-unix-timestamp/
auto filetime_to_unix_time(const FILETIME &ft) -> remote::file_time {
LARGE_INTEGER date{};
date.HighPart = ft.dwHighDateTime;
date.HighPart = static_cast<LONG>(ft.dwHighDateTime);
date.LowPart = ft.dwLowDateTime;
date.QuadPart -= 116444736000000000ULL;
date.QuadPart -= 116444736000000000LL;
return date.QuadPart * 100ULL;
return static_cast<remote::file_time>(date.QuadPart) * 100ULL;
}
void unix_time_to_filetime(const remote::file_time &ts, FILETIME &ft) {
const auto win_time = (ts / 100ULL) + 116444736000000000ULL;
ft.dwHighDateTime = win_time >> 32U;
ft.dwHighDateTime = static_cast<DWORD>(win_time >> 32U);
ft.dwLowDateTime = win_time & 0xFFFFFFFF;
}
#endif
@@ -216,7 +216,8 @@ auto get_file_time_now() -> std::uint64_t {
::GetSystemTime(&st);
FILETIME ft{};
::SystemTimeToFileTime(&st, &ft);
return static_cast<std::uint64_t>(((LARGE_INTEGER *)&ft)->QuadPart);
return static_cast<std::uint64_t>(
(reinterpret_cast<LARGE_INTEGER *>(&ft))->QuadPart);
#else
return get_time_now();
#endif