diff options
author | František Dvořák <valtri@users.sourceforge.net> | 2004-04-10 17:41:44 +0000 |
---|---|---|
committer | František Dvořák <valtri@users.sourceforge.net> | 2004-04-10 17:41:44 +0000 |
commit | 6c9b4d3d60563bebad18ee653a638d9e38381a07 (patch) | |
tree | f72cefe154f259e4d9ee9ca54f087bdc2fc0c4f4 /src/input/input_cdda.c | |
parent | 75a3e6582d0570541b1f6bdc54821b7550721128 (diff) | |
download | xine-lib-6c9b4d3d60563bebad18ee653a638d9e38381a07.tar.gz xine-lib-6c9b4d3d60563bebad18ee653a638d9e38381a07.tar.bz2 |
Permit (but not recommend) stream == NULL in io_helper functions.
CVS patchset: 6385
CVS date: 2004/04/10 17:41:44
Diffstat (limited to 'src/input/input_cdda.c')
-rw-r--r-- | src/input/input_cdda.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index 5e4f33d4f..5985b36fe 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -20,7 +20,7 @@ * Compact Disc Digital Audio (CDDA) Input Plugin * by Mike Melanson (melanson@pcisys.net) * - * $Id: input_cdda.c,v 1.49 2004/04/10 15:45:10 mroi Exp $ + * $Id: input_cdda.c,v 1.50 2004/04/10 17:41:44 valtri Exp $ */ #ifdef HAVE_CONFIG_H @@ -894,13 +894,15 @@ static int network_command( xine_stream_t *stream, int socket, char *data_buf, c if( _x_io_tcp_write(stream, socket, buf, strlen(buf)) < (int)strlen(buf) ) { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "input_cdda: error writing to socket.\n"); + if (stream) + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "input_cdda: error writing to socket.\n"); return -1; } if (_x_io_tcp_read_line(stream, socket, buf, _BUFSIZ) <= 0) { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "input_cdda: error reading from socket.\n"); + if (stream) + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "input_cdda: error reading from socket.\n"); return -1; } @@ -908,8 +910,9 @@ static int network_command( xine_stream_t *stream, int socket, char *data_buf, c if( n ) { if( !data_buf ) { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, - "input_cdda: protocol error, data returned but no buffer provided.\n"); + if (stream) + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, + "input_cdda: protocol error, data returned but no buffer provided.\n"); return -1; } if ( _x_io_tcp_read(stream, socket, data_buf, n) < n ) @@ -959,7 +962,8 @@ static int network_read_cdrom_toc(xine_stream_t *stream, int fd, cdrom_toc *toc) /* fetch the table of contents */ if( network_command(stream, fd, buf, "cdda_tochdr" ) == -1) { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "input_cdda: network CDROMREADTOCHDR error.\n"); + if (stream) + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "input_cdda: network CDROMREADTOCHDR error.\n"); return -1; } @@ -979,7 +983,8 @@ static int network_read_cdrom_toc(xine_stream_t *stream, int fd, cdrom_toc *toc) /* fetch the table of contents */ if( network_command( stream, fd, buf, "cdda_tocentry %d", i ) == -1) { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "input_cdda: network CDROMREADTOCENTRY error.\n"); + if (stream) + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "input_cdda: network CDROMREADTOCENTRY error.\n"); return -1; } @@ -996,7 +1001,8 @@ static int network_read_cdrom_toc(xine_stream_t *stream, int fd, cdrom_toc *toc) /* fetch the leadout as well */ if( network_command( stream, fd, buf, "cdda_tocentry %d", CD_LEADOUT_TRACK ) == -1) { - xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "input_cdda: network CDROMREADTOCENTRY error.\n"); + if (stream) + xprintf(stream->xine, XINE_VERBOSITY_DEBUG, "input_cdda: network CDROMREADTOCENTRY error.\n"); return -1; } @@ -2218,15 +2224,14 @@ static char ** cdda_class_get_autoplay_list (input_class_t *this_gen, * gets called, before a plugin instance has been created; * let's create a dummy instance in such a condition */ ip = (cdda_input_plugin_t *)xine_xmalloc(sizeof(cdda_input_plugin_t)); + ip->stream = NULL; #ifndef WIN32 if( strchr(this->cdda_device,':') ) { - ip->stream = xine_stream_new(this->xine, NULL, NULL); fd = network_connect(ip->stream, this->cdda_device); if( fd != -1 ) { err = network_read_cdrom_toc(ip->stream, fd, toc); } - xine_dispose(ip->stream); } #endif |