Skip to content

Commit 7dfced3

Browse files
committed
Auto merge of #2407 - devnexen:win32_fns_upd, r=JohnTitor
windows add localtime_s/memccpy fns
2 parents ffcf50a + e20c31b commit 7dfced3

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

libc-test/semver/windows-msvc.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
EOTHER
2+
memccpy
23
stricmp
34
strnicmp

libc-test/semver/windows.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ creat
178178
dev_t
179179
dup
180180
dup2
181+
errno_t
181182
execl
182183
execle
183184
execlp
@@ -239,6 +240,7 @@ isupper
239240
isxdigit
240241
labs
241242
listen
243+
localtime_s
242244
lseek
243245
lseek64
244246
malloc

src/windows/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ pub type wchar_t = u16;
2727

2828
pub type clock_t = i32;
2929

30+
pub type errno_t = ::c_int;
31+
3032
cfg_if! {
3133
if #[cfg(all(target_arch = "x86", target_env = "gnu"))] {
3234
pub type time_t = i32;
@@ -372,6 +374,8 @@ extern "C" {
372374

373375
#[link_name = "_gmtime64_s"]
374376
pub fn gmtime_s(destTime: *mut tm, srcTime: *const time_t) -> ::c_int;
377+
#[link_name = "_localtime64_s"]
378+
pub fn localtime_s(tmDest: *mut tm, sourceTime: *const time_t) -> ::errno_t;
375379
#[link_name = "_time64"]
376380
pub fn time(destTime: *mut time_t) -> time_t;
377381
#[link_name = "_chmod"]

src/windows/msvc/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ extern "C" {
1010
pub fn stricmp(s1: *const ::c_char, s2: *const ::c_char) -> ::c_int;
1111
#[link_name = "_strnicmp"]
1212
pub fn strnicmp(s1: *const ::c_char, s2: *const ::c_char, n: ::size_t) -> ::c_int;
13+
#[link_name = "_memccpy"]
14+
pub fn memccpy(
15+
dest: *mut ::c_void,
16+
src: *const ::c_void,
17+
c: ::c_int,
18+
count: ::size_t,
19+
) -> *mut ::c_void;
1320
}
1421

1522
cfg_if! {

0 commit comments

Comments
 (0)