if (!tmp->real_name) NS_MsgSACopy ( &(tmp->real_name), tmpSpec ); }
if (!tmp->real_name) { if (tmpFile->real_name) NS_MsgSACopy ( &(tmp->real_name), tmpFile->real_name ); else NS_MsgSACopy ( &(tmp->real_name), tmpSpec ); } }
mime_draft_process_attachments(mime_draft_data *mdd) {  nsMsgAttachmentData         *attachData = NULL, *tmp = NULL;  nsMsgAttachedFile           *tmpFile = NULL;  int                         i;  PRInt32                     cleanupCount = 0;  NS_ASSERTION ( mdd->attachments_count && mdd->attachments, "processing attachments but there aren't any" );  if ( !mdd->attachments || !mdd->attachments_count )  	return nsnull;  attachData = (nsMsgAttachmentData *) PR_MALLOC( ( (mdd->attachments_count+1) * sizeof (nsMsgAttachmentData) ) );  if ( !attachData )     return nsnull;  nsCRT::memset ( attachData, 0, (mdd->attachments_count+1) * sizeof (nsMsgAttachmentData) );  tmpFile = mdd->attachments;  tmp = attachData;  for ( i=0; i < mdd->attachments_count; i++, tmp++, tmpFile++ )   {	  if (tmpFile->type)     {		  if (nsCRT::strcasecmp ( tmpFile->type, "text/x-vcard") == 0)			  NS_MsgSACopy (&(tmp->real_name), tmpFile->description);	  }	  if ( tmpFile->orig_url )     {      char  *tmpSpec = nsnull;      if (NS_FAILED(tmpFile->orig_url->GetSpec(&tmpSpec)))      {        cleanupCount = i;        goto FAIL;      }      if (NS_FAILED(nsMimeNewURI(&(tmp->url), tmpSpec, nsnull)))      {        PR_FREEIF(tmpSpec);        cleanupCount = i;        goto FAIL;       }      NS_ADDREF(tmp->url);	    if (!tmp->real_name)  	   NS_MsgSACopy ( &(tmp->real_name), tmpSpec );	  }	  if ( tmpFile->type )     {	    NS_MsgSACopy ( &(tmp->desired_type), tmpFile->type );	    NS_MsgSACopy ( &(tmp->real_type), tmpFile->type );	  }	  if ( tmpFile->encoding )     {	    NS_MsgSACopy ( &(tmp->real_encoding), tmpFile->encoding );	  }	  if ( tmpFile->description )     {	    NS_MsgSACopy ( &(tmp->description), tmpFile->description );	  }	  if ( tmpFile->x_mac_type )     {	    NS_MsgSACopy ( &(tmp->x_mac_type), tmpFile->x_mac_type );	  }	  if ( tmpFile->x_mac_creator )     {	    NS_MsgSACopy ( &(tmp->x_mac_creator), tmpFile->x_mac_creator );	  }  }  return (attachData);FAIL:  mime_free_attach_data (attachData, cleanupCount);  PR_FREEIF(attachData);  return nsnull;}