From a321381b944589b7aa0b741d33359b04cadebbea Mon Sep 17 00:00:00 2001 From: "rickg%netscape.com" Date: Mon, 15 Nov 1999 17:10:06 +0000 Subject: [PATCH] reenabled safer version of assertion git-svn-id: svn://10.0.0.236/trunk@53516 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/string/obsolete/nsString.cpp | 18 ++++++---------- mozilla/string/obsolete/nsString2.cpp | 24 +++++++-------------- mozilla/xpcom/ds/nsString.cpp | 18 ++++++---------- mozilla/xpcom/ds/nsString2.cpp | 24 +++++++-------------- mozilla/xpcom/string/obsolete/nsString.cpp | 18 ++++++---------- mozilla/xpcom/string/obsolete/nsString2.cpp | 24 +++++++-------------- 6 files changed, 42 insertions(+), 84 deletions(-) diff --git a/mozilla/string/obsolete/nsString.cpp b/mozilla/string/obsolete/nsString.cpp index 1270c8a5abf..775bf310754 100644 --- a/mozilla/string/obsolete/nsString.cpp +++ b/mozilla/string/obsolete/nsString.cpp @@ -795,10 +795,8 @@ nsCString& nsCString::Assign(const PRUnichar* aString,PRInt32 aCount) { // If this assertion fires, the caller is probably lying about the length of // the passed-in string. File a bug on the caller. #ifdef NS_DEBUG -#if 0 - PRInt32 len=nsCRT::strlen(aString); - NS_WARN_IF_FALSE(len>=aCount,"possible embedded null in Assign(PRUnichar*)"); -#endif + PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0); + NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in Assign(PRUnichar*)"); #endif } @@ -905,10 +903,8 @@ nsCString& nsCString::Append(const char* aCString,PRInt32 aCount) { // the passed-in string. File a bug on the caller. #ifdef NS_DEBUG -#if 0 - PRInt32 len=strlen(aCString); - NS_WARN_IF_FALSE(len>=aCount,"possible embedded null in append(char*)"); -#endif + PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0); + NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in append(char*)"); #endif } else aCount=temp.mLength=nsCRT::strlen(aCString); @@ -1094,10 +1090,8 @@ nsCString& nsCString::Insert(const char* aCString,PRUint32 anOffset,PRInt32 aCou // If this assertion fires, the caller is probably lying about the length of // the passed-in string. File a bug on the caller. #ifdef NS_DEBUG -#if 0 - PRInt32 len=strlen(aCString); - NS_WARN_IF_FALSE(len>=aCount,"possible embedded null in Insert(char*)"); -#endif + PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0); + NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in Insert(char*)"); #endif } diff --git a/mozilla/string/obsolete/nsString2.cpp b/mozilla/string/obsolete/nsString2.cpp index 7475b427df2..e1932cf0146 100644 --- a/mozilla/string/obsolete/nsString2.cpp +++ b/mozilla/string/obsolete/nsString2.cpp @@ -1044,10 +1044,8 @@ nsString& nsString::Append(const char* aCString,PRInt32 aCount) { // the passed-in string. File a bug on the caller. #ifdef NS_DEBUG -#if 0 - PRInt32 len=strlen(aCString); - NS_WARN_IF_FALSE(len>=aCount,"possible embedded null in append(char*)"); -#endif + PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0); + NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in append(char*)"); #endif } @@ -1078,10 +1076,8 @@ nsString& nsString::Append(const PRUnichar* aString,PRInt32 aCount) { // If this assertion fires, the caller is probably lying about the length of // the passed-in string. File a bug on the caller. #ifdef NS_DEBUG -#if 0 - PRInt32 len=nsCRT::strlen(aString); - NS_WARN_IF_FALSE(len>=aCount,"possible embedded null in append(PRUnichar*)"); -#endif + PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0); + NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in append(PRUnichar*)"); #endif } @@ -1270,10 +1266,8 @@ nsString& nsString::Insert(const char* aCString,PRUint32 anOffset,PRInt32 aCount // If this assertion fires, the caller is probably lying about the length of // the passed-in string. File a bug on the caller. #ifdef NS_DEBUG -#if 0 - PRInt32 len=strlen(aCString); - NS_WARN_IF_FALSE(len>=aCount,"possible embedded null in Insert(char*)"); -#endif + PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0); + NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in Insert(char*)"); #endif } @@ -1307,10 +1301,8 @@ nsString& nsString::Insert(const PRUnichar* aString,PRUint32 anOffset,PRInt32 aC // If this assertion fires, the caller is probably lying about the length of // the passed-in string. File a bug on the caller. #ifdef NS_DEBUG -#if 0 - PRInt32 len=nsCRT::strlen(aString); - NS_WARN_IF_FALSE(len>=aCount,"possible embedded null in Insert(PRUnichar*)"); -#endif + PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0); + NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in Insert(PRUnichar*)"); #endif } diff --git a/mozilla/xpcom/ds/nsString.cpp b/mozilla/xpcom/ds/nsString.cpp index 1270c8a5abf..775bf310754 100644 --- a/mozilla/xpcom/ds/nsString.cpp +++ b/mozilla/xpcom/ds/nsString.cpp @@ -795,10 +795,8 @@ nsCString& nsCString::Assign(const PRUnichar* aString,PRInt32 aCount) { // If this assertion fires, the caller is probably lying about the length of // the passed-in string. File a bug on the caller. #ifdef NS_DEBUG -#if 0 - PRInt32 len=nsCRT::strlen(aString); - NS_WARN_IF_FALSE(len>=aCount,"possible embedded null in Assign(PRUnichar*)"); -#endif + PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0); + NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in Assign(PRUnichar*)"); #endif } @@ -905,10 +903,8 @@ nsCString& nsCString::Append(const char* aCString,PRInt32 aCount) { // the passed-in string. File a bug on the caller. #ifdef NS_DEBUG -#if 0 - PRInt32 len=strlen(aCString); - NS_WARN_IF_FALSE(len>=aCount,"possible embedded null in append(char*)"); -#endif + PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0); + NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in append(char*)"); #endif } else aCount=temp.mLength=nsCRT::strlen(aCString); @@ -1094,10 +1090,8 @@ nsCString& nsCString::Insert(const char* aCString,PRUint32 anOffset,PRInt32 aCou // If this assertion fires, the caller is probably lying about the length of // the passed-in string. File a bug on the caller. #ifdef NS_DEBUG -#if 0 - PRInt32 len=strlen(aCString); - NS_WARN_IF_FALSE(len>=aCount,"possible embedded null in Insert(char*)"); -#endif + PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0); + NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in Insert(char*)"); #endif } diff --git a/mozilla/xpcom/ds/nsString2.cpp b/mozilla/xpcom/ds/nsString2.cpp index 7475b427df2..e1932cf0146 100644 --- a/mozilla/xpcom/ds/nsString2.cpp +++ b/mozilla/xpcom/ds/nsString2.cpp @@ -1044,10 +1044,8 @@ nsString& nsString::Append(const char* aCString,PRInt32 aCount) { // the passed-in string. File a bug on the caller. #ifdef NS_DEBUG -#if 0 - PRInt32 len=strlen(aCString); - NS_WARN_IF_FALSE(len>=aCount,"possible embedded null in append(char*)"); -#endif + PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0); + NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in append(char*)"); #endif } @@ -1078,10 +1076,8 @@ nsString& nsString::Append(const PRUnichar* aString,PRInt32 aCount) { // If this assertion fires, the caller is probably lying about the length of // the passed-in string. File a bug on the caller. #ifdef NS_DEBUG -#if 0 - PRInt32 len=nsCRT::strlen(aString); - NS_WARN_IF_FALSE(len>=aCount,"possible embedded null in append(PRUnichar*)"); -#endif + PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0); + NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in append(PRUnichar*)"); #endif } @@ -1270,10 +1266,8 @@ nsString& nsString::Insert(const char* aCString,PRUint32 anOffset,PRInt32 aCount // If this assertion fires, the caller is probably lying about the length of // the passed-in string. File a bug on the caller. #ifdef NS_DEBUG -#if 0 - PRInt32 len=strlen(aCString); - NS_WARN_IF_FALSE(len>=aCount,"possible embedded null in Insert(char*)"); -#endif + PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0); + NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in Insert(char*)"); #endif } @@ -1307,10 +1301,8 @@ nsString& nsString::Insert(const PRUnichar* aString,PRUint32 anOffset,PRInt32 aC // If this assertion fires, the caller is probably lying about the length of // the passed-in string. File a bug on the caller. #ifdef NS_DEBUG -#if 0 - PRInt32 len=nsCRT::strlen(aString); - NS_WARN_IF_FALSE(len>=aCount,"possible embedded null in Insert(PRUnichar*)"); -#endif + PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0); + NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in Insert(PRUnichar*)"); #endif } diff --git a/mozilla/xpcom/string/obsolete/nsString.cpp b/mozilla/xpcom/string/obsolete/nsString.cpp index 1270c8a5abf..775bf310754 100644 --- a/mozilla/xpcom/string/obsolete/nsString.cpp +++ b/mozilla/xpcom/string/obsolete/nsString.cpp @@ -795,10 +795,8 @@ nsCString& nsCString::Assign(const PRUnichar* aString,PRInt32 aCount) { // If this assertion fires, the caller is probably lying about the length of // the passed-in string. File a bug on the caller. #ifdef NS_DEBUG -#if 0 - PRInt32 len=nsCRT::strlen(aString); - NS_WARN_IF_FALSE(len>=aCount,"possible embedded null in Assign(PRUnichar*)"); -#endif + PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0); + NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in Assign(PRUnichar*)"); #endif } @@ -905,10 +903,8 @@ nsCString& nsCString::Append(const char* aCString,PRInt32 aCount) { // the passed-in string. File a bug on the caller. #ifdef NS_DEBUG -#if 0 - PRInt32 len=strlen(aCString); - NS_WARN_IF_FALSE(len>=aCount,"possible embedded null in append(char*)"); -#endif + PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0); + NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in append(char*)"); #endif } else aCount=temp.mLength=nsCRT::strlen(aCString); @@ -1094,10 +1090,8 @@ nsCString& nsCString::Insert(const char* aCString,PRUint32 anOffset,PRInt32 aCou // If this assertion fires, the caller is probably lying about the length of // the passed-in string. File a bug on the caller. #ifdef NS_DEBUG -#if 0 - PRInt32 len=strlen(aCString); - NS_WARN_IF_FALSE(len>=aCount,"possible embedded null in Insert(char*)"); -#endif + PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0); + NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in Insert(char*)"); #endif } diff --git a/mozilla/xpcom/string/obsolete/nsString2.cpp b/mozilla/xpcom/string/obsolete/nsString2.cpp index 7475b427df2..e1932cf0146 100644 --- a/mozilla/xpcom/string/obsolete/nsString2.cpp +++ b/mozilla/xpcom/string/obsolete/nsString2.cpp @@ -1044,10 +1044,8 @@ nsString& nsString::Append(const char* aCString,PRInt32 aCount) { // the passed-in string. File a bug on the caller. #ifdef NS_DEBUG -#if 0 - PRInt32 len=strlen(aCString); - NS_WARN_IF_FALSE(len>=aCount,"possible embedded null in append(char*)"); -#endif + PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0); + NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in append(char*)"); #endif } @@ -1078,10 +1076,8 @@ nsString& nsString::Append(const PRUnichar* aString,PRInt32 aCount) { // If this assertion fires, the caller is probably lying about the length of // the passed-in string. File a bug on the caller. #ifdef NS_DEBUG -#if 0 - PRInt32 len=nsCRT::strlen(aString); - NS_WARN_IF_FALSE(len>=aCount,"possible embedded null in append(PRUnichar*)"); -#endif + PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0); + NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in append(PRUnichar*)"); #endif } @@ -1270,10 +1266,8 @@ nsString& nsString::Insert(const char* aCString,PRUint32 anOffset,PRInt32 aCount // If this assertion fires, the caller is probably lying about the length of // the passed-in string. File a bug on the caller. #ifdef NS_DEBUG -#if 0 - PRInt32 len=strlen(aCString); - NS_WARN_IF_FALSE(len>=aCount,"possible embedded null in Insert(char*)"); -#endif + PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0); + NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in Insert(char*)"); #endif } @@ -1307,10 +1301,8 @@ nsString& nsString::Insert(const PRUnichar* aString,PRUint32 anOffset,PRInt32 aC // If this assertion fires, the caller is probably lying about the length of // the passed-in string. File a bug on the caller. #ifdef NS_DEBUG -#if 0 - PRInt32 len=nsCRT::strlen(aString); - NS_WARN_IF_FALSE(len>=aCount,"possible embedded null in Insert(PRUnichar*)"); -#endif + PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0); + NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in Insert(PRUnichar*)"); #endif }