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
7d0c04d3
Commit
7d0c04d3
authored
Aug 27, 2010
by
Piotr Caban
Committed by
Alexandre Julliard
Aug 27, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Added _strtime_s and _wstrtime_s implementation.
parent
3fec8d9e
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
95 additions
and
14 deletions
+95
-14
msvcr100.spec
dlls/msvcr100/msvcr100.spec
+2
-2
msvcr80.spec
dlls/msvcr80/msvcr80.spec
+2
-2
msvcr90.spec
dlls/msvcr90/msvcr90.spec
+2
-2
msvcrt.spec
dlls/msvcrt/msvcrt.spec
+2
-2
time.c
dlls/msvcrt/tests/time.c
+40
-6
time.c
dlls/msvcrt/time.c
+44
-0
time.h
include/msvcrt/time.h
+2
-0
wchar.h
include/msvcrt/wchar.h
+1
-0
No files found.
dlls/msvcr100/msvcr100.spec
View file @
7d0c04d3
...
...
@@ -1156,7 +1156,7 @@
@ cdecl _strset(str long) msvcrt._strset
@ stub _strset_s
@ cdecl _strtime(ptr) msvcrt._strtime
@
stub
_strtime_s
@
cdecl _strtime_s(ptr long) msvcrt.
_strtime_s
@ cdecl _strtod_l(str ptr ptr) msvcrt._strtod_l
@ cdecl _strtoi64(str ptr long) msvcrt._strtoi64
@ cdecl _strtoi64_l(str ptr long ptr) msvcrt._strtoi64_l
...
...
@@ -1400,7 +1400,7 @@
@ cdecl _wstrdate(ptr) msvcrt._wstrdate
@ stub _wstrdate_s
@ cdecl _wstrtime(ptr) msvcrt._wstrtime
@
stub
_wstrtime_s
@
cdecl _wstrtime_s(ptr long) msvcrt.
_wstrtime_s
@ cdecl _wsystem(wstr) msvcrt._wsystem
@ cdecl _wtempnam(wstr wstr) msvcrt._wtempnam
@ stub _wtmpnam
...
...
dlls/msvcr80/msvcr80.spec
View file @
7d0c04d3
...
...
@@ -1010,7 +1010,7 @@
@ cdecl _strset(str long) msvcrt._strset
@ stub _strset_s
@ cdecl _strtime(ptr) msvcrt._strtime
@
stub
_strtime_s
@
cdecl _strtime_s(ptr long) msvcrt.
_strtime_s
@ cdecl _strtod_l(str ptr ptr) msvcrt._strtod_l
@ cdecl _strtoi64(str ptr long) msvcrt._strtoi64
@ cdecl _strtoi64_l(str ptr long ptr) msvcrt._strtoi64_l
...
...
@@ -1256,7 +1256,7 @@
@ cdecl _wstrdate(ptr) msvcrt._wstrdate
@ stub _wstrdate_s
@ cdecl _wstrtime(ptr) msvcrt._wstrtime
@
stub
_wstrtime_s
@
cdecl _wstrtime_s(ptr long) msvcrt.
_wstrtime_s
@ cdecl _wsystem(wstr) msvcrt._wsystem
@ cdecl _wtempnam(wstr wstr) msvcrt._wtempnam
@ stub _wtmpnam
...
...
dlls/msvcr90/msvcr90.spec
View file @
7d0c04d3
...
...
@@ -996,7 +996,7 @@
@ cdecl _strset(str long) msvcrt._strset
@ stub _strset_s
@ cdecl _strtime(ptr) msvcrt._strtime
@
stub
_strtime_s
@
cdecl _strtime_s(ptr long) msvcrt.
_strtime_s
@ cdecl _strtod_l(str ptr ptr) msvcrt._strtod_l
@ cdecl _strtoi64(str ptr long) msvcrt._strtoi64
@ cdecl _strtoi64_l(str ptr long ptr) msvcrt._strtoi64_l
...
...
@@ -1240,7 +1240,7 @@
@ cdecl _wstrdate(ptr) msvcrt._wstrdate
@ stub _wstrdate_s
@ cdecl _wstrtime(ptr) msvcrt._wstrtime
@
stub
_wstrtime_s
@
cdecl _wstrtime_s(ptr long) msvcrt.
_wstrtime_s
@ cdecl _wsystem(wstr) msvcrt._wsystem
@ cdecl _wtempnam(wstr wstr) msvcrt._wtempnam
@ stub _wtmpnam
...
...
dlls/msvcrt/msvcrt.spec
View file @
7d0c04d3
...
...
@@ -931,7 +931,7 @@
@ cdecl _strset(str long)
# stub _strset_s
@ cdecl _strtime(ptr)
# stub _strtime_s
@ cdecl _strtime_s(ptr long)
@ cdecl _strtod_l(str ptr ptr) MSVCRT_strtod_l
@ cdecl _strtoi64(str ptr long) MSVCRT_strtoi64
@ cdecl _strtoi64_l(str ptr long ptr) MSVCRT_strtoi64_l
...
...
@@ -1170,7 +1170,7 @@
@ cdecl _wstrdate(ptr)
# stub _wstrdate_s
@ cdecl _wstrtime(ptr)
# stub _wstrtime_s
@ cdecl _wstrtime_s(ptr long)
@ cdecl _wsystem(wstr)
@ cdecl _wtempnam(wstr wstr)
# stub _wtempnam_dbg
...
...
dlls/msvcrt/tests/time.c
View file @
7d0c04d3
...
...
@@ -25,6 +25,7 @@
#include <stdlib.h>
/*setenv*/
#include <stdio.h>
/*printf*/
#include <errno.h>
#define SECSPERDAY 86400
#define SECSPERHOUR 3600
...
...
@@ -32,6 +33,19 @@
#define MINSPERHOUR 60
#define HOURSPERDAY 24
static
__time32_t
(
__cdecl
*
p_mkgmtime32
)(
struct
tm
*
);
static
struct
tm
*
(
__cdecl
*
p_gmtime32
)(
__time32_t
*
);
static
errno_t
(
__cdecl
*
p_strtime_s
)(
char
*
,
size_t
);
static
void
init
(
void
)
{
HMODULE
hmod
=
GetModuleHandleA
(
"msvcrt.dll"
);
p_gmtime32
=
(
void
*
)
GetProcAddress
(
hmod
,
"_gmtime32"
);
p_mkgmtime32
=
(
void
*
)
GetProcAddress
(
hmod
,
"_mkgmtime32"
);
p_strtime_s
=
(
void
*
)
GetProcAddress
(
hmod
,
"_strtime_s"
);
}
static
int
get_test_year
(
time_t
*
start
)
{
time_t
now
=
time
(
NULL
);
...
...
@@ -54,14 +68,9 @@ static void test_ctime(void)
}
static
void
test_gmtime
(
void
)
{
static
__time32_t
(
__cdecl
*
p_mkgmtime32
)(
struct
tm
*
);
static
struct
tm
*
(
__cdecl
*
p_gmtime32
)(
__time32_t
*
);
HMODULE
hmod
=
GetModuleHandleA
(
"msvcrt.dll"
);
__time32_t
valid
,
gmt
;
struct
tm
*
gmt_tm
;
p_gmtime32
=
(
void
*
)
GetProcAddress
(
hmod
,
"_gmtime32"
);
if
(
!
p_gmtime32
)
{
win_skip
(
"Skipping _gmtime32 tests
\n
"
);
return
;
...
...
@@ -81,7 +90,6 @@ static void test_gmtime(void)
gmt_tm
->
tm_year
,
gmt_tm
->
tm_mon
,
gmt_tm
->
tm_yday
,
gmt_tm
->
tm_mday
,
gmt_tm
->
tm_wday
,
gmt_tm
->
tm_hour
,
gmt_tm
->
tm_min
,
gmt_tm
->
tm_sec
,
gmt_tm
->
tm_isdst
);
p_mkgmtime32
=
(
void
*
)
GetProcAddress
(
hmod
,
"_mkgmtime32"
);
if
(
!
p_mkgmtime32
)
{
win_skip
(
"Skipping _mkgmtime32 tests
\n
"
);
return
;
...
...
@@ -300,6 +308,7 @@ static void test_strtime(void)
{
char
time
[
16
],
*
result
;
int
hour
,
minute
,
second
,
count
,
len
;
errno_t
err
;
result
=
_strtime
(
time
);
ok
(
result
==
time
,
"Wrong return value
\n
"
);
...
...
@@ -307,6 +316,29 @@ static void test_strtime(void)
ok
(
len
==
8
,
"Wrong length: returned %d, should be 8
\n
"
,
len
);
count
=
sscanf
(
time
,
"%02d:%02d:%02d"
,
&
hour
,
&
minute
,
&
second
);
ok
(
count
==
3
,
"Wrong format: count = %d, should be 3
\n
"
,
count
);
if
(
!
p_strtime_s
)
{
win_skip
(
"Skipping _strtime_s tests
\n
"
);
return
;
}
errno
=
0
;
err
=
p_strtime_s
(
NULL
,
0
);
ok
(
err
==
EINVAL
,
"err = %d
\n
"
,
err
);
ok
(
errno
==
EINVAL
,
"errno = %d
\n
"
,
errno
);
err
=
p_strtime_s
(
NULL
,
1
);
ok
(
err
==
EINVAL
,
"err = %d
\n
"
,
err
);
ok
(
errno
==
EINVAL
,
"errno = %d
\n
"
,
errno
);
time
[
0
]
=
'x'
;
err
=
p_strtime_s
(
time
,
8
);
ok
(
err
==
ERANGE
,
"err = %d
\n
"
,
err
);
ok
(
errno
==
ERANGE
,
"errno = %d
\n
"
,
errno
);
ok
(
time
[
0
]
==
'\0'
,
"time[0] != '
\\
0'
\n
"
);
err
=
p_strtime_s
(
time
,
9
);
ok
(
err
==
0
,
"err = %x
\n
"
,
err
);
}
static
void
test_wstrdate
(
void
)
...
...
@@ -339,6 +371,8 @@ static void test_wstrtime(void)
START_TEST
(
time
)
{
init
();
test_ctime
();
test_gmtime
();
test_mktime
();
...
...
dlls/msvcrt/time.c
View file @
7d0c04d3
...
...
@@ -326,6 +326,28 @@ char* CDECL _strtime(char* time)
}
/*********************************************************************
* _strtime_s (MSVCRT.@)
*/
int
CDECL
_strtime_s
(
char
*
time
,
MSVCRT_size_t
size
)
{
if
(
time
&&
size
)
time
[
0
]
=
'\0'
;
if
(
!
time
)
{
*
MSVCRT__errno
()
=
MSVCRT_EINVAL
;
return
MSVCRT_EINVAL
;
}
if
(
size
<
9
)
{
*
MSVCRT__errno
()
=
MSVCRT_ERANGE
;
return
MSVCRT_ERANGE
;
}
_strtime
(
time
);
return
0
;
}
/*********************************************************************
* _wstrtime (MSVCRT.@)
*/
MSVCRT_wchar_t
*
CDECL
_wstrtime
(
MSVCRT_wchar_t
*
time
)
...
...
@@ -338,6 +360,28 @@ MSVCRT_wchar_t* CDECL _wstrtime(MSVCRT_wchar_t* time)
}
/*********************************************************************
* _wstrtime_s (MSVCRT.@)
*/
int
CDECL
_wstrtime_s
(
MSVCRT_wchar_t
*
time
,
MSVCRT_size_t
size
)
{
if
(
time
&&
size
)
time
[
0
]
=
'\0'
;
if
(
!
time
)
{
*
MSVCRT__errno
()
=
MSVCRT_EINVAL
;
return
MSVCRT_EINVAL
;
}
if
(
size
<
9
)
{
*
MSVCRT__errno
()
=
MSVCRT_ERANGE
;
return
MSVCRT_ERANGE
;
}
_wstrtime
(
time
);
return
0
;
}
/*********************************************************************
* clock (MSVCRT.@)
*/
MSVCRT_clock_t
CDECL
MSVCRT_clock
(
void
)
...
...
include/msvcrt/time.h
View file @
7d0c04d3
...
...
@@ -90,6 +90,7 @@ unsigned __cdecl _getsystime(struct tm*);
unsigned
__cdecl
_setsystime
(
struct
tm
*
,
unsigned
);
char
*
__cdecl
_strdate
(
char
*
);
char
*
__cdecl
_strtime
(
char
*
);
errno_t
__cdecl
_strtime_s
(
char
*
,
size_t
);
void
__cdecl
_tzset
(
void
);
char
*
__cdecl
asctime
(
const
struct
tm
*
);
...
...
@@ -130,6 +131,7 @@ wchar_t* __cdecl _wctime32(const __time32_t*);
wchar_t
*
__cdecl
_wctime64
(
const
__time64_t
*
);
wchar_t
*
__cdecl
_wstrdate
(
wchar_t
*
);
wchar_t
*
__cdecl
_wstrtime
(
wchar_t
*
);
errno_t
__cdecl
_wstrtime_s
(
wchar_t
*
,
size_t
);
#ifndef _USE_32BIT_TIME_T
static
inline
wchar_t
*
_wctime
(
const
time_t
*
t
)
{
return
_wctime64
(
t
);
}
...
...
include/msvcrt/wchar.h
View file @
7d0c04d3
...
...
@@ -397,6 +397,7 @@ wchar_t* __cdecl _wctime32(const __time32_t*);
wchar_t
*
__cdecl
_wctime64
(
const
__time64_t
*
);
wchar_t
*
__cdecl
_wstrdate
(
wchar_t
*
);
wchar_t
*
__cdecl
_wstrtime
(
wchar_t
*
);
errno_t
__cdecl
_wstrtime_s
(
wchar_t
*
,
size_t
);
#ifndef _USE_32BIT_TIME_T
static
inline
wchar_t
*
_wctime
(
const
time_t
*
t
)
{
return
_wctime64
(
t
);
}
...
...
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