diff --git a/src/stdio/src/lib.rs b/src/stdio/src/lib.rs index 8f07338b73ac21d6057729e205b83623857361df..e3e23d8c21625c3e7417b678871bbec9f5d8813c 100644 --- a/src/stdio/src/lib.rs +++ b/src/stdio/src/lib.rs @@ -607,7 +607,7 @@ pub extern "C" fn getc(stream: &mut FILE) -> c_int { /// Get a single char from `stdin` #[no_mangle] pub extern "C" fn getchar() -> c_int { - fgetc(&mut *__stdin()) + fgetc(unsafe { &mut *__stdin() }) } /// Get a char from a stream without locking the stream @@ -640,14 +640,14 @@ pub extern "C" fn getc_unlocked(stream: &mut FILE) -> c_int { /// Get a char from `stdin` without locking `stdin` #[no_mangle] pub extern "C" fn getchar_unlocked() -> c_int { - getc_unlocked(&mut *__stdin()) + getc_unlocked(unsafe { &mut *__stdin() }) } /// Get a string from `stdin` #[no_mangle] pub extern "C" fn gets(s: *mut c_char) -> *mut c_char { use core::i32; - fgets(s, i32::MAX, &mut *__stdin()) + fgets(s, i32::MAX, unsafe { &mut *__stdin() }) } /// Get an integer from `stream` @@ -704,7 +704,7 @@ pub extern "C" fn putc(c: c_int, stream: &mut FILE) -> c_int { /// Put a character `c` into `stdout` #[no_mangle] pub extern "C" fn putchar(c: c_int) -> c_int { - fputc(c, &mut *__stdout()) + fputc(c, unsafe { &mut *__stdout() }) } /// Put a character `c` into `stream` without locking `stream` @@ -732,13 +732,13 @@ pub extern "C" fn putc_unlocked(c: c_int, stream: &mut FILE) -> c_int { /// Put a character `c` into `stdout` without locking `stdout` #[no_mangle] pub extern "C" fn putchar_unlocked(c: c_int) -> c_int { - putc_unlocked(c, &mut *__stdout()) + putc_unlocked(c, unsafe { &mut *__stdout() }) } /// Put a string `s` into `stdout` #[no_mangle] pub extern "C" fn puts(s: *const c_char) -> c_int { - let ret = (fputs(s, &mut *__stdout()) > 0) || (putchar_unlocked(b'\n' as c_int) > 0); + let ret = (fputs(s, unsafe { &mut *__stdout() }) > 0) || (putchar_unlocked(b'\n' as c_int) > 0); if ret { 0 } else { @@ -863,7 +863,7 @@ pub unsafe extern "C" fn vfprintf(file: &mut FILE, format: *const c_char, ap: va #[no_mangle] pub unsafe extern "C" fn vprintf(format: *const c_char, ap: va_list) -> c_int { - vfprintf(&mut *__stdout(), format, ap) + vfprintf(unsafe { &mut *__stdout() }, format, ap) } #[no_mangle] @@ -892,7 +892,7 @@ pub unsafe extern "C" fn vfscanf(file: &mut FILE, format: *const c_char, ap: va_ #[no_mangle] pub unsafe extern "C" fn vscanf(format: *const c_char, ap: va_list) -> c_int { - vfscanf(&mut *__stdin(), format, ap) + vfscanf(unsafe { &mut *__stdin() }, format, ap) } #[no_mangle]