Skip to content

Commit

Permalink
fix: update to avoid argument corruption on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
silversquirl committed Nov 14, 2024
1 parent d990c00 commit ca6e866
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
11 changes: 6 additions & 5 deletions build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.{
.name = "slimy",
.version = "0.1.0-dev",
.minimum_zig_version = "0.13.0",
.paths = .{
"LICENSE",
"README.md",
Expand All @@ -11,16 +12,16 @@
},
.dependencies = .{
.optz = .{
.url = "https://github.com/silversquirl/optz/archive/63c1c02ecbbfe18fa898b5b86dbee0e5e30df099.tar.gz",
.hash = "12200ca26c64345c3fd64caf744205c05b48abe11353261252b562c7d721a451589f",
.url = "git+https://github.com/silversquirl/optz#c9a3882f2eee8bfd9452ec204b9ba7ab51cb51dc",
.hash = "122064f97f973a3fc1652fd4eeb90c7daa953677e7475c7a18d31809dc84a760be06",
},
.cpuinfo = .{
.url = "https://github.com/silversquirl/cpuinfo-zig/archive/7a7d5aea11addee3b81baa9195ef84593376d39a.tar.gz",
.url = "git+https://github.com/silversquirl/cpuinfo-zig#7a7d5aea11addee3b81baa9195ef84593376d39a",
.hash = "122048b51d1cdd9dd16c93927a47e9ee3ed7756d1060d33442749ce332b176ef0604",
},
.zcompute = .{
.url = "https://github.com/silversquirl/zcompute/archive/321f260b3170e1a66cf9abf29f4d0ae5115b2185.tar.gz",
.hash = "12202fe573ff7fd505d2e00dc1c8eaa2393efb6ae1806abed15254c311d473b9eff2",
.url = "git+https://github.com/silversquirl/zcompute#094670e754cca0bf87b0c551e95c14ecb1f2186c",
.hash = "12208114291786678c429e3680ce1fde6cc4f31f1ad3b735c4e530c1f990d854e7b3",
},
},
}
4 changes: 2 additions & 2 deletions src/gpu.zig
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const ResultBuffers = struct {
results: zc.Buffer(slimy.Result),

fn init(ctx: *zc.Context) !ResultBuffers {
const count = try zc.Buffer(u32).init(ctx, 1, .{ .map = true, .storage = true });
var count = try zc.Buffer(u32).init(ctx, 1, .{ .map = true, .storage = true });
errdefer count.deinit();
(try count.map())[0] = 0;
count.unmap();
Expand All @@ -159,7 +159,7 @@ const ResultBuffers = struct {
}

fn report(
self: ResultBuffers,
self: *ResultBuffers,
callback_context: anytype,
comptime resultCallback: fn (@TypeOf(callback_context), slimy.Result) void,
) !void {
Expand Down
16 changes: 8 additions & 8 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,8 @@ pub fn main() u8 {
std.log.err("Missing option parameter", .{});
return 1;
},
error.InvalidFormat => {
std.log.err("Invalid output format. Must be 'human' or 'csv'", .{});
return 1;
},
error.InvalidMethod => {
std.log.err("Invalid search method. Must be 'gpu' or 'cpu'", .{});
return 1;
},
error.InvalidFormat => return 1,
error.InvalidMethod => return 1,
error.InvalidCharacter => {
std.log.err("Invalid number", .{});
return 1;
Expand Down Expand Up @@ -279,12 +273,18 @@ fn parseArgs(arena: std.mem.Allocator) ArgsError!Options {
if (flags.b) return error.Benchmark;

const format = std.meta.stringToEnum(OutputOptions.Format, flags.f) orelse {
std.log.err("Invalid output format '{'}'. Must be 'human' or 'csv'", .{
std.zig.fmtEscapes(flags.f),
});
return error.InvalidFormat;
};

const progress = !flags.q and std.io.getStdErr().supportsAnsiEscapeCodes();

const method_id = std.meta.stringToEnum(std.meta.Tag(slimy.SearchMethod), flags.m) orelse {
std.log.err("Invalid search method '{'}'. Must be 'gpu' or 'cpu'", .{
std.zig.fmtEscapes(flags.m),
});
return error.InvalidMethod;
};

Expand Down

0 comments on commit ca6e866

Please sign in to comment.