зеркало из https://github.com/mozilla/gecko-dev.git
fixed an error subsuming autostrings, and removed an AIX warning
This commit is contained in:
Родитель
66aa98a5d5
Коммит
641adcdf34
|
@ -478,7 +478,7 @@ PRInt32 nsStr::FindSubstr(const nsStr& aDest,const nsStr& aTarget, PRBool aIgnor
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
PRInt32 nsStr::FindChar(const nsStr& aDest,const PRUnichar aChar, PRBool aIgnoreCase,PRUint32 anOffset) {
|
||||
PRInt32 nsStr::FindChar(const nsStr& aDest,PRUnichar aChar, PRBool aIgnoreCase,PRUint32 anOffset) {
|
||||
PRInt32 result=gFindChars[aDest.mCharSize](aDest.mStr,aDest.mLength,anOffset,aChar,aIgnoreCase);
|
||||
return result;
|
||||
}
|
||||
|
@ -553,7 +553,7 @@ PRInt32 nsStr::RFindSubstr(const nsStr& aDest,const nsStr& aTarget, PRBool aIgno
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
PRInt32 nsStr::RFindChar(const nsStr& aDest,const PRUnichar aChar, PRBool aIgnoreCase,PRUint32 anOffset) {
|
||||
PRInt32 nsStr::RFindChar(const nsStr& aDest,PRUnichar aChar, PRBool aIgnoreCase,PRUint32 anOffset) {
|
||||
PRInt32 result=gRFindChars[aDest.mCharSize](aDest.mStr,aDest.mLength,anOffset,aChar,aIgnoreCase);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -149,6 +149,26 @@ void Truncate(PRInt32 anIndex=0);
|
|||
*/
|
||||
PRBool IsOrdered(void) const;
|
||||
|
||||
/**
|
||||
* Determine whether or not the characters in this
|
||||
* string are in store as 1 or 2 byte (unicode) strings.
|
||||
*
|
||||
* @return TRUE if ordered.
|
||||
*/
|
||||
PRBool IsUnicode(void) const {
|
||||
PRBool result=PRBool(mCharSize==eTwoByte);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether or not this string has a length of 0
|
||||
*
|
||||
* @return TRUE if empty.
|
||||
*/
|
||||
PRBool IsEmpty(void) const {
|
||||
return PRBool(0==mLength);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
Accessor methods...
|
||||
*********************************************************************/
|
||||
|
@ -774,16 +794,6 @@ public:
|
|||
nsSubsumeStr(const char* aString);
|
||||
};
|
||||
|
||||
#ifdef RICKG_DEBUG
|
||||
/********************************************************
|
||||
This class's only purpose in life is to test nsString2.
|
||||
********************************************************/
|
||||
class CStringTester {
|
||||
public:
|
||||
CStringTester();
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -478,7 +478,7 @@ PRInt32 nsStr::FindSubstr(const nsStr& aDest,const nsStr& aTarget, PRBool aIgnor
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
PRInt32 nsStr::FindChar(const nsStr& aDest,const PRUnichar aChar, PRBool aIgnoreCase,PRUint32 anOffset) {
|
||||
PRInt32 nsStr::FindChar(const nsStr& aDest,PRUnichar aChar, PRBool aIgnoreCase,PRUint32 anOffset) {
|
||||
PRInt32 result=gFindChars[aDest.mCharSize](aDest.mStr,aDest.mLength,anOffset,aChar,aIgnoreCase);
|
||||
return result;
|
||||
}
|
||||
|
@ -553,7 +553,7 @@ PRInt32 nsStr::RFindSubstr(const nsStr& aDest,const nsStr& aTarget, PRBool aIgno
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
PRInt32 nsStr::RFindChar(const nsStr& aDest,const PRUnichar aChar, PRBool aIgnoreCase,PRUint32 anOffset) {
|
||||
PRInt32 nsStr::RFindChar(const nsStr& aDest,PRUnichar aChar, PRBool aIgnoreCase,PRUint32 anOffset) {
|
||||
PRInt32 result=gRFindChars[aDest.mCharSize](aDest.mStr,aDest.mLength,anOffset,aChar,aIgnoreCase);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -149,6 +149,26 @@ void Truncate(PRInt32 anIndex=0);
|
|||
*/
|
||||
PRBool IsOrdered(void) const;
|
||||
|
||||
/**
|
||||
* Determine whether or not the characters in this
|
||||
* string are in store as 1 or 2 byte (unicode) strings.
|
||||
*
|
||||
* @return TRUE if ordered.
|
||||
*/
|
||||
PRBool IsUnicode(void) const {
|
||||
PRBool result=PRBool(mCharSize==eTwoByte);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether or not this string has a length of 0
|
||||
*
|
||||
* @return TRUE if empty.
|
||||
*/
|
||||
PRBool IsEmpty(void) const {
|
||||
return PRBool(0==mLength);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
Accessor methods...
|
||||
*********************************************************************/
|
||||
|
@ -774,16 +794,6 @@ public:
|
|||
nsSubsumeStr(const char* aString);
|
||||
};
|
||||
|
||||
#ifdef RICKG_DEBUG
|
||||
/********************************************************
|
||||
This class's only purpose in life is to test nsString2.
|
||||
********************************************************/
|
||||
class CStringTester {
|
||||
public:
|
||||
CStringTester();
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -478,7 +478,7 @@ PRInt32 nsStr::FindSubstr(const nsStr& aDest,const nsStr& aTarget, PRBool aIgnor
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
PRInt32 nsStr::FindChar(const nsStr& aDest,const PRUnichar aChar, PRBool aIgnoreCase,PRUint32 anOffset) {
|
||||
PRInt32 nsStr::FindChar(const nsStr& aDest,PRUnichar aChar, PRBool aIgnoreCase,PRUint32 anOffset) {
|
||||
PRInt32 result=gFindChars[aDest.mCharSize](aDest.mStr,aDest.mLength,anOffset,aChar,aIgnoreCase);
|
||||
return result;
|
||||
}
|
||||
|
@ -553,7 +553,7 @@ PRInt32 nsStr::RFindSubstr(const nsStr& aDest,const nsStr& aTarget, PRBool aIgno
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
PRInt32 nsStr::RFindChar(const nsStr& aDest,const PRUnichar aChar, PRBool aIgnoreCase,PRUint32 anOffset) {
|
||||
PRInt32 nsStr::RFindChar(const nsStr& aDest,PRUnichar aChar, PRBool aIgnoreCase,PRUint32 anOffset) {
|
||||
PRInt32 result=gRFindChars[aDest.mCharSize](aDest.mStr,aDest.mLength,anOffset,aChar,aIgnoreCase);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -149,6 +149,26 @@ void Truncate(PRInt32 anIndex=0);
|
|||
*/
|
||||
PRBool IsOrdered(void) const;
|
||||
|
||||
/**
|
||||
* Determine whether or not the characters in this
|
||||
* string are in store as 1 or 2 byte (unicode) strings.
|
||||
*
|
||||
* @return TRUE if ordered.
|
||||
*/
|
||||
PRBool IsUnicode(void) const {
|
||||
PRBool result=PRBool(mCharSize==eTwoByte);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether or not this string has a length of 0
|
||||
*
|
||||
* @return TRUE if empty.
|
||||
*/
|
||||
PRBool IsEmpty(void) const {
|
||||
return PRBool(0==mLength);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
Accessor methods...
|
||||
*********************************************************************/
|
||||
|
@ -774,16 +794,6 @@ public:
|
|||
nsSubsumeStr(const char* aString);
|
||||
};
|
||||
|
||||
#ifdef RICKG_DEBUG
|
||||
/********************************************************
|
||||
This class's only purpose in life is to test nsString2.
|
||||
********************************************************/
|
||||
class CStringTester {
|
||||
public:
|
||||
CStringTester();
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -478,7 +478,7 @@ PRInt32 nsStr::FindSubstr(const nsStr& aDest,const nsStr& aTarget, PRBool aIgnor
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
PRInt32 nsStr::FindChar(const nsStr& aDest,const PRUnichar aChar, PRBool aIgnoreCase,PRUint32 anOffset) {
|
||||
PRInt32 nsStr::FindChar(const nsStr& aDest,PRUnichar aChar, PRBool aIgnoreCase,PRUint32 anOffset) {
|
||||
PRInt32 result=gFindChars[aDest.mCharSize](aDest.mStr,aDest.mLength,anOffset,aChar,aIgnoreCase);
|
||||
return result;
|
||||
}
|
||||
|
@ -553,7 +553,7 @@ PRInt32 nsStr::RFindSubstr(const nsStr& aDest,const nsStr& aTarget, PRBool aIgno
|
|||
* @param
|
||||
* @return
|
||||
*/
|
||||
PRInt32 nsStr::RFindChar(const nsStr& aDest,const PRUnichar aChar, PRBool aIgnoreCase,PRUint32 anOffset) {
|
||||
PRInt32 nsStr::RFindChar(const nsStr& aDest,PRUnichar aChar, PRBool aIgnoreCase,PRUint32 anOffset) {
|
||||
PRInt32 result=gRFindChars[aDest.mCharSize](aDest.mStr,aDest.mLength,anOffset,aChar,aIgnoreCase);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -149,6 +149,26 @@ void Truncate(PRInt32 anIndex=0);
|
|||
*/
|
||||
PRBool IsOrdered(void) const;
|
||||
|
||||
/**
|
||||
* Determine whether or not the characters in this
|
||||
* string are in store as 1 or 2 byte (unicode) strings.
|
||||
*
|
||||
* @return TRUE if ordered.
|
||||
*/
|
||||
PRBool IsUnicode(void) const {
|
||||
PRBool result=PRBool(mCharSize==eTwoByte);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether or not this string has a length of 0
|
||||
*
|
||||
* @return TRUE if empty.
|
||||
*/
|
||||
PRBool IsEmpty(void) const {
|
||||
return PRBool(0==mLength);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
Accessor methods...
|
||||
*********************************************************************/
|
||||
|
@ -774,16 +794,6 @@ public:
|
|||
nsSubsumeStr(const char* aString);
|
||||
};
|
||||
|
||||
#ifdef RICKG_DEBUG
|
||||
/********************************************************
|
||||
This class's only purpose in life is to test nsString2.
|
||||
********************************************************/
|
||||
class CStringTester {
|
||||
public:
|
||||
CStringTester();
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче