aboutsummaryrefslogtreecommitdiff
path: root/externals/ace/OS_NS_strings.cpp
diff options
context:
space:
mode:
authorRat <none@none>2010-06-07 19:10:55 +0200
committerRat <none@none>2010-06-07 19:10:55 +0200
commit32546e22828e793e3881e1055acb72b6a044e331 (patch)
tree759706cdfe8423887c69a2f8ed651c0c1e5ab7d7 /externals/ace/OS_NS_strings.cpp
parent2e0f8fb6e558088b33bdee83bc5ff20014e983b3 (diff)
added ace + vcproj for win
--HG-- branch : trunk
Diffstat (limited to 'externals/ace/OS_NS_strings.cpp')
-rw-r--r--externals/ace/OS_NS_strings.cpp84
1 files changed, 84 insertions, 0 deletions
diff --git a/externals/ace/OS_NS_strings.cpp b/externals/ace/OS_NS_strings.cpp
new file mode 100644
index 00000000000..5b5cfcf4917
--- /dev/null
+++ b/externals/ace/OS_NS_strings.cpp
@@ -0,0 +1,84 @@
+// $Id: OS_NS_strings.cpp 80826 2008-03-04 14:51:23Z wotte $
+
+#include "ace/OS_NS_strings.h"
+
+ACE_RCSID(ace, OS_NS_strings, "$Id: OS_NS_strings.cpp 80826 2008-03-04 14:51:23Z wotte $")
+
+#if !defined (ACE_HAS_INLINED_OSCALLS)
+# include "ace/OS_NS_strings.inl"
+#endif /* ACE_HAS_INLINED_OSCALLS */
+
+#if defined (ACE_LACKS_STRCASECMP)
+# include "ace/OS_NS_ctype.h"
+#endif /* ACE_LACKS_STRCASECMP */
+
+ACE_BEGIN_VERSIONED_NAMESPACE_DECL
+
+#if defined (ACE_LACKS_STRCASECMP)
+int
+ACE_OS::strcasecmp_emulation (const char *s, const char *t)
+{
+ const char *scan1 = s;
+ const char *scan2 = t;
+
+ while (*scan1 != 0
+ && ACE_OS::ace_tolower (*scan1)
+ == ACE_OS::ace_tolower (*scan2))
+ {
+ ++scan1;
+ ++scan2;
+ }
+
+ // The following case analysis is necessary so that characters which
+ // look negative collate low against normal characters but high
+ // against the end-of-string NUL.
+
+ if (*scan1 == '\0' && *scan2 == '\0')
+ return 0;
+ else if (*scan1 == '\0')
+ return -1;
+ else if (*scan2 == '\0')
+ return 1;
+ else
+ return ACE_OS::ace_tolower (*scan1) - ACE_OS::ace_tolower (*scan2);
+}
+#endif /* ACE_LACKS_STRCASECMP */
+
+#if defined (ACE_LACKS_STRCASECMP)
+int
+ACE_OS::strncasecmp_emulation (const char *s,
+ const char *t,
+ size_t len)
+{
+ const char *scan1 = s;
+ const char *scan2 = t;
+ size_t count = 0;
+
+ while (count++ < len
+ && *scan1 != 0
+ && ACE_OS::ace_tolower (*scan1)
+ == ACE_OS::ace_tolower (*scan2))
+ {
+ ++scan1;
+ ++scan2;
+ }
+
+ if (count > len)
+ return 0;
+
+ // The following case analysis is necessary so that characters which
+ // look negative collate low against normal characters but high
+ // against the end-of-string NUL.
+
+ if (*scan1 == '\0' && *scan2 == '\0')
+ return 0;
+ else if (*scan1 == '\0')
+ return -1;
+ else if (*scan2 == '\0')
+ return 1;
+ else
+ return ACE_OS::ace_tolower (*scan1) - ACE_OS::ace_tolower (*scan2);
+}
+#endif /* ACE_LACKS_STRCASECMP */
+
+ACE_END_VERSIONED_NAMESPACE_DECL