Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
2ca9a73a
Commit
2ca9a73a
authored
Apr 11, 2012
by
Piotr Caban
Committed by
Alexandre Julliard
Apr 11, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Rewrite wasctime function.
parent
0f7c834b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
23 deletions
+23
-23
time.c
dlls/msvcrt/time.c
+23
-23
No files found.
dlls/msvcrt/time.c
View file @
2ca9a73a
...
...
@@ -954,19 +954,20 @@ int CDECL MSVCRT_asctime_s(char* time, MSVCRT_size_t size, const struct MSVCRT_t
MSVCRT_wchar_t
*
CDECL
MSVCRT__wasctime
(
const
struct
MSVCRT_tm
*
mstm
)
{
thread_data_t
*
data
=
msvcrt_get_thread_data
();
struct
tm
tm
;
char
buffer
[
30
];
char
buffer
[
26
];
msvcrt_tm_to_unix
(
&
tm
,
mstm
);
if
(
!
data
->
wasctime_buffer
)
{
data
->
wasctime_buffer
=
MSVCRT_malloc
(
26
*
sizeof
(
MSVCRT_wchar_t
));
if
(
!
data
->
wasctime_buffer
)
{
*
MSVCRT__errno
()
=
MSVCRT_ENOMEM
;
return
NULL
;
}
}
if
(
!
data
->
wasctime_buffer
)
data
->
wasctime_buffer
=
MSVCRT_malloc
(
30
*
sizeof
(
MSVCRT_wchar_t
)
);
/* ought to be enough */
#ifdef HAVE_ASCTIME_R
asctime_r
(
&
tm
,
buffer
);
#else
strcpy
(
buffer
,
asctime
(
&
tm
)
);
#endif
MultiByteToWideChar
(
CP_UNIXCP
,
0
,
buffer
,
-
1
,
data
->
wasctime_buffer
,
30
);
if
(
!
asctime_buf
(
buffer
,
mstm
))
return
NULL
;
MultiByteToWideChar
(
CP_ACP
,
0
,
buffer
,
-
1
,
data
->
wasctime_buffer
,
26
);
return
data
->
wasctime_buffer
;
}
...
...
@@ -975,23 +976,22 @@ MSVCRT_wchar_t * CDECL MSVCRT__wasctime(const struct MSVCRT_tm *mstm)
*/
int
CDECL
MSVCRT__wasctime_s
(
MSVCRT_wchar_t
*
time
,
MSVCRT_size_t
size
,
const
struct
MSVCRT_tm
*
mstm
)
{
WCHAR
*
asc
;
unsigned
int
len
;
char
buffer
[
26
]
;
int
ret
;
if
(
!
MSVCRT_CHECK_PMT
(
time
!=
NULL
)
||
!
MSVCRT_CHECK_PMT
(
mstm
!=
NULL
))
{
if
(
!
MSVCRT_CHECK_PMT
(
time
!=
NULL
)
||
!
MSVCRT_CHECK_PMT
(
mstm
!=
NULL
)
||
!
MSVCRT_CHECK_PMT
(
size
>=
26
))
{
if
(
time
&&
size
)
time
[
0
]
=
0
;
*
MSVCRT__errno
()
=
MSVCRT_EINVAL
;
return
MSVCRT_EINVAL
;
}
asc
=
MSVCRT__wasctime
(
mstm
);
len
=
(
strlenW
(
asc
)
+
1
)
*
sizeof
(
WCHAR
);
if
(
!
MSVCRT_CHECK_PMT
(
size
>=
len
))
{
*
MSVCRT__errno
()
=
MSVCRT_ERANGE
;
return
MSVCRT_ERANGE
;
}
strcpyW
(
time
,
asc
);
ret
=
MSVCRT_asctime_s
(
buffer
,
sizeof
(
buffer
),
mstm
);
if
(
!
ret
)
return
ret
;
MultiByteToWideChar
(
CP_ACP
,
0
,
buffer
,
-
1
,
time
,
size
);
return
0
;
}
...
...
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