nsString.h - the mBuf member data type was the raw PRUnichar type, changed it to chartype.

nsString.cpp - we were dropping the ending null-byte/unichar when expanding/growing strings


git-svn-id: svn://10.0.0.236/trunk@8606 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
valeski%netscape.com
1998-08-27 08:15:40 +00:00
parent 164839f6fb
commit 3574dedce6
8 changed files with 12 additions and 12 deletions

View File

@@ -165,7 +165,7 @@ void nsString::EnsureCapacityFor(PRInt32 aNewLength)
mCapacity=newCapacity;
chartype* temp = new chartype[newCapacity+1];
if (mLength > 0) {
nsCRT::memcpy(temp, mStr, mLength * sizeof(chartype));
nsCRT::memcpy(temp, mStr, mLength * sizeof(chartype) + sizeof(chartype));
}
if(mStr && (mStr!=kCommonEmptyBuffer))
delete [] mStr;
@@ -1795,7 +1795,7 @@ void nsAutoString::EnsureCapacityFor(PRInt32 aNewLength) {
mCapacity=size;
chartype* temp = new chartype[mCapacity+1];
if (mLength > 0) {
nsCRT::memcpy(temp, mStr, mLength * sizeof(chartype));
nsCRT::memcpy(temp, mStr, mLength * sizeof(chartype) + sizeof(chartype));
}
if ((mStr != mBuf) && (0 != mStr)) {
delete [] mStr;