From ddd703e7c47a44207a8ae267cddfadae340983de Mon Sep 17 00:00:00 2001 From: Vreixo Formoso Date: Wed, 26 Dec 2007 18:19:00 +0100 Subject: [PATCH] Fix several bugs related to RR SL/NM fields (PT 2 :). --- src/ecma119.c | 2 +- src/rockridge.c | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/ecma119.c b/src/ecma119.c index 1e88c18..bdb9621 100644 --- a/src/ecma119.c +++ b/src/ecma119.c @@ -417,7 +417,7 @@ int write_one_dir(Ecma119Image *t, Ecma119Node *dir) /* compute len of directory entry */ fi_len = strlen(child->iso_name); len = fi_len + 33 + (fi_len % 2 ? 0 : 1); - if (child->type == ECMA119_FILE && !t->omit_version_numbers) { + if (need_version_number(t, child)) { len += 2; } diff --git a/src/rockridge.c b/src/rockridge.c index 7705dd2..f8d0e14 100644 --- a/src/rockridge.c +++ b/src/rockridge.c @@ -15,7 +15,6 @@ #include - static int susp_append(Ecma119Image *t, struct susp_info *susp, uint8_t *data) { @@ -347,7 +346,7 @@ int rrip_add_SL(Ecma119Image *t, struct susp_info *susp, if (ret < 0) { return ret; } - written = i - 1; + written = i; total_comp_len = comp[i][1] + 2; } } @@ -599,7 +598,7 @@ size_t rrip_calc_len(Ecma119Image *t, Ecma119Node *n, int type, * anything in this SL */ *ce += sl_len + 255; - sl_len = 5 + (clen - 250); + sl_len = 5 + (clen - 250) + 2; } } else { /* case 2, create a new SL entry */ @@ -884,7 +883,7 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type, * and another SL entry */ ret = rrip_SL_append_comp(&n_comp, &comps, - prev, fit, cflag); + prev, fit, 0x01); if (ret < 0) { goto add_susp_cleanup; } @@ -895,7 +894,7 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type, ret = rrip_SL_append_comp(&n_comp, &comps, prev + fit, clen - fit - 2, - cflag); + 0); if (ret < 0) { goto add_susp_cleanup; } @@ -908,13 +907,19 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type, * anything in this SL */ ret = rrip_SL_append_comp(&n_comp, &comps, - prev, 250 - 2, - cflag); + prev, 248, 0x01); + if (ret < 0) { + goto add_susp_cleanup; + } + ret = rrip_SL_append_comp(&n_comp, &comps, + prev + 248, + strlen(prev + 248), + 0x00); if (ret < 0) { goto add_susp_cleanup; } ce_len += sl_len + 255; - sl_len = 5 + (clen - 250); + sl_len = 5 + (clen - 250) + 2; } } else { /* case 2, create a new SL entry */