Rename packet_len to data_len

This makes the distinction clearer between the length of the USB packet
and the length of the data its CCID header references
This commit is contained in:
Sosthène Guédon
2023-01-25 10:11:53 +01:00
parent 9d3949659c
commit 0dc5ac9d8c
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -152,7 +152,7 @@ where
// TODO check
self.ext_packet.extend_from_slice(&packet).unwrap();
let pl = packet.packet_len();
let pl = packet.data_len();
if pl > PACKET_SIZE - CCID_HEADER_LEN {
self.receiving_long = true;
self.in_chain = 1;
+2 -2
View File
@@ -6,11 +6,11 @@ pub type RawPacket = heapless::Vec<u8, PACKET_SIZE>;
pub type ExtPacket = heapless::Vec<u8, MAX_MSG_LENGTH>;
pub trait RawPacketExt {
fn packet_len(&self) -> usize;
fn data_len(&self) -> usize;
}
impl RawPacketExt for RawPacket {
fn packet_len(&self) -> usize {
fn data_len(&self) -> usize {
u32::from_le_bytes(self[1..5].try_into().unwrap()) as usize
}
}