Lines Matching refs:len

142         if payload.len() < item_payload_len {  in parse()
223 if buffer.len() < core::mem::size_of::<ZbiHeader>() in new()
224 || buffer.len() - core::mem::size_of::<ZbiHeader>() < payload_len in new()
354 if length > payload.len() { in parse()
385 fn set_payload_length_usize(&mut self, len: usize) -> ZbiResult<()> { in set_payload_length_usize()
386 if self.buffer.len() < len { in set_payload_length_usize()
389 self.header.length = u32::try_from(len).map_err(|_| ZbiError::PlatformBadLength)?; in set_payload_length_usize()
390 self.payload_length = len; in set_payload_length_usize()
458 if self.buffer.len() < align_payload_offset { in get_next_payload()
507 self.get_next_payload()?[..payload.len()].copy_from_slice(payload); in create_entry_with_payload()
508 self.create_entry(type_, extra, flags, payload.len()) in create_entry_with_payload()
570 .checked_add(item.payload.len()) in create_entry()
620 if self.buffer.len() < new_length { in extend()
629 let end = start + b.payload.len(); in extend()
1189 if tail_offset > buffer.len() { in get_align_buffer_offset()
1224 self.buffer[self.tail_offset..self.tail_offset + buf.len()].copy_from_slice(buf); in add_slice()
1225 self.tail_offset += buf.len(); in add_slice()
1242 length: payload.len().try_into().unwrap(), in item_default()
1249 self.add(header).add_slice(&payload[..payload.len()]) in item()
1328 assert_eq!(item.payload.len(), expect.length.try_into().unwrap()); in zbi_test_item_new()
1417 assert_eq!(item.payload.len(), 0); in zbi_test_container_new()
1578 length: x.len().try_into().unwrap(), in zbi_test_container_parse()
1634 assert_eq!(ZbiContainer::parse(&buffer[..buffer.len() - 1]), Err(ZbiError::Truncated)); in zbi_test_container_parse_error_payload_truncated()
1646 assert_eq!(ZbiContainer::parse(&buffer[..buffer.len() - 1]), Err(ZbiError::Truncated)); in zbi_test_container_parse_error_truncated()
1712 container.get_next_payload().unwrap()[..payload.len()].copy_from_slice(payload); in zbi_test_container_new_entry()
1714 .create_entry(e.type_.try_into().unwrap(), e.extra, e.get_flags(), payload.len()) in zbi_test_container_new_entry()
1793 let buf_len = 2 * core::mem::size_of::<ZbiHeader>() + payload.len() - 1; in zbi_test_container_new_entry_no_space_for_payload()
1814 + payload.len() in zbi_test_container_new_entry_with_payload_just_enough_to_fit_no_align()
1815 + (/*alignment*/ZBI_ALIGNMENT_USIZE - payload.len()); in zbi_test_container_new_entry_with_payload_just_enough_to_fit_no_align()
1822 payload.len(), in zbi_test_container_new_entry_with_payload_just_enough_to_fit_no_align()
1832 + payload.len() in zbi_test_container_new_entry_with_payload_just_enough_to_fit_with_alignment()
1833 + (ZBI_ALIGNMENT_USIZE - payload.len()/*alignment*/); in zbi_test_container_new_entry_with_payload_just_enough_to_fit_with_alignment()
2047 expected_items.len() * ZBI_HEADER_SIZE // add header len in check_container_made_of()
2051 payload.len() + in check_container_made_of()
2052 match payload.len() % ZBI_ALIGNMENT_USIZE{ in check_container_made_of()
2065 assert_eq!(b.payload.len(), payload.len()); in check_container_made_of()
2079 next_payload[..payload.len()].copy_from_slice(payload); in zbi_test_container_get_next_paylad()
2081 .create_entry(e.type_.try_into().unwrap(), e.extra, e.get_flags(), payload.len()) in zbi_test_container_get_next_paylad()
2093 let expected_payload_len = buffer.0.len() - 2 * core::mem::size_of::<ZbiHeader>(); in zbi_test_container_get_next_paylad_length()
2098 assert_eq!(next_payload.len(), expected_payload_len); in zbi_test_container_get_next_paylad_length()
2105 let len = 2 * core::mem::size_of::<ZbiHeader>(); in zbi_test_container_get_next_paylad_only_header_can_fit() localVariable
2107 let mut container = ZbiContainer::new(&mut buffer.0[..len]).unwrap(); in zbi_test_container_get_next_paylad_only_header_can_fit()
2110 assert_eq!(next_payload.len(), 0); in zbi_test_container_get_next_paylad_only_header_can_fit()
2117 let len = 2 * core::mem::size_of::<ZbiHeader>() - 1; in zbi_test_container_get_next_paylad_header_cant_fit() localVariable
2119 let mut container = ZbiContainer::new(&mut buffer.0[..len]).unwrap(); in zbi_test_container_get_next_paylad_header_cant_fit()
2127 let len = 2 * core::mem::size_of::<ZbiHeader>() - 1; in zbi_test_container_get_next_paylad_length_overflow() localVariable
2129 let mut container = ZbiContainer::new(&mut buffer.0[..len]).unwrap(); in zbi_test_container_get_next_paylad_length_overflow()
2179 buffer.0[..ref_buffer.len()].clone_from_slice(&ref_buffer); in zbi_test_container_parse_c_reference()
2181 let container = ZbiContainer::parse(&buffer.0[..ref_buffer.len()]).unwrap(); in zbi_test_container_parse_c_reference()
2268 byteslice.len() == slice.len() && byteslice.iter().zip(slice.iter()).all(|(a, b)| a == b) in byteslice_cmp()
2408 buffer.0[..ref_buffer.len()].clone_from_slice(&ref_buffer); in zbi_test_is_bootable_reference()
2473 length: test_payloads[0].len().try_into().unwrap(), in get_test_zbi_headers_all()
2482 length: test_payloads[1].len().try_into().unwrap(), in get_test_zbi_headers_all()
2491 length: test_payloads[2].len().try_into().unwrap(), in get_test_zbi_headers_all()
2500 length: test_payloads[3].len().try_into().unwrap(), in get_test_zbi_headers_all()
2509 length: test_payloads[4].len().try_into().unwrap(), in get_test_zbi_headers_all()
2518 length: test_payloads[5].len().try_into().unwrap(), in get_test_zbi_headers_all()
2527 length: test_payloads[6].len().try_into().unwrap(), in get_test_zbi_headers_all()
2536 length: test_payloads[7].len().try_into().unwrap(), in get_test_zbi_headers_all()
2553 assert_eq!(headers.len(), payloads.len()); in get_test_entries_all()
2571 entries[entries.len() - 4..].to_vec() in get_test_entries_creference()
2610 assert_eq!(&ref_buffer[..ref_buffer.len()], &buffer.0[..ref_buffer.len()]); in test_creference_buffer_generation()
2624 let original_len = buffer.0.len(); in zby_test_container_align_buffer()
2627 assert_eq!(buffer.len(), original_len - ZBI_ALIGNMENT_USIZE); in zby_test_container_align_buffer()
2635 assert_eq!(buffer.len(), 0); in zby_test_container_align_buffer_empty()
2649 assert_eq!(buffer.len(), 0); in zby_test_container_align_buffer_just_enough()