rv = decoder->GetMaxLength(aRefInDocCharset, srcLen, &dstLen);
rv = decoder->GetMaxLength(aRefInDocCharset.get(), srcLen, &dstLen);
nsresult CharsetConvRef(const nsString& aDocCharset, const nsCString& aRefInDocCharset, nsString& aRefInUnicode){  nsresult rv;    nsCOMPtr <nsIAtom> docCharsetAtom;  nsCOMPtr<nsICharsetConverterManager2> ccm2 = do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);  if (NS_SUCCEEDED(rv))  {    rv = ccm2->GetCharsetAtom(aDocCharset.get(), getter_AddRefs(docCharsetAtom));    if (NS_SUCCEEDED(rv))    {      nsCOMPtr<nsIUnicodeDecoder> decoder;      rv = ccm2->GetUnicodeDecoder(docCharsetAtom, getter_AddRefs(decoder));      if (NS_SUCCEEDED(rv))      {        PRInt32 srcLen = aRefInDocCharset.Length();        PRInt32 dstLen;        rv = decoder->GetMaxLength(aRefInDocCharset, srcLen, &dstLen);        if (NS_SUCCEEDED(rv))        {          PRUnichar *ustr = (PRUnichar *) nsMemory::Alloc((dstLen+1) * sizeof(PRUnichar));          if (ustr)          {            rv = decoder->Convert(aRefInDocCharset, &srcLen, ustr, &dstLen);            if (NS_SUCCEEDED(rv))            {              ustr[dstLen] = 0;              aRefInUnicode.Assign(ustr);            }            nsMemory::Free(ustr);          }        }      }    }  }  return rv;}