diff options
| author | Jonathan Marler <johnnymarler@gmail.com> | 2022-01-24 00:52:25 -0700 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-01-24 17:35:15 +0200 |
| commit | 2fc2d88fc659f456e21d40a11e1d7bdcfa243f53 (patch) | |
| tree | 9b9ed1f130a26b9087bce6efa16385f83d6bd9e4 /lib/std/os | |
| parent | da8d4d922518300a8e041f59cf994f1f83ce1f48 (diff) | |
| download | zig-2fc2d88fc659f456e21d40a11e1d7bdcfa243f53.tar.gz zig-2fc2d88fc659f456e21d40a11e1d7bdcfa243f53.zip | |
use explicit integer bit widths for windows GUID
The size of a GUID is not platform-dependent, it's always a fixed number of bits. So I've updated guid to use fixed bit integer types rather than platform-dependent C integer types.
Diffstat (limited to 'lib/std/os')
| -rw-r--r-- | lib/std/os/windows.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig index 7642fa80f8..4ddba2f72a 100644 --- a/lib/std/os/windows.zig +++ b/lib/std/os/windows.zig @@ -2733,9 +2733,9 @@ pub const HRESULT = c_long; pub const KNOWNFOLDERID = GUID; pub const GUID = extern struct { - Data1: c_ulong, - Data2: c_ushort, - Data3: c_ushort, + Data1: u32, + Data2: u16, + Data3: u16, Data4: [8]u8, pub fn parse(str: []const u8) GUID { @@ -2744,19 +2744,19 @@ pub const GUID = extern struct { assert(str[index] == '{'); index += 1; - guid.Data1 = std.fmt.parseUnsigned(c_ulong, str[index .. index + 8], 16) catch unreachable; + guid.Data1 = std.fmt.parseUnsigned(u32, str[index .. index + 8], 16) catch unreachable; index += 8; assert(str[index] == '-'); index += 1; - guid.Data2 = std.fmt.parseUnsigned(c_ushort, str[index .. index + 4], 16) catch unreachable; + guid.Data2 = std.fmt.parseUnsigned(u16, str[index .. index + 4], 16) catch unreachable; index += 4; assert(str[index] == '-'); index += 1; - guid.Data3 = std.fmt.parseUnsigned(c_ushort, str[index .. index + 4], 16) catch unreachable; + guid.Data3 = std.fmt.parseUnsigned(u16, str[index .. index + 4], 16) catch unreachable; index += 4; assert(str[index] == '-'); |
