summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjxh <jxh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-12-12 09:00:21 +0000
committerjxh <jxh@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1997-12-12 09:00:21 +0000
commitc4718c91ead3716a51b4eef6058ad9c702bc26df (patch)
tree91a3a0bce4a42a0da141e7303743a20c1f7ccfaf
parent3f9b018b890e454d69c7f0d752962ffb13a5f7cb (diff)
downloadATCD-c4718c91ead3716a51b4eef6058ad9c702bc26df.tar.gz
Re-implemented strcasecmp methods. Thought bad implementations were
related to a JAWS bug, but the the hand implementations are not used on Solaris.
-rw-r--r--ace/OS.i52
1 files changed, 22 insertions, 30 deletions
diff --git a/ace/OS.i b/ace/OS.i
index 9c002f69fc6..c488da5f870 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -1118,21 +1118,17 @@ ACE_OS::strcasecmp (const char *s, const char *t)
// equal.
int result = 0;
- if (ACE_OS::strlen (s) != ACE_OS::strlen (t))
- result = 1;
- else
- {
- for (;
- *s != '\0' && *t != '\0';
- ++s, ++t)
- if (ACE_OS::to_lower (*s) != ACE_OS::to_lower (*t))
- {
- result = ((ACE_OS::to_lower (*s) < ACE_OS::to_lower (*t)) ? -1 : 1);
- break;
- }
- }
-
- return result; // == 0 for match, else 1
+ do
+ {
+ int a = ACE_OS::to_lower (*s);
+ int b = ACE_OS::to_lower (*t);
+ result = ((a < b) ? -1 : (a > b));
+ if (result != 0)
+ break;
+ } while (*s++ != '\0' && *t++ != '\0');
+ // paranoid termination condition
+
+ return result; // == 0 for match, else 1
#else
return ::strcasecmp (s, t);
#endif /* ACE_LACKS_STRCASECMP */
@@ -7536,21 +7532,17 @@ ACE_OS::strcasecmp (const wchar_t *s, const wchar_t *t)
// equal.
int result = 0;
- if (ACE_OS::strlen (s) != ACE_OS::strlen (t))
- result = 1;
- else
- {
- for (;
- *s != '\0' && *t != '\0';
- ++s, ++t)
- if (ACE_OS::to_lower (*s) != ACE_OS::to_lower (*t))
- {
- result = ((ACE_OS::to_lower (*s) < ACE_OS::to_lower (*t)) ? -1 : 1);
- break;
- }
- }
-
- return result; // == 0 for match, else 1
+ do
+ {
+ int a = ACE_OS::to_lower (*s);
+ int b = ACE_OS::to_lower (*t);
+ result = ((a < b) ? -1 : (a > b));
+ if (result != 0)
+ break;
+ } while (*s++ != '\0' && *t++ != '\0');
+ // paranoid termination condition
+
+ return result; // == 0 for match, else 1
#else /* ACE_WIN32 */
return ::_wcsicmp (s, t);