X-Git-Url: https://git.distorted.org.uk/~mdw/dvdrip/blobdiff_plain/c62cd11a8bcfdacd01498ee08da82b2afa4b2f25..8ed763a58ec8c9f402d2ee30164c59a613afba93:/dvd-sector-copy.c diff --git a/dvd-sector-copy.c b/dvd-sector-copy.c index e699741..ee89f2a 100644 --- a/dvd-sector-copy.c +++ b/dvd-sector-copy.c @@ -95,8 +95,8 @@ static void put_menu(dvd_reader_t *dvd, unsigned title) store_filename(fn, id); start = UDFFindFile(dvd, fn, &len); if (!start) return; #ifdef DEBUG - printf(";; %8"PRIuSEC" .. %-8"PRIuSEC": %s\n", - start, start + SECTORS(len), fn); + printf(";; %8"PRIuSEC" .. %-8"PRIuSEC": %s\n", + start, start + SECTORS(len), fn); #endif put_file(id, start, start + SECTORS(len)); } @@ -487,9 +487,9 @@ static ssize_t recovery_read_buffer(struct recoverybuf *r, #endif } } else if (pos > r->pos + r->end) { - r->pos = pos; r->start = r->end = 0; + r->pos = pos; r->start = r->end = 0; #ifdef DEBUG - show_recovery_buffer_map(r, "cleared; beyond previous region"); + show_recovery_buffer_map(r, "cleared; beyond previous region"); #endif } else if (pos + want > r->pos + r->sz) { diff = (pos + want) - (r->pos + r->sz); @@ -805,19 +805,6 @@ static void emit(secaddr start, secaddr end) #undef BUFSECTORS } -static int read_line(FILE *fp, struct buf *b) -{ - int ch; - - ch = getc(fp); - if (ch == EOF) - return (-1); - else if (ch != '\n') - do { buf_putc(b, ch); ch = getc(fp); } while (ch != EOF && ch != '\n'); - buf_putz(b); - return (0); -} - #define PRF_HYPHEN 1u static int parse_range(const char *p, unsigned f, secaddr *start_out, secaddr *end_out) @@ -1056,7 +1043,7 @@ int main(int argc, char *argv[]) #endif } - open_dvd(device, O_RDONLY, &dvdfd, &dvd); + if (open_dvd(device, O_RDONLY, &dvdfd, &dvd)) exit(2); blksz = SECTORSZ; volsz = device_size(dvdfd, device, &blksz); if (blksz != SECTORSZ) @@ -1066,7 +1053,7 @@ int main(int argc, char *argv[]) device, volsz, SECTORSZ); if (f&f_checkid) { - open_dvd(outfile, O_RDONLY, 0, &dvd_out); + if (open_dvd(outfile, O_RDONLY, 0, &dvd_out)) exit(2); if (dvd_id(id_in, dvd, DIF_MUSTIFOHASH, device) || dvd_id(id_out, dvd_out, DIF_MUSTIFOHASH, device)) exit(2);