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
16890928
Commit
16890928
authored
Apr 27, 2011
by
Piotr Caban
Committed by
Alexandre Julliard
Apr 28, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Added wcsrtombs implementation.
parent
7810e231
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
93 additions
and
24 deletions
+93
-24
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.h
dlls/msvcrt/msvcrt.h
+1
-0
msvcrt.spec
dlls/msvcrt/msvcrt.spec
+2
-2
string.c
dlls/msvcrt/tests/string.c
+22
-0
wcs.c
dlls/msvcrt/wcs.c
+62
-16
No files found.
dlls/msvcr100/msvcr100.spec
View file @
16890928
...
...
@@ -1647,8 +1647,8 @@
@ cdecl wcsnlen(wstr long) msvcrt.wcsnlen
@ cdecl wcspbrk(wstr wstr) msvcrt.wcspbrk
@ cdecl wcsrchr(wstr long) msvcrt.wcsrchr
@
stub
wcsrtombs
@
stub
wcsrtombs_s
@
cdecl wcsrtombs(ptr ptr long ptr) msvcrt.
wcsrtombs
@
cdecl wcsrtombs_s(ptr ptr long ptr long ptr) msvcrt.
wcsrtombs_s
@ cdecl wcsspn(wstr wstr) msvcrt.wcsspn
@ cdecl wcsstr(wstr wstr) msvcrt.wcsstr
@ cdecl wcstod(wstr ptr) msvcrt.wcstod
...
...
dlls/msvcr80/msvcr80.spec
View file @
16890928
...
...
@@ -1501,8 +1501,8 @@
@ cdecl wcsnlen(wstr long) msvcrt.wcsnlen
@ cdecl wcspbrk(wstr wstr) msvcrt.wcspbrk
@ cdecl wcsrchr(wstr long) msvcrt.wcsrchr
@
stub
wcsrtombs
@
stub
wcsrtombs_s
@
cdecl wcsrtombs(ptr ptr long ptr) msvcrt.
wcsrtombs
@
cdecl wcsrtombs_s(ptr ptr long ptr long ptr) msvcrt.
wcsrtombs_s
@ cdecl wcsspn(wstr wstr) msvcrt.wcsspn
@ cdecl wcsstr(wstr wstr) msvcrt.wcsstr
@ cdecl wcstod(wstr ptr) msvcrt.wcstod
...
...
dlls/msvcr90/msvcr90.spec
View file @
16890928
...
...
@@ -1485,8 +1485,8 @@
@ cdecl wcsnlen(wstr long) msvcrt.wcsnlen
@ cdecl wcspbrk(wstr wstr) msvcrt.wcspbrk
@ cdecl wcsrchr(wstr long) msvcrt.wcsrchr
@
stub
wcsrtombs
@
stub
wcsrtombs_s
@
cdecl wcsrtombs(ptr ptr long ptr) msvcrt.
wcsrtombs
@
cdecl wcsrtombs_s(ptr ptr long ptr long ptr) msvcrt.
wcsrtombs_s
@ cdecl wcsspn(wstr wstr) msvcrt.wcsspn
@ cdecl wcsstr(wstr wstr) msvcrt.wcsstr
@ cdecl wcstod(wstr ptr) msvcrt.wcstod
...
...
dlls/msvcrt/msvcrt.h
View file @
16890928
...
...
@@ -74,6 +74,7 @@ typedef int MSVCRT_clock_t;
typedef
int
MSVCRT___time32_t
;
typedef
__int64
DECLSPEC_ALIGN
(
8
)
MSVCRT___time64_t
;
typedef
__int64
DECLSPEC_ALIGN
(
8
)
MSVCRT_fpos_t
;
typedef
int
MSVCRT_mbstate_t
;
typedef
void
(
*
__cdecl
MSVCRT_terminate_handler
)(
void
);
typedef
void
(
*
__cdecl
MSVCRT_terminate_function
)(
void
);
...
...
dlls/msvcrt/msvcrt.spec
View file @
16890928
...
...
@@ -1456,8 +1456,8 @@
@ cdecl wcsnlen(wstr long) MSVCRT_wcsnlen
@ cdecl wcspbrk(wstr wstr) MSVCRT_wcspbrk
@ cdecl wcsrchr(wstr long) ntdll.wcsrchr
# stub
wcsrtombs
# stub
wcsrtombs_s
@ cdecl wcsrtombs(ptr ptr long ptr) MSVCRT_
wcsrtombs
@ cdecl wcsrtombs_s(ptr ptr long ptr long ptr) MSVCRT_
wcsrtombs_s
@ cdecl wcsspn(wstr wstr) ntdll.wcsspn
@ cdecl wcsstr(wstr wstr) ntdll.wcsstr
@ cdecl wcstod(wstr ptr) MSVCRT_wcstod
...
...
dlls/msvcrt/tests/string.c
View file @
16890928
...
...
@@ -68,6 +68,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
size_t
(
__cdecl
*
pwcsrtombs
)(
char
*
,
const
wchar_t
**
,
size_t
,
int
*
);
static
errno_t
(
__cdecl
*
p_gcvt_s
)(
char
*
,
size_t
,
double
,
int
);
static
errno_t
(
__cdecl
*
p_itoa_s
)(
int
,
char
*
,
size_t
,
int
);
static
errno_t
(
__cdecl
*
p_strlwr_s
)(
char
*
,
size_t
);
...
...
@@ -1283,6 +1284,7 @@ static void test_mbstowcs(void)
static
const
char
mSimple
[]
=
"text"
;
static
const
char
mHiragana
[]
=
{
0x82
,
0xa0
,
0x82
,
0xa1
,
0
};
const
wchar_t
*
pwstr
;
wchar_t
wOut
[
6
];
char
mOut
[
6
];
size_t
ret
;
...
...
@@ -1355,6 +1357,25 @@ static void test_mbstowcs(void)
err
=
pwcstombs_s
(
&
ret
,
NULL
,
0
,
wHiragana
,
1
);
ok
(
err
==
0
,
"err = %d
\n
"
,
err
);
ok
(
ret
==
5
,
"ret = %d
\n
"
,
(
int
)
ret
);
if
(
!
pwcsrtombs
)
{
win_skip
(
"wcsrtombs not available
\n
"
);
return
;
}
pwstr
=
wSimple
;
err
=
-
3
;
ret
=
pwcsrtombs
(
mOut
,
&
pwstr
,
4
,
&
err
);
ok
(
ret
==
4
,
"ret = %d
\n
"
,
ret
);
ok
(
err
==
0
,
"err = %d
\n
"
,
err
);
ok
(
pwstr
==
wSimple
+
4
,
"pwstr = %p (wszSimple = %p)
\n
"
,
pwstr
,
wSimple
);
ok
(
!
memcmp
(
mOut
,
mSimple
,
ret
),
"mOut = %s
\n
"
,
mOut
);
pwstr
=
wSimple
;
ret
=
pwcsrtombs
(
mOut
,
&
pwstr
,
5
,
NULL
);
ok
(
ret
==
4
,
"ret = %d
\n
"
,
ret
);
ok
(
pwstr
==
NULL
,
"pwstr != NULL
\n
"
);
ok
(
!
memcmp
(
mOut
,
mSimple
,
sizeof
(
mSimple
)),
"mOut = %s
\n
"
,
mOut
);
}
static
void
test_gcvt
(
void
)
...
...
@@ -1974,6 +1995,7 @@ START_TEST(string)
p_strtoui64
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_strtoui64"
);
pmbstowcs_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"mbstowcs_s"
);
pwcstombs_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"wcstombs_s"
);
pwcsrtombs
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"wcsrtombs"
);
p_gcvt_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_gcvt_s"
);
p_itoa_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_itoa_s"
);
p_strlwr_s
=
(
void
*
)
GetProcAddress
(
hMsvcrt
,
"_strlwr_s"
);
...
...
dlls/msvcrt/wcs.c
View file @
16890928
...
...
@@ -288,9 +288,9 @@ double CDECL MSVCRT__wcstod_l(const MSVCRT_wchar_t* str, MSVCRT_wchar_t** end,
}
/*********************************************************************
*
_wcstombs_l (MSVCRT.@
)
*
wcsrtombs_l (INTERNAL
)
*/
MSVCRT_size_t
CDECL
MSVCRT__wcstombs_l
(
char
*
mbstr
,
const
MSVCRT_wchar_t
*
wcstr
,
static
MSVCRT_size_t
CDECL
MSVCRT_wcsrtombs_l
(
char
*
mbstr
,
const
MSVCRT_wchar_t
*
*
wcstr
,
MSVCRT_size_t
count
,
MSVCRT__locale_t
locale
)
{
char
default_char
=
'\0'
;
...
...
@@ -302,14 +302,14 @@ MSVCRT_size_t CDECL MSVCRT__wcstombs_l(char *mbstr, const MSVCRT_wchar_t *wcstr,
if
(
!
mbstr
)
return
WideCharToMultiByte
(
locale
->
locinfo
->
lc_codepage
,
WC_NO_BEST_FIT_CHARS
,
wcstr
,
-
1
,
NULL
,
0
,
&
default_char
,
&
used_default
)
-
1
;
*
wcstr
,
-
1
,
NULL
,
0
,
&
default_char
,
&
used_default
)
-
1
;
while
(
*
wcstr
)
{
while
(
*
*
wcstr
)
{
char
buf
[
3
];
MSVCRT_size_t
i
,
size
;
size
=
WideCharToMultiByte
(
locale
->
locinfo
->
lc_codepage
,
WC_NO_BEST_FIT_CHARS
,
wcstr
,
1
,
buf
,
3
,
&
default_char
,
&
used_default
);
*
wcstr
,
1
,
buf
,
3
,
&
default_char
,
&
used_default
);
if
(
used_default
)
return
-
1
;
if
(
tmp
+
size
>
count
)
...
...
@@ -317,40 +317,64 @@ MSVCRT_size_t CDECL MSVCRT__wcstombs_l(char *mbstr, const MSVCRT_wchar_t *wcstr,
for
(
i
=
0
;
i
<
size
;
i
++
)
mbstr
[
tmp
++
]
=
buf
[
i
];
wcstr
++
;
(
*
wcstr
)
++
;
}
if
(
tmp
<
count
)
if
(
tmp
<
count
)
{
mbstr
[
tmp
]
=
'\0'
;
*
wcstr
=
NULL
;
}
return
tmp
;
}
/*********************************************************************
* _wcstombs_l (MSVCRT.@)
*/
MSVCRT_size_t
CDECL
MSVCRT__wcstombs_l
(
char
*
mbstr
,
const
MSVCRT_wchar_t
*
wcstr
,
MSVCRT_size_t
count
,
MSVCRT__locale_t
locale
)
{
return
MSVCRT_wcsrtombs_l
(
mbstr
,
&
wcstr
,
count
,
locale
);
}
/*********************************************************************
* wcstombs (MSVCRT.@)
*/
MSVCRT_size_t
CDECL
MSVCRT_wcstombs
(
char
*
mbstr
,
const
MSVCRT_wchar_t
*
wcstr
,
MSVCRT_size_t
count
)
{
return
MSVCRT_
_wcstombs_l
(
mbstr
,
wcstr
,
count
,
NULL
);
return
MSVCRT_
wcsrtombs_l
(
mbstr
,
&
wcstr
,
count
,
NULL
);
}
/*********************************************************************
*
_wcstombs_s_l
(MSVCRT.@)
*
wcsrtombs
(MSVCRT.@)
*/
MSVCRT_size_t
CDECL
MSVCRT__wcstombs_s_l
(
MSVCRT_size_t
*
ret
,
char
*
mbstr
,
MSVCRT_size_t
size
,
const
MSVCRT_wchar_t
*
wcstr
,
MSVCRT_size_t
CDECL
MSVCRT_wcsrtombs
(
char
*
mbstr
,
const
MSVCRT_wchar_t
**
wcstr
,
MSVCRT_size_t
count
,
MSVCRT_mbstate_t
*
mbstate
)
{
if
(
mbstate
)
*
mbstate
=
0
;
return
MSVCRT_wcsrtombs_l
(
mbstr
,
wcstr
,
count
,
NULL
);
}
/*********************************************************************
* MSVCRT_wcsrtombs_s_l (INTERNAL)
*/
MSVCRT_size_t
CDECL
MSVCRT_wcsrtombs_s_l
(
MSVCRT_size_t
*
ret
,
char
*
mbstr
,
MSVCRT_size_t
size
,
const
MSVCRT_wchar_t
**
wcstr
,
MSVCRT_size_t
count
,
MSVCRT__locale_t
locale
)
{
MSVCRT_size_t
conv
;
if
(
!
mbstr
&&
!
size
)
{
conv
=
MSVCRT_
_wcs
tombs_l
(
NULL
,
wcstr
,
0
,
locale
);
if
(
!
mbstr
&&
!
size
&&
wcstr
)
{
conv
=
MSVCRT_
wcsr
tombs_l
(
NULL
,
wcstr
,
0
,
locale
);
if
(
ret
)
*
ret
=
conv
+
1
;
return
0
;
}
if
(
!
MSVCRT_CHECK_PMT
(
wcstr
!=
NULL
)
||
!
MSVCRT_CHECK_PMT
(
mbstr
!=
NULL
))
{
if
(
!
MSVCRT_CHECK_PMT
(
wcstr
!=
NULL
)
||
!
MSVCRT_CHECK_PMT
(
*
wcstr
!=
NULL
)
||
!
MSVCRT_CHECK_PMT
(
mbstr
!=
NULL
))
{
if
(
mbstr
&&
size
)
mbstr
[
0
]
=
'\0'
;
*
MSVCRT__errno
()
=
MSVCRT_EINVAL
;
...
...
@@ -362,7 +386,7 @@ MSVCRT_size_t CDECL MSVCRT__wcstombs_s_l(MSVCRT_size_t *ret, char *mbstr,
else
conv
=
count
;
conv
=
MSVCRT_
_wcs
tombs_l
(
mbstr
,
wcstr
,
conv
,
locale
);
conv
=
MSVCRT_
wcsr
tombs_l
(
mbstr
,
wcstr
,
conv
,
locale
);
if
(
conv
<
size
)
mbstr
[
conv
++
]
=
'\0'
;
else
if
(
conv
==
size
&&
(
count
==
MSVCRT__TRUNCATE
||
mbstr
[
conv
-
1
]
==
'\0'
))
...
...
@@ -381,12 +405,34 @@ MSVCRT_size_t CDECL MSVCRT__wcstombs_s_l(MSVCRT_size_t *ret, char *mbstr,
}
/*********************************************************************
* _wcstombs_s_l (MSVCRT.@)
*/
MSVCRT_size_t
CDECL
MSVCRT__wcstombs_s_l
(
MSVCRT_size_t
*
ret
,
char
*
mbstr
,
MSVCRT_size_t
size
,
const
MSVCRT_wchar_t
*
wcstr
,
MSVCRT_size_t
count
,
MSVCRT__locale_t
locale
)
{
return
MSVCRT_wcsrtombs_s_l
(
ret
,
mbstr
,
size
,
&
wcstr
,
count
,
locale
);
}
/*********************************************************************
* wcstombs_s (MSVCRT.@)
*/
MSVCRT_size_t
CDECL
MSVCRT_wcstombs_s
(
MSVCRT_size_t
*
ret
,
char
*
mbstr
,
MSVCRT_size_t
size
,
const
MSVCRT_wchar_t
*
wcstr
,
MSVCRT_size_t
count
)
{
return
MSVCRT__wcstombs_s_l
(
ret
,
mbstr
,
size
,
wcstr
,
count
,
NULL
);
return
MSVCRT_wcsrtombs_s_l
(
ret
,
mbstr
,
size
,
&
wcstr
,
count
,
NULL
);
}
/*********************************************************************
* wcsrtombs_s (MSVCRT.@)
*/
MSVCRT_size_t
CDECL
MSVCRT_wcsrtombs_s
(
MSVCRT_size_t
*
ret
,
char
*
mbstr
,
MSVCRT_size_t
size
,
const
MSVCRT_wchar_t
**
wcstr
,
MSVCRT_size_t
count
,
MSVCRT_mbstate_t
*
mbstate
)
{
if
(
mbstate
)
*
mbstate
=
0
;
return
MSVCRT_wcsrtombs_s_l
(
ret
,
mbstr
,
size
,
wcstr
,
count
,
NULL
);
}
/*********************************************************************
...
...
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