From 0288034c2f2d158970cd481e1810a2301ab0b50a Mon Sep 17 00:00:00 2001 From: emekoi Date: Wed, 5 Jun 2019 15:30:01 -0500 Subject: [PATCH] fixed mismatched types --- CMakeLists.txt | 1 + std/os/windows.zig | 4 ++-- std/os/windows/kernel32.zig | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ff4cebf40..206e2ccf99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -630,6 +630,7 @@ set(ZIG_STD_FILES "os/windows/bits.zig" "os/windows/error.zig" "os/windows/kernel32.zig" + "os/windows/lang.zig" "os/windows/ntdll.zig" "os/windows/ole32.zig" "os/windows/shell32.zig" diff --git a/std/os/windows.zig b/std/os/windows.zig index 0757d9924f..4d5dda0142 100644 --- a/std/os/windows.zig +++ b/std/os/windows.zig @@ -756,7 +756,7 @@ pub fn sliceToPrefixedSuffixedFileW(s: []const u8, comptime suffix: []const u16) return result; } -inline fn MAKELANGID(p: USHORT, s: USHORT) LANGID { +inline fn MAKELANGID(p: c_ushort, s: c_ushort) LANGID { return (s << 10) | p; } @@ -765,7 +765,7 @@ inline fn MAKELANGID(p: USHORT, s: USHORT) LANGID { pub fn unexpectedError(err: DWORD) std.os.UnexpectedError { if (std.os.unexpected_error_tracing) { var buf: LPSTR = undefined; - const len = kernel32.FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, null, err, MAKELANGID(LANG.LANG_NEUTRAL, LANG.SUBLANG_DEFAULT), buf, 0, null); + const len = kernel32.FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, null, err, MAKELANGID(LANG.LANG_NEUTRAL, LANG.SUBLANG_DEFAULT), @ptrCast(LPSTR, &buf), 0, null); defer _ = kernel32.LocalFree(@ptrCast(HLOCAL, buf)); std.debug.warn("error.Unexpected: {}: {}\n", err, buf[0..len]); diff --git a/std/os/windows/kernel32.zig b/std/os/windows/kernel32.zig index bee1b82544..fb1cff00f7 100644 --- a/std/os/windows/kernel32.zig +++ b/std/os/windows/kernel32.zig @@ -50,7 +50,7 @@ pub extern "kernel32" stdcallcc fn FindFirstFileW(lpFileName: [*]const u16, lpFi pub extern "kernel32" stdcallcc fn FindClose(hFindFile: HANDLE) BOOL; pub extern "kernel32" stdcallcc fn FindNextFileW(hFindFile: HANDLE, lpFindFileData: *WIN32_FIND_DATAW) BOOL; -pub extern "kernel32" stdcallcc fn FormatMessageA(dwFlags: DWORD, lpSource: LPVOID, dwMessageId: DWORD, dwLanguageId: DWORD, lpBuffer: LPSTR, nSize: DWORD, Arguments: ?*va_list) DWORD; +pub extern "kernel32" stdcallcc fn FormatMessageA(dwFlags: DWORD, lpSource: ?LPVOID, dwMessageId: DWORD, dwLanguageId: DWORD, lpBuffer: LPSTR, nSize: DWORD, Arguments: ?*va_list) DWORD; pub extern "kernel32" stdcallcc fn FreeEnvironmentStringsW(penv: [*]u16) BOOL;