From d97137d6edff4568ffee1ebd4425b73176f2af66 Mon Sep 17 00:00:00 2001 From: rocky Date: Sat, 27 Aug 2005 14:28:30 +0000 Subject: [PATCH] Get device name if none supplied in cdio_cddap_indentify. Check for more error conditions and update doc to reflect that the error return is NULL. --- lib/cdda_interface/scan_devices.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/lib/cdda_interface/scan_devices.c b/lib/cdda_interface/scan_devices.c index 0ff2147a..dbd62dab 100644 --- a/lib/cdda_interface/scan_devices.c +++ b/lib/cdda_interface/scan_devices.c @@ -1,5 +1,5 @@ /* - $Id: scan_devices.c,v 1.28 2005/04/30 07:15:51 rocky Exp $ + $Id: scan_devices.c,v 1.29 2005/08/27 14:28:30 rocky Exp $ Copyright (C) 2004, 2005 Rocky Bernstein Copyright (C) 1998 Monty xiphmont@mit.edu @@ -150,7 +150,8 @@ test_resolve_symlink(const char *file, int messagedest, char **ppsz_messages) } #endif -/** Returns a paranoia CD-ROM drive object with a CD-DA in it. +/** Returns a paranoia CD-ROM drive object with a CD-DA in it or NULL + if there was an error. @see cdio_cddap_identify_cdio */ cdrom_drive_t * @@ -181,15 +182,21 @@ char **ppsz_messages) #endif p_cdio = cdio_open(psz_dev, DRIVER_UNKNOWN); - return cdda_identify_device_cdio(p_cdio, psz_dev, messagedest, - ppsz_messages); + if (p_cdio) { + if (!psz_dev) { + psz_dev = cdio_get_arg(p_cdio, "source"); + } + return cdda_identify_device_cdio(p_cdio, psz_dev, messagedest, + ppsz_messages); + } + return NULL; } -/** Returns a paranoia CD-ROM drive object with a CD-DA in it. In - contrast to cdio_cddap_identify, we start out with an initialized - p_cdio object. For example you may have used that for other - purposes such as to get CDDB/CD-Text information. @see - cdio_cddap_identify +/** Returns a paranoia CD-ROM drive object with a CD-DA in it or NULL + if there was an error. In contrast to cdio_cddap_identify, we + start out with an initialized p_cdio object. For example you may + have used that for other purposes such as to get CDDB/CD-Text + information. @see cdio_cddap_identify */ cdrom_drive_t * cdio_cddap_identify_cdio(CdIo_t *p_cdio, int messagedest, char **ppsz_messages)