implemented bsearch() for CE; added src/msw/wince/crt.cpp

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26596 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2004-04-04 12:30:54 +00:00
parent 34952e03e2
commit e3bf2e8cac
2 changed files with 46 additions and 0 deletions

View File

@ -1314,6 +1314,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/generic/dirdlgg.cpp
src/generic/fdrepdlg.cpp
src/generic/fontdlgg.cpp
src/msw/wince/crt.cpp
src/msw/wince/filedlgwce.cpp
src/msw/wince/helpwce.cpp
src/msw/wince/tbarwce.cpp

45
src/msw/wince/crt.cpp Normal file
View File

@ -0,0 +1,45 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wince/crt.cpp
// Purpose: Implementation of CRT functions missing under Windows CE
// Author: Vadim Zeitlin
// Modified by:
// Created: 03.04.04
// RCS-ID:
// Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#include "wx/msw/wince/missing.h"
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
extern "C" void *
bsearch(const void *key, const void *base, size_t num, size_t size,
int (wxCMPFUNC_CONV *cmp)(const void *, const void *))
{
int res;
char *mid;
char *lo = (char *)base;
char *hi = lo + num*size;
while ( lo < hi )
{
mid = lo + (hi - lo)/2;
res = (*cmp)(key, mid);
if ( res < 0 )
hi = mid;
else if ( res > 0 )
lo = mid + size;
else // res == 0
return mid;
}
return NULL;
}