Commit 7ab0d84e authored by Petri Hintukainen's avatar Petri Hintukainen

Simplify extent AD handling

parent e535dc88
......@@ -339,18 +339,12 @@ int decode_allocation_extent(struct file_entry **p_fe, const uint8_t *p, size_t
return 0;
}
fe = (struct file_entry *)realloc(fe, sizeof(struct file_entry) + sizeof(struct long_ad) * (fe->num_ad + num_ad - 1));
fe = (struct file_entry *)realloc(fe, sizeof(struct file_entry) + sizeof(struct long_ad) * (fe->num_ad + num_ad));
if (!fe) {
return -1;
}
*p_fe = fe;
/* drop pointer to this extent from the end of ads */
if (fe->data.ad[fe->num_ad - 1].extent_type != ECMA_AD_EXTENT_AD) {
ecma_error("decode_allocation_extent: missing link ad\n");
}
fe->num_ad--;
/* decode new allocation descriptors */
_decode_file_ads(p + 24, fe->ad_type, partition, &fe->data.ad[fe->num_ad], num_ad);
fe->num_ad += num_ad;
......
......@@ -842,7 +842,10 @@ static struct file_entry *_read_file_entry(udfread *udf,
while (fe->num_ad > 0 &&
fe->data.ad[fe->num_ad - 1].extent_type == ECMA_AD_EXTENT_AD) {
icb = &fe->data.ad[fe->num_ad - 1];
/* drop pointer to this extent from the end of AD list */
fe->num_ad--;
icb = &fe->data.ad[fe->num_ad];
udf_log("_read_file_entry: reading allocation extent @%u\n", icb->lba);
buf = _read_metadata(udf, icb, &tag_id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment