From 1ee3d0b751493047deb17dbac9f615f1ff7d9e71 Mon Sep 17 00:00:00 2001 From: "scc%mozilla.org" Date: Sat, 10 Feb 2001 01:05:43 +0000 Subject: [PATCH] fix bustage caused by access violations not caught in CodeWarrior git-svn-id: svn://10.0.0.236/trunk@86722 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/htmlparser/src/nsScanner.cpp | 5 +++-- mozilla/parser/htmlparser/src/nsScanner.cpp | 5 +++-- mozilla/string/public/nsSlidingString.h | 13 +++++++++++++ mozilla/xpcom/ds/nsSlidingString.h | 13 +++++++++++++ mozilla/xpcom/string/public/nsSlidingString.h | 13 +++++++++++++ 5 files changed, 45 insertions(+), 4 deletions(-) diff --git a/mozilla/htmlparser/src/nsScanner.cpp b/mozilla/htmlparser/src/nsScanner.cpp index 0995b272396..dde8783add9 100644 --- a/mozilla/htmlparser/src/nsScanner.cpp +++ b/mozilla/htmlparser/src/nsScanner.cpp @@ -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 diff --git a/mozilla/parser/htmlparser/src/nsScanner.cpp b/mozilla/parser/htmlparser/src/nsScanner.cpp index 0995b272396..dde8783add9 100644 --- a/mozilla/parser/htmlparser/src/nsScanner.cpp +++ b/mozilla/parser/htmlparser/src/nsScanner.cpp @@ -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 diff --git a/mozilla/string/public/nsSlidingString.h b/mozilla/string/public/nsSlidingString.h index af36acc39eb..9e753182181 100755 --- a/mozilla/string/public/nsSlidingString.h +++ b/mozilla/string/public/nsSlidingString.h @@ -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&, 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 diff --git a/mozilla/xpcom/ds/nsSlidingString.h b/mozilla/xpcom/ds/nsSlidingString.h index af36acc39eb..9e753182181 100755 --- a/mozilla/xpcom/ds/nsSlidingString.h +++ b/mozilla/xpcom/ds/nsSlidingString.h @@ -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&, 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 diff --git a/mozilla/xpcom/string/public/nsSlidingString.h b/mozilla/xpcom/string/public/nsSlidingString.h index af36acc39eb..9e753182181 100755 --- a/mozilla/xpcom/string/public/nsSlidingString.h +++ b/mozilla/xpcom/string/public/nsSlidingString.h @@ -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&, 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