freebsd_ioctl.c: Erroneous data size. Thanks again to Heiner.
toc: better error messages and more tests.
This commit is contained in:
5
NEWS
5
NEWS
@@ -1,5 +1,8 @@
|
|||||||
0.69
|
0.69
|
||||||
- Add interface returning drive capabilityes (cdio_get_drive_cap).
|
- Add interface returning drive capabilityes (cdio_get_drive_cap).
|
||||||
|
- Minimal cdrdao image reading
|
||||||
|
- Some important (I think) bug fixes
|
||||||
|
|
||||||
|
|
||||||
0.68
|
0.68
|
||||||
- More honest about mode1 reading in backends. Remove some of the bogusness.
|
- More honest about mode1 reading in backends. Remove some of the bogusness.
|
||||||
@@ -108,4 +111,4 @@
|
|||||||
0.1
|
0.1
|
||||||
Routines split off from VCDImager.
|
Routines split off from VCDImager.
|
||||||
|
|
||||||
$Id: NEWS,v 1.38 2004/04/23 22:10:52 rocky Exp $
|
$Id: NEWS,v 1.39 2004/05/08 20:36:01 rocky Exp $
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: freebsd_ioctl.c,v 1.2 2004/04/30 21:36:54 rocky Exp $
|
$Id: freebsd_ioctl.c,v 1.3 2004/05/08 20:36:01 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: freebsd_ioctl.c,v 1.2 2004/04/30 21:36:54 rocky Exp $";
|
static const char _rcsid[] = "$Id: freebsd_ioctl.c,v 1.3 2004/05/08 20:36:01 rocky Exp $";
|
||||||
|
|
||||||
#ifdef HAVE_FREEBSD_CDROM
|
#ifdef HAVE_FREEBSD_CDROM
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ int
|
|||||||
read_mode2_sector_freebsd_ioctl (_img_private_t *env, void *data, lsn_t lsn,
|
read_mode2_sector_freebsd_ioctl (_img_private_t *env, void *data, lsn_t lsn,
|
||||||
bool b_form2)
|
bool b_form2)
|
||||||
{
|
{
|
||||||
char buf[M2RAW_SECTOR_SIZE] = { 0, };
|
char buf[CDIO_CD_FRAMESIZE] = { 0, };
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
if ( (retval = read_audio_sectors_freebsd_ioctl (env, buf, lsn, 1)) )
|
if ( (retval = read_audio_sectors_freebsd_ioctl (env, buf, lsn, 1)) )
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: cdrdao.c,v 1.3 2004/05/07 10:58:23 rocky Exp $
|
$Id: cdrdao.c,v 1.4 2004/05/08 20:36:01 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
toc reading routine adapted from cuetools
|
toc reading routine adapted from cuetools
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
(*.cue).
|
(*.cue).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: cdrdao.c,v 1.3 2004/05/07 10:58:23 rocky Exp $";
|
static const char _rcsid[] = "$Id: cdrdao.c,v 1.4 2004/05/08 20:36:01 rocky Exp $";
|
||||||
|
|
||||||
#include "cdio_assert.h"
|
#include "cdio_assert.h"
|
||||||
#include "cdio_private.h"
|
#include "cdio_private.h"
|
||||||
@@ -202,12 +202,12 @@ msf_lba_from_mmssff (char *s)
|
|||||||
ret += msf_to_lba (0, field, 0);
|
ret += msf_to_lba (0, field, 0);
|
||||||
|
|
||||||
c = *s++;
|
c = *s++;
|
||||||
if(c >= '0' && c <= '9')
|
if (isdigit(c))
|
||||||
field = (c - '0');
|
field = (c - '0');
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
if('\0' != (c = *s++)) {
|
if('\0' != (c = *s++)) {
|
||||||
if(c >= '0' && c <= '9') {
|
if (isdigit(c)) {
|
||||||
field = field * 10 + (c - '0');
|
field = field * 10 + (c - '0');
|
||||||
c = *s++;
|
c = *s++;
|
||||||
}
|
}
|
||||||
@@ -433,11 +433,36 @@ parse_tocfile (_img_private_t *cd, const char *toc_name)
|
|||||||
/* CATALOG "ddddddddddddd" */
|
/* CATALOG "ddddddddddddd" */
|
||||||
if (0 == strcmp ("CATALOG", keyword)) {
|
if (0 == strcmp ("CATALOG", keyword)) {
|
||||||
if (-1 == i) {
|
if (-1 == i) {
|
||||||
if (NULL != (field = strtok (NULL, "\"\t\n\r")))
|
if (NULL != (field = strtok (NULL, "\"\t\n\r"))) {
|
||||||
if (NULL != cd)
|
if (13 != strlen(field)) {
|
||||||
cd->mcn = strdup (field);
|
cdio_log(log_level,
|
||||||
if (NULL != (field = strtok (NULL, " \t\n\r"))) {
|
"%s line %d after word CATALOG:",
|
||||||
cdio_log(log_level, "%d: format error: %s", line_num, keyword);
|
toc_name, line_num);
|
||||||
|
cdio_log(log_level,
|
||||||
|
"Token %s has length %ld. Should be 13 digits.",
|
||||||
|
field, (long int) strlen(field));
|
||||||
|
|
||||||
|
goto err_exit;
|
||||||
|
} else {
|
||||||
|
/* Check that we have all digits*/
|
||||||
|
unsigned int i;
|
||||||
|
for (i=0; i<13; i++) {
|
||||||
|
if (!isdigit(field[i])) {
|
||||||
|
cdio_log(log_level,
|
||||||
|
"%s line %d after word CATALOG:",
|
||||||
|
toc_name, line_num);
|
||||||
|
cdio_log(log_level,
|
||||||
|
"Token %s is not all digits.", field);
|
||||||
|
goto err_exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (NULL != cd) cd->mcn = strdup (field);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
cdio_log(log_level,
|
||||||
|
"%s line %d after word CATALOG:",
|
||||||
|
toc_name, line_num);
|
||||||
|
cdio_log(log_level, "Expecting 13 digits; nothing seen.");
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -547,7 +572,7 @@ parse_tocfile (_img_private_t *cd, const char *toc_name)
|
|||||||
cd->tocent[i].endsize = 0;
|
cd->tocent[i].endsize = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cdio_log(log_level, "%s line %d: format after keyword TRACK.",
|
cdio_log(log_level, "%s line %d after keyword TRACK:",
|
||||||
toc_name, line_num);
|
toc_name, line_num);
|
||||||
cdio_log(log_level, "'%s' not a valid mode.", field);
|
cdio_log(log_level, "'%s' not a valid mode.", field);
|
||||||
goto err_exit;
|
goto err_exit;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# $Id: Makefile.am,v 1.21 2004/05/07 10:57:50 rocky Exp $
|
# $Id: Makefile.am,v 1.22 2004/05/08 20:36:01 rocky Exp $
|
||||||
#
|
#
|
||||||
# Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
# Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
#
|
#
|
||||||
@@ -49,6 +49,7 @@ check_DATA = vcd_demo.right \
|
|||||||
check_opts6.right check_opts7.right \
|
check_opts6.right check_opts7.right \
|
||||||
isofs-m1-read.right cdda-read.right \
|
isofs-m1-read.right cdda-read.right \
|
||||||
t1.toc t2.toc t3.toc t4.toc t5.toc t6.toc t7.toc t8.toc t9.toc \
|
t1.toc t2.toc t3.toc t4.toc t5.toc t6.toc t7.toc t8.toc t9.toc \
|
||||||
|
data1.toc data2.toc data5.toc data6.toc data7.doc \
|
||||||
bad-mode1.toc bad-msf-1.toc bad-msf-2.toc \
|
bad-mode1.toc bad-msf-1.toc bad-msf-2.toc \
|
||||||
copying.iso copying.right
|
copying.iso copying.right
|
||||||
|
|
||||||
|
|||||||
8
test/bad-cat1.toc
Normal file
8
test/bad-cat1.toc
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// $Id: bad-cat1.toc,v 1.1 2004/05/08 20:36:02 rocky Exp $
|
||||||
|
// test catalog number - no catalog after word CATALOG
|
||||||
|
|
||||||
|
CATALOG
|
||||||
|
|
||||||
|
TRACK AUDIO
|
||||||
|
NO COPY
|
||||||
|
FILE "cdda.bin" 1:0:0
|
||||||
8
test/bad-cat2.toc
Normal file
8
test/bad-cat2.toc
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// $Id: bad-cat2.toc,v 1.1 2004/05/08 20:36:02 rocky Exp $
|
||||||
|
// test catalog number. -- not enough digits
|
||||||
|
|
||||||
|
CATALOG "167890123" // Should be 13 digits
|
||||||
|
|
||||||
|
TRACK AUDIO
|
||||||
|
NO COPY
|
||||||
|
FILE "cdda.bin" 1:0:0
|
||||||
8
test/bad-cat3.toc
Normal file
8
test/bad-cat3.toc
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// $Id: bad-cat3.toc,v 1.1 2004/05/08 20:36:02 rocky Exp $
|
||||||
|
// test catalog number - non-digit catalog name
|
||||||
|
|
||||||
|
CATALOG "123456789A123"
|
||||||
|
|
||||||
|
TRACK AUDIO
|
||||||
|
NO COPY
|
||||||
|
FILE "cdda.bin" 1:0:0
|
||||||
8
test/data1.toc
Normal file
8
test/data1.toc
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// $Id: data1.toc,v 1.1 2004/05/08 20:36:02 rocky Exp $
|
||||||
|
// Just a single MODE1 track.
|
||||||
|
|
||||||
|
CD_ROM
|
||||||
|
|
||||||
|
TRACK MODE1
|
||||||
|
SILENCE 0:59:74
|
||||||
|
|
||||||
13
test/data2.toc
Normal file
13
test/data2.toc
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
// $Id
|
||||||
|
// MODE1 track followed by an AUDIO track
|
||||||
|
|
||||||
|
CD_ROM
|
||||||
|
|
||||||
|
TRACK MODE1
|
||||||
|
FILE "isofs-m1.bin" 00:00:00
|
||||||
|
ZERO 1:0:0
|
||||||
|
|
||||||
|
TRACK AUDIO
|
||||||
|
PREGAP 0:2:0
|
||||||
|
FILE "cdda.bin" 00:00:00
|
||||||
|
|
||||||
13
test/data5.toc
Normal file
13
test/data5.toc
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
// $Id: data5.toc,v 1.1 2004/05/08 20:36:02 rocky Exp $
|
||||||
|
// XA disk
|
||||||
|
//
|
||||||
|
|
||||||
|
CD_ROM_XA
|
||||||
|
|
||||||
|
TRACK MODE2_FORM2
|
||||||
|
FILE "vcd_demo.bin" 00:00:00 00:13:57
|
||||||
|
|
||||||
|
TRACK MODE2_FORM1
|
||||||
|
PREGAP 0:2:0
|
||||||
|
FILE "vcd_demo.bin" 00:20:71 00:00:00
|
||||||
|
|
||||||
8
test/data6.toc
Normal file
8
test/data6.toc
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
// $Id: data6.toc,v 1.1 2004/05/08 20:36:02 rocky Exp $
|
||||||
|
// MODE2 track
|
||||||
|
//
|
||||||
|
|
||||||
|
CD_ROM
|
||||||
|
|
||||||
|
TRACK MODE2
|
||||||
|
FILE "vcd_demo.bin" 00:00:00 00:13:57
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: testtoc.c,v 1.1 2004/05/07 10:57:50 rocky Exp $
|
$Id: testtoc.c,v 1.2 2004/05/08 20:36:02 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -38,13 +38,13 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#define NUM_GOOD_TOCS 9
|
#define NUM_GOOD_TOCS 14
|
||||||
#define NUM_BAD_TOCS 3
|
#define NUM_BAD_TOCS 6
|
||||||
int
|
int
|
||||||
main(int argc, const char *argv[])
|
main(int argc, const char *argv[])
|
||||||
{
|
{
|
||||||
const char *toc_file[NUM_GOOD_TOCS] = {
|
const char *toc_file[NUM_GOOD_TOCS] = {
|
||||||
"t1.toc",
|
"t9.toc",
|
||||||
"t2.toc",
|
"t2.toc",
|
||||||
"t3.toc",
|
"t3.toc",
|
||||||
"t4.toc",
|
"t4.toc",
|
||||||
@@ -52,12 +52,20 @@ main(int argc, const char *argv[])
|
|||||||
"t6.toc",
|
"t6.toc",
|
||||||
"t7.toc",
|
"t7.toc",
|
||||||
"t8.toc",
|
"t8.toc",
|
||||||
"t9.toc"
|
"t9.toc",
|
||||||
|
"data1.toc",
|
||||||
|
"data2.toc",
|
||||||
|
"data5.toc",
|
||||||
|
"data6.toc",
|
||||||
|
"data7.toc"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *badtoc_file[NUM_BAD_TOCS] = {
|
const char *badtoc_file[NUM_BAD_TOCS] = {
|
||||||
"bad-msf-1.toc",
|
"bad-msf-1.toc",
|
||||||
"bad-msf-2.toc",
|
"bad-msf-2.toc",
|
||||||
|
"bad-cat1.toc",
|
||||||
|
"bad-cat2.toc",
|
||||||
|
"bad-cat3.toc",
|
||||||
"bad-mode1.toc"
|
"bad-mode1.toc"
|
||||||
};
|
};
|
||||||
int ret=0;
|
int ret=0;
|
||||||
|
|||||||
Reference in New Issue
Block a user