示例#1
0
void
CopyUTF16toUTF8(const nsAString& aSource, nsACString& aDest)
{
  if (!CopyUTF16toUTF8(aSource, aDest, mozilla::fallible)) {
    // Note that this may wildly underestimate the allocation that failed, as
    // we report the length of aSource as UTF-16 instead of UTF-8.
    aDest.AllocFailed(aDest.Length() + aSource.Length());
  }
}