Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
a80aec4c
Commit
a80aec4c
authored
Apr 12, 2012
by
Piotr Caban
Committed by
Alexandre Julliard
Apr 12, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Added support for _TRUNCATE flag in wcsncpy_s.
parent
f900ed14
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
string.c
dlls/msvcrt/tests/string.c
+6
-0
wcs.c
dlls/msvcrt/wcs.c
+8
-3
No files found.
dlls/msvcrt/tests/string.c
View file @
a80aec4c
...
...
@@ -682,6 +682,12 @@ static void test_wcscpy_s(void)
ret
=
p_wcsncpy_s
(
szDestShort
,
8
,
szLongText
,
sizeof
(
szLongText
)
/
sizeof
(
WCHAR
));
ok
(
ret
==
ERANGE
||
ret
==
EINVAL
,
"expected ERANGE/EINVAL got %d
\n
"
,
ret
);
ok
(
szDestShort
[
0
]
==
0
,
"szDestShort[0] not 0
\n
"
);
szDest
[
0
]
=
'A'
;
ret
=
p_wcsncpy_s
(
szDest
,
5
,
szLongText
,
-
1
);
ok
(
ret
==
STRUNCATE
,
"expected STRUNCATE got %d
\n
"
,
ret
);
ok
(
szDest
[
4
]
==
0
,
"szDest[4] not 0
\n
"
);
ok
(
!
memcmp
(
szDest
,
szLongText
,
4
*
sizeof
(
WCHAR
)),
"szDest = %s
\n
"
,
wine_dbgstr_w
(
szDest
));
}
static
void
test__wcsupr_s
(
void
)
...
...
dlls/msvcrt/wcs.c
View file @
a80aec4c
...
...
@@ -1230,6 +1230,7 @@ INT CDECL MSVCRT_wcsncpy_s( MSVCRT_wchar_t* wcDest, MSVCRT_size_t numElement, co
MSVCRT_size_t
count
)
{
MSVCRT_size_t
size
=
0
;
INT
ret
=
0
;
if
(
!
wcDest
||
!
numElement
)
return
MSVCRT_EINVAL
;
...
...
@@ -1242,8 +1243,12 @@ INT CDECL MSVCRT_wcsncpy_s( MSVCRT_wchar_t* wcDest, MSVCRT_size_t numElement, co
}
size
=
min
(
strlenW
(
wcSrc
),
count
);
if
(
size
>=
numElement
)
if
(
count
==
MSVCRT__TRUNCATE
&&
size
>=
numElement
)
{
ret
=
MSVCRT_STRUNCATE
;
size
=
numElement
-
1
;
}
else
if
(
size
>=
numElement
)
{
return
MSVCRT_ERANGE
;
}
...
...
@@ -1251,7 +1256,7 @@ INT CDECL MSVCRT_wcsncpy_s( MSVCRT_wchar_t* wcDest, MSVCRT_size_t numElement, co
memcpy
(
wcDest
,
wcSrc
,
size
*
sizeof
(
WCHAR
)
);
wcDest
[
size
]
=
'\0'
;
return
0
;
return
ret
;
}
/******************************************************************
...
...
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