File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -912,19 +912,16 @@ fn get_device_property<T: Default>(
912912}
913913
914914fn parse_str ( buffer : & [ u8 ] ) -> Result < String , FfiError > {
915- Ok ( HSTRING :: from_wide ( to_u16_slice ( buffer) )
915+ let slice = to_u16_slice ( buffer) ;
916+ Ok ( HSTRING :: from_wide ( & slice[ 0 ..slice. len ( ) - 1 ] )
916917 . into_report ( )
917918 . change_context ( FfiError :: Parser )
918919 . attach_printable ( "failed to parse string" ) ?
919920 . to_string ( ) )
920921}
921922
922923fn parse_uuid ( buffer : & [ u8 ] ) -> Result < Uuid , FfiError > {
923- let string = HSTRING :: from_wide ( to_u16_slice ( buffer) )
924- . into_report ( )
925- . change_context ( FfiError :: Parser )
926- . attach_printable ( "failed to parse a uuid into a string" ) ?
927- . to_string ( ) ;
924+ let string = parse_str ( buffer) ?;
928925 let str = string. trim_matches ( |c : char | !c. is_ascii_alphanumeric ( ) ) ;
929926 let str = match str. starts_with ( '{' ) {
930927 true => & str[ 1 ..str. len ( ) - 1 ] ,
You can’t perform that action at this time.
0 commit comments