[libbluray-devel] Simplify extent AD handling
Petri Hintukainen
git at videolan.org
Fri Jun 9 12:33:35 CEST 2017
libudfread | branch: master | Petri Hintukainen <phintuka at gmail.com> | Wed Jun 7 22:49:32 2017 +0300| [7ab0d84e1777aeb6d2bc20025dc6d0c3db0c8cac] | committer: Petri Hintukainen
Simplify extent AD handling
> http://git.videolan.org/gitweb.cgi/libudfread.git/?a=commit;h=7ab0d84e1777aeb6d2bc20025dc6d0c3db0c8cac
---
src/ecma167.c | 8 +-------
src/udfread.c | 5 ++++-
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/src/ecma167.c b/src/ecma167.c
index 2760d4d..6c694f9 100644
--- a/src/ecma167.c
+++ b/src/ecma167.c
@@ -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;
diff --git a/src/udfread.c b/src/udfread.c
index 08a7721..936e415 100644
--- a/src/udfread.c
+++ b/src/udfread.c
@@ -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);
More information about the libbluray-devel
mailing list