@@ -2,7 +2,7 @@ use crate::{
22 ADBServerDevice , Result , RustADBError ,
33 models:: { ADBListItem , ADBListItemType , AdbServerCommand , SyncCommand } ,
44} ;
5- use byteorder:: { ByteOrder , LittleEndian } ;
5+ use byteorder:: { ByteOrder , LittleEndian , ReadBytesExt } ;
66use std:: {
77 io:: { Read , Write } ,
88 str,
@@ -23,7 +23,7 @@ impl ADBServerDevice {
2323 self . handle_list_command ( path)
2424 }
2525
26- fn handle_list_command < S : AsRef < str > > ( & mut self , path : S ) -> Result < Vec < ADBListItem > > {
26+ fn handle_list_command < A : AsRef < str > > ( & mut self , path : A ) -> Result < Vec < ADBListItem > > {
2727 // TODO: use LIS2 to support files over 2.14 GB in size.
2828 // SEE: https://github.com/cstyan/adbDocumentation?tab=readme-ov-file#adb-list
2929 let mut len_buf = [ 0_u8 ; 4 ] ;
@@ -47,21 +47,12 @@ impl ADBServerDevice {
4747 . read_exact ( & mut response) ?;
4848 match str:: from_utf8 ( response. as_ref ( ) ) ? {
4949 "DENT" => {
50- let mut mode = [ 0_u8 ; 4 ] ;
51- let mut size = [ 0_u8 ; 4 ] ;
52- let mut time = [ 0_u8 ; 4 ] ;
53- let mut name_len = [ 0_u8 ; 4 ] ;
54-
5550 let mut connection = self . transport . get_raw_connection ( ) ?;
56- connection. read_exact ( & mut mode) ?;
57- connection. read_exact ( & mut size) ?;
58- connection. read_exact ( & mut time) ?;
59- connection. read_exact ( & mut name_len) ?;
6051
61- let mode = LittleEndian :: read_u32 ( & mode ) ;
62- let size = LittleEndian :: read_u32 ( & size ) ;
63- let time = LittleEndian :: read_u32 ( & time ) ;
64- let name_len = LittleEndian :: read_u32 ( & name_len ) ;
52+ let mode = connection . read_u32 :: < LittleEndian > ( ) ? ;
53+ let size = connection . read_u32 :: < LittleEndian > ( ) ? ;
54+ let time = connection . read_u32 :: < LittleEndian > ( ) ? ;
55+ let name_len = connection . read_u32 :: < LittleEndian > ( ) ? ;
6556 let mut name_buf = vec ! [ 0_u8 ; name_len as usize ] ;
6657 connection. read_exact ( & mut name_buf) ?;
6758 let name = String :: from_utf8 ( name_buf) ?;
0 commit comments