Bug in get_drive_types_with_cap: Had wrong boolean logic.

This commit is contained in:
rocky
2006-03-26 20:47:55 +00:00
parent 1fe161aad3
commit 8b24c3a47e
3 changed files with 13 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
/* /*
$Id: cd_types.h,v 1.14 2006/02/13 08:44:17 rocky Exp $ $Id: cd_types.h,v 1.15 2006/03/26 20:47:55 rocky Exp $
Copyright (C) 2003, 2006 Rocky Bernstein <rocky@panix.com> Copyright (C) 2003, 2006 Rocky Bernstein <rocky@panix.com>
Copyright (C) 1996,1997,1998 Gerd Knorr <kraxel@bytesex.org> Copyright (C) 1996,1997,1998 Gerd Knorr <kraxel@bytesex.org>
@@ -52,7 +52,7 @@ extern "C" {
/**< /**<
* EXT2 was the GNU/Linux native filesystem for early kernels. Newer * EXT2 was the GNU/Linux native filesystem for early kernels. Newer
* GNU/Linux OS's may use EXT3 which EXT2 with a journal. * GNU/Linux OS's may use EXT3 which is EXT2 with a journal.
*/ */
CDIO_FS_EXT2 = 7, CDIO_FS_EXT2 = 7,

View File

@@ -1,5 +1,5 @@
/* /*
$Id: device.c,v 1.35 2006/02/27 10:29:20 flameeyes Exp $ $Id: device.c,v 1.36 2006/03/26 20:47:55 rocky Exp $
Copyright (C) 2005, 2006 Rocky Bernstein <rocky@panix.com> Copyright (C) 2005, 2006 Rocky Bernstein <rocky@panix.com>
@@ -606,9 +606,7 @@ cdio_get_devices_with_cap_ret (/*in*/ char* search_devices[],
} 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;
char **d = ppsz_drives; char **d = ppsz_drives;
need_fs_ext = capabilities & ~CDIO_FS_MASK;
for( ; *d != NULL; d++ ) { for( ; *d != NULL; d++ ) {
CdIo_t *p_cdio = cdio_open(*d, *p_driver_id); CdIo_t *p_cdio = cdio_open(*d, *p_driver_id);
@@ -621,11 +619,9 @@ cdio_get_devices_with_cap_ret (/*in*/ char* search_devices[],
got_fs = cdio_guess_cd_type(p_cdio, 0, i_first_track, got_fs = cdio_guess_cd_type(p_cdio, 0, i_first_track,
&cdio_iso_analysis); &cdio_iso_analysis);
/* Match on fs and add */ /* Match on fs and add */
if ( (CDIO_FS_UNKNOWN == need_fs || CDIO_FSTYPE(got_fs) == need_fs) ) if ( (CDIO_FS_UNKNOWN == need_fs || CDIO_FSTYPE(got_fs & need_fs)) )
{ {
bool doit = any bool doit = any ? true : (got_fs & need_fs) == need_fs;
? (got_fs & need_fs_ext) != 0
: (got_fs | ~need_fs_ext) == -1;
if (doit) if (doit)
cdio_add_device_list(&ppsz_drives_ret, *d, &i_drives); cdio_add_device_list(&ppsz_drives_ret, *d, &i_drives);
} }

View File

@@ -1,4 +1,4 @@
/* $Id: testisocd.c,v 1.1 2006/03/26 15:05:21 rocky Exp $ /* $Id: testisocd.c,v 1.2 2006/03/26 20:47:55 rocky Exp $
Copyright (C) 2003, 2004, 2005, 2006 Rocky Bernstein Copyright (C) 2003, 2004, 2005, 2006 Rocky Bernstein
<rockyb@users.sourceforge.net> <rockyb@users.sourceforge.net>
@@ -64,8 +64,13 @@ main(int argc, const char *argv[])
/* See if we can find a device with a loaded CD-DA in it. If successful /* See if we can find a device with a loaded CD-DA in it. If successful
drive_id will be set. */ drive_id will be set. */
ppsz_cd_drives = cdio_get_devices_with_cap_ret(NULL, CDIO_FS_ISO_9660, false, ppsz_cd_drives =
&driver_id); cdio_get_devices_with_cap_ret(NULL,
(CDIO_FS_ISO_9660
|CDIO_FS_ISO_HFS
|CDIO_FS_ISO_9660_INTERACTIVE),
true,
&driver_id);
if (ppsz_cd_drives && ppsz_cd_drives[0]) { if (ppsz_cd_drives && ppsz_cd_drives[0]) {
/* Found such a CD-ROM with an ISO 9660 filesystem. Use the first drive in /* Found such a CD-ROM with an ISO 9660 filesystem. Use the first drive in