changed 'embedded nulls' asserts to warnings in nsString

git-svn-id: svn://10.0.0.236/trunk@61360 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rickg%netscape.com
2000-02-19 09:17:49 +00:00
parent 0528624083
commit afbb008cab
6 changed files with 60 additions and 21 deletions

View File

@@ -35,12 +35,12 @@
#include "nsISizeOfHandler.h"
#endif
static const char* kPossibleNull = "Error: possible unintended null in string";
static const char* kNullPointerError = "Error: unexpected null ptr";
static const char* kWhitespace="\b\t\r\n ";
static void CSubsume(nsStr& aDest,nsStr& aSource){
if(aSource.mStr && aSource.mLength) {
if(aSource.mOwnsBuffer){
@@ -837,7 +837,9 @@ nsCString& nsCString::Assign(const PRUnichar* aString,PRInt32 aCount) {
// the passed-in string. File a bug on the caller.
#ifdef NS_DEBUG
PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0,temp.mLength);
NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in Assign(PRUnichar*)");
if(kNotFound<len) {
NS_WARNING(kPossibleNull);
}
#endif
}
@@ -1126,7 +1128,9 @@ nsCString& nsCString::Insert(const char* aCString,PRUint32 anOffset,PRInt32 aCou
// the passed-in string. File a bug on the caller.
#ifdef NS_DEBUG
PRInt32 len=nsStr::FindChar(temp,0,PR_FALSE,0,temp.mLength);
NS_WARN_IF_FALSE(kNotFound==len,"possible embedded null in Insert(char*)");
if(kNotFound<len) {
NS_WARNING(kPossibleNull);
}
#endif
}