if (aSource) { AppendUTF8toUTF16(nsDependentCString(aSource), aDest); }
nsACString::const_iterator source_start, source_end; CalculateUTF8Length calculator; copy_string(aSource.BeginReading(source_start), aSource.EndReading(source_end), calculator);  PRUint32 count = calculator.Length();  if (count) { PRUint32 old_dest_length = aDest.Length();   aDest.SetLength(old_dest_length + count);  nsAString::iterator dest; aDest.BeginWriting(dest);  dest.advance(old_dest_length);  if (count <= (PRUint32)dest.size_forward()) {       ConvertUTF8toUTF16 converter(dest.get()); copy_string(aSource.BeginReading(source_start), aSource.EndReading(source_end), converter);  if (converter.Length() != count) { NS_ERROR("Input wasn't UTF8 or incorrect length was calculated"); aDest.SetLength(old_dest_length); } } else {      aDest.Replace(old_dest_length, count, NS_ConvertUTF8toUTF16(aSource)); } }
AppendUTF8toUTF16( const char* aSource, nsAString& aDest )  {    if (aSource) {      AppendUTF8toUTF16(nsDependentCString(aSource), aDest);    }  }