diff --git a/string/public/nsBufferHandle.h b/string/public/nsBufferHandle.h index 04a623117e3..f976b236f79 100755 --- a/string/public/nsBufferHandle.h +++ b/string/public/nsBufferHandle.h @@ -180,11 +180,6 @@ struct nsStringAllocatorTraits // end of string allocator stuff that needs to move - - /** - * - * @status FROZEN - */ template class nsSharedBufferHandle : public nsBufferHandle @@ -192,7 +187,6 @@ class nsSharedBufferHandle public: typedef PRUint32 size_type; - protected: enum { kIsImmutable = 0x01000000, // if this is set, the buffer cannot be modified even if its refcount is 1 diff --git a/string/public/nsXPIDLString.h b/string/public/nsXPIDLString.h index 50995fb3783..ecb7defe15a 100644 --- a/string/public/nsXPIDLString.h +++ b/string/public/nsXPIDLString.h @@ -188,9 +188,9 @@ class NS_COM nsXPIDLString // overridden to make getter_Copies mechanism work virtual const char_type* get() const { - return (mBuffer.get() != GetSharedEmptyBufferHandle()) - ? mBuffer->DataStart() - : 0; + return (mBuffer->GetImplementationFlags() & shared_buffer_handle_type::kIsNULL) + ? 0 + : mBuffer->DataStart(); } // deprecated, to be eliminated @@ -300,9 +300,9 @@ class NS_COM nsXPIDLCString // overridden to make getter_Copies mechanism work virtual const char_type* get() const { - return (mBuffer.get() != GetSharedEmptyBufferHandle()) - ? mBuffer->DataStart() - : 0; + return (mBuffer->GetImplementationFlags() & shared_buffer_handle_type::kIsNULL) + ? 0 + : mBuffer->DataStart(); } // deprecated, to be eliminated diff --git a/string/src/nsXPIDLString.cpp b/string/src/nsXPIDLString.cpp index d9dd2eb0bc1..5ea9266b732 100644 --- a/string/src/nsXPIDLString.cpp +++ b/string/src/nsXPIDLString.cpp @@ -156,6 +156,7 @@ nsXPIDLString::GetSharedEmptyBufferHandle() // race to set the refcount, in // which case we'll pull the // same trick in |Destroy|. + sBufferHandle->SetImplementationFlags(sBufferHandle->GetImplementationFlags() & shared_buffer_handle_type::kIsNULL); } return sBufferHandle; } @@ -238,6 +239,7 @@ nsXPIDLCString::GetSharedEmptyBufferHandle() // race to set the refcount, in // which case we'll pull the // same trick in |Destroy|. + sBufferHandle->SetImplementationFlags(sBufferHandle->GetImplementationFlags() & shared_buffer_handle_type::kIsNULL); } return sBufferHandle; } diff --git a/xpcom/string/public/nsBufferHandle.h b/xpcom/string/public/nsBufferHandle.h index 04a623117e3..f976b236f79 100755 --- a/xpcom/string/public/nsBufferHandle.h +++ b/xpcom/string/public/nsBufferHandle.h @@ -180,11 +180,6 @@ struct nsStringAllocatorTraits // end of string allocator stuff that needs to move - - /** - * - * @status FROZEN - */ template class nsSharedBufferHandle : public nsBufferHandle @@ -192,7 +187,6 @@ class nsSharedBufferHandle public: typedef PRUint32 size_type; - protected: enum { kIsImmutable = 0x01000000, // if this is set, the buffer cannot be modified even if its refcount is 1 diff --git a/xpcom/string/public/nsXPIDLString.h b/xpcom/string/public/nsXPIDLString.h index 50995fb3783..ecb7defe15a 100644 --- a/xpcom/string/public/nsXPIDLString.h +++ b/xpcom/string/public/nsXPIDLString.h @@ -188,9 +188,9 @@ class NS_COM nsXPIDLString // overridden to make getter_Copies mechanism work virtual const char_type* get() const { - return (mBuffer.get() != GetSharedEmptyBufferHandle()) - ? mBuffer->DataStart() - : 0; + return (mBuffer->GetImplementationFlags() & shared_buffer_handle_type::kIsNULL) + ? 0 + : mBuffer->DataStart(); } // deprecated, to be eliminated @@ -300,9 +300,9 @@ class NS_COM nsXPIDLCString // overridden to make getter_Copies mechanism work virtual const char_type* get() const { - return (mBuffer.get() != GetSharedEmptyBufferHandle()) - ? mBuffer->DataStart() - : 0; + return (mBuffer->GetImplementationFlags() & shared_buffer_handle_type::kIsNULL) + ? 0 + : mBuffer->DataStart(); } // deprecated, to be eliminated diff --git a/xpcom/string/src/nsXPIDLString.cpp b/xpcom/string/src/nsXPIDLString.cpp index d9dd2eb0bc1..5ea9266b732 100644 --- a/xpcom/string/src/nsXPIDLString.cpp +++ b/xpcom/string/src/nsXPIDLString.cpp @@ -156,6 +156,7 @@ nsXPIDLString::GetSharedEmptyBufferHandle() // race to set the refcount, in // which case we'll pull the // same trick in |Destroy|. + sBufferHandle->SetImplementationFlags(sBufferHandle->GetImplementationFlags() & shared_buffer_handle_type::kIsNULL); } return sBufferHandle; } @@ -238,6 +239,7 @@ nsXPIDLCString::GetSharedEmptyBufferHandle() // race to set the refcount, in // which case we'll pull the // same trick in |Destroy|. + sBufferHandle->SetImplementationFlags(sBufferHandle->GetImplementationFlags() & shared_buffer_handle_type::kIsNULL); } return sBufferHandle; }