fn getStringGeneric(opt_str: ?[]const u8, offset: u64) ![:0]const u8 opt_str: ?[]const u8offset: u641629
1630
1631
1632
1633
1634
1635
1636fn getStringGeneric(opt_str: ?[]const u8, offset: u64) ![:0]const u8 {
const str = opt_str orelse return bad();
if (offset > str.len) return bad();
const casted_offset = cast(usize, offset) orelse return bad();
// Valid strings always have a terminating zero byte
const last = std.mem.findScalarPos(u8, str, casted_offset, 0) orelse return bad();
return str[casted_offset..last :0];
}