summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorphintuka <phintuka>2007-03-14 10:26:39 +0000
committerphintuka <phintuka>2007-03-14 10:26:39 +0000
commitd3ce1f2c7fcb71abe143e8c99da7c069785e4a15 (patch)
tree2279000db20f01fdc486e2f5c261133381a67a69
parentc386b4b79b99c352b7a19f2adca2b7f0d609da21 (diff)
downloadxineliboutput-d3ce1f2c7fcb71abe143e8c99da7c069785e4a15.tar.gz
xineliboutput-d3ce1f2c7fcb71abe143e8c99da7c069785e4a15.tar.bz2
String checks
-rw-r--r--xine_fbfe_frontend.c7
-rw-r--r--xine_frontend.c26
2 files changed, 22 insertions, 11 deletions
diff --git a/xine_fbfe_frontend.c b/xine_fbfe_frontend.c
index 014a5022..06ab56b9 100644
--- a/xine_fbfe_frontend.c
+++ b/xine_fbfe_frontend.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: xine_fbfe_frontend.c,v 1.11 2007-03-08 13:42:05 phintuka Exp $
+ * $Id: xine_fbfe_frontend.c,v 1.12 2007-03-14 10:26:39 phintuka Exp $
*
*/
@@ -46,6 +46,7 @@
#include "xine_frontend.h"
#include "xine/post.h"
+
/*
* data
*/
@@ -158,7 +159,7 @@ static int fbfe_display_open(frontend_t *this_gen, int width, int height, int fu
this->field_order = 0/*field_order ? 1 : 0*/;
this->scale_video = scale_video;
this->overscan = 0;
- strcpy(this->modeline, modeline);
+ strn0cpy(this->modeline, modeline, sizeof(this->modeline));
this->display_ratio = 1.0;
this->xine_visual_type = XINE_VISUAL_TYPE_FB;
@@ -198,7 +199,7 @@ static int fbfe_display_config(frontend_t *this_gen, int width, int height, int
}
if(!modeswitch && strcmp(modeline, this->modeline)) {
- strcpy(this->modeline, modeline);
+ strn0cpy(this->modeline, modeline, sizeof(this->modeline));
/* XXX TODO - switch vmode */
#ifdef LOG
LOGDBG("fbfe_display_config: TODO: switch vmode\n");fflush(stdout);
diff --git a/xine_frontend.c b/xine_frontend.c
index d3ee615b..2006e008 100644
--- a/xine_frontend.c
+++ b/xine_frontend.c
@@ -4,7 +4,7 @@
* See the main source file 'xineliboutput.c' for copyright information and
* how to reach the author.
*
- * $Id: xine_frontend.c,v 1.32 2007-01-20 14:21:03 phintuka Exp $
+ * $Id: xine_frontend.c,v 1.33 2007-03-14 10:23:15 phintuka Exp $
*
*/
@@ -38,6 +38,14 @@ typedef struct {
} vdr_input_plugin_t;
+static inline char *strn0cpy(char *dest, const char *src, int n)
+{
+ char *s = dest;
+ for ( ; --n && (*dest = *src) != 0; dest++, src++) ;
+ *dest = 0;
+ return s;
+}
+
/*
* detect input plugin
*/
@@ -291,7 +299,7 @@ static void configure_audio_out(fe_t *this, const char *audio_driver, const char
/*
* alsa
*/
- if(!strcmp("alsa", audio_driver) && audio_port && strlen(audio_port) > 0) {
+ if(audio_driver && !strcmp("alsa", audio_driver) && audio_port && strlen(audio_port) > 0) {
/* define possible speaker arrangements */
/* From xine audio_alsa_out.c ; must be synchronized ! */
@@ -300,7 +308,7 @@ static void configure_audio_out(fe_t *this, const char *audio_driver, const char
"Surround 3.0", "Surround 4.0", "Surround 4.1",
"Surround 5.0", "Surround 5.1", "Surround 6.0",
"Surround 6.1", "Surround 7.1", "Pass Through", NULL};
-
+
x_reg_enum("audio.output.speaker_arrangement",
STEREO,
speaker_arrangement,
@@ -367,6 +375,7 @@ static void configure_audio_out(fe_t *this, const char *audio_driver, const char
"alsa documentation for information on alsa "
"devices."),
10, NULL, NULL);
+
x_upd_str("audio.device.alsa_front_device", audio_port);
x_upd_str("audio.device.alsa_default_device", audio_port);
x_upd_str("audio.device.alsa_surround51_device", audio_port);
@@ -447,7 +456,8 @@ static int fe_xine_init(frontend_t *this_gen, const char *audio_driver,
/*xine_register_log_cb(this->xine, xine_log_cb, this);*/
/* TODO: use different config file ? (vdr conf.dir/xine/config_vdr ?) */
- sprintf(this->configfile, "%s%s", xine_get_homedir(),
+ snprintf(this->configfile, sizeof(this->configfile),
+ "%s%s", xine_get_homedir(),
"/.xine/config_xineliboutput");
xine_config_load (this->xine, this->configfile);
@@ -477,9 +487,9 @@ static int fe_xine_init(frontend_t *this_gen, const char *audio_driver,
#ifdef IS_FBFE
if(fbdev) {
- if(!strcmp(video_driver, "fb"))
+ if(video_driver && !strcmp(video_driver, "fb"))
x_upd_str("video.device.fb_device", fbdev);
- else if(!strcmp(video_driver, "DirectFB")) {
+ else if(video_driver && !strcmp(video_driver, "DirectFB")) {
/* DirectFBInit (NULL, NULL); */
/* DirectFBSetOption ("fbdev", video_port); */
char *orig = getenv("DFBARGS"), *head = NULL, *tail = NULL, *tmp = NULL;
@@ -860,7 +870,7 @@ static int fe_post_open(fe_t *this, const char *name, const char *args)
char initstr[1024];
int found = 0;
- if(!this || !this->xine || !this->stream)
+ if(!this || !this->xine || !this->stream || !name)
return 0;
/* pip */
@@ -877,7 +887,7 @@ static int fe_post_open(fe_t *this, const char *name, const char *args)
snprintf(initstr, sizeof(initstr), "%s:%s", name, args);
initstr[sizeof(initstr)-1] = 0;
} else
- strncpy(initstr, name, sizeof(initstr));
+ strn0cpy(initstr, name, sizeof(initstr));
LOGDBG("opening post plugin: %s", initstr);