win32.c: was not indicating a failure when reading the TOC failed.
testparanoia.c: better check that there are drives. device.c: I think better checking on drive capability. At least we now check for the TOC failure case and not add a drive there.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: win32.c,v 1.2 2005/01/01 04:17:41 rocky Exp $
|
$Id: win32.c,v 1.3 2005/01/14 19:25:45 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2003, 2004 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char _rcsid[] = "$Id: win32.c,v 1.2 2005/01/01 04:17:41 rocky Exp $";
|
static const char _rcsid[] = "$Id: win32.c,v 1.3 2005/01/14 19:25:45 rocky Exp $";
|
||||||
|
|
||||||
#include <cdio/cdio.h>
|
#include <cdio/cdio.h>
|
||||||
#include <cdio/sector.h>
|
#include <cdio/sector.h>
|
||||||
@@ -432,7 +432,7 @@ read_toc_win32 (void *p_user_data)
|
|||||||
ret = read_toc_win32ioctl( p_env );
|
ret = read_toc_win32ioctl( p_env );
|
||||||
}
|
}
|
||||||
if (ret) p_env->gen.toc_init = true ;
|
if (ret) p_env->gen.toc_init = true ;
|
||||||
return true;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
$Id: device.c,v 1.1 2005/01/09 16:07:46 rocky Exp $
|
$Id: device.c,v 1.2 2005/01/14 19:25:45 rocky Exp $
|
||||||
|
|
||||||
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
|
Copyright (C) 2005 Rocky Bernstein <rocky@panix.com>
|
||||||
|
|
||||||
@@ -420,55 +420,58 @@ cdio_get_devices_with_cap_ret (/*out*/ char* search_devices[],
|
|||||||
cdio_fs_anal_t capabilities, bool any,
|
cdio_fs_anal_t capabilities, bool any,
|
||||||
/*out*/ driver_id_t *p_driver_id)
|
/*out*/ driver_id_t *p_driver_id)
|
||||||
{
|
{
|
||||||
char **drives=search_devices;
|
char **ppsz_drives=search_devices;
|
||||||
char **drives_ret=NULL;
|
char **ppsz_drives_ret=NULL;
|
||||||
unsigned int i_drives=0;
|
unsigned int i_drives=0;
|
||||||
|
|
||||||
*p_driver_id = DRIVER_DEVICE;
|
*p_driver_id = DRIVER_DEVICE;
|
||||||
|
|
||||||
if (NULL == drives) drives=cdio_get_devices_ret(p_driver_id);
|
if (NULL == ppsz_drives) ppsz_drives=cdio_get_devices_ret(p_driver_id);
|
||||||
if (NULL == drives) return NULL;
|
if (NULL == ppsz_drives) return NULL;
|
||||||
|
|
||||||
if (capabilities == CDIO_FS_MATCH_ALL) {
|
if (capabilities == CDIO_FS_MATCH_ALL) {
|
||||||
/* Duplicate drives into drives_ret. */
|
/* Duplicate drives into drives_ret. */
|
||||||
char **d = drives;
|
char **d = ppsz_drives;
|
||||||
|
|
||||||
for( ; *d != NULL; d++ ) {
|
for( ; *d != NULL; d++ ) {
|
||||||
cdio_add_device_list(&drives_ret, *d, &i_drives);
|
cdio_add_device_list(&ppsz_drives_ret, *d, &i_drives);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cdio_fs_anal_t got_fs=0;
|
cdio_fs_anal_t got_fs=0;
|
||||||
cdio_fs_anal_t need_fs = CDIO_FSTYPE(capabilities);
|
cdio_fs_anal_t need_fs = CDIO_FSTYPE(capabilities);
|
||||||
cdio_fs_anal_t need_fs_ext;
|
cdio_fs_anal_t need_fs_ext;
|
||||||
char **d = drives;
|
char **d = ppsz_drives;
|
||||||
need_fs_ext = capabilities & ~CDIO_FS_MASK;
|
need_fs_ext = capabilities & ~CDIO_FS_MASK;
|
||||||
|
|
||||||
for( ; *d != NULL; d++ ) {
|
for( ; *d != NULL; d++ ) {
|
||||||
CdIo_t *cdio = cdio_open(*d, *p_driver_id);
|
CdIo_t *p_cdio = cdio_open(*d, *p_driver_id);
|
||||||
|
|
||||||
if (NULL != cdio) {
|
if (NULL != p_cdio) {
|
||||||
track_t first_track = cdio_get_first_track_num(cdio);
|
track_t i_first_track = cdio_get_first_track_num(p_cdio);
|
||||||
cdio_iso_analysis_t cdio_iso_analysis;
|
cdio_iso_analysis_t cdio_iso_analysis;
|
||||||
got_fs = cdio_guess_cd_type(cdio, 0, first_track,
|
|
||||||
&cdio_iso_analysis);
|
if (CDIO_INVALID_TRACK != i_first_track) {
|
||||||
/* Match on fs and add */
|
got_fs = cdio_guess_cd_type(p_cdio, 0, i_first_track,
|
||||||
if ( (CDIO_FS_UNKNOWN == need_fs || CDIO_FSTYPE(got_fs) == need_fs) )
|
&cdio_iso_analysis);
|
||||||
{
|
/* Match on fs and add */
|
||||||
bool doit = any
|
if ( (CDIO_FS_UNKNOWN == need_fs || CDIO_FSTYPE(got_fs) == need_fs) )
|
||||||
? (got_fs & need_fs_ext) != 0
|
{
|
||||||
: (got_fs | ~need_fs_ext) == -1;
|
bool doit = any
|
||||||
if (doit)
|
? (got_fs & need_fs_ext) != 0
|
||||||
cdio_add_device_list(&drives_ret, *d, &i_drives);
|
: (got_fs | ~need_fs_ext) == -1;
|
||||||
}
|
if (doit)
|
||||||
|
cdio_add_device_list(&ppsz_drives_ret, *d, &i_drives);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cdio_destroy(cdio);
|
cdio_destroy(p_cdio);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cdio_add_device_list(&drives_ret, NULL, &i_drives);
|
cdio_add_device_list(&ppsz_drives_ret, NULL, &i_drives);
|
||||||
cdio_free_device_list(drives);
|
cdio_free_device_list(ppsz_drives);
|
||||||
free(drives);
|
free(ppsz_drives);
|
||||||
return drives_ret;
|
return ppsz_drives_ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ main(int argc, const char *argv[])
|
|||||||
ppsz_cd_drives = cdio_get_devices_with_cap_ret(NULL, CDIO_FS_AUDIO, false,
|
ppsz_cd_drives = cdio_get_devices_with_cap_ret(NULL, CDIO_FS_AUDIO, false,
|
||||||
&driver_id);
|
&driver_id);
|
||||||
|
|
||||||
if (ppsz_cd_drives) {
|
if (ppsz_cd_drives && *ppsz_cd_drives) {
|
||||||
/* Found such a CD-ROM with a CD-DA loaded. Use the first drive in
|
/* Found such a CD-ROM with a CD-DA loaded. Use the first drive in
|
||||||
the list. */
|
the list. */
|
||||||
d=cdda_identify(*ppsz_cd_drives, 1, NULL);
|
d=cdda_identify(*ppsz_cd_drives, 1, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user