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
3a25d7d9
Commit
3a25d7d9
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 _gcvt_s implementation.
parent
600fa766
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
90 additions
and
11 deletions
+90
-11
msvcr100.spec
dlls/msvcr100/msvcr100.spec
+1
-1
msvcr80.spec
dlls/msvcr80/msvcr80.spec
+1
-1
msvcr90.spec
dlls/msvcr90/msvcr90.spec
+1
-1
math.c
dlls/msvcrt/math.c
+42
-3
msvcrt.h
dlls/msvcrt/msvcrt.h
+2
-0
msvcrt.spec
dlls/msvcrt/msvcrt.spec
+1
-1
string.c
dlls/msvcrt/tests/string.c
+42
-4
No files found.
dlls/msvcr100/msvcr100.spec
View file @
3a25d7d9
...
...
@@ -674,7 +674,7 @@
@ varargs _fwscanf_l(ptr wstr ptr) msvcrt._fwscanf_l
@ varargs _fwscanf_s_l(ptr wstr ptr) msvcrt._fwscanf_s_l
@ cdecl _gcvt(double long str) msvcrt._gcvt
@
stub
_gcvt_s
@
cdecl _gcvt_s(ptr long double long) msvcrt.
_gcvt_s
@ stub _get_current_locale
@ stub _get_daylight
@ stub _get_doserrno
...
...
dlls/msvcr80/msvcr80.spec
View file @
3a25d7d9
...
...
@@ -515,7 +515,7 @@
@ varargs _fwscanf_l(ptr wstr ptr) msvcrt._fwscanf_l
@ varargs _fwscanf_s_l(ptr wstr ptr) msvcrt._fwscanf_s_l
@ cdecl _gcvt(double long str) msvcrt._gcvt
@
stub
_gcvt_s
@
cdecl _gcvt_s(ptr long double long) msvcrt.
_gcvt_s
@ stub _get_amblksiz
@ stub _get_current_locale
@ stub _get_daylight
...
...
dlls/msvcr90/msvcr90.spec
View file @
3a25d7d9
...
...
@@ -507,7 +507,7 @@
@ varargs _fwscanf_l(ptr wstr ptr) msvcrt._fwscanf_l
@ varargs _fwscanf_s_l(ptr wstr ptr) msvcrt._fwscanf_s_l
@ cdecl _gcvt(double long str) msvcrt._gcvt
@
stub
_gcvt_s
@
cdecl _gcvt_s(ptr long double long) msvcrt.
_gcvt_s
@ stub _get_amblksiz
@ stub _get_current_locale
@ stub _get_daylight
...
...
dlls/msvcrt/math.c
View file @
3a25d7d9
...
...
@@ -1196,15 +1196,54 @@ char * CDECL _fcvt( double number, int ndigits, int *decpt, int *sign )
/***********************************************************************
* _gcvt (MSVCRT.@)
*
* FIXME: uses both E and F.
*/
char
*
CDECL
_gcvt
(
double
number
,
int
ndigit
,
char
*
buff
)
{
sprintf
(
buff
,
"%.*E"
,
ndigit
,
number
);
if
(
!
buff
)
{
*
MSVCRT__errno
()
=
MSVCRT_EINVAL
;
return
NULL
;
}
if
(
ndigit
<
0
)
{
*
MSVCRT__errno
()
=
MSVCRT_ERANGE
;
return
NULL
;
}
MSVCRT_sprintf
(
buff
,
"%.*g"
,
ndigit
,
number
);
return
buff
;
}
/***********************************************************************
* _gcvt_s (MSVCRT.@)
*/
int
CDECL
_gcvt_s
(
char
*
buff
,
MSVCRT_size_t
size
,
double
number
,
int
digits
)
{
int
len
;
if
(
!
buff
)
{
*
MSVCRT__errno
()
=
MSVCRT_EINVAL
;
return
MSVCRT_EINVAL
;
}
if
(
digits
<
0
||
digits
>=
size
)
{
if
(
size
)
buff
[
0
]
=
'\0'
;
*
MSVCRT__errno
()
=
MSVCRT_ERANGE
;
return
MSVCRT_ERANGE
;
}
len
=
MSVCRT__scprintf
(
"%.*g"
,
digits
,
number
);
if
(
len
>
size
)
{
buff
[
0
]
=
'\0'
;
*
MSVCRT__errno
()
=
MSVCRT_ERANGE
;
return
MSVCRT_ERANGE
;
}
MSVCRT_sprintf
(
buff
,
"%.*g"
,
digits
,
number
);
return
0
;
}
#include <stdlib.h>
/* div_t, ldiv_t */
/*********************************************************************
...
...
dlls/msvcrt/msvcrt.h
View file @
3a25d7d9
...
...
@@ -743,6 +743,8 @@ MSVCRT_FILE* __cdecl MSVCRT__wfdopen(int, const MSVCRT_wchar_t *);
int
__cdecl
MSVCRT_vsnprintf
(
char
*
str
,
MSVCRT_size_t
len
,
const
char
*
format
,
__ms_va_list
valist
);
int
__cdecl
MSVCRT_vsnwprintf
(
MSVCRT_wchar_t
*
str
,
MSVCRT_size_t
len
,
const
MSVCRT_wchar_t
*
format
,
__ms_va_list
valist
);
int
__cdecl
MSVCRT_sprintf
(
char
*
,
const
char
*
,...);
int
__cdecl
MSVCRT__scprintf
(
const
char
*
,...);
int
__cdecl
MSVCRT_raise
(
int
sig
);
typedef
struct
MSVCRT_tagLC_ID
{
...
...
dlls/msvcrt/msvcrt.spec
View file @
3a25d7d9
...
...
@@ -461,7 +461,7 @@
@ varargs _fwscanf_l(ptr wstr ptr) MSVCRT__fwscanf_l
@ varargs _fwscanf_s_l(ptr wstr ptr) MSVCRT__fwscanf_s_l
@ cdecl _gcvt(double long str)
# stub _gcvt_s
@ cdecl _gcvt_s(ptr long double long)
# stub _get_doserrno
# stub _get_environ
# stub _get_errno
...
...
dlls/msvcrt/tests/string.c
View file @
3a25d7d9
...
...
@@ -58,6 +58,7 @@ static __int64 (__cdecl *p_strtoi64)(const char *, char **, int);
static
unsigned
__int64
(
__cdecl
*
p_strtoui64
)(
const
char
*
,
char
**
,
int
);
static
int
(
__cdecl
*
pwcstombs_s
)(
size_t
*
,
char
*
,
size_t
,
const
wchar_t
*
,
size_t
);
static
int
(
__cdecl
*
pmbstowcs_s
)(
size_t
*
,
wchar_t
*
,
size_t
,
const
char
*
,
size_t
);
static
errno_t
(
__cdecl
*
p_gcvt_s
)(
char
*
,
size_t
,
double
,
int
);
static
int
*
p__mb_cur_max
;
static
unsigned
char
*
p_mbctype
;
...
...
@@ -1241,6 +1242,41 @@ static void test_mbstowcs(void)
ok
(
!
memcmp
(
mOut
,
mHiragana
,
sizeof
(
mHiragana
)),
"mOut = %s
\n
"
,
mOut
);
}
static
void
test_gcvt
(
void
)
{
char
buf
[
1024
],
*
res
;
errno_t
err
;
if
(
!
p_gcvt_s
)
{
win_skip
(
"Skipping _gcvt tests
\n
"
);
return
;
}
errno
=
0
;
res
=
_gcvt
(
1
.
2
,
-
1
,
buf
);
ok
(
res
==
NULL
,
"res != NULL
\n
"
);
ok
(
errno
==
ERANGE
,
"errno = %d
\n
"
,
errno
);
errno
=
0
;
res
=
_gcvt
(
1
.
2
,
5
,
NULL
);
ok
(
res
==
NULL
,
"res != NULL
\n
"
);
ok
(
errno
==
EINVAL
,
"errno = %d
\n
"
,
errno
);
res
=
gcvt
(
1
.
2
,
5
,
buf
);
ok
(
res
==
buf
,
"res != buf
\n
"
);
ok
(
!
strcmp
(
buf
,
"1.2"
),
"buf = %s
\n
"
,
buf
);
buf
[
0
]
=
'x'
;
err
=
p_gcvt_s
(
buf
,
5
,
1
.
2
,
10
);
ok
(
err
==
ERANGE
,
"err = %d
\n
"
,
err
);
ok
(
buf
[
0
]
==
'\0'
,
"buf[0] = %c
\n
"
,
buf
[
0
]);
buf
[
0
]
=
'x'
;
err
=
p_gcvt_s
(
buf
,
4
,
123456
,
2
);
ok
(
err
==
ERANGE
,
"err = %d
\n
"
,
err
);
ok
(
buf
[
0
]
==
'\0'
,
"buf[0] = %c
\n
"
,
buf
[
0
]);
}
START_TEST
(
string
)
{
char
mem
[
100
];
...
...
@@ -1261,10 +1297,11 @@ START_TEST(string)
p_wcscpy_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"wcscpy_s"
);
p_wcsupr_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_wcsupr_s"
);
p_strnlen
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"strnlen"
);
p_strtoi64
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_strtoi64"
);
p_strtoui64
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_strtoui64"
);
pmbstowcs_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"mbstowcs_s"
);
pwcstombs_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"wcstombs_s"
);
p_strtoi64
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_strtoi64"
);
p_strtoui64
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_strtoui64"
);
pmbstowcs_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"mbstowcs_s"
);
pwcstombs_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"wcstombs_s"
);
p_gcvt_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_gcvt_s"
);
/* MSVCRT memcpy behaves like memmove for overlapping moves,
MFC42 CString::Insert seems to rely on that behaviour */
...
...
@@ -1298,4 +1335,5 @@ START_TEST(string)
test__strtoi64
();
test__strtod
();
test_mbstowcs
();
test_gcvt
();
}
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