Add wcswidth and test
This commit is contained in:
+11
-3
@@ -637,9 +637,17 @@ pub extern "C" fn wcswcs(ws1: *const wchar_t, ws2: *const wchar_t) -> *mut wchar
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
// #[no_mangle]
|
||||
pub extern "C" fn wcswidth(pwcs: *const wchar_t, n: size_t) -> c_int {
|
||||
unimplemented!();
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn wcswidth(pwcs: *const wchar_t, n: size_t) -> c_int {
|
||||
let mut total_width = 0;
|
||||
for i in 0..n {
|
||||
let wc_width = wcwidth(*pwcs.add(i));
|
||||
if wc_width < 0 {
|
||||
return -1;
|
||||
}
|
||||
total_width += wc_width;
|
||||
}
|
||||
total_width
|
||||
}
|
||||
|
||||
// #[no_mangle]
|
||||
|
||||
@@ -115,6 +115,7 @@ EXPECT_NAMES=\
|
||||
wchar/wcstol \
|
||||
wchar/wcscasecmp \
|
||||
wchar/wcsncasecmp \
|
||||
wchar/wcswidth \
|
||||
wctype/towlower \
|
||||
wctype/towupper
|
||||
# TODO: Fix these
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
bins_dynamic/args test args
|
||||
@@ -1,6 +0,0 @@
|
||||
bins_dynamic/errno
|
||||
bins_dynamic/errno
|
||||
errno
|
||||
yes, you can change this
|
||||
yes, you can change this
|
||||
yes, you can change this
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user