diff --git a/lib/driver/MSWindows/win32.c b/lib/driver/MSWindows/win32.c index 1bcd0fdf..c7433197 100644 --- a/lib/driver/MSWindows/win32.c +++ b/lib/driver/MSWindows/win32.c @@ -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 @@ -26,7 +26,7 @@ # include "config.h" #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 #include @@ -432,7 +432,7 @@ read_toc_win32 (void *p_user_data) ret = read_toc_win32ioctl( p_env ); } if (ret) p_env->gen.toc_init = true ; - return true; + return ret; } /*! diff --git a/lib/driver/device.c b/lib/driver/device.c index 02ca972b..c3784f95 100644 --- a/lib/driver/device.c +++ b/lib/driver/device.c @@ -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 @@ -420,55 +420,58 @@ cdio_get_devices_with_cap_ret (/*out*/ char* search_devices[], cdio_fs_anal_t capabilities, bool any, /*out*/ driver_id_t *p_driver_id) { - char **drives=search_devices; - char **drives_ret=NULL; + char **ppsz_drives=search_devices; + char **ppsz_drives_ret=NULL; unsigned int i_drives=0; *p_driver_id = DRIVER_DEVICE; - if (NULL == drives) drives=cdio_get_devices_ret(p_driver_id); - if (NULL == drives) return NULL; + if (NULL == ppsz_drives) ppsz_drives=cdio_get_devices_ret(p_driver_id); + if (NULL == ppsz_drives) return NULL; if (capabilities == CDIO_FS_MATCH_ALL) { /* Duplicate drives into drives_ret. */ - char **d = drives; + char **d = ppsz_drives; for( ; *d != NULL; d++ ) { - cdio_add_device_list(&drives_ret, *d, &i_drives); + cdio_add_device_list(&ppsz_drives_ret, *d, &i_drives); } } else { cdio_fs_anal_t got_fs=0; cdio_fs_anal_t need_fs = CDIO_FSTYPE(capabilities); cdio_fs_anal_t need_fs_ext; - char **d = drives; + char **d = ppsz_drives; need_fs_ext = capabilities & ~CDIO_FS_MASK; 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) { - track_t first_track = cdio_get_first_track_num(cdio); + if (NULL != p_cdio) { + track_t i_first_track = cdio_get_first_track_num(p_cdio); cdio_iso_analysis_t cdio_iso_analysis; - got_fs = cdio_guess_cd_type(cdio, 0, first_track, - &cdio_iso_analysis); - /* Match on fs and add */ - if ( (CDIO_FS_UNKNOWN == need_fs || CDIO_FSTYPE(got_fs) == need_fs) ) - { - bool doit = any - ? (got_fs & need_fs_ext) != 0 - : (got_fs | ~need_fs_ext) == -1; - if (doit) - cdio_add_device_list(&drives_ret, *d, &i_drives); - } + + if (CDIO_INVALID_TRACK != i_first_track) { + got_fs = cdio_guess_cd_type(p_cdio, 0, i_first_track, + &cdio_iso_analysis); + /* Match on fs and add */ + if ( (CDIO_FS_UNKNOWN == need_fs || CDIO_FSTYPE(got_fs) == need_fs) ) + { + bool doit = any + ? (got_fs & need_fs_ext) != 0 + : (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_free_device_list(drives); - free(drives); - return drives_ret; + cdio_add_device_list(&ppsz_drives_ret, NULL, &i_drives); + cdio_free_device_list(ppsz_drives); + free(ppsz_drives); + return ppsz_drives_ret; } /*! diff --git a/test/testparanoia.c b/test/testparanoia.c index 7a7f230b..fd348790 100644 --- a/test/testparanoia.c +++ b/test/testparanoia.c @@ -66,7 +66,7 @@ main(int argc, const char *argv[]) ppsz_cd_drives = cdio_get_devices_with_cap_ret(NULL, CDIO_FS_AUDIO, false, &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 the list. */ d=cdda_identify(*ppsz_cd_drives, 1, NULL);