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); } } } }
GaimMimeDocument * gaim_mime_document_parsen(const char *buf, gsize len) { GaimMimeDocument *doc; char *b = (char *) buf; gsize n = len; g_return_val_if_fail(buf != NULL, NULL); doc = gaim_mime_document_new(); if (!len) return doc; fields_load(&doc->fields, &b, &n); { const char *ct = fields_get(&doc->fields, "content-type"); if(ct && gaim_str_has_prefix(ct, "multipart")) { char *bd = strrchr(ct, '='); if(bd++) { doc_parts_load(doc, bd, b, n); } } } return doc; }
char * gaim_mime_part_get_field_decoded(GaimMimePart *part, const char *field) { const char *f; g_return_val_if_fail(part != NULL, NULL); f = fields_get(&part->fields, field); return gaim_mime_decode_field(f); }
void psc_push_particles_cbe_push_xy(struct psc_push_particles *push, mparticles_base_t *particles_base, mfields_base_t *flds_base) { mfields_t flds; mparticles_t particles; fields_get(&flds, EX, EX +6,flds_base); mparticles_get(&particles, particles_base); static int pr; if (!pr) { pr = prof_register("cbe_part_2d", 1., 0, 0); } prof_start(pr); int job = SPU_PART; psc_mfields_zero(&flds, JXI); psc_mfields_zero(&flds, JYI); psc_mfields_zero(&flds, JZI); // I'm not really sure about this. I mean, it's the nicest way to do this // in terms of reusing code, but it also means I'm basically dooming the ppu to not // do anything but manage the spes. I think we could do more with it, but that's // a task for another day... foreach_patch(p) { // So, another thing I'm not too please about. The function that's getting // called here will basically stall the ppu until it manages to start the patch // on an spe... cell_run_patch(p,&flds.f[p], &particles.p[p], job); } wait_all_spe(); prof_stop(pr); fields_put(&flds, JXI, JXI + 3, flds_base); mparticles_put(&particles, particles_base); }
const char * gaim_mime_document_get_field(GaimMimeDocument *doc, const char *field) { g_return_val_if_fail(doc != NULL, NULL); return fields_get(&doc->fields, field); }
const char * gaim_mime_part_get_field(GaimMimePart *part, const char *field) { g_return_val_if_fail(part != NULL, NULL); return fields_get(&part->fields, field); }