diff options
author | Steve Huston <shuston@riverace.com> | 2003-02-07 00:51:51 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2003-02-07 00:51:51 +0000 |
commit | 497e425414d29e3129c4f62484f0e251b3f4e86e (patch) | |
tree | 0f2a93009a1ca374d11ffdbb271e93da0071a88d | |
parent | 2776cf328f852204d27e0c5c43a8b4f89330b653 (diff) | |
download | ATCD-497e425414d29e3129c4f62484f0e251b3f4e86e.tar.gz |
ChangeLogTag:Thu Feb 6 19:30:18 2003 Steve Huston <shuston@riverace.com>
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 10 | ||||
-rw-r--r-- | ace/String_Base.i | 2 | ||||
-rw-r--r-- | tests/SString_Test.cpp | 16 |
4 files changed, 30 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog index c7b3eedff2e..768aa5ee6b6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Thu Feb 6 19:30:18 2003 Steve Huston <shuston@riverace.com> + + * tests/SString_Test.cpp: Added a test for wide-string compares of + equal-length strings that differ in the last character. + + * ace/String_Base.i (compare): When memcmp()-ing to compare, take + the size of CHAR into account when calculating byte length. Thanks + to Emmanuel Thevenot Beaufort <emmanuel.thevenot-beaufort@jci.com> + for this fix. + Thu Feb 6 16:06:29 2003 Rich Seibel <seibel_r@ociweb.com> * ace/config-tru64.h: Added a guard around the diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index c7b3eedff2e..768aa5ee6b6 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,13 @@ +Thu Feb 6 19:30:18 2003 Steve Huston <shuston@riverace.com> + + * tests/SString_Test.cpp: Added a test for wide-string compares of + equal-length strings that differ in the last character. + + * ace/String_Base.i (compare): When memcmp()-ing to compare, take + the size of CHAR into account when calculating byte length. Thanks + to Emmanuel Thevenot Beaufort <emmanuel.thevenot-beaufort@jci.com> + for this fix. + Thu Feb 6 16:06:29 2003 Rich Seibel <seibel_r@ociweb.com> * ace/config-tru64.h: Added a guard around the diff --git a/ace/String_Base.i b/ace/String_Base.i index 8f7aeb79078..548285c71a3 100644 --- a/ace/String_Base.i +++ b/ace/String_Base.i @@ -212,7 +212,7 @@ ACE_String_Base<CHAR>::compare (const ACE_String_Base<CHAR> &s) const int result = ACE_OS::memcmp (this->rep_, s.rep_, - smaller_length); + smaller_length * sizeof (CHAR)); if (!result) result = ACE_static_cast (int, (this->len_ - s.len_)); diff --git a/tests/SString_Test.cpp b/tests/SString_Test.cpp index 7dfccc90a90..737659de377 100644 --- a/tests/SString_Test.cpp +++ b/tests/SString_Test.cpp @@ -167,6 +167,7 @@ ACE_TMAIN (int, ACE_TCHAR *[]) ACE_NS_WString s3 ("ll"); ACE_NS_WString s4 ("ello"); ACE_NS_WString s5 = s1 + " " + s2; + ACE_NS_WString s6 = ("hella"); // Same length as s1, off by one char. ACE_WCHAR_T single_character = 'z'; ACE_NS_WString single_character_string (single_character); @@ -177,6 +178,7 @@ ACE_TMAIN (int, ACE_TCHAR *[]) // Not equal comparisons. Error if they are equal if (s1 == s2){ACE_ERROR((LM_ERROR,"Set #3: \n"));} if (s1 == s5){ACE_ERROR((LM_ERROR,"Set #3: \n"));} + if (s1 == s6){ACE_ERROR((LM_ERROR,"Set #3: off-by-one failed\n"));} // Equal comparisons. Error if they are not equal if (s1 != s1){ACE_ERROR((LM_ERROR,"Set #3: \n"));} @@ -207,13 +209,13 @@ ACE_TMAIN (int, ACE_TCHAR *[]) if (s1.rfind ('l', 3) != 2){ACE_ERROR((LM_ERROR,"Set #3: \n"));} // Assignment. Error if they are not equal - ACE_NS_WString s6; - s6 = s0; - if (s6 != s0){ACE_ERROR((LM_ERROR,"Set #3: \n"));} - s6 = s4; - if (s4 != s6){ACE_ERROR((LM_ERROR,"Set #3: \n"));} - s6 = s5; - if (s6 != s5){ACE_ERROR((LM_ERROR,"Set #3: \n"));} + ACE_NS_WString s7; + s7 = s0; + if (s7 != s0){ACE_ERROR((LM_ERROR,"Set #3: \n"));} + s7 = s4; + if (s4 != s7){ACE_ERROR((LM_ERROR,"Set #3: \n"));} + s7 = s5; + if (s7 != s5){ACE_ERROR((LM_ERROR,"Set #3: \n"));} // Clear. Error if they are not equal s0.clear(); |