cdp: explain buffer size for int serialization

This commit is contained in:
Adrià Arrufat
2026-03-16 09:41:28 +09:00
parent 5bc00045c7
commit 21fc6d1cf6

View File

@@ -230,6 +230,7 @@ pub const Writer = struct {
switch (value) { switch (value) {
.integer => |v| { .integer => |v| {
// CDP spec requires integer values to be serialized as strings. // CDP spec requires integer values to be serialized as strings.
// 20 bytes is enough for the decimal representation of a 64-bit integer.
var buf: [20]u8 = undefined; var buf: [20]u8 = undefined;
const s = try std.fmt.bufPrint(&buf, "{d}", .{v}); const s = try std.fmt.bufPrint(&buf, "{d}", .{v});
try w.write(s); try w.write(s);