$OpenBSD: patch-string_embed_nsEmbedString_cpp,v 1.1.1.1 2003/05/18 20:43:49 wilfried Exp $ --- string/embed/nsEmbedString.cpp.orig Mon Mar 24 23:46:49 2003 +++ string/embed/nsEmbedString.cpp Sun May 18 04:48:33 2003 @@ -39,7 +39,7 @@ #include #include "nsEmbedString.h" -const PRUnichar gCommonEmptyBuffer[1] = { 0 }; +static const PRUnichar gCommonEmptyBuffer[1] = { 0 }; nsEmbedString::nsEmbedString() { @@ -130,7 +130,7 @@ nsEmbedString::Realloc(size_type aNewSiz PRBool nsEmbedString::OwnsBuffer() const { - return mStr != (char_type*)gCommonEmptyBuffer; + return mStr != (char_type*)gCommonEmptyBuffer && mCapacity != 0; } const nsEmbedString::char_type* @@ -180,7 +180,7 @@ nsEmbedString::SetLength(size_type aLeng GrowCapacity(aLength); mLength = aLength; - if (mStr != (char_type*)gCommonEmptyBuffer) + if (mStr != (char_type*)gCommonEmptyBuffer && mCapacity != 0) AddNullTerminator(); } @@ -336,7 +336,7 @@ nsEmbedCString::Realloc(size_type aNewSi PRBool nsEmbedCString::OwnsBuffer() const { - return mStr != (char_type*)gCommonEmptyBuffer; + return mStr != (char_type*)gCommonEmptyBuffer && mCapacity != 0; } const nsEmbedCString::char_type* @@ -386,7 +386,7 @@ nsEmbedCString::SetLength(size_type aLen GrowCapacity(aLength); mLength = aLength; - if (mStr != (char_type*)gCommonEmptyBuffer) + if (mStr != (char_type*)gCommonEmptyBuffer && mCapacity != 0) AddNullTerminator(); }