void gaim_mime_document_write(GaimMimeDocument *doc, GString *str) { const char *bd = NULL; g_return_if_fail(doc != NULL); g_return_if_fail(str != NULL); { const char *ct = fields_get(&doc->fields, "content-type"); if(ct && gaim_str_has_prefix(ct, "multipart")) { char *b = strrchr(ct, '='); if(b++) bd = b; } } fields_write(&doc->fields, str); if(bd) { GList *l; for(l = doc->parts; l; l = l->next) { g_string_append_printf(str, "--%s\r\n", bd); part_write(l->data, str); if(! l->next) { g_string_append_printf(str, "--%s--\r\n", bd); } } } }
static int partool_write(part_block_t block, char *partition) { int err; err = part_block_read(block, 0, part_tmp, partool_size); if (err<0) { goto error; } err = part_write(partition); if (err<0) { goto error; } err = 0; error: return err; }