From 518102c3873373c77daf92feaaca14bb8228baed Mon Sep 17 00:00:00 2001 From: Jonas Sicking Date: Mon, 8 Mar 2010 08:03:55 -0800 Subject: [PATCH] Bug 534136 part 4bis: Fix review comments from peterv that should have been in initial patch. --- parser/html/nsHtml5Atom.cpp | 5 +++++ xpcom/ds/nsAtomTable.cpp | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/parser/html/nsHtml5Atom.cpp b/parser/html/nsHtml5Atom.cpp index 1727dd6586f..15cf4a8079e 100644 --- a/parser/html/nsHtml5Atom.cpp +++ b/parser/html/nsHtml5Atom.cpp @@ -51,6 +51,11 @@ nsHtml5Atom::nsHtml5Atom(const nsAString& aString) CopyUnicodeTo(aString, 0, mString, mLength); mString[mLength] = PRUnichar(0); } + + NS_ASSERTION(mString[mLength] == PRUnichar(0), "null terminated"); + NS_ASSERTION(buf && buf->StorageSize() >= (mLength+1) * sizeof(PRUnichar), + "enough storage"); + NS_ASSERTION(Equals(aString), "correct data"); } nsHtml5Atom::~nsHtml5Atom() diff --git a/xpcom/ds/nsAtomTable.cpp b/xpcom/ds/nsAtomTable.cpp index 441c41b451b..9bff0d93cce 100644 --- a/xpcom/ds/nsAtomTable.cpp +++ b/xpcom/ds/nsAtomTable.cpp @@ -269,7 +269,9 @@ AtomImpl::AtomImpl(nsStringBuffer* aStringBuffer, PRUint32 aLength) aStringBuffer->AddRef(); NS_ASSERTION(mString[mLength] == PRUnichar(0), "null terminated"); - NS_ASSERTION(aStringBuffer && aStringBuffer->StorageSize() == (mLength+1) * 2, "correct storage"); + NS_ASSERTION(aStringBuffer && + aStringBuffer->StorageSize() == (mLength+1) * sizeof(PRUnichar), + "correct storage"); } AtomImpl::~AtomImpl()