tmp = lineResult2.ToNewCString();
tmp = ToNewCString(lineResult2);
MimeInlineTextPlainFlowed_parse_line (char *line, PRInt32 length, MimeObject *obj){  int status;  PRBool quoting = ( obj->options    && ( obj->options->format_out == nsMimeOutput::nsMimeMessageQuoting ||         obj->options->format_out == nsMimeOutput::nsMimeMessageBodyQuoting       )           );  // see above  PRBool plainHTML = quoting || (obj->options &&       obj->options->format_out == nsMimeOutput::nsMimeMessageSaveAs);       // see above  struct MimeInlineTextPlainFlowedExData *exdata;  exdata = MimeInlineTextPlainFlowedExDataList;  while(exdata && (exdata->ownerobj != obj)) {    exdata = exdata->next;  }  NS_ASSERTION(exdata, "The extra data has disappeared!");  NS_ASSERTION(length > 0, "zero length");  if (length <= 0) return 0;  uint32 linequotelevel = 0;  char *linep = line;  // Space stuffed?  if(' ' == *linep) {    linep++;  } else {    // count '>':s before the first non-'>'    while('>' == *linep) {      linep++;      linequotelevel++;    }    // Space stuffed?    if(' ' == *linep) {      linep++;    }  }  // Look if the last character (after stripping ending end  // of lines and quoting stuff) is a SPACE. If it is, we are looking at a  // flowed line. Normally we assume that the last two chars  // are CR and LF as said in RFC822, but that doesn't seem to  // be the case always.  PRBool flowed = PR_FALSE;  PRInt32 index = length-1;  while(index >= 0 && ('\r' == line[index] || '\n' == line[index])) {    index--;  }  if (index > linep - line && ' ' == line[index])       /* Ignore space stuffing, i.e. lines with just          (quote marks and) a space count as empty */    flowed = PR_TRUE;  mozITXTToHTMLConv *conv = GetTextConverter(obj->options);  PRBool skipConversion = !conv ||                          (obj->options && obj->options->force_user_charset);  nsString lineSource;  nsString lineResult;  lineSource.SetCapacity(kInitialBufferSize);  lineResult.SetCapacity(kInitialBufferSize);      if (!skipConversion)  {    lineSource.AssignWithConversion(linep, (length - (linep - line)) );    PRUnichar* wresult = nsnull;    nsresult rv = NS_OK;    PRBool whattodo = obj->options->whattodo;    if (plainHTML)    {      if (quoting)        whattodo = 0;      else        whattodo = whattodo & ~mozITXTToHTMLConv::kGlyphSubstitution;                   /* Do recognition for the case, the result is viewed in                      Mozilla, but not GlyphSubstitution, because other UAs                      might not be able to display the glyphs. */    }    // Get a mail charset of this message.    MimeInlineText  *inlinetext = (MimeInlineText *) obj;    char *mailCharset = NULL;    if (inlinetext->charset && *(inlinetext->charset))      mailCharset = inlinetext->charset;    if (obj->options->format_out != nsMimeOutput::nsMimeMessageSaveAs ||        !mailCharset || !nsMsgI18Nstateful_charset(mailCharset))    {      /* This is the main TXT to HTML conversion:	       escaping (very important), eventually recognizing etc. */      rv = conv->ScanTXT(lineSource.get(), whattodo, &wresult);      if (NS_FAILED(rv)) return -1;      lineResult = wresult;      Recycle(wresult);    }    else    {      // If nsMimeMessageSaveAs, the string is in mail charset (and stateful, e.g. ISO-2022-JP).      // convert to unicode so it won't confuse ScanTXT.      char *newcstr;      newcstr = lineSource.ToNewCString();      // lineSource uses nsString but the string is NOT unicode      if (!newcstr) return -1;      nsAutoString ustr;      nsCAutoString cstr;      nsCAutoString mailCharsetStr(mailCharset);      cstr.Assign(newcstr);      Recycle(newcstr);      rv = nsMsgI18NConvertToUnicode(mailCharsetStr, cstr, ustr);      if (NS_SUCCEEDED(rv))      {        PRUnichar *u;        rv = conv->ScanTXT(ustr.get(), whattodo, &u);        if (NS_SUCCEEDED(rv))        {          ustr.Assign(u);          Recycle(u);          rv = nsMsgI18NConvertFromUnicode(mailCharsetStr, ustr, cstr);          if (NS_SUCCEEDED(rv))            lineResult.AssignWithConversion(cstr);   // create nsString which contains NON unicode                                                      // as the following code expecting it        }      }      if (NS_FAILED(rv))        return -1;    }  }  else  {    lineResult.AssignWithConversion(line, length);    status = NS_OK;  }  nsCAutoString preface;  /* Correct number of blockquotes */  int32 quoteleveldiff=linequotelevel - exdata->quotelevel;  if((quoteleveldiff != 0) && flowed && exdata->inflow) {    // From RFC 2646 4.5    // The receiver SHOULD handle this error by using the 'quote-depth-wins' rule,    // which is to ignore the flowed indicator and treat the line as fixed.  That    // is, the change in quote depth ends the paragraph.    // We get that behaviour by just going on.  }  while(quoteleveldiff>0) {    quoteleveldiff--;    preface += "<blockquote type=cite";    // This is to have us observe the user pref settings for citations    MimeInlineTextPlainFlowed *tObj = (MimeInlineTextPlainFlowed *) obj;    char *style = MimeTextBuildPrefixCSS(tObj->mQuotedSizeSetting,                                         tObj->mQuotedStyleSetting,                                         tObj->mCitationColor);    if (!plainHTML && style && strlen(style))    {      preface += " style=\"";      preface += style;      preface += '"';      PR_FREEIF(style);    }    preface += '>';  }  while(quoteleveldiff<0) {    quoteleveldiff++;    preface += "</blockquote>";  }  exdata->quotelevel = linequotelevel;  nsString lineResult2;  lineResult2.SetCapacity(kInitialBufferSize);  if(flowed) {    // Check RFC 2646 "4.3. Usenet Signature Convention": "-- "+CRLF is    // not a flowed line    if      (  // is "-- "LINEBREAK        lineSource.Length() >= 4        && lineSource[0] == '-'        &&        (          lineSource.EqualsWithConversion("-- \r", PR_FALSE, 4) ||          lineSource.EqualsWithConversion("-- \n", PR_FALSE, 4)        )      )    {      if (linequotelevel > 0 || exdata->isSig)      {        preface += "--&nbsp;<br>";      } else {        exdata->isSig = PR_TRUE;        preface += "<div class=\"moz-txt-sig\"><span class=\"moz-txt-tag\">"                   "--&nbsp;<br></span>";      }    } else {      Line_convert_whitespace(lineResult, PR_FALSE /* Allow wraps */,                              lineResult2);    }    exdata->inflow=PR_TRUE;  } else {    // Fixed paragraph.    Line_convert_whitespace(lineResult,                            !plainHTML && !obj->options->wrap_long_lines_p                              /* If wrap, convert all spaces but the last in                                 a row into nbsp, otherwise all. */,                            lineResult2);    lineResult2 += NS_LITERAL_STRING("<br>");    exdata->inflow = PR_FALSE;  } // End Fixed line  if (!(exdata->isSig && quoting))  {    char* tmp = preface.ToNewCString();    status = MimeObject_write(obj, tmp, preface.Length(), PR_TRUE);    Recycle(tmp);    tmp = lineResult2.ToNewCString();    status = MimeObject_write(obj, tmp, lineResult2.Length(), PR_TRUE);    Recycle(tmp);    return status;  }  else    return NS_OK;}