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
This commit is contained in:
valeski%netscape.com 1998-08-27 08:15:40 +00:00
Родитель 7bfff2f61c
Коммит da9bc1007c
8 изменённых файлов: 12 добавлений и 12 удалений

Просмотреть файл

@ -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;

Просмотреть файл

@ -234,7 +234,7 @@ public:
protected:
virtual void EnsureCapacityFor(PRInt32 aNewLength);
PRUnichar mBuf[32];
chartype mBuf[32];
};
ostream& operator<<(ostream& os,nsAutoString& aString);

Просмотреть файл

@ -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;

Просмотреть файл

@ -234,7 +234,7 @@ public:
protected:
virtual void EnsureCapacityFor(PRInt32 aNewLength);
PRUnichar mBuf[32];
chartype mBuf[32];
};
ostream& operator<<(ostream& os,nsAutoString& aString);

Просмотреть файл

@ -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;

Просмотреть файл

@ -234,7 +234,7 @@ public:
protected:
virtual void EnsureCapacityFor(PRInt32 aNewLength);
PRUnichar mBuf[32];
chartype mBuf[32];
};
ostream& operator<<(ostream& os,nsAutoString& aString);

Просмотреть файл

@ -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;

Просмотреть файл

@ -234,7 +234,7 @@ public:
protected:
virtual void EnsureCapacityFor(PRInt32 aNewLength);
PRUnichar mBuf[32];
chartype mBuf[32];
};
ostream& operator<<(ostream& os,nsAutoString& aString);