Fix some GCC warnings on Windows.

This commit is contained in:
levlam 2021-09-01 19:26:18 +03:00
parent 438ae78e8a
commit bfd76964ea
3 changed files with 5 additions and 7 deletions

View File

@ -860,7 +860,7 @@ static void pbkdf2_impl(Slice password, Slice salt, int iteration_count, Mutable
LOG(FATAL) << "Failed to HMAC";
}
for (int i = 0; i < hash_size; i++) {
dest[i] ^= buf[i];
dest[i] = static_cast<unsigned char>(dest[i] ^ buf[i]);
}
}
}

View File

@ -38,10 +38,8 @@ class MemoryMapping::Impl {
int64 offset_;
};
#if !TD_WINDOWS
static Result<int64> get_page_size() {
#if TD_WINDOWS
return Status::Error("Unimplemented");
#else
static Result<int64> page_size = []() -> Result<int64> {
auto page_size = sysconf(_SC_PAGESIZE);
if (page_size < 0) {
@ -50,8 +48,8 @@ static Result<int64> get_page_size() {
return page_size;
}();
return page_size.clone();
#endif
}
#endif
Result<MemoryMapping> MemoryMapping::create_anonymous(const MemoryMapping::Options &options) {
return Status::Error("Unsupported yet");

View File

@ -230,7 +230,7 @@ Slice get_operating_system_version() {
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
auto handle = GetModuleHandle(L"ntdll.dll");
if (handle != nullptr) {
using RtlGetVersionPtr = LONG(WINAPI *)(PRTL_OSVERSIONINFOEXW);
using RtlGetVersionPtr = LONG(WINAPI *)(_Out_ PRTL_OSVERSIONINFOEXW);
RtlGetVersionPtr RtlGetVersion = reinterpret_cast<RtlGetVersionPtr>(GetProcAddress(handle, "RtlGetVersion"));
if (RtlGetVersion != nullptr) {
RTL_OSVERSIONINFOEXW os_version_info = {};
@ -240,7 +240,7 @@ Slice get_operating_system_version() {
auto minor = os_version_info.dwMinorVersion;
bool is_server = os_version_info.wProductType != VER_NT_WORKSTATION;
if (major == 10 && minor >= 0) {
if (major == 10) {
if (is_server) {
return os_version_info.dwBuildNumber >= 17623 ? "Windows Server 2019" : "Windows Server 2016";
}