[Libburn] libisofs patch (3rd revision)
Ben Jansens
xor@orodu.net
Tue, 24 Feb 2004 13:34:14 -0500
--SkvwRMAIpAhPCcCJ
Content-Type: multipart/mixed; boundary="9jxsPFA5p3P2qPhR"
Content-Disposition: inline
--9jxsPFA5p3P2qPhR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Mon, Feb 23, 2004 at 12:40:15AM -0500, Todd Kulesza wrote:
> OK, last patch for tonight, I promise... This one adds support for
> writing the directory and file structure. All that remains is to write
> the files themselves and libisofs will be (sort of) functional; it
> should be able to write level-1 ISOs, at any rate. Right now the files
> it writes are all of size 0:
Awesome :D I'm impressed you have it so far already. Cheers!
> I've tried to keep the coding style consistent with what already existed
> in libisofs. Let me know if there's anything to clean up or styled
> differently.
Don't access the isoname1 field directly. Always go through the
iso_tree_*_get_name() function. I've fixed this where it was occuring.
All static functions should have prototypes at the top of the .c file. Then
in their definition they should not include the static keyword again. I
think I got all of them.
When choosing between all the options of an enum, a switch statement is
preferable to if{}else if{}else{}. This way you get compiler warnings if
ever a new one is added. And I like it better :) I've changed this as well.
I think everything else looks nice nice nice. I'm attaching my changed
version of your patch. You can diff the diffs, or something, if you want.
I'll commit this and hopefully I didn't break anything of yours :)
Cheers,
Ben
--9jxsPFA5p3P2qPhR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="libisofs.xor.diff"
Content-Transfer-Encoding: quoted-printable
? libburn/null.lo
? test/disc
? test/disc2
? test/joerg.bigpath.iso
? test/joerg.bigpath.iso.dump
? test/joerg.iso
? test/joerg.iso.dump
? test/me.iso
? test/me.iso.dump
? test/neromode1.nrg
? test/neromode2.nrg
Index: libburn/async.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/async.c,v
retrieving revision 1.17
diff -p -u -r1.17 async.c
--- a/libburn/async.c 19 Dec 2003 02:11:10 -0000 1.17
+++ b/libburn/async.c 24 Feb 2004 18:31:07 -0000
@@ -12,8 +12,7 @@
=20
#define SCAN_GOING() (workers && !workers->drive)
=20
-
-typedef void* (*WorkerFunc)(void *);
+typedef void *(*WorkerFunc) (void *);
=20
struct scan_opts
{
@@ -36,23 +35,24 @@ struct write_opts
struct burn_disc *disc;
};
=20
-struct w_list {
+struct w_list
+{
struct burn_drive *drive;
pthread_t thread;
=20
struct w_list *next;
=20
- union w_list_data {
+ union w_list_data
+ {
struct scan_opts scan;
struct erase_opts erase;
struct write_opts write;
} u;
};
=20
-
static struct w_list *workers;
=20
-static struct w_list* find_worker(struct burn_drive *d)
+static struct w_list *find_worker(struct burn_drive *d)
{
struct w_list *a;
=20
@@ -68,7 +68,7 @@ static void add_worker(struct burn_drive
=20
a =3D malloc(sizeof(struct w_list));
a->drive =3D d;
- a->u =3D *(union w_list_data*)data;
+ a->u =3D *(union w_list_data *)data;
=20
/* insert at front of the list */
a->next =3D workers;
@@ -96,18 +96,17 @@ static void remove_worker(pthread_t th)
free(a);
break;
}
- assert(a !=3D NULL); /* wasn't found.. this should not be possible */
+ assert(a !=3D NULL); /* wasn't found.. this should not be possible */
}
=20
-static void* scan_worker_func(struct w_list *w)
+static void *scan_worker_func(struct w_list *w)
{
burn_drive_scan_sync(w->u.scan.drives, w->u.scan.n_drives);
w->u.scan.done =3D 1;
return NULL;
}
=20
-int burn_drive_scan(struct burn_drive_info *drives[],
- unsigned int *n_drives)
+int burn_drive_scan(struct burn_drive_info *drives[], unsigned int *n_driv=
es)
{
struct scan_opts o;
int ret =3D 0;
@@ -132,7 +131,7 @@ int burn_drive_scan(struct burn_drive_in
return ret;
}
=20
-static void* erase_worker_func(struct w_list *w)
+static void *erase_worker_func(struct w_list *w)
{
burn_disc_erase_sync(w->u.erase.drive, w->u.erase.fast);
remove_worker(pthread_self());
@@ -146,19 +145,19 @@ void burn_disc_erase(struct burn_drive *
assert(drive);
assert(!SCAN_GOING());
assert(!find_worker(drive));
-=09
+
o.drive =3D drive;
o.fast =3D fast;
add_worker(drive, (WorkerFunc) erase_worker_func, &o);
}
=20
-static void* write_disc_worker_func(struct w_list *w)
+static void *write_disc_worker_func(struct w_list *w)
{
burn_disc_write_sync(w->u.write.opts, w->u.write.disc);
=20
- /* the options are refcounted, free out ref count which we added
- below */
- burn_write_opts_free(w->u.write.opts);=09
+ /* the options are refcounted, free out ref count which we added below=20
+ */
+ burn_write_opts_free(w->u.write.opts);
=20
remove_worker(pthread_self());
return NULL;
Index: libburn/async.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/async.h,v
retrieving revision 1.4
diff -p -u -r1.4 async.h
--- a/libburn/async.h 15 Dec 2003 21:17:17 -0000 1.4
+++ b/libburn/async.h 24 Feb 2004 18:31:07 -0000
@@ -6,4 +6,3 @@
void burn_async_join_all();
struct burn_write_opts;
#endif /* BURN__ASYNC_H */
-
Index: libburn/drive.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/drive.c,v
retrieving revision 1.254
diff -p -u -r1.254 drive.c
--- a/libburn/drive.c 7 Feb 2004 03:22:22 -0000 1.254
+++ b/libburn/drive.c 24 Feb 2004 18:31:07 -0000
@@ -143,7 +143,7 @@ void burn_disc_erase_sync(struct burn_dr
burn_message_clear_queue();
=20
burn_print(1, "erasing drive %s %s\n", d->idata->vendor,
- d->idata->product);
+ d->idata->product);
=20
if (d->status !=3D BURN_DISC_FULL)
return;
@@ -161,9 +161,10 @@ void burn_disc_erase_sync(struct burn_dr
d->progress.sectors =3D 0x10000;
d->progress.current_sector =3D 0;
/* read the initial 0 stage */
- while(!d->test_unit_ready(d) && d->get_erase_progress(d) =3D=3D 0)
+ while (!d->test_unit_ready(d) && d->get_erase_progress(d) =3D=3D 0)
sleep(1);
- while(!d->test_unit_ready(d) && (d->progress.current_sector =3D d->get_er=
ase_progress(d)) > 0)
+ while (!d->test_unit_ready(d) &&
+ (d->progress.current_sector =3D d->get_erase_progress(d)) > 0)
sleep(1);
d->progress.current_sector =3D 0x10000;
d->busy =3D BURN_DRIVE_IDLE;
@@ -179,7 +180,8 @@ int burn_disc_erasable(struct burn_drive
{
return d->erasable;
}
-enum burn_drive_status burn_drive_get_status(struct burn_drive *d, struct =
burn_progress *p)
+enum burn_drive_status burn_drive_get_status(struct burn_drive *d,
+ struct burn_progress *p)
{
if (p) {
memcpy(p, &(d->progress), sizeof(struct burn_progress));
@@ -194,7 +196,7 @@ void burn_drive_cancel(struct burn_drive
}
=20
int burn_drive_get_block_types(struct burn_drive *d,
- enum burn_write_types write_type)
+ enum burn_write_types write_type)
{
burn_print(12, "write type: %d\n", write_type);
assert( /* (write_type >=3D BURN_WRITE_PACKET) && */
@@ -256,7 +258,7 @@ static int drive_getcaps(struct burn_dri
/* update available block types for burners */
if (out->write_dvdram || out->write_dvdr ||
out->write_cdrw || out->write_cdr)
- d->probe_write_modes(d);
+ d->probe_write_modes(d);
out->tao_block_types =3D d->block_types[BURN_WRITE_TAO];
out->sao_block_types =3D d->block_types[BURN_WRITE_SAO];
out->raw_block_types =3D d->block_types[BURN_WRITE_RAW];
@@ -265,7 +267,7 @@ static int drive_getcaps(struct burn_dri
}
=20
int burn_drive_scan_sync(struct burn_drive_info *drives[],
- unsigned int *n_drives)
+ unsigned int *n_drives)
{
/* state vars for the scan process */
static int scanning =3D 0, scanned, found;
@@ -293,8 +295,7 @@ int burn_drive_scan_sync(struct burn_dri
count =3D burn_drive_count();
if (count)
*drives =3D
- malloc(sizeof(struct burn_drive_info) *
- count);
+ malloc(sizeof(struct burn_drive_info) * count);
else
*drives =3D NULL;
*n_drives =3D scanned =3D found =3D num_scanned =3D 0;
@@ -346,7 +347,7 @@ int burn_msf_to_sectors(int m, int s, in
=20
void burn_sectors_to_msf(int sectors, int *m, int *s, int *f)
{
- *m =3D sectors/(60*75);
+ *m =3D sectors / (60 * 75);
*s =3D (sectors - *m * 60 * 75) / 75;
*f =3D sectors - *m * 60 * 75 - *s * 75;
}
@@ -360,4 +361,3 @@ int burn_drive_get_write_speed(struct bu
{
return d->mdata->max_write_speed;
}
-
Index: libburn/drive.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/drive.h,v
retrieving revision 1.81
diff -p -u -r1.81 drive.h
--- a/libburn/drive.h 15 Dec 2003 04:44:01 -0000 1.81
+++ b/libburn/drive.h 24 Feb 2004 18:31:07 -0000
@@ -45,7 +45,7 @@ void burn_write_empty_subcode(int fd);
void burn_drive_free(void);
=20
int burn_drive_scan_sync(struct burn_drive_info *drives[],
- unsigned int *n_drives);
+ unsigned int *n_drives);
void burn_disc_erase_sync(struct burn_drive *d, int fast);
=20
#endif /* __DRIVE */
Index: libburn/file.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/file.c,v
retrieving revision 1.10
diff -p -u -r1.10 file.c
--- a/libburn/file.c 27 Jan 2004 21:59:54 -0000 1.10
+++ b/libburn/file.c 24 Feb 2004 18:31:07 -0000
@@ -14,18 +14,21 @@ an unreadable disc */
int file_read(struct burn_source *source, unsigned char *buffer, int size)
{
struct burn_source_file *fs =3D source->data;
+
return read(fs->datafd, buffer, size);
}
=20
-int file_read_sub(struct burn_source *source , unsigned char *buffer, int =
size)
+int file_read_sub(struct burn_source *source, unsigned char *buffer, int s=
ize)
{
struct burn_source_file *fs =3D source->data;
+
return read(fs->subfd, buffer, size);
}
=20
static void file_free(struct burn_source *source)
{
struct burn_source_file *fs =3D source->data;
+
close(fs->datafd);
if (source->read_sub)
close(fs->subfd);
@@ -36,12 +39,12 @@ static int file_size(struct burn_source=20
{
struct stat buf;
struct burn_source_file *fs =3D source->data;
+
fstat(fs->datafd, &buf);
return buf.st_size;
}
=20
-struct burn_source *burn_file_source_new(const char *path,
- const char *subpath)
+struct burn_source *burn_file_source_new(const char *path, const char *sub=
path)
{
struct burn_source_file *fs;
struct burn_source *src;
@@ -70,7 +73,8 @@ struct burn_source *burn_file_source_new
src->read =3D file_read;
if (subpath)
src->read_sub =3D file_read_sub;
- else src->read_sub =3D NULL;
+ else
+ src->read_sub =3D NULL;
=20
src->get_size =3D file_size;
src->free_data =3D file_free;
Index: libburn/file.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/file.h,v
retrieving revision 1.3
diff -p -u -r1.3 file.h
--- a/libburn/file.h 9 Dec 2003 00:05:47 -0000 1.3
+++ b/libburn/file.h 24 Feb 2004 18:31:07 -0000
@@ -3,7 +3,8 @@
#ifndef BURN__FILE_H
#define BURN__FILE_H
=20
-struct burn_source_file {
+struct burn_source_file
+{
int datafd;
int subfd;
};
Index: libburn/message.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/message.c,v
retrieving revision 1.3
diff -p -u -r1.3 message.c
--- a/libburn/message.c 15 Dec 2003 04:44:01 -0000 1.3
+++ b/libburn/message.c 24 Feb 2004 18:31:07 -0000
@@ -7,100 +7,101 @@
=20
struct message_list
{
- struct message_list *next;
+ struct message_list *next;
=20
- struct burn_message *msg;
+ struct burn_message *msg;
};
=20
static struct message_list *queue;
=20
void burn_message_free(struct burn_message *msg)
{
- free(msg);
+ free(msg);
}
=20
void burn_message_clear_queue()
{
- struct burn_message *msg;
+ struct burn_message *msg;
=20
- if ((msg =3D burn_get_message())) {
- burn_print(0, "YOU HAVE MESSAGES QUEUED FROM THE LAST OPERATION. "
- "YOU SHOULD BE GRABBING THEM ALL!\n");
- do {
- burn_message_free(msg);
- } while ((msg =3D burn_get_message()));
- }
+ if ((msg =3D burn_get_message())) {
+ burn_print(0,
+ "YOU HAVE MESSAGES QUEUED FROM THE LAST OPERATION. "
+ "YOU SHOULD BE GRABBING THEM ALL!\n");
+ do {
+ burn_message_free(msg);
+ } while ((msg =3D burn_get_message()));
+ }
}
=20
-struct burn_message* burn_get_message()
+struct burn_message *burn_get_message()
{
- struct burn_message *msg =3D NULL;
+ struct burn_message *msg =3D NULL;
=20
- if (queue) {
- struct message_list *next;
+ if (queue) {
+ struct message_list *next;
=20
- next =3D queue->next;
- msg =3D queue->msg;
- free(queue);
- queue =3D next;
- }
+ next =3D queue->next;
+ msg =3D queue->msg;
+ free(queue);
+ queue =3D next;
+ }
=20
- return msg;
+ return msg;
}
=20
void queue_push_tail(struct burn_message *msg)
{
- struct message_list *node;
+ struct message_list *node;
=20
- node =3D malloc(sizeof(struct message_list));
- node->next =3D NULL;
- node->msg =3D msg;
-
- if (!queue)
- queue =3D node;
- else {
- struct message_list *it;
-
- for (it =3D queue; it->next; it =3D it->next);
- it->next =3D node;
- }
+ node =3D malloc(sizeof(struct message_list));
+ node->next =3D NULL;
+ node->msg =3D msg;
+
+ if (!queue)
+ queue =3D node;
+ else {
+ struct message_list *it;
+
+ for (it =3D queue; it->next; it =3D it->next) ;
+ it->next =3D node;
+ }
}
=20
void burn_message_info_new(struct burn_drive *drive,
- enum burn_message_info message)
+ enum burn_message_info message)
{
- struct burn_message *msg;
+ struct burn_message *msg;
=20
- msg =3D malloc(sizeof(struct burn_message));
- msg->drive =3D drive;
- msg->type =3D BURN_MESSAGE_INFO;
- msg->detail.info.message =3D message;
+ msg =3D malloc(sizeof(struct burn_message));
+ msg->drive =3D drive;
+ msg->type =3D BURN_MESSAGE_INFO;
+ msg->detail.info.message =3D message;
=20
- queue_push_tail(msg);
+ queue_push_tail(msg);
}
=20
void burn_message_warning_new(struct burn_drive *drive,
- enum burn_message_info message)
+ enum burn_message_info message)
{
- struct burn_message *msg;
+ struct burn_message *msg;
=20
- msg =3D malloc(sizeof(struct burn_message));
- msg->drive =3D drive;
- msg->type =3D BURN_MESSAGE_WARNING;
- msg->detail.warning.message =3D message;
+ msg =3D malloc(sizeof(struct burn_message));
+ msg->drive =3D drive;
+ msg->type =3D BURN_MESSAGE_WARNING;
+ msg->detail.warning.message =3D message;
=20
- queue_push_tail(msg);
+ queue_push_tail(msg);
}
=20
void burn_message_error(struct burn_drive *drive,
- enum burn_message_info message)
+ enum burn_message_info message)
{
- struct burn_message *msg;
+ struct burn_message *msg;
=20
- msg =3D malloc(sizeof(struct burn_message));
- msg->drive =3D drive;
- msg->type =3D BURN_MESSAGE_ERROR;
- msg->detail.error.message =3D message;
+ msg =3D malloc(sizeof(struct burn_message));
+ msg->drive =3D drive;
+ msg->type =3D BURN_MESSAGE_ERROR;
+ msg->detail.error.message =3D message;
=20
- queue_push_tail(msg);
+ queue_push_tail(msg);
}
Index: libburn/message.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/message.h,v
retrieving revision 1.3
diff -p -u -r1.3 message.h
--- a/libburn/message.h 15 Dec 2003 04:44:01 -0000 1.3
+++ b/libburn/message.h 24 Feb 2004 18:31:07 -0000
@@ -8,13 +8,12 @@
void burn_message_clear_queue();
=20
void burn_message_info_new(struct burn_drive *drive,
- enum burn_message_info message);
+ enum burn_message_info message);
=20
void burn_message_warning_new(struct burn_drive *drive,
- enum burn_message_info message);
+ enum burn_message_info message);
=20
void burn_message_error_new(struct burn_drive *drive,
- enum burn_message_info message);
-
+ enum burn_message_info message);
=20
#endif
Index: libburn/mmc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/mmc.c,v
retrieving revision 1.136
diff -p -u -r1.136 mmc.c
--- a/libburn/mmc.c 19 Jan 2004 02:30:46 -0000 1.136
+++ b/libburn/mmc.c 24 Feb 2004 18:31:07 -0000
@@ -18,19 +18,24 @@
=20
static unsigned char MMC_GET_TOC[] =3D { 0x43, 2, 2, 0, 0, 0, 0, 16, 0, 0 =
};
static unsigned char MMC_GET_ATIP[] =3D { 0x43, 2, 4, 0, 0, 0, 0, 16, 0, 0=
};
-static unsigned char MMC_GET_DISC_INFO[] =3D { 0x51, 0, 0, 0, 0, 0, 0, 16,=
0, 0 };
+static unsigned char MMC_GET_DISC_INFO[] =3D
+ { 0x51, 0, 0, 0, 0, 0, 0, 16, 0, 0 };
static unsigned char MMC_READ_CD[] =3D { 0xBE, 0, 0, 0, 0, 0, 0, 0, 0, 0, =
0, 0 };
static unsigned char MMC_ERASE[] =3D { 0xA1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,=
0 };
static unsigned char MMC_SEND_OPC[] =3D { 0x54, 0, 0, 0, 0, 0, 0, 0, 0, 0 =
};
-static unsigned char MMC_SET_SPEED[] =3D{ 0xBB, 0, 0, 0, 0, 0, 0, 0, 0, 0,=
0, 0 };
-static unsigned char MMC_WRITE_12[] =3D { 0xAA, 0, 0, 0, 0, 0, 0, 0, 0, 0,=
0, 0 };
+static unsigned char MMC_SET_SPEED[] =3D
+ { 0xBB, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+static unsigned char MMC_WRITE_12[] =3D
+ { 0xAA, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
static unsigned char MMC_WRITE_10[] =3D { 0x2A, 0, 0, 0, 0, 0, 0, 0, 0, 0 =
};
-static unsigned char MMC_GET_CONFIGURATION[] =3D{ 0x46, 0, 0, 0, 0, 0, 16,=
0, 0 };
+static unsigned char MMC_GET_CONFIGURATION[] =3D
+ { 0x46, 0, 0, 0, 0, 0, 16, 0, 0 };
static unsigned char MMC_SYNC_CACHE[] =3D { 0x35, 0, 0, 0, 0, 0, 0, 0, 0, =
0 };
static unsigned char MMC_GET_EVENT[] =3D { 0x4A, 1, 0, 0, 16, 0, 0, 0, 8, =
0 };
static unsigned char MMC_CLOSE[] =3D { 0x5B, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
static unsigned char MMC_TRACK_INFO[] =3D { 0x52, 0, 0, 0, 0, 0, 0, 16, 0,=
0 };
-static unsigned char MMC_SEND_CUE_SHEET[] =3D { 0x5D, 0, 0, 0, 0, 0, 0, 0,=
0, 0 };
+static unsigned char MMC_SEND_CUE_SHEET[] =3D
+ { 0x5D, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
=20
void mmc_send_cue_sheet(struct burn_drive *d, struct cue_sheet *s)
{
@@ -67,10 +72,9 @@ int mmc_get_nwa(struct burn_drive *d)
d->issue_command(d, &c);
data =3D c.page->data;
return (data[12] << 24) + (data[13] << 16)
- + (data[14] << 8) + data[15];
+ + (data[14] << 8) + data[15];
}
=20
-
void mmc_close_disc(struct burn_drive *d, struct burn_write_opts *o)
{
assert(o->drive =3D=3D d);
@@ -90,6 +94,7 @@ void mmc_close_session(struct burn_drive
void mmc_close(struct burn_drive *d, int session, int track)
{
struct command c;
+
c.retry =3D 1;
c.oplen =3D sizeof(MMC_CLOSE);
memcpy(c.opcode, MMC_CLOSE, sizeof(MMC_CLOSE));
@@ -105,6 +110,7 @@ void mmc_get_event(struct burn_drive *d)
{
struct buffer buf;
struct command c;
+
c.retry =3D 1;
c.oplen =3D sizeof(MMC_GET_EVENT);
memcpy(c.opcode, MMC_GET_EVENT, sizeof(MMC_GET_EVENT));
@@ -113,10 +119,11 @@ void mmc_get_event(struct burn_drive *d)
c.page->sectors =3D 0;
c.dir =3D FROM_DRIVE;
d->issue_command(d, &c);
- burn_print(12, "0x%x:0x%x:0x%x:0x%x\n",=20
-c.page->data[0], c.page->data[1], c.page->data[2], c.page->data[3]);
- burn_print(12, "event: %d:%d:%d:%d\n",
-c.page->data[4], c.page->data[5], c.page->data[6], c.page->data[7]);
+ burn_print(12, "0x%x:0x%x:0x%x:0x%x\n",
+ c.page->data[0], c.page->data[1], c.page->data[2],
+ c.page->data[3]);
+ burn_print(12, "event: %d:%d:%d:%d\n", c.page->data[4],
+ c.page->data[5], c.page->data[6], c.page->data[7]);
}
=20
void mmc_write_12(struct burn_drive *d, int start, struct buffer *buf)
@@ -211,7 +218,7 @@ void mmc_read_toc(struct burn_drive *d)
=20
burn_print(12, "TOC:\n");
=20
- d->disc =3D burn_disc_create();=20
+ d->disc =3D burn_disc_create();
=20
for (i =3D 0; i < c.page->data[3]; i++) {
session =3D burn_session_create();
@@ -220,19 +227,19 @@ void mmc_read_toc(struct burn_drive *d)
}
for (i =3D 0; i < d->toc_entries; i++, tdata +=3D 11) {
burn_print(12, "S %d, PT %d, TNO %d : ", tdata[0], tdata[3],
- tdata[2]);
+ tdata[2]);
burn_print(12, "(%d:%d:%d)", tdata[8], tdata[9], tdata[10]);
burn_print(12, "A(%d:%d:%d)", tdata[4], tdata[5], tdata[6]);
burn_print(12, " - control %d, adr %d\n", tdata[1] & 0xF,
- tdata[1] >> 4);
+ tdata[1] >> 4);
=20
if (tdata[3] =3D=3D 1) {
if (burn_msf_to_lba(tdata[8], tdata[9], tdata[10])) {
d->disc->session[0]->hidefirst =3D 1;
track =3D burn_track_create();
- burn_session_add_track(
- d->disc->session[tdata[0] - 1],
- track, BURN_POS_END);
+ burn_session_add_track(d->disc->
+ session[tdata[0] - 1],
+ track, BURN_POS_END);
burn_track_free(track);
=20
}
@@ -240,7 +247,7 @@ void mmc_read_toc(struct burn_drive *d)
if (tdata[3] < 100) {
track =3D burn_track_create();
burn_session_add_track(d->disc->session[tdata[0] - 1],
- track, BURN_POS_END);
+ track, BURN_POS_END);
track->entry =3D &d->toc_entry[i];
burn_track_free(track);
}
@@ -261,8 +268,8 @@ void mmc_read_toc(struct burn_drive *d)
if (tdata[3] =3D=3D 0xA1)
d->disc->session[tdata[0] - 1]->lasttrack =3D tdata[8];
if (tdata[3] =3D=3D 0xA2)
- d->disc->session[tdata[0] - 1]->leadout_entry =3D=20
- &d->toc_entry[=
i];
+ d->disc->session[tdata[0] - 1]->leadout_entry =3D
+ &d->toc_entry[i];
}
if (d->status !=3D BURN_DISC_APPENDABLE)
d->status =3D BURN_DISC_FULL;
@@ -326,8 +333,7 @@ void mmc_read_atip(struct burn_drive *d)
void mmc_read_sectors(struct burn_drive *d,
int start,
int len,
- const struct burn_read_opts *o,
- struct buffer *buf)
+ const struct burn_read_opts *o, struct buffer *buf)
{
int temp;
int errorblock, req;
@@ -336,7 +342,7 @@ void mmc_read_sectors(struct burn_drive=20
assert(len >=3D 0);
/* if the drive isn't busy, why the hell are we here? */
assert(d->busy);
-burn_print(12, "reading %d from %d\n", len, start);
+ burn_print(12, "reading %d from %d\n", len, start);
memcpy(c.opcode, MMC_READ_CD, sizeof(MMC_READ_CD));
c.retry =3D 1;
c.oplen =3D sizeof(MMC_READ_CD);
@@ -354,8 +360,7 @@ burn_print(12, "reading %d from %d\n", l
len >>=3D 8;
c.opcode[6] =3D len & 0xFF;
req =3D 0xF8;
- if (d->busy =3D=3D BURN_DRIVE_GRABBING ||
- o->report_recovered_errors)
+ if (d->busy =3D=3D BURN_DRIVE_GRABBING || o->report_recovered_errors)
req |=3D 2;
=20
c.opcode[10] =3D 0;
@@ -372,10 +377,12 @@ burn_print(12, "reading %d from %d\n", l
d->issue_command(d, &c);
=20
if (c.error) {
-burn_print(12, "got an error over here\n");
-burn_print(12, "%d, %d, %d, %d\n", c.sense[3], c.sense[4], c.sense[5], c.s=
ense[6]);
- errorblock =3D (c.sense[3] << 24) +
- (c.sense[4] << 16) + (c.sense[5] << 8) + c.sense[6];
+ burn_print(12, "got an error over here\n");
+ burn_print(12, "%d, %d, %d, %d\n", c.sense[3], c.sense[4],
+ c.sense[5], c.sense[6]);
+ errorblock =3D
+ (c.sense[3] << 24) + (c.sense[4] << 16) +
+ (c.sense[5] << 8) + c.sense[6];
c.page->sectors =3D errorblock - start + 1;
burn_print(1, "error on block %d\n", errorblock);
burn_print(12, "error on block %d\n", errorblock);
@@ -388,7 +395,7 @@ void mmc_erase(struct burn_drive *d, int
struct command c;
=20
memcpy(c.opcode, MMC_ERASE, sizeof(MMC_ERASE));
- c.opcode[1] =3D 16; /* IMMED set to 1 */
+ c.opcode[1] =3D 16; /* IMMED set to 1 */
c.opcode[1] |=3D !!fast;
c.retry =3D 1;
c.oplen =3D sizeof(MMC_ERASE);
@@ -455,8 +462,7 @@ void mmc_get_configuration(struct burn_d
int len;
struct command c;
=20
- memcpy(c.opcode, MMC_GET_CONFIGURATION,
- sizeof(MMC_GET_CONFIGURATION));
+ memcpy(c.opcode, MMC_GET_CONFIGURATION, sizeof(MMC_GET_CONFIGURATION));
c.retry =3D 1;
c.oplen =3D sizeof(MMC_GET_CONFIGURATION);
c.page =3D &buf;
@@ -472,8 +478,8 @@ void mmc_get_configuration(struct burn_d
+ c.page->data[3];
burn_print(1, "all %d bytes of it\n", len);
burn_print(1, "%d, %d, %d, %d\n",
- c.page->data[0],
- c.page->data[1], c.page->data[2], c.page->data[3]);
+ c.page->data[0],
+ c.page->data[1], c.page->data[2], c.page->data[3]);
}
=20
void mmc_sync_cache(struct burn_drive *d)
Index: libburn/mmc.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/mmc.h,v
retrieving revision 1.38
diff -p -u -r1.38 mmc.h
--- a/libburn/mmc.h 19 Jan 2004 02:31:13 -0000 1.38
+++ b/libburn/mmc.h 24 Feb 2004 18:31:07 -0000
@@ -26,9 +26,7 @@ void mmc_read_disc_info(struct burn_driv
void mmc_read_atip(struct burn_drive *);
void mmc_read_sectors(struct burn_drive *,
int,
- int,
- const struct burn_read_opts *,
- struct buffer *);
+ int, const struct burn_read_opts *, struct buffer *);
void mmc_set_speed(struct burn_drive *, int, int);
void mmc_read_lead_in(struct burn_drive *, struct buffer *);
void mmc_perform_opc(struct burn_drive *);
Index: libburn/options.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/options.c,v
retrieving revision 1.16
diff -p -u -r1.16 options.c
--- a/libburn/options.c 7 Feb 2004 04:41:47 -0000 1.16
+++ b/libburn/options.c 24 Feb 2004 18:31:07 -0000
@@ -5,7 +5,7 @@
#include <assert.h>
#include <stdlib.h>
#include <string.h>
-struct burn_write_opts* burn_write_opts_new(struct burn_drive *drive)
+struct burn_write_opts *burn_write_opts_new(struct burn_drive *drive)
{
struct burn_write_opts *opts;
=20
@@ -32,7 +32,7 @@ void burn_write_opts_free(struct burn_wr
free(opts);
}
=20
-struct burn_read_opts* burn_read_opts_new(struct burn_drive *drive)
+struct burn_read_opts *burn_read_opts_new(struct burn_drive *drive)
{
struct burn_read_opts *opts;
=20
@@ -57,7 +57,9 @@ void burn_read_opts_free(struct burn_rea
free(opts);
}
=20
-int burn_write_opts_set_write_type(struct burn_write_opts *opts, enum burn=
_write_types write_type, int block_type)
+int burn_write_opts_set_write_type(struct burn_write_opts *opts,
+ enum burn_write_types write_type,
+ int block_type)
{
if ((write_type =3D=3D BURN_WRITE_SAO && block_type =3D=3D BURN_BLOCK_SAO=
) ||
(opts->drive->block_types[write_type] & block_type)) {
@@ -69,11 +71,13 @@ int burn_write_opts_set_write_type(struc
return 0;
}
=20
-void burn_write_opts_set_toc_entries(struct burn_write_opts *opts, int cou=
nt, struct burn_toc_entry *toc_entries)
+void burn_write_opts_set_toc_entries(struct burn_write_opts *opts, int cou=
nt,
+ struct burn_toc_entry *toc_entries)
{
opts->toc_entries =3D count;
opts->toc_entry =3D malloc(count * sizeof(struct burn_toc_entry));
- memcpy(opts->toc_entry, &toc_entries, sizeof(struct burn_toc_entry) * cou=
nt);
+ memcpy(opts->toc_entry, &toc_entries,
+ sizeof(struct burn_toc_entry) * count);
}
=20
void burn_write_opts_set_format(struct burn_write_opts *opts, int format)
@@ -83,16 +87,17 @@ void burn_write_opts_set_format(struct b
=20
int burn_write_opts_set_simulate(struct burn_write_opts *opts, int sim)
{
- if(opts->drive->mdata->simulate) {
+ if (opts->drive->mdata->simulate) {
opts->simulate =3D sim;
return 1;
}
return 0;
}
=20
-int burn_write_opts_set_underrun_proof(struct burn_write_opts *opts, int u=
nderrun_proof)
+int burn_write_opts_set_underrun_proof(struct burn_write_opts *opts,
+ int underrun_proof)
{
- if(opts->drive->mdata->underrun_proof) {
+ if (opts->drive->mdata->underrun_proof) {
opts->underrun_proof =3D underrun_proof;
return 1;
}
@@ -104,12 +109,14 @@ void burn_write_opts_set_perform_opc(str
opts->perform_opc =3D opc;
}
=20
-void burn_write_opts_has_mediacatalog(struct burn_write_opts *opts, int ha=
s_mediacatalog)
+void burn_write_opts_has_mediacatalog(struct burn_write_opts *opts,
+ int has_mediacatalog)
{
opts->has_mediacatalog =3D has_mediacatalog;
}
=20
-void burn_write_opts_set_mediacatalog(struct burn_write_opts *opts, unsign=
ed char mediacatalog[13])
+void burn_write_opts_set_mediacatalog(struct burn_write_opts *opts,
+ unsigned char mediacatalog[13])
{
memcpy(opts->mediacatalog, &mediacatalog, 13);
}
@@ -124,32 +131,39 @@ void burn_read_opts_set_c2errors(struct=20
opts->c2errors =3D c2errors;
}
=20
-void burn_read_opts_read_subcodes_audio(struct burn_read_opts *opts, int s=
ubcodes_audio)
+void burn_read_opts_read_subcodes_audio(struct burn_read_opts *opts,
+ int subcodes_audio)
{
opts->subcodes_audio =3D subcodes_audio;
}
=20
-void burn_read_opts_read_subcodes_data(struct burn_read_opts *opts, int su=
bcodes_data)
+void burn_read_opts_read_subcodes_data(struct burn_read_opts *opts,
+ int subcodes_data)
{
opts->subcodes_data =3D subcodes_data;
}
=20
-void burn_read_opts_set_hardware_error_recovery(struct burn_read_opts *opt=
s, int hardware_error_recovery)
+void burn_read_opts_set_hardware_error_recovery(struct burn_read_opts *opt=
s,
+ int hardware_error_recovery)
{
opts->hardware_error_recovery =3D hardware_error_recovery;
}
=20
-void burn_read_opts_report_recovered_errors(struct burn_read_opts *opts, i=
nt report_recovered_errors)
+void burn_read_opts_report_recovered_errors(struct burn_read_opts *opts,
+ int report_recovered_errors)
{
opts->report_recovered_errors =3D report_recovered_errors;
}
=20
-void burn_read_opts_transfer_damaged_blocks(struct burn_read_opts *opts, i=
nt transfer_damaged_blocks)
+void burn_read_opts_transfer_damaged_blocks(struct burn_read_opts *opts,
+ int transfer_damaged_blocks)
{
opts->transfer_damaged_blocks =3D transfer_damaged_blocks;
}
=20
-void burn_read_opts_set_hardware_error_retries(struct burn_read_opts *opts=
, unsigned char hardware_error_retries)
+void burn_read_opts_set_hardware_error_retries(struct burn_read_opts *opts,
+ unsigned char
+ hardware_error_retries)
{
opts->hardware_error_retries =3D hardware_error_retries;
}
Index: libburn/read.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/read.c,v
retrieving revision 1.14
diff -p -u -r1.14 read.c
--- a/libburn/read.c 15 Dec 2003 04:44:01 -0000 1.14
+++ b/libburn/read.c 24 Feb 2004 18:31:08 -0000
@@ -59,7 +59,7 @@ drive, or only store a subset of the _op
drive_lba =3D 0;
/* XXX removal of this line obviously breaks *
d->track_end =3D burn_track_end(d, d->currsession, d->currtrack);*/
-printf("track ends at %d\n", d->track_end);
+ printf("track ends at %d\n", d->track_end);
page.sectors =3D 0;
page.bytes =3D 0;
=20
@@ -98,17 +98,18 @@ printf("track ends at %d\n", d->track_en
=20
if (drive_lba =3D=3D end) {
d->currtrack++;
- if (d->currtrack > d->toc->session[d->currsession].lasttrack) {
+ if (d->currtrack >
+ d->toc->session[d->currsession].lasttrack) {
d->currsession++;
burn_print(12, "session switch to %d\n",
- d->currsession);
+ d->currsession);
burn_print(12, "skipping a lead out\n");
drive_lba =3D CURRENT_SESSION_START(d);
burn_print(12, "new lba %d\n", drive_lba);
/* XXX more of the same
end =3D burn_track_end(d, d->currsession,
d->currtrack);
-*/ }
+*/ }
burn_print(12, "track switch to %d\n", d->currtrack);
}
=20
@@ -121,14 +122,15 @@ printf("track ends at %d\n", d->track_en
d->track_end =3D finish;
=20
page.sectors =3D (finish < maxsects) ? finish : maxsects;
-printf("reading %d sectors from %d\n", page.sectors, drive_lba);
+ printf("reading %d sectors from %d\n", page.sectors,
+ drive_lba);
d->read_sectors(d, drive_lba, page.sectors, o, &page);
-printf("Read %d\n", page.sectors);
+ printf("Read %d\n", page.sectors);
}
#endif
}
int burn_sector_length_read(struct burn_drive *d,
- const struct burn_read_opts *o)
+ const struct burn_read_opts *o)
{
int dlen =3D 2352;
int data;
@@ -161,7 +163,7 @@ static int bitcount(unsigned char *data,
}
=20
void burn_packet_process(struct burn_drive *d, unsigned char *data,
- const struct burn_read_opts *o)
+ const struct burn_read_opts *o)
{
unsigned char sub[96];
unsigned short crc;
@@ -172,11 +174,11 @@ void burn_packet_process(struct burn_dri
fb =3D bitcount(data + ptr, 294);
if (fb) {
burn_print(1, "%d damaged bits\n",
- bitcount(data + ptr, 294));
+ bitcount(data + ptr, 294));
burn_print(1, "sending error on %s %s\n",
- d->idata->vendor, d->idata->product);
- /* XXX send a burn_message!
- burn_message_error(d, something); */
+ d->idata->vendor, d->idata->product);
+ /* XXX send a burn_message! burn_message_error(d,
+ something); */
}
ptr +=3D 294;
}
@@ -215,18 +217,16 @@ void burn_packet_process(struct burn_dri
crc =3D (*(sub + 22) << 8) + *(sub + 23);
if (crc !=3D crc_ccitt(sub + 12, 10)) {
burn_print(1, "sending error on %s %s\n",
- d->idata->vendor, d->idata->product);
+ d->idata->vendor, d->idata->product);
/* e =3D burn_error();
e->drive =3D d;
*/
burn_print(1, "crc mismatch in Q\n");
- } /* else
- process_q(d, sub + 12);
-*/
-/*
- if (o->subfd !=3D -1)
- write(o->subfd, sub, 96);
-*/ }
+ }
+ /* else process_q(d, sub + 12); */
+ /*=20
+ if (o->subfd !=3D -1) write(o->subfd, sub, 96); */
+ }
/*
if ((d->track_end <=3D 150)
&& (drive_lba + 150 < CURRENT_SESSION_END(d))
@@ -236,9 +236,10 @@ void burn_packet_process(struct burn_dri
write(o->binfd, zeros, 2352);
=20
#warning XXX WHERE ARE MY SUBCODES
- } else
-*/ /* write(o->datafd, data, 2352);*/
+ } else
+*//* write(o->datafd, data, 2352); */
}
+
/* so yeah, when you uncomment these, make them write zeros insted of crap
static void write_empty_sector(int fd)
{
Index: libburn/read.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/read.h,v
retrieving revision 1.3
diff -p -u -r1.3 read.h
--- a/libburn/read.h 15 Dec 2003 04:44:01 -0000 1.3
+++ b/libburn/read.h 24 Feb 2004 18:31:08 -0000
@@ -4,8 +4,8 @@
#define __LIBBURN_READ
=20
int burn_sector_length_read(struct burn_drive *d,
- const struct burn_read_opts *o);
+ const struct burn_read_opts *o);
void burn_packet_process(struct burn_drive *d, unsigned char *data,
- const struct burn_read_opts *o);
+ const struct burn_read_opts *o);
=20
#endif /* __LIBBURN_READ */
Index: libburn/sector.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/sector.c,v
retrieving revision 1.96
diff -p -u -r1.96 sector.c
--- a/libburn/sector.c 5 Feb 2004 06:21:42 -0000 1.96
+++ b/libburn/sector.c 24 Feb 2004 18:31:08 -0000
@@ -22,13 +22,14 @@
static void uncook_subs(unsigned char *dest, unsigned char *source)
{
int i, j, code;
+
memset(dest, 0, 96);
=20
for (i =3D 0; i < 12; i++) {
for (j =3D 0; j < 8; j++) {
for (code =3D 0; code < 8; code++) {
if (source[code * 12 + i] & 0x80)
- dest[j + i*8] |=3D (1 << (7-code));
+ dest[j + i * 8] |=3D (1 << (7 - code));
source[code * 12 + i] <<=3D 1;
}
}
@@ -53,10 +54,9 @@ static int get_outmode(struct burn_write
case BURN_BLOCK_MODE1:
return BURN_MODE1;
}
- assert(0); /* return BURN_MODE_UNIMPLEMENTED :) */
+ assert(0); /* return BURN_MODE_UNIMPLEMENTED :) */
}
=20
-
/* get bytes from a source into *data=20
XXX add a 0 source, and add "next source" links to the sources!
*/
@@ -71,9 +71,9 @@ static void get_bytes(struct burn_source
valid =3D src->read(src, data, count);
shortage =3D count - valid;
if (shortage) {
-// if (t->pad)
- memset(data + valid, 0, shortage);
-// else printf("need %d from next track\n", shortage);
+// if (t->pad)
+ memset(data + valid, 0, shortage);
+// else printf("need %d from next track\n", shortage);
printf("OH NOES!\n");
}
}
@@ -104,9 +104,10 @@ static unsigned char *get_sector(struct=20
=20
return ret;
}
+
/* either inmode =3D=3D outmode, or outmode =3D=3D raw. anything else is =
bad news */
static void convert_data(struct burn_write_opts *o, struct burn_source *sr=
c,
- int inmode, unsigned char *data)
+ int inmode, unsigned char *data)
{
int outlen, inlen;
int offset =3D -1;
@@ -120,7 +121,6 @@ static void convert_data(struct burn_wri
inlen =3D burn_sector_length(inmode);
assert(outlen >=3D inlen);
=20
-
if ((outmode & BURN_MODE_BITS) =3D=3D (inmode & BURN_MODE_BITS)) {
get_bytes(src, inlen, data);
return;
@@ -138,7 +138,7 @@ static void convert_data(struct burn_wri
get_bytes(src, inlen, data + offset);
}
static void convert_subs(struct burn_write_opts *o, int inmode,
- unsigned char *subs, unsigned char *sector)
+ unsigned char *subs, unsigned char *sector)
{
unsigned char *out;
int outmode;
@@ -225,8 +225,7 @@ void sector_toc(struct burn_write_opts *
}
=20
void sector_pregap(struct burn_write_opts *o,
- unsigned char tno, unsigned char control,
- int mode)
+ unsigned char tno, unsigned char control, int mode)
{
struct burn_drive *d =3D o->drive;
unsigned char *data;
@@ -241,8 +240,7 @@ void sector_pregap(struct burn_write_opt
}
=20
void sector_postgap(struct burn_write_opts *o,
- unsigned char tno, unsigned char control,
- int mode)
+ unsigned char tno, unsigned char control, int mode)
{
struct burn_drive *d =3D o->drive;
unsigned char subs[96];
@@ -258,7 +256,7 @@ void sector_postgap(struct burn_write_op
}
=20
void subcode_lout(struct burn_write_opts *o, unsigned char control,
- unsigned char *data)
+ unsigned char *data)
{
struct burn_drive *d =3D o->drive;
unsigned char *q;
@@ -302,13 +300,13 @@ static char char_to_isrc(char c)
}
=20
void subcode_user(struct burn_write_opts *o, unsigned char *subcodes,
- unsigned char tno, unsigned char control,
- unsigned char index, struct isrc *isrc, int psub)
+ unsigned char tno, unsigned char control,
+ unsigned char index, struct isrc *isrc, int psub)
{
struct burn_drive *d =3D o->drive;
unsigned char *p, *q;
int crc;
- int m, s, f, c, qmode; /* 1, 2 or 3 */
+ int m, s, f, c, qmode; /* 1, 2 or 3 */
=20
memset(subcodes, 0, 96);
=20
@@ -352,29 +350,17 @@ void subcode_user(struct burn_write_opts
break;
case 2:
/* media catalog number */
- q[1] =3D
- (o->mediacatalog[0] << 4) +
- o->mediacatalog[1];
- q[2] =3D
- (o->mediacatalog[2] << 4) +
- o->mediacatalog[3];
- q[3] =3D
- (o->mediacatalog[4] << 4) +
- o->mediacatalog[5];
- q[4] =3D
- (o->mediacatalog[6] << 4) +
- o->mediacatalog[7];
- q[5] =3D
- (o->mediacatalog[8] << 4) +
- o->mediacatalog[9];
- q[6] =3D
- (o->mediacatalog[10] << 4) +
- o->mediacatalog[11];
+ q[1] =3D (o->mediacatalog[0] << 4) + o->mediacatalog[1];
+ q[2] =3D (o->mediacatalog[2] << 4) + o->mediacatalog[3];
+ q[3] =3D (o->mediacatalog[4] << 4) + o->mediacatalog[5];
+ q[4] =3D (o->mediacatalog[6] << 4) + o->mediacatalog[7];
+ q[5] =3D (o->mediacatalog[8] << 4) + o->mediacatalog[9];
+ q[6] =3D (o->mediacatalog[10] << 4) + o->mediacatalog[11];
q[7] =3D o->mediacatalog[12] << 4;
=20
- q[8] =3D 0; =20
+ q[8] =3D 0;
burn_lba_to_msf(d->alba, &m, &s, &f);
- q[9] =3D dec_to_bcd(f); /* abs frame */
+ q[9] =3D dec_to_bcd(f); /* abs frame */
break;
case 3:
c =3D char_to_isrc(isrc->country[0]);
@@ -418,8 +404,7 @@ void subcode_user(struct burn_write_opts
q[11] =3D crc & 0xff;
}
=20
-void sector_lout(struct burn_write_opts *o, unsigned char control,
- int mode)
+void sector_lout(struct burn_write_opts *o, unsigned char control, int mod=
e)
{
struct burn_drive *d =3D o->drive;
unsigned char subs[96];
@@ -444,11 +429,10 @@ void sector_data(struct burn_write_opts=20
=20
if (!t->source->read_sub)
subcode_user(o, subs, t->entry->point,
- t->entry->control, 1, &t->isrc, psub);
- else=20
- if (!t->source->read_sub(t->source, subs, 96))
+ t->entry->control, 1, &t->isrc, psub);
+ else if (!t->source->read_sub(t->source, subs, 96))
subcode_user(o, subs, t->entry->point,
- t->entry->control, 1, &t->isrc, psub);
+ t->entry->control, 1, &t->isrc, psub);
convert_subs(o, t->mode, subs, data);
=20
sector_headers(o, data, t->mode, 0);
@@ -486,7 +470,7 @@ int dec_to_bcd(int d)
}
=20
void sector_headers(struct burn_write_opts *o, unsigned char *out,
- int mode, int leadin)
+ int mode, int leadin)
{
struct burn_drive *d =3D o->drive;
unsigned int crc;
@@ -553,7 +537,8 @@ void process_q(struct burn_drive *d, uns
/* q[1] is the track number (starting at 1) q[2] is the index
number (starting at 0) */
#warning this is totally bogus
-if (q[1]-1 > 99) break;
+ if (q[1] - 1 > 99)
+ break;
if (q[2] > d->toc->track[q[1] - 1].indices) {
burn_print(12, "new index at %d\n", d->alba);
d->toc->track[q[1] - 1].index[q[2]] =3D d->alba;
Index: libburn/sector.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/sector.h,v
retrieving revision 1.35
diff -p -u -r1.35 sector.h
--- a/libburn/sector.h 5 Feb 2004 00:34:26 -0000 1.35
+++ b/libburn/sector.h 24 Feb 2004 18:31:08 -0000
@@ -13,17 +13,16 @@ int dec_to_bcd(int);
=20
void sector_toc(struct burn_write_opts *, int mode);
void sector_pregap(struct burn_write_opts *, unsigned char tno,
- unsigned char control, int mode);
+ unsigned char control, int mode);
void sector_postgap(struct burn_write_opts *, unsigned char tno,
- unsigned char control, int mode);
-void sector_lout(struct burn_write_opts *, unsigned char control,
- int mode);
+ unsigned char control, int mode);
+void sector_lout(struct burn_write_opts *, unsigned char control, int mode=
);
void sector_data(struct burn_write_opts *, struct burn_track *t, int psub);
void sector_headers(struct burn_write_opts *, unsigned char *,
- int mode, int leadin);
+ int mode, int leadin);
void subcode_user(struct burn_write_opts *, unsigned char *s,
- unsigned char tno, unsigned char control,
- unsigned char index, struct isrc *isrc, int psub);
+ unsigned char tno, unsigned char control,
+ unsigned char index, struct isrc *isrc, int psub);
=20
int sector_identify(unsigned char *);
=20
Index: libburn/sg.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/sg.c,v
retrieving revision 1.121
diff -p -u -r1.121 sg.c
--- a/libburn/sg.c 30 Jan 2004 23:49:29 -0000 1.121
+++ b/libburn/sg.c 24 Feb 2004 18:31:08 -0000
@@ -27,8 +27,9 @@ static void enumerate_common(char *fname
=20
static int sgio_test(int fd)
{
- unsigned char test_ops[] =3D {0,0,0,0,0,0};
+ unsigned char test_ops[] =3D { 0, 0, 0, 0, 0, 0 };
sg_io_hdr_t s;
+
memset(&s, 0, sizeof(sg_io_hdr_t));
s.interface_id =3D 'S';
s.dxfer_direction =3D SG_DXFER_NONE;
@@ -49,7 +50,7 @@ void ata_enumerate(void)
fd =3D open(fname, O_RDONLY | O_NONBLOCK);
if (fd =3D=3D -1)
continue;
-=20
+
/* found a drive */
ioctl(fd, HDIO_GET_IDENTITY, &tm);
=20
@@ -59,8 +60,8 @@ void ata_enumerate(void)
continue;
}
=20
- /* if SG_IO fails on an atapi device, we should stop=20
- trying to use hd* devices */
+ /* if SG_IO fails on an atapi device, we should stop trying to=20
+ use hd* devices */
if (sgio_test(fd) =3D=3D -1) {
close(fd);
return;
@@ -160,7 +161,7 @@ int sg_grab(struct burn_drive *d)
assert(fd !=3D -1337);
if (-1 !=3D fd) {
/* er =3D ioctl(fd, SG_GET_ACCESS_COUNT, &count);*/
-count =3D 1;
+ count =3D 1;
if (1 =3D=3D count) {
d->fd =3D fd;
fcntl(fd, F_SETOWN, getpid());
@@ -249,7 +250,7 @@ this is valid during the mode probe in s
c->error =3D 1;
return 1;
}
- switch(scsi_error(d, s.sbp, s.sb_len_wr)) {
+ switch (scsi_error(d, s.sbp, s.sb_len_wr)) {
case RETRY:
done =3D 0;
break;
@@ -265,7 +266,8 @@ this is valid during the mode probe in s
return 1;
}
=20
-enum response scsi_error(struct burn_drive *d, unsigned char *sense, int s=
enselen)
+enum response scsi_error(struct burn_drive *d, unsigned char *sense,
+ int senselen)
{
int key, asc, ascq;
=20
@@ -275,7 +277,7 @@ enum response scsi_error(struct burn_dri
ascq =3D sense[13];
=20
burn_print(12, "CONDITION: 0x%x 0x%x 0x%x on %s %s\n",
- key, asc, ascq, d->idata->vendor, d->idata->product);
+ key, asc, ascq, d->idata->vendor, d->idata->product);
=20
switch (asc) {
case 0:
@@ -287,7 +289,7 @@ enum response scsi_error(struct burn_dri
return RETRY;
case 4:
burn_print(1,
- "logical unit is in the process of becoming ready\n");
+ "logical unit is in the process of becoming ready\n");
return RETRY;
case 0x24:
if (key =3D=3D 5)
@@ -301,7 +303,7 @@ enum response scsi_error(struct burn_dri
case 0x28:
if (key =3D=3D 6)
burn_print(1,
- "Not ready to ready change, medium may have changed\n");
+ "Not ready to ready change, medium may have changed\n");
else
break;
return RETRY;
@@ -311,7 +313,7 @@ enum response scsi_error(struct burn_dri
return FAIL;
case 0x3A:
burn_print(12, "Medium not present in %s %s\n",
- d->idata->vendor, d->idata->product);
+ d->idata->vendor, d->idata->product);
=20
d->status =3D BURN_DISC_EMPTY;
return FAIL;
Index: libburn/source.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/source.c,v
retrieving revision 1.5
diff -p -u -r1.5 source.c
--- a/libburn/source.c 15 Dec 2003 04:52:51 -0000 1.5
+++ b/libburn/source.c 24 Feb 2004 18:31:08 -0000
@@ -14,7 +14,7 @@ void burn_source_free(struct burn_source
}
=20
enum burn_source_status burn_track_set_source(struct burn_track *t,
- struct burn_source *s)
+ struct burn_source *s)
{
if (!s->read)
return BURN_SOURCE_FAILED;
Index: libburn/spc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/spc.c,v
retrieving revision 1.92
diff -p -u -r1.92 spc.c
--- a/libburn/spc.c 7 Feb 2004 03:42:06 -0000 1.92
+++ b/libburn/spc.c 24 Feb 2004 18:31:08 -0000
@@ -35,6 +35,7 @@ static unsigned char SPC_TEST_UNIT_READY
int spc_test_unit_ready(struct burn_drive *d)
{
struct command c;
+
c.retry =3D 0;
c.oplen =3D sizeof(SPC_TEST_UNIT_READY);
memcpy(c.opcode, SPC_TEST_UNIT_READY, sizeof(SPC_TEST_UNIT_READY));
@@ -49,6 +50,7 @@ int spc_test_unit_ready(struct burn_driv
void spc_request_sense(struct burn_drive *d, struct buffer *buf)
{
struct command c;
+
c.retry =3D 0;
c.oplen =3D sizeof(SPC_REQUEST_SENSE);
memcpy(c.opcode, SPC_REQUEST_SENSE, sizeof(SPC_REQUEST_SENSE));
@@ -62,6 +64,7 @@ void spc_request_sense(struct burn_drive
int spc_get_erase_progress(struct burn_drive *d)
{
struct buffer b;
+
spc_request_sense(d, &b);
return (b.data[16] << 8) | b.data[17];
}
@@ -184,7 +187,8 @@ void spc_sense_error_params(struct burn_
m->retry_page_valid =3D 1;
}
=20
-void spc_select_error_params(struct burn_drive *d, const struct burn_read_=
opts *o)
+void spc_select_error_params(struct burn_drive *d,
+ const struct burn_read_opts *o)
{
struct buffer buf;
struct command c;
@@ -244,7 +248,7 @@ void spc_sense_write_params(struct burn_
}
=20
void spc_select_write_params(struct burn_drive *d,
- const struct burn_write_opts *o)
+ const struct burn_write_opts *o)
{
struct buffer buf;
struct command c;
@@ -265,7 +269,7 @@ void spc_select_write_params(struct burn
c.page->data[9] =3D d->mdata->write_page_length;
=20
burn_print(12, "using write page length %d (valid %d)\n",
- d->mdata->write_page_length, d->mdata->write_page_valid);
+ d->mdata->write_page_length, d->mdata->write_page_valid);
bufe =3D o->underrun_proof;
sim =3D o->simulate;
c.page->data[10] =3D (bufe << 6)
@@ -274,7 +278,7 @@ void spc_select_write_params(struct burn
c.page->data[11] =3D (o->multi << 6) | o->control;
c.page->data[12] =3D spc_block_type(o->block_type);
c.page->data[22] =3D 0;
- c.page->data[23] =3D 150; /* audio pause length */
+ c.page->data[23] =3D 150; /* audio pause length */
/*XXX need session format! */
c.dir =3D TO_DRIVE;
d->issue_command(d, &c);
@@ -305,7 +309,7 @@ void spc_probe_write_modes(struct burn_d
=20
while (try_write_type !=3D 4) {
burn_print(9, "trying %d, %d\n", try_write_type,
- try_block_type);
+ try_block_type);
memcpy(c.opcode, SPC_MODE_SELECT, sizeof(SPC_MODE_SELECT));
c.retry =3D 1;
c.oplen =3D sizeof(SPC_MODE_SELECT);
@@ -332,14 +336,13 @@ void spc_probe_write_modes(struct burn_d
ascq =3D c.sense[13];
=20
if (key)
- burn_print(7, "%d not supported\n",
- try_block_type);
+ burn_print(7, "%d not supported\n", try_block_type);
else {
burn_print(7, "%d:%d SUPPORTED MODE!\n",
- try_write_type,
- try_block_type);
- if (try_write_type =3D=3D 2) /* sao */
- d->block_types[try_write_type] =3D BURN_BLOCK_SAO;
+ try_write_type, try_block_type);
+ if (try_write_type =3D=3D 2) /* sao */
+ d->block_types[try_write_type] =3D
+ BURN_BLOCK_SAO;
else
d->block_types[try_write_type] |=3D
1 << try_block_type;
@@ -374,7 +377,7 @@ int spc_block_type(enum burn_block_types
{
switch (b) {
case BURN_BLOCK_SAO:
- return 0; /* ignored bitz */
+ return 0; /* ignored bitz */
case BURN_BLOCK_RAW0:
return 0;
case BURN_BLOCK_RAW16:
Index: libburn/spc.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/spc.h,v
retrieving revision 1.27
diff -p -u -r1.27 spc.h
--- a/libburn/spc.h 22 Dec 2003 02:15:37 -0000 1.27
+++ b/libburn/spc.h 24 Feb 2004 18:31:08 -0000
@@ -8,11 +8,12 @@ void spc_prevent(struct burn_drive *);
void spc_allow(struct burn_drive *);
void spc_sense_caps(struct burn_drive *);
void spc_sense_error_params(struct burn_drive *);
-void spc_select_error_params(struct burn_drive *, const struct burn_read_o=
pts *);
+void spc_select_error_params(struct burn_drive *,
+ const struct burn_read_opts *);
void spc_getcaps(struct burn_drive *d);
void spc_sense_write_params(struct burn_drive *);
void spc_select_write_params(struct burn_drive *,
- const struct burn_write_opts *);
+ const struct burn_write_opts *);
void spc_probe_write_modes(struct burn_drive *);
void spc_request_sense(struct burn_drive *d, struct buffer *buf);
int spc_block_type(enum burn_block_types b);
Index: libburn/structure.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/structure.c,v
retrieving revision 1.32
diff -p -u -r1.32 structure.c
--- a/libburn/structure.c 1 Feb 2004 06:11:00 -0000 1.32
+++ b/libburn/structure.c 24 Feb 2004 18:31:08 -0000
@@ -79,10 +79,11 @@ void burn_session_free(struct burn_sessi
free(s->track);
free(s);
}
- =09
+
}
=20
-int burn_disc_add_session(struct burn_disc *d, struct burn_session *s, uns=
igned int pos)
+int burn_disc_add_session(struct burn_disc *d, struct burn_session *s,
+ unsigned int pos)
{
RESIZE(d, session, pos);
d->session[pos] =3D s;
@@ -121,7 +122,8 @@ void burn_track_free(struct burn_track *
}
}
=20
-int burn_session_add_track(struct burn_session *s, struct burn_track *t, u=
nsigned int pos)
+int burn_session_add_track(struct burn_session *s, struct burn_track *t,
+ unsigned int pos)
{
RESIZE(s, track, pos);
s->track[pos] =3D t;
@@ -132,33 +134,36 @@ int burn_session_add_track(struct burn_s
int burn_session_remove_track(struct burn_session *s, struct burn_track *t)
{
int i, pos =3D -1;
+
assert(s->track !=3D NULL);
-=09
+
burn_track_free(t);
-=09
+
/* Find the position */
- for(i =3D 0; i<s->tracks;i++){
- if (t =3D=3D s->track[i])
+ for (i =3D 0; i < s->tracks; i++) {
+ if (t =3D=3D s->track[i])
pos =3D i;
}
=20
if (pos =3D=3D -1)
return 0;
=20
- /* Is it the last track?*/
- if (pos !=3D s->tracks){
- memmove(s->track[pos], s->track[pos+1], sizeof(struct burn_track *) * (s=
->tracks - (pos+1)));
+ /* Is it the last track? */
+ if (pos !=3D s->tracks) {
+ memmove(s->track[pos], s->track[pos + 1],
+ sizeof(struct burn_track *) * (s->tracks - (pos + 1)));
}
-=09
+
s->tracks--;
realloc(&(s->track), sizeof(struct burn_track *) * s->tracks);
-=09
+
return 1;
}
=20
void burn_structure_print_disc(struct burn_disc *d)
{
int i;
+
burn_print(12, "This disc has %d sessions\n", d->sessions);
for (i =3D 0; i < d->sessions; i++) {
burn_structure_print_session(d->session[i]);
@@ -167,6 +172,7 @@ void burn_structure_print_disc(struct bu
void burn_structure_print_session(struct burn_session *s)
{
int i;
+
burn_print(12, " Session has %d tracks\n", s->tracks);
for (i =3D 0; i < s->tracks; i++) {
burn_structure_print_track(s->track[i]);
@@ -174,11 +180,12 @@ void burn_structure_print_session(struct
}
void burn_structure_print_track(struct burn_track *t)
{
- burn_print(12, "(%p) track size %d sectors\n", t, burn_track_get_sectors=
(t));
+ burn_print(12, "(%p) track size %d sectors\n", t,
+ burn_track_get_sectors(t));
}
=20
void burn_track_define_data(struct burn_track *t, int offset, int tail,
- int pad, int mode)
+ int pad, int mode)
{
t->offset =3D offset;
t->pad =3D pad;
@@ -186,26 +193,26 @@ void burn_track_define_data(struct burn_
}
=20
void burn_track_set_isrc(struct burn_track *t, char *country, char *owner,
- unsigned char year, unsigned int serial)
+ unsigned char year, unsigned int serial)
{
- int i;
+ int i;
=20
t->isrc.has_isrc =3D 1;
- for (i =3D 0; i < 2; ++i) {
- assert((country[i] >=3D '0' || country[i] < '9') &&
- (country[i] >=3D 'a' || country[i] < 'z') &&
- (country[i] >=3D 'A' || country[i] < 'Z'));
- t->isrc.country[i] =3D country[i];
- }
- for (i =3D 0; i < 3; ++i) {
- assert((owner[i] >=3D '0' || owner[i] < '9') &&
- (owner[i] >=3D 'a' || owner[i] < 'z') &&
- (owner[i] >=3D 'A' || owner[i] < 'Z'));
- t->isrc.owner[i] =3D owner[i];
- }
- assert(year <=3D 99);
+ for (i =3D 0; i < 2; ++i) {
+ assert((country[i] >=3D '0' || country[i] < '9') &&
+ (country[i] >=3D 'a' || country[i] < 'z') &&
+ (country[i] >=3D 'A' || country[i] < 'Z'));
+ t->isrc.country[i] =3D country[i];
+ }
+ for (i =3D 0; i < 3; ++i) {
+ assert((owner[i] >=3D '0' || owner[i] < '9') &&
+ (owner[i] >=3D 'a' || owner[i] < 'z') &&
+ (owner[i] >=3D 'A' || owner[i] < 'Z'));
+ t->isrc.owner[i] =3D owner[i];
+ }
+ assert(year <=3D 99);
t->isrc.year =3D year;
- assert(serial <=3D 99999);
+ assert(serial <=3D 99999);
t->isrc.serial =3D serial;
}
=20
@@ -218,9 +225,10 @@ int burn_track_get_sectors(struct burn_t
{
int size;
int sectors, seclen;
+
seclen =3D burn_sector_length(t->mode);
size =3D t->offset + t->source->get_size(t->source) + t->tail;
- sectors =3D size/seclen;
+ sectors =3D size / seclen;
if (size % seclen)
sectors++;
burn_print(1, "%d sectors of %d length\n", sectors, seclen);
@@ -231,25 +239,28 @@ int burn_track_get_shortage(struct burn_
{
int size;
int seclen;
+
seclen =3D burn_sector_length(t->mode);
size =3D t->offset + t->source->get_size(t->source) + t->tail;
if (size % seclen)
return seclen - size % seclen;
return 0;
-}=09
+}
=20
int burn_session_get_sectors(struct burn_session *s)
{
int sectors =3D 0, i;
+
for (i =3D 0; i < s->tracks; i++)
- sectors +=3D burn_track_get_sectors(s->track[i]);=09
+ sectors +=3D burn_track_get_sectors(s->track[i]);
return sectors;
}
=20
int burn_disc_get_sectors(struct burn_disc *d)
{
int sectors =3D 0, i;
- for (i =3D 0; i < d->sessions; i++)=20
+
+ for (i =3D 0; i < d->sessions; i++)
sectors +=3D burn_session_get_sectors(d->session[i]);
return sectors;
}
@@ -260,7 +271,7 @@ void burn_track_get_entry(struct burn_tr
}
=20
void burn_session_get_leadout_entry(struct burn_session *s,
- struct burn_toc_entry *entry)
+ struct burn_toc_entry *entry)
{
memcpy(entry, s->leadout_entry, sizeof(struct burn_toc_entry));
}
Index: libburn/structure.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/structure.h,v
retrieving revision 1.20
diff -p -u -r1.20 structure.h
--- a/libburn/structure.h 30 Jan 2004 21:57:27 -0000 1.20
+++ b/libburn/structure.h 24 Feb 2004 18:31:08 -0000
@@ -1,10 +1,11 @@
#ifndef BURN__STRUCTURE_H
#define BURN__STRUCTURE_H
=20
-struct isrc {
+struct isrc
+{
int has_isrc;
char country[2]; /* each must be 0-9, A-Z */
- char owner[3]; /* each must be 0-9, A-Z */
+ char owner[3]; /* each must be 0-9, A-Z */
unsigned char year; /* must be 0-99 */
unsigned int serial; /* must be 0-99999 */
};
@@ -36,7 +37,8 @@ struct burn_track
struct isrc isrc;
};
=20
-struct burn_session {
+struct burn_session
+{
unsigned char firsttrack;
unsigned char lasttrack;
int hidefirst;
@@ -50,7 +52,8 @@ struct burn_session {
int refcnt;
};
=20
-struct burn_disc {
+struct burn_disc
+{
int sessions;
struct burn_session **session;
int refcnt;
Index: libburn/toc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/toc.c,v
retrieving revision 1.36
diff -p -u -r1.36 toc.c
--- a/libburn/toc.c 1 Feb 2004 06:11:00 -0000 1.36
+++ b/libburn/toc.c 24 Feb 2004 18:31:08 -0000
@@ -72,16 +72,16 @@ static void write_clonecd2(volatile stru
dprintf(f, "AFrame=3D%d\r\n", toc->toc_entry[i].frame);
dprintf(f, "ALBA=3D%d\r\n",
burn_msf_to_lba(toc->toc_entry[i].min,
- toc->toc_entry[i].sec,
- toc->toc_entry[i].frame));
+ toc->toc_entry[i].sec,
+ toc->toc_entry[i].frame));
dprintf(f, "Zero=3D%d\r\n", toc->toc_entry[i].zero);
dprintf(f, "PMin=3D%d\r\n", toc->toc_entry[i].pmin);
dprintf(f, "PSec=3D%d\r\n", toc->toc_entry[i].psec);
dprintf(f, "PFrame=3D%d\r\n", toc->toc_entry[i].pframe);
dprintf(f, "PLBA=3D%d\r\n",
burn_msf_to_lba(toc->toc_entry[i].pmin,
- toc->toc_entry[i].psec,
- toc->toc_entry[i].pframe));
+ toc->toc_entry[i].psec,
+ toc->toc_entry[i].pframe));
dprintf(f, "\r\n");
}
}
@@ -99,10 +99,10 @@ void toc_find_modes(struct burn_drive *d
=20
mem.bytes =3D 0;
mem.sectors =3D 1;
- o.raw =3D 1; =20
+ o.raw =3D 1;
o.c2errors =3D 0;
o.subcodes_audio =3D 1;
- o.subcodes_data =3D 1;=20
+ o.subcodes_data =3D 1;
o.hardware_error_recovery =3D 1;
o.report_recovered_errors =3D 0;
o.transfer_damaged_blocks =3D 1;
@@ -111,12 +111,13 @@ void toc_find_modes(struct burn_drive *d
for (i =3D 0; i < d->disc->sessions; i++)
for (j =3D 0; j < d->disc->session[i]->tracks; j++) {
struct burn_track *t =3D d->disc->session[i]->track[j];
+
e =3D t->entry;
if (!e)
lba =3D 0;
else
lba =3D burn_msf_to_lba(e->pmin, e->psec,
- e->pframe);
+ e->pframe);
/* XXX | in the subcodes if appropriate! */
if (e && !(e->control & 4)) {
t->mode =3D BURN_AUDIO;
@@ -125,5 +126,5 @@ void toc_find_modes(struct burn_drive *d
d->read_sectors(d, lba, mem.sectors, &o, &mem);
t->mode =3D sector_identify(mem.data);
}
- }
+ }
}
Index: libburn/transport.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/transport.h,v
retrieving revision 1.107
diff -p -u -r1.107 transport.h
--- a/libburn/transport.h 19 Jan 2004 02:30:14 -0000 1.107
+++ b/libburn/transport.h 24 Feb 2004 18:31:08 -0000
@@ -24,7 +24,8 @@ enum transfer_direction
=20
/* generic 'drive' data structures */
=20
-struct cue_sheet {
+struct cue_sheet
+{
int count;
unsigned char *data;
};
@@ -35,7 +36,8 @@ struct params
int retries;
};
=20
-struct buffer {
+struct buffer
+{
unsigned char data[BUFFER_SIZE];
int sectors;
int bytes;
@@ -97,13 +99,13 @@ struct burn_drive
enum burn_disc_status status;
int erasable;
volatile int released;
- int nwa; /* next writeable address */
- int alba; /* absolute lba */
- int rlba; /* relative lba in section */
+ int nwa; /* next writeable address */
+ int alba; /* absolute lba */
+ int rlba; /* relative lba in section */
int start_lba;
int end_lba;
int toc_temp;
- struct burn_disc *disc; /* disc structure */
+ struct burn_disc *disc; /* disc structure */
int block_types[4];
struct buffer *buffer;
struct burn_progress progress;
@@ -111,39 +113,39 @@ struct burn_drive
volatile int cancel;
volatile enum burn_drive_status busy;
/* transport functions */
- int (*grab)(struct burn_drive *);
- int (*release)(struct burn_drive *);
- int (*issue_command)(struct burn_drive *, struct command *);
+ int (*grab) (struct burn_drive *);
+ int (*release) (struct burn_drive *);
+ int (*issue_command) (struct burn_drive *, struct command *);
=20
/* lower level functions */
- void (*erase)(struct burn_drive *, int);
- void (*getcaps)(struct burn_drive *);
- void (*write)(struct burn_drive *, int, struct buffer *);
- void (*read_toc)(struct burn_drive *);
- void (*lock)(struct burn_drive *);
- void (*unlock)(struct burn_drive *);
- void (*eject)(struct burn_drive *);
- void (*load)(struct burn_drive *);
- void (*read_disc_info)(struct burn_drive *);
- void (*read_sectors)(struct burn_drive *,
+ void (*erase) (struct burn_drive *, int);
+ void (*getcaps) (struct burn_drive *);
+ void (*write) (struct burn_drive *, int, struct buffer *);
+ void (*read_toc) (struct burn_drive *);
+ void (*lock) (struct burn_drive *);
+ void (*unlock) (struct burn_drive *);
+ void (*eject) (struct burn_drive *);
+ void (*load) (struct burn_drive *);
+ void (*read_disc_info) (struct burn_drive *);
+ void (*read_sectors) (struct burn_drive *,
int start,
int len,
- const struct burn_read_opts *,
- struct buffer *);
- void (*perform_opc)(struct burn_drive *);
- void (*set_speed)(struct burn_drive *, int, int);
- void (*send_parameters)(struct burn_drive *,
- const struct burn_read_opts *);
- void (*send_write_parameters)(struct burn_drive *,
- const struct burn_write_opts *);
- void (*send_cue_sheet)(struct burn_drive *, struct cue_sheet *);
- void (*sync_cache)(struct burn_drive *);
- int (*get_erase_progress)(struct burn_drive *);
- int (*get_nwa)(struct burn_drive *);
- void (*close_disc)(struct burn_drive *d, struct burn_write_opts *o);
- void (*close_session)(struct burn_drive *d, struct burn_write_opts *o);
- int (*test_unit_ready) (struct burn_drive *d);
- void (*probe_write_modes) (struct burn_drive *d);
+ const struct burn_read_opts *, struct buffer *);
+ void (*perform_opc) (struct burn_drive *);
+ void (*set_speed) (struct burn_drive *, int, int);
+ void (*send_parameters) (struct burn_drive *,
+ const struct burn_read_opts *);
+ void (*send_write_parameters) (struct burn_drive *,
+ const struct burn_write_opts *);
+ void (*send_cue_sheet) (struct burn_drive *, struct cue_sheet *);
+ void (*sync_cache) (struct burn_drive *);
+ int (*get_erase_progress) (struct burn_drive *);
+ int (*get_nwa) (struct burn_drive *);
+ void (*close_disc) (struct burn_drive * d, struct burn_write_opts * o);
+ void (*close_session) (struct burn_drive * d,
+ struct burn_write_opts * o);
+ int (*test_unit_ready) (struct burn_drive * d);
+ void (*probe_write_modes) (struct burn_drive * d);
struct params params;
struct scsi_inquiry_data *idata;
struct scsi_mode_data *mdata;
Index: libburn/util.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/util.c,v
retrieving revision 1.4
diff -p -u -r1.4 util.c
--- a/libburn/util.c 9 Dec 2003 00:05:47 -0000 1.4
+++ b/libburn/util.c 24 Feb 2004 18:31:08 -0000
@@ -2,33 +2,33 @@
#include <assert.h>
#include <stdlib.h>
=20
-char* burn_strdup(char *s)
+char *burn_strdup(char *s)
{
- char *ret;
- int l;
+ char *ret;
+ int l;
=20
- assert(s);
+ assert(s);
=20
- l =3D strlen(s) + 1;
- ret =3D malloc(l);
- memcpy(ret, s, l);
+ l =3D strlen(s) + 1;
+ ret =3D malloc(l);
+ memcpy(ret, s, l);
=20
- return ret;
+ return ret;
}
=20
-char* burn_strndup(char *s, int n)
+char *burn_strndup(char *s, int n)
{
- char *ret;
- int l;
+ char *ret;
+ int l;
=20
- assert(s);
- assert(n > 0);
+ assert(s);
+ assert(n > 0);
=20
- l =3D strlen(s);
- ret =3D malloc(l < n ? l : n);
+ l =3D strlen(s);
+ ret =3D malloc(l < n ? l : n);
=20
- memcpy(ret, s, l < n - 1 ? l : n - 1);
- ret[n - 1] =3D '\0';
+ memcpy(ret, s, l < n - 1 ? l : n - 1);
+ ret[n - 1] =3D '\0';
=20
- return ret;
+ return ret;
}
Index: libburn/util.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/util.h,v
retrieving revision 1.4
diff -p -u -r1.4 util.h
--- a/libburn/util.h 9 Dec 2003 00:05:47 -0000 1.4
+++ b/libburn/util.h 24 Feb 2004 18:31:08 -0000
@@ -1,8 +1,8 @@
#ifndef __UTIL
#define __UTIL
=20
-char* burn_strdup(char *s);
+char *burn_strdup(char *s);
=20
-char* burn_strndup(char *s, int n);
+char *burn_strndup(char *s, int n);
=20
#endif
Index: libburn/write.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/write.c,v
retrieving revision 1.56
diff -p -u -r1.56 write.c
--- a/libburn/write.c 7 Feb 2004 04:40:36 -0000 1.56
+++ b/libburn/write.c 24 Feb 2004 18:31:08 -0000
@@ -27,6 +27,7 @@ static int type_to_ctrl(int mode)
int ctrl =3D 0;
=20
int data =3D BURN_MODE2 | BURN_MODE1 | BURN_MODE0;
+
if (mode & data) {
ctrl |=3D 4;
} else if (mode & BURN_AUDIO) {
@@ -44,8 +45,7 @@ static int type_to_ctrl(int mode)
}
=20
/* only the ctrl nibble is set here (not adr) */
-static void type_to_form(int mode,
- unsigned char *ctladr, int *form)
+static void type_to_form(int mode, unsigned char *ctladr, int *form)
{
*ctladr =3D type_to_ctrl(mode) << 4;
=20
@@ -59,7 +59,7 @@ static void type_to_form(int mode,
assert(0); /* XXX someone's gonna want this sometime */
if (mode & BURN_MODE_RAW)
*form =3D 0;
- if (mode & BURN_SUBCODE_P16) /* must be expanded to R96 */
+ if (mode & BURN_SUBCODE_P16) /* must be expanded to R96 */
*form |=3D 0x40;
if (mode & BURN_SUBCODE_P96)
*form |=3D 0xC0;
@@ -87,24 +87,24 @@ static void print_cue(struct cue_sheet *
printf("ctladr|trno|indx|form|scms| msf\n");
printf("------+----+----+----+----+--------\n");
for (i =3D 0; i < sheet->count; i++) {
- unit =3D sheet->data + 8*i;
+ unit =3D sheet->data + 8 * i;
printf(" %1X %1X | %02X | %02X | %02X | %02X |",
- (unit[0] & 0xf0) >> 4, unit[0] & 0xf, unit[1], unit[2],
- unit[3], unit[4]);
+ (unit[0] & 0xf0) >> 4, unit[0] & 0xf, unit[1], unit[2],
+ unit[3], unit[4]);
printf("%02X:%02X:%02X\n", unit[5], unit[6], unit[7]);
}
}
=20
static void add_cue(struct cue_sheet *sheet, unsigned char ctladr,
- unsigned char tno, unsigned char indx,
- unsigned char form, unsigned char scms,
- int lba)
+ unsigned char tno, unsigned char indx,
+ unsigned char form, unsigned char scms, int lba)
{
unsigned char *unit;
unsigned char *ptr;
int m, s, f;
+
burn_lba_to_msf(lba, &m, &s, &f);
-=09
+
sheet->count++;
ptr =3D realloc(sheet->data, sheet->count * 8);
assert(ptr);
@@ -121,7 +121,7 @@ static void add_cue(struct cue_sheet *sh
}
=20
struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
- struct burn_session *session)
+ struct burn_session *session)
{
int i, m, s, f, form, pform, runtime =3D -150;
unsigned char ctladr;
@@ -176,8 +176,8 @@ struct cue_sheet *burn_create_toc_entrie
add_cue(sheet, ctladr | 1, i + 1, 0, form, 0, runtime);
runtime +=3D 150;
/* XXX fix pregap interval 1 for data tracks */
-// if (!(form & BURN_AUDIO))
-// tar[i]->pregap1 =3D 1;
+// if (!(form & BURN_AUDIO))
+// tar[i]->pregap1 =3D 1;
tar[i]->pregap2 =3D 1;
}
/* XXX HERE IS WHERE WE DO INDICES IN THE CUE SHEET */
@@ -190,8 +190,9 @@ struct cue_sheet *burn_create_toc_entrie
e[3 + i].pframe =3D f;
e[3 + i].adr =3D 1;
e[3 + i].control =3D type_to_ctrl(tar[i]->mode);
-burn_print(1,"track %d control %d\n", tar[i]->mode, e[3+i].control);
- add_cue(sheet, ctladr | 1, i+1, 1, form, 0, runtime);
+ burn_print(1, "track %d control %d\n", tar[i]->mode,
+ e[3 + i].control);
+ add_cue(sheet, ctladr | 1, i + 1, 1, form, 0, runtime);
runtime +=3D burn_track_get_sectors(tar[i]);
/* if we're padding, we'll clear any current shortage.
if we're not, we'll slip toc entries by a sector every time our
@@ -214,13 +215,11 @@ XXX this is untested :)
e[2].pmin =3D m;
e[2].psec =3D s;
e[2].pframe =3D f;
-burn_print(1, "run time is %d (%d:%d:%d)\n", runtime, m, s, f);
+ burn_print(1, "run time is %d (%d:%d:%d)\n", runtime, m, s, f);
for (i =3D 0; i < d->toc_entries; i++)
- burn_print(1, "point %d (%02d:%02d:%02d)\n"
- , d->toc_entry[i].point
- , d->toc_entry[i].pmin
- , d->toc_entry[i].psec
- , d->toc_entry[i].pframe);
+ burn_print(1, "point %d (%02d:%02d:%02d)\n",
+ d->toc_entry[i].point, d->toc_entry[i].pmin,
+ d->toc_entry[i].psec, d->toc_entry[i].pframe);
add_cue(sheet, ctladr | 1, 0xAA, 1, 1, 0, runtime);
return sheet;
}
@@ -241,32 +240,30 @@ int burn_subcode_length(int tracktype)
{
if (tracktype & BURN_SUBCODE_P16)
return 16;
- if ((tracktype & BURN_SUBCODE_P96) ||
- (tracktype & BURN_SUBCODE_R96))
+ if ((tracktype & BURN_SUBCODE_P96) || (tracktype & BURN_SUBCODE_R96))
return 96;
return 0;
}
=20
void burn_write_leadin(struct burn_write_opts *o,
- struct burn_session *s,
- int first)
+ struct burn_session *s, int first)
{
struct burn_drive *d =3D o->drive;
int count;
-=09
+
d->busy =3D BURN_DRIVE_WRITING_LEADIN;
=20
- burn_print(5, first?" first leadin\n":" leadin\n");
+ burn_print(5, first ? " first leadin\n" : " leadin\n");
=20
if (first)
count =3D 0 - d->alba - 150;
else
count =3D 4500;
-=09
+
d->progress.start_sector =3D d->alba;
d->progress.sectors =3D count;
d->progress.current_sector =3D 0;
-=09
+
while (count !=3D 0) {
sector_toc(o, s->track[0]->mode);
count--;
@@ -276,8 +273,7 @@ void burn_write_leadin(struct burn_write
}
=20
void burn_write_leadout(struct burn_write_opts *o,
- int first, unsigned char control,
- int mode)
+ int first, unsigned char control, int mode)
{
struct burn_drive *d =3D o->drive;
int count;
@@ -285,7 +281,7 @@ void burn_write_leadout(struct burn_writ
d->busy =3D BURN_DRIVE_WRITING_LEADOUT;
/* XXX pass the lead out mode? */
d->rlba =3D -150;
- burn_print(5, first?" first leadout\n":" leadout\n");
+ burn_print(5, first ? " first leadout\n" : " leadout\n");
if (first)
count =3D 6750;
else
@@ -293,7 +289,7 @@ void burn_write_leadout(struct burn_writ
d->progress.start_sector =3D d->alba;
d->progress.sectors =3D count;
d->progress.current_sector =3D 0;
-=09
+
while (count !=3D 0) {
sector_lout(o, control, mode);
count--;
@@ -302,8 +298,7 @@ void burn_write_leadout(struct burn_writ
d->busy =3D BURN_DRIVE_WRITING;
}
=20
-void burn_write_session(struct burn_write_opts *o,
- struct burn_session *s)
+void burn_write_session(struct burn_write_opts *o, struct burn_session *s)
{
struct burn_drive *d =3D o->drive;
struct burn_track *prev =3D NULL, *next =3D NULL;
@@ -313,22 +308,25 @@ void burn_write_session(struct burn_writ
burn_print(1, " writing a session\n");
for (i =3D 0; i < s->tracks; i++) {
if (i > 0)
- prev =3D s->track[i-1];
+ prev =3D s->track[i - 1];
if (i + 1 < s->tracks)
- next =3D s->track[i+1];
- else next =3D NULL;
- =09
+ next =3D s->track[i + 1];
+ else
+ next =3D NULL;
+
burn_write_track(o, s, i);
}
}
=20
-void burn_write_track(struct burn_write_opts *o, struct burn_session *s, i=
nt tnum)
+void burn_write_track(struct burn_write_opts *o, struct burn_session *s,
+ int tnum)
{
#warning XXX if track is not an even sector size we barf
struct burn_track *t =3D s->track[tnum];
struct burn_drive *d =3D o->drive;
int i, tmp =3D 0;
int sectors;
+
d->rlba =3D -150;
=20
/* XXX for tao, we don't want the pregaps but still want post? */
@@ -340,18 +338,19 @@ void burn_write_track(struct burn_write_
=20
if (t->pregap1) {
struct burn_track *pt =3D s->track[tnum - 1];
+
if (tnum =3D=3D 0) {
printf("first track should not have a pregap1\n");
pt =3D t;
}
for (i =3D 0; i < 75; i++)
- sector_pregap(o, t->entry->point, pt->entry->control,
- pt->mode);
+ sector_pregap(o, t->entry->point,
+ pt->entry->control, pt->mode);
}
if (t->pregap2)
for (i =3D 0; i < 150; i++)
- sector_pregap(o, t->entry->point, t->entry->control,
- t->mode);
+ sector_pregap(o, t->entry->point,
+ t->entry->control, t->mode);
} else {
o->control =3D t->entry->control;
d->send_write_parameters(d, o);
@@ -359,20 +358,20 @@ void burn_write_track(struct burn_write_
=20
/* user data */
sectors =3D burn_track_get_sectors(t);
-=09
+
/* Update progress */
d->progress.start_sector =3D d->nwa;
d->progress.sectors =3D sectors;
d->progress.current_sector =3D 0;
-=09
-burn_print(12, "track is %d sectors long\n", sectors);
+
+ burn_print(12, "track is %d sectors long\n", sectors);
=20
if (tnum =3D=3D s->tracks)
tmp =3D sectors > 150 ? 150 : sectors;
=20
for (i =3D 0; i < sectors - tmp; i++) {
sector_data(o, t, 0);
- =09
+
/* update current progress */
d->progress.current_sector++;
}
@@ -387,7 +386,7 @@ burn_print(12, "track is %d sectors long
if (t->postgap)
for (i =3D 0; i < 150; i++)
sector_postgap(o, t->entry->point, t->entry->control,
- t->mode);
+ t->mode);
i =3D t->offset;
if (o->write_type =3D=3D BURN_WRITE_SAO) {
if (d->buffer->bytes) {
@@ -401,8 +400,7 @@ burn_print(12, "track is %d sectors long
burn_write_flush(o);
}
=20
-void burn_disc_write_sync(struct burn_write_opts *o,
- struct burn_disc *disc)
+void burn_disc_write_sync(struct burn_write_opts *o, struct burn_disc *dis=
c)
{
struct cue_sheet *sheet;
struct burn_drive *d =3D o->drive;
@@ -416,7 +414,7 @@ void burn_disc_write_sync(struct burn_wr
burn_print(1, "sync write of %d sessions\n", disc->sessions);
d->buffer =3D &buf;
memset(d->buffer, 0, sizeof(struct buffer));
-=09
+
d->rlba =3D -150;
=20
d->toc_temp =3D 9;
@@ -466,25 +464,24 @@ return crap. so we send the command, th
if (first) {
d->nwa =3D -150;
d->alba =3D -150;
- }
- else {
+ } else {
d->nwa +=3D 4500;
d->alba +=3D 4500;
}
}
burn_write_session(o, disc->session[i]);
- lt =3D disc->session[i]->track[disc->session[i]->tracks-1];
+ lt =3D disc->session[i]->track[disc->session[i]->tracks - 1];
if (o->write_type =3D=3D BURN_WRITE_RAW) {
burn_write_leadout(o, first, lt->entry->control,
- lt->mode);
+ lt->mode);
} else {
burn_write_flush(o);
- d->nwa +=3D first?6750:2250;
- d->alba +=3D first?6750:2250;
+ d->nwa +=3D first ? 6750 : 2250;
+ d->alba +=3D first ? 6750 : 2250;
}
if (first)
first =3D 0;
- =09
+
/* XXX: currently signs an end of session */
d->progress.current_sector =3D 0;
d->progress.start_sector =3D 0;
Index: libburn/write.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libburn/write.h,v
retrieving revision 1.15
diff -p -u -r1.15 write.h
--- a/libburn/write.h 7 Feb 2004 04:40:36 -0000 1.15
+++ b/libburn/write.h 24 Feb 2004 18:31:08 -0000
@@ -4,20 +4,17 @@
#define BURN__WRITE_H
=20
struct cue_sheet *burn_create_toc_entries(struct burn_write_opts *o,
- struct burn_session *session);
+ struct burn_session *session);
int burn_sector_length(int trackmode);
int burn_subcode_length(int trackmode);
-void burn_disc_write_sync(struct burn_write_opts *o,
- struct burn_disc *disc);
+void burn_disc_write_sync(struct burn_write_opts *o, struct burn_disc *dis=
c);
void burn_write_leadin(struct burn_write_opts *o,
- struct burn_session *s,
- int first);
+ struct burn_session *s, int first);
void burn_write_leadout(struct burn_write_opts *o,
- int first, unsigned char control,
- int mode);
-void burn_write_session(struct burn_write_opts *o,
- struct burn_session *s);
-void burn_write_track(struct burn_write_opts *o, struct burn_session *s, i=
nt tnum);
+ int first, unsigned char control, int mode);
+void burn_write_session(struct burn_write_opts *o, struct burn_session *s);
+void burn_write_track(struct burn_write_opts *o, struct burn_session *s,
+ int tnum);
void burn_write_flush(struct burn_write_opts *o);
=20
#endif /* BURN__WRITE_H */
Index: libisofs/errors.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libisofs/errors.c,v
retrieving revision 1.1
diff -p -u -r1.1 errors.c
--- a/libisofs/errors.c 27 Nov 2003 16:55:21 -0000 1.1
+++ b/libisofs/errors.c 24 Feb 2004 18:31:08 -0000
@@ -3,14 +3,12 @@
#include "errors.h"
#include <stdio.h>
=20
-void
-iso_warn (enum iso_warnings w)
+void iso_warn(enum iso_warnings w)
{
- printf ("WARNING: %u\n", w);
+ printf("WARNING: %u\n", w);
}
=20
-void
-iso_error (enum iso_errors e)
+void iso_error(enum iso_errors e)
{
- printf ("ERROR: %u\n", e);
+ printf("ERROR: %u\n", e);
}
Index: libisofs/errors.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libisofs/errors.h,v
retrieving revision 1.1
diff -p -u -r1.1 errors.h
--- a/libisofs/errors.h 27 Nov 2003 16:55:21 -0000 1.1
+++ b/libisofs/errors.h 24 Feb 2004 18:31:08 -0000
@@ -5,16 +5,15 @@
=20
enum iso_warnings
{
- ISO_WARNING_FOO
+ ISO_WARNING_FOO
};
=20
-
enum iso_errors
{
- ISO_ERROR_FOO
+ ISO_ERROR_FOO
};
=20
-void iso_warn (enum iso_warnings w);
-void iso_error (enum iso_errors e);
+void iso_warn(enum iso_warnings w);
+void iso_error(enum iso_errors e);
=20
#endif /* __ERRORS */
Index: libisofs/tree.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libisofs/tree.c,v
retrieving revision 1.6
diff -p -u -r1.6 tree.c
--- a/libisofs/tree.c 10 Dec 2003 05:45:26 -0000 1.6
+++ b/libisofs/tree.c 24 Feb 2004 18:31:08 -0000
@@ -11,8 +11,7 @@
#include <unistd.h>
#include <stdlib.h>
=20
-static void
-iso_tree_free_r (struct iso_tree_dir *dir)
+static void iso_tree_free_r(struct iso_tree_dir *dir)
{
struct iso_tree_file *f;
struct iso_tree_dir *d;
@@ -20,95 +19,98 @@ iso_tree_free_r (struct iso_tree_dir *di
=20
for (i =3D 0; i < dir->nfiles; ++i) {
f =3D &dir->files[i];
- free (f->path);
- free (f->fullname);
- free (f->name);
- free (f->extension);
- free (f->isoname1);
- free (f->isoname2);
- free (f->jolietname);
- free (f->rrname);
- free (f->me);
+ free(f->path);
+ free(f->fullname);
+ free(f->name);
+ free(f->extension);
+ free(f->isoname1);
+ free(f->isoname2);
+ free(f->jolietname);
+ free(f->rrname);
+ free(f->me);
}
- free (dir->fullname);
- free (dir->isoname1);
- free (dir->isoname2);
- free (dir->jolietname);
- free (dir->rrname);
- free (dir->me);
+ free(dir->fullname);
+ free(dir->isoname1);
+ free(dir->isoname2);
+ free(dir->jolietname);
+ free(dir->rrname);
+ free(dir->me);
=20
for (i =3D 0; i < dir->nchildren; ++i) {
d =3D &dir->children[i];
- iso_tree_free_r (d);
+ iso_tree_free_r(d);
}
=20
- free (dir->children);
- free (dir->files);
+ free(dir->children);
+ free(dir->files);
}
=20
-void
-iso_tree_free (struct iso_tree_dir **root)
+void iso_tree_free(struct iso_tree_dir **root)
{
if (root && *root) {
struct iso_tree_dir *d =3D *root;
- iso_tree_free_r (d);
+
+ iso_tree_free_r(d);
free(d);
}
}
=20
-struct iso_tree_dir**
-iso_tree_new_root (struct iso_volumeset *volset)
+struct iso_tree_dir **iso_tree_new_root(struct iso_volumeset *volset)
{
struct iso_tree_dir *d;
=20
- d =3D calloc (1, sizeof (struct iso_tree_dir));
+ d =3D calloc(1, sizeof(struct iso_tree_dir));
/* initialize stuff? all zero's for now. */
- d->me =3D malloc (sizeof (struct iso_tree_dir*));
+ d->me =3D malloc(sizeof(struct iso_tree_dir *));
*d->me =3D d;
d->volset =3D volset;
return d->me;
}
=20
-struct iso_tree_dir**
-iso_tree_add_dir (struct iso_tree_dir **dparent,
- const char *name,
- int volume)
+struct iso_tree_dir **iso_tree_add_dir(struct iso_tree_dir **dparent,
+ const char *name, int volume)
{
struct iso_tree_dir *parent;
struct iso_tree_dir *d;
- int i;
+ int i, j;
=20
- if (!(dparent && *dparent && name)) return NULL;
+ if (!(dparent && *dparent && name))
+ return NULL;
=20
parent =3D *dparent;
parent->nchildren++;
- parent->children =3D realloc (parent->children,
- sizeof (struct iso_tree_dir) *
- parent->nchildren);
+ parent->children =3D realloc(parent->children,
+ sizeof(struct iso_tree_dir) *
+ parent->nchildren);
d =3D &parent->children[parent->nchildren - 1];
- memset (d, 0, sizeof (struct iso_tree_dir));
+ memset(d, 0, sizeof(struct iso_tree_dir));
=20
- if (!iso_tree_dir_set_name (&d, name)) {
+ if (!iso_tree_dir_set_name(&d, name)) {
/* we don't unalloc the end of the array but that's ok :> */
- parent->children--;
+ parent->nchildren--;
d =3D NULL;
} else {
d->volume =3D volume;
d->parent =3D parent;
- d->me =3D malloc (sizeof (struct iso_tree_dir*));
+ d->me =3D malloc(sizeof(struct iso_tree_dir *));
d->volset =3D parent->volset;
}
=20
- for (i =3D 0; i < parent->nchildren; ++i)
+ /* since 'parent->children' was set to a new memory location, fix the
+ 'parent' references */
+ for (i =3D 0; i < parent->nchildren; ++i) {
*parent->children[i].me =3D &parent->children[i];
+ for (j =3D 0; j < parent->children[i].nchildren; ++j) {
+ parent->children[i].children[j].parent =3D
+ &parent->children[i];
+ }
+ }
=20
return d->me;
}
=20
-struct iso_tree_file**
-iso_tree_add_file (struct iso_tree_dir **dparent,
- const char *path,
- int volume)
+struct iso_tree_file **iso_tree_add_file(struct iso_tree_dir **dparent,
+ const char *path, int volume)
{
struct iso_tree_file *f;
struct stat st;
@@ -116,33 +118,36 @@ iso_tree_add_file (struct iso_tree_dir *
struct iso_tree_dir *parent;
int i;
=20
- if (!(dparent && *dparent && path)) return NULL;
- if (path[0] !=3D '/') return NULL;
-
- if (stat (path, &st) < 0) return NULL;
- if (!S_ISREG(st.st_mode)) return NULL;
+ if (!(dparent && *dparent && path))
+ return NULL;
+ if (path[0] !=3D '/')
+ return NULL;
+
+ if (stat(path, &st) < 0)
+ return NULL;
+ if (!S_ISREG(st.st_mode))
+ return NULL;
=20
parent =3D *dparent;
parent->nfiles++;
- parent->files =3D realloc (parent->files,
- sizeof (struct iso_tree_file) *
- parent->nfiles);
+ parent->files =3D realloc(parent->files,
+ sizeof(struct iso_tree_file) * parent->nfiles);
f =3D &parent->files[parent->nfiles - 1];
- memset (f, 0, sizeof (struct iso_tree_file));
+ memset(f, 0, sizeof(struct iso_tree_file));
=20
- r =3D strrchr (path, '/');
- assert (r);
+ r =3D strrchr(path, '/');
+ assert(r);
=20
- if (!iso_tree_file_set_name (&f, r + 1)) {
+ if (!iso_tree_file_set_name(&f, r + 1)) {
/* we don't unalloc the end of the array but that's ok :> */
- parent->nfiles --;
+ parent->nfiles--;
f =3D NULL;
} else {
f->volume =3D volume;
- f->path =3D strdup (path);
+ f->path =3D strdup(path);
f->version =3D 1;
f->size =3D st.st_size;
- f->me =3D malloc (sizeof (struct iso_tree_file*));
+ f->me =3D malloc(sizeof(struct iso_tree_file *));
*f->me =3D f;
f->volset =3D parent->volset;
}
@@ -153,12 +158,13 @@ iso_tree_add_file (struct iso_tree_dir *
return f->me;
}
=20
-const char* iso_tree_file_get_name (struct iso_tree_file **dfile,
- enum iso_file_name_version ver)
+const char *iso_tree_file_get_name(struct iso_tree_file **dfile,
+ enum iso_file_name_version ver)
{
struct iso_tree_file *file;
=20
- if (!(dfile && *dfile)) return NULL;
+ if (!(dfile && *dfile))
+ return NULL;
=20
file =3D *dfile;
=20
@@ -172,7 +178,7 @@ const char* iso_tree_file_get_name (stru
case 2:
return file->isoname2;
default:
- assert (0);
+ assert(0);
}
break;
case ISO_FILE_NAME_JOLIET:
@@ -183,42 +189,41 @@ const char* iso_tree_file_get_name (stru
return NULL;
}
=20
-char* get_iso_name_1(const char *name, const char *ext)
+char *get_iso_name_1(const char *name, const char *ext)
{
char *out =3D NULL;
char *n, *e;
=20
/* XXX avoid duplicates */
- n =3D iso_d_strndup (name, 8);
- e =3D iso_d_strndup (ext, 3);
- if (strlen (n) || strlen (e))
- out =3D iso_strconcat ('.', n, e);
+ n =3D iso_d_strndup(name, 8);
+ e =3D iso_d_strndup(ext, 3);
+ if (strlen(n) || strlen(e))
+ out =3D iso_strconcat('.', n, e);
=20
- free (n);
- free (e);
+ free(n);
+ free(e);
return out;
}
=20
-char* get_iso_name_2(const char *name, const char *ext)
+char *get_iso_name_2(const char *name, const char *ext)
{
char *out =3D NULL;
char *n, *e;
int nl;
=20
/* XXX avoid duplicates */
- n =3D iso_d_strndup (name, 30);
- nl =3D strlen (n);
- e =3D iso_d_strndup (ext, 30 - nl);
- if (nl || strlen (e))
- out =3D iso_strconcat ('.', n, e);
+ n =3D iso_d_strndup(name, 30);
+ nl =3D strlen(n);
+ e =3D iso_d_strndup(ext, 30 - nl);
+ if (nl || strlen(e))
+ out =3D iso_strconcat('.', n, e);
=20
- free (n);
- free (e);
+ free(n);
+ free(e);
return out;
}
=20
-int iso_tree_file_set_name (struct iso_tree_file **dfile,
- const char *fullname)
+int iso_tree_file_set_name(struct iso_tree_file **dfile, const char *fulln=
ame)
{
int ret =3D 0;
char *name =3D NULL, *ext;
@@ -226,36 +231,38 @@ int iso_tree_file_set_name (struct iso_t
char *jolietname =3D NULL, *rrname =3D NULL;
struct iso_tree_file *file;
=20
- if (!(dfile && *dfile)) return ret;
- if (!fullname) return ret;
+ if (!(dfile && *dfile))
+ return ret;
+ if (!fullname)
+ return ret;
=20
file =3D *dfile;
=20
- name =3D strdup (fullname);
- iso_split_filename (name, &ext);
+ name =3D strdup(fullname);
+ iso_split_filename(name, &ext);
=20
- if (!(strlen (name) || strlen (ext)))
+ if (!(strlen(name) || strlen(ext)))
goto set_name_done;
=20
- isoname1 =3D get_iso_name_1 (name, ext);
+ isoname1 =3D get_iso_name_1(name, ext);
if (!isoname1)
goto set_name_fail;
- isoname2 =3D get_iso_name_2 (name, ext);
+ isoname2 =3D get_iso_name_2(name, ext);
if (!isoname2)
goto set_name_fail;
ret =3D 1;
=20
- free (file->fullname);
- free (file->name);
- free (file->extension);
- free (file->isoname1);
- free (file->isoname2);
- free (file->jolietname);
- free (file->rrname);
-
- file->fullname =3D strdup (fullname);
- file->name =3D strdup (name);
- file->extension =3D strdup (ext);
+ free(file->fullname);
+ free(file->name);
+ free(file->extension);
+ free(file->isoname1);
+ free(file->isoname2);
+ free(file->jolietname);
+ free(file->rrname);
+
+ file->fullname =3D strdup(fullname);
+ file->name =3D strdup(name);
+ file->extension =3D strdup(ext);
file->isoname1 =3D isoname1;
file->isoname2 =3D isoname2;
file->jolietname =3D jolietname;
@@ -263,24 +270,24 @@ int iso_tree_file_set_name (struct iso_t
=20
goto set_name_done;
=20
-set_name_fail:
- free (isoname1);
- free (isoname2);
- free (jolietname);
- free (rrname);
-set_name_done:
- free (name);
+ set_name_fail:
+ free(isoname1);
+ free(isoname2);
+ free(jolietname);
+ free(rrname);
+ set_name_done:
+ free(name);
=20
return ret;
}
=20
-const char*
-iso_tree_dir_get_name (struct iso_tree_dir **ddir,
- enum iso_file_name_version ver)
+const char *iso_tree_dir_get_name(struct iso_tree_dir **ddir,
+ enum iso_file_name_version ver)
{
struct iso_tree_dir *dir;
=20
- if (!(ddir && *ddir)) return NULL;
+ if (!(ddir && *ddir))
+ return NULL;
=20
dir =3D *ddir;
=20
@@ -294,7 +301,7 @@ iso_tree_dir_get_name (struct iso_tree_d
case 2:
return dir->isoname2;
default:
- assert (0);
+ assert(0);
}
break;
case ISO_FILE_NAME_JOLIET:
@@ -305,72 +312,73 @@ iso_tree_dir_get_name (struct iso_tree_d
return NULL;
}
=20
-int iso_tree_dir_set_name (struct iso_tree_dir **ddir,
- const char *name)
+int iso_tree_dir_set_name(struct iso_tree_dir **ddir, const char *name)
{
int ret =3D 0;
char *isoname1 =3D NULL, *isoname2 =3D NULL;
char *jolietname =3D NULL, *rrname =3D NULL;
struct iso_tree_dir *dir;
=20
- if (!(ddir && *ddir)) return ret;
- if (!name) return ret;
+ if (!(ddir && *ddir))
+ return ret;
+ if (!name)
+ return ret;
=20
dir =3D *ddir;
=20
- isoname1 =3D iso_d_strndup (name, 8);
- isoname2 =3D iso_d_strndup (name, 31);
+ isoname1 =3D iso_d_strndup(name, 8);
+ isoname2 =3D iso_d_strndup(name, 31);
jolietname =3D NULL;
rrname =3D NULL;
=20
- if (strlen (isoname1) && strlen (isoname2)) {
- free (dir->fullname);
- free (dir->isoname1);
- free (dir->isoname2);
- free (dir->jolietname);
- free (dir->rrname);
+ if (strlen(isoname1) && strlen(isoname2)) {
+ free(dir->fullname);
+ free(dir->isoname1);
+ free(dir->isoname2);
+ free(dir->jolietname);
+ free(dir->rrname);
=20
- dir->fullname =3D strdup (name);
+ dir->fullname =3D strdup(name);
dir->isoname1 =3D isoname1;
dir->isoname2 =3D isoname2;
dir->jolietname =3D jolietname;
dir->rrname =3D rrname;
ret =3D 1;
} else {
- free (isoname1);
- free (isoname2);
- free (jolietname);
- free (rrname);
+ free(isoname1);
+ free(isoname2);
+ free(jolietname);
+ free(rrname);
}
return ret;
}
=20
-static int
-fnamecmp (const void *v1, const void *v2)
+static int fnamecmp(const void *v1, const void *v2)
{
- struct iso_tree_file *f1 =3D (struct iso_tree_file*)v1;
- struct iso_tree_file *f2 =3D (struct iso_tree_file*)v2;
- return strcmp (iso_tree_file_get_name (&f1, ISO_FILE_NAME_ISO),
- iso_tree_file_get_name (&f2, ISO_FILE_NAME_ISO));
+ struct iso_tree_file *f1 =3D (struct iso_tree_file *)v1;
+ struct iso_tree_file *f2 =3D (struct iso_tree_file *)v2;
+
+ return strcmp(iso_tree_file_get_name(&f1, ISO_FILE_NAME_ISO),
+ iso_tree_file_get_name(&f2, ISO_FILE_NAME_ISO));
}
=20
-static int
-dnamecmp (const void *v1, const void *v2)
+static int dnamecmp(const void *v1, const void *v2)
{
- struct iso_tree_dir *d1 =3D (struct iso_tree_dir*)v1;
- struct iso_tree_dir *d2 =3D (struct iso_tree_dir*)v2;
- return strcmp (iso_tree_dir_get_name (&d1, ISO_FILE_NAME_ISO),
- iso_tree_dir_get_name (&d2, ISO_FILE_NAME_ISO));
+ struct iso_tree_dir *d1 =3D (struct iso_tree_dir *)v1;
+ struct iso_tree_dir *d2 =3D (struct iso_tree_dir *)v2;
+
+ return strcmp(iso_tree_dir_get_name(&d1, ISO_FILE_NAME_ISO),
+ iso_tree_dir_get_name(&d2, ISO_FILE_NAME_ISO));
}
=20
-void iso_tree_sort (struct iso_tree_dir **root)
+void iso_tree_sort(struct iso_tree_dir **root)
{
int i;
=20
- qsort ((*root)->files, (*root)->nfiles,
- sizeof (struct iso_tree_file), fnamecmp);
- qsort ((*root)->children, (*root)->nchildren,
- sizeof (struct iso_tree_dir), dnamecmp);
+ qsort((*root)->files, (*root)->nfiles,
+ sizeof(struct iso_tree_file), fnamecmp);
+ qsort((*root)->children, (*root)->nchildren,
+ sizeof(struct iso_tree_dir), dnamecmp);
=20
/* update the me pointers */
for (i =3D 0; i < (*root)->nchildren; ++i)
@@ -379,36 +387,34 @@ void iso_tree_sort (struct iso_tree_dir=20
*(*root)->files[i].me =3D &(*root)->files[i];
=20
for (i =3D 0; i < (*root)->nchildren; ++i)
- iso_tree_sort ((*root)->children[i].me);
+ iso_tree_sort((*root)->children[i].me);
}
=20
#include <stdio.h>
-static void
-iso_tree_print_r (struct iso_tree_dir *dir, int spaces)
+static void iso_tree_print_r(struct iso_tree_dir *dir, int spaces)
{
int i, j;
=20
for (i =3D 0; i < spaces; ++i)
- printf (" ");
+ printf(" ");
if (dir->fullname)
- printf ("%s", iso_tree_dir_get_name (&dir, ISO_FILE_NAME_ISO));
- printf ("/\n");
+ printf("%s", iso_tree_dir_get_name(&dir, ISO_FILE_NAME_ISO));
+ printf("/\n");
=20
spaces +=3D 2;
=20
for (j =3D 0; j < dir->nchildren; ++j)
- iso_tree_print_r (&dir->children[j], spaces);
+ iso_tree_print_r(&dir->children[j], spaces);
=20
for (j =3D 0; j < dir->nfiles; ++j) {
for (i =3D 0; i < spaces; ++i)
- printf (" ");
- printf ("%s\n", iso_tree_file_get_name (dir->files[j].me,
- ISO_FILE_NAME_ISO));
+ printf(" ");
+ printf("%s\n", iso_tree_file_get_name(dir->files[j].me,
+ ISO_FILE_NAME_ISO));
}
}
=20
-void
-iso_tree_print (struct iso_tree_dir **root)
+void iso_tree_print(struct iso_tree_dir **root)
{
- iso_tree_print_r (*root, 0);
+ iso_tree_print_r(*root, 0);
}
Index: libisofs/tree.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libisofs/tree.h,v
retrieving revision 1.6
diff -p -u -r1.6 tree.h
--- a/libisofs/tree.h 10 Dec 2003 05:45:26 -0000 1.6
+++ b/libisofs/tree.h 24 Feb 2004 18:31:08 -0000
@@ -9,8 +9,8 @@ struct iso_volumeset;
=20
struct iso_tree_file
{
- /* which volume the file should appear on in the set,
- usually 0 (1st volume) */
+ /* which volume the file should appear on in the set, usually 0 (1st
+ volume) */
int volume;
=20
/* XXX use a libburn_source or iso source? */
@@ -21,7 +21,7 @@ struct iso_tree_file
/* the version of the file (XXX always 1?) */
int version;
=20
- /* these are derived from the fullname */
+ /* these are derived from the fullname */
char *name;
char *extension;
=20
@@ -32,8 +32,7 @@ struct iso_tree_file
char *jolietname;
char *rrname;
=20
- /* the logical block at which the file will be placed
- in the volume */
+ /* the logical block at which the file will be placed in the volume */
int logical_block;
/* the size of the file */
int size;
@@ -44,8 +43,8 @@ struct iso_tree_file
=20
struct iso_tree_dir
{
- /* which volume the file should appear on in the set,
- usually 0 (1st volume) */
+ /* which volume the file should appear on in the set, usually 0 (1st
+ volume) */
int volume;
=20
char *fullname;
@@ -55,11 +54,13 @@ struct iso_tree_dir
char *jolietname;
char *rrname;
=20
- /* the logical block at which the dir will be placed
- in the volume */
+ /* the logical block at which the dir will be placed in the volume */
int logical_block;
- /* XXX not really sure what this is the size of */
+ /* the number of bytes needed to hold the directory record for each
+ file and subdirectory of this directory */
int size;
+ /* the position of the directory in the path table */
+ short position;
=20
struct iso_tree_dir *parent;
=20
@@ -72,9 +73,9 @@ struct iso_tree_dir
struct iso_volumeset *volset;
};
=20
-struct iso_tree_dir** iso_tree_new_root (struct iso_volumeset *volset);
-void iso_tree_free (struct iso_tree_dir **root);
+struct iso_tree_dir **iso_tree_new_root(struct iso_volumeset *volset);
+void iso_tree_free(struct iso_tree_dir **root);
=20
-void iso_tree_sort (struct iso_tree_dir **root);
+void iso_tree_sort(struct iso_tree_dir **root);
=20
#endif /* __TREE */
Index: libisofs/util.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libisofs/util.c,v
retrieving revision 1.3
diff -p -u -r1.3 util.c
--- a/libisofs/util.c 10 Feb 2004 12:45:20 -0000 1.3
+++ b/libisofs/util.c 24 Feb 2004 18:31:08 -0000
@@ -10,31 +10,28 @@
static int valid_a_char(char c);
static int valid_d_char(char c);
=20
-int
-valid_a_char(char c)
+int valid_a_char(char c)
{
return ((c >=3D ' ' && c <=3D '"') ||
(c >=3D '%' && c <=3D '?') ||
- (c >=3D 'A' && c <=3D 'Z') ||
- (c =3D=3D '_'));
+ (c >=3D 'A' && c <=3D 'Z') || (c =3D=3D '_'));
}
=20
int valid_d_char(char c)
{
return ((c >=3D '0' && c <=3D '9') ||
- (c >=3D 'A' && c <=3D 'Z') ||
- (c =3D=3D '_'));
+ (c >=3D 'A' && c <=3D 'Z') || (c =3D=3D '_'));
}
=20
-void
-iso_a_strcpy(unsigned char *dest, int size, const char *src)
+void iso_a_strcpy(unsigned char *dest, int size, const char *src)
{
int i =3D 0, d =3D 0;
=20
if (src)
for (; i < size && *src; ++i, ++src) {
- char s =3D toupper (*src);
- if (valid_a_char (s))
+ char s =3D toupper(*src);
+
+ if (valid_a_char(s))
dest[d++] =3D s;
else
dest[d++] =3D '_';
@@ -45,15 +42,15 @@ iso_a_strcpy(unsigned char *dest, int si
}
}
=20
-void
-iso_d_strcpy(unsigned char *dest, int size, const char *src)
+void iso_d_strcpy(unsigned char *dest, int size, const char *src)
{
int i =3D 0, d =3D 0;
=20
if (src)
for (; i < size && *src; ++i, ++src) {
- char s =3D toupper (*src);
- if (valid_d_char (s))
+ char s =3D toupper(*src);
+
+ if (valid_d_char(s))
dest[d++] =3D s;
else
dest[d++] =3D '_';
@@ -61,110 +58,106 @@ iso_d_strcpy(unsigned char *dest, int si
for (; i < size; ++i) {
/* pad with spaces */
dest[d++] =3D ' ';
- } =20
+ }
}
=20
-char*
-iso_a_strndup(const char *src, int size)
+char *iso_a_strndup(const char *src, int size)
{
int i, d;
char *out;
=20
out =3D malloc(size + 1);
for (i =3D d =3D 0; i < size && *src; ++i, ++src) {
- char s =3D toupper (*src);
- if (valid_a_char (s))
+ char s =3D toupper(*src);
+
+ if (valid_a_char(s))
out[d++] =3D s;
else
out[d++] =3D '_';
}
out[d++] =3D '\0';
- out =3D realloc (out, d); /* shrink the buffer to what we used */
+ out =3D realloc(out, d); /* shrink the buffer to what we used */
return out;
}
=20
-char*
-iso_d_strndup(const char *src, int size)
+char *iso_d_strndup(const char *src, int size)
{
int i, d;
char *out;
=20
out =3D malloc(size + 1);
for (i =3D d =3D 0; i < size && *src; ++i, ++src) {
- char s =3D toupper (*src);
- if (valid_d_char (s))
+ char s =3D toupper(*src);
+
+ if (valid_d_char(s))
out[d++] =3D s;
else
out[d++] =3D '_';
}
out[d++] =3D '\0';
- out =3D realloc (out, d); /* shrink the buffer to what we used */
+ out =3D realloc(out, d); /* shrink the buffer to what we used */
return out;
}
=20
-char* iso_strconcat(char sep, const char *a, const char *b)
+char *iso_strconcat(char sep, const char *a, const char *b)
{
char *out;
int la, lb;
=20
la =3D strlen(a);
lb =3D strlen(b);
- out =3D malloc (la + lb + 1 + (sep ? 1 : 0));
- memcpy (out, a, la);
- memcpy (out + la + (sep ? 1 : 0), b, lb);
- if (sep) out[la] =3D sep;
- out[la + lb + (sep ? 1 : 0)] =3D '\0';=09
+ out =3D malloc(la + lb + 1 + (sep ? 1 : 0));
+ memcpy(out, a, la);
+ memcpy(out + la + (sep ? 1 : 0), b, lb);
+ if (sep)
+ out[la] =3D sep;
+ out[la + lb + (sep ? 1 : 0)] =3D '\0';
return out;
}
=20
-char*
-iso_strdup(const char *src)
+char *iso_strdup(const char *src)
{
- return src ? strdup (src) : NULL;
+ return src ? strdup(src) : NULL;
}
=20
-void
-iso_lsb(unsigned char *buf, int num, int bytes)
+void iso_lsb(unsigned char *buf, int num, int bytes)
{
int i;
=20
- assert (bytes <=3D sizeof (int));
+ assert(bytes <=3D sizeof(int));
=20
for (i =3D 0; i < bytes; ++i)
- buf[i] =3D num << (sizeof (int)-1-i) >> (sizeof (int) - 1) << i;
+ buf[i] =3D (num >> (8 * i)) & 0xff;
}
=20
-void
-iso_msb(unsigned char *buf, int num, int bytes)
+void iso_msb(unsigned char *buf, int num, int bytes)
{
int i;
=20
- assert (bytes <=3D sizeof (int));
+ assert(bytes <=3D sizeof(int));
=20
for (i =3D 0; i < bytes; ++i)
buf[bytes - 1 - i] =3D (num >> (8 * i)) & 0xff;
}
=20
-void
-iso_bb(unsigned char *buf, int num, int bytes)
+void iso_bb(unsigned char *buf, int num, int bytes)
{
int i;
-=09
- assert (bytes <=3D sizeof (int));
-=09
+
+ assert(bytes <=3D sizeof(int));
+
for (i =3D 0; i < bytes; ++i)
buf[i] =3D buf[2 * bytes - 1 - i] =3D (num >> (8 * i)) & 0xff;
}
=20
-void
-iso_datetime_7(unsigned char *buf, time_t t)
+void iso_datetime_7(unsigned char *buf, time_t t)
{
static int tzsetup =3D 0;
static int tzoffset;
struct tm tm;
=20
if (!tzsetup) {
- tzset ();
+ tzset();
=20
tzoffset =3D -timezone / 60 / 15;
if (tzoffset < -48)
@@ -173,7 +166,7 @@ iso_datetime_7(unsigned char *buf, time_
tzsetup =3D 1;
}
=20
- localtime_r (&t, &tm);
+ localtime_r(&t, &tm);
=20
buf[0] =3D tm.tm_year;
buf[1] =3D tm.tm_mon + 1;
@@ -184,21 +177,20 @@ iso_datetime_7(unsigned char *buf, time_
buf[6] =3D tzoffset;
}
=20
-void
-iso_datetime_17(unsigned char *buf, time_t t)
+void iso_datetime_17(unsigned char *buf, time_t t)
{
static int tzsetup =3D 0;
static int tzoffset;
struct tm tm;
char c[5];
=20
- if (t =3D=3D (time_t) -1) {
+ if (t =3D=3D (time_t) - 1) {
/* unspecified time */
- memset (buf, '0', 16);
+ memset(buf, '0', 16);
buf[16] =3D 0;
} else {
if (!tzsetup) {
- tzset ();
+ tzset();
=20
tzoffset =3D -timezone / 60 / 15;
if (tzoffset < -48)
@@ -207,39 +199,38 @@ iso_datetime_17(unsigned char *buf, time
tzsetup =3D 1;
}
=20
- localtime_r (&t, &tm);
+ localtime_r(&t, &tm);
=20
/* year */
- sprintf (c, "%04d", tm.tm_year + 1900);
- memcpy (&buf[0], c, 4);
+ sprintf(c, "%04d", tm.tm_year + 1900);
+ memcpy(&buf[0], c, 4);
/* month */
- sprintf (c, "%02d", tm.tm_mon + 1);
- memcpy (&buf[4], c, 2);
+ sprintf(c, "%02d", tm.tm_mon + 1);
+ memcpy(&buf[4], c, 2);
/* day */
- sprintf (c, "%02d", tm.tm_mday);
- memcpy (&buf[6], c, 2);
+ sprintf(c, "%02d", tm.tm_mday);
+ memcpy(&buf[6], c, 2);
/* hour */
- sprintf (c, "%02d", tm.tm_hour);
- memcpy (&buf[8], c, 2);
+ sprintf(c, "%02d", tm.tm_hour);
+ memcpy(&buf[8], c, 2);
/* minute */
- sprintf (c, "%02d", tm.tm_min);
- memcpy (&buf[10], c, 2);
+ sprintf(c, "%02d", tm.tm_min);
+ memcpy(&buf[10], c, 2);
/* second */
- sprintf (c, "%02d", MIN (59, tm.tm_sec));
- memcpy (&buf[12], c, 2);
+ sprintf(c, "%02d", MIN(59, tm.tm_sec));
+ memcpy(&buf[12], c, 2);
/* hundreths */
- memcpy (&buf[14], "00", 2);
+ memcpy(&buf[14], "00", 2);
/* timezone */
buf[16] =3D tzoffset;
}
}
=20
-void
-iso_split_filename(char *name, char **ext)
+void iso_split_filename(char *name, char **ext)
{
char *r;
=20
- r =3D strrchr (name, '.');
+ r =3D strrchr(name, '.');
if (r) {
*r =3D '\0';
*ext =3D r + 1;
@@ -247,32 +238,31 @@ iso_split_filename(char *name, char **ex
*ext =3D "";
}
=20
-void
-iso_filecpy (unsigned char *buf, int size, const char *name, int version)
+void iso_filecpy(unsigned char *buf, int size, const char *name, int versi=
on)
{
char v[6];
int nl, vl;
=20
- assert (version >=3D 0);
- assert (version < 0x8000);
+ assert(version >=3D 0);
+ assert(version < 0x8000);
=20
- nl =3D strlen (name);
+ nl =3D strlen(name);
=20
- memcpy (buf, name, nl);
+ memcpy(buf, name, nl);
=20
if (!version)
- assert (size >=3D strlen (name));
+ assert(size >=3D strlen(name));
else {
- sprintf (v, "%d", version);
- vl =3D strlen (v);
- assert (size >=3D nl + vl + 1);
+ sprintf(v, "%d", version);
+ vl =3D strlen(v);
+ assert(size >=3D nl + vl + 1);
=20
buf[nl] =3D ';';
- memcpy (&buf[nl + 1], v, vl);
+ memcpy(&buf[nl + 1], v, vl);
=20
nl +=3D vl + 1;
}
/* pad with spaces */
if (nl < size)
- memset (&buf[nl], ' ', size - nl);
+ memset(&buf[nl], ' ', size - nl);
}
Index: libisofs/util.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libisofs/util.h,v
retrieving revision 1.3
diff -p -u -r1.3 util.h
--- a/libisofs/util.h 3 Dec 2003 20:01:58 -0000 1.3
+++ b/libisofs/util.h 24 Feb 2004 18:31:08 -0000
@@ -10,25 +10,23 @@
=20
/** Copy a string of a-characters, padding the unused part of the
destination buffer */
-void iso_a_strcpy(unsigned char *dest, int size,
- const char *src);
+void iso_a_strcpy(unsigned char *dest, int size, const char *src);
=20
/** Copy a string of d-characters, padding the unused part of the
destination buffer */
-void iso_d_strcpy(unsigned char *dest, int size,
- const char *src);
+void iso_d_strcpy(unsigned char *dest, int size, const char *src);
=20
/** Returns a null terminated string containing the first 'size' a-charact=
ers
from the source */
-char* iso_a_strndup(const char *src, int size);
+char *iso_a_strndup(const char *src, int size);
=20
/** Returns a null terminated string containing the first 'size' d-charact=
ers
from the source */
-char* iso_d_strndup(const char *src, int size);
+char *iso_d_strndup(const char *src, int size);
=20
-char* iso_strconcat(char sep, const char *a, const char *b);
+char *iso_strconcat(char sep, const char *a, const char *b);
=20
-char* iso_strdup(const char *src);
+char *iso_strdup(const char *src);
=20
void iso_lsb(unsigned char *buf, int num, int bytes);
void iso_msb(unsigned char *buf, int num, int bytes);
@@ -36,6 +34,7 @@ void iso_bb(unsigned char *buf, int num,
=20
/** Records the date/time into a 7 byte buffer (9.1.5) */
void iso_datetime_7(unsigned char *buf, time_t t);
+
/** Records the date/time into a 17 byte buffer (8.4.26.1) */
void iso_datetime_17(unsigned char *buf, time_t t);
=20
@@ -43,6 +42,6 @@ void iso_datetime_17(unsigned char *buf,
returned extension should _not_ be freed! */
void iso_split_filename(char *name, char **ext);
=20
-void iso_filecpy (unsigned char *buf, int size, const char *name, int vers=
ion);
+void iso_filecpy(unsigned char *buf, int size, const char *name, int versi=
on);
=20
#endif /* __UTIL */
Index: libisofs/volume.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libisofs/volume.c,v
retrieving revision 1.5
diff -p -u -r1.5 volume.c
--- a/libisofs/volume.c 10 Dec 2003 05:45:26 -0000 1.5
+++ b/libisofs/volume.c 24 Feb 2004 18:31:08 -0000
@@ -6,106 +6,100 @@
#include <stdlib.h>
#include <string.h>
=20
-struct iso_volumeset*
-iso_volumeset_new (int volumeset_size,
- const char *volumeset_id,
- char *const*volume_id,
- const char *publisher_id,
- const char *data_preparer_id,
- time_t *expiration_time,
- time_t *effective_time)
+struct iso_volumeset *iso_volumeset_new(int volumeset_size,
+ const char *volumeset_id,
+ char *const *volume_id,
+ const char *publisher_id,
+ const char *data_preparer_id,
+ time_t * expiration_time,
+ time_t * effective_time)
{
struct iso_volumeset *volset;
int i;
=20
- if (volumeset_size < 1) return NULL;
+ if (volumeset_size < 1)
+ return NULL;
=20
- volset =3D calloc (1, sizeof (struct iso_volumeset));
+ volset =3D calloc(1, sizeof(struct iso_volumeset));
volset->refcount =3D 1;
=20
- volset->root =3D iso_tree_new_root (volset);
+ volset->root =3D iso_tree_new_root(volset);
=20
- volset->volumeset_id =3D iso_strdup (volumeset_id);
+ volset->volumeset_id =3D iso_strdup(volumeset_id);
volset->volumeset_size =3D volumeset_size;
- volset->publisher_id =3D iso_strdup (publisher_id);
- volset->data_preparer_id =3D iso_strdup (data_preparer_id);
+ volset->publisher_id =3D iso_strdup(publisher_id);
+ volset->data_preparer_id =3D iso_strdup(data_preparer_id);
=20
if (!expiration_time)
- volset->expiration_time =3D (time_t) -1;
+ volset->expiration_time =3D (time_t) - 1;
else
volset->expiration_time =3D *expiration_time;
if (!effective_time)
- volset->effective_time =3D (time_t) -1;
+ volset->effective_time =3D (time_t) - 1;
else
volset->effective_time =3D *effective_time;
=20
- volset->volume_id =3D malloc (sizeof (char*) * volumeset_size);
+ volset->volume_id =3D malloc(sizeof(char *) * volumeset_size);
=20
for (i =3D 0; i < volumeset_size; ++i) {
volset->volume_id[i] =3D
- volume_id ? iso_strdup (volume_id[i]) : NULL;
+ volume_id ? iso_strdup(volume_id[i]) : NULL;
}
=20
- /* default option values. these are pretty lenient :)=20
- but its up to the app anyways */
+ /* default option values. these are pretty lenient :) but its up to
+ the app anyways */
volset->options.iso_level =3D 2;
volset->options.joliet =3D 1;
=20
return volset;
}
=20
-void
-iso_volumeset_free (struct iso_volumeset *volset)
+void iso_volumeset_free(struct iso_volumeset *volset)
{
if (--volset->refcount < 1) {
int i;
=20
- iso_tree_free (volset->root);
+ iso_tree_free(volset->root);
=20
- free (volset->volumeset_id);
- free (volset->publisher_id);
- free (volset->data_preparer_id);
- free (volset->copyright_file);
- free (volset->abstract_file);
- free (volset->bibliographic_file);
+ free(volset->volumeset_id);
+ free(volset->publisher_id);
+ free(volset->data_preparer_id);
+ free(volset->copyright_file);
+ free(volset->abstract_file);
+ free(volset->bibliographic_file);
=20
for (i =3D 0; i < volset->volumeset_size; ++i)
- free (volset->volume_id[i]);
- free (volset->volume_id);
+ free(volset->volume_id[i]);
+ free(volset->volume_id);
=20
- free (volset->data_sectors);
+ free(volset->data_sectors);
=20
- free (volset);
+ free(volset);
}
}
=20
-struct iso_tree_dir**
-iso_volumeset_get_root (struct iso_volumeset *volumeset)
+struct iso_tree_dir **iso_volumeset_get_root(struct iso_volumeset *volumes=
et)
{
return volumeset->root;
}
=20
-int
-iso_volumeset_get_iso_level (struct iso_volumeset *volumeset)
+int iso_volumeset_get_iso_level(struct iso_volumeset *volumeset)
{
return volumeset->options.iso_level;
}
=20
-void
-iso_volumeset_set_iso_level (struct iso_volumeset *volumeset, int level)
+void iso_volumeset_set_iso_level(struct iso_volumeset *volumeset, int leve=
l)
{
if (level =3D=3D 1 || level =3D=3D 2)
volumeset->options.iso_level =3D level;
}
=20
-int
-iso_volumeset_get_joliet (struct iso_volumeset *volumeset)
+int iso_volumeset_get_joliet(struct iso_volumeset *volumeset)
{
- return volumeset->options.joliet;
+ return volumeset->options.joliet;
}
=20
-void
-iso_volumeset_set_joliet (struct iso_volumeset *volumeset, int joliet)
+void iso_volumeset_set_joliet(struct iso_volumeset *volumeset, int joliet)
{
- volumeset->options.joliet =3D !!joliet;
+ volumeset->options.joliet =3D !!joliet;
}
Index: libisofs/volume.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libisofs/volume.h,v
retrieving revision 1.5
diff -p -u -r1.5 volume.h
--- a/libisofs/volume.h 10 Dec 2003 05:45:26 -0000 1.5
+++ b/libisofs/volume.h 24 Feb 2004 18:31:08 -0000
@@ -14,7 +14,7 @@ struct iso_volumeset
struct iso_tree_dir **root;
=20
char *volumeset_id;
- int volumeset_size;
+ int volumeset_size;
=20
char *publisher_id;
char *data_preparer_id;
@@ -30,13 +30,14 @@ struct iso_volumeset
time_t expiration_time;
time_t effective_time;
=20
- char **volume_id; /* array of size 'volumeset_size' */
+ char **volume_id; /* array of size 'volumeset_size' */
=20
int system_sectors;
int header_sectors;
- int *data_sectors; /* array of size 'volumeset_size' */
+ int *data_sectors; /* array of size 'volumeset_size' */
=20
- struct iso_volumeset_options {
+ struct iso_volumeset_options
+ {
int iso_level;
int joliet;
} options;
Index: libisofs/writer.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libisofs/writer.c,v
retrieving revision 1.15
diff -p -u -r1.15 writer.c
--- a/libisofs/writer.c 10 Feb 2004 12:45:20 -0000 1.15
+++ b/libisofs/writer.c 24 Feb 2004 18:31:08 -0000
@@ -10,79 +10,97 @@
=20
#define APPLICATION_ID "LIBBURN SUITE (C) 2002 D.FOREMAN/B.JANSENS"
=20
-static void iso_next_state (struct iso_write_target *target);
-static int iso_source_get_size (struct burn_source *src);
-static void iso_source_free (struct burn_source *src);
-static void iso_target_layout (struct iso_write_target *target);
-static void iso_dir_layout (struct iso_write_target *target,
- struct iso_tree_dir **dir);
-static int iso_write_system_area (struct iso_write_target *t,
- unsigned char *buffer,
- enum burn_source_status *err);
-static int iso_write_pri_volume (struct iso_write_target *t,
+enum dir_type
+{
+ DIR_TYPE_SELF,
+ DIR_TYPE_PARENT,
+ DIR_TYPE_NORMAL
+};
+
+static void iso_next_state(struct iso_write_target *target);
+static int iso_source_get_size(struct burn_source *src);
+static void iso_source_free(struct burn_source *src);
+static void iso_target_layout(struct iso_write_target *target);
+static void iso_dir_layout(struct iso_write_target *target,
+ struct iso_tree_dir **dir);
+static int iso_write_system_area(struct iso_write_target *t,
unsigned char *buffer,
enum burn_source_status *err);
-static int iso_write_volume_terminator (struct iso_write_target *t,
- unsigned char *buffer,
- enum burn_source_status *err);
-static int iso_write_path_table (struct iso_write_target *t,
- unsigned char *buffer,
- enum burn_source_status *err,
- int lsb);
-static int iso_write_dir_record (struct iso_write_target *target,
+static int iso_write_pri_volume(struct iso_write_target *t,
+ unsigned char *buffer,
+ enum burn_source_status *err);
+static int iso_write_volume_terminator(struct iso_write_target *t,
+ unsigned char *buffer,
+ enum burn_source_status *err);
+static int iso_write_path_table(struct iso_write_target *t,
+ unsigned char *buffer,
+ enum burn_source_status *err, int lsb);
+static int iso_write_dir_record(struct iso_write_target *target,
+ unsigned char *buffer,
+ struct iso_tree_dir **dir, enum dir_type type);
+static void iso_write_file_id(unsigned char *buf, int size,
+ struct iso_tree_file **f);
+static int iso_write_dir_records(struct iso_write_target *t,
unsigned char *buffer,
- struct iso_tree_dir **dir);
-static void iso_write_file_id (unsigned char *buf, int size,
- struct iso_tree_file **f);
+ enum burn_source_status *err);
+static int get_path_table_size(struct iso_tree_dir **ddir);
+static int get_directory_record_length(const char *isoname);
=20
-static int
-get_path_table_size (struct iso_tree_dir **ddir)
+int get_path_table_size(struct iso_tree_dir **ddir)
{
int i, size =3D 0;
struct iso_tree_dir *dir =3D *ddir;
-=09
- assert (dir);
-=09
- if (iso_tree_dir_get_name(ddir, ISO_FILE_NAME_ISO))
- size +=3D strlen (dir->isoname1);
- else
- {
- /* if iso_tree_dir_get_name is NULL, this is the root dir
- and will have a path record of 10 bytes */
+ const char *isoname;
+
+ assert(dir);
+
+ isoname =3D iso_tree_dir_get_name(ddir, ISO_FILE_NAME_ISO);
+ if (isoname) {
+ /* a path table record is 8 bytes + the length of the
+ directory identifier */
+ size +=3D (8 + strlen(isoname));
+ } else {
+ /* if iso_tree_dir_get_name is NULL, this is the root dir and
+ will have a path record of 10 bytes */
size +=3D 10;
}
-=09
+
+ /* pad the field if the directory identifier is an odd number of bytes=20
+ */
+ if (size % 2)
+ ++size;
+
for (i =3D 0; i < dir->nchildren; i++)
- size +=3D get_path_table_size (dir->children[i].me);
-=09
+ size +=3D get_path_table_size(dir->children[i].me);
+
return size;
}
=20
-struct burn_source*
-iso_source_new (struct iso_volumeset *volumeset,
- int volume)
+struct burn_source *iso_source_new(struct iso_volumeset *volumeset, int vo=
lume)
{
struct burn_source *src;
struct iso_write_target *t;
=20
- if (!volumeset) return NULL;
- if (volume >=3D volumeset->volumeset_size) return NULL;
+ if (!volumeset)
+ return NULL;
+ if (volume >=3D volumeset->volumeset_size)
+ return NULL;
=20
- t =3D malloc (sizeof (struct iso_write_target));
+ t =3D malloc(sizeof(struct iso_write_target));
=20
- iso_tree_sort (volumeset->root);
+ iso_tree_sort(volumeset->root);
=20
t->volset =3D volumeset;
t->volset->refcount++;
t->volume =3D volume;
- t->now =3D time (NULL);
+ t->now =3D time(NULL);
t->phys_sector_size =3D 2048;
- iso_target_layout (t);
+ iso_target_layout(t);
=20
t->state =3D ISO_WRITE_BEFORE;
- iso_next_state (t); /* prepare for the first state */
+ iso_next_state(t); /* prepare for the first state */
=20
- src =3D malloc (sizeof (struct burn_source));
+ src =3D malloc(sizeof(struct burn_source));
src->refcount =3D 1;
src->free_data =3D iso_source_free;
src->read =3D iso_source_generate;
@@ -92,40 +110,67 @@ iso_source_new (struct iso_volumeset *vo
return src;
}
=20
-void
-iso_source_free (struct burn_source *src)
+void iso_source_free(struct burn_source *src)
{
struct iso_write_target *target =3D src->data;
=20
- assert (src->read =3D=3D iso_source_generate &&
- src->read_sub =3D=3D NULL &&
- src->get_size =3D=3D iso_source_get_size);
+ assert(src->read =3D=3D iso_source_generate &&
+ src->read_sub =3D=3D NULL && src->get_size =3D=3D iso_source_get_s=
ize);
+
+ iso_volumeset_free(target->volset);
+ free(target);
+}
+
+int get_directory_record_length(const char *isoname)
+{
+ int size;
+
+ /* size =3D the length of the filename + 33 bytes (9.1) */
+ size =3D 33 + strlen(isoname);
+ /* if size is odd, pad it with a single byte (9.1.12) */
+ if (size % 2)
+ ++size;
=20
- iso_volumeset_free (target->volset);
- free (target);
+ return size;
}
=20
void
-iso_dir_layout (struct iso_write_target *target,
- struct iso_tree_dir **ddir)
+iso_dir_layout(struct iso_write_target *target, struct iso_tree_dir **ddir)
{
- int i;
+ int i, length;
struct iso_tree_dir *dir =3D *ddir;
=20
dir->logical_block =3D target->logical_block++;
- dir->size =3D 0; /* XXX wtf goes here? */
+ length =3D 0;
=20
for (i =3D 0; i < dir->nfiles; ++i) {
+ const char *name;
+
+ /* XXX: need to get size of files and all that stuff */
dir->files[i].logical_block =3D 0;
dir->files[i].size =3D 0;
+ name =3D iso_tree_file_get_name(dir->files[i].me,
+ ISO_FILE_NAME_ISO);
+ length +=3D get_directory_record_length(name);
+ }
+
+ for (i =3D 0; i < dir->nchildren; ++i) {
+ const char *name;
+
+ iso_dir_layout(target, dir->children[i].me);
+ name =3D iso_tree_file_get_name(dir->files[i].me,
+ ISO_FILE_NAME_ISO);
+ length +=3D get_directory_record_length(name);
}
=20
- for (i =3D 0; i < dir->nchildren; ++i)
- iso_dir_layout (target, dir->children[i].me);
+ /* dir->size is the number of bytes needed to hold the directory
+ record for each file and subdirectory of 'dir', padded to use up
+ all of the bytes of a physical sector. */
+ dir->size =3D ((length / target->phys_sector_size) + 1)
+ * target->phys_sector_size;
}
=20
-void
-iso_target_layout (struct iso_write_target *target)
+void iso_target_layout(struct iso_write_target *target)
{
/* logical block numbering starts at 1, not 0 */
target->logical_block =3D 1;
@@ -140,45 +185,41 @@ iso_target_layout (struct iso_write_targ
target->logical_block++;
target->total_size +=3D target->phys_sector_size;
=20
- /* 16 logical blocks for the System Area plus at least 2 for
- * the Data Area (primary volume and volume terminator) */
+ /* 16 logical blocks for the System Area plus at least 2 for the Data
+ Area (primary volume and volume terminator) */
target->volume_space_size =3D 18;
target->logical_block_size =3D 2048;
- target->path_table_size =3D get_path_table_size (target->volset->root);
- /* leave a 1-block buffer after each path table */
+ target->path_table_size =3D get_path_table_size(target->volset->root);
+ /* put a 1-block buffer before each path table */
target->l_path_table_pos =3D 19;
target->volume_space_size +=3D 2;
target->logical_block +=3D 2;
target->total_size +=3D 2 * target->phys_sector_size;
- /* leave a 1-block buffer after each path table */
+ /* put a 1-block buffer before each path table */
target->m_path_table_pos =3D 21;
target->volume_space_size +=3D 2;
target->logical_block +=3D 2;
target->total_size +=3D 2 * target->phys_sector_size;
-=09
- iso_dir_layout (target, target->volset->root);
+
+ iso_dir_layout(target, target->volset->root);
}
=20
-int
-iso_source_get_size (struct burn_source *src)
+int iso_source_get_size(struct burn_source *src)
{
struct iso_write_target *target =3D src->data;
=20
- assert (src->read =3D=3D iso_source_generate &&
- src->read_sub =3D=3D NULL &&
- src->get_size =3D=3D iso_source_get_size);
+ assert(src->read =3D=3D iso_source_generate &&
+ src->read_sub =3D=3D NULL && src->get_size =3D=3D iso_source_get_s=
ize);
=20
return target->total_size;
}
=20
-void
-iso_next_state (struct iso_write_target *target)
+void iso_next_state(struct iso_write_target *target)
{
- switch (++target->state)
- {
+ switch (++target->state) {
case ISO_WRITE_BEFORE:
/* this should never occur */
- assert (0);
+ assert(0);
break;
case ISO_WRITE_SYSTEM_AREA:
target->state_data.system_area.sectors =3D 0;
@@ -193,48 +234,55 @@ iso_next_state (struct iso_write_target=20
case ISO_WRITE_M_PATH_TABLE:
target->state_data.path_tables.sectors =3D 0;
break;
+ case ISO_WRITE_DIR_RECORDS:
+ target->state_data.dir_records.sectors =3D 0;
+ break;
case ISO_WRITE_DONE:
break;
}
}
=20
int
-iso_source_generate (struct burn_source *src,
- unsigned char *buffer,
- int size)
+iso_source_generate(struct burn_source *src, unsigned char *buffer, int si=
ze)
{
int next =3D 0;
enum burn_source_status err =3D BURN_SOURCE_OK;
struct iso_write_target *target =3D src->data;
=20
- assert (src->read =3D=3D iso_source_generate &&
- src->read_sub =3D=3D NULL &&
- src->get_size =3D=3D iso_source_get_size);
-
+ assert(src->read =3D=3D iso_source_generate &&
+ src->read_sub =3D=3D NULL && src->get_size =3D=3D iso_source_get_s=
ize);
=20
/* make sure the app didn't fuck up badly. */
if (size !=3D target->phys_sector_size)
- return BURN_SOURCE_FAILED; /* XXX better code */
+ return BURN_SOURCE_FAILED; /* XXX better code */
+
+ /* make sure 'buffer' doesn't have anything in it */
+ memset(buffer, 0, size);
=20
- switch (target->state)
- {
+ switch (target->state) {
case ISO_WRITE_BEFORE:
/* this should never occur */
assert(0);
case ISO_WRITE_SYSTEM_AREA:
- next =3D iso_write_system_area (target, buffer, &err);
+ next =3D iso_write_system_area(target, buffer, &err);
break;
case ISO_WRITE_PRI_VOL_DESC:
- next =3D iso_write_pri_volume (target, buffer, &err);
+ /* set target->logical_block to the logical block containing
+ the root directory record */
+ target->logical_block =3D 23;
+ next =3D iso_write_pri_volume(target, buffer, &err);
break;
case ISO_WRITE_VOL_DESC_TERMINATOR:
- next =3D iso_write_volume_terminator (target, buffer, &err);
+ next =3D iso_write_volume_terminator(target, buffer, &err);
break;
case ISO_WRITE_L_PATH_TABLE:
- next =3D iso_write_path_table (target, buffer, &err, 1);
+ next =3D iso_write_path_table(target, buffer, &err, 1);
break;
case ISO_WRITE_M_PATH_TABLE:
- next =3D iso_write_path_table (target, buffer, &err, 0);
+ next =3D iso_write_path_table(target, buffer, &err, 0);
+ break;
+ case ISO_WRITE_DIR_RECORDS:
+ next =3D iso_write_dir_records(target, buffer, &err);
break;
case ISO_WRITE_DONE:
err =3D BURN_SOURCE_EOF;
@@ -242,131 +290,128 @@ iso_source_generate (struct burn_source=20
}
=20
if (next)
- iso_next_state (target);
+ iso_next_state(target);
=20
return err;
}
=20
-
/* writes 16 sectors of '0' */
int
-iso_write_system_area (struct iso_write_target *t,
- unsigned char *buffer,
- enum burn_source_status *err)
+iso_write_system_area(struct iso_write_target *t,
+ unsigned char *buffer, enum burn_source_status *err)
{
struct iso_state_system_area *state =3D &t->state_data.system_area;
=20
- memset (buffer, 0, t->phys_sector_size);
+ memset(buffer, 0, t->phys_sector_size);
return (++state->sectors =3D=3D 16);
}
=20
/* writes the primary volume descriptor */
int
-iso_write_pri_volume (struct iso_write_target *t,
- unsigned char *buffer,
- enum burn_source_status *err)
+iso_write_pri_volume(struct iso_write_target *t,
+ unsigned char *buffer, enum burn_source_status *err)
{
/* volume descriptor type (8.4.1) */
buffer[0] =3D 1;
/* standard identifier (8.4.2) */
- memcpy (&buffer[1], "CD001", 5);
+ memcpy(&buffer[1], "CD001", 5);
/* volume descriptor version (8.4.3) */
buffer[6] =3D 1;
/* unused field (8.4.4) */
buffer[7] =3D 0;
/* system identifier (8.4.5) */
/* XXX mkisofs puts "LINUX" here */
- memset (&buffer[8], ' ', 32);
+ memset(&buffer[8], ' ', 32);
/* volume identifier (8.4.6) */
- iso_d_strcpy (&buffer[40], 32, t->volset->volume_id[t->volume]);
+ iso_d_strcpy(&buffer[40], 32, t->volset->volume_id[t->volume]);
/* unused field (8.4.7) */
- memset (&buffer[72], 0, 8);
+ memset(&buffer[72], 0, 8);
/* volume space size (8.4.8) */
- iso_bb (&buffer[80], t->volume_space_size, 4);
+ iso_bb(&buffer[80], t->volume_space_size, 4);
/* unused field (8.4.9) */
- memset (&buffer[88], 0, 32);
+ memset(&buffer[88], 0, 32);
/* volume set size (8.4.10) */
- iso_bb (&buffer[120], t->volset->volumeset_size, 2);
+ iso_bb(&buffer[120], t->volset->volumeset_size, 2);
/* volume sequence number (8.4.11) */
- iso_bb (&buffer[124], t->volume + 1, 2);
+ iso_bb(&buffer[124], t->volume + 1, 2);
/* logical block size (8.4.12) */
- iso_bb (&buffer[128], t->logical_block_size, 2);
+ iso_bb(&buffer[128], t->logical_block_size, 2);
/* path table size (8.4.13) */
- iso_bb (&buffer[132], t->path_table_size, 4);
+ iso_bb(&buffer[132], t->path_table_size, 4);
/* location of occurance of type l path table (8.4.14) */
- iso_lsb (&buffer[140], t->l_path_table_pos, 4);
+ iso_lsb(&buffer[140], t->l_path_table_pos, 4);
/* location of optional occurance of type l path table (8.4.15) */
- iso_lsb (&buffer[144], 0, 4);
+ iso_lsb(&buffer[144], 0, 4);
/* location of occurance of type m path table (8.4.16) */
- iso_msb (&buffer[148], t->m_path_table_pos, 4);
+ iso_msb(&buffer[148], t->m_path_table_pos, 4);
/* location of optional occurance of type m path table (8.4.17) */
- iso_msb (&buffer[152], 0, 4);
+ iso_msb(&buffer[152], 0, 4);
/* directory record for root directory (8.4.18) */
- iso_write_dir_record (t, &buffer[156], t->volset->root);
+ iso_write_dir_record(t, &buffer[156], t->volset->root, DIR_TYPE_SELF);
/* volume set identifier (8.4.19) */
- iso_d_strcpy (&buffer[190], 128, t->volset->volumeset_id);
+ iso_d_strcpy(&buffer[190], 128, t->volset->volumeset_id);
/* publisher identifier (8.4.20) */
- iso_a_strcpy (&buffer[318], 128, t->volset->publisher_id);
+ iso_a_strcpy(&buffer[318], 128, t->volset->publisher_id);
/* data preparer identifier (8.4.21) */
- iso_a_strcpy (&buffer[446], 128, t->volset->data_preparer_id);
+ iso_a_strcpy(&buffer[446], 128, t->volset->data_preparer_id);
/* application identifier (8.4.22) */
- iso_a_strcpy (&buffer[574], 128, APPLICATION_ID);
+ iso_a_strcpy(&buffer[574], 128, APPLICATION_ID);
/* copyright file identifier (8.4.23) */
- iso_write_file_id (&buffer[702], 37, t->volset->copyright_file);
+ iso_write_file_id(&buffer[702], 37, t->volset->copyright_file);
/* abstract file identifier (8.4.24) */
- iso_write_file_id (&buffer[739], 37, t->volset->abstract_file);
+ iso_write_file_id(&buffer[739], 37, t->volset->abstract_file);
/* bibliographic file identifier (8.4.25) */
- iso_write_file_id (&buffer[776], 37, t->volset->bibliographic_file);
+ iso_write_file_id(&buffer[776], 37, t->volset->bibliographic_file);
/* volume creation date and time (8.4.26) */
/* XXX is this different for multisession? */
- iso_datetime_17 (&buffer[813], t->now);
+ iso_datetime_17(&buffer[813], t->now);
/* volume modification date and time (8.4.27) */
- iso_datetime_17 (&buffer[830], t->now);
+ iso_datetime_17(&buffer[830], t->now);
/* volume expiration date and time (8.4.28) */
- iso_datetime_17 (&buffer[847], t->volset->expiration_time);
+ iso_datetime_17(&buffer[847], t->volset->expiration_time);
/* volume effective date and time (8.4.29) */
- iso_datetime_17 (&buffer[864],
- t->volset->effective_time =3D=3D (time_t) -1 ?
- t->now : t->volset->effective_time);
+ iso_datetime_17(&buffer[864],
+ t->volset->effective_time =3D=3D (time_t) - 1 ?
+ t->now : t->volset->effective_time);
/* file structure version (8.4.30) */
buffer[881] =3D 1;
/* reserved for future standardization (8.4.31) */
buffer[882] =3D 0;
/* application use (8.4.32) */
/* XXX put something in here? does mkisofs? */
- memset (&buffer[883], 0, 512);
+ memset(&buffer[883], 0, 512);
/* reserved for future standardization (8.4.33) */
- memset (&buffer[1395], 0, 653);
+ memset(&buffer[1395], 0, 653);
=20
return 1;
}
=20
-void
-iso_write_file_id (unsigned char *buf, int size, struct iso_tree_file **f)
+void iso_write_file_id(unsigned char *buf, int size, struct iso_tree_file =
**f)
{
if (!f)
- memset (buf, ' ', size);
+ memset(buf, ' ', size);
else
- iso_filecpy (buf, size,
- iso_tree_file_get_name (f, ISO_FILE_NAME_ISO),
- (*f)->version);
+ iso_filecpy(buf, size,
+ iso_tree_file_get_name(f, ISO_FILE_NAME_ISO),
+ (*f)->version);
}
=20
int
-iso_write_dir_record (struct iso_write_target *t,
- unsigned char *buffer,
- struct iso_tree_dir **ddir)
+iso_write_dir_record(struct iso_write_target *t,
+ unsigned char *buffer,
+ struct iso_tree_dir **ddir, enum dir_type type)
{
int len_fi;
const char *fi =3D NULL;
int sz;
struct iso_tree_dir *dir =3D *ddir;
=20
- if (!dir->fullname)
+ if (type !=3D DIR_TYPE_NORMAL)
len_fi =3D 1;
else {
- fi =3D iso_tree_dir_get_name (ddir, ISO_FILE_NAME_ISO);
- len_fi =3D strlen (fi);
+ assert(dir->parent);
+ fi =3D iso_tree_dir_get_name(ddir, ISO_FILE_NAME_ISO);
+ len_fi =3D strlen(fi);
}
=20
sz =3D 33 + len_fi + !(len_fi % 2);
@@ -374,28 +419,93 @@ iso_write_dir_record (struct iso_write_t
/* length of directory record (9.1.1) */
buffer[0] =3D sz;
/* extended attribute record length (9.1.2) */
- buffer[1] =3D 0; /* XXX allow for extended attribute records */
+ buffer[1] =3D 0; /* XXX allow for extended attribute records */
/* location of extent (9.1.3) */
- iso_bb (&buffer[2], dir->logical_block, 4);
+ iso_bb(&buffer[2], dir->logical_block, 4);
/* data length (9.1.4) */
- iso_bb (&buffer[10], dir->size, 4);
+ iso_bb(&buffer[10], dir->size, 4);
/* recording date and time (9.1.5) */
iso_datetime_7(&buffer[18], t->now);
/* file flags (9.1.6) */
buffer[25] =3D ISO_FILE_FLAG_DIRECTORY;
/* file unit size (9.1.7) */
- buffer[26] =3D 0; /* XXX support this shit? */
+ buffer[26] =3D 0; /* XXX support this shit? */
/* interleave gap size (9.1.8) */
- buffer[27] =3D 0; /* XXX support this shit? */
+ buffer[27] =3D 0; /* XXX support this shit? */
/* volume sequence number (9.1.9) */
- iso_bb (&buffer[28], dir->volume + 1, 2);
+ iso_bb(&buffer[28], dir->volume + 1, 2);
/* length of file identifier (9.1.10) */
buffer[32] =3D len_fi;
/* file identifier */
- if (!dir->fullname)
+ switch (type) {
+ case DIR_TYPE_SELF:
buffer[33] =3D 0;
- else
- iso_d_strcpy (&buffer[33], len_fi, fi);
+ break;
+ case DIR_TYPE_PARENT:
+ buffer[33] =3D 1;
+ break;
+ case DIR_TYPE_NORMAL:
+ iso_d_strcpy(&buffer[33], len_fi, fi);
+ break;
+ }
+ if (!(len_fi % 2))
+ buffer[33 + len_fi] =3D 0;
+
+ return sz;
+}
+
+/* write the file record as per (9.1) */
+int
+iso_write_file_record(struct iso_write_target *t,
+ unsigned char *buffer,
+ struct iso_tree_file **ffile, enum dir_type type)
+{
+ int len_fi;
+ const char *fi =3D NULL;
+ int sz;
+ struct iso_tree_file *file =3D *ffile;
+
+ if (type !=3D DIR_TYPE_NORMAL) {
+ len_fi =3D 1;
+ } else {
+ fi =3D iso_tree_file_get_name(ffile, ISO_FILE_NAME_ISO);
+ len_fi =3D strlen(fi);
+ }
+
+ sz =3D 33 + len_fi + !(len_fi % 2);
+
+ /* length of directory record (9.1.1) */
+ buffer[0] =3D sz;
+ /* extended attribute record length (9.1.2) */
+ buffer[1] =3D 0; /* XXX allow for extended attribute records */
+ /* location of extent (9.1.3) */
+ iso_bb(&buffer[2], file->logical_block, 4);
+ /* data length (9.1.4) */
+ iso_bb(&buffer[10], file->size, 4);
+ /* recording date and time (9.1.5) */
+ iso_datetime_7(&buffer[18], t->now);
+ /* file flags (9.1.6) */
+ buffer[25] =3D ISO_FILE_FLAG_NORMAL;
+ /* file unit size (9.1.7) */
+ buffer[26] =3D 0; /* XXX support this shit? */
+ /* interleave gap size (9.1.8) */
+ buffer[27] =3D 0; /* XXX support this shit? */
+ /* volume sequence number (9.1.9) */
+ iso_bb(&buffer[28], file->volume + 1, 2);
+ /* length of file identifier (9.1.10) */
+ buffer[32] =3D len_fi;
+ /* file identifier */
+ switch (type) {
+ case DIR_TYPE_SELF:
+ buffer[33] =3D 0;
+ break;
+ case DIR_TYPE_PARENT:
+ buffer[33] =3D 1;
+ break;
+ case DIR_TYPE_NORMAL:
+ iso_d_strcpy(&buffer[33], len_fi, fi);
+ break;
+ }
if (!(len_fi % 2))
buffer[33 + len_fi] =3D 0;
=20
@@ -404,37 +514,257 @@ iso_write_dir_record (struct iso_write_t
=20
/* writes the volume descriptor set terminator */
int
-iso_write_volume_terminator (struct iso_write_target *t,
- unsigned char *buffer,
- enum burn_source_status *err)
+iso_write_volume_terminator(struct iso_write_target *t,
+ unsigned char *buffer,
+ enum burn_source_status *err)
{
/* volume descriptor type (8.3.1) */
buffer[0] =3D 255;
/* standard identifier (8.3.2) */
- memcpy (&buffer[1], "CD001", 5);
+ memcpy(&buffer[1], "CD001", 5);
/* volume descriptor version (8.3.3) */
buffer[6] =3D 1;
/* reserved for future standardization (8.3.4) */
- memset (&buffer[7], 0, 2041);
+ memset(&buffer[7], 0, 2041);
=20
return 1;
}
=20
+/* write the path record for 'ddir' into 'buffer' */
+int
+write_path_table_record(unsigned char *buffer,
+ struct iso_tree_dir **ddir, int *position, int lsb)
+{
+ int len, bytes_written;
+ short parent_position;
+ const char *name;
+ struct iso_tree_dir *dir =3D *ddir;
+
+ /* set the position in the path table of this directory */
+ dir->position =3D *position;
+ /* increment the position for the next path table record */
+ *position +=3D 1;
+ if (dir->parent)
+ parent_position =3D dir->parent->position;
+ else
+ parent_position =3D 1;
+
+ name =3D iso_tree_dir_get_name(ddir, ISO_FILE_NAME_ISO);
+ if (name)
+ len =3D strlen(name);
+ else
+ len =3D 1;
+
+ /* the directory identifier length (9.4.1) */
+ buffer[0] =3D len;
+ /* the extended attribute record length (9.4.2) */
+ buffer[1] =3D 0;
+ /* location of extent (9.4.3) */
+ if (lsb)
+ iso_lsb(&buffer[2], dir->logical_block, 4);
+ else
+ iso_msb(&buffer[2], dir->logical_block, 4);
+ /* parent directory record (9.4.4) */
+ if (lsb)
+ iso_lsb(&buffer[6], parent_position, 2);
+ else
+ iso_msb(&buffer[6], parent_position, 2);
+ /* the directory identifier (9.4.5) */
+ if (name)
+ memcpy(&buffer[8], name, len);
+ else
+ memset(&buffer[8], 0, len);
+ /* padding field (9.4.6) */
+ if (len % 2) {
+ bytes_written =3D 9 + len;
+ buffer[bytes_written] =3D 0;
+ } else
+ bytes_written =3D 8 + len;
+
+ return bytes_written;
+}
+
+/* recursive function used to write the path records for each level
+ * of the file system sequentially, i.e. root, then all children of
+ * root, then all grandchildren of root, then all great-grandchildren
+ * of root, etc. */
+int
+write_path_table_records(unsigned char *buffer,
+ struct iso_tree_dir **ddir,
+ int level, int *position, int lsb)
+{
+ int offset;
+ struct iso_tree_dir *dir =3D *ddir;
+
+ /* ISO9660 only allows directories to be nested 8-deep */
+ if (level >=3D 8)
+ return 0;
+
+ if (!level) {
+ offset =3D write_path_table_record(buffer, ddir, position, lsb);
+ } else {
+ int i;
+
+ offset =3D 0;
+ for (i =3D 0; i < dir->nchildren; ++i) {
+ offset +=3D
+ write_path_table_records(buffer + offset,
+ dir->children[i].me,
+ level - 1,
+ position, lsb);
+ }
+ }
+
+ return offset;
+}
+
/* writes set of path table records */
-int iso_write_path_table (struct iso_write_target *t,
- unsigned char *buffer,
- enum burn_source_status *err,
- int lsb)
+int
+iso_write_path_table(struct iso_write_target *t,
+ unsigned char *buffer,
+ enum burn_source_status *err, int lsb)
{
+ int i, offset, position;
struct iso_state_path_tables *state =3D &t->state_data.path_tables;
=20
- /* XXX replace =3D=3D 0 with < (size of path table) */
- if (state->sectors =3D=3D 0) {
- /* XXX replace these 0xff's with actual path table data */
- memset (buffer, 0xff, t->phys_sector_size);
+ if (state->sectors) {
+ offset =3D 0;
+ position =3D 1;
+
+ for (i =3D 0; i < 8; ++i) {
+ offset +=3D write_path_table_records(buffer + offset,
+ t->volset->root,
+ i, &position, lsb);
+ }
} else {
/* empty buffer sector */
- memset (buffer, 0, t->phys_sector_size);
+ memset(buffer, 0, t->phys_sector_size);
}
+
return (++state->sectors =3D=3D 2);
}
+
+struct iso_tree_dir **find_dir_at_block(struct iso_tree_dir **ddir, int bl=
ock)
+{
+ int i;
+ struct iso_tree_dir *dir =3D *ddir;
+ struct iso_tree_dir **to_write =3D NULL;
+
+ if (dir->logical_block =3D=3D block) {
+ to_write =3D ddir;
+ } else {
+ for (i =3D 0; (i < dir->nchildren) && !to_write; ++i) {
+ to_write =3D find_dir_at_block(dir->children[i].me,
+ block);
+ }
+ }
+
+ if (to_write)
+ return to_write;
+ else
+ return NULL;
+}
+
+/* write the records for children of 'dir' */
+void
+write_child_records(struct iso_write_target *t,
+ unsigned char *buffer,
+ enum burn_source_status *err, struct iso_tree_dir *dir)
+{
+ int file_counter, dir_counter, order, offset;
+
+ file_counter =3D dir_counter =3D offset =3D 0;
+
+ while ((file_counter < dir->nfiles) || (dir_counter < dir->nchildren)) {
+ /* if there are files and dirs, compare them to figure out
+ which comes 1st alphabetically */
+ if ((file_counter < dir->nfiles) &&
+ (dir_counter < dir->nchildren)) {
+ const char *dirname, *filename;
+
+ dirname =3D iso_tree_dir_get_name
+ (dir->children[dir_counter].me,
+ ISO_FILE_NAME_ISO);
+ filename =3D iso_tree_file_get_name
+ (dir->files[file_counter].me,
+ ISO_FILE_NAME_ISO);
+ order =3D strcmp(dirname, filename);
+ } else {
+
+ if (file_counter < dir->nfiles)
+ /* only files are left */
+ order =3D 1;
+ else
+ /* only dirs are left */
+ order =3D -1;
+ }
+
+ if (order < 0) {
+ offset +=3D iso_write_dir_record
+ (t, buffer + offset,
+ dir->children[dir_counter].me,
+ DIR_TYPE_NORMAL);
+ dir_counter++;
+ } else {
+ offset +=3D iso_write_file_record
+ (t, buffer + offset,
+ dir->files[file_counter].me, DIR_TYPE_NORMAL);
+ file_counter++;
+ }
+
+ }
+
+ return;
+}
+
+/* write out the next directory record */
+int
+iso_write_dir_records(struct iso_write_target *t,
+ unsigned char *buffer, enum burn_source_status *err)
+{
+ int finished, offset;
+ struct iso_tree_dir **ddir, *dir;
+ struct iso_state_dir_records *state =3D &t->state_data.dir_records;
+
+ finished =3D 0; /* set to 1 when all directory records have
+ been written */
+
+ if (state->sectors++) {
+ /* t->logical_block is the next block to write. find the dir
+ record which belongs there and write it out. if none
+ exists, we're done writing the directory records. */
+
+ ddir =3D find_dir_at_block(t->volset->root, t->logical_block);
+ if (!ddir) {
+ finished =3D 1;
+ } else {
+ /* 1) write the record for this directory 2) write the=20
+ record for the parent directory 3) write the
+ records for all child files and directories */
+ dir =3D *ddir;
+ offset =3D iso_write_dir_record(t,
+ buffer,
+ ddir, DIR_TYPE_SELF);
+ if (!dir->parent) {
+ /* this is the root directory */
+ offset +=3D
+ iso_write_dir_record(t,
+ buffer + offset,
+ ddir,
+ DIR_TYPE_PARENT);
+ } else {
+ offset +=3D
+ iso_write_dir_record(t,
+ buffer + offset,
+ dir->parent->me,
+ DIR_TYPE_PARENT);
+ }
+
+ write_child_records(t, buffer + offset, err, dir);
+
+ t->logical_block++;
+ }
+ }
+
+ return finished;
+}
Index: libisofs/writer.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/libisofs/writer.h,v
retrieving revision 1.10
diff -p -u -r1.10 writer.h
--- a/libisofs/writer.h 10 Feb 2004 12:45:20 -0000 1.10
+++ b/libisofs/writer.h 24 Feb 2004 18:31:08 -0000
@@ -17,6 +17,7 @@ enum iso_write_state
ISO_WRITE_VOL_DESC_TERMINATOR,
ISO_WRITE_L_PATH_TABLE,
ISO_WRITE_M_PATH_TABLE,
+ ISO_WRITE_DIR_RECORDS,
=20
ISO_WRITE_DONE
};
@@ -24,12 +25,13 @@ enum iso_write_state
/** File Flags (9.1.6) */
enum
{
- ISO_FILE_FLAG_HIDDEN =3D 1 << 0,
- ISO_FILE_FLAG_DIRECTORY =3D 1 << 1,
- ISO_FILE_FLAG_ASSOCIATED =3D 1 << 2,
- ISO_FILE_FLAG_RECORD =3D 1 << 3,
- ISO_FILE_FLAG_PROTECTION =3D 1 << 4,
- ISO_FILE_FLAG_MULTIEXTENT =3D 1 << 7
+ ISO_FILE_FLAG_HIDDEN =3D 1 << 0,
+ ISO_FILE_FLAG_DIRECTORY =3D 1 << 1,
+ ISO_FILE_FLAG_ASSOCIATED =3D 1 << 2,
+ ISO_FILE_FLAG_RECORD =3D 1 << 3,
+ ISO_FILE_FLAG_PROTECTION =3D 1 << 4,
+ ISO_FILE_FLAG_MULTIEXTENT =3D 1 << 7,
+ ISO_FILE_FLAG_NORMAL =3D 0
};
=20
struct iso_write_target
@@ -45,7 +47,8 @@ struct iso_write_target
/* size of the total output */
int total_size;
=20
- /* the next available logical block */
+ /* when compiling the iso, this is the next available logical block.
+ when writing the iso, this is the next block to write. */
int logical_block;
/* The number of Logical Blocks for the Volume Space */
int volume_space_size;
@@ -60,17 +63,26 @@ struct iso_write_target
=20
/* what we're doing when the generate function gets called next */
enum iso_write_state state;
- union {
- struct iso_state_system_area {
+ union
+ {
+ struct iso_state_system_area
+ {
/* how many sectors in the system area have been
written */
int sectors;
} system_area;
- struct iso_state_path_tables {
+ struct iso_state_path_tables
+ {
/* how many sectors in the path table area have been
written */
int sectors;
} path_tables;
+ struct iso_state_dir_records
+ {
+ /* how many sectors in the directory records area have
+ been written */
+ int sectors;
+ } dir_records;
} state_data;
};
=20
Index: test/blank.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/test/blank.c,v
retrieving revision 1.22
diff -p -u -r1.22 blank.c
--- a/test/blank.c 15 Jan 2004 03:35:09 -0000 1.22
+++ b/test/blank.c 24 Feb 2004 18:31:08 -0000
@@ -69,7 +69,8 @@ void parse_args(int argc, char **argv, i
}
}
if (help) {
- printf("Usage: %s [--drive <num>] [--verbose <level>]\n", argv[0]);
+ printf("Usage: %s [--drive <num>] [--verbose <level>]\n",
+ argv[0]);
exit(EXIT_FAILURE);
}
}
Index: test/burniso.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/test/burniso.c,v
retrieving revision 1.54
diff -p -u -r1.54 burniso.c
--- a/test/burniso.c 4 Feb 2004 23:33:05 -0000 1.54
+++ b/test/burniso.c 24 Feb 2004 18:31:08 -0000
@@ -64,11 +64,12 @@ void burn_iso(struct burn_drive *drive,=20
burn_disc_write(o, disc);
burn_write_opts_free(o);
=20
- while (burn_drive_get_status(drive, NULL) =3D=3D BURN_DRIVE_SPAWNING);
+ while (burn_drive_get_status(drive, NULL) =3D=3D BURN_DRIVE_SPAWNING) ;
while (burn_drive_get_status(drive, &p)) {
printf("S: %d/%d ", p.session, p.sessions);
printf("T: %d/%d ", p.track, p.tracks);
- printf("L: %d: %d/%d\n", p.start_sector, p.current_sector, p.sectors);
+ printf("L: %d: %d/%d\n", p.start_sector, p.current_sector,
+ p.sectors);
sleep(2);
}
printf("\n");
Index: test/master.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/test/master.c,v
retrieving revision 1.26
diff -p -u -r1.26 master.c
--- a/test/master.c 4 Feb 2004 23:32:09 -0000 1.26
+++ b/test/master.c 24 Feb 2004 18:31:08 -0000
@@ -80,7 +80,7 @@ void parse_args(int argc, char **argv, i
else
burn_set_verbosity(atoi(argv[i]));
} else if (!strcmp(argv[i], "--help")) {
- help =3D 1; /* who cares */
+ help =3D 1; /* who cares */
} else {
help =3D 0;
printf("%s is a track\n", argv[i]);
@@ -94,7 +94,8 @@ void parse_args(int argc, char **argv, i
}
}
if (help) {
- printf("Usage: %s [--drive <num>] [--verbose <level>] files\n", argv[0]);
+ printf("Usage: %s [--drive <num>] [--verbose <level>] files\n",
+ argv[0]);
exit(EXIT_FAILURE);
}
}
Index: test/rip.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/test/rip.c,v
retrieving revision 1.16
diff -p -u -r1.16 rip.c
--- a/test/rip.c 15 Dec 2003 04:44:01 -0000 1.16
+++ b/test/rip.c 24 Feb 2004 18:31:08 -0000
@@ -10,6 +10,7 @@
=20
static struct burn_drive_info *drives;
static unsigned int n_drives;
+
#warning this example is totally fried
int main()
{
@@ -18,10 +19,12 @@ int main()
struct burn_read_opts o;
=20
burn_initialize();
- o.datafd =3D open("/xp/burn/blah.data", O_CREAT | O_WRONLY
- , S_IRUSR | S_IWUSR);
- o.subfd =3D open("/xp/burn/blah.sub", O_CREAT | O_WRONLY
- , S_IRUSR | S_IWUSR);
+ o.datafd =3D
+ open("/xp/burn/blah.data", O_CREAT | O_WRONLY,
+ S_IRUSR | S_IWUSR);
+ o.subfd =3D
+ open("/xp/burn/blah.sub", O_CREAT | O_WRONLY,
+ S_IRUSR | S_IWUSR);
o.raw =3D 1;
o.c2errors =3D 0;
o.subcodes_audio =3D 1;
@@ -45,7 +48,6 @@ int main()
while (burn_drive_get_status(drive, NULL))
usleep(1000);
=20
-
burn_disc_read(drive, &o);
#endif
return EXIT_SUCCESS;
Index: test/structest.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/test/structest.c,v
retrieving revision 1.12
diff -p -u -r1.12 structest.c
--- a/test/structest.c 15 Dec 2003 04:52:51 -0000 1.12
+++ b/test/structest.c 24 Feb 2004 18:31:08 -0000
@@ -11,15 +11,15 @@ int main(int argc, char **argv)
struct burn_disc *disc;
struct burn_session *session;
struct burn_source *src;
-=09
+
disc =3D burn_disc_create();
session =3D burn_session_create();
burn_disc_add_session(disc, session, BURN_POS_END);
- =09
- /* Define a source for all of the tracks*/
+
+ /* Define a source for all of the tracks */
path =3D strdup("/etc/hosts");
src =3D burn_file_source_new(path, NULL);
-=09
+
/* Add ten tracks to a session */
for (i =3D 0; i < 10; i++) {
track =3D burn_track_create();
@@ -30,7 +30,6 @@ int main(int argc, char **argv)
}
}
=20
-
/* Add ten tracks to a session */
for (i =3D 0; i < 10; i++) {
track =3D burn_track_create();
@@ -40,7 +39,7 @@ int main(int argc, char **argv)
return 0;
}
}
- =09
+
/* Delete a session */
burn_session_remove_track(session, track);
=20
Index: test/toc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs/burn/burn/test/toc.c,v
retrieving revision 1.30
diff -p -u -r1.30 toc.c
--- a/test/toc.c 15 Jan 2004 03:34:52 -0000 1.30
+++ b/test/toc.c 24 Feb 2004 18:31:08 -0000
@@ -44,10 +44,13 @@ static void show_tocs()
=20
sessions =3D burn_disc_get_sessions(disc, &nses);
for (k =3D 0; k < nses; ++k) {
- tracks =3D burn_session_get_tracks(sessions[k], &ntracks);
+ tracks =3D burn_session_get_tracks(sessions[k],
+ &ntracks);
hidefirst =3D burn_session_get_hidefirst(sessions[k]);
if (hidefirst)
- fprintf(stderr, "track: GAP (%2d) lba: %9d (%9d) %02d:%02d:%02d adr: X=
control: X mode: %d\n", k+1, 0, 0, 0, 2, 0,
+ fprintf(stderr,
+ "track: GAP (%2d) lba: %9d (%9d) %02d:%02d:%02d adr: X control: X mod=
e: %d\n",
+ k + 1, 0, 0, 0, 2, 0,
burn_track_get_mode(tracks[0]));
=20
for (j =3D !!hidefirst; j < ntracks; ++j) {
@@ -57,11 +60,11 @@ static void show_tocs()
"adr: %d control: %d mode: %d\n",
e.point, e.session,
burn_msf_to_lba(e.pmin, e.psec,
- e.pframe),
+ e.pframe),
burn_msf_to_lba(e.pmin, e.psec,
- e.pframe) * 4,
+ e.pframe) * 4,
e.pmin, e.psec, e.pframe, e.adr,
- e.control,=20
+ e.control,
burn_track_get_mode(tracks[j]));
}
burn_session_get_leadout_entry(sessions[k], &e);
@@ -69,9 +72,9 @@ static void show_tocs()
"track:lout (%2d) lba: %9d (%9d) %02d:%02d:%02d "
"adr: %d control: %d mode: %d\n",
k + 1, burn_msf_to_lba(e.pmin, e.psec,
- e.pframe),
+ e.pframe),
burn_msf_to_lba(e.pmin, e.psec,
- e.pframe) * 4, e.pmin,
+ e.pframe) * 4, e.pmin,
e.psec, e.pframe, e.adr, e.control, -1);
}
burn_disc_free(disc);
--9jxsPFA5p3P2qPhR--
--SkvwRMAIpAhPCcCJ
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)
iD8DBQFAO5kl8mPQRGtSu14RAkHZAJ0XZuT9+s6p8kTU26T/JACqJ8pogQCeOmVu
sUHQfwc4G4OVhfcigMFkVxU=
=QjK7
-----END PGP SIGNATURE-----
--SkvwRMAIpAhPCcCJ--