| ... | @@ -222,8 +222,8 @@ pub const File = extern struct { | ... | @@ -222,8 +222,8 @@ pub const File = extern struct { |
| 222 | self: *const File, | 222 | self: *const File, |
| 223 | comptime info: std.meta.Tag(Info), | 223 | comptime info: std.meta.Tag(Info), |
| 224 | buffer: ?[]u8, | 224 | buffer: ?[]u8, |
| 225 | ) GetInfoError!struct { usize, ?*std.meta.TagPayload(Info, info) } { | 225 | ) GetInfoError!struct { usize, @FieldType(Info, @tagName(info)) } { |
| 226 | const InfoType = std.meta.TagPayload(Info, info); | 226 | const InfoType = @FieldType(Info, @tagName(info)); |
| 227 | | 227 | |
| 228 | var len = if (buffer) |b| b.len else 0; | 228 | var len = if (buffer) |b| b.len else 0; |
| 229 | switch (self._get_info( | 229 | switch (self._get_info( |
| ... | @@ -245,17 +245,15 @@ pub const File = extern struct { | ... | @@ -245,17 +245,15 @@ pub const File = extern struct { |
| 245 | pub fn setInfo( | 245 | pub fn setInfo( |
| 246 | self: *File, | 246 | self: *File, |
| 247 | comptime info: std.meta.Tag(Info), | 247 | comptime info: std.meta.Tag(Info), |
| 248 | data: *const std.meta.TagPayload(Info, info), | 248 | data: *const @FieldType(Info, @tagName(info)), |
| 249 | ) SetInfoError!void { | 249 | ) SetInfoError!void { |
| 250 | const InfoType = std.meta.TagPayload(Info, info); | 250 | const InfoType = @FieldType(Info, @tagName(info)); |
| 251 | | 251 | |
| 252 | var attached_str_len: usize = 0; | | |
| 253 | const attached_str: [*:0]const u16 = switch (info) { | 252 | const attached_str: [*:0]const u16 = switch (info) { |
| 254 | .file => data.getFileName(), | 253 | .file => data.getFileName(), |
| 255 | inline .file_system, .volume_label => data.getVolumeLabel(), | 254 | inline .file_system, .volume_label => data.getVolumeLabel(), |
| 256 | }; | 255 | }; |
| 257 | | 256 | const attached_str_len = std.mem.sliceTo(attached_str, 0).len; |
| 258 | while (attached_str[attached_str_len] != 0) : (attached_str_len += 1) {} | | |
| 259 | | 257 | |
| 260 | // add the length (not +1 for sentinel) because `@sizeOf(InfoType)` | 258 | // add the length (not +1 for sentinel) because `@sizeOf(InfoType)` |
| 261 | // already contains the first utf16 char | 259 | // already contains the first utf16 char |