File tree 1 file changed +2
-9
lines changed
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;
4
4
use crate :: os:: uefi;
5
5
use crate :: ptr:: NonNull ;
6
6
7
- const MAX_BUFFER_SIZE : usize = 8192 ;
8
-
9
7
pub struct Stdin {
10
8
pending : Option < char > ,
11
9
}
@@ -111,19 +109,14 @@ fn write(
111
109
protocol : * mut r_efi:: protocols:: simple_text_output:: Protocol ,
112
110
buf : & [ u8 ] ,
113
111
) -> io:: Result < usize > {
114
- let mut utf16 = [ 0 ; MAX_BUFFER_SIZE / 2 ] ;
115
-
116
112
// Get valid UTF-8 buffer
117
113
let utf8 = match crate :: str:: from_utf8 ( buf) {
118
114
Ok ( x) => x,
119
115
Err ( e) => unsafe { crate :: str:: from_utf8_unchecked ( & buf[ ..e. valid_up_to ( ) ] ) } ,
120
116
} ;
121
- // Clip UTF-8 buffer to max UTF-16 buffer we support
122
- let utf8 = & utf8[ ..utf8. floor_char_boundary ( utf16. len ( ) - 1 ) ] ;
123
117
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 ) ;
127
120
128
121
unsafe { simple_text_output ( protocol, & mut utf16) } ?;
129
122
You can’t perform that action at this time.
0 commit comments