diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dxr3/video_out_dxr3.c | 10 | ||||
-rw-r--r-- | src/input/input_dvb.c | 22 | ||||
-rw-r--r-- | src/input/input_http.c | 20 | ||||
-rw-r--r-- | src/post/planar/pp.c | 13 | ||||
-rw-r--r-- | src/video_out/video_out_opengl.c | 5 |
5 files changed, 28 insertions, 42 deletions
diff --git a/src/dxr3/video_out_dxr3.c b/src/dxr3/video_out_dxr3.c index 482d094b9..3e7c9ab08 100644 --- a/src/dxr3/video_out_dxr3.c +++ b/src/dxr3/video_out_dxr3.c @@ -1334,7 +1334,7 @@ static int lookup_parameter(struct lut_entry *lut, char *name, static int dxr3_overlay_read_state(dxr3_overlay_t *this) { char *loc; - char fname[256], tmp[128], line[256]; + char *fname, line[256]; FILE *fp; struct lut_entry lut[] = { {"xoffset", TYPE_INT, &this->xoffset}, @@ -1359,18 +1359,16 @@ static int dxr3_overlay_read_state(dxr3_overlay_t *this) * (used by .overlay/res file) */ setlocale(LC_NUMERIC, "C"); - snprintf(tmp, sizeof(tmp), "/res_%dx%dx%d", + asprintf(&fname, "%s/.overlay/res_%dx%dx%d", getenv("HOME"), this->screen_xres, this->screen_yres, this->screen_depth); - strncpy(fname, getenv("HOME"), sizeof(fname) - strlen(tmp) - sizeof("/.overlay")); - fname[sizeof(fname) - strlen(tmp) - sizeof("/.overlay")] = '\0'; - strcat(fname, "/.overlay"); - strcat(fname, tmp); llprintf(LOG_OVR, "attempting to open %s\n", fname); if (!(fp = fopen(fname, "r"))) { xprintf(this->xine, XINE_VERBOSITY_LOG, _("video_out_dxr3: ERROR Reading overlay init file. Run autocal!\n")); + free(fname); return -1; } + free(fname); while (!feof(fp)) { if (!fgets(line, 256, fp)) diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index bccbc13be..121e11b11 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -66,14 +66,14 @@ * OSD - this will allow for filtering/searching of epg data - useful for automatic recording :) */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + /* pthread.h must be included first so rest of the headers are imported thread safely (on some systems). */ #include <pthread.h> -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include <assert.h> #include <stdio.h> #include <stdlib.h> @@ -3222,21 +3222,19 @@ static char **dvb_class_get_autoplay_list(input_class_t * this_gen, for (ch = 0, apch = !!lastchannel_enable.num_value; ch < num_channels && ch < MAX_AUTOCHANNELS; ++ch, ++apch) { - snprintf(foobuffer, BUFSIZE, "dvb://%s", channels[ch].name); - free(class->autoplaylist[apch]); - class->autoplaylist[apch] = strdup(foobuffer); - _x_assert(class->autoplaylist[apch] != NULL); + free(class->autoplaylist[apch]); + asprintf(&(class->autoplaylist[apch]), "dvb://%s", channels[ch].name); + _x_assert(class->autoplaylist[apch] != NULL); } if (lastchannel_enable.num_value){ + free(class->autoplaylist[0]); if (default_channel != -1) /* plugin has been used before - channel is valid */ - sprintf (foobuffer, "dvb://%s", channels[default_channel].name); + asprintf (&(class->autoplaylist[0]), "dvb://%s", channels[default_channel].name); else /* set a reasonable default - the first channel */ - sprintf (foobuffer, "dvb://%s", num_channels ? channels[0].name : "0"); - free(class->autoplaylist[0]); - class->autoplaylist[0]=strdup(foobuffer); + asprintf (&(class->autoplaylist[0]), "dvb://%s", num_channels ? channels[0].name : "0"); } free_channel_list(channels, num_channels); diff --git a/src/input/input_http.c b/src/input/input_http.c index 0e9345731..3b091e7cb 100644 --- a/src/input/input_http.c +++ b/src/input/input_http.c @@ -235,26 +235,16 @@ static int http_plugin_basicauth (const char *user, const char *password, char* char *tmp; char *sptr; char *dptr; - int totlen; + size_t count; int enclen; - int count; - totlen = strlen (user) + 1; - if(password != NULL) - totlen += strlen (password); - - enclen = ((totlen + 2) / 3 ) * 4 + 1; + count = asprintf(&tmp, "%s:%s", user, (password != NULL) ? password : ""); + + enclen = ((count + 2) / 3 ) * 4 + 1; if (len < enclen) return -1; - - tmp = malloc (sizeof(char) * (totlen + 1)); - strcpy (tmp, user); - strcat (tmp, ":"); - if (password != NULL) - strcat (tmp, password); - - count = strlen(tmp); + sptr = tmp; dptr = dest; while (count >= 3) { diff --git a/src/post/planar/pp.c b/src/post/planar/pp.c index 3c6fe8767..51d28b33d 100644 --- a/src/post/planar/pp.c +++ b/src/post/planar/pp.c @@ -20,6 +20,10 @@ * plugin for ffmpeg libpostprocess */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include "xine_internal.h" #include "post.h" #include "xineutils.h" @@ -119,12 +123,9 @@ static char * get_help (void) { ); static char *help = NULL; - if( !help ) { - help = malloc( strlen(help1) + strlen(help2) + strlen(pp_help) + 1); - strcpy(help, help1); - strcat(help, pp_help); - strcat(help, help2); - } + if( !help ) + asprintf(&help, "%s%s%s", help1, help2, pp_help); + return help; } diff --git a/src/video_out/video_out_opengl.c b/src/video_out/video_out_opengl.c index a82bb8f18..46fffabf8 100644 --- a/src/video_out/video_out_opengl.c +++ b/src/video_out/video_out_opengl.c @@ -694,10 +694,9 @@ static void *getdladdr (const GLubyte *_funcName) { return NULL; #elif defined(__APPLE__) - char *temp = xine_xmalloc (strlen (funcName) + 2); + char *temp; + asprintf(&temp, "_%s", funcName); void *res = NULL; - temp[0] = '_'; /* Mac OS X prepends an underscore on function names */ - strcpy (temp+1, funcName); if (NSIsSymbolNameDefined (temp)) { NSSymbol symbol = NSLookupAndBindSymbol (temp); res = NSAddressOfSymbol (symbol); |