From 93851270526e71407b4225a23daa66214a4010f9 Mon Sep 17 00:00:00 2001 From: emekoi Date: Tue, 27 Nov 2018 01:39:37 -0600 Subject: [PATCH] changed pointer types --- std/mutex.zig | 7 ++++--- std/os/windows/kernel32.zig | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/std/mutex.zig b/std/mutex.zig index 45336f353e..3469b9a118 100644 --- a/std/mutex.zig +++ b/std/mutex.zig @@ -82,9 +82,9 @@ pub const Mutex = switch(builtin.os) { }; } - extern fn initCriticalSection(InitOnce: *windows.PINIT_ONCE, Parameter: ?windows.PVOID, Context: ?*windows.PVOID) windows.BOOL { + extern fn initCriticalSection(InitOnce: *windows.PINIT_ONCE, Parameter: ?windows.PVOID, Context: ?windows.PVOID) windows.BOOL { if (Context) |ctx| { - var mutex = @ptrCast(*?windows.CRITICAL_SECTION, ctx); + var mutex = @ptrCast(*?windows.CRITICAL_SECTION, @alignCast(8, ctx)); if (mutex.* == null) { var lock: windows.CRITICAL_SECTION = undefined; windows.InitializeCriticalSection(&lock); @@ -105,7 +105,8 @@ pub const Mutex = switch(builtin.os) { if (self.lock) |*lock| { windows.EnterCriticalSection(lock); } else { - if (windows.InitOnceExecuteOnce(&self.init_once, initCriticalSection, null, @ptrCast(?*windows.PVOID, self)) == windows.TRUE) { + var mutex = @ptrCast(?windows.PVOID, self); + if (windows.InitOnceExecuteOnce(&self.init_once, initCriticalSection, null, mutex) == windows.TRUE) { windows.EnterCriticalSection(&self.lock.?); } else { @panic("unable to initialize Mutex"); diff --git a/std/os/windows/kernel32.zig b/std/os/windows/kernel32.zig index 07d6cd80a2..56e2163fb6 100644 --- a/std/os/windows/kernel32.zig +++ b/std/os/windows/kernel32.zig @@ -254,9 +254,9 @@ pub const RTL_CRITICAL_SECTION = extern struct { pub const CRITICAL_SECTION = RTL_CRITICAL_SECTION; -pub extern "kernel32" stdcallcc fn InitOnceExecuteOnce(InitOnce: *PINIT_ONCE, InitFn: PINIT_ONCE_FN, Context: ?PVOID, Parameter: ?*LPVOID) BOOL; +pub extern "kernel32" stdcallcc fn InitOnceExecuteOnce(InitOnce: *PINIT_ONCE, InitFn: PINIT_ONCE_FN, Context: ?PVOID, Parameter: ?LPVOID) BOOL; -pub const PINIT_ONCE_FN = ?extern fn(InitOnce: *PINIT_ONCE, Parameter: ?PVOID, Context: ?*PVOID) BOOL; +pub const PINIT_ONCE_FN = ?extern fn(InitOnce: *PINIT_ONCE, Parameter: ?PVOID, Context: ?PVOID) BOOL; pub const RTL_RUN_ONCE = extern struct { Ptr: PVOID,