From ce13bac37f6b63f4a12fdbac97ecb5a5048fe16b Mon Sep 17 00:00:00 2001 From: "jst%mozilla.jstenback.com" Date: Wed, 14 Jan 2004 19:26:17 +0000 Subject: [PATCH] Fixing bug 230849. Making LossyCopyUTF16toASCII() and CopyASCIItoUTF8() truncate the destination even when the source is null. r=jshin@mailaps.org, sr=peterv@propagandism.org --- xpcom/string/src/nsReadableUtils.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xpcom/string/src/nsReadableUtils.cpp b/xpcom/string/src/nsReadableUtils.cpp index 6baa85cddc6..c4f6a428808 100755 --- a/xpcom/string/src/nsReadableUtils.cpp +++ b/xpcom/string/src/nsReadableUtils.cpp @@ -166,8 +166,8 @@ NS_COM void LossyCopyUTF16toASCII( const PRUnichar* aSource, nsACString& aDest ) { + aDest.Truncate(); if (aSource) { - aDest.Truncate(); LossyAppendUTF16toASCII(nsDependentString(aSource), aDest); } } @@ -176,8 +176,8 @@ NS_COM void CopyASCIItoUTF16( const char* aSource, nsAString& aDest ) { + aDest.Truncate(); if (aSource) { - aDest.Truncate(); AppendASCIItoUTF16(nsDependentCString(aSource), aDest); } }