File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -1898,14 +1898,14 @@ pub unsafe extern "C-unwind" fn gzgetc(file: gzFile) -> c_int {
18981898 // `state.next + 1` is within the bounds of the `state.output` buffer, as required
18991899 // by the pointer `add` method.
19001900 state. next = unsafe { state. next . add ( 1 ) } ;
1901- return ret as _ ;
1901+ return c_int :: from ( ret) ;
19021902 }
19031903
19041904 // Nothing there -- try gz_read.
1905- let mut buf = [ 0u8 ; 1 ] ;
1906- // Safety: `buf ` is big enough to hold `len = 1` bytes.
1907- match unsafe { gz_read ( state, buf . as_mut_ptr ( ) , 1 ) } {
1908- 1 => buf [ 0 ] as _ ,
1905+ let mut c = 0u8 ;
1906+ // Safety: `c ` is big enough to hold `len = 1` bytes.
1907+ match unsafe { gz_read ( state, core :: slice :: from_mut ( & mut c ) . as_mut_ptr ( ) , 1 ) } {
1908+ 1 => c_int :: from ( c ) ,
19091909 _ => -1 ,
19101910 }
19111911}
Original file line number Diff line number Diff line change @@ -1026,6 +1026,8 @@ fn gzputs_error() {
10261026fn gzgetc_basic ( ) {
10271027 // Read data from a gzip file one byte at a time using gzgetc, and verify that
10281028 // the expected content is returned.
1029+ // FIXME: Replace these closures with simple function pointers once the project MSRV
1030+ // includes a fix for https://github.com/rust-lang/rust/issues/140293
10291031 for gzgetc_fn in [ |x| unsafe { gzgetc ( x) } , |x| unsafe { gzgetc_ ( x) } ] {
10301032 let file_name = crate_path ( "src/test-data/text.gz" ) ;
10311033 let file = unsafe {
@@ -1053,6 +1055,8 @@ fn gzgetc_basic() {
10531055
10541056#[ test]
10551057fn gzgetc_error ( ) {
1058+ // FIXME: Replace these closures with simple function pointers once the project MSRV
1059+ // includes a fix for https://github.com/rust-lang/rust/issues/140293
10561060 for gzgetc_fn in [ |x| unsafe { gzgetc ( x) } , |x| unsafe { gzgetc_ ( x) } ] {
10571061 // gzgetc on a null file handle should return -1.
10581062 assert_eq ! ( gzgetc_fn( ptr:: null_mut( ) ) , -1 ) ;
You can’t perform that action at this time.
0 commit comments