if(NS_SUCCEEDED(res) && (NULL != entityConv)) {
if(NS_SUCCEEDED(res)) {
nsresult nsMsgI18NConvertToEntity(const nsString& inString, nsString* outString){  nsresult res;  outString->SetString("");  nsCOMPtr <nsIEntityConverter> entityConv;  res = nsComponentManager::CreateInstance(kEntityConverterCID, NULL,                                            nsIEntityConverter::GetIID(), getter_AddRefs(entityConv));  if(NS_SUCCEEDED(res) && (NULL != entityConv)) {    PRUnichar *entities = NULL;    res = entityConv->ConvertToEntities(inString.GetUnicode(), nsIEntityConverter::html40Latin1, &entities);    if (NS_SUCCEEDED(res) && (NULL != entities)) {      outString->SetString(entities);      nsAllocator::Free(entities);     }   }   return res;}