fix bustage caused by access violations not caught in CodeWarrior <sorry>

git-svn-id: svn://10.0.0.236/trunk@86722 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
scc%mozilla.org 2001-02-10 01:05:43 +00:00
parent dbb7bc5232
commit 1ee3d0b751
5 changed files with 45 additions and 4 deletions

View File

@ -47,7 +47,7 @@ nsScannerString::InsertData(const PRUnichar* aDataStart,
* nor the work string will be invalidated.
*/
{
mBufferList->SplitBuffer(mStart, nsSharedBufferList::kSplitCopyRightData);
BufferList()->SplitBuffer(StartPosition(), nsSharedBufferList::kSplitCopyRightData);
// splitting to the right keeps the work string and any extant token pointing to and
// holding a reference count on the same buffer
@ -56,7 +56,8 @@ nsScannerString::InsertData(const PRUnichar* aDataStart,
// BULLSHIT ALERT: we may have empty space to re-use in the split buffer, measure the cost
// of this and decide if we should do the work to fill it
mBufferList->LinkBuffer(mStart.mBuffer, new_buffer, mStart.mBuffer->mNext);
Buffer* buffer_to_split = StartPosition().mBuffer;
BufferList()->LinkBuffer(buffer_to_split, new_buffer, buffer_to_split->mNext);
}
void

View File

@ -47,7 +47,7 @@ nsScannerString::InsertData(const PRUnichar* aDataStart,
* nor the work string will be invalidated.
*/
{
mBufferList->SplitBuffer(mStart, nsSharedBufferList::kSplitCopyRightData);
BufferList()->SplitBuffer(StartPosition(), nsSharedBufferList::kSplitCopyRightData);
// splitting to the right keeps the work string and any extant token pointing to and
// holding a reference count on the same buffer
@ -56,7 +56,8 @@ nsScannerString::InsertData(const PRUnichar* aDataStart,
// BULLSHIT ALERT: we may have empty space to re-use in the split buffer, measure the cost
// of this and decide if we should do the work to fill it
mBufferList->LinkBuffer(mStart.mBuffer, new_buffer, mStart.mBuffer->mNext);
Buffer* buffer_to_split = StartPosition().mBuffer;
BufferList()->LinkBuffer(buffer_to_split, new_buffer, buffer_to_split->mNext);
}
void

View File

@ -160,6 +160,9 @@ class NS_COM nsSlidingString
friend class nsSlidingSubstring;
public:
typedef nsSlidingSharedBufferList::Buffer Buffer;
typedef nsSlidingSharedBufferList::Position Position;
nsSlidingString( PRUnichar* aStorageStart, PRUnichar* aDataEnd, PRUnichar* aStorageEnd );
// ...created by consuming ownership of a buffer ... |aStorageStart| must point to something
// that it will be OK for the slidking string to call |nsMemory::Free| on
@ -177,6 +180,16 @@ class NS_COM nsSlidingString
protected:
virtual const PRUnichar* GetReadableFragment( nsReadableFragment<PRUnichar>&, nsFragmentRequest, PRUint32 ) const;
// |using| doesn't work everywhere, so we have to provide accessors for derived classes
Position& StartPosition() { return mStart; }
const Position& StartPosition() const { return mStart; }
Position& EndPosition() { return mEnd; }
const Position& EndPosition() const { return mEnd; }
nsSlidingSharedBufferList* BufferList() { return mBufferList; }
const nsSlidingSharedBufferList* BufferList() const { return mBufferList; }
private:
void

View File

@ -160,6 +160,9 @@ class NS_COM nsSlidingString
friend class nsSlidingSubstring;
public:
typedef nsSlidingSharedBufferList::Buffer Buffer;
typedef nsSlidingSharedBufferList::Position Position;
nsSlidingString( PRUnichar* aStorageStart, PRUnichar* aDataEnd, PRUnichar* aStorageEnd );
// ...created by consuming ownership of a buffer ... |aStorageStart| must point to something
// that it will be OK for the slidking string to call |nsMemory::Free| on
@ -177,6 +180,16 @@ class NS_COM nsSlidingString
protected:
virtual const PRUnichar* GetReadableFragment( nsReadableFragment<PRUnichar>&, nsFragmentRequest, PRUint32 ) const;
// |using| doesn't work everywhere, so we have to provide accessors for derived classes
Position& StartPosition() { return mStart; }
const Position& StartPosition() const { return mStart; }
Position& EndPosition() { return mEnd; }
const Position& EndPosition() const { return mEnd; }
nsSlidingSharedBufferList* BufferList() { return mBufferList; }
const nsSlidingSharedBufferList* BufferList() const { return mBufferList; }
private:
void

View File

@ -160,6 +160,9 @@ class NS_COM nsSlidingString
friend class nsSlidingSubstring;
public:
typedef nsSlidingSharedBufferList::Buffer Buffer;
typedef nsSlidingSharedBufferList::Position Position;
nsSlidingString( PRUnichar* aStorageStart, PRUnichar* aDataEnd, PRUnichar* aStorageEnd );
// ...created by consuming ownership of a buffer ... |aStorageStart| must point to something
// that it will be OK for the slidking string to call |nsMemory::Free| on
@ -177,6 +180,16 @@ class NS_COM nsSlidingString
protected:
virtual const PRUnichar* GetReadableFragment( nsReadableFragment<PRUnichar>&, nsFragmentRequest, PRUint32 ) const;
// |using| doesn't work everywhere, so we have to provide accessors for derived classes
Position& StartPosition() { return mStart; }
const Position& StartPosition() const { return mStart; }
Position& EndPosition() { return mEnd; }
const Position& EndPosition() const { return mEnd; }
nsSlidingSharedBufferList* BufferList() { return mBufferList; }
const nsSlidingSharedBufferList* BufferList() const { return mBufferList; }
private:
void