Fix several bugs related to RR SL/NM fields (PT 2 :).

This commit is contained in:
Vreixo Formoso 2007-12-26 18:19:00 +01:00
parent 5f6b5fd930
commit ddd703e7c4
2 changed files with 14 additions and 9 deletions

View File

@ -417,7 +417,7 @@ int write_one_dir(Ecma119Image *t, Ecma119Node *dir)
/* compute len of directory entry */ /* compute len of directory entry */
fi_len = strlen(child->iso_name); fi_len = strlen(child->iso_name);
len = fi_len + 33 + (fi_len % 2 ? 0 : 1); 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; len += 2;
} }

View File

@ -15,7 +15,6 @@
#include <string.h> #include <string.h>
static static
int susp_append(Ecma119Image *t, struct susp_info *susp, uint8_t *data) 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) { if (ret < 0) {
return ret; return ret;
} }
written = i - 1; written = i;
total_comp_len = comp[i][1] + 2; 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 * anything in this SL
*/ */
*ce += sl_len + 255; *ce += sl_len + 255;
sl_len = 5 + (clen - 250); sl_len = 5 + (clen - 250) + 2;
} }
} else { } else {
/* case 2, create a new SL entry */ /* 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 * and another SL entry
*/ */
ret = rrip_SL_append_comp(&n_comp, &comps, ret = rrip_SL_append_comp(&n_comp, &comps,
prev, fit, cflag); prev, fit, 0x01);
if (ret < 0) { if (ret < 0) {
goto add_susp_cleanup; 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, ret = rrip_SL_append_comp(&n_comp, &comps,
prev + fit, prev + fit,
clen - fit - 2, clen - fit - 2,
cflag); 0);
if (ret < 0) { if (ret < 0) {
goto add_susp_cleanup; goto add_susp_cleanup;
} }
@ -908,13 +907,19 @@ int rrip_get_susp_fields(Ecma119Image *t, Ecma119Node *n, int type,
* anything in this SL * anything in this SL
*/ */
ret = rrip_SL_append_comp(&n_comp, &comps, ret = rrip_SL_append_comp(&n_comp, &comps,
prev, 250 - 2, prev, 248, 0x01);
cflag); if (ret < 0) {
goto add_susp_cleanup;
}
ret = rrip_SL_append_comp(&n_comp, &comps,
prev + 248,
strlen(prev + 248),
0x00);
if (ret < 0) { if (ret < 0) {
goto add_susp_cleanup; goto add_susp_cleanup;
} }
ce_len += sl_len + 255; ce_len += sl_len + 255;
sl_len = 5 + (clen - 250); sl_len = 5 + (clen - 250) + 2;
} }
} else { } else {
/* case 2, create a new SL entry */ /* case 2, create a new SL entry */