int rdfwriteheader(FILE * fp, rdf_headerbuf * h) { long l; fwrite (RDOFFId, 1, strlen(RDOFFId), fp) ; l = translatelong ( membuflength (h) ); fwrite (&l, 4, 1, fp); membufdump(h, fp); return 0; /* no error handling in here... CHANGE THIS! */ }
int rdfwriteheader(FILE * fp, rdf_headerbuf * h) { int32_t l, l2; fwrite(RDOFFId, 1, strlen(RDOFFId), fp); l = membuflength(h->buf); l2 = l + 14 + 10 * h->nsegments + h->seglength; l = translateint32_t(l); l2 = translateint32_t(l2); fwrite(&l2, 4, 1, fp); /* object length */ fwrite(&l, 4, 1, fp); /* header length */ membufdump(h->buf, fp); return 0; /* no error handling in here... CHANGE THIS! */ }
int membuflength(memorybuffer * b) { if (!b) return 0; return b->length + membuflength(b->next); }