fix windows std lib regressions

This commit is contained in:
Andrew Kelley 2019-11-29 21:55:27 -05:00
parent 6936243ee1
commit d87b13f2f7
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
5 changed files with 13 additions and 13 deletions

View File

@ -61,7 +61,7 @@ pub const Coff = struct {
var magic: [2]u8 = undefined;
try in.readNoEof(magic[0..]);
if (!mem.eql(u8, magic, "MZ"))
if (!mem.eql(u8, &magic, "MZ"))
return error.InvalidPEMagic;
// Seek to PE File Header (coff header)
@ -71,7 +71,7 @@ pub const Coff = struct {
var pe_header_magic: [4]u8 = undefined;
try in.readNoEof(pe_header_magic[0..]);
if (!mem.eql(u8, pe_header_magic, [_]u8{ 'P', 'E', 0, 0 }))
if (!mem.eql(u8, &pe_header_magic, &[_]u8{ 'P', 'E', 0, 0 }))
return error.InvalidPEHeader;
self.coff_header = CoffHeader{
@ -163,7 +163,7 @@ pub const Coff = struct {
var cv_signature: [4]u8 = undefined; // CodeView signature
try in.readNoEof(cv_signature[0..]);
// 'RSDS' indicates PDB70 format, used by lld.
if (!mem.eql(u8, cv_signature, "RSDS"))
if (!mem.eql(u8, &cv_signature, "RSDS"))
return error.InvalidPEMagic;
try in.readNoEof(self.guid[0..]);
self.age = try in.readIntLittle(u32);

View File

@ -825,7 +825,7 @@ fn openSelfDebugInfoWindows(allocator: *mem.Allocator) !DebugInfo {
const len = try di.coff.getPdbPath(path_buf[0..]);
const raw_path = path_buf[0..len];
const path = try fs.path.resolve(allocator, [_][]const u8{raw_path});
const path = try fs.path.resolve(allocator, &[_][]const u8{raw_path});
try di.pdb.openFile(di.coff, path);
@ -834,10 +834,10 @@ fn openSelfDebugInfoWindows(allocator: *mem.Allocator) !DebugInfo {
const signature = try pdb_stream.stream.readIntLittle(u32);
const age = try pdb_stream.stream.readIntLittle(u32);
var guid: [16]u8 = undefined;
try pdb_stream.stream.readNoEof(guid[0..]);
try pdb_stream.stream.readNoEof(&guid);
if (version != 20000404) // VC70, only value observed by LLVM team
return error.UnknownPDBVersion;
if (!mem.eql(u8, di.coff.guid, guid) or di.coff.age != age)
if (!mem.eql(u8, &di.coff.guid, &guid) or di.coff.age != age)
return error.PDBMismatch;
// We validated the executable and pdb match.

View File

@ -1569,8 +1569,8 @@ pub fn isCygwinPty(handle: fd_t) bool {
const name_info = @ptrCast(*const windows.FILE_NAME_INFO, &name_info_bytes[0]);
const name_bytes = name_info_bytes[size .. size + @as(usize, name_info.FileNameLength)];
const name_wide = @bytesToSlice(u16, name_bytes);
return mem.indexOf(u16, name_wide, [_]u16{ 'm', 's', 'y', 's', '-' }) != null or
mem.indexOf(u16, name_wide, [_]u16{ '-', 'p', 't', 'y' }) != null;
return mem.indexOf(u16, name_wide, &[_]u16{ 'm', 's', 'y', 's', '-' }) != null or
mem.indexOf(u16, name_wide, &[_]u16{ '-', 'p', 't', 'y' }) != null;
}
pub const SocketError = error{

View File

@ -932,9 +932,9 @@ pub fn wToPrefixedFileW(s: []const u16) ![PATH_MAX_WIDE:0]u16 {
// TODO https://github.com/ziglang/zig/issues/2765
var result: [PATH_MAX_WIDE:0]u16 = undefined;
const start_index = if (mem.startsWith(u16, s, [_]u16{ '\\', '?' })) 0 else blk: {
const start_index = if (mem.startsWith(u16, s, &[_]u16{ '\\', '?' })) 0 else blk: {
const prefix = [_]u16{ '\\', '?', '?', '\\' };
mem.copy(u16, result[0..], prefix);
mem.copy(u16, result[0..], &prefix);
break :blk prefix.len;
};
const end_index = start_index + s.len;
@ -961,7 +961,7 @@ pub fn sliceToPrefixedSuffixedFileW(s: []const u8, comptime suffix: []const u16)
}
const start_index = if (mem.startsWith(u8, s, "\\?") or !std.fs.path.isAbsolute(s)) 0 else blk: {
const prefix = [_]u16{ '\\', '?', '?', '\\' };
mem.copy(u16, result[0..], prefix);
mem.copy(u16, result[0..], &prefix);
break :blk prefix.len;
};
const end_index = start_index + try std.unicode.utf8ToUtf16Le(result[start_index..], s);

View File

@ -500,7 +500,7 @@ const Msf = struct {
const superblock = try in.readStruct(SuperBlock);
// Sanity checks
if (!mem.eql(u8, superblock.FileMagic, SuperBlock.file_magic))
if (!mem.eql(u8, &superblock.FileMagic, SuperBlock.file_magic))
return error.InvalidDebugInfo;
if (superblock.FreeBlockMapBlock != 1 and superblock.FreeBlockMapBlock != 2)
return error.InvalidDebugInfo;
@ -546,7 +546,7 @@ const Msf = struct {
const size = stream_sizes[i];
if (size == 0) {
stream.* = MsfStream{
.blocks = [_]u32{},
.blocks = &[_]u32{},
};
} else {
var blocks = try allocator.alloc(u32, size);