msvcrt: Add bsearch_s implementation by reusing code and tests from ntdll (try 3)

Alexandre Julliard julliard at winehq.org
Mon Apr 9 10:07:01 CDT 2012


André Hentschel <nerv at dawncrow.de> writes:

> @@ -124,6 +124,39 @@ void* CDECL _lsearch(const void* match, void* start,
>  }
>  
>  /*********************************************************************
> + *                  bsearch_s (msvcrt.@)
> + */
> +void* CDECL MSVCRT_bsearch_s(const void *key, const void *base,
> +                             MSVCRT_size_t nmemb, MSVCRT_size_t size,
> +                             int (__cdecl *compare)(void *, const void *, const void *), void *ctx)
> +{
> +    ssize_t min = 0;
> +    ssize_t max;
> +
> +    if (!MSVCRT_CHECK_PMT(key != NULL) || !MSVCRT_CHECK_PMT(base != NULL) ||
> +        !MSVCRT_CHECK_PMT(nmemb != 0) || !MSVCRT_CHECK_PMT(size != 0) ||
> +        !MSVCRT_CHECK_PMT(compare != NULL) || !MSVCRT_CHECK_PMT(ctx != NULL))
> +    {

Some of these look suspicious, you need more tests.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list