openbsd-ports/www/mozilla/patches/patch-string_embed_nsEmbedString_cpp

49 lines
1.4 KiB
Plaintext

$OpenBSD: patch-string_embed_nsEmbedString_cpp,v 1.1 2003/05/14 21:50:59 wilfried Exp $
--- string/embed/nsEmbedString.cpp.orig Mon Mar 24 23:46:49 2003
+++ string/embed/nsEmbedString.cpp Wed May 14 10:52:02 2003
@@ -39,7 +39,7 @@
#include <stdlib.h>
#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();
}