fixed an error subsuming autostrings, and removed an AIX warning
git-svn-id: svn://10.0.0.236/trunk@30641 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
#define RICKG_DEBUG 1
|
||||
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
@@ -101,15 +102,33 @@ public:
|
||||
***********************************************************************/
|
||||
|
||||
void Subsume(nsStr& aDest,nsStr& aSource){
|
||||
aDest.mStr=aSource.mStr;
|
||||
aDest.mLength=aSource.mLength;
|
||||
aDest.mCharSize=aSource.mCharSize;
|
||||
aDest.mCapacity=aSource.mCapacity;
|
||||
aDest.mOwnsBuffer=aSource.mOwnsBuffer;
|
||||
aSource.mOwnsBuffer=PR_FALSE;
|
||||
aSource.mStr=0;
|
||||
if(aSource.mStr && aSource.mLength) {
|
||||
if(aSource.mOwnsBuffer){
|
||||
aDest.mStr=aSource.mStr;
|
||||
aDest.mLength=aSource.mLength;
|
||||
aDest.mCharSize=aSource.mCharSize;
|
||||
aDest.mCapacity=aSource.mCapacity;
|
||||
aDest.mOwnsBuffer=aSource.mOwnsBuffer;
|
||||
aSource.mOwnsBuffer=false;
|
||||
aSource.mStr=0;
|
||||
}
|
||||
else{
|
||||
nsStr::Assign(aDest,aSource,0,aSource.mLength,0);
|
||||
}
|
||||
}
|
||||
else nsStr::Truncate(aDest,0,0);
|
||||
}
|
||||
|
||||
#ifdef RICKG_DEBUG
|
||||
/********************************************************
|
||||
This class's only purpose in life is to test nsString2.
|
||||
********************************************************/
|
||||
class CStringTester {
|
||||
public:
|
||||
CStringTester();
|
||||
};
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Default constructor. Note that we actually allocate a small buffer
|
||||
* to begin with. This is because the "philosophy" of the string class
|
||||
@@ -1917,7 +1936,8 @@ CStringTester::CStringTester() {
|
||||
nsSubsumeStr temp3=theString+'?';
|
||||
nsString2 temp4(temp3);
|
||||
temp1=temp3;
|
||||
nsSubsumeStr temp5("hello");
|
||||
nsAutoString2 temp5("hello");
|
||||
nsSubsumeStr temp6(temp5);
|
||||
}
|
||||
|
||||
nsString2 theString1(theSize);
|
||||
|
||||
Reference in New Issue
Block a user