Skip to content

Commit ac6ec1c

Browse files
committed
Add bindings for iconv calls
1 parent bb8fe9a commit ac6ec1c

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

libc-test/build.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ fn test_apple(target: &str) {
106106
"fcntl.h",
107107
"glob.h",
108108
"grp.h",
109+
"iconv.h",
109110
"ifaddrs.h",
110111
"langinfo.h",
111112
"limits.h",
@@ -356,6 +357,7 @@ fn test_openbsd(target: &str) {
356357
"pthread_np.h",
357358
"sys/syscall.h",
358359
"sys/shm.h",
360+
"iconv.h",
359361
}
360362

361363
cfg.skip_struct(move |ty| {
@@ -554,6 +556,7 @@ fn test_redox(target: &str) {
554556
"errno.h",
555557
"fcntl.h",
556558
"grp.h",
559+
"iconv.h",
557560
"limits.h",
558561
"locale.h",
559562
"netdb.h",
@@ -614,6 +617,7 @@ fn test_solarish(target: &str) {
614617
"fcntl.h",
615618
"glob.h",
616619
"grp.h",
620+
"iconv.h",
617621
"ifaddrs.h",
618622
"langinfo.h",
619623
"limits.h",
@@ -889,6 +893,7 @@ fn test_netbsd(target: &str) {
889893
"sys/event.h",
890894
"sys/quota.h",
891895
"sys/shm.h",
896+
"iconv.h",
892897
}
893898

894899
cfg.type_name(move |ty, is_struct, is_union| {
@@ -1096,6 +1101,7 @@ fn test_dragonflybsd(target: &str) {
10961101
"utime.h",
10971102
"utmpx.h",
10981103
"wchar.h",
1104+
"iconv.h",
10991105
}
11001106

11011107
cfg.type_name(move |ty, is_struct, is_union| {
@@ -1325,6 +1331,7 @@ fn test_android(target: &str) {
13251331
"errno.h",
13261332
"fcntl.h",
13271333
"grp.h",
1334+
"iconv.h",
13281335
"ifaddrs.h",
13291336
"limits.h",
13301337
"locale.h",
@@ -1377,8 +1384,8 @@ fn test_android(target: &str) {
13771384
"sys/syscall.h",
13781385
"sys/sysinfo.h",
13791386
"sys/time.h",
1380-
"sys/times.h",
13811387
"sys/timerfd.h",
1388+
"sys/times.h",
13821389
"sys/types.h",
13831390
"sys/ucontext.h",
13841391
"sys/uio.h",
@@ -1600,6 +1607,7 @@ fn test_freebsd(target: &str) {
16001607
"fcntl.h",
16011608
"glob.h",
16021609
"grp.h",
1610+
"iconv.h",
16031611
"ifaddrs.h",
16041612
"langinfo.h",
16051613
"libutil.h",
@@ -1906,6 +1914,7 @@ fn test_emscripten(target: &str) {
19061914
"fcntl.h",
19071915
"glob.h",
19081916
"grp.h",
1917+
"iconv.h",
19091918
"ifaddrs.h",
19101919
"langinfo.h",
19111920
"limits.h",
@@ -2270,6 +2279,7 @@ fn test_linux(target: &str) {
22702279
"fcntl.h",
22712280
"glob.h",
22722281
"grp.h",
2282+
"iconv.h",
22732283
"ifaddrs.h",
22742284
"langinfo.h",
22752285
"limits.h",

src/unix/mod.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ impl ::Clone for DIR {
3939
}
4040
}
4141
pub type locale_t = *mut ::c_void;
42+
pub type iconv_t = *mut ::c_void;
4243

4344
s! {
4445
pub struct group {
@@ -1542,6 +1543,19 @@ extern "C" {
15421543
cmd: ::c_int,
15431544
len: ::off_t,
15441545
) -> ::c_int;
1546+
1547+
pub fn iconv_open(
1548+
tocode: *const ::c_char,
1549+
fromcode: *const ::c_char,
1550+
) -> iconv_t;
1551+
pub fn iconv(
1552+
cd: iconv_t,
1553+
inbuf: *mut *mut ::c_char,
1554+
inbytesleft: *mut ::size_t,
1555+
outbuf: *mut *mut ::c_char,
1556+
outbytesleft: *mut ::size_t,
1557+
) -> ::size_t;
1558+
pub fn iconv_close(cd: iconv_t) -> ::c_int;
15451559
}
15461560

15471561
cfg_if! {

0 commit comments

Comments
 (0)