[pbs-devel] [PATCH v3 pxar 04/58] decoder: factor out skip part from skip_entry

Christian Ebner c.ebner at proxmox.com
Wed Apr 3 13:02:26 CEST 2024


On 4/3/24 11:18, Fabian Grünbichler wrote:
> On March 28, 2024 1:36 pm, Christian Ebner wrote:
>> Make the skip part reusable for a different input.
>>
>> In preparation for skipping payload paddings in a separated input.
>>
>> Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
>> ---
>> changes since version 2:
>> - not present in previous version
>>
>>   src/decoder/mod.rs | 16 ++++++++++------
>>   1 file changed, 10 insertions(+), 6 deletions(-)
>>
>> diff --git a/src/decoder/mod.rs b/src/decoder/mod.rs
>> index cc50e4f..f439327 100644
>> --- a/src/decoder/mod.rs
>> +++ b/src/decoder/mod.rs
>> @@ -563,15 +563,19 @@ impl<I: SeqRead> DecoderImpl<I> {
>>       //
>>   
>>       async fn skip_entry(&mut self, offset: u64) -> io::Result<()> {
>> -        let mut len = self.current_header.content_size() - offset;
>> +        let len = (self.current_header.content_size() - offset) as usize;
>> +        Self::skip(&mut self.input, len).await
>> +    }
>> +
>> +    async fn skip(input: &mut I, len: usize) -> io::Result<()> {
>> +        let mut len = len;
> 
> nit: this re-binding could just be part of the fn signature ;)

Okay, moved the mut binding to the function signature.





More information about the pbs-devel mailing list