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
00bce251
Commit
00bce251
authored
Jun 12, 2014
by
Piotr Caban
Committed by
Alexandre Julliard
Jun 12, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Add _strxfrm_l implementation.
parent
80695cde
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
120 additions
and
7 deletions
+120
-7
msvcr100.spec
dlls/msvcr100/msvcr100.spec
+1
-1
msvcr110.spec
dlls/msvcr110/msvcr110.spec
+1
-1
msvcr80.spec
dlls/msvcr80/msvcr80.spec
+1
-1
msvcr90.spec
dlls/msvcr90/msvcr90.spec
+1
-1
msvcrt.spec
dlls/msvcrt/msvcrt.spec
+1
-1
string.c
dlls/msvcrt/string.c
+47
-2
string.c
dlls/msvcrt/tests/string.c
+68
-0
No files found.
dlls/msvcr100/msvcr100.spec
View file @
00bce251
...
...
@@ -1367,7 +1367,7 @@
@ cdecl _strupr_l(str ptr) MSVCRT__strupr_l
@ cdecl _strupr_s(str long) MSVCRT__strupr_s
@ cdecl _strupr_s_l(str long ptr) MSVCRT__strupr_s_l
@
stub
_strxfrm_l
@
cdecl _strxfrm_l(ptr str long ptr) MSVCRT_
_strxfrm_l
@ cdecl _swab(str str long) MSVCRT__swab
@ varargs _swprintf(ptr wstr) MSVCRT_swprintf
@ stub _swprintf_c
...
...
dlls/msvcr110/msvcr110.spec
View file @
00bce251
...
...
@@ -1725,7 +1725,7 @@
@ cdecl _strupr_l(str ptr) MSVCRT__strupr_l
@ cdecl _strupr_s(str long) MSVCRT__strupr_s
@ cdecl _strupr_s_l(str long ptr) MSVCRT__strupr_s_l
@
stub
_strxfrm_l
@
cdecl _strxfrm_l(ptr str long ptr) MSVCRT_
_strxfrm_l
@ cdecl _swab(str str long) MSVCRT__swab
@ varargs _swprintf(ptr wstr) MSVCRT_swprintf
@ stub _swprintf_c
...
...
dlls/msvcr80/msvcr80.spec
View file @
00bce251
...
...
@@ -1047,7 +1047,7 @@
@ cdecl _strupr_l(str ptr) MSVCRT__strupr_l
@ cdecl _strupr_s(str long) MSVCRT__strupr_s
@ cdecl _strupr_s_l(str long ptr) MSVCRT__strupr_s_l
@
stub
_strxfrm_l
@
cdecl _strxfrm_l(ptr str long ptr) MSVCRT_
_strxfrm_l
@ cdecl _swab(str str long) MSVCRT__swab
@ varargs _swprintf(ptr wstr) MSVCRT_swprintf
@ stub _swprintf_c
...
...
dlls/msvcr90/msvcr90.spec
View file @
00bce251
...
...
@@ -1022,7 +1022,7 @@
@ cdecl _strupr_l(str ptr) MSVCRT__strupr_l
@ cdecl _strupr_s(str long) MSVCRT__strupr_s
@ cdecl _strupr_s_l(str long ptr) MSVCRT__strupr_s_l
@
stub
_strxfrm_l
@
cdecl _strxfrm_l(ptr str long ptr) MSVCRT_
_strxfrm_l
@ cdecl _swab(str str long) MSVCRT__swab
@ varargs _swprintf(ptr wstr) MSVCRT_swprintf
@ stub _swprintf_c
...
...
dlls/msvcrt/msvcrt.spec
View file @
00bce251
...
...
@@ -988,7 +988,7 @@
@ cdecl _strupr_l(str ptr) MSVCRT__strupr_l
@ cdecl _strupr_s(str long) MSVCRT__strupr_s
@ cdecl _strupr_s_l(str long ptr) MSVCRT__strupr_s_l
# stub _strxfrm_l(ptr str long ptr)
@ cdecl _strxfrm_l(ptr str long ptr) MSVCRT__strxfrm_l
@ cdecl _swab(str str long) MSVCRT__swab
@ varargs _swprintf(ptr wstr) MSVCRT_swprintf
# stub _swprintf_c(ptr long str)
...
...
dlls/msvcrt/string.c
View file @
00bce251
...
...
@@ -701,12 +701,57 @@ char* __cdecl MSVCRT_strncat(char *dst, const char *src, MSVCRT_size_t len)
}
/*********************************************************************
* _strxfrm_l (MSVCRT.@)
*/
MSVCRT_size_t
CDECL
MSVCRT__strxfrm_l
(
char
*
dest
,
const
char
*
src
,
MSVCRT_size_t
len
,
MSVCRT__locale_t
locale
)
{
MSVCRT_pthreadlocinfo
locinfo
;
int
ret
;
if
(
!
MSVCRT_CHECK_PMT
(
src
))
return
INT_MAX
;
if
(
!
MSVCRT_CHECK_PMT
(
dest
||
!
len
))
return
INT_MAX
;
if
(
len
>
INT_MAX
)
{
FIXME
(
"len > INT_MAX not supported
\n
"
);
len
=
INT_MAX
;
}
if
(
!
locale
)
locinfo
=
get_locinfo
();
else
locinfo
=
locale
->
locinfo
;
if
(
!
locinfo
->
lc_handle
[
MSVCRT_LC_COLLATE
])
{
MSVCRT_strncpy
(
dest
,
src
,
len
);
return
strlen
(
src
);
}
ret
=
LCMapStringA
(
locinfo
->
lc_handle
[
MSVCRT_LC_COLLATE
],
LCMAP_SORTKEY
,
src
,
-
1
,
NULL
,
0
);
if
(
!
ret
)
{
if
(
len
)
dest
[
0
]
=
0
;
*
MSVCRT__errno
()
=
MSVCRT_EILSEQ
;
return
INT_MAX
;
}
if
(
!
len
)
return
ret
-
1
;
if
(
ret
>
len
)
{
dest
[
0
]
=
0
;
*
MSVCRT__errno
()
=
MSVCRT_ERANGE
;
return
ret
-
1
;
}
return
LCMapStringA
(
locinfo
->
lc_handle
[
MSVCRT_LC_COLLATE
],
LCMAP_SORTKEY
,
src
,
-
1
,
dest
,
len
)
-
1
;
}
/*********************************************************************
* strxfrm (MSVCRT.@)
*/
MSVCRT_size_t
CDECL
MSVCRT_strxfrm
(
char
*
dest
,
const
char
*
src
,
MSVCRT_size_t
len
)
{
/* FIXME: handle Windows locale */
return
strxfrm
(
dest
,
src
,
len
);
return
MSVCRT__strxfrm_l
(
dest
,
src
,
len
,
NULL
);
}
/********************************************************************
...
...
dlls/msvcrt/tests/string.c
View file @
00bce251
...
...
@@ -2649,6 +2649,73 @@ static void test_strncpy(void)
ok
(
!
strncmp
(
dst
,
"0123456789"
,
TEST_STRNCPY_LEN
),
"dst != 0123456789
\n
"
);
}
static
void
test_strxfrm
(
void
)
{
char
dest
[
256
];
size_t
ret
;
/* crashes on old version of msvcrt */
if
(
p__atodbl_l
)
{
errno
=
0xdeadbeef
;
ret
=
strxfrm
(
NULL
,
"src"
,
1
);
ok
(
ret
==
INT_MAX
,
"ret = %d
\n
"
,
(
int
)
ret
);
ok
(
errno
==
EINVAL
,
"errno = %d
\n
"
,
errno
);
errno
=
0xdeadbeef
;
ret
=
strxfrm
(
dest
,
NULL
,
100
);
ok
(
ret
==
INT_MAX
,
"ret = %d
\n
"
,
(
int
)
ret
);
ok
(
errno
==
EINVAL
,
"errno = %d
\n
"
,
errno
);
}
ret
=
strxfrm
(
NULL
,
"src"
,
0
);
ok
(
ret
==
3
,
"ret = %d
\n
"
,
(
int
)
ret
);
dest
[
0
]
=
'a'
;
ret
=
strxfrm
(
dest
,
"src"
,
0
);
ok
(
ret
==
3
,
"ret = %d
\n
"
,
(
int
)
ret
);
ok
(
dest
[
0
]
==
'a'
,
"dest[0] = %d
\n
"
,
dest
[
0
]);
dest
[
3
]
=
'a'
;
ret
=
strxfrm
(
dest
,
"src"
,
5
);
ok
(
ret
==
3
,
"ret = %d
\n
"
,
(
int
)
ret
);
ok
(
!
strcmp
(
dest
,
"src"
),
"dest = %s
\n
"
,
dest
);
errno
=
0xdeadbeef
;
dest
[
1
]
=
'a'
;
ret
=
strxfrm
(
dest
,
"src"
,
1
);
ok
(
ret
==
3
,
"ret = %d
\n
"
,
(
int
)
ret
);
ok
(
dest
[
0
]
==
's'
,
"dest[0] = %d
\n
"
,
dest
[
0
]);
ok
(
dest
[
1
]
==
'a'
,
"dest[1] = %d
\n
"
,
dest
[
1
]);
ok
(
errno
==
0xdeadbeef
,
"errno = %d
\n
"
,
errno
);
ret
=
strxfrm
(
dest
,
""
,
5
);
ok
(
ret
==
0
,
"ret = %d
\n
"
,
(
int
)
ret
);
ok
(
!
dest
[
0
],
"dest[0] = %d
\n
"
,
dest
[
0
]);
if
(
!
setlocale
(
LC_ALL
,
"polish"
))
{
win_skip
(
"stxfrm tests
\n
"
);
return
;
}
ret
=
strxfrm
(
NULL
,
"src"
,
0
);
ok
(
ret
<
sizeof
(
dest
)
-
1
,
"ret = %d
\n
"
,
(
int
)
ret
);
dest
[
0
]
=
'a'
;
ret
=
strxfrm
(
dest
,
"src"
,
0
);
ok
(
ret
<
sizeof
(
dest
)
-
1
,
"ret = %d
\n
"
,
(
int
)
ret
);
ok
(
dest
[
0
]
==
'a'
,
"dest[0] = %d
\n
"
,
dest
[
0
]);
ret
=
strxfrm
(
dest
,
"src"
,
ret
+
1
);
ok
(
ret
<
sizeof
(
dest
)
-
1
,
"ret = %d
\n
"
,
(
int
)
ret
);
ok
(
dest
[
0
],
"dest[0] = 0
\n
"
);
errno
=
0xdeadbeef
;
dest
[
0
]
=
'a'
;
ret
=
strxfrm
(
dest
,
"src"
,
5
);
ok
(
ret
>
5
&&
ret
<
sizeof
(
dest
)
-
1
,
"ret = %d
\n
"
,
(
int
)
ret
);
ok
(
!
dest
[
0
]
||
broken
(
!
p__atodbl_l
&&
dest
[
0
]
==
'a'
),
"dest[0] = %d
\n
"
,
dest
[
0
]);
setlocale
(
LC_ALL
,
"C"
);
}
START_TEST
(
string
)
{
char
mem
[
100
];
...
...
@@ -2748,4 +2815,5 @@ START_TEST(string)
test__wcstoi64
();
test_atoi
();
test_strncpy
();
test_strxfrm
();
}
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