msvcrt: Add bsearch_s implementation by reusing code and tests from ntdll (try 4)
Alexandre Julliard
julliard at winehq.org
Tue Apr 10 07:53:24 CDT 2012
André Hentschel <nerv at dawncrow.de> writes:
> /*********************************************************************
> + * 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(size != 0) || !MSVCRT_CHECK_PMT(compare != NULL))
> + {
> + *MSVCRT__errno() = MSVCRT_EINVAL;
> + return NULL;
> + }
> +
> + if (!MSVCRT_CHECK_PMT(nmemb != 0) || !MSVCRT_CHECK_PMT(ctx != NULL))
> + {
> + *MSVCRT__errno() = 0;
> + return NULL;
> + }
That looks even more suspicious...
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list