summaryrefslogtreecommitdiff
path: root/src/input/vcd/libcdio/_cdio_generic.c
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2004-04-11 12:20:31 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2004-04-11 12:20:31 +0000
commitc4e423537d77267ff859f20cefcbeaa4817d7199 (patch)
tree60bf60d3735d39384b35936a89a71b8223bf4a4a /src/input/vcd/libcdio/_cdio_generic.c
parent79c5f9914c6476d31d64b85d0d34b31644732672 (diff)
downloadxine-lib-c4e423537d77267ff859f20cefcbeaa4817d7199.tar.gz
xine-lib-c4e423537d77267ff859f20cefcbeaa4817d7199.tar.bz2
libvcd 0.7.20, libcdio 0.68
CVS patchset: 6388 CVS date: 2004/04/11 12:20:31
Diffstat (limited to 'src/input/vcd/libcdio/_cdio_generic.c')
-rw-r--r--src/input/vcd/libcdio/_cdio_generic.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/input/vcd/libcdio/_cdio_generic.c b/src/input/vcd/libcdio/_cdio_generic.c
index 180de1086..1328fb2a7 100644
--- a/src/input/vcd/libcdio/_cdio_generic.c
+++ b/src/input/vcd/libcdio/_cdio_generic.c
@@ -1,8 +1,8 @@
/*
- $Id: _cdio_generic.c,v 1.1 2003/10/13 11:47:11 f1rmb Exp $
+ $Id: _cdio_generic.c,v 1.2 2004/04/11 12:20:31 miguelfreitas Exp $
Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org>
- Copyright (C) 2002,2003 Rocky Bernstein <rocky@panix.com>
+ Copyright (C) 2002, 2003, 2004 Rocky Bernstein <rocky@panix.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@
# include "config.h"
#endif
-static const char _rcsid[] = "$Id: _cdio_generic.c,v 1.1 2003/10/13 11:47:11 f1rmb Exp $";
+static const char _rcsid[] = "$Id: _cdio_generic.c,v 1.2 2004/04/11 12:20:31 miguelfreitas Exp $";
#include <stdio.h>
#include <stdlib.h>
@@ -126,7 +126,7 @@ cdio_generic_read (void *user_data, void *buf, size_t size)
Release and free resources associated with stream or disk image.
*/
void
-cdio_generic_stream_free (void *user_data)
+cdio_generic_stdio_free (void *user_data)
{
generic_img_private_t *_obj = user_data;
@@ -134,9 +134,7 @@ cdio_generic_stream_free (void *user_data)
free (_obj->source_name);
if (_obj->data_source)
- cdio_stream_destroy (_obj->data_source);
-
- free (_obj);
+ cdio_stdio_destroy (_obj->data_source);
}
@@ -177,17 +175,31 @@ cdio_add_device_list(char **device_list[], const char *drive, int *num_drives)
{
if (NULL != drive) {
unsigned int j;
+
+ /* Check if drive is already in list. */
for (j=0; j<*num_drives; j++) {
if (strcmp((*device_list)[j], drive) == 0) break;
}
+
if (j==*num_drives) {
+ /* Drive not in list. Add it. */
(*num_drives)++;
- *device_list = realloc(*device_list, (*num_drives) * sizeof(char *));
+ if (*device_list) {
+ *device_list = realloc(*device_list, (*num_drives) * sizeof(char *));
+ } else {
+ /* num_drives should be 0. Add assert? */
+ *device_list = malloc((*num_drives) * sizeof(char *));
+ }
+
(*device_list)[*num_drives-1] = strdup(drive);
}
} else {
(*num_drives)++;
- *device_list = realloc(*device_list, (*num_drives) * sizeof(char *));
+ if (*device_list) {
+ *device_list = realloc(*device_list, (*num_drives) * sizeof(char *));
+ } else {
+ *device_list = malloc((*num_drives) * sizeof(char *));
+ }
(*device_list)[*num_drives-1] = NULL;
}
}