Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
60866103
Commit
60866103
authored
Oct 11, 2010
by
Andrew Nguyen
Committed by
Alexandre Julliard
Oct 11, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Implement _localtime32_s.
parent
90771ab6
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
79 additions
and
4 deletions
+79
-4
msvcr100.spec
dlls/msvcr100/msvcr100.spec
+1
-1
msvcr80.spec
dlls/msvcr80/msvcr80.spec
+1
-1
msvcr90.spec
dlls/msvcr90/msvcr90.spec
+1
-1
msvcrt.spec
dlls/msvcrt/msvcrt.spec
+1
-1
time.c
dlls/msvcrt/tests/time.c
+54
-0
time.c
dlls/msvcrt/time.c
+20
-0
time.h
include/msvcrt/time.h
+1
-0
No files found.
dlls/msvcr100/msvcr100.spec
View file @
60866103
...
...
@@ -847,7 +847,7 @@
@ cdecl -i386 _local_unwind2(ptr long) msvcrt._local_unwind2
@ cdecl -i386 _local_unwind4(ptr ptr long) msvcrt._local_unwind4
@ cdecl _localtime32(ptr) msvcrt._localtime32
@
stub
_localtime32_s
@
cdecl _localtime32_s(ptr ptr) msvcrt.
_localtime32_s
@ cdecl _localtime64(ptr) msvcrt._localtime64
@ cdecl _localtime64_s(ptr ptr) msvcrt._localtime64_s
@ cdecl _lock(long) msvcrt._lock
...
...
dlls/msvcr80/msvcr80.spec
View file @
60866103
...
...
@@ -693,7 +693,7 @@
@ cdecl -i386 _local_unwind2(ptr long) msvcrt._local_unwind2
@ cdecl -i386 _local_unwind4(ptr ptr long) msvcrt._local_unwind4
@ cdecl _localtime32(ptr) msvcrt._localtime32
@
stub
_localtime32_s
@
cdecl _localtime32_s(ptr ptr) msvcrt.
_localtime32_s
@ cdecl _localtime64(ptr) msvcrt._localtime64
@ cdecl _localtime64_s(ptr ptr) msvcrt._localtime64_s
@ cdecl _lock(long) msvcrt._lock
...
...
dlls/msvcr90/msvcr90.spec
View file @
60866103
...
...
@@ -681,7 +681,7 @@
@ cdecl -i386 _local_unwind2(ptr long) msvcrt._local_unwind2
@ cdecl -i386 _local_unwind4(ptr ptr long) msvcrt._local_unwind4
@ cdecl _localtime32(ptr) msvcrt._localtime32
@
stub
_localtime32_s
@
cdecl _localtime32_s(ptr ptr) msvcrt.
_localtime32_s
@ cdecl _localtime64(ptr) msvcrt._localtime64
@ cdecl _localtime64_s(ptr ptr) msvcrt._localtime64_s
@ cdecl _lock(long) msvcrt._lock
...
...
dlls/msvcrt/msvcrt.spec
View file @
60866103
...
...
@@ -620,7 +620,7 @@
@ cdecl -i386 _local_unwind2(ptr long)
@ cdecl -i386 _local_unwind4(ptr ptr long)
@ cdecl _localtime32(ptr) MSVCRT__localtime32
# stub _localtime32_s
@ cdecl _localtime32_s(ptr ptr)
@ cdecl _localtime64(ptr) MSVCRT__localtime64
@ cdecl _localtime64_s(ptr ptr)
@ cdecl _lock(long)
...
...
dlls/msvcrt/tests/time.c
View file @
60866103
...
...
@@ -40,6 +40,7 @@ static struct tm* (__cdecl *p_gmtime32)(__time32_t*);
static
errno_t
(
__cdecl
*
p_gmtime32_s
)(
struct
tm
*
,
__time32_t
*
);
static
errno_t
(
__cdecl
*
p_strtime_s
)(
char
*
,
size_t
);
static
errno_t
(
__cdecl
*
p_strdate_s
)(
char
*
,
size_t
);
static
errno_t
(
__cdecl
*
p_localtime32_s
)(
struct
tm
*
,
__time32_t
*
);
static
errno_t
(
__cdecl
*
p_localtime64_s
)(
struct
tm
*
,
__time64_t
*
);
static
void
init
(
void
)
...
...
@@ -51,6 +52,7 @@ static void init(void)
p_mkgmtime32
=
(
void
*
)
GetProcAddress
(
hmod
,
"_mkgmtime32"
);
p_strtime_s
=
(
void
*
)
GetProcAddress
(
hmod
,
"_strtime_s"
);
p_strdate_s
=
(
void
*
)
GetProcAddress
(
hmod
,
"_strdate_s"
);
p_localtime32_s
=
(
void
*
)
GetProcAddress
(
hmod
,
"_localtime32_s"
);
p_localtime64_s
=
(
void
*
)
GetProcAddress
(
hmod
,
"_localtime64_s"
);
}
...
...
@@ -425,6 +427,57 @@ static void test_wstrtime(void)
ok
(
count
==
3
,
"Wrong format: count = %d, should be 3
\n
"
,
count
);
}
static
void
test_localtime32_s
(
void
)
{
struct
tm
tm
;
__time32_t
time
;
errno_t
err
;
if
(
!
p_localtime32_s
)
{
win_skip
(
"Skipping _localtime32_s tests
\n
"
);
return
;
}
errno
=
EBADF
;
err
=
p_localtime32_s
(
NULL
,
NULL
);
ok
(
err
==
EINVAL
,
"Expected _localtime32_s to return EINVAL, got %d
\n
"
,
err
);
ok
(
errno
==
EINVAL
,
"Expected errno to be EINVAL, got %d
\n
"
,
errno
);
errno
=
EBADF
;
time
=
0x12345678
;
err
=
p_localtime32_s
(
NULL
,
&
time
);
ok
(
err
==
EINVAL
,
"Expected _localtime32_s to return EINVAL, got %d
\n
"
,
err
);
ok
(
errno
==
EINVAL
,
"Expected errno to be EINVAL, got %d
\n
"
,
errno
);
memset
(
&
tm
,
0
,
sizeof
(
tm
));
errno
=
EBADF
;
err
=
p_localtime32_s
(
&
tm
,
NULL
);
ok
(
err
==
EINVAL
,
"Expected _localtime32_s to return EINVAL, got %d
\n
"
,
err
);
ok
(
errno
==
EINVAL
,
"Expected errno to be EINVAL, got %d
\n
"
,
errno
);
ok
(
tm
.
tm_sec
==
-
1
&&
tm
.
tm_min
==
-
1
&&
tm
.
tm_hour
==
-
1
&&
tm
.
tm_mday
==
-
1
&&
tm
.
tm_mon
==
-
1
&&
tm
.
tm_year
==
-
1
&&
tm
.
tm_wday
==
-
1
&&
tm
.
tm_yday
==
-
1
&&
tm
.
tm_isdst
==
-
1
,
"Expected tm structure members to be initialized to -1, got "
"(%d, %d, %d, %d, %d, %d, %d, %d, %d)
\n
"
,
tm
.
tm_sec
,
tm
.
tm_min
,
tm
.
tm_hour
,
tm
.
tm_mday
,
tm
.
tm_mon
,
tm
.
tm_year
,
tm
.
tm_wday
,
tm
.
tm_yday
,
tm
.
tm_isdst
);
memset
(
&
tm
,
0
,
sizeof
(
tm
));
time
=
-
1
;
errno
=
EBADF
;
err
=
p_localtime32_s
(
&
tm
,
&
time
);
ok
(
err
==
EINVAL
,
"Expected _localtime32_s to return EINVAL, got %d
\n
"
,
err
);
ok
(
errno
==
EINVAL
,
"Expected errno to be EINVAL, got %d
\n
"
,
errno
);
ok
(
tm
.
tm_sec
==
-
1
&&
tm
.
tm_min
==
-
1
&&
tm
.
tm_hour
==
-
1
&&
tm
.
tm_mday
==
-
1
&&
tm
.
tm_mon
==
-
1
&&
tm
.
tm_year
==
-
1
&&
tm
.
tm_wday
==
-
1
&&
tm
.
tm_yday
==
-
1
&&
tm
.
tm_isdst
==
-
1
,
"Expected tm structure members to be initialized to -1, got "
"(%d, %d, %d, %d, %d, %d, %d, %d, %d)
\n
"
,
tm
.
tm_sec
,
tm
.
tm_min
,
tm
.
tm_hour
,
tm
.
tm_mday
,
tm
.
tm_mon
,
tm
.
tm_year
,
tm
.
tm_wday
,
tm
.
tm_yday
,
tm
.
tm_isdst
);
}
static
void
test_localtime64_s
(
void
)
{
struct
tm
tm
;
...
...
@@ -502,5 +555,6 @@ START_TEST(time)
test_strtime
();
test_wstrdate
();
test_wstrtime
();
test_localtime32_s
();
test_localtime64_s
();
}
dlls/msvcrt/time.c
View file @
60866103
...
...
@@ -260,6 +260,26 @@ struct MSVCRT_tm* CDECL MSVCRT__localtime32(const MSVCRT___time32_t* secs)
}
/*********************************************************************
* _localtime32_s (MSVCRT.@)
*/
int
CDECL
_localtime32_s
(
struct
MSVCRT_tm
*
time
,
const
MSVCRT___time32_t
*
secs
)
{
MSVCRT___time64_t
secs64
;
if
(
!
time
||
!
secs
||
*
secs
<
0
)
{
if
(
time
)
write_invalid_msvcrt_tm
(
time
);
*
MSVCRT__errno
()
=
MSVCRT_EINVAL
;
return
MSVCRT_EINVAL
;
}
secs64
=
*
secs
;
return
_localtime64_s
(
time
,
&
secs64
);
}
/*********************************************************************
* localtime (MSVCRT.@)
*/
#ifdef _WIN64
...
...
include/msvcrt/time.h
View file @
60866103
...
...
@@ -103,6 +103,7 @@ double __cdecl _difftime64(__time64_t,__time64_t);
struct
tm
*
__cdecl
_gmtime32
(
const
__time32_t
*
);
struct
tm
*
__cdecl
_gmtime64
(
const
__time64_t
*
);
struct
tm
*
__cdecl
_localtime32
(
const
__time32_t
*
);
errno_t
__cdecl
_localtime32_s
(
struct
tm
*
,
const
__time64_t
*
);
struct
tm
*
__cdecl
_localtime64
(
const
__time64_t
*
);
errno_t
__cdecl
_localtime64_s
(
struct
tm
*
,
const
__time64_t
*
);
__time32_t
__cdecl
_mktime32
(
struct
tm
*
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment