diff --git a/mozilla/string/obsolete/nsStr.cpp b/mozilla/string/obsolete/nsStr.cpp index 4125e5f8a62..76739b99d1f 100644 --- a/mozilla/string/obsolete/nsStr.cpp +++ b/mozilla/string/obsolete/nsStr.cpp @@ -132,7 +132,7 @@ PRBool nsStr::GrowCapacity(nsStr& aDest,PRUint32 aNewLength) { PRBool result=PR_TRUE; if(aNewLength>aDest.mCapacity) { nsStr theTempStr; - nsStr::Initialize(theTempStr,aDest.mCharSize); + nsStr::Initialize(theTempStr,eCharSize(aDest.mCharSize)); #ifndef NS_USE_OLD_STRING_ALLOCATION_STRATEGY // the new strategy is, allocate exact size, double on grows @@ -232,7 +232,7 @@ void nsStr::StrInsert( nsStr& aDest,PRUint32 aDestOffset,const nsStr& aSource,PR if(aDest.mLength+theLength > aDest.mCapacity) { nsStr theTempStr; - nsStr::Initialize(theTempStr,aDest.mCharSize); + nsStr::Initialize(theTempStr,eCharSize(aDest.mCharSize)); PRBool isBigEnough=EnsureCapacity(theTempStr,aDest.mLength+theLength); //grow the temp buffer to the right size diff --git a/mozilla/string/obsolete/nsStr.h b/mozilla/string/obsolete/nsStr.h index 781d32ad78d..3fb76fae389 100644 --- a/mozilla/string/obsolete/nsStr.h +++ b/mozilla/string/obsolete/nsStr.h @@ -455,14 +455,15 @@ struct NS_COM nsStr { PRUint32 mLength; PRUint32 mCapacity; - eCharSize mCharSize; - PRBool mOwnsBuffer; - + union { char* mStr; PRUnichar* mUStr; }; + PRInt8 mCharSize; + PRPackedBool mOwnsBuffer; + private: static PRBool Alloc(nsStr& aString,PRUint32 aCount); static PRBool Realloc(nsStr& aString,PRUint32 aCount); diff --git a/mozilla/string/obsolete/nsString.cpp b/mozilla/string/obsolete/nsString.cpp index cdb6f1a4d5d..fd18cc2c26a 100644 --- a/mozilla/string/obsolete/nsString.cpp +++ b/mozilla/string/obsolete/nsString.cpp @@ -114,7 +114,7 @@ nsCString::nsCString(const nsStr &aString) { * @param reference to another nsCString */ nsCString::nsCString(const nsCString& aString) { - Initialize(*this,aString.mCharSize); + Initialize(*this,eCharSize(aString.mCharSize)); StrAssign(*this,aString,0,aString.mLength); } diff --git a/mozilla/xpcom/string/obsolete/nsStr.cpp b/mozilla/xpcom/string/obsolete/nsStr.cpp index 4125e5f8a62..76739b99d1f 100644 --- a/mozilla/xpcom/string/obsolete/nsStr.cpp +++ b/mozilla/xpcom/string/obsolete/nsStr.cpp @@ -132,7 +132,7 @@ PRBool nsStr::GrowCapacity(nsStr& aDest,PRUint32 aNewLength) { PRBool result=PR_TRUE; if(aNewLength>aDest.mCapacity) { nsStr theTempStr; - nsStr::Initialize(theTempStr,aDest.mCharSize); + nsStr::Initialize(theTempStr,eCharSize(aDest.mCharSize)); #ifndef NS_USE_OLD_STRING_ALLOCATION_STRATEGY // the new strategy is, allocate exact size, double on grows @@ -232,7 +232,7 @@ void nsStr::StrInsert( nsStr& aDest,PRUint32 aDestOffset,const nsStr& aSource,PR if(aDest.mLength+theLength > aDest.mCapacity) { nsStr theTempStr; - nsStr::Initialize(theTempStr,aDest.mCharSize); + nsStr::Initialize(theTempStr,eCharSize(aDest.mCharSize)); PRBool isBigEnough=EnsureCapacity(theTempStr,aDest.mLength+theLength); //grow the temp buffer to the right size diff --git a/mozilla/xpcom/string/obsolete/nsStr.h b/mozilla/xpcom/string/obsolete/nsStr.h index 781d32ad78d..3fb76fae389 100644 --- a/mozilla/xpcom/string/obsolete/nsStr.h +++ b/mozilla/xpcom/string/obsolete/nsStr.h @@ -455,14 +455,15 @@ struct NS_COM nsStr { PRUint32 mLength; PRUint32 mCapacity; - eCharSize mCharSize; - PRBool mOwnsBuffer; - + union { char* mStr; PRUnichar* mUStr; }; + PRInt8 mCharSize; + PRPackedBool mOwnsBuffer; + private: static PRBool Alloc(nsStr& aString,PRUint32 aCount); static PRBool Realloc(nsStr& aString,PRUint32 aCount); diff --git a/mozilla/xpcom/string/obsolete/nsString.cpp b/mozilla/xpcom/string/obsolete/nsString.cpp index cdb6f1a4d5d..fd18cc2c26a 100644 --- a/mozilla/xpcom/string/obsolete/nsString.cpp +++ b/mozilla/xpcom/string/obsolete/nsString.cpp @@ -114,7 +114,7 @@ nsCString::nsCString(const nsStr &aString) { * @param reference to another nsCString */ nsCString::nsCString(const nsCString& aString) { - Initialize(*this,aString.mCharSize); + Initialize(*this,eCharSize(aString.mCharSize)); StrAssign(*this,aString,0,aString.mLength); }