diff --git a/src/apprt/surface.zig b/src/apprt/surface.zig index c7ebc6ac8..58e3cea9b 100644 --- a/src/apprt/surface.zig +++ b/src/apprt/surface.zig @@ -9,7 +9,7 @@ const Config = @import("../config.zig").Config; pub const Message = union(enum) { /// Represents a write request. Magic number comes from the max size /// we want this union to be. - pub const WriteReq = termio.MessageData(u8, 256); + pub const WriteReq = termio.MessageData(u8, 255); /// Set the title of the surface. /// TODO: we should change this to a "WriteReq" style structure in diff --git a/src/termio/message.zig b/src/termio/message.zig index c7fe19976..d0212950e 100644 --- a/src/termio/message.zig +++ b/src/termio/message.zig @@ -84,6 +84,8 @@ pub const Message = union(enum) { /// are a stable pointer, or require deallocation. This is helpful for thread /// messaging utilities. pub fn MessageData(comptime Elem: type, comptime small_size: comptime_int) type { + assert(small_size <= std.math.maxInt(u8)); + return union(enum) { pub const Self = @This();