authorgravatar for johnnymarler@gmail.comJonathan Marler <johnnymarler@gmail.com> 2022-01-24 00:52:25-07:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2022-01-24 17:35:15+02:00
log2fc2d88fc659f456e21d40a11e1d7bdcfa243f53
tree9b9ed1f130a26b9087bce6efa16385f83d6bd9e4
parentda8d4d922518300a8e041f59cf994f1f83ce1f48

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.

1 files changed, 6 insertions(+), 6 deletions(-)

lib/std/os/windows.zig+6-6
...@@ -2733,9 +2733,9 @@ pub const HRESULT = c_long;...@@ -2733,9 +2733,9 @@ pub const HRESULT = c_long;
27332733
2734pub const KNOWNFOLDERID = GUID;2734pub const KNOWNFOLDERID = GUID;
2735pub const GUID = extern struct {2735pub const GUID = extern struct {
2736 Data1: c_ulong,2736 Data1: u32,
2737 Data2: c_ushort,2737 Data2: u16,
2738 Data3: c_ushort,2738 Data3: u16,
2739 Data4: [8]u8,2739 Data4: [8]u8,
27402740
2741 pub fn parse(str: []const u8) GUID {2741 pub fn parse(str: []const u8) GUID {
...@@ -2744,19 +2744,19 @@ pub const GUID = extern struct {...@@ -2744,19 +2744,19 @@ pub const GUID = extern struct {
2744 assert(str[index] == '{');2744 assert(str[index] == '{');
2745 index += 1;2745 index += 1;
27462746
2747 guid.Data1 = std.fmt.parseUnsigned(c_ulong, str[index .. index + 8], 16) catch unreachable;2747 guid.Data1 = std.fmt.parseUnsigned(u32, str[index .. index + 8], 16) catch unreachable;
2748 index += 8;2748 index += 8;
27492749
2750 assert(str[index] == '-');2750 assert(str[index] == '-');
2751 index += 1;2751 index += 1;
27522752
2753 guid.Data2 = std.fmt.parseUnsigned(c_ushort, str[index .. index + 4], 16) catch unreachable;2753 guid.Data2 = std.fmt.parseUnsigned(u16, str[index .. index + 4], 16) catch unreachable;
2754 index += 4;2754 index += 4;
27552755
2756 assert(str[index] == '-');2756 assert(str[index] == '-');
2757 index += 1;2757 index += 1;
27582758
2759 guid.Data3 = std.fmt.parseUnsigned(c_ushort, str[index .. index + 4], 16) catch unreachable;2759 guid.Data3 = std.fmt.parseUnsigned(u16, str[index .. index + 4], 16) catch unreachable;
2760 index += 4;2760 index += 4;
27612761
2762 assert(str[index] == '-');2762 assert(str[index] == '-');