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
5b36a00b
Commit
5b36a00b
authored
Jul 01, 2022
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Add bsearch_s.
Implementation copied from msvcrt. Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d1cc31ce
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
4 deletions
+19
-4
misc.c
dlls/ntdll/misc.c
+18
-4
ntdll.spec
dlls/ntdll/ntdll.spec
+1
-0
No files found.
dlls/ntdll/misc.c
View file @
5b36a00b
...
...
@@ -179,18 +179,21 @@ void __cdecl qsort( void *base, size_t nmemb, size_t size,
/*********************************************************************
* bsearch (NTDLL.@)
* bsearch
_s
(NTDLL.@)
*/
void
*
__cdecl
bsearch
(
const
void
*
key
,
const
void
*
base
,
size_t
nmemb
,
size_t
size
,
int
(
__cdecl
*
compar
)(
const
void
*
,
const
void
*
)
)
void
*
__cdecl
bsearch
_s
(
const
void
*
key
,
const
void
*
base
,
size_t
nmemb
,
size_t
size
,
int
(
__cdecl
*
compare
)(
void
*
,
const
void
*
,
const
void
*
),
void
*
ctx
)
{
ssize_t
min
=
0
;
ssize_t
max
=
nmemb
-
1
;
if
(
!
size
)
return
NULL
;
if
(
!
compare
)
return
NULL
;
while
(
min
<=
max
)
{
ssize_t
cursor
=
min
+
(
max
-
min
)
/
2
;
int
ret
=
compar
(
key
,(
const
char
*
)
base
+
(
cursor
*
size
));
int
ret
=
compar
e
(
ctx
,
key
,(
const
char
*
)
base
+
(
cursor
*
size
));
if
(
!
ret
)
return
(
char
*
)
base
+
(
cursor
*
size
);
if
(
ret
<
0
)
...
...
@@ -203,6 +206,17 @@ void * __cdecl bsearch( const void *key, const void *base, size_t nmemb,
/*********************************************************************
* bsearch (NTDLL.@)
*/
void
*
__cdecl
bsearch
(
const
void
*
key
,
const
void
*
base
,
size_t
nmemb
,
size_t
size
,
int
(
__cdecl
*
compar
)(
const
void
*
,
const
void
*
)
)
{
return
bsearch_s
(
key
,
base
,
nmemb
,
size
,
compare_wrapper
,
compar
);
}
/*********************************************************************
* _lfind (NTDLL.@)
*/
void
*
__cdecl
_lfind
(
const
void
*
key
,
const
void
*
base
,
unsigned
int
*
nmemb
,
...
...
dlls/ntdll/ntdll.spec
View file @
5b36a00b
...
...
@@ -1566,6 +1566,7 @@
@ cdecl atoi(str)
@ cdecl atol(str)
@ cdecl bsearch(ptr ptr long long ptr)
@ cdecl bsearch_s(ptr ptr long long ptr ptr)
@ cdecl ceil(double)
@ cdecl cos(double)
@ cdecl fabs(double)
...
...
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