From 9da4e2dde0da695c240cf48390217ac97cb10c1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Wed, 19 Dec 2007 02:59:06 +0100 Subject: Update all the code to the new headers layout. --- src/input/input_dvb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/input/input_dvb.c') diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 1151d9a81..b35f35fa6 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -113,9 +113,9 @@ #define LOG_READS */ -#include "xine_internal.h" -#include "xineutils.h" -#include "input_plugin.h" +#include +#include +#include #include "net_buf_ctrl.h" #define BUFSIZE 16384 -- cgit v1.2.3 From 353b351017e8de11269112e621911d891ed7a305 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Wed, 19 Dec 2007 11:14:30 +0100 Subject: Mark content static and const. --- src/input/input_dvb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/input/input_dvb.c') diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 1151d9a81..4f66b8ff4 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -1591,7 +1591,7 @@ static void load_epg_data(dvb_input_plugin_t *this) case 0x54: { /* Content Descriptor, riveting stuff */ int content_bits = getbits(eit, 8, 4); - char *content[] = { + static const char *content[] = { "UNKNOWN","MOVIE","NEWS","ENTERTAINMENT","SPORT", "CHILDRENS","MUSIC","ARTS/CULTURE","CURRENT AFFAIRS", "EDUCATIONAL","INFOTAINMENT","SPECIAL","COMEDY","DRAMA", -- cgit v1.2.3 From 64cd8ba42517cdbb58f7526e7bcbe447fccf22bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Wed, 19 Dec 2007 11:15:37 +0100 Subject: Mark the name attribute of Param being a const char *. --- src/input/input_dvb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/input/input_dvb.c') diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 4f66b8ff4..fe4e7de5a 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -359,7 +359,7 @@ typedef struct { } dvb_input_plugin_t; typedef struct { - char *name; + const char *name; int value; } Param; -- cgit v1.2.3 From d4a43f8c11da38b9bd6fa54476d08efb4bff6fd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Wed, 19 Dec 2007 11:25:37 +0100 Subject: Use asprintf rather than snprintf, make frontend_device a local variable, and make sure to free the allocated variables on error. --- src/input/input_dvb.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'src/input/input_dvb.c') diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index fe4e7de5a..1e876f251 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -234,9 +234,8 @@ typedef struct { int adapter_num; - char frontend_device[100]; - char dvr_device[100]; - char demux_device[100]; + char *dvr_device; + char *demux_device; struct dmx_pes_filter_params pesFilterParams[MAX_FILTERS]; struct dmx_pes_filter_params subFilterParams[MAX_SUBTITLES]; @@ -548,9 +547,10 @@ static void tuner_dispose(tuner_t * this) for (x = 0; x < MAX_SUBTITLES; x++) if (this->fd_subfilter[x] >= 0) close(this->fd_subfilter[x]); - - if(this) - free(this); + + free(this->dvr_device); + free(this->demux_device); + free(this); } @@ -560,7 +560,8 @@ static tuner_t *tuner_init(xine_t * xine, int adapter) tuner_t *this; int x; int test_video; - char *video_device=xine_xmalloc(200); + char *video_device = NULL; + char *frontend_device = NULL; _x_assert(video_device != NULL); @@ -576,21 +577,24 @@ static tuner_t *tuner_init(xine_t * xine, int adapter) this->xine = xine; this->adapter_num = adapter; - snprintf(this->frontend_device,100,"/dev/dvb/adapter%i/frontend0",this->adapter_num); - snprintf(this->demux_device,100,"/dev/dvb/adapter%i/demux0",this->adapter_num); - snprintf(this->dvr_device,100,"/dev/dvb/adapter%i/dvr0",this->adapter_num); - snprintf(video_device,100,"/dev/dvb/adapter%i/video0",this->adapter_num); - - if ((this->fd_frontend = open(this->frontend_device, O_RDWR)) < 0) { + asprintf(&this->demux_device,"/dev/dvb/adapter%i/demux0",this->adapter_num); + asprintf(&this->dvr_device,"/dev/dvb/adapter%i/dvr0",this->adapter_num); + asprintf(&video_device,"/dev/dvb/adapter%i/video0",this->adapter_num); + + asprintf(&frontend_device,"/dev/dvb/adapter%i/frontend0",this->adapter_num); + if ((this->fd_frontend = open(frontend_device, O_RDWR)) < 0) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "FRONTEND DEVICE: %s\n", strerror(errno)); tuner_dispose(this); - return NULL; + this = NULL; + goto exit; } + free(frontend_device); frontend_device = NULL; if ((ioctl(this->fd_frontend, FE_GET_INFO, &this->feinfo)) < 0) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "FE_GET_INFO: %s\n", strerror(errno)); tuner_dispose(this); - return NULL; + this = NULL; + goto exit; } for (x = 0; x < MAX_FILTERS; x++) { @@ -598,7 +602,8 @@ static tuner_t *tuner_init(xine_t * xine, int adapter) if (this->fd_pidfilter[x] < 0) { xprintf(this->xine, XINE_VERBOSITY_DEBUG, "DEMUX DEVICE PIDfilter: %s\n", strerror(errno)); tuner_dispose(this); - return NULL; + this = NULL; + goto exit; } } for (x = 0; x < MAX_SUBTITLES; x++) { @@ -630,7 +635,9 @@ static tuner_t *tuner_init(xine_t * xine, int adapter) close(test_video); } + exit: free(video_device); + free(frontend_device); return this; } -- cgit v1.2.3 From 63ba5c5f0504600844f9a9e50b9d7da3b10953f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Wed, 19 Dec 2007 19:29:34 +0100 Subject: Mark more arrays as constant. --- src/input/input_dvb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/input/input_dvb.c') diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 1e876f251..e6daf423b 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -1598,7 +1598,7 @@ static void load_epg_data(dvb_input_plugin_t *this) case 0x54: { /* Content Descriptor, riveting stuff */ int content_bits = getbits(eit, 8, 4); - static const char *content[] = { + static const char *const content[] = { "UNKNOWN","MOVIE","NEWS","ENTERTAINMENT","SPORT", "CHILDRENS","MUSIC","ARTS/CULTURE","CURRENT AFFAIRS", "EDUCATIONAL","INFOTAINMENT","SPECIAL","COMEDY","DRAMA", -- cgit v1.2.3 From 9b3fc5f500954e2deb241c17b0437ec8afad025e Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sat, 22 Dec 2007 15:48:51 +0000 Subject: Remove an assertion which is always triggered. --- src/input/input_dvb.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/input/input_dvb.c') diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index e6daf423b..5ba3f9d93 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -563,8 +563,6 @@ static tuner_t *tuner_init(xine_t * xine, int adapter) char *video_device = NULL; char *frontend_device = NULL; - _x_assert(video_device != NULL); - this = (tuner_t *) xine_xmalloc(sizeof(tuner_t)); _x_assert(this != NULL); -- cgit v1.2.3