odd 'n' ends
git-svn-id: svn://10.0.0.236/trunk@41053 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -651,7 +651,7 @@ PRInt32 nsStr::RFindCharInSet(const nsStr& aDest,const nsStr& aSet,PRBool aIgnor
|
||||
if(0<aDest.mLength) {
|
||||
while(--index>=0) {
|
||||
PRUnichar theChar=GetCharAt(aDest,index);
|
||||
thePos=gRFindChars[aSet.mCharSize](aSet.mStr,aSet.mLength,0,theChar,aIgnoreCase);
|
||||
thePos=gFindChars[aSet.mCharSize](aSet.mStr,aSet.mLength,0,theChar,aIgnoreCase);
|
||||
if(kNotFound!=thePos)
|
||||
return index;
|
||||
} //while
|
||||
@@ -691,7 +691,7 @@ PRInt32 nsStr::Compare(const nsStr& aDest,const nsStr& aSource,PRInt32 aCount,PR
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
CSharedStrBuffer::CSharedStrBuffer(char* aString,PRBool aStackBased,PRUint32 aCapacity,PRInt32 aLength) {
|
||||
CBufDescriptor::CBufDescriptor(char* aString,PRBool aStackBased,PRUint32 aCapacity,PRInt32 aLength) {
|
||||
mBuffer=aString;
|
||||
mCharSize=eOneByte;
|
||||
mStackBased=aStackBased;
|
||||
@@ -704,7 +704,7 @@ CSharedStrBuffer::CSharedStrBuffer(char* aString,PRBool aStackBased,PRUint32 aCa
|
||||
}
|
||||
}
|
||||
|
||||
CSharedStrBuffer::CSharedStrBuffer(PRUnichar* aString,PRBool aStackBased,PRUint32 aCapacity,PRInt32 aLength) {
|
||||
CBufDescriptor::CBufDescriptor(PRUnichar* aString,PRBool aStackBased,PRUint32 aCapacity,PRInt32 aLength) {
|
||||
mBuffer=(char*)aString;
|
||||
mCharSize=eTwoByte;
|
||||
mStackBased=aStackBased;
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#define _nsStr
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsCppSharedAllocator.h"
|
||||
#include "nsIAllocator.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
@@ -60,10 +60,10 @@ class nsIMemoryAgent;
|
||||
|
||||
//----------------------------------------------------------------------------------------
|
||||
|
||||
class NS_COM CSharedStrBuffer {
|
||||
class NS_COM CBufDescriptor {
|
||||
public:
|
||||
CSharedStrBuffer(char* aString,PRBool aStackBased,PRUint32 aCapacity,PRInt32 aLength=-1);
|
||||
CSharedStrBuffer(PRUnichar* aString,PRBool aStackBased,PRUint32 aCapacity,PRInt32 aLength=-1);
|
||||
CBufDescriptor(char* aString,PRBool aStackBased,PRUint32 aCapacity,PRInt32 aLength=-1);
|
||||
CBufDescriptor(PRUnichar* aString,PRBool aStackBased,PRUint32 aCapacity,PRInt32 aLength=-1);
|
||||
|
||||
char* mBuffer;
|
||||
eCharSize mCharSize;
|
||||
@@ -311,11 +311,8 @@ public:
|
||||
}
|
||||
|
||||
aDest.mCapacity=theNewCapacity++;
|
||||
size_t theSize=(theNewCapacity<<aDest.mCharSize);
|
||||
|
||||
// aDest.mStr=new char[theSize];
|
||||
nsCppSharedAllocator<char> shared_allocator;
|
||||
aDest.mStr = shared_allocator.allocate(theSize);
|
||||
PRUint32 theSize=(theNewCapacity<<aDest.mCharSize);
|
||||
aDest.mStr = (char*)nsAllocator::Alloc(theSize);
|
||||
|
||||
aDest.mOwnsBuffer=1;
|
||||
return PR_TRUE;
|
||||
@@ -324,9 +321,7 @@ public:
|
||||
virtual PRBool Free(nsStr& aDest){
|
||||
if(aDest.mStr){
|
||||
if(aDest.mOwnsBuffer){
|
||||
// delete [] aDest.mStr;
|
||||
nsCppSharedAllocator<char> shared_allocator;
|
||||
shared_allocator.deallocate(aDest.mStr, aDest.mCapacity);
|
||||
nsAllocator::Free(aDest.mStr);
|
||||
}
|
||||
aDest.mStr=0;
|
||||
aDest.mOwnsBuffer=0;
|
||||
|
||||
Reference in New Issue
Block a user