Move some basic macros for working with UTF16 from intl to XPCOM; use them in

some places including the HTML parser.  Part of fix for bug 316394; the CSS
parser changes are still coming.  r=smontagu, r=mrbkap on parser changes, sr=dbaron


git-svn-id: svn://10.0.0.236/trunk@184651 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu
2005-11-15 18:17:22 +00:00
parent 64d8ac678b
commit 48dbeb8ec0
6 changed files with 79 additions and 45 deletions

View File

@@ -1166,3 +1166,19 @@ CompareUTF8toUTF16(const nsASingleFragmentCString& aUTF8String,
return 0;
}
NS_COM
void
AppendUCS4ToUTF16(PRUint32 aSource, nsAString& aDest)
{
NS_ASSERTION(IS_VALID_CHAR(aSource), "Invalid UCS4 char");
if (IS_IN_BMP(aSource))
{
aDest.Append(PRUnichar(aSource));
}
else
{
aDest.Append(H_SURROGATE(aSource));
aDest.Append(L_SURROGATE(aSource));
}
}