char *result = NS_STATIC_CAST(char*, nsMemory::Alloc(calculator.Size() + 1));
char* result; if (temp.GetOwnsBuffer()) {   result = temp.mStr;
ToNewUTF8String( const nsAString& aSource )  {    nsAString::const_iterator start, end;    CalculateUTF8Size calculator;    copy_string(aSource.BeginReading(start), aSource.EndReading(end),                calculator);    char *result = NS_STATIC_CAST(char*,        nsMemory::Alloc(calculator.Size() + 1));    ConvertUCS2toUTF8 converter(result);    copy_string(aSource.BeginReading(start), aSource.EndReading(end),                converter).write_terminator();    NS_ASSERTION(calculator.Size() == converter.Size(), "length mismatch");    return result;  }