diff --git a/mozilla/base/src/nsCRT.cpp b/mozilla/base/src/nsCRT.cpp index 4bb16d4a082..05aa8bb2b8d 100644 --- a/mozilla/base/src/nsCRT.cpp +++ b/mozilla/base/src/nsCRT.cpp @@ -154,7 +154,7 @@ PRInt32 nsCRT::strlen(const PRUnichar* s) * NOTE: If both are null, we return 0. * @update gess7/30/98 * @param s1 and s2 both point to unichar strings - * @return 1 if they match, 0 if not + * @return 0 if they match, -1 if s1s2 */ PRInt32 nsCRT::strcmp(const PRUnichar* s1, const PRUnichar* s2) { @@ -177,7 +177,7 @@ PRInt32 nsCRT::strcmp(const PRUnichar* s1, const PRUnichar* s2) * NOTE: If either is null, we return 0. * @update gess7/30/98 * @param s1 and s2 both point to unichar strings - * @return 1 if they match, 0 if not + * @return 0 if they match, -1 if s1s2 */ PRInt32 nsCRT::strncmp(const PRUnichar* s1, const PRUnichar* s2, PRInt32 n) { @@ -204,7 +204,7 @@ PRInt32 nsCRT::strncmp(const PRUnichar* s1, const PRUnichar* s2, PRInt32 n) * NOTE: If both are null, we return 0. * @update gess7/30/98 * @param s1 and s2 both point to unichar strings - * @return 1 if they match, 0 if not + * @return 0 if they match, -1 if s1s2 */ PRInt32 nsCRT::strcasecmp(const PRUnichar* s1, const PRUnichar* s2) { @@ -232,7 +232,7 @@ PRInt32 nsCRT::strcasecmp(const PRUnichar* s1, const PRUnichar* s2) * NOTE: If both are null, we return 0. * @update gess7/30/98 * @param s1 and s2 both point to unichar strings - * @return 1 if they match, 0 if not + * @return 0 if they match, -1 if s1s2 */ PRInt32 nsCRT::strncasecmp(const PRUnichar* s1, const PRUnichar* s2, PRInt32 n) { @@ -263,7 +263,7 @@ PRInt32 nsCRT::strncasecmp(const PRUnichar* s1, const PRUnichar* s2, PRInt32 n) * @update gess7/30/98 * @param s1 points to unichar string * @param s2 points to cstring - * @return 1 if they match, 0 if not + * @return 0 if they match, -1 if s1s2 */ PRInt32 nsCRT::strcmp(const PRUnichar* s1, const char* s2) { @@ -288,7 +288,7 @@ PRInt32 nsCRT::strcmp(const PRUnichar* s1, const char* s2) * @update gess7/30/98 * @param s1 points to unichar string * @param s2 points to cstring - * @return 1 if they match, 0 if not + * @return 0 if they match, -1 if s1s2 */ PRInt32 nsCRT::strncmp(const PRUnichar* s1, const char* s2, PRInt32 n) { @@ -314,7 +314,7 @@ PRInt32 nsCRT::strncmp(const PRUnichar* s1, const char* s2, PRInt32 n) * @update gess7/30/98 * @param s1 points to unichar string * @param s2 points to cstring - * @return 1 if they match, 0 if not + * @return 0 if they match, -1 if s1s2 */ PRInt32 nsCRT::strcasecmp(const PRUnichar* s1, const char* s2) { @@ -342,7 +342,7 @@ PRInt32 nsCRT::strcasecmp(const PRUnichar* s1, const char* s2) * @update gess7/30/98 * @param s1 points to unichar string * @param s2 points to cstring - * @return 1 if they match, 0 if not + * @return 0 if they match, -1 if s1s2 */ PRInt32 nsCRT::strncasecmp(const PRUnichar* s1, const char* s2, PRInt32 n) { diff --git a/mozilla/base/src/nsString.cpp b/mozilla/base/src/nsString.cpp index 545004e60c8..33b7d04d6b4 100644 --- a/mozilla/base/src/nsString.cpp +++ b/mozilla/base/src/nsString.cpp @@ -61,8 +61,10 @@ nsString::nsString() { NS_ASSERTION(kCommonEmptyBuffer[0]==0,kFoolMsg); mLength = mCapacity = 0; mStr = kCommonEmptyBuffer; - if(!mSelfTested) + if(!mSelfTested) { + mSelfTested=PR_TRUE; SelfTest(); + } } @@ -1869,7 +1871,7 @@ NS_BASE int fputs(const nsString& aString, FILE* out) * @return */ void nsString::SelfTest(void) { -#if 1 +#if 0 static const char* kConstructorError = kConstructorError; static const char* kComparisonError = "Comparision error!"; @@ -1884,6 +1886,10 @@ void nsString::SelfTest(void) { //first, let's test the constructors... nsString empty; + empty=""; + empty="xxx"; + empty=""; + nsString a(temp); nsString* a_=new nsString(a); //test copy constructor nsString b("world!"); @@ -1961,6 +1967,7 @@ void nsString::SelfTest(void) { const char* bbbb="bbbb"; //First test the string compare routines... + NS_ASSERTION(0>temp8.Compare(temp9),kComparisonError); NS_ASSERTION(0temp8.Compare(temp9),kComparisonError); NS_ASSERTION(0s2 */ PRInt32 nsCRT::strcmp(const PRUnichar* s1, const PRUnichar* s2) { @@ -177,7 +177,7 @@ PRInt32 nsCRT::strcmp(const PRUnichar* s1, const PRUnichar* s2) * NOTE: If either is null, we return 0. * @update gess7/30/98 * @param s1 and s2 both point to unichar strings - * @return 1 if they match, 0 if not + * @return 0 if they match, -1 if s1s2 */ PRInt32 nsCRT::strncmp(const PRUnichar* s1, const PRUnichar* s2, PRInt32 n) { @@ -204,7 +204,7 @@ PRInt32 nsCRT::strncmp(const PRUnichar* s1, const PRUnichar* s2, PRInt32 n) * NOTE: If both are null, we return 0. * @update gess7/30/98 * @param s1 and s2 both point to unichar strings - * @return 1 if they match, 0 if not + * @return 0 if they match, -1 if s1s2 */ PRInt32 nsCRT::strcasecmp(const PRUnichar* s1, const PRUnichar* s2) { @@ -232,7 +232,7 @@ PRInt32 nsCRT::strcasecmp(const PRUnichar* s1, const PRUnichar* s2) * NOTE: If both are null, we return 0. * @update gess7/30/98 * @param s1 and s2 both point to unichar strings - * @return 1 if they match, 0 if not + * @return 0 if they match, -1 if s1s2 */ PRInt32 nsCRT::strncasecmp(const PRUnichar* s1, const PRUnichar* s2, PRInt32 n) { @@ -263,7 +263,7 @@ PRInt32 nsCRT::strncasecmp(const PRUnichar* s1, const PRUnichar* s2, PRInt32 n) * @update gess7/30/98 * @param s1 points to unichar string * @param s2 points to cstring - * @return 1 if they match, 0 if not + * @return 0 if they match, -1 if s1s2 */ PRInt32 nsCRT::strcmp(const PRUnichar* s1, const char* s2) { @@ -288,7 +288,7 @@ PRInt32 nsCRT::strcmp(const PRUnichar* s1, const char* s2) * @update gess7/30/98 * @param s1 points to unichar string * @param s2 points to cstring - * @return 1 if they match, 0 if not + * @return 0 if they match, -1 if s1s2 */ PRInt32 nsCRT::strncmp(const PRUnichar* s1, const char* s2, PRInt32 n) { @@ -314,7 +314,7 @@ PRInt32 nsCRT::strncmp(const PRUnichar* s1, const char* s2, PRInt32 n) * @update gess7/30/98 * @param s1 points to unichar string * @param s2 points to cstring - * @return 1 if they match, 0 if not + * @return 0 if they match, -1 if s1s2 */ PRInt32 nsCRT::strcasecmp(const PRUnichar* s1, const char* s2) { @@ -342,7 +342,7 @@ PRInt32 nsCRT::strcasecmp(const PRUnichar* s1, const char* s2) * @update gess7/30/98 * @param s1 points to unichar string * @param s2 points to cstring - * @return 1 if they match, 0 if not + * @return 0 if they match, -1 if s1s2 */ PRInt32 nsCRT::strncasecmp(const PRUnichar* s1, const char* s2, PRInt32 n) { diff --git a/mozilla/xpcom/ds/nsString.cpp b/mozilla/xpcom/ds/nsString.cpp index 545004e60c8..33b7d04d6b4 100644 --- a/mozilla/xpcom/ds/nsString.cpp +++ b/mozilla/xpcom/ds/nsString.cpp @@ -61,8 +61,10 @@ nsString::nsString() { NS_ASSERTION(kCommonEmptyBuffer[0]==0,kFoolMsg); mLength = mCapacity = 0; mStr = kCommonEmptyBuffer; - if(!mSelfTested) + if(!mSelfTested) { + mSelfTested=PR_TRUE; SelfTest(); + } } @@ -1869,7 +1871,7 @@ NS_BASE int fputs(const nsString& aString, FILE* out) * @return */ void nsString::SelfTest(void) { -#if 1 +#if 0 static const char* kConstructorError = kConstructorError; static const char* kComparisonError = "Comparision error!"; @@ -1884,6 +1886,10 @@ void nsString::SelfTest(void) { //first, let's test the constructors... nsString empty; + empty=""; + empty="xxx"; + empty=""; + nsString a(temp); nsString* a_=new nsString(a); //test copy constructor nsString b("world!"); @@ -1961,6 +1967,7 @@ void nsString::SelfTest(void) { const char* bbbb="bbbb"; //First test the string compare routines... + NS_ASSERTION(0>temp8.Compare(temp9),kComparisonError); NS_ASSERTION(0temp8.Compare(temp9),kComparisonError); NS_ASSERTION(0