Ejemplo n.º 1
0
int32_t
tmap_sff_io_read(tmap_sff_io_t *sffio, tmap_sff_t *sff)
{
    // we have read them all
    if(sffio->gheader->n_reads <= sffio->n_read) return EOF;

    // destroy previous data, if any
    if(NULL != sff->rheader) {
        tmap_sff_read_header_destroy(sff->rheader);
        sff->rheader = NULL;
    }
    if(NULL != sff->read) {
        tmap_sff_read_destroy(sff->read);
        sff->read = NULL;
    }

    sff->gheader = sffio->gheader;
    sff->rheader = tmap_sff_read_header_read(sffio->fp, sffio->early_eof_ok);
    if(NULL == sff->rheader && 1 == sffio->early_eof_ok) return EOF;
    sff->read = tmap_sff_read_read(sffio->fp, sffio->gheader, sff->rheader);

    sffio->n_read++;

    return 1;
}
Ejemplo n.º 2
0
void 
tmap_sff_destroy(tmap_sff_t *sff)
{
  if(NULL == sff) return;
  tmap_sff_read_header_destroy(sff->rheader);
  tmap_sff_read_destroy(sff->read);
  free(sff);
}