Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / OS_NS_strings.cpp
blob964549785ad4a170706c0e5a01f539706cef1220
1 #include "ace/OS_NS_strings.h"
4 #if !defined (ACE_HAS_INLINED_OSCALLS)
5 # include "ace/OS_NS_strings.inl"
6 #endif /* ACE_HAS_INLINED_OSCALLS */
8 #if defined (ACE_LACKS_STRCASECMP)
9 # include "ace/OS_NS_ctype.h"
10 #endif /* ACE_LACKS_STRCASECMP */
12 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
14 #if defined (ACE_LACKS_STRCASECMP)
15 int
16 ACE_OS::strcasecmp_emulation (const char *s, const char *t)
18 const char *scan1 = s;
19 const char *scan2 = t;
21 while (*scan1 != 0
22 && ACE_OS::ace_tolower (*scan1)
23 == ACE_OS::ace_tolower (*scan2))
25 ++scan1;
26 ++scan2;
29 // The following case analysis is necessary so that characters which
30 // look negative collate low against normal characters but high
31 // against the end-of-string NUL.
33 if (*scan1 == '\0' && *scan2 == '\0')
34 return 0;
35 else if (*scan1 == '\0')
36 return -1;
37 else if (*scan2 == '\0')
38 return 1;
39 else
40 return ACE_OS::ace_tolower (*scan1) - ACE_OS::ace_tolower (*scan2);
42 #endif /* ACE_LACKS_STRCASECMP */
44 #if defined (ACE_LACKS_STRCASECMP)
45 int
46 ACE_OS::strncasecmp_emulation (const char *s,
47 const char *t,
48 size_t len)
50 const char *scan1 = s;
51 const char *scan2 = t;
52 size_t count = 0;
54 while (count++ < len
55 && *scan1 != 0
56 && ACE_OS::ace_tolower (*scan1)
57 == ACE_OS::ace_tolower (*scan2))
59 ++scan1;
60 ++scan2;
63 if (count > len)
64 return 0;
66 // The following case analysis is necessary so that characters which
67 // look negative collate low against normal characters but high
68 // against the end-of-string NUL.
70 if (*scan1 == '\0' && *scan2 == '\0')
71 return 0;
72 else if (*scan1 == '\0')
73 return -1;
74 else if (*scan2 == '\0')
75 return 1;
76 else
77 return ACE_OS::ace_tolower (*scan1) - ACE_OS::ace_tolower (*scan2);
79 #endif /* ACE_LACKS_STRCASECMP */
81 ACE_END_VERSIONED_NAMESPACE_DECL