if (!relobj->file_buffer_name) return MIME_OUT_OF_MEMORY;
MimeMultipartRelated_parse_child_line (MimeObject *obj,									   char *line, PRInt32 length,									   PRBool first_line_p){	MimeContainer *cont = (MimeContainer *) obj;	MimeMultipartRelated *relobj = (MimeMultipartRelated *) obj;	int status;	MimeObject *kid;	if (obj->options && !obj->options->write_html_p#ifdef MIME_DRAFTS		&& !obj->options->decompose_file_p#endif /* MIME_DRAFTS */		)	  {		/* Oh, just go do the normal thing... */		return ((MimeMultipartClass*)&MIME_SUPERCLASS)->			parse_child_line(obj, line, length, first_line_p);	  }	/* Throw it away if this isn't the head object.  (Someday, maybe we'll	   cache it instead.) */	PR_ASSERT(cont->nchildren > 0);	if (cont->nchildren <= 0)		return -1;	kid = cont->children[cont->nchildren-1];	PR_ASSERT(kid);	if (!kid) return -1;	if (kid != relobj->headobj) return 0;	/* Buffer this up (###tw much code duplication from mimemalt.c) */	/* If we don't yet have a buffer (either memory or file) try and make a	   memory buffer. */	if (!relobj->head_buffer && !relobj->file_buffer_name) {		int target_size = 1024 * 50;       /* try for 50k */		while (target_size > 0) {			relobj->head_buffer = (char *) PR_MALLOC(target_size);			if (relobj->head_buffer) break;  /* got it! */			target_size -= (1024 * 5);     /* decrease it and try again */		}		if (relobj->head_buffer) {			relobj->head_buffer_size = target_size;		} else {			relobj->head_buffer_size = 0;		}		relobj->head_buffer_fp = 0;	}	/* Ok, if at this point we still don't have either kind of buffer, try and	   make a file buffer. */	if (!relobj->head_buffer && !relobj->file_buffer_name) {		relobj->file_buffer_name = GetOSTempFile("nsma");		if (!relobj->file_buffer_name) return MIME_OUT_OF_MEMORY;		relobj->file_stream = PR_Open(relobj->file_buffer_name, 						PR_RDWR | PR_CREATE_FILE,						0);		if (!relobj->file_stream) {			return MIME_UNABLE_TO_OPEN_TMP_FILE;		}	}  	PR_ASSERT(relobj->head_buffer || relobj->file_stream);	/* If this line will fit in the memory buffer, put it there.	 */	if (relobj->head_buffer &&	    relobj->head_buffer_fp + length < relobj->head_buffer_size) {		nsCRT::memcpy(relobj->head_buffer + relobj->head_buffer_fp, line, length);		relobj->head_buffer_fp += length;	} else {		/* Otherwise it won't fit; write it to the file instead. */		/* If the file isn't open yet, open it, and dump the memory buffer		   to it. */		if (!relobj->file_stream) {			if (!relobj->file_buffer_name) {				relobj->file_buffer_name = GetOSTempFile("nsma");			}			if (!relobj->file_buffer_name) return MIME_OUT_OF_MEMORY;			relobj->file_stream = PR_Open(relobj->file_buffer_name,						PR_RDWR | PR_CREATE_FILE,						0);			if (!relobj->file_stream) {				return MIME_UNABLE_TO_OPEN_TMP_FILE;			}			if (relobj->head_buffer && relobj->head_buffer_fp) {				status = PR_Write (relobj->file_stream,							relobj->head_buffer,							relobj->head_buffer_fp);				if (status < 0) return status;			}			PR_FREEIF(relobj->head_buffer);			relobj->head_buffer_fp = 0;			relobj->head_buffer_size = 0;		}		/* Dump this line to the file. */		status = PR_Write (relobj->file_stream, line, length);		if (status < 0) return status;	}	return 0;}