oops, back myself out - forward declared enums don't work on linux!

git-svn-id: svn://10.0.0.236/trunk@114534 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
alecf%netscape.com
2002-02-14 23:14:50 +00:00
parent 6326ee9424
commit a959243ac9
8 changed files with 856 additions and 418 deletions

View File

@@ -40,7 +40,6 @@
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include "nsStrPrivate.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsDebug.h"
@@ -66,11 +65,11 @@ nsString::GetFlatBufferHandle() const
* Default constructor.
*/
nsString::nsString() {
nsStrPrivate::Initialize(*this,eTwoByte);
Initialize(*this,eTwoByte);
}
nsString::nsString(const PRUnichar* aString) {
nsStrPrivate::Initialize(*this,eTwoByte);
Initialize(*this,eTwoByte);
Assign(aString);
}
@@ -81,7 +80,7 @@ nsString::nsString(const PRUnichar* aString) {
* @param aLength tells us how many chars to copy from given aString
*/
nsString::nsString(const PRUnichar* aString,PRInt32 aCount) {
nsStrPrivate::Initialize(*this,eTwoByte);
Initialize(*this,eTwoByte);
Assign(aString,aCount);
}
@@ -91,16 +90,16 @@ nsString::nsString(const PRUnichar* aString,PRInt32 aCount) {
* @param reference to another nsString
*/
nsString::nsString(const nsString& aString) {
nsStrPrivate::Initialize(*this,eTwoByte);
nsStrPrivate::StrAssign(*this,aString,0,aString.mLength);
Initialize(*this,eTwoByte);
StrAssign(*this,aString,0,aString.mLength);
}
/**
* Destructor
* Make sure we call nsStrPrivate::Destroy.
* Make sure we call nsStr::Destroy.
*/
nsString::~nsString() {
nsStrPrivate::Destroy(*this);
nsStr::Destroy(*this);
}
const PRUnichar* nsString::GetReadableFragment( nsReadableFragment<PRUnichar>& aFragment, nsFragmentRequest aRequest, PRUint32 aOffset ) const {
@@ -141,15 +140,15 @@ nsString::do_AppendFromElement( PRUnichar inChar )
buf[0] = inChar;
nsStr temp;
nsStrPrivate::Initialize(temp, eTwoByte);
nsStr::Initialize(temp, eTwoByte);
temp.mUStr = buf;
temp.mLength = 1;
nsStrPrivate::StrAppend(*this, temp, 0, 1);
StrAppend(*this, temp, 0, 1);
}
nsString::nsString( const nsAString& aReadable ) {
nsStrPrivate::Initialize(*this,eTwoByte);
Initialize(*this,eTwoByte);
Assign(aReadable);
}
@@ -173,7 +172,7 @@ void nsString::SetLength(PRUint32 anIndex) {
SetCapacity(anIndex);
// |SetCapacity| normally doesn't guarantee the use we are putting it to here (see its interface comment in nsAWritableString.h),
// we can only use it since our local implementation, |nsString::SetCapacity|, is known to do what we want
nsStrPrivate::StrTruncate(*this,anIndex);
nsStr::StrTruncate(*this,anIndex);
}
@@ -189,13 +188,13 @@ nsString::SetCapacity( PRUint32 aNewCapacity )
if ( aNewCapacity )
{
if( aNewCapacity > GetCapacity() )
nsStrPrivate::GrowCapacity(*this, aNewCapacity);
GrowCapacity(*this, aNewCapacity);
AddNullTerminator(*this);
}
else
{
nsStrPrivate::Destroy(*this);
nsStrPrivate::Initialize(*this, eTwoByte);
nsStr::Destroy(*this);
nsStr::Initialize(*this, eTwoByte);
}
}
@@ -300,7 +299,7 @@ nsString::StripChar(PRUnichar aChar,PRInt32 anOffset){
*/
void
nsString::StripChars(const char* aSet){
nsStrPrivate::StripChars2(*this,aSet);
nsStr::StripChars2(*this,aSet);
}
@@ -410,19 +409,19 @@ nsString::ReplaceSubstring(const nsString& aTarget,const nsString& aNewValue){
}
else {
PRInt32 theIndex=0;
while(kNotFound!=(theIndex=nsStrPrivate::FindSubstr2in2(*this,aTarget,PR_FALSE,theIndex,mLength))) {
while(kNotFound!=(theIndex=nsStr::FindSubstr2in2(*this,aTarget,PR_FALSE,theIndex,mLength))) {
if(aNewValue.mLength<aTarget.mLength) {
//Since target is longer than newValue, we should delete a few chars first, then overwrite.
PRInt32 theDelLen=aTarget.mLength-aNewValue.mLength;
nsStrPrivate::Delete2(*this,theIndex,theDelLen);
nsStrPrivate::Overwrite(*this,aNewValue,theIndex);
nsStr::Delete2(*this,theIndex,theDelLen);
nsStr::Overwrite(*this,aNewValue,theIndex);
}
else {
//this is the worst case: the newvalue is larger than the substr it's replacing
//so we have to insert some characters...
PRInt32 theInsLen=aNewValue.mLength-aTarget.mLength;
nsStrPrivate::StrInsert2into2(*this,theIndex,aNewValue,0,theInsLen);
nsStrPrivate::Overwrite(*this,aNewValue,theIndex);
StrInsert2into2(*this,theIndex,aNewValue,0,theInsLen);
nsStr::Overwrite(*this,aNewValue,theIndex);
theIndex += aNewValue.mLength;
}
}
@@ -461,7 +460,7 @@ nsString::Trim(const char* aTrimSet, PRBool aEliminateLeading,PRBool aEliminateT
}
}
nsStrPrivate::Trim(*this,aTrimSet,aEliminateLeading,aEliminateTrailing);
nsStr::Trim(*this,aTrimSet,aEliminateLeading,aEliminateTrailing);
if(aIgnoreQuotes && theQuotesAreNeeded) {
Insert(theFirstChar,0);
@@ -485,7 +484,7 @@ void
nsString::CompressSet(const char* aSet, PRUnichar aChar,PRBool aEliminateLeading,PRBool aEliminateTrailing){
if(aSet){
ReplaceChar(aSet,aChar);
nsStrPrivate::CompressSet2(*this,aSet,aEliminateLeading,aEliminateTrailing);
nsStr::CompressSet2(*this,aSet,aEliminateLeading,aEliminateTrailing);
}
}
@@ -526,7 +525,7 @@ char* nsString::ToCString(char* aBuf, PRUint32 aBufLength,PRUint32 anOffset) con
CBufDescriptor theDescr(aBuf,PR_TRUE,aBufLength,0);
nsCAutoString temp(theDescr);
nsStrPrivate::StrAssign(temp, *this, anOffset, PR_MIN(mLength, aBufLength-1));
nsStr::StrAssign(temp, *this, anOffset, PR_MIN(mLength, aBufLength-1));
temp.mStr=0;
}
return aBuf;
@@ -681,14 +680,14 @@ PRInt32 nsString::ToInteger(PRInt32* anErrorCode,PRUint32 aRadix) const {
* @return this
*/
void nsString::AssignWithConversion(const char* aCString,PRInt32 aCount) {
nsStrPrivate::StrTruncate(*this,0);
nsStr::StrTruncate(*this,0);
if(aCString){
AppendWithConversion(aCString,aCount);
}
}
void nsString::AssignWithConversion(const char* aCString) {
nsStrPrivate::StrTruncate(*this,0);
nsStr::StrTruncate(*this,0);
if(aCString){
AppendWithConversion(aCString);
}
@@ -702,7 +701,7 @@ void nsString::AssignWithConversion(const char* aCString) {
* @return this
*/
void nsString::AssignWithConversion(char aChar) {
nsStrPrivate::StrTruncate(*this,0);
nsStr::StrTruncate(*this,0);
AppendWithConversion(aChar);
}
@@ -719,7 +718,7 @@ void nsString::AssignWithConversion(char aChar) {
void nsString::AppendWithConversion(const char* aCString,PRInt32 aCount) {
if(aCString && aCount){ //if astring is null or count==0 there's nothing to do
nsStr temp;
nsStrPrivate::Initialize(temp,eOneByte);
nsStr::Initialize(temp,eOneByte);
temp.mStr=(char*)aCString;
if(0<aCount) {
@@ -729,7 +728,7 @@ void nsString::AppendWithConversion(const char* aCString,PRInt32 aCount) {
// the passed-in string. File a bug on the caller.
#ifdef NS_DEBUG
PRInt32 len=nsStrPrivate::FindChar1(temp,0,0,temp.mLength);
PRInt32 len=nsStr::FindChar1(temp,0,0,temp.mLength);
if(kNotFound<len) {
NS_WARNING(kPossibleNull);
}
@@ -739,7 +738,7 @@ void nsString::AppendWithConversion(const char* aCString,PRInt32 aCount) {
else aCount=temp.mLength=nsCRT::strlen(aCString);
if(0<aCount)
nsStrPrivate::StrAppend(*this,temp,0,aCount);
StrAppend(*this,temp,0,aCount);
}
}
@@ -754,10 +753,10 @@ void nsString::AppendWithConversion(char aChar) {
buf[0]=aChar;
nsStr temp;
nsStrPrivate::Initialize(temp,eOneByte);
nsStr::Initialize(temp,eOneByte);
temp.mStr=buf;
temp.mLength=1;
nsStrPrivate::StrAppend(*this,temp,0,1);
StrAppend(*this,temp,0,1);
}
/**
@@ -829,7 +828,7 @@ void nsString::AppendFloat(double aFloat){
void nsString::InsertWithConversion(const char* aCString,PRUint32 anOffset,PRInt32 aCount){
if(aCString && aCount){
nsStr temp;
nsStrPrivate::Initialize(temp,eOneByte);
nsStr::Initialize(temp,eOneByte);
temp.mStr=(char*)aCString;
if(0<aCount) {
@@ -838,7 +837,7 @@ void nsString::InsertWithConversion(const char* aCString,PRUint32 anOffset,PRInt
// If this assertion fires, the caller is probably lying about the length of
// the passed-in string. File a bug on the caller.
#ifdef NS_DEBUG
PRInt32 len=nsStrPrivate::FindChar1(temp,0,0,temp.mLength);
PRInt32 len=nsStr::FindChar1(temp,0,0,temp.mLength);
if(kNotFound<len) {
NS_WARNING(kPossibleNull);
}
@@ -848,19 +847,19 @@ void nsString::InsertWithConversion(const char* aCString,PRUint32 anOffset,PRInt
else aCount=temp.mLength=nsCRT::strlen(aCString);
if(0<aCount){
nsStrPrivate::StrInsert1into2(*this,anOffset,temp,0,aCount);
StrInsert1into2(*this,anOffset,temp,0,aCount);
}
}
}
void nsString::Adopt(PRUnichar* aPtr, PRInt32 aLength) {
NS_ASSERTION(aPtr, "Can't adopt |0|");
nsStrPrivate::Destroy(*this);
nsStr::Destroy(*this);
if (aLength == -1)
aLength = nsCharTraits<PRUnichar>::length(aPtr);
// We don't know the capacity, so we'll just have to assume
// capacity = length.
nsStrPrivate::Initialize(*this, (char*)aPtr, aLength, aLength, eTwoByte, PR_TRUE);
nsStr::Initialize(*this, (char*)aPtr, aLength, aLength, eTwoByte, PR_TRUE);
}
@@ -884,10 +883,10 @@ PRInt32 nsString::Find(const char* aCString,PRBool aIgnoreCase,PRInt32 anOffset,
PRInt32 result=kNotFound;
if(aCString) {
nsStr temp;
nsStrPrivate::Initialize(temp,eOneByte);
nsStr::Initialize(temp,eOneByte);
temp.mLength=nsCRT::strlen(aCString);
temp.mStr=(char*)aCString;
result=nsStrPrivate::FindSubstr1in2(*this,temp,aIgnoreCase,anOffset,aCount);
result=nsStr::FindSubstr1in2(*this,temp,aIgnoreCase,anOffset,aCount);
}
return result;
}
@@ -908,10 +907,10 @@ PRInt32 nsString::Find(const PRUnichar* aString,PRBool aIgnoreCase,PRInt32 anOff
PRInt32 result=kNotFound;
if(aString) {
nsStr temp;
nsStrPrivate::Initialize(temp,eTwoByte);
nsStr::Initialize(temp,eTwoByte);
temp.mLength=nsCRT::strlen(aString);
temp.mUStr=(PRUnichar*)aString;
result=nsStrPrivate::FindSubstr2in2(*this,temp,aIgnoreCase,anOffset,aCount);
result=nsStr::FindSubstr2in2(*this,temp,aIgnoreCase,anOffset,aCount);
}
return result;
}
@@ -927,7 +926,7 @@ PRInt32 nsString::Find(const PRUnichar* aString,PRBool aIgnoreCase,PRInt32 anOff
* @return offset in string, or -1 (kNotFound)
*/
PRInt32 nsString::Find(const nsCString& aString,PRBool aIgnoreCase,PRInt32 anOffset,PRInt32 aCount) const{
PRInt32 result=nsStrPrivate::FindSubstr1in2(*this,aString,aIgnoreCase,anOffset,aCount);
PRInt32 result=nsStr::FindSubstr1in2(*this,aString,aIgnoreCase,anOffset,aCount);
return result;
}
@@ -942,7 +941,7 @@ PRInt32 nsString::Find(const nsCString& aString,PRBool aIgnoreCase,PRInt32 anOff
* @return offset in string, or -1 (kNotFound)
*/
PRInt32 nsString::Find(const nsString& aString,PRBool aIgnoreCase,PRInt32 anOffset,PRInt32 aCount) const{
PRInt32 result=nsStrPrivate::FindSubstr2in2(*this,aString,aIgnoreCase,anOffset,aCount);
PRInt32 result=nsStr::FindSubstr2in2(*this,aString,aIgnoreCase,anOffset,aCount);
return result;
}
@@ -961,10 +960,10 @@ PRInt32 nsString::FindCharInSet(const char* aCStringSet,PRInt32 anOffset) const{
PRInt32 result=kNotFound;
if(aCStringSet) {
nsStr temp;
nsStrPrivate::Initialize(temp,eOneByte);
nsStr::Initialize(temp,eOneByte);
temp.mLength=nsCRT::strlen(aCStringSet);
temp.mStr=(char*)aCStringSet;
result=nsStrPrivate::FindCharInSet1(*this,temp,PR_FALSE,anOffset);
result=nsStr::FindCharInSet1(*this,temp,PR_FALSE,anOffset);
}
return result;
}
@@ -984,10 +983,10 @@ PRInt32 nsString::FindCharInSet(const PRUnichar* aStringSet,PRInt32 anOffset) co
PRInt32 result=kNotFound;
if(aStringSet) {
nsStr temp;
nsStrPrivate::Initialize(temp,eTwoByte);
nsStr::Initialize(temp,eTwoByte);
temp.mLength=nsCRT::strlen(aStringSet);
temp.mStr=(char*)aStringSet;
result=nsStrPrivate::FindCharInSet2(*this,temp,anOffset);
result=nsStr::FindCharInSet2(*this,temp,anOffset);
}
return result;
}
@@ -1002,12 +1001,12 @@ PRInt32 nsString::FindCharInSet(const PRUnichar* aStringSet,PRInt32 anOffset) co
* @return
*/
PRInt32 nsString::FindCharInSet(const nsString& aSet,PRInt32 anOffset) const{
PRInt32 result=nsStrPrivate::FindCharInSet2(*this,aSet,anOffset);
PRInt32 result=nsStr::FindCharInSet2(*this,aSet,anOffset);
return result;
}
PRInt32 nsString::FindCharInSet(const nsCString& aSet,PRInt32 anOffset) const{
PRInt32 result=nsStrPrivate::FindCharInSet1(*this,aSet,PR_FALSE,anOffset);
PRInt32 result=nsStr::FindCharInSet1(*this,aSet,PR_FALSE,anOffset);
return result;
}
@@ -1023,7 +1022,7 @@ PRInt32 nsString::FindCharInSet(const nsCString& aSet,PRInt32 anOffset) const{
* @return offset in string, or -1 (kNotFound)
*/
PRInt32 nsString::RFind(const nsCString& aString,PRBool aIgnoreCase,PRInt32 anOffset,PRInt32 aCount) const{
PRInt32 result=nsStrPrivate::RFindSubstr1in2(*this,aString,aIgnoreCase,anOffset,aCount);
PRInt32 result=nsStr::RFindSubstr1in2(*this,aString,aIgnoreCase,anOffset,aCount);
return result;
}
@@ -1038,7 +1037,7 @@ PRInt32 nsString::RFind(const nsCString& aString,PRBool aIgnoreCase,PRInt32 anOf
* @return offset in string, or -1 (kNotFound)
*/
PRInt32 nsString::RFind(const nsString& aString,PRBool aIgnoreCase,PRInt32 anOffset,PRInt32 aCount) const{
PRInt32 result=nsStrPrivate::RFindSubstr2in2(*this,aString,aIgnoreCase,anOffset,aCount);
PRInt32 result=nsStr::RFindSubstr2in2(*this,aString,aIgnoreCase,anOffset,aCount);
return result;
}
@@ -1058,10 +1057,10 @@ PRInt32 nsString::RFind(const char* aString,PRBool aIgnoreCase,PRInt32 anOffset,
PRInt32 result=kNotFound;
if(aString) {
nsStr temp;
nsStrPrivate::Initialize(temp,eOneByte);
nsStr::Initialize(temp,eOneByte);
temp.mLength=nsCRT::strlen(aString);
temp.mStr=(char*)aString;
result=nsStrPrivate::RFindSubstr1in2(*this,temp,aIgnoreCase,anOffset,aCount);
result=nsStr::RFindSubstr1in2(*this,temp,aIgnoreCase,anOffset,aCount);
}
return result;
}
@@ -1076,7 +1075,7 @@ PRInt32 nsString::RFind(const char* aString,PRBool aIgnoreCase,PRInt32 anOffset,
* @return offset of found char, or -1 (kNotFound)
*/
PRInt32 nsString::RFindChar(PRUnichar aChar,PRInt32 anOffset,PRInt32 aCount) const{
PRInt32 result=nsStrPrivate::RFindChar2(*this,aChar,anOffset,aCount);
PRInt32 result=nsStr::RFindChar2(*this,aChar,anOffset,aCount);
return result;
}
@@ -1094,10 +1093,10 @@ PRInt32 nsString::RFindCharInSet(const char* aCStringSet,PRInt32 anOffset) const
PRInt32 result=kNotFound;
if(aCStringSet) {
nsStr temp;
nsStrPrivate::Initialize(temp,eOneByte);
nsStr::Initialize(temp,eOneByte);
temp.mLength=nsCRT::strlen(aCStringSet);
temp.mStr=(char*)aCStringSet;
result=nsStrPrivate::RFindCharInSet1(*this,temp,PR_FALSE,anOffset);
result=nsStr::RFindCharInSet1(*this,temp,PR_FALSE,anOffset);
}
return result;
}
@@ -1113,12 +1112,12 @@ PRInt32 nsString::RFindCharInSet(const char* aCStringSet,PRInt32 anOffset) const
* @return offset of found char, or -1 (kNotFound)
*/
PRInt32 nsString::RFindCharInSet(const nsString& aSet,PRInt32 anOffset) const{
PRInt32 result=nsStrPrivate::RFindCharInSet2(*this,aSet,anOffset);
PRInt32 result=nsStr::RFindCharInSet2(*this,aSet,anOffset);
return result;
}
PRInt32 nsString::RFindCharInSet(const nsCString& aSet,PRInt32 anOffset) const{
PRInt32 result=nsStrPrivate::RFindCharInSet1(*this,aSet,PR_FALSE,anOffset);
PRInt32 result=nsStr::RFindCharInSet1(*this,aSet,PR_FALSE,anOffset);
return result;
}
@@ -1138,10 +1137,10 @@ PRInt32 nsString::RFindCharInSet(const PRUnichar* aStringSet,PRInt32 anOffset) c
PRInt32 result=kNotFound;
if(aStringSet) {
nsStr temp;
nsStrPrivate::Initialize(temp,eTwoByte);
nsStr::Initialize(temp,eTwoByte);
temp.mLength=nsCRT::strlen(aStringSet);
temp.mUStr=(PRUnichar*)aStringSet;
result=nsStrPrivate::RFindCharInSet2(*this,temp,anOffset);
result=nsStr::RFindCharInSet2(*this,temp,anOffset);
}
return result;
}
@@ -1164,12 +1163,12 @@ PRInt32 nsString::CompareWithConversion(const char *aCString,PRBool aIgnoreCase,
if(aCString) {
nsStr temp;
nsStrPrivate::Initialize(temp,eOneByte);
nsStr::Initialize(temp,eOneByte);
temp.mLength= (0<aCount) ? aCount : nsCRT::strlen(aCString);
temp.mStr=(char*)aCString;
return nsStrPrivate::StrCompare2To1(*this,temp,aCount,aIgnoreCase);
return nsStr::StrCompare2To1(*this,temp,aCount,aIgnoreCase);
}
return 0;
@@ -1184,7 +1183,7 @@ PRInt32 nsString::CompareWithConversion(const char *aCString,PRBool aIgnoreCase,
* @return -1,0,1
*/
PRInt32 nsString::CompareWithConversion(const nsString& aString,PRBool aIgnoreCase,PRInt32 aCount) const {
PRInt32 result=nsStrPrivate::StrCompare2To2(*this,aString,aCount,aIgnoreCase);
PRInt32 result=nsStr::StrCompare2To2(*this,aString,aCount,aIgnoreCase);
return result;
}
@@ -1201,10 +1200,10 @@ PRInt32 nsString::CompareWithConversion(const PRUnichar* aString,PRBool aIgnoreC
if(aString) {
nsStr temp;
nsStrPrivate::Initialize(temp,eTwoByte);
nsStr::Initialize(temp,eTwoByte);
temp.mLength=nsCRT::strlen(aString);
temp.mUStr=(PRUnichar*)aString;
return nsStrPrivate::StrCompare2To2(*this,temp,aCount,aIgnoreCase);
return nsStr::StrCompare2To2(*this,temp,aCount,aIgnoreCase);
}
return 0;
@@ -1229,7 +1228,7 @@ PRBool nsString::EqualsIgnoreCase(const char* aString,PRInt32 aLength) const {
* @return TRUE if equal
*/
PRBool nsString::EqualsWithConversion(const nsString& aString,PRBool aIgnoreCase,PRInt32 aCount) const {
PRInt32 theAnswer=nsStrPrivate::StrCompare2To2(*this,aString,aCount,aIgnoreCase);
PRInt32 theAnswer=nsStr::StrCompare2To2(*this,aString,aCount,aIgnoreCase);
PRBool result=PRBool(0==theAnswer);
return result;
@@ -1382,12 +1381,12 @@ PRBool nsString::IsDigit(PRUnichar aChar) {
*
*/
nsAutoString::nsAutoString() : nsString() {
nsStrPrivate::Initialize(*this,mBuffer,(sizeof(mBuffer)>>eTwoByte)-1,0,eTwoByte,PR_FALSE);
Initialize(*this,mBuffer,(sizeof(mBuffer)>>eTwoByte)-1,0,eTwoByte,PR_FALSE);
AddNullTerminator(*this);
}
nsAutoString::nsAutoString(const PRUnichar* aString) : nsString() {
nsStrPrivate::Initialize(*this,mBuffer,(sizeof(mBuffer)>>eTwoByte)-1,0,eTwoByte,PR_FALSE);
Initialize(*this,mBuffer,(sizeof(mBuffer)>>eTwoByte)-1,0,eTwoByte,PR_FALSE);
AddNullTerminator(*this);
Append(aString);
}
@@ -1398,7 +1397,7 @@ nsAutoString::nsAutoString(const PRUnichar* aString) : nsString() {
* @param aLength tells us how many chars to copy from aString
*/
nsAutoString::nsAutoString(const PRUnichar* aString,PRInt32 aLength) : nsString() {
nsStrPrivate::Initialize(*this,mBuffer,(sizeof(mBuffer)>>eTwoByte)-1,0,eTwoByte,PR_FALSE);
Initialize(*this,mBuffer,(sizeof(mBuffer)>>eTwoByte)-1,0,eTwoByte,PR_FALSE);
AddNullTerminator(*this);
Append(aString,aLength);
}
@@ -1406,7 +1405,7 @@ nsAutoString::nsAutoString(const PRUnichar* aString,PRInt32 aLength) : nsString(
nsAutoString::nsAutoString( const nsString& aString )
: nsString()
{
nsStrPrivate::Initialize(*this, mBuffer, (sizeof(mBuffer)>>eTwoByte)-1, 0, eTwoByte, PR_FALSE);
Initialize(*this, mBuffer, (sizeof(mBuffer)>>eTwoByte)-1, 0, eTwoByte, PR_FALSE);
AddNullTerminator(*this);
Append(aString);
}
@@ -1414,7 +1413,7 @@ nsAutoString::nsAutoString( const nsString& aString )
nsAutoString::nsAutoString( const nsAString& aString )
: nsString()
{
nsStrPrivate::Initialize(*this, mBuffer, (sizeof(mBuffer)>>eTwoByte)-1, 0, eTwoByte, PR_FALSE);
Initialize(*this, mBuffer, (sizeof(mBuffer)>>eTwoByte)-1, 0, eTwoByte, PR_FALSE);
AddNullTerminator(*this);
Append(aString);
}
@@ -1427,10 +1426,10 @@ nsAutoString::nsAutoString( const nsAString& aString )
*/
nsAutoString::nsAutoString(const CBufDescriptor& aBuffer) : nsString() {
if(!aBuffer.mBuffer) {
nsStrPrivate::Initialize(*this,mBuffer,(sizeof(mBuffer)>>eTwoByte)-1,0,eTwoByte,PR_FALSE);
Initialize(*this,mBuffer,(sizeof(mBuffer)>>eTwoByte)-1,0,eTwoByte,PR_FALSE);
}
else {
nsStrPrivate::Initialize(*this,aBuffer.mBuffer,aBuffer.mCapacity,aBuffer.mLength,aBuffer.mCharSize,!aBuffer.mStackBased);
Initialize(*this,aBuffer.mBuffer,aBuffer.mCapacity,aBuffer.mLength,aBuffer.mCharSize,!aBuffer.mStackBased);
}
if(!aBuffer.mIsConst)
AddNullTerminator(*this);
@@ -1545,7 +1544,7 @@ NS_ConvertUTF8toUCS2::Init( const nsACString& aCString )
* Default copy constructor
*/
nsAutoString::nsAutoString(const nsAutoString& aString) : nsString() {
nsStrPrivate::Initialize(*this,mBuffer,(sizeof(mBuffer)>>eTwoByte)-1,0,eTwoByte,PR_FALSE);
Initialize(*this,mBuffer,(sizeof(mBuffer)>>eTwoByte)-1,0,eTwoByte,PR_FALSE);
AddNullTerminator(*this);
Append(aString);
}
@@ -1556,7 +1555,7 @@ nsAutoString::nsAutoString(const nsAutoString& aString) : nsString() {
* @param
*/
nsAutoString::nsAutoString(PRUnichar aChar) : nsString(){
nsStrPrivate::Initialize(*this,mBuffer,(sizeof(mBuffer)>>eTwoByte)-1,0,eTwoByte,PR_FALSE);
Initialize(*this,mBuffer,(sizeof(mBuffer)>>eTwoByte)-1,0,eTwoByte,PR_FALSE);
AddNullTerminator(*this);
Append(aChar);
}