зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
7bfff2f61c
Коммит
da9bc1007c
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче