@@ -64,9 +64,9 @@ fn write_offset(buf: &mut Vec<u8>, value: usize, nbytes: u8) {
64
64
}
65
65
66
66
/// Write little-endian integer to buffer at a specific position
67
- fn write_offset_at_pos ( buf : & mut [ u8 ] , index : usize , value : usize , nbytes : u8 ) {
67
+ fn write_offset_at_pos ( buf : & mut [ u8 ] , start_pos : usize , value : usize , nbytes : u8 ) {
68
68
let bytes = value. to_le_bytes ( ) ;
69
- buf[ index..index + nbytes as usize ] . copy_from_slice ( & bytes[ ..nbytes as usize ] ) ;
69
+ buf[ start_pos..start_pos + nbytes as usize ] . copy_from_slice ( & bytes[ ..nbytes as usize ] ) ;
70
70
}
71
71
72
72
/// Wrapper around a `Vec<u8>` that provides methods for appending
@@ -383,15 +383,14 @@ impl ValueBuffer {
383
383
/// from the starting position of the buffer, will return the position after this write
384
384
fn append_offset_array_start_from_buf_pos (
385
385
& mut self ,
386
- start_index : usize ,
386
+ start_pos : usize ,
387
387
offsets : impl IntoIterator < Item = usize > ,
388
388
data_size : Option < usize > ,
389
389
nbytes : u8 ,
390
390
) -> usize {
391
391
let buf = self . inner_mut ( ) ;
392
392
393
- // Write field offsets (adjusted for header)
394
- let mut current_pos = start_index; // skip the header byte
393
+ let mut current_pos = start_pos;
395
394
for relative_offset in offsets {
396
395
write_offset_at_pos ( buf, current_pos, relative_offset, nbytes) ;
397
396
current_pos += nbytes as usize ;
0 commit comments