diff options
Diffstat (limited to 'src/input')
-rw-r--r-- | src/input/input_cda.c | 22 | ||||
-rw-r--r-- | src/input/input_dvd.c | 29 | ||||
-rw-r--r-- | src/input/input_file.c | 21 | ||||
-rw-r--r-- | src/input/input_http.c | 2 | ||||
-rw-r--r-- | src/input/input_mms.c | 4 | ||||
-rw-r--r-- | src/input/input_net.c | 9 | ||||
-rw-r--r-- | src/input/input_plugin.h | 8 | ||||
-rw-r--r-- | src/input/input_rtp.c | 10 | ||||
-rw-r--r-- | src/input/input_stdin_fifo.c | 28 | ||||
-rw-r--r-- | src/input/input_vcd.c | 24 | ||||
-rw-r--r-- | src/input/mms.c | 4 | ||||
-rw-r--r-- | src/input/mms.h | 4 |
12 files changed, 91 insertions, 74 deletions
diff --git a/src/input/input_cda.c b/src/input/input_cda.c index cec013532..202db5af6 100644 --- a/src/input/input_cda.c +++ b/src/input/input_cda.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_cda.c,v 1.32 2002/09/05 22:18:54 mroi Exp $ + * $Id: input_cda.c,v 1.33 2002/09/06 18:13:10 mroi Exp $ */ #ifdef HAVE_CONFIG_H @@ -1370,15 +1370,16 @@ static void _cda_update_ui_title(cda_input_plugin_t *this) { /* * */ -static int cda_plugin_open (input_plugin_t *this_gen, char *mrl) { +static int cda_plugin_open (input_plugin_t *this_gen, const char *mrl) { cda_input_plugin_t *this = (cda_input_plugin_t *) this_gen; char *filename; _ENTER_FUNC(); - this->mrl = mrl; + free(this->mrl); + this->mrl = strdup(mrl); - if(strncasecmp (mrl, "cda://", 6)) + if(strncasecmp (this->mrl, "cda://", 6)) return 0; if(!_cda_open_cd(this->cda)) { @@ -1395,7 +1396,7 @@ static int cda_plugin_open (input_plugin_t *this_gen, char *mrl) { _cda_cbbd_grab_infos(this); } - filename = (char *) &mrl[6]; + filename = (char *) &this->mrl[6]; if(sscanf(filename, "%d", &this->cda->cur_track) != 1) { LOG_MSG_STDERR(this->xine, _("input_cda: malformed MRL. Use cda://<track #>\n")); @@ -1618,8 +1619,8 @@ static char *cda_plugin_get_identifier (input_plugin_t *this_gen) { /* * Get dir. */ -static xine_mrl_t **cda_plugin_get_dir (input_plugin_t *this_gen, - char *filename, int *nEntries) { +static const xine_mrl_t *const *cda_plugin_get_dir (input_plugin_t *this_gen, + const char *filename, int *nEntries) { cda_input_plugin_t *this = (cda_input_plugin_t *) this_gen; int i; @@ -1694,13 +1695,13 @@ static xine_mrl_t **cda_plugin_get_dir (input_plugin_t *this_gen, _LEAVE_FUNC(); - return this->mrls; + return (const xine_mrl_t *const *)this->mrls; } /* * Get autoplay. */ -static char **cda_plugin_get_autoplay_list (input_plugin_t *this_gen, int *nFiles) { +static const char *const *cda_plugin_get_autoplay_list (input_plugin_t *this_gen, int *nFiles) { cda_input_plugin_t *this = (cda_input_plugin_t *) this_gen; int i; @@ -1742,7 +1743,7 @@ static char **cda_plugin_get_autoplay_list (input_plugin_t *this_gen, int *nFile _LEAVE_FUNC(); - return this->filelist; + return (const char *const *)this->filelist; } /* @@ -1775,6 +1776,7 @@ static void cda_plugin_dispose (input_plugin_t *this_gen ) { _cda_free_cda(this->cda); free (this->cda); + free (this->mrl); free (this->mrls); free (this); } diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index 76aaab973..d756dfb77 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -18,7 +18,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_dvd.c,v 1.76 2002/09/05 22:18:54 mroi Exp $ + * $Id: input_dvd.c,v 1.77 2002/09/06 18:13:10 mroi Exp $ * */ @@ -379,7 +379,7 @@ static void dvdnav_build_mrl_list(dvdnav_input_plugin_t *this) { * dvd:///dev/dvd2:1 - Play Title 1 from /dev/dvd2 * dvd://:1.3 - Play Title 1, program 3 from /dev/dvd */ -static int dvdnav_plugin_open (input_plugin_t *this_gen, char *mrl) { +static int dvdnav_plugin_open (input_plugin_t *this_gen, const char *mrl) { char *locator; int colon_point; dvdnav_input_plugin_t *this = (dvdnav_input_plugin_t *) this_gen; @@ -390,14 +390,15 @@ static int dvdnav_plugin_open (input_plugin_t *this_gen, char *mrl) { trace_print("Called\n"); /* printf("input_dvd: open1: dvdnav=%p opened=%d\n",this->dvdnav, this->opened); */ - this->mrl = mrl; + free(this->mrl); + this->mrl = strdup(mrl); this->pause_timer = 0; this->dvd_name[0] = 0; this->dvd_name_length = 0; /* Check we can handle this MRL */ - if (!strncasecmp (mrl, "dvd://",6)) - locator = &mrl[6]; + if (!strncasecmp (this->mrl, "dvd://",6)) + locator = &this->mrl[6]; else { return 0; } @@ -882,8 +883,8 @@ static uint32_t dvdnav_plugin_get_blocksize (input_plugin_t *this_gen) { return DVD_BLOCK_SIZE; } -static xine_mrl_t **dvdnav_plugin_get_dir (input_plugin_t *this_gen, - char *filename, int *nFiles) { +static const xine_mrl_t *const *dvdnav_plugin_get_dir (input_plugin_t *this_gen, + const char *filename, int *nFiles) { dvdnav_input_plugin_t *this = (dvdnav_input_plugin_t*)this_gen; trace_print("Called\n"); @@ -891,7 +892,7 @@ static xine_mrl_t **dvdnav_plugin_get_dir (input_plugin_t *this_gen, dvdnav_build_mrl_list((dvdnav_input_plugin_t *) this_gen); *nFiles = this->num_mrls; - return this->mrls; + return (const xine_mrl_t *const *)this->mrls; } static int dvdnav_umount_media(char *device) @@ -1304,8 +1305,8 @@ static int dvdnav_plugin_get_optional_data (input_plugin_t *this_gen, return INPUT_OPTIONAL_UNSUPPORTED; } -static char **dvdnav_plugin_get_autoplay_list (input_plugin_t *this_gen, - int *nFiles) { +static const char *const *dvdnav_plugin_get_autoplay_list (input_plugin_t *this_gen, + int *nFiles) { dvdnav_input_plugin_t *this = (dvdnav_input_plugin_t *) this_gen; dvdnav_status_t res; int titles, i; @@ -1343,12 +1344,13 @@ static char **dvdnav_plugin_get_autoplay_list (input_plugin_t *this_gen, printf("input_dvd: get_autoplay_list exiting opened=%d dvdnav=%p\n",this->opened, this->dvdnav); #endif - return filelist2; + return (const char *const *)filelist2; } void dvdnav_plugin_dispose(input_plugin_t *this_gen) { dvdnav_input_plugin_t *this = (dvdnav_input_plugin_t*)this_gen; pthread_mutex_destroy(&this->buf_mutex); + free(this->mrl); this->mrl = NULL; free(this->mrls); this->mrls = NULL; } @@ -1421,6 +1423,7 @@ static void *init_input_plugin (xine_t *xine, void *data) { this->typed_buttonN = 0; this->dvd_name[0] = 0; this->dvd_name_length = 0; + this->mrl = NULL; this->mrls = NULL; this->num_mrls = 0; @@ -1496,6 +1499,10 @@ static void *init_input_plugin (xine_t *xine, void *data) { /* * $Log: input_dvd.c,v $ + * Revision 1.77 2002/09/06 18:13:10 mroi + * introduce "const" + * fix some input plugins that would not copy the mrl on open + * * Revision 1.76 2002/09/05 22:18:54 mroi * remove plugin's private priority and interface members * adapt some more decoders diff --git a/src/input/input_file.c b/src/input/input_file.c index 42bd3a80d..d0a522fef 100644 --- a/src/input/input_file.c +++ b/src/input/input_file.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_file.c,v 1.56 2002/09/05 22:18:54 mroi Exp $ + * $Id: input_file.c,v 1.57 2002/09/06 18:13:11 mroi Exp $ */ #ifdef HAVE_CONFIG_H @@ -98,7 +98,7 @@ typedef struct { config_values_t *config; int mrls_allocated_entries; - xine_mrl_t **mrls; + xine_mrl_t **mrls; } file_input_plugin_t; @@ -272,7 +272,7 @@ static uint32_t file_plugin_get_capabilities (input_plugin_t *this_gen) { /* * */ -static int file_plugin_open (input_plugin_t *this_gen, char *mrl) { +static int file_plugin_open (input_plugin_t *this_gen, const char *mrl) { char *filename, *subtitle; file_input_plugin_t *this = (file_input_plugin_t *) this_gen; @@ -427,12 +427,12 @@ static int is_a_dir(char *filepathname) { /* * */ -static xine_mrl_t **file_plugin_get_dir (input_plugin_t *this_gen, - char *filename, int *nFiles) { +static const xine_mrl_t *const *file_plugin_get_dir (input_plugin_t *this_gen, + const char *filename, int *nFiles) { file_input_plugin_t *this = (file_input_plugin_t *) this_gen; struct dirent *pdirent; DIR *pdir; - xine_mrl_t *hide_files, *dir_files, *norm_files; + xine_mrl_t *hide_files, *dir_files, *norm_files; char current_dir[XINE_PATH_MAX + 1]; char current_dir_slashed[XINE_PATH_MAX + 1]; char fullfilename[XINE_PATH_MAX + XINE_NAME_MAX + 1]; @@ -453,12 +453,11 @@ static xine_mrl_t **file_plugin_get_dir (input_plugin_t *this_gen, snprintf(current_dir, XINE_PATH_MAX, "%s", this->origin_path); } else { - /* Remove exceed '/' */ - while((filename[strlen(filename) - 1] == '/') && strlen(filename) > 1) - filename[strlen(filename) - 1] = '\0'; - snprintf(current_dir, XINE_PATH_MAX, "%s", filename); + /* Remove exceed '/' */ + while((current_dir[strlen(current_dir) - 1] == '/') && strlen(current_dir) > 1) + current_dir[strlen(current_dir) - 1] = '\0'; } /* Store new origin path */ @@ -741,7 +740,7 @@ static xine_mrl_t **file_plugin_get_dir (input_plugin_t *this_gen, } */ - return this->mrls; + return (const xine_mrl_t *const *)this->mrls; } /* diff --git a/src/input/input_http.c b/src/input/input_http.c index 954c8d2e0..1ebbf0f2f 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -290,7 +290,7 @@ static int http_plugin_basicauth (const char *user, const char *password, static off_t http_plugin_read (input_plugin_t *this_gen, char *buf, off_t nlen) ; -static int http_plugin_open (input_plugin_t *this_gen, char *mrl) { +static int http_plugin_open (input_plugin_t *this_gen, const char *mrl) { http_input_plugin_t *this = (http_input_plugin_t *) this_gen; char *proxy; diff --git a/src/input/input_mms.c b/src/input/input_mms.c index d18a568cb..486278015 100644 --- a/src/input/input_mms.c +++ b/src/input/input_mms.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_mms.c,v 1.18 2002/09/05 22:18:55 mroi Exp $ + * $Id: input_mms.c,v 1.19 2002/09/06 18:13:11 mroi Exp $ * * mms input plugin based on work from major mms */ @@ -71,7 +71,7 @@ typedef struct { } mms_input_plugin_t; -static int mms_plugin_open (input_plugin_t *this_gen, char *mrl) { +static int mms_plugin_open (input_plugin_t *this_gen, const char *mrl) { mms_input_plugin_t *this = (mms_input_plugin_t *) this_gen; #ifdef LOG diff --git a/src/input/input_net.c b/src/input/input_net.c index 9df193864..a4afe2375 100644 --- a/src/input/input_net.c +++ b/src/input/input_net.c @@ -139,13 +139,14 @@ static int host_connect(const char *host, int port, xine_t *xine) { return -1; } -static int net_plugin_open (input_plugin_t *this_gen, char *mrl) { +static int net_plugin_open (input_plugin_t *this_gen, const char *mrl) { net_input_plugin_t *this = (net_input_plugin_t *) this_gen; char *filename; char *pptr; int port = 7658; - this->mrl = strdup(mrl); /* FIXME: small memory leak */ + free(this->mrl); + this->mrl = strdup(mrl); if (!strncasecmp (mrl, "tcp://", 6)) { filename = (char *) &this->mrl[6]; @@ -170,8 +171,6 @@ static int net_plugin_open (input_plugin_t *this_gen, char *mrl) { return 0; } - this->mrl = strdup(mrl); /* FIXME: small memory leak */ - this->nbc = nbc_init (this->xine); return 1; @@ -328,6 +327,8 @@ static int net_plugin_get_optional_data (input_plugin_t *this_gen, } static void net_plugin_dispose (input_plugin_t *this_gen ) { + net_input_plugin_t *this = (net_input_plugin_t *) this_gen; + free (this->mrl); free (this_gen); } diff --git a/src/input/input_plugin.h b/src/input/input_plugin.h index 0131e211c..039f11962 100644 --- a/src/input/input_plugin.h +++ b/src/input/input_plugin.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_plugin.h,v 1.29 2002/09/05 22:18:55 mroi Exp $ + * $Id: input_plugin.h,v 1.30 2002/09/06 18:13:11 mroi Exp $ */ #ifndef HAVE_INPUT_PLUGIN_H @@ -150,7 +150,7 @@ struct input_plugin_s /* * open input MRL - return 1 if succ */ - int (*open) (input_plugin_t *this, char *mrl); + int (*open) (input_plugin_t *this, const char *mrl); /* @@ -199,7 +199,7 @@ struct input_plugin_s * ls function * return value: NULL => filename is a file, **char=> filename is a dir */ - xine_mrl_t** (*get_dir) (input_plugin_t *this, char *filename, int *nFiles); + const xine_mrl_t *const * (*get_dir) (input_plugin_t *this, const char *filename, int *nFiles); /* @@ -246,7 +246,7 @@ struct input_plugin_s * generate autoplay list * return value: list of MRLs */ - char** (*get_autoplay_list) (input_plugin_t *this, int *nFiles); + const char *const * (*get_autoplay_list) (input_plugin_t *this, int *nFiles); /* diff --git a/src/input/input_rtp.c b/src/input/input_rtp.c index f61b649c8..e576e6f53 100644 --- a/src/input/input_rtp.c +++ b/src/input/input_rtp.c @@ -288,7 +288,7 @@ static void * input_plugin_read_loop(void *arg) { /* * */ -static int rtp_plugin_open (input_plugin_t *this_gen, char *mrl ) { +static int rtp_plugin_open (input_plugin_t *this_gen, const char *mrl ) { rtp_input_plugin_t *this = (rtp_input_plugin_t *) this_gen; char *filename; char *pptr; @@ -296,10 +296,11 @@ static int rtp_plugin_open (input_plugin_t *this_gen, char *mrl ) { pthread_attr_t thread_attrs; int err; - this->mrl = mrl; + free(this->mrl); + this->mrl = strdup(mrl); - if ((!strncmp (mrl, "rtp://", 6)) || (!strncmp (mrl, "udp://", 6))) { - filename = &mrl[6]; + if ((!strncmp (this->mrl, "rtp://", 6)) || (!strncmp (this->mrl, "udp://", 6))) { + filename = &this->mrl[6]; if((!filename) || (strlen(filename) == 0)) return 0; @@ -497,6 +498,7 @@ static void rtp_plugin_dispose (input_plugin_t *this_gen ) { free (buf); } + free (this->mrl); free (this); } diff --git a/src/input/input_stdin_fifo.c b/src/input/input_stdin_fifo.c index dd9f26da3..917fdafc4 100644 --- a/src/input/input_stdin_fifo.c +++ b/src/input/input_stdin_fifo.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_stdin_fifo.c,v 1.31 2002/09/05 22:18:55 mroi Exp $ + * $Id: input_stdin_fifo.c,v 1.32 2002/09/06 18:13:11 mroi Exp $ */ #ifdef HAVE_CONFIG_H @@ -75,7 +75,7 @@ typedef struct { static off_t stdin_plugin_read (input_plugin_t *this_gen, char *buf, off_t todo) ; -static int stdin_plugin_open(input_plugin_t *this_gen, char *mrl) { +static int stdin_plugin_open(input_plugin_t *this_gen, const char *mrl) { stdin_input_plugin_t *this = (stdin_input_plugin_t *) this_gen; char *filename; char *pfn; @@ -85,30 +85,31 @@ static int stdin_plugin_open(input_plugin_t *this_gen, char *mrl) { mrl); #endif - this->mrl = mrl; + free(this->mrl); + this->mrl = strdup(mrl); - if (!strncasecmp(mrl, "stdin://", 8) - || !strncmp(mrl, "-", 1)) { + if (!strncasecmp(this->mrl, "stdin://", 8) + || !strncmp(this->mrl, "-", 1)) { #if defined(CONFIG_DEVFS_FS) filename = "/dev/vc/stdin"; #else filename = "/dev/stdin"; #endif - } else if(!strncasecmp(mrl, "fifo://", 7)) { + } else if(!strncasecmp(this->mrl, "fifo://", 7)) { - if ((pfn = strrchr((mrl + 7), ':')) != NULL) { + if ((pfn = strrchr((this->mrl + 7), ':')) != NULL) { filename = ++pfn; } else { - if (!(strncasecmp(mrl + 7, "mpeg1", 5)) - || (!(strncasecmp(mrl + 7, "mpeg2", 5)))) { - filename = (char *) &mrl[12]; + if (!(strncasecmp(this->mrl + 7, "mpeg1", 5)) + || (!(strncasecmp(this->mrl + 7, "mpeg2", 5)))) { + filename = (char *) &this->mrl[12]; } else { - filename = (char *) &mrl[7]; + filename = (char *) &this->mrl[7]; } } } else { @@ -343,7 +344,10 @@ static int stdin_plugin_get_optional_data (input_plugin_t *this_gen, } static void stdin_plugin_dispose (input_plugin_t *this_gen ) { - free (this_gen); + stdin_input_plugin_t *this = (stdin_input_plugin_t *) this_gen; + + free (this->mrl); + free (this); } diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c index b875ea277..7db42ae72 100644 --- a/src/input/input_vcd.c +++ b/src/input/input_vcd.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: input_vcd.c,v 1.50 2002/09/05 22:18:55 mroi Exp $ + * $Id: input_vcd.c,v 1.51 2002/09/06 18:13:11 mroi Exp $ * */ @@ -341,13 +341,14 @@ static int sun_vcd_read(vcd_input_plugin_t *this, long lba, cdsector_t *data) /* * */ -static int vcd_plugin_open (input_plugin_t *this_gen, char *mrl) { +static int vcd_plugin_open (input_plugin_t *this_gen, const char *mrl) { vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; char *filename; - this->mrl = mrl; + free(this->mrl); + this->mrl = strdup(mrl); - if (strncasecmp (mrl, "vcd://",6)) + if (strncasecmp (this->mrl, "vcd://",6)) return 0; this->fd = open (this->device, O_RDONLY); @@ -362,7 +363,7 @@ static int vcd_plugin_open (input_plugin_t *this_gen, char *mrl) { return 0; } - filename = (char *) &mrl[6]; + filename = (char *) &this->mrl[6]; if (sscanf (filename, "%d", &this->cur_track) != 1) { LOG_MSG_STDERR(this->xine, _("input_vcd: malformed MRL. Use vcd://<track #>\n")); @@ -973,8 +974,8 @@ static char *vcd_plugin_get_identifier (input_plugin_t *this_gen) { /* * */ -static xine_mrl_t **vcd_plugin_get_dir (input_plugin_t *this_gen, - char *filename, int *nEntries) { +static const xine_mrl_t *const *vcd_plugin_get_dir (input_plugin_t *this_gen, + const char *filename, int *nEntries) { vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; int i; @@ -1053,14 +1054,14 @@ static xine_mrl_t **vcd_plugin_get_dir (input_plugin_t *this_gen, this->mrls[*nEntries] = NULL; - return this->mrls; + return (const xine_mrl_t *const *)this->mrls; } /* * */ -static char **vcd_plugin_get_autoplay_list (input_plugin_t *this_gen, - int *nFiles) { +static const char *const *vcd_plugin_get_autoplay_list (input_plugin_t *this_gen, + int *nFiles) { vcd_input_plugin_t *this = (vcd_input_plugin_t *) this_gen; int i; @@ -1100,7 +1101,7 @@ static char **vcd_plugin_get_autoplay_list (input_plugin_t *this_gen, this->filelist[i - 1] = (char *) realloc(this->filelist[i-1], sizeof(char *)); this->filelist[i - 1] = NULL; - return this->filelist; + return (const char *const *)this->filelist; } /* @@ -1129,6 +1130,7 @@ static void vcd_plugin_dispose (input_plugin_t *this_gen ) { free (this->filelist[i]); free (this->mrls); + free (this->mrl); free (this); } diff --git a/src/input/mms.c b/src/input/mms.c index 8adc9cb0f..235631adb 100644 --- a/src/input/mms.c +++ b/src/input/mms.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: mms.c,v 1.9 2002/06/07 07:00:59 tmattern Exp $ + * $Id: mms.c,v 1.10 2002/09/06 18:13:11 mroi Exp $ * * based on work from major mms * utility functions to handle communication with an mms server @@ -616,7 +616,7 @@ void mms_gen_guid(char guid[]) { guid[36] = '\0'; } -mms_t *mms_connect (char *url_) { +mms_t *mms_connect (const char *url_) { mms_t *this; char *url = NULL; char *url1 = NULL; diff --git a/src/input/mms.h b/src/input/mms.h index daecff93f..9e535315a 100644 --- a/src/input/mms.h +++ b/src/input/mms.h @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: mms.h,v 1.5 2002/05/06 21:40:02 f1rmb Exp $ + * $Id: mms.h,v 1.6 2002/09/06 18:13:11 mroi Exp $ * * libmms public header */ @@ -30,7 +30,7 @@ typedef struct mms_s mms_t; char* mms_connect_common(int *s ,int *port, char *url, char **host, char **path, char **file); -mms_t* mms_connect (char *url); +mms_t* mms_connect (const char *url); int mms_read (mms_t *this, char *data, int len); uint32_t mms_get_length (mms_t *this); |