mirror of
https://codeberg.org/demostf/parser.git
synced 2026-10-01 08:44:05 +02:00
remove some slice indexing
This commit is contained in:
parent
e0ec7db236
commit
1d71aa8ba6
9 changed files with 42 additions and 33 deletions
|
|
@ -613,7 +613,13 @@ fn write_table_entry(
|
|||
if let Some((history_index, history_count)) = history_item {
|
||||
history_index.write_sized(stream, 5)?;
|
||||
history_count.write_sized(stream, 5)?;
|
||||
let diff_bytes = &text.as_bytes()[history_count..];
|
||||
let diff_bytes =
|
||||
text.as_bytes()
|
||||
.get(history_count..)
|
||||
.ok_or(BitError::IndexOutOfBounds {
|
||||
pos: history_count,
|
||||
size: text.len(),
|
||||
})?;
|
||||
stream.write_bytes(diff_bytes)?;
|
||||
0u8.write(stream)?; // writing the string as bytes doesn't add the null terminator
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue