int encdesc_read_header(GtEncdesc *encdesc, FILE *fp, GtError *err) { int had_err = 0; GtUword cur_field_num; DescField *cur_field; had_err = encdesc_header_io_basics(encdesc, fp, gt_io_error_fread, err); if (!had_err) encdesc->fields = gt_calloc((size_t) encdesc->num_of_fields, sizeof (DescField)); for (cur_field_num = 0; !had_err && cur_field_num < encdesc->num_of_fields; cur_field_num++) { cur_field = &encdesc->fields[cur_field_num]; /* cur_field->bits_per_num = 0; */ /* cur_field->prev_value = 0; */ had_err = io_field_sep_and_is_cons(cur_field, fp, gt_io_error_fread, err); if (!had_err && cur_field->is_cons) { had_err = io_cons_field_header(cur_field, fp, gt_io_error_fread, err); } else if (!had_err) { had_err = gt_io_error_fread_one(cur_field->is_numeric, fp, err); if (!had_err && cur_field->is_numeric) { had_err = io_numeric_field_header(cur_field, fp, gt_io_error_fread, err); } else if (!had_err) { had_err = io_field_len_header(cur_field, fp, gt_io_error_fread, err); if (!had_err) { cur_field->bittab = gt_bittab_new(cur_field->len); cur_field->data = gt_calloc((size_t) (cur_field->len + 1), sizeof (char)); had_err = gt_io_error_fread(cur_field->data, sizeof (char), (size_t) cur_field->len, fp, err); } if (!had_err) had_err = read_field_header_bittab(cur_field, fp, err); if (!had_err) { cur_field->chars = gt_calloc((size_t) (cur_field->max_len + 1), sizeof (cur_field->chars)); had_err = read_field_char_dists(cur_field, fp, err); } } } } return had_err; }
static int gt_intset_read_type_rewind(FILE *fp, GtUword *type, GtError *err) { int had_err = 0; fpos_t pos; if (fgetpos(fp, &pos) != 0) { gt_error_set(err, "fgetpos failed"); had_err = 1; } if (!had_err) had_err = gt_io_error_fread(type, sizeof (*type), (size_t) 1, fp, err); if (!had_err && fsetpos(fp, &pos) != 0) { gt_error_set(err, "fsetpos failed"); had_err = 1; } return had_err; }