WIP for new string library, and defensive coding improvement in SetCapcity; r=buster

git-svn-id: svn://10.0.0.236/trunk@64014 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rickg%netscape.com
2000-03-24 07:21:56 +00:00
parent 39a364f3bd
commit 61451beb94
12 changed files with 78 additions and 66 deletions

View File

@@ -175,7 +175,7 @@ void nsCString::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const {
/**
* This method truncates this string to given length.
*
* @update gess 01/04/99
* @update rickg 03.23.2000
* @param anIndex -- new length of string
* @return nada
*/
@@ -192,10 +192,12 @@ void nsCString::SetLength(PRUint32 anIndex) {
* @param aLength -- contains new length for mStr
*/
void nsCString::SetCapacity(PRUint32 aLength) {
if(aLength>mCapacity) {
GrowCapacity(*this,aLength);
if(aLength) {
if(aLength>mCapacity) {
GrowCapacity(*this,aLength);
}
AddNullTerminator(*this);
}
AddNullTerminator(*this);
}
/**********************************************************************