Skip to content

Commit

Permalink
Update for latest Zig
Browse files Browse the repository at this point in the history
  • Loading branch information
squeek502 committed Dec 17, 2023
1 parent b5970a8 commit a1545d1
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
submodules: true
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.12.0-dev.1513+77bc8e7b6
version: 0.12.0-dev.1830+779b8e259
- uses: ilammy/msvc-dev-cmd@v1
if: ${{ matrix.os == 'windows-latest' }}
with:
Expand Down
4 changes: 2 additions & 2 deletions src/cli.zig
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ pub const Options = struct {
cwd.access(options.input_filename, .{}) catch |err| switch (err) {
error.FileNotFound => {
var filename_bytes = try options.allocator.alloc(u8, options.input_filename.len + 3);
std.mem.copy(u8, filename_bytes, options.input_filename);
std.mem.copy(u8, filename_bytes[filename_bytes.len - 3 ..], ".rc");
@memcpy(filename_bytes[0..options.input_filename.len], options.input_filename);
@memcpy(filename_bytes[filename_bytes.len - 3 ..], ".rc");
options.allocator.free(options.input_filename);
options.input_filename = filename_bytes;
},
Expand Down
2 changes: 1 addition & 1 deletion src/compile.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2948,7 +2948,7 @@ pub fn HeaderSlurpingReader(comptime size: usize, comptime ReaderType: anytype)
if (self.bytes_read < size) {
const bytes_to_add = @min(amt, size - self.bytes_read);
const end_index = self.bytes_read + bytes_to_add;
std.mem.copy(u8, self.slurped_header[self.bytes_read..end_index], buf[0..bytes_to_add]);
@memcpy(self.slurped_header[self.bytes_read..end_index], buf[0..bytes_to_add]);
}
self.bytes_read +|= amt;
return amt;
Expand Down
4 changes: 2 additions & 2 deletions src/lang.zig
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ test "exhaustive tagToId" {
writer.writeAll(parsed_sort.suffix.?) catch unreachable;
const expected_field_name = comptime field: {
var name_buf: [5]u8 = undefined;
std.mem.copy(u8, &name_buf, parsed_sort.language_code);
@memcpy(name_buf[0..parsed_sort.language_code.len], parsed_sort.language_code);
name_buf[2] = '_';
std.mem.copy(u8, name_buf[3..], parsed_sort.country_code.?);
@memcpy(name_buf[3..], parsed_sort.country_code.?);
break :field name_buf;
};
const expected = @field(LanguageId, &expected_field_name);
Expand Down
2 changes: 1 addition & 1 deletion test/fuzz_winafl.zig
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub fn main() !void {
const tmp_dir = try std.process.getEnvVarOwned(allocator, "TEMP");
defer allocator.free(tmp_dir);

std.mem.copy(u8, &tmp_buf, tmp_dir);
@memcpy(&tmp_buf, tmp_dir);
tmp_dir_len = tmp_dir.len;
tmp_buf[tmp_dir_len] = std.fs.path.sep;
}
Expand Down
4 changes: 2 additions & 2 deletions test/reference.zig
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ fn setupTmpDir() !std.testing.TmpDir {
// TODO: Figure out a better way to consistently find the ./test/files directory.
const files_dir_path = "test/data/files";

var files_dir = try std.fs.cwd().openIterableDir(files_dir_path, .{});
var files_dir = try std.fs.cwd().openDir(files_dir_path, .{ .iterate = true });
defer files_dir.close();

var files_it = files_dir.iterate();
while (try files_it.next()) |entry| {
try files_dir.dir.copyFile(entry.name, tmp.dir, entry.name, .{});
try files_dir.copyFile(entry.name, tmp.dir, entry.name, .{});
}

return tmp;
Expand Down

0 comments on commit a1545d1

Please sign in to comment.