Done major changes to libisofs, including multisession and reading support

This commit is contained in:
Mario Danic
2007-08-27 22:51:48 +00:00
parent a4e0041128
commit df04ee014e
19 changed files with 573 additions and 117 deletions

View File

@ -15,6 +15,7 @@
#include "ecma119_read.h"
#include "ecma119_read_rr.h"
#include "util.h"
#include "messages.h"
#define BLOCK_SIZE 2048
@ -30,11 +31,11 @@ read_rr_PX(struct iso_read_info *info, struct susp_sys_user_entry *px,
assert( px->sig[0] == 'P' && px->sig[1] == 'X');
if ( info->rr == RR_EXT_112 && px->len_sue[0] != 44 ) {
printf("[ERROR] Invalid PX entry for RR version 1.12\n");
iso_msg_sorry(LIBISO_RR_ERROR, "Invalid PX entry for RR version 1.12");
info->error = LIBISOFS_WRONG_RR;
return -1;
} else if ( info->rr == RR_EXT_110 && px->len_sue[0] != 36 ) {
printf("[ERROR] Invalid PX entry for RR version 1.10\n");
iso_msg_sorry(LIBISO_RR_ERROR, "Invalid PX entry for RR version 1.10");
info->error = LIBISOFS_WRONG_RR;
return -1;
}
@ -85,7 +86,7 @@ read_rr_TF(struct iso_read_info *info, struct susp_sys_user_entry *tf,
/* 2. modify time */
if (tf->data.TF.flags[0] & (1 << 1)) {
if (tf->len_sue[0] < 5 + (nts+1) * s) {
printf("[ERROR] RR TF entry too short.\n");
iso_msg_sorry(LIBISO_RR_ERROR, "RR TF entry too short.");
info->error = LIBISOFS_WRONG_RR;
return -1;
}
@ -101,7 +102,7 @@ read_rr_TF(struct iso_read_info *info, struct susp_sys_user_entry *tf,
/* 3. access time */
if (tf->data.TF.flags[0] & (1 << 2)) {
if (tf->len_sue[0] < 5 + (nts+1) * s) {
printf("[ERROR] RR TF entry too short.\n");
iso_msg_sorry(LIBISO_RR_ERROR, "RR TF entry too short.");
info->error = LIBISOFS_WRONG_RR;
return -1;
}
@ -117,7 +118,7 @@ read_rr_TF(struct iso_read_info *info, struct susp_sys_user_entry *tf,
/* 4. attributes time */
if (tf->data.TF.flags[0] & (1 << 3)) {
if (tf->len_sue[0] < 5 + (nts+1) * s) {
printf("[ERROR] RR TF entry too short.\n");
iso_msg_sorry(LIBISO_RR_ERROR, "RR TF entry too short.");
info->error = LIBISOFS_WRONG_RR;
return -1;
}
@ -178,7 +179,9 @@ read_rr_SL(struct susp_sys_user_entry *sl, char *dest)
len = 1;
comp = "/";
} else if (flags & ~0x01) {
printf("[ERROR] SL component flag %x not supported.\n", flags);
char msg[38];
sprintf(msg, "SL component flag %x not supported.", flags);
iso_msg_sorry(LIBISO_RR_ERROR, msg);
return NULL;
} else {
len = sl->data.SL.comps[pos + 1];
@ -275,7 +278,7 @@ susp_iter_next(struct susp_iterator* iter)
if (entry->len_sue[0] == 0) {
/* a wrong image with this lead us to a infinity loop */
printf("[ERROR] Damaged RR/SUSP information.\n");
iso_msg_sorry(LIBISO_RR_ERROR, "Damaged RR/SUSP information.");
iter->info->error = LIBISOFS_WRONG_RR;
return NULL;
}
@ -285,10 +288,10 @@ susp_iter_next(struct susp_iterator* iter)
if ( SUSP_SIG(entry, 'C', 'E') ) {
/* Continuation entry */
if (iter->ce_len) {
printf("[WARN] More than one CE System user entry has found "
"in a single System Use field or continuation area.\n"
"This breaks SUSP standard and it's not supported.\n"
"Ignoring last CE. Maybe the image is damaged.\n");
iso_msg_sorry(LIBISO_RR_ERROR, "More than one CE System user entry "
"has found in a single System Use field or continuation area. "
"This breaks SUSP standard and it's not supported.\n"
"Ignoring last CE. Maybe the image is damaged.\n");
} else {
iter->ce_block = iso_read_bb(entry->data.CE.block, 4, NULL);
iter->ce_off = iso_read_bb(entry->data.CE.offset, 4, NULL);