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
b7a74d24
Commit
b7a74d24
authored
Sep 28, 2010
by
Andrew Nguyen
Committed by
Alexandre Julliard
Sep 28, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcrt: Implement strerror_s.
parent
ac26d786
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
82 additions
and
4 deletions
+82
-4
msvcr100.spec
dlls/msvcr100/msvcr100.spec
+1
-1
msvcr80.spec
dlls/msvcr80/msvcr80.spec
+1
-1
msvcr90.spec
dlls/msvcr90/msvcr90.spec
+1
-1
errno.c
dlls/msvcrt/errno.c
+27
-0
msvcrt.spec
dlls/msvcrt/msvcrt.spec
+1
-1
misc.c
dlls/msvcrt/tests/misc.c
+50
-0
string.h
include/msvcrt/string.h
+1
-0
No files found.
dlls/msvcr100/msvcr100.spec
View file @
b7a74d24
...
...
@@ -1581,7 +1581,7 @@
@ cdecl strcpy_s(ptr long str) msvcrt.strcpy_s
@ cdecl strcspn(str str) msvcrt.strcspn
@ cdecl strerror(long) msvcrt.strerror
@
stub
strerror_s
@
cdecl strerror_s(ptr long long) msvcrt.
strerror_s
@ cdecl strftime(str long str ptr) msvcrt.strftime
@ cdecl strlen(str) msvcrt.strlen
@ cdecl strncat(str str long) msvcrt.strncat
...
...
dlls/msvcr80/msvcr80.spec
View file @
b7a74d24
...
...
@@ -1435,7 +1435,7 @@
@ cdecl strcpy_s(ptr long str) msvcrt.strcpy_s
@ cdecl strcspn(str str) msvcrt.strcspn
@ cdecl strerror(long) msvcrt.strerror
@
stub
strerror_s
@
cdecl strerror_s(ptr long long) msvcrt.
strerror_s
@ cdecl strftime(str long str ptr) msvcrt.strftime
@ cdecl strlen(str) msvcrt.strlen
@ cdecl strncat(str str long) msvcrt.strncat
...
...
dlls/msvcr90/msvcr90.spec
View file @
b7a74d24
...
...
@@ -1419,7 +1419,7 @@
@ cdecl strcpy_s(ptr long str) msvcrt.strcpy_s
@ cdecl strcspn(str str) msvcrt.strcspn
@ cdecl strerror(long) msvcrt.strerror
@
stub
strerror_s
@
cdecl strerror_s(ptr long long) msvcrt.
strerror_s
@ cdecl strftime(str long str ptr) msvcrt.strftime
@ cdecl strlen(str) msvcrt.strlen
@ cdecl strncat(str str long) msvcrt.strncat
...
...
dlls/msvcrt/errno.c
View file @
b7a74d24
...
...
@@ -219,6 +219,33 @@ char* CDECL MSVCRT_strerror(int err)
}
/**********************************************************************
* strerror_s (MSVCRT.@)
*/
int
CDECL
strerror_s
(
char
*
buffer
,
MSVCRT_size_t
numberOfElements
,
int
errnum
)
{
char
*
ptr
;
if
(
!
buffer
||
!
numberOfElements
)
{
*
MSVCRT__errno
()
=
MSVCRT_EINVAL
;
return
MSVCRT_EINVAL
;
}
if
(
errnum
<
0
||
errnum
>
MSVCRT__sys_nerr
)
errnum
=
MSVCRT__sys_nerr
;
ptr
=
MSVCRT__sys_errlist
[
errnum
];
while
(
*
ptr
&&
numberOfElements
>
1
)
{
*
buffer
++
=
*
ptr
++
;
numberOfElements
--
;
}
*
buffer
=
'\0'
;
return
0
;
}
/**********************************************************************
* _strerror (MSVCRT.@)
*/
char
*
CDECL
_strerror
(
const
char
*
str
)
...
...
dlls/msvcrt/msvcrt.spec
View file @
b7a74d24
...
...
@@ -1374,7 +1374,7 @@
@ cdecl strcpy_s(ptr long str) MSVCRT_strcpy_s
@ cdecl strcspn(str str) ntdll.strcspn
@ cdecl strerror(long) MSVCRT_strerror
# stub strerror_s
@ cdecl strerror_s(ptr long long)
@ cdecl strftime(str long str ptr) MSVCRT_strftime
@ cdecl strlen(str) ntdll.strlen
@ cdecl strncat(str str long) ntdll.strncat
...
...
dlls/msvcrt/tests/misc.c
View file @
b7a74d24
...
...
@@ -25,6 +25,7 @@
static
int
(
__cdecl
*
prand_s
)(
unsigned
int
*
);
static
int
(
__cdecl
*
pmemcpy_s
)(
void
*
,
MSVCRT_size_t
,
void
*
,
MSVCRT_size_t
);
static
int
(
__cdecl
*
pI10_OUTPUT
)(
long
double
,
int
,
int
,
void
*
);
static
int
(
__cdecl
*
pstrerror_s
)(
char
*
,
MSVCRT_size_t
,
int
);
static
void
init
(
void
)
{
...
...
@@ -33,6 +34,7 @@ static void init(void)
prand_s
=
(
void
*
)
GetProcAddress
(
hmod
,
"rand_s"
);
pmemcpy_s
=
(
void
*
)
GetProcAddress
(
hmod
,
"memcpy_s"
);
pI10_OUTPUT
=
(
void
*
)
GetProcAddress
(
hmod
,
"$I10_OUTPUT"
);
pstrerror_s
=
(
void
*
)
GetProcAddress
(
hmod
,
"strerror_s"
);
}
static
void
test_rand_s
(
void
)
...
...
@@ -192,6 +194,53 @@ static void test_I10_OUTPUT(void)
}
}
static
void
test_strerror_s
(
void
)
{
int
ret
;
char
buf
[
256
];
if
(
!
pstrerror_s
)
{
win_skip
(
"strerror_s is not available
\n
"
);
return
;
}
errno
=
EBADF
;
ret
=
pstrerror_s
(
NULL
,
0
,
0
);
ok
(
ret
==
EINVAL
,
"Expected strerror_s to return EINVAL, got %d
\n
"
,
ret
);
ok
(
errno
==
EINVAL
,
"Expected errno to be EINVAL, got %d
\n
"
,
errno
);
errno
=
EBADF
;
ret
=
pstrerror_s
(
NULL
,
sizeof
(
buf
),
0
);
ok
(
ret
==
EINVAL
,
"Expected strerror_s to return EINVAL, got %d
\n
"
,
ret
);
ok
(
errno
==
EINVAL
,
"Expected errno to be EINVAL, got %d
\n
"
,
errno
);
memset
(
buf
,
'X'
,
sizeof
(
buf
));
errno
=
EBADF
;
ret
=
pstrerror_s
(
buf
,
0
,
0
);
ok
(
ret
==
EINVAL
,
"Expected strerror_s to return EINVAL, got %d
\n
"
,
ret
);
ok
(
errno
==
EINVAL
,
"Expected errno to be EINVAL, got %d
\n
"
,
errno
);
ok
(
buf
[
0
]
==
'X'
,
"Expected output buffer to be untouched
\n
"
);
memset
(
buf
,
'X'
,
sizeof
(
buf
));
ret
=
pstrerror_s
(
buf
,
1
,
0
);
ok
(
ret
==
0
,
"Expected strerror_s to return 0, got %d
\n
"
,
ret
);
ok
(
strlen
(
buf
)
==
0
,
"Expected output buffer to be null terminated
\n
"
);
memset
(
buf
,
'X'
,
sizeof
(
buf
));
ret
=
pstrerror_s
(
buf
,
2
,
0
);
ok
(
ret
==
0
,
"Expected strerror_s to return 0, got %d
\n
"
,
ret
);
ok
(
strlen
(
buf
)
==
1
,
"Expected output buffer to be truncated
\n
"
);
memset
(
buf
,
'X'
,
sizeof
(
buf
));
ret
=
pstrerror_s
(
buf
,
sizeof
(
buf
),
0
);
ok
(
ret
==
0
,
"Expected strerror_s to return 0, got %d
\n
"
,
ret
);
memset
(
buf
,
'X'
,
sizeof
(
buf
));
ret
=
pstrerror_s
(
buf
,
sizeof
(
buf
),
-
1
);
ok
(
ret
==
0
,
"Expected strerror_s to return 0, got %d
\n
"
,
ret
);
}
START_TEST
(
misc
)
{
init
();
...
...
@@ -199,4 +248,5 @@ START_TEST(misc)
test_rand_s
();
test_memcpy_s
();
test_I10_OUTPUT
();
test_strerror_s
();
}
include/msvcrt/string.h
View file @
b7a74d24
...
...
@@ -44,6 +44,7 @@ static inline void* memccpy(void *s1, const void *s2, int c, size_t n) { return
int
__cdecl
_strcmpi
(
const
char
*
,
const
char
*
);
char
*
__cdecl
_strdup
(
const
char
*
);
char
*
__cdecl
_strerror
(
const
char
*
);
errno_t
__cdecl
strerror_s
(
char
*
,
size_t
,
int
);
int
__cdecl
_stricmp
(
const
char
*
,
const
char
*
);
int
__cdecl
_stricoll
(
const
char
*
,
const
char
*
);
char
*
__cdecl
_strlwr
(
char
*
);
...
...
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