From 3574dedce68dd7c05d12f98487e8df341fc7333c Mon Sep 17 00:00:00 2001 From: "valeski%netscape.com" Date: Thu, 27 Aug 1998 08:15:40 +0000 Subject: [PATCH] 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 --- mozilla/base/src/nsString.cpp | 4 ++-- mozilla/base/src/nsString.h | 2 +- mozilla/string/obsolete/nsString.cpp | 4 ++-- mozilla/string/obsolete/nsString.h | 2 +- mozilla/xpcom/ds/nsString.cpp | 4 ++-- mozilla/xpcom/ds/nsString.h | 2 +- mozilla/xpcom/string/obsolete/nsString.cpp | 4 ++-- mozilla/xpcom/string/obsolete/nsString.h | 2 +- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/mozilla/base/src/nsString.cpp b/mozilla/base/src/nsString.cpp index 1b2882d99e0..99a54b766ca 100644 --- a/mozilla/base/src/nsString.cpp +++ b/mozilla/base/src/nsString.cpp @@ -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; diff --git a/mozilla/base/src/nsString.h b/mozilla/base/src/nsString.h index d5b82c8fa7d..912f5fb9f35 100644 --- a/mozilla/base/src/nsString.h +++ b/mozilla/base/src/nsString.h @@ -234,7 +234,7 @@ public: protected: virtual void EnsureCapacityFor(PRInt32 aNewLength); - PRUnichar mBuf[32]; + chartype mBuf[32]; }; ostream& operator<<(ostream& os,nsAutoString& aString); diff --git a/mozilla/string/obsolete/nsString.cpp b/mozilla/string/obsolete/nsString.cpp index 1b2882d99e0..99a54b766ca 100644 --- a/mozilla/string/obsolete/nsString.cpp +++ b/mozilla/string/obsolete/nsString.cpp @@ -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; diff --git a/mozilla/string/obsolete/nsString.h b/mozilla/string/obsolete/nsString.h index d5b82c8fa7d..912f5fb9f35 100644 --- a/mozilla/string/obsolete/nsString.h +++ b/mozilla/string/obsolete/nsString.h @@ -234,7 +234,7 @@ public: protected: virtual void EnsureCapacityFor(PRInt32 aNewLength); - PRUnichar mBuf[32]; + chartype mBuf[32]; }; ostream& operator<<(ostream& os,nsAutoString& aString); diff --git a/mozilla/xpcom/ds/nsString.cpp b/mozilla/xpcom/ds/nsString.cpp index 1b2882d99e0..99a54b766ca 100644 --- a/mozilla/xpcom/ds/nsString.cpp +++ b/mozilla/xpcom/ds/nsString.cpp @@ -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; diff --git a/mozilla/xpcom/ds/nsString.h b/mozilla/xpcom/ds/nsString.h index d5b82c8fa7d..912f5fb9f35 100644 --- a/mozilla/xpcom/ds/nsString.h +++ b/mozilla/xpcom/ds/nsString.h @@ -234,7 +234,7 @@ public: protected: virtual void EnsureCapacityFor(PRInt32 aNewLength); - PRUnichar mBuf[32]; + chartype mBuf[32]; }; ostream& operator<<(ostream& os,nsAutoString& aString); diff --git a/mozilla/xpcom/string/obsolete/nsString.cpp b/mozilla/xpcom/string/obsolete/nsString.cpp index 1b2882d99e0..99a54b766ca 100644 --- a/mozilla/xpcom/string/obsolete/nsString.cpp +++ b/mozilla/xpcom/string/obsolete/nsString.cpp @@ -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; diff --git a/mozilla/xpcom/string/obsolete/nsString.h b/mozilla/xpcom/string/obsolete/nsString.h index d5b82c8fa7d..912f5fb9f35 100644 --- a/mozilla/xpcom/string/obsolete/nsString.h +++ b/mozilla/xpcom/string/obsolete/nsString.h @@ -234,7 +234,7 @@ public: protected: virtual void EnsureCapacityFor(PRInt32 aNewLength); - PRUnichar mBuf[32]; + chartype mBuf[32]; }; ostream& operator<<(ostream& os,nsAutoString& aString);