]> git.saurik.com Git - wxWidgets.git/blob - src/msw/wince/crt.cpp
make sure we are comparing the stripped strings
[wxWidgets.git] / src / msw / wince / crt.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wince/crt.cpp
3 // Purpose: Implementation of CRT functions missing under Windows CE
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 03.04.04
7 // RCS-ID:
8 // Copyright: (c) 2004 Vadim Zeitlin <vadim@wxwindows.org>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/wxprec.h"
13
14 #ifdef __BORLANDC__
15 #pragma hdrstop
16 #endif
17
18 #ifndef WX_PRECOMP
19 #include "wx/app.h"
20 #endif
21
22 #include "wx/msw/wince/missing.h"
23
24 extern "C" void *
25 bsearch(const void *key, const void *base, size_t num, size_t size,
26 int (wxCMPFUNC_CONV *cmp)(const void *, const void *))
27 {
28 int res;
29 char *mid;
30
31 char *lo = (char *)base;
32 char *hi = lo + num*size;
33 while ( lo < hi )
34 {
35 mid = lo + (hi - lo)/2;
36
37 res = (*cmp)(key, mid);
38 if ( res < 0 )
39 hi = mid;
40 else if ( res > 0 )
41 lo = mid + size;
42 else // res == 0
43 return mid;
44 }
45
46 return NULL;
47 }
48
49 extern "C"
50 void abort()
51 {
52 wxString name;
53 if ( wxTheApp )
54 name = wxTheApp->GetAppName();
55 if ( name.empty() )
56 name = L"wxWindows Application";
57
58 MessageBox(NULL, L"Abnormal program termination", name, MB_ICONHAND | MB_OK);
59
60 ::ExitProcess(3);
61 }
62
63 extern "C"
64 char *getenv(const char * WXUNUSED(name))
65 {
66 // no way to implement it in Unicode-only environment without using
67 // wxCharBuffer and it is of no use in C code which uses this function
68 // (libjpeg)
69 return NULL;
70 }
71