detector = do_CreateInstance(detector_contractid, &res);
detector = do_CreateInstance(detector_contractid.get(), &res);
MIME_detect_charset(const char *aBuf, PRInt32 aLength, const char** aCharset){  nsresult res;  char theBuffer[128];  CBufDescriptor theBufDecriptor( theBuffer, PR_TRUE, sizeof(theBuffer), 0);  nsCAutoString detector_contractid(theBufDecriptor);  nsXPIDLString detector_name;  nsCOMPtr<nsIStringCharsetDetector> detector;  *aCharset = nsnull;  detector_contractid.Assign(NS_STRCDETECTOR_CONTRACTID_BASE);  nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &res));   if (NS_SUCCEEDED(res)) {    if (NS_SUCCEEDED(prefs->GetLocalizedUnicharPref("intl.charset.detector", getter_Copies(detector_name)))) {      detector_contractid.Append(NS_ConvertUCS2toUTF8(detector_name).get());    }  }  if (detector_contractid.Length() > sizeof(NS_STRCDETECTOR_CONTRACTID_BASE)) {    detector = do_CreateInstance(detector_contractid, &res);    if (NS_SUCCEEDED(res)) {      nsDetectionConfident oConfident;      res = detector->DoIt(aBuf, aLength, aCharset, oConfident);      if (NS_SUCCEEDED(res) && (eBestAnswer == oConfident || eSureAnswer == oConfident)) {        return NS_OK;      }    }  }  return res;}