@@ -1026,7 +1026,7 @@ fn gzputs_error() {
1026
1026
fn gzgetc_basic ( ) {
1027
1027
// Read data from a gzip file one byte at a time using gzgetc, and verify that
1028
1028
// the expected content is returned.
1029
- for gzgetc_fn in [ gzgetc, gzgetc_] {
1029
+ for gzgetc_fn in [ |x| unsafe { gzgetc ( x ) } , |x| unsafe { gzgetc_ ( x ) } ] {
1030
1030
let file_name = crate_path ( "src/test-data/text.gz" ) ;
1031
1031
let file = unsafe {
1032
1032
gzopen (
@@ -1040,31 +1040,31 @@ fn gzgetc_basic() {
1040
1040
let mut content = String :: with_capacity ( EXPECTED . len ( ) ) ;
1041
1041
for _ in 0 ..EXPECTED . len ( ) {
1042
1042
// Safety: `file` was initialized by `gzopen`.
1043
- let ch = unsafe { gzgetc_fn ( file) } ;
1043
+ let ch = gzgetc_fn ( file) ;
1044
1044
assert_ne ! ( ch, -1 ) ;
1045
1045
content. push ( ch as u8 as char ) ;
1046
1046
}
1047
1047
// We should be at the end, so the next gzgetc should return -1.
1048
- assert_eq ! ( unsafe { gzgetc_fn( file) } , -1 ) ;
1048
+ assert_eq ! ( gzgetc_fn( file) , -1 ) ;
1049
1049
assert_eq ! ( unsafe { gzclose( file) } , Z_OK ) ;
1050
1050
assert_eq ! ( content. as_str( ) , EXPECTED ) ;
1051
1051
}
1052
1052
}
1053
1053
1054
1054
#[ test]
1055
1055
fn gzgetc_error ( ) {
1056
- for gzgetc_fn in [ gzgetc, gzgetc_] {
1056
+ for gzgetc_fn in [ |x| unsafe { gzgetc ( x ) } , |x| unsafe { gzgetc_ ( x ) } ] {
1057
1057
// gzgetc on a null file handle should return -1.
1058
- assert_eq ! ( unsafe { gzgetc_fn( ptr:: null_mut( ) ) } , -1 ) ;
1058
+ assert_eq ! ( gzgetc_fn( ptr:: null_mut( ) ) , -1 ) ;
1059
1059
1060
1060
// gzgetc on a write-only file handle should return -1.
1061
1061
let file = unsafe { gzdopen ( -2 , CString :: new ( "w" ) . unwrap ( ) . as_ptr ( ) ) } ;
1062
- assert_eq ! ( unsafe { gzgetc_fn( file) } , -1 ) ;
1062
+ assert_eq ! ( gzgetc_fn( file) , -1 ) ;
1063
1063
assert_eq ! ( unsafe { gzclose( file) } , Z_ERRNO ) ;
1064
1064
1065
1065
// Open an invalid file descriptor as a gzip read stream. gzgetc should return -1.
1066
1066
let file = unsafe { gzdopen ( -2 , CString :: new ( "r" ) . unwrap ( ) . as_ptr ( ) ) } ;
1067
- assert_eq ! ( unsafe { gzgetc_fn( file) } , -1 ) ;
1067
+ assert_eq ! ( gzgetc_fn( file) , -1 ) ;
1068
1068
assert_eq ! ( unsafe { gzclose( file) } , Z_ERRNO ) ;
1069
1069
}
1070
1070
}
0 commit comments