Created opportunity to omit source module libburn/crc.c

This commit is contained in:
Thomas Schmitt 2010-02-14 17:17:04 +00:00
parent 6db992e646
commit c12bbff7d1
5 changed files with 49 additions and 2 deletions

View File

@ -1 +1 @@
#define Cdrskin_timestamP "2010.02.14.084452" #define Cdrskin_timestamP "2010.02.14.171833"

View File

@ -3,7 +3,21 @@
#ifndef BURN__CRC_H #ifndef BURN__CRC_H
#define BURN__CRC_H #define BURN__CRC_H
#ifdef Xorriso_standalonE
/* Do not use source module crc.c of yet unclear ancestry in GNU xorriso */
#ifndef Libburn_no_crc_C
#define Libburn_no_crc_C 1
#endif
#endif
#ifndef Libburn_no_crc_C
unsigned short crc_ccitt(unsigned char *, int len); unsigned short crc_ccitt(unsigned char *, int len);
unsigned int crc_32(unsigned char *, int len); unsigned int crc_32(unsigned char *, int len);
#endif /* Libburn_no_crc_C */
#endif /* BURN__CRC_H */ #endif /* BURN__CRC_H */

View File

@ -100,7 +100,13 @@ drive, or only store a subset of the _opts structs in drives */
fakesub[20] = 2; fakesub[20] = 2;
fakesub[12] = (d->toc->toc_entry[0].control << 4) + fakesub[12] = (d->toc->toc_entry[0].control << 4) +
d->toc->toc_entry[0].adr; d->toc->toc_entry[0].adr;
#ifdef Libburn_no_crc_C
crc = 0; /* dummy */
#else
crc = crc_ccitt(fakesub + 12, 10); crc = crc_ccitt(fakesub + 12, 10);
#endif
fakesub[22] = crc >> 8; fakesub[22] = crc >> 8;
fakesub[23] = crc & 0xFF; fakesub[23] = crc & 0xFF;
write(o->subfd, fakesub, 96); write(o->subfd, fakesub, 96);
@ -247,6 +253,8 @@ void burn_packet_process(struct burn_drive *d, unsigned char *data,
} }
} }
crc = (*(sub + 22) << 8) + *(sub + 23); crc = (*(sub + 22) << 8) + *(sub + 23);
#ifndef Libburn_no_crc_C
if (crc != crc_ccitt(sub + 12, 10)) { if (crc != crc_ccitt(sub + 12, 10)) {
burn_print(1, "sending error on %s %s\n", burn_print(1, "sending error on %s %s\n",
d->idata->vendor, d->idata->product); d->idata->vendor, d->idata->product);
@ -255,6 +263,8 @@ void burn_packet_process(struct burn_drive *d, unsigned char *data,
*/ */
burn_print(1, "crc mismatch in Q\n"); burn_print(1, "crc mismatch in Q\n");
} }
#endif
/* else process_q(d, sub + 12); */ /* else process_q(d, sub + 12); */
/* /*
if (o->subfd != -1) write(o->subfd, sub, 96); */ if (o->subfd != -1) write(o->subfd, sub, 96); */

View File

@ -411,7 +411,13 @@ a2 - lout ctrl
q[7] = dec_to_bcd(d->toc_entry[track].pmin); q[7] = dec_to_bcd(d->toc_entry[track].pmin);
q[8] = dec_to_bcd(d->toc_entry[track].psec); q[8] = dec_to_bcd(d->toc_entry[track].psec);
q[9] = dec_to_bcd(d->toc_entry[track].pframe); q[9] = dec_to_bcd(d->toc_entry[track].pframe);
#ifdef Libburn_no_crc_C
crc = 0; /* dummy */
#else
crc = crc_ccitt(q, 10); crc = crc_ccitt(q, 10);
#endif
q[10] = crc >> 8; q[10] = crc >> 8;
q[11] = crc & 0xFF; q[11] = crc & 0xFF;
d->toc_temp++; d->toc_temp++;
@ -508,7 +514,13 @@ static void subcode_lout(struct burn_write_opts *o, unsigned char control,
q[7] = dec_to_bcd(min); q[7] = dec_to_bcd(min);
q[8] = dec_to_bcd(sec); q[8] = dec_to_bcd(sec);
q[9] = dec_to_bcd(frame); q[9] = dec_to_bcd(frame);
#ifdef Libburn_no_crc_C
crc = 0; /* dummy */
#else
crc = crc_ccitt(q, 10); crc = crc_ccitt(q, 10);
#endif
q[10] = crc >> 8; q[10] = crc >> 8;
q[11] = crc & 0xFF; q[11] = crc & 0xFF;
} }
@ -628,7 +640,13 @@ void subcode_user(struct burn_write_opts *o, unsigned char *subcodes,
} }
q[0] = (control << 4) + qmode; q[0] = (control << 4) + qmode;
#ifdef Libburn_no_crc_C
crc = 0; /* dummy */
#else
crc = crc_ccitt(q, 10); crc = crc_ccitt(q, 10);
#endif
q[10] = crc >> 8; q[10] = crc >> 8;
q[11] = crc & 0xff; q[11] = crc & 0xff;
} }
@ -774,7 +792,13 @@ int sector_headers(struct burn_write_opts *o, unsigned char *out,
out[15] = modebyte; out[15] = modebyte;
} }
if (mode & BURN_MODE1) { if (mode & BURN_MODE1) {
#ifdef Libburn_no_crc_C
crc = 0; /* dummy */
#else
crc = crc_32(out, 2064); crc = crc_32(out, 2064);
#endif
out[2064] = crc & 0xFF; out[2064] = crc & 0xFF;
crc >>= 8; crc >>= 8;
out[2065] = crc & 0xFF; out[2065] = crc & 0xFF;

View File

@ -39,7 +39,6 @@
#include "libburn.h" #include "libburn.h"
#include "drive.h" #include "drive.h"
#include "transport.h" #include "transport.h"
#include "crc.h"
#include "debug.h" #include "debug.h"
#include "init.h" #include "init.h"
#include "toc.h" #include "toc.h"