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
335c9772
Commit
335c9772
authored
May 06, 2010
by
Piotr Caban
Committed by
Alexandre Julliard
May 06, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Fixed wcstombs(_s_l) implementation.
parent
7352ee84
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
47 deletions
+66
-47
msvcrt.spec
dlls/msvcrt/msvcrt.spec
+2
-2
wcs.c
dlls/msvcrt/wcs.c
+64
-45
No files found.
dlls/msvcrt/msvcrt.spec
View file @
335c9772
...
...
@@ -1040,7 +1040,7 @@
@ cdecl _wcstoi64(wstr ptr long) MSVCRT__wcstoi64
@ cdecl _wcstoi64_l(wstr ptr long ptr) MSVCRT__wcstoi64_l
# stub _wcstol_l
# stub
_wcstombs_l
@ cdecl _wcstombs_l(ptr ptr long ptr) MSVCRT_
_wcstombs_l
@ cdecl _wcstombs_s_l(ptr ptr long wstr long ptr) MSVCRT__wcstombs_s_l
@ cdecl _wcstoui64(wstr ptr long) MSVCRT__wcstoui64
@ cdecl _wcstoui64_l(wstr ptr long ptr) MSVCRT__wcstoui64_l
...
...
@@ -1417,7 +1417,7 @@
@ cdecl wcstok(wstr wstr) MSVCRT_wcstok
# stub wcstok_s
@ cdecl wcstol(wstr ptr long) ntdll.wcstol
@ cdecl wcstombs(ptr ptr long)
ntdll.
wcstombs
@ cdecl wcstombs(ptr ptr long)
MSVCRT_
wcstombs
@ cdecl wcstombs_s(ptr ptr long wstr long) MSVCRT_wcstombs_s
@ cdecl wcstoul(wstr ptr long) ntdll.wcstoul
@ stub wcsxfrm #(ptr wstr long) MSVCRT_wcsxfrm
...
...
dlls/msvcrt/wcs.c
View file @
335c9772
...
...
@@ -227,76 +227,95 @@ double CDECL MSVCRT__wcstod_l(const MSVCRT_wchar_t* str, MSVCRT_wchar_t** end,
}
/*********************************************************************
* _wcstombs_
s_
l (MSVCRT.@)
* _wcstombs_l (MSVCRT.@)
*/
int
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__wcstombs_l
(
char
*
mbstr
,
const
MSVCRT_wchar_t
*
wcstr
,
MSVCRT_size_t
count
,
MSVCRT__locale_t
locale
)
{
char
default_char
=
'\0'
,
*
p
;
int
hlp
,
len
;
if
(
!
size
)
return
0
;
if
(
!
mbstr
||
!
wcstr
)
{
MSVCRT__invalid_parameter
(
NULL
,
NULL
,
NULL
,
0
,
0
);
if
(
mbstr
)
*
mbstr
=
'\0'
;
*
MSVCRT__errno
()
=
MSVCRT_EINVAL
;
return
MSVCRT_EINVAL
;
}
char
default_char
=
'\0'
;
MSVCRT_size_t
tmp
;
BOOL
used_default
;
if
(
!
locale
)
locale
=
get_locale
();
if
(
size
<=
count
)
len
=
size
;
else
if
(
count
==
_TRUNCATE
)
len
=
size
-
1
;
else
len
=
count
;
/* FIXME: Use wcslen here */
tmp
=
strlenW
(
wcstr
);
if
(
tmp
>
count
&&
mbstr
)
tmp
=
count
;
p
=
mbstr
;
*
ret
=
0
;
while
(
1
)
{
if
(
!
len
)
break
;
tmp
=
WideCharToMultiByte
(
locale
->
locinfo
->
lc_codepage
,
WC_NO_BEST_FIT_CHARS
,
wcstr
,
tmp
,
mbstr
,
count
,
&
default_char
,
&
used_default
);
if
(
*
wcstr
==
'\0'
)
{
*
p
=
'\0'
;
break
;
}
if
(
used_default
)
return
-
1
;
hlp
=
WideCharToMultiByte
(
locale
->
locinfo
->
lc_codepage
,
WC_NO_BEST_FIT_CHARS
,
wcstr
,
1
,
p
,
len
,
&
default_char
,
NULL
);
if
(
!
hlp
||
*
p
==
'\0'
)
break
;
if
(
tmp
<
count
&&
mbstr
)
mbstr
[
tmp
]
=
'\0'
;
p
+=
hl
p
;
len
-=
hlp
;
return
tm
p
;
}
wcstr
++
;
*
ret
+=
1
;
/*********************************************************************
* 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
);
}
/*********************************************************************
* _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
)
{
MSVCRT_size_t
conv
;
if
(
!
mbstr
&&
!
size
)
{
conv
=
MSVCRT__wcstombs_l
(
NULL
,
wcstr
,
0
,
locale
);
if
(
ret
)
*
ret
=
conv
;
return
0
;
}
if
(
!
wcstr
||
!
mbstr
)
{
MSVCRT__invalid_parameter
(
NULL
,
NULL
,
NULL
,
0
,
0
);
if
(
mbstr
&&
size
)
mbstr
[
0
]
=
'\0'
;
*
MSVCRT__errno
()
=
MSVCRT_EINVAL
;
return
MSVCRT_EINVAL
;
}
if
(
!
len
&&
size
<=
count
)
{
if
(
count
==
_TRUNCATE
||
size
<
count
)
conv
=
size
;
else
conv
=
count
;
conv
=
MSVCRT__wcstombs_l
(
mbstr
,
wcstr
,
conv
,
locale
);
if
(
conv
<
size
)
mbstr
[
conv
++
]
=
'\0'
;
else
if
(
conv
==
size
&&
(
count
==
_TRUNCATE
||
mbstr
[
conv
-
1
]
==
'\0'
))
mbstr
[
conv
-
1
]
=
'\0'
;
else
{
MSVCRT__invalid_parameter
(
NULL
,
NULL
,
NULL
,
0
,
0
);
*
mbstr
=
'\0'
;
if
(
size
)
mbstr
[
0
]
=
'\0'
;
*
MSVCRT__errno
()
=
MSVCRT_ERANGE
;
return
MSVCRT_ERANGE
;
}
if
(
*
wcstr
==
'\0'
)
*
ret
+=
1
;
*
p
=
'\0'
;
if
(
ret
)
*
ret
=
conv
;
return
0
;
}
/*********************************************************************
* wcstombs_s (MSVCRT.@)
*/
in
t
CDECL
MSVCRT_wcstombs_s
(
MSVCRT_size_t
*
ret
,
char
*
mbstr
,
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
);
...
...
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