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
aaaac6ff
Commit
aaaac6ff
authored
Jul 10, 2017
by
Mikhail Paulyshka
Committed by
Alexandre Julliard
Jul 10, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcp140: Implement _To_byte.
Signed-off-by:
Mikhail Paulyshka
<
me@mixaill.tk
>
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8cb8c145
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
1 deletion
+56
-1
msvcp140.spec
dlls/msvcp140/msvcp140.spec
+1
-1
msvcp140.c
dlls/msvcp140/tests/msvcp140.c
+49
-0
locale.c
dlls/msvcp90/locale.c
+6
-0
No files found.
dlls/msvcp140/msvcp140.spec
View file @
aaaac6ff
...
...
@@ -3731,7 +3731,7 @@
@ cdecl _Thrd_sleep(ptr) _Thrd_sleep
@ cdecl _Thrd_start(ptr ptr ptr) _Thrd_start
@ cdecl _Thrd_yield() _Thrd_yield
@
stub
_To_byte
@
cdecl _To_byte(wstr ptr)
_To_byte
@ cdecl _To_wide(str ptr)
@ cdecl _Tolower(long ptr) _Tolower
@ cdecl _Toupper(long ptr) _Toupper
...
...
dlls/msvcp140/tests/msvcp140.c
View file @
aaaac6ff
...
...
@@ -152,6 +152,7 @@ static int (__cdecl *p__Schedule_chore)(_Threadpool_chore*);
static
int
(
__cdecl
*
p__Reschedule_chore
)(
const
_Threadpool_chore
*
);
static
void
(
__cdecl
*
p__Release_chore
)(
_Threadpool_chore
*
);
static
int
(
__cdecl
*
p_To_byte
)(
const
WCHAR
*
src
,
char
*
dst
);
static
int
(
__cdecl
*
p_To_wide
)(
const
char
*
src
,
WCHAR
*
dst
);
static
HMODULE
msvcp
;
...
...
@@ -215,6 +216,7 @@ static BOOL init(void)
SET
(
p__Release_chore
,
"?_Release_chore@details@Concurrency@@YAXPAU_Threadpool_chore@12@@Z"
);
}
SET
(
p_To_byte
,
"_To_byte"
);
SET
(
p_To_wide
,
"_To_wide"
);
init_thiscall_thunk
();
...
...
@@ -469,6 +471,52 @@ static void test_chore(void)
p__Release_chore
(
&
chore
);
}
static
void
test_to_byte
(
void
)
{
static
const
WCHAR
test_1
[]
=
{
'T'
,
'E'
,
'S'
,
'T'
,
0
};
static
const
WCHAR
test_2
[]
=
{
0x9580
,
0x9581
,
0x9582
,
0x9583
,
0
};
/* some CJK characters */
static
const
WCHAR
*
tests
[]
=
{
test_1
,
test_2
};
char
dst
[
MAX_PATH
+
4
]
=
"ABC
\0
XXXXXXX"
;
char
compare
[
MAX_PATH
+
4
]
=
"ABC
\0
XXXXXXX"
;
int
ret
,
expected
;
unsigned
int
i
,
j
;
WCHAR
longstr
[
MAX_PATH
+
3
];
ret
=
p_To_byte
(
NULL
,
NULL
);
ok
(
!
ret
,
"Got unexpected result %d
\n
"
,
ret
);
ret
=
p_To_byte
(
tests
[
0
],
NULL
);
ok
(
!
ret
,
"Got unexpected result %d
\n
"
,
ret
);
ret
=
p_To_byte
(
NULL
,
dst
);
ok
(
!
ret
,
"Got unexpected result %d
\n
"
,
ret
);
ok
(
!
memcmp
(
dst
,
compare
,
sizeof
(
compare
)),
"Destination was modified: %s
\n
"
,
dst
);
for
(
i
=
0
;
i
<
sizeof
(
tests
)
/
sizeof
(
*
tests
);
++
i
)
{
ret
=
p_To_byte
(
tests
[
i
],
dst
);
expected
=
WideCharToMultiByte
(
CP_ACP
,
0
,
tests
[
i
],
-
1
,
compare
,
sizeof
(
compare
)
/
sizeof
(
*
compare
),
NULL
,
NULL
);
ok
(
ret
==
expected
,
"Got unexpected result %d, expected %d, test case %u
\n
"
,
ret
,
expected
,
i
);
ok
(
!
memcmp
(
dst
,
compare
,
sizeof
(
compare
)),
"Got unexpected output %s, test case %u
\n
"
,
dst
,
i
);
}
/* Output length is limited to MAX_PATH.*/
for
(
i
=
MAX_PATH
-
2
;
i
<
MAX_PATH
+
2
;
++
i
)
{
for
(
j
=
0
;
j
<
i
;
j
++
)
longstr
[
j
]
=
'A'
;
longstr
[
i
]
=
0
;
memset
(
dst
,
0xff
,
sizeof
(
dst
));
memset
(
compare
,
0xff
,
sizeof
(
compare
));
ret
=
p_To_byte
(
longstr
,
dst
);
expected
=
WideCharToMultiByte
(
CP_ACP
,
0
,
longstr
,
-
1
,
compare
,
MAX_PATH
,
NULL
,
NULL
);
ok
(
ret
==
expected
,
"Got unexpected result %d, expected %d, length %u
\n
"
,
ret
,
expected
,
i
);
ok
(
!
memcmp
(
dst
,
compare
,
sizeof
(
compare
)),
"Got unexpected output %s, length %u
\n
"
,
dst
,
i
);
}
}
static
void
test_to_wide
(
void
)
{
/* öäü߀Ÿ.A.B in cp1252, the two . are an undefined value and delete.
...
...
@@ -524,6 +572,7 @@ START_TEST(msvcp140)
test__ContextCallback
();
test__TaskEventLogger
();
test_chore
();
test_to_byte
();
test_to_wide
();
FreeLibrary
(
msvcp
);
}
dlls/msvcp90/locale.c
View file @
aaaac6ff
...
...
@@ -11224,6 +11224,12 @@ size_t __cdecl wcsrtombs(char *dst, const wchar_t **pstr, size_t n, mbstate_t *s
}
#endif
int
__cdecl
_To_byte
(
const
wchar_t
*
src
,
char
*
dst
)
{
TRACE
(
"(%s %p)
\n
"
,
debugstr_w
(
src
),
dst
);
return
WideCharToMultiByte
(
CP_ACP
,
0
,
src
,
-
1
,
dst
,
MAX_PATH
,
NULL
,
NULL
);
}
int
__cdecl
_To_wide
(
const
char
*
src
,
wchar_t
*
dst
)
{
TRACE
(
"(%s %p)
\n
"
,
debugstr_a
(
src
),
dst
);
...
...
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