else if (!PL_strcasecmp(newAttachment->encoding, ENCODING_BASE64))
else if (!nsCRT::strcasecmp(newAttachment->encoding, ENCODING_BASE64))
mime_decompose_file_init_fn ( void *stream_closure, MimeHeaders *headers ){  struct mime_draft_data *mdd = (struct mime_draft_data *) stream_closure;  nsMsgAttachedFile *attachments = 0, *newAttachment = 0;  int nAttachments = 0;  //char *hdr_value = NULL;  char *parm_value = NULL;  PRBool needURL = PR_FALSE;  PRBool creatingMsgBody = PR_TRUE;  PRBool bodyPart = PR_FALSE;    PR_ASSERT (mdd && headers);  if (!mdd || !headers)     return -1;  if ( !mdd->options->is_multipart_msg )   {    if (mdd->options->decompose_init_count)     {      mdd->options->decompose_init_count++;      PR_ASSERT(mdd->curAttachment);      if (mdd->curAttachment) {        char *ct = MimeHeaders_get(headers, HEADER_CONTENT_TYPE, PR_TRUE, PR_FALSE);        if (ct)          mime_SACopy(&(mdd->curAttachment->type), ct);        PR_FREEIF(ct);      }      return 0;    }    else {      mdd->options->decompose_init_count++;    }  }  nAttachments = mdd->attachments_count;  if (!nAttachments && !mdd->messageBody)   {    char *charset = NULL, *contentType = NULL;    contentType = MimeHeaders_get(headers, HEADER_CONTENT_TYPE, PR_FALSE, PR_FALSE);    if (contentType)     {      charset = MimeHeaders_get_parameter(contentType, "charset", NULL, NULL);      mdd->mailcharset = PL_strdup(charset);      PR_FREEIF(charset);      PR_FREEIF(contentType);    }        mdd->messageBody = PR_NEWZAP (nsMsgAttachedFile);    PR_ASSERT (mdd->messageBody);    if (!mdd->messageBody)       return MIME_OUT_OF_MEMORY;    newAttachment = mdd->messageBody;    creatingMsgBody = PR_TRUE;    bodyPart = PR_TRUE;  }  else   {    /* always allocate one more extra; don't ask me why */    needURL = PR_TRUE;    if ( nAttachments )     {      PR_ASSERT (mdd->attachments);            attachments = (nsMsgAttachedFile *)PR_REALLOC(mdd->attachments, 								                                    sizeof (nsMsgAttachedFile) *                                                     (nAttachments + 2));    if (!attachments)        return MIME_OUT_OF_MEMORY;      mdd->attachments = attachments;      mdd->attachments_count++;    }    else {      PR_ASSERT (!mdd->attachments);            attachments = (nsMsgAttachedFile *) PR_MALLOC ( sizeof (nsMsgAttachedFile) * 2);      if (!attachments)         return MIME_OUT_OF_MEMORY;      mdd->attachments_count++;      mdd->attachments = attachments;    }        newAttachment = attachments + nAttachments;    nsCRT::memset ( newAttachment, 0, sizeof (nsMsgAttachedFile) * 2 );  }  char *workURLSpec = nsnull;  char *contLoc = nsnull;  newAttachment->real_name = MimeHeaders_get_name ( headers );  contLoc = MimeHeaders_get( headers, HEADER_CONTENT_LOCATION, PR_FALSE, PR_FALSE );  if (!contLoc)      contLoc = MimeHeaders_get( headers, HEADER_CONTENT_BASE, PR_FALSE, PR_FALSE );  if ( (!contLoc) && (newAttachment->real_name) )    workURLSpec = PL_strdup(newAttachment->real_name);  if ( (contLoc) && (!workURLSpec) )    workURLSpec = PL_strdup(contLoc);  PR_FREEIF(contLoc);  mdd->curAttachment = newAttachment;    newAttachment->type =  MimeHeaders_get ( headers, HEADER_CONTENT_TYPE, PR_TRUE, PR_FALSE );    //  // This is to handle the degenerated Apple Double attachment.  //  parm_value = MimeHeaders_get( headers, HEADER_CONTENT_TYPE, PR_FALSE, PR_FALSE );  if (parm_value)   {    char *boundary = NULL;    char *tmp_value = NULL;    boundary = MimeHeaders_get_parameter(parm_value, "boundary", NULL, NULL);    if (boundary)      tmp_value = PR_smprintf("; boundary=\"%s\"", boundary);    if (tmp_value)      mime_SACat(&(newAttachment->type), tmp_value);    newAttachment->x_mac_type = MimeHeaders_get_parameter(parm_value, "x-mac-type", NULL, NULL);    newAttachment->x_mac_creator = MimeHeaders_get_parameter(parm_value, "x-mac-creator", NULL, NULL);    PR_FREEIF(parm_value);    PR_FREEIF(boundary);    PR_FREEIF(tmp_value);  }  newAttachment->encoding = MimeHeaders_get ( headers, HEADER_CONTENT_TRANSFER_ENCODING,                                              PR_FALSE, PR_FALSE );  newAttachment->description = MimeHeaders_get( headers, HEADER_CONTENT_DESCRIPTION,                                                PR_FALSE, PR_FALSE );  //   // If we came up empty for description or the orig URL, we should do something about it.  //  if  ( ( (!newAttachment->description) || (!*newAttachment->description) ) && (workURLSpec) )    newAttachment->description = PL_strdup(workURLSpec);  nsFileSpec *tmpSpec = nsnull;  if (newAttachment->real_name)    tmpSpec = nsMsgCreateTempFileSpec(newAttachment->real_name);  else  {    char *ptr = PL_strchr(newAttachment->type, '/');    if (!ptr)    {      tmpSpec = nsMsgCreateTempFileSpec("nsmail.tmp");    }    else    {      ++ptr;      workURLSpec = PR_smprintf("nsmail.%s", ptr);      tmpSpec = nsMsgCreateTempFileSpec(workURLSpec);    }  }  // This needs to be done so the attachment structure has a handle   // on the temp file for this attachment...  // if ( (tmpSpec) && (!bodyPart) )  if (tmpSpec)  {    char *tmpSpecStr = PR_smprintf("file://%s", tmpSpec->GetNativePathCString());    if (tmpSpecStr)    {      char *slashPtr = tmpSpecStr+7;      while (*slashPtr)      {        if (*slashPtr == '\\')           *slashPtr = '/';#ifdef XP_WIN		if (*slashPtr == ':')			*slashPtr = '|';#endif         slashPtr++;      }      nsMimeNewURI(&(newAttachment->orig_url), tmpSpecStr);      NS_IF_ADDREF(newAttachment->orig_url);      PR_FREEIF(tmpSpecStr);    }  }  PR_FREEIF(workURLSpec);  if (!tmpSpec)    return MIME_OUT_OF_MEMORY;  NS_NewFileSpecWithSpec(*tmpSpec, &mdd->tmpFileSpec);	if (!mdd->tmpFileSpec)    return MIME_OUT_OF_MEMORY;    newAttachment->file_spec = tmpSpec;  mdd->tmpFileStream = new nsOutputFileStream(mdd->tmpFileSpec);  if (!mdd->tmpFileStream)    return MIME_UNABLE_TO_OPEN_TMP_FILE;      // For now, we are always going to decode all of the attachments   // for the message. This way, we have native data   if (creatingMsgBody)   {    MimeDecoderData *(*fn) (int (*) (const char*, PRInt32, void*), void*) = 0;        //    // Initialize a decoder if necessary.    //    if (!newAttachment->encoding || mdd->options->dexlate_p)      ;    else if (!PL_strcasecmp(newAttachment->encoding, ENCODING_BASE64))      fn = &MimeB64DecoderInit;    else if (!PL_strcasecmp(newAttachment->encoding, ENCODING_QUOTED_PRINTABLE))      fn = &MimeQPDecoderInit;    else if (!PL_strcasecmp(newAttachment->encoding, ENCODING_UUENCODE) ||             !PL_strcasecmp(newAttachment->encoding, ENCODING_UUENCODE2) ||             !PL_strcasecmp(newAttachment->encoding, ENCODING_UUENCODE3) ||             !PL_strcasecmp(newAttachment->encoding, ENCODING_UUENCODE4))      fn = &MimeUUDecoderInit;        if (fn)     {      mdd->decoder_data = fn (/* The (int (*) ...) cast is to turn the `void' argument into `MimeObject'. */                              ((int (*) (const char *, PRInt32, void *))                              dummy_file_write), mdd->tmpFileStream);      if (!mdd->decoder_data)        return MIME_OUT_OF_MEMORY;    }  }  return 0;}