diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-06 12:14:58 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-06 14:56:36 -0300 |
| commit | 4839c4b037d401393bbc87143d663e115c71242e (patch) | |
| tree | 6d23e1cd9aaf89404dd53f03e6ada23588b42dcc /src/gui/gui.zig | |
| parent | 77671575bd2f481651ea54e956ac5c7da8d63710 (diff) | |
| download | pardes-4839c4b037d401393bbc87143d663e115c71242e.tar.gz pardes-4839c4b037d401393bbc87143d663e115c71242e.zip | |
idioms #2, formats that cannot overflow say so: a bufPrint or a fixed writer whose buffer provably holds the text (numbers, a 128-byte name, a short phrase) is catch unreachable with its reason, not a catch "" or a stand-in sentence nobody can reach, and dump.check takes its 256-byte why as such
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/gui/gui.zig')
| -rw-r--r-- | src/gui/gui.zig | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 8271699e..48a30b8d 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -3721,7 +3721,7 @@ fn captureSeries(dir: []const u8, pixels: []const u8, w: u32, h: u32) void { const tf = libc.open(times, .{ .ACCMODE = .WRONLY, .CREAT = true, .APPEND = true }, @as(libc.mode_t, 0o644)); if (tf < 0) return; var line_buf: [96]u8 = undefined; - const line = std.fmt.bufPrint(&line_buf, "{d} {d} {d} {d}\n", .{ frame_capture_count, monoNs(), w, h }) catch ""; + const line = std.fmt.bufPrint(&line_buf, "{d} {d} {d} {d}\n", .{ frame_capture_count, monoNs(), w, h }) catch unreachable; // four numbers fit 96 _ = libc.write(tf, line.ptr, line.len); _ = libc.close(tf); frame_capture_count += 1; @@ -4219,7 +4219,7 @@ fn handOver(ctx: ?*anyopaque, seq: u32, bytes: []const u8) void { const geometry = (if (placed) std.fmt.bufPrint(&job.geometry, "{d}x{d}+{d}+{d}", .{ w, h, @as(i32, @intFromFloat(gx)) - 40, @as(i32, @intFromFloat(gy)) - 10 }) else - std.fmt.bufPrint(&job.geometry, "{d}x{d}", .{ w, h })) catch ""; + std.fmt.bufPrint(&job.geometry, "{d}x{d}", .{ w, h })) catch unreachable; // four c_ints fit 64 job.geometry_len = geometry.len; } s.core.handover.start(s.io, job) catch |err| { |
