File tree Expand file tree Collapse file tree 1 file changed +2
-9
lines changed
library/std/src/sys/pal/uefi Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Original file line number Diff line number Diff line change @@ -4,8 +4,6 @@ use crate::mem::MaybeUninit;
44use crate :: os:: uefi;
55use crate :: ptr:: NonNull ;
66
7- const MAX_BUFFER_SIZE : usize = 8192 ;
8-
97pub struct Stdin {
108 pending : Option < char > ,
119}
@@ -111,19 +109,14 @@ fn write(
111109 protocol : * mut r_efi:: protocols:: simple_text_output:: Protocol ,
112110 buf : & [ u8 ] ,
113111) -> io:: Result < usize > {
114- let mut utf16 = [ 0 ; MAX_BUFFER_SIZE / 2 ] ;
115-
116112 // Get valid UTF-8 buffer
117113 let utf8 = match crate :: str:: from_utf8 ( buf) {
118114 Ok ( x) => x,
119115 Err ( e) => unsafe { crate :: str:: from_utf8_unchecked ( & buf[ ..e. valid_up_to ( ) ] ) } ,
120116 } ;
121- // Clip UTF-8 buffer to max UTF-16 buffer we support
122- let utf8 = & utf8[ ..utf8. floor_char_boundary ( utf16. len ( ) - 1 ) ] ;
123117
124- for ( i, ch) in utf8. encode_utf16 ( ) . enumerate ( ) {
125- utf16[ i] = ch;
126- }
118+ let mut utf16: Vec < u16 > = utf8. encode_utf16 ( ) . collect ( ) ;
119+ utf16. push ( 0 ) ;
127120
128121 unsafe { simple_text_output ( protocol, & mut utf16) } ?;
129122
You can’t perform that action at this time.
0 commit comments