File tree 1 file changed +7
-9
lines changed
1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -52,12 +52,12 @@ unsafe fn get_posix_path(long_path: &[u16]) -> Option<OsString> {
52
52
// Src: https://github.com/cygwin/cygwin/blob/718a15ba50e0d01c79800bd658c2477f9a603540/winsup/cygwin/path.cc#L3902
53
53
// Safety:
54
54
// * `what` should be `CCP_WIN_W_TO_POSIX` here
55
- // * `from` is `*const u16`, null-terminated, UTF-16 path
56
- // * `to` is `*mut u8` buffer, the buffer size is `size`.
55
+ // * `from` is null-terminated UTF-16 path
56
+ // * `to` is buffer, the buffer size is `size`.
57
57
fn cygwin_conv_path (
58
58
what : libc:: c_uint ,
59
- from : * const libc :: c_void ,
60
- to : * mut libc :: c_void ,
59
+ from : * const u16 ,
60
+ to : * mut u8 ,
61
61
size : libc:: size_t ,
62
62
) -> libc:: ssize_t ;
63
63
}
@@ -69,7 +69,7 @@ unsafe fn get_posix_path(long_path: &[u16]) -> Option<OsString> {
69
69
let name_len = unsafe {
70
70
cygwin_conv_path (
71
71
CCP_WIN_W_TO_POSIX ,
72
- long_path. as_ptr ( ) . cast ( ) ,
72
+ long_path. as_ptr ( ) ,
73
73
core:: ptr:: null_mut ( ) ,
74
74
0 ,
75
75
)
@@ -85,17 +85,15 @@ unsafe fn get_posix_path(long_path: &[u16]) -> Option<OsString> {
85
85
let res = unsafe {
86
86
cygwin_conv_path (
87
87
CCP_WIN_W_TO_POSIX ,
88
- long_path. as_ptr ( ) . cast ( ) ,
89
- name_buffer. as_mut_ptr ( ) . cast ( ) ,
88
+ long_path. as_ptr ( ) ,
89
+ name_buffer. as_mut_ptr ( ) ,
90
90
name_buffer. len ( ) ,
91
91
)
92
92
} ;
93
93
// It's not likely to return error here.
94
94
if res != 0 {
95
95
return None ;
96
96
}
97
- // Ignore null terminator.
98
- unsafe { name_buffer. set_len ( name_len - 1 ) } ;
99
97
let name = OsString :: from_vec ( name_buffer) ;
100
98
Some ( name)
101
99
}
You can’t perform that action at this time.
0 commit comments