if (!type || !*type || !PL_strcasecmp(type, UNKNOWN_CONTENT_TYPE))
if (!type || !*type || !nsCRT::strcasecmp(type, UNKNOWN_CONTENT_TYPE))
MimeUntypedText_open_subpart (MimeObject *obj,							  MimeUntypedTextSubpartType ttype,							  const char *type,							  const char *enc,							  const char *name,							  const char *desc){  MimeUntypedText *uty = (MimeUntypedText *) obj;  int status = 0;  char *h = 0;  if (!type || !*type || !PL_strcasecmp(type, UNKNOWN_CONTENT_TYPE))	type = APPLICATION_OCTET_STREAM;  if (enc && !*enc)	enc = 0;  if (desc && !*desc)	desc = 0;  if (name && !*name)	name = 0;  if (uty->open_subpart)	{	  status = MimeUntypedText_close_subpart (obj);	  if (status < 0) return status;	}  PR_ASSERT(!uty->open_subpart);  PR_ASSERT(!uty->open_hdrs);  /* To make one of these implicitly-typed sub-objects, we make up a fake	 header block, containing only the minimum number of MIME headers needed.	 We could do most of this (Type and Encoding) by making a null header	 block, and simply setting obj->content_type and obj->encoding; but making	 a fake header block is better for two reasons: first, it means that	 something will actually be displayed when in `Show All Headers' mode;	 and second, it's the only way to communicate the filename parameter,	 aside from adding a new slot to MimeObject (which is something to be	 avoided when possible.)   */  uty->open_hdrs = MimeHeaders_new();  if (!uty->open_hdrs) return MIME_OUT_OF_MEMORY;  h = (char *) PR_MALLOC(PL_strlen(type) +						(enc ? PL_strlen(enc) : 0) +						(desc ? PL_strlen(desc) : 0) +						(name ? PL_strlen(name) : 0) +						100);  if (!h) return MIME_OUT_OF_MEMORY;  PL_strcpy(h, HEADER_CONTENT_TYPE ": ");  PL_strcat(h, type);  PL_strcat(h, MSG_LINEBREAK);  status = MimeHeaders_parse_line(h, PL_strlen(h), uty->open_hdrs);  if (status < 0) goto FAIL;  if (enc)	{	  PL_strcpy(h, HEADER_CONTENT_TRANSFER_ENCODING ": ");	  PL_strcat(h, enc);	  PL_strcat(h, MSG_LINEBREAK);	  status = MimeHeaders_parse_line(h, PL_strlen(h), uty->open_hdrs);	  if (status < 0) goto FAIL;	}  if (desc)	{	  PL_strcpy(h, HEADER_CONTENT_DESCRIPTION ": ");	  PL_strcat(h, desc);	  PL_strcat(h, MSG_LINEBREAK);	  status = MimeHeaders_parse_line(h, PL_strlen(h), uty->open_hdrs);	  if (status < 0) goto FAIL;	}  if (name)	{	  PL_strcpy(h, HEADER_CONTENT_DISPOSITION ": inline; filename=\"");	  PL_strcat(h, name);	  PL_strcat(h, "\"" MSG_LINEBREAK);	  status = MimeHeaders_parse_line(h, PL_strlen(h), uty->open_hdrs);	  if (status < 0) goto FAIL;	}  /* push out a blank line. */  PL_strcpy(h, MSG_LINEBREAK);  status = MimeHeaders_parse_line(h, PL_strlen(h), uty->open_hdrs);  if (status < 0) goto FAIL;  /* Create a child... */  {	PRBool horrid_kludge = (obj->options && obj->options->state &&							 obj->options->state->first_part_written_p);	if (horrid_kludge)	  obj->options->state->first_part_written_p = PR_FALSE;	uty->open_subpart = mime_create(type, uty->open_hdrs, obj->options);	if (horrid_kludge)	  obj->options->state->first_part_written_p = PR_TRUE;	if (!uty->open_subpart)	  {		status = MIME_OUT_OF_MEMORY;		goto FAIL;	  }  }  /* Add it to the list... */  status = ((MimeContainerClass *) obj->clazz)->add_child(obj,														  uty->open_subpart);  if (status < 0)	{	  mime_free(uty->open_subpart);	  uty->open_subpart = 0;	  goto FAIL;	}  /* And start its parser going. */  status = uty->open_subpart->clazz->parse_begin(uty->open_subpart);  if (status < 0)	{	  /* MimeContainer->finalize will take care of shutting it down now. */	  uty->open_subpart = 0;	  goto FAIL;	}  uty->type = ttype; FAIL:  PR_FREEIF(h);  if (status < 0 && uty->open_hdrs)	{	  MimeHeaders_free(uty->open_hdrs);	  uty->open_hdrs = 0;	}  return status;}