summaryrefslogtreecommitdiff
path: root/src/dump.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/dump.zig')
-rw-r--r--src/dump.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/dump.zig b/src/dump.zig
index ba159325..82b1410f 100644
--- a/src/dump.zig
+++ b/src/dump.zig
@@ -247,14 +247,14 @@ fn dumpWith(p: *Pardes, deferred: ?*std.ArrayListUnmanaged(walk.Deferred)) ![]u8
/// Whether `bytes` are a dump a Restore could read, saying nothing: a
/// Restore asks before it warns about unsaved text or replaces anything.
/// Why not is left in `why`, ended by a 0.
-pub fn check(gpa: std.mem.Allocator, bytes: []const u8, why: []u8) !void {
+pub fn check(gpa: std.mem.Allocator, bytes: []const u8, why: *[256]u8) !void {
if (pardes.Db.isImage(bytes)) {
const r = pardes.Db.Read.open(gpa, bytes, null) catch |err| {
const said = std.fmt.bufPrint(why[0 .. why.len - 1], "{s}", .{switch (err) {
error.NoDump => "it holds no dump",
error.OutOfMemory => "out of memory",
else => "it is no dump of pardes's",
- }}) catch "";
+ }}) catch unreachable; // a short phrase or an error's name fits 255
why[said.len] = 0;
return err;
};
@@ -266,7 +266,7 @@ pub fn check(gpa: std.mem.Allocator, bytes: []const u8, why: []u8) !void {
error.BadDump => "it does not begin as one",
error.EndOfDump => "it is cut short",
else => @errorName(err),
- }}) catch "";
+ }}) catch unreachable; // a short phrase or an error's name fits 255
why[said.len] = 0;
return err;
};