File tree Expand file tree Collapse file tree 2 files changed +3
-4
lines changed
Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ impl Display for CodePartitionDirectory {
125125}
126126
127127impl CodePartitionDirectory {
128- pub fn new ( data : Vec < u8 > , offset : usize , size : usize ) -> Result < Self , String > {
128+ pub fn new ( data : & [ u8 ] , offset : usize , size : usize ) -> Result < Self , String > {
129129 let Ok ( ( header, _) ) = CPDHeader :: read_from_prefix ( & data) else {
130130 return Err ( "could not parse CPD header" . to_string ( ) ) ;
131131 } ;
Original file line number Diff line number Diff line change @@ -77,8 +77,7 @@ impl ME {
7777 if o + 4 < data. len ( ) {
7878 let buf = & data[ o..o + 4 ] ;
7979 if buf. eq ( CPD_MAGIC_BYTES ) {
80- if let Ok ( cpd) =
81- CodePartitionDirectory :: new ( data[ o..o + s] . to_vec ( ) , o, s)
80+ if let Ok ( cpd) = CodePartitionDirectory :: new ( & data[ o..o + s] , o, s)
8281 {
8382 gen3dirs. push ( cpd) ;
8483 }
@@ -156,7 +155,7 @@ impl ME {
156155 while o < data. len ( ) {
157156 let buf = & data[ o..o + 4 ] ;
158157 if buf. eq ( CPD_MAGIC_BYTES ) {
159- let Ok ( cpd) = CodePartitionDirectory :: new ( data[ o..] . to_vec ( ) , o, 0 ) else {
158+ let Ok ( cpd) = CodePartitionDirectory :: new ( & data[ o..] , o, 0 ) else {
160159 continue ;
161160 } ;
162161 gen3dirs. push ( cpd) ;
You can’t perform that action at this time.
0 commit comments