diff --git a/mozilla/string/public/nsDependentString.h b/mozilla/string/public/nsDependentString.h index ca520e7a749..ec5ba8191f7 100644 --- a/mozilla/string/public/nsDependentString.h +++ b/mozilla/string/public/nsDependentString.h @@ -52,20 +52,20 @@ class NS_COM nsLocalString explicit nsLocalString( const PRUnichar* aLiteral ) - : mHandle(aLiteral, aLiteral ? (aLiteral+nsCharTraits::length(aLiteral)) : aLiteral) + : mHandle(NS_CONST_CAST(PRUnichar*, aLiteral), aLiteral ? (NS_CONST_CAST(PRUnichar*, aLiteral)+nsCharTraits::length(aLiteral)) : NS_CONST_CAST(PRUnichar*, aLiteral)) { // nothing else to do here } nsLocalString( const PRUnichar* aLiteral, PRUint32 aLength ) - : mHandle(aLiteral, aLiteral+aLength) + : mHandle(NS_CONST_CAST(PRUnichar*, aLiteral), NS_CONST_CAST(PRUnichar*, aLiteral)+aLength) { // This is an annoying hack. Callers should be fixed to use the other // constructor if they don't really know the length. if ( aLength == PRUint32(-1) ) { // NS_WARNING("Tell scc: Caller constructing a string doesn't know the real length. Please use the other constructor."); - mHandle.DataEnd(aLiteral ? (aLiteral+nsCharTraits::length(aLiteral)) : aLiteral); + mHandle.DataEnd(aLiteral ? (NS_CONST_CAST(PRUnichar*, aLiteral)+nsCharTraits::length(aLiteral)) : NS_CONST_CAST(PRUnichar*, aLiteral)); } } @@ -91,20 +91,20 @@ class NS_COM nsLocalCString explicit nsLocalCString( const char* aLiteral ) - : mHandle(aLiteral, aLiteral ? (aLiteral+nsCharTraits::length(aLiteral)) : aLiteral) + : mHandle(NS_CONST_CAST(char*, aLiteral), aLiteral ? (NS_CONST_CAST(char*, aLiteral)+nsCharTraits::length(aLiteral)) : NS_CONST_CAST(char*, aLiteral)) { // nothing else to do here } nsLocalCString( const char* aLiteral, PRUint32 aLength ) - : mHandle(aLiteral, aLiteral+aLength) + : mHandle(NS_CONST_CAST(char*, aLiteral), NS_CONST_CAST(char*, aLiteral)+aLength) { // This is an annoying hack. Callers should be fixed to use the other // constructor if they don't really know the length. if ( aLength == PRUint32(-1) ) { // NS_WARNING("Tell scc: Caller constructing a string doesn't know the real length. Please use the other constructor."); - mHandle.DataEnd(aLiteral ? (aLiteral+nsCharTraits::length(aLiteral)) : aLiteral); + mHandle.DataEnd(aLiteral ? (NS_CONST_CAST(char*, aLiteral)+nsCharTraits::length(aLiteral)) : NS_CONST_CAST(char*, aLiteral)); } } diff --git a/mozilla/string/public/nsLocalString.h b/mozilla/string/public/nsLocalString.h index ca520e7a749..ec5ba8191f7 100644 --- a/mozilla/string/public/nsLocalString.h +++ b/mozilla/string/public/nsLocalString.h @@ -52,20 +52,20 @@ class NS_COM nsLocalString explicit nsLocalString( const PRUnichar* aLiteral ) - : mHandle(aLiteral, aLiteral ? (aLiteral+nsCharTraits::length(aLiteral)) : aLiteral) + : mHandle(NS_CONST_CAST(PRUnichar*, aLiteral), aLiteral ? (NS_CONST_CAST(PRUnichar*, aLiteral)+nsCharTraits::length(aLiteral)) : NS_CONST_CAST(PRUnichar*, aLiteral)) { // nothing else to do here } nsLocalString( const PRUnichar* aLiteral, PRUint32 aLength ) - : mHandle(aLiteral, aLiteral+aLength) + : mHandle(NS_CONST_CAST(PRUnichar*, aLiteral), NS_CONST_CAST(PRUnichar*, aLiteral)+aLength) { // This is an annoying hack. Callers should be fixed to use the other // constructor if they don't really know the length. if ( aLength == PRUint32(-1) ) { // NS_WARNING("Tell scc: Caller constructing a string doesn't know the real length. Please use the other constructor."); - mHandle.DataEnd(aLiteral ? (aLiteral+nsCharTraits::length(aLiteral)) : aLiteral); + mHandle.DataEnd(aLiteral ? (NS_CONST_CAST(PRUnichar*, aLiteral)+nsCharTraits::length(aLiteral)) : NS_CONST_CAST(PRUnichar*, aLiteral)); } } @@ -91,20 +91,20 @@ class NS_COM nsLocalCString explicit nsLocalCString( const char* aLiteral ) - : mHandle(aLiteral, aLiteral ? (aLiteral+nsCharTraits::length(aLiteral)) : aLiteral) + : mHandle(NS_CONST_CAST(char*, aLiteral), aLiteral ? (NS_CONST_CAST(char*, aLiteral)+nsCharTraits::length(aLiteral)) : NS_CONST_CAST(char*, aLiteral)) { // nothing else to do here } nsLocalCString( const char* aLiteral, PRUint32 aLength ) - : mHandle(aLiteral, aLiteral+aLength) + : mHandle(NS_CONST_CAST(char*, aLiteral), NS_CONST_CAST(char*, aLiteral)+aLength) { // This is an annoying hack. Callers should be fixed to use the other // constructor if they don't really know the length. if ( aLength == PRUint32(-1) ) { // NS_WARNING("Tell scc: Caller constructing a string doesn't know the real length. Please use the other constructor."); - mHandle.DataEnd(aLiteral ? (aLiteral+nsCharTraits::length(aLiteral)) : aLiteral); + mHandle.DataEnd(aLiteral ? (NS_CONST_CAST(char*, aLiteral)+nsCharTraits::length(aLiteral)) : NS_CONST_CAST(char*, aLiteral)); } } diff --git a/mozilla/string/public/nsSlidingString.h b/mozilla/string/public/nsSlidingString.h index 4c0d24f1797..181e59dd64c 100755 --- a/mozilla/string/public/nsSlidingString.h +++ b/mozilla/string/public/nsSlidingString.h @@ -25,8 +25,13 @@ #ifndef nsSlidingString_h___ #define nsSlidingString_h___ -#include "nsAReadableString.h" +#ifndef nsAString_h___ +#include "nsAString.h" +#endif + +#ifndef nsSharedBufferList_h___ #include "nsSharedBufferList.h" +#endif /** @@ -90,14 +95,14 @@ class NS_COM nsSlidingSubstring nsSlidingSubstring( const nsSlidingSubstring& aString, const nsReadingIterator& aStart, const nsReadingIterator& aEnd ); nsSlidingSubstring( const nsSlidingString& ); nsSlidingSubstring( const nsSlidingString& aString, const nsReadingIterator& aStart, const nsReadingIterator& aEnd ); - explicit nsSlidingSubstring( const nsAReadableString& ); + explicit nsSlidingSubstring( const nsAString& ); // copy the supplied string into a new buffer ... there will be no modifying instance over this buffer list void Rebind( const nsSlidingSubstring& ); void Rebind( const nsSlidingSubstring&, const nsReadingIterator&, const nsReadingIterator& ); void Rebind( const nsSlidingString& ); void Rebind( const nsSlidingString&, const nsReadingIterator&, const nsReadingIterator& ); - void Rebind( const nsAReadableString& ); + void Rebind( const nsAString& ); ~nsSlidingSubstring(); @@ -106,6 +111,7 @@ class NS_COM nsSlidingSubstring protected: nsSlidingSubstring( nsSlidingSharedBufferList* aBufferList ); virtual const PRUnichar* GetReadableFragment( nsReadableFragment&, nsFragmentRequest, PRUint32 ) const; + virtual PRUnichar* GetWritableFragment( nsWritableFragment&, nsFragmentRequest, PRUint32 ) { } private: // can't assign into me, I'm a read-only reference @@ -176,8 +182,9 @@ class NS_COM nsSlidingString protected: virtual const PRUnichar* GetReadableFragment( nsReadableFragment&, nsFragmentRequest, PRUint32 ) const; + virtual PRUnichar* GetWritableFragment( nsWritableFragment&, nsFragmentRequest, PRUint32 ) { } - void InsertReadable( const nsAReadableString&, const nsReadingIterator& ); // ...to implement |nsScannerString::UngetReadable| + void InsertReadable( const nsAString&, const nsReadingIterator& ); // ...to implement |nsScannerString::UngetReadable| private: diff --git a/mozilla/string/src/nsSlidingString.cpp b/mozilla/string/src/nsSlidingString.cpp index f574779c281..51a5842581d 100755 --- a/mozilla/string/src/nsSlidingString.cpp +++ b/mozilla/string/src/nsSlidingString.cpp @@ -99,7 +99,7 @@ nsSlidingSubstring::nsSlidingSubstring( nsSlidingSharedBufferList* aBufferList ) typedef const nsSharedBufferList::Buffer* Buffer_ptr; static nsSharedBufferList::Buffer* -AllocateContiguousHandleWithData( Buffer_ptr aDummyHandlePtr, const nsAReadableString& aDataSource ) +AllocateContiguousHandleWithData( Buffer_ptr aDummyHandlePtr, const nsAString& aDataSource ) { typedef const PRUnichar* PRUnichar_ptr; @@ -131,7 +131,7 @@ AllocateContiguousHandleWithData( Buffer_ptr aDummyHandlePtr, const nsAReadableS return result; } -nsSlidingSubstring::nsSlidingSubstring( const nsAReadableString& aSourceString ) +nsSlidingSubstring::nsSlidingSubstring( const nsAString& aSourceString ) : mBufferList(new nsSlidingSharedBufferList(AllocateContiguousHandleWithData(Buffer_ptr(0), aSourceString))) { init_range_from_buffer_list(); @@ -189,7 +189,7 @@ nsSlidingSubstring::Rebind( const nsSlidingString& aString, const nsReadingItera } void -nsSlidingSubstring::Rebind( const nsAReadableString& aSourceString ) +nsSlidingSubstring::Rebind( const nsAString& aSourceString ) { release_ownership_of_buffer_list(); mBufferList = new nsSlidingSharedBufferList(AllocateContiguousHandleWithData(Buffer_ptr(0), aSourceString)); @@ -291,7 +291,7 @@ nsSlidingString::AppendBuffer( PRUnichar* aStorageStart, PRUnichar* aDataEnd, PR } void -nsSlidingString::InsertReadable( const nsAReadableString& aReadable, const nsReadingIterator& aInsertPoint ) +nsSlidingString::InsertReadable( const nsAString& aReadable, const nsReadingIterator& aInsertPoint ) /* * Warning: this routine manipulates the shared buffer list in an unexpected way. * The original design did not really allow for insertions, but this call promises diff --git a/mozilla/xpcom/string/public/nsDependentString.h b/mozilla/xpcom/string/public/nsDependentString.h index ca520e7a749..ec5ba8191f7 100644 --- a/mozilla/xpcom/string/public/nsDependentString.h +++ b/mozilla/xpcom/string/public/nsDependentString.h @@ -52,20 +52,20 @@ class NS_COM nsLocalString explicit nsLocalString( const PRUnichar* aLiteral ) - : mHandle(aLiteral, aLiteral ? (aLiteral+nsCharTraits::length(aLiteral)) : aLiteral) + : mHandle(NS_CONST_CAST(PRUnichar*, aLiteral), aLiteral ? (NS_CONST_CAST(PRUnichar*, aLiteral)+nsCharTraits::length(aLiteral)) : NS_CONST_CAST(PRUnichar*, aLiteral)) { // nothing else to do here } nsLocalString( const PRUnichar* aLiteral, PRUint32 aLength ) - : mHandle(aLiteral, aLiteral+aLength) + : mHandle(NS_CONST_CAST(PRUnichar*, aLiteral), NS_CONST_CAST(PRUnichar*, aLiteral)+aLength) { // This is an annoying hack. Callers should be fixed to use the other // constructor if they don't really know the length. if ( aLength == PRUint32(-1) ) { // NS_WARNING("Tell scc: Caller constructing a string doesn't know the real length. Please use the other constructor."); - mHandle.DataEnd(aLiteral ? (aLiteral+nsCharTraits::length(aLiteral)) : aLiteral); + mHandle.DataEnd(aLiteral ? (NS_CONST_CAST(PRUnichar*, aLiteral)+nsCharTraits::length(aLiteral)) : NS_CONST_CAST(PRUnichar*, aLiteral)); } } @@ -91,20 +91,20 @@ class NS_COM nsLocalCString explicit nsLocalCString( const char* aLiteral ) - : mHandle(aLiteral, aLiteral ? (aLiteral+nsCharTraits::length(aLiteral)) : aLiteral) + : mHandle(NS_CONST_CAST(char*, aLiteral), aLiteral ? (NS_CONST_CAST(char*, aLiteral)+nsCharTraits::length(aLiteral)) : NS_CONST_CAST(char*, aLiteral)) { // nothing else to do here } nsLocalCString( const char* aLiteral, PRUint32 aLength ) - : mHandle(aLiteral, aLiteral+aLength) + : mHandle(NS_CONST_CAST(char*, aLiteral), NS_CONST_CAST(char*, aLiteral)+aLength) { // This is an annoying hack. Callers should be fixed to use the other // constructor if they don't really know the length. if ( aLength == PRUint32(-1) ) { // NS_WARNING("Tell scc: Caller constructing a string doesn't know the real length. Please use the other constructor."); - mHandle.DataEnd(aLiteral ? (aLiteral+nsCharTraits::length(aLiteral)) : aLiteral); + mHandle.DataEnd(aLiteral ? (NS_CONST_CAST(char*, aLiteral)+nsCharTraits::length(aLiteral)) : NS_CONST_CAST(char*, aLiteral)); } } diff --git a/mozilla/xpcom/string/public/nsLocalString.h b/mozilla/xpcom/string/public/nsLocalString.h index ca520e7a749..ec5ba8191f7 100644 --- a/mozilla/xpcom/string/public/nsLocalString.h +++ b/mozilla/xpcom/string/public/nsLocalString.h @@ -52,20 +52,20 @@ class NS_COM nsLocalString explicit nsLocalString( const PRUnichar* aLiteral ) - : mHandle(aLiteral, aLiteral ? (aLiteral+nsCharTraits::length(aLiteral)) : aLiteral) + : mHandle(NS_CONST_CAST(PRUnichar*, aLiteral), aLiteral ? (NS_CONST_CAST(PRUnichar*, aLiteral)+nsCharTraits::length(aLiteral)) : NS_CONST_CAST(PRUnichar*, aLiteral)) { // nothing else to do here } nsLocalString( const PRUnichar* aLiteral, PRUint32 aLength ) - : mHandle(aLiteral, aLiteral+aLength) + : mHandle(NS_CONST_CAST(PRUnichar*, aLiteral), NS_CONST_CAST(PRUnichar*, aLiteral)+aLength) { // This is an annoying hack. Callers should be fixed to use the other // constructor if they don't really know the length. if ( aLength == PRUint32(-1) ) { // NS_WARNING("Tell scc: Caller constructing a string doesn't know the real length. Please use the other constructor."); - mHandle.DataEnd(aLiteral ? (aLiteral+nsCharTraits::length(aLiteral)) : aLiteral); + mHandle.DataEnd(aLiteral ? (NS_CONST_CAST(PRUnichar*, aLiteral)+nsCharTraits::length(aLiteral)) : NS_CONST_CAST(PRUnichar*, aLiteral)); } } @@ -91,20 +91,20 @@ class NS_COM nsLocalCString explicit nsLocalCString( const char* aLiteral ) - : mHandle(aLiteral, aLiteral ? (aLiteral+nsCharTraits::length(aLiteral)) : aLiteral) + : mHandle(NS_CONST_CAST(char*, aLiteral), aLiteral ? (NS_CONST_CAST(char*, aLiteral)+nsCharTraits::length(aLiteral)) : NS_CONST_CAST(char*, aLiteral)) { // nothing else to do here } nsLocalCString( const char* aLiteral, PRUint32 aLength ) - : mHandle(aLiteral, aLiteral+aLength) + : mHandle(NS_CONST_CAST(char*, aLiteral), NS_CONST_CAST(char*, aLiteral)+aLength) { // This is an annoying hack. Callers should be fixed to use the other // constructor if they don't really know the length. if ( aLength == PRUint32(-1) ) { // NS_WARNING("Tell scc: Caller constructing a string doesn't know the real length. Please use the other constructor."); - mHandle.DataEnd(aLiteral ? (aLiteral+nsCharTraits::length(aLiteral)) : aLiteral); + mHandle.DataEnd(aLiteral ? (NS_CONST_CAST(char*, aLiteral)+nsCharTraits::length(aLiteral)) : NS_CONST_CAST(char*, aLiteral)); } } diff --git a/mozilla/xpcom/string/public/nsSlidingString.h b/mozilla/xpcom/string/public/nsSlidingString.h index 4c0d24f1797..181e59dd64c 100755 --- a/mozilla/xpcom/string/public/nsSlidingString.h +++ b/mozilla/xpcom/string/public/nsSlidingString.h @@ -25,8 +25,13 @@ #ifndef nsSlidingString_h___ #define nsSlidingString_h___ -#include "nsAReadableString.h" +#ifndef nsAString_h___ +#include "nsAString.h" +#endif + +#ifndef nsSharedBufferList_h___ #include "nsSharedBufferList.h" +#endif /** @@ -90,14 +95,14 @@ class NS_COM nsSlidingSubstring nsSlidingSubstring( const nsSlidingSubstring& aString, const nsReadingIterator& aStart, const nsReadingIterator& aEnd ); nsSlidingSubstring( const nsSlidingString& ); nsSlidingSubstring( const nsSlidingString& aString, const nsReadingIterator& aStart, const nsReadingIterator& aEnd ); - explicit nsSlidingSubstring( const nsAReadableString& ); + explicit nsSlidingSubstring( const nsAString& ); // copy the supplied string into a new buffer ... there will be no modifying instance over this buffer list void Rebind( const nsSlidingSubstring& ); void Rebind( const nsSlidingSubstring&, const nsReadingIterator&, const nsReadingIterator& ); void Rebind( const nsSlidingString& ); void Rebind( const nsSlidingString&, const nsReadingIterator&, const nsReadingIterator& ); - void Rebind( const nsAReadableString& ); + void Rebind( const nsAString& ); ~nsSlidingSubstring(); @@ -106,6 +111,7 @@ class NS_COM nsSlidingSubstring protected: nsSlidingSubstring( nsSlidingSharedBufferList* aBufferList ); virtual const PRUnichar* GetReadableFragment( nsReadableFragment&, nsFragmentRequest, PRUint32 ) const; + virtual PRUnichar* GetWritableFragment( nsWritableFragment&, nsFragmentRequest, PRUint32 ) { } private: // can't assign into me, I'm a read-only reference @@ -176,8 +182,9 @@ class NS_COM nsSlidingString protected: virtual const PRUnichar* GetReadableFragment( nsReadableFragment&, nsFragmentRequest, PRUint32 ) const; + virtual PRUnichar* GetWritableFragment( nsWritableFragment&, nsFragmentRequest, PRUint32 ) { } - void InsertReadable( const nsAReadableString&, const nsReadingIterator& ); // ...to implement |nsScannerString::UngetReadable| + void InsertReadable( const nsAString&, const nsReadingIterator& ); // ...to implement |nsScannerString::UngetReadable| private: diff --git a/mozilla/xpcom/string/src/nsSlidingString.cpp b/mozilla/xpcom/string/src/nsSlidingString.cpp index f574779c281..51a5842581d 100755 --- a/mozilla/xpcom/string/src/nsSlidingString.cpp +++ b/mozilla/xpcom/string/src/nsSlidingString.cpp @@ -99,7 +99,7 @@ nsSlidingSubstring::nsSlidingSubstring( nsSlidingSharedBufferList* aBufferList ) typedef const nsSharedBufferList::Buffer* Buffer_ptr; static nsSharedBufferList::Buffer* -AllocateContiguousHandleWithData( Buffer_ptr aDummyHandlePtr, const nsAReadableString& aDataSource ) +AllocateContiguousHandleWithData( Buffer_ptr aDummyHandlePtr, const nsAString& aDataSource ) { typedef const PRUnichar* PRUnichar_ptr; @@ -131,7 +131,7 @@ AllocateContiguousHandleWithData( Buffer_ptr aDummyHandlePtr, const nsAReadableS return result; } -nsSlidingSubstring::nsSlidingSubstring( const nsAReadableString& aSourceString ) +nsSlidingSubstring::nsSlidingSubstring( const nsAString& aSourceString ) : mBufferList(new nsSlidingSharedBufferList(AllocateContiguousHandleWithData(Buffer_ptr(0), aSourceString))) { init_range_from_buffer_list(); @@ -189,7 +189,7 @@ nsSlidingSubstring::Rebind( const nsSlidingString& aString, const nsReadingItera } void -nsSlidingSubstring::Rebind( const nsAReadableString& aSourceString ) +nsSlidingSubstring::Rebind( const nsAString& aSourceString ) { release_ownership_of_buffer_list(); mBufferList = new nsSlidingSharedBufferList(AllocateContiguousHandleWithData(Buffer_ptr(0), aSourceString)); @@ -291,7 +291,7 @@ nsSlidingString::AppendBuffer( PRUnichar* aStorageStart, PRUnichar* aDataEnd, PR } void -nsSlidingString::InsertReadable( const nsAReadableString& aReadable, const nsReadingIterator& aInsertPoint ) +nsSlidingString::InsertReadable( const nsAString& aReadable, const nsReadingIterator& aInsertPoint ) /* * Warning: this routine manipulates the shared buffer list in an unexpected way. * The original design did not really allow for insertions, but this call promises