diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-05-07 18:06:56 +0200 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-05-07 18:06:56 +0200 |
commit | bbb2643bdcc8fb3d7f29c11e1344286b042535bf (patch) | |
tree | 874f8a93f6afe13af796073c92a46dee774c946f /src/input | |
parent | 837822b5c6924be7fbc297bcef9639d7ada95a30 (diff) | |
download | xine-lib-bbb2643bdcc8fb3d7f29c11e1344286b042535bf.tar.gz xine-lib-bbb2643bdcc8fb3d7f29c11e1344286b042535bf.tar.bz2 |
Use proper string functions in place of sn?printf.
Instead of calling sprintf or snprintf with a "%s" format string, use
the proper strcpy, strncpy, strdup or strndup function.
Diffstat (limited to 'src/input')
-rw-r--r-- | src/input/input_dvb.c | 5 | ||||
-rw-r--r-- | src/input/input_dvd.c | 4 | ||||
-rw-r--r-- | src/input/input_vcd.c | 11 | ||||
-rw-r--r-- | src/input/vcd/xineplug_inp_vcd.c | 4 |
4 files changed, 7 insertions, 17 deletions
diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 0ec81026b..bccbc13be 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -1839,8 +1839,7 @@ static void show_program_info(int x, int y, int max_x, int max_y, int* last_y, /*Content type and rating, if any. */ if (strlen(epg_data->content) > 3) { - - snprintf(buffer, 94, "%s", epg_data->content); + strncpy(buffer, epg_data->content, 94-1); prog_rating = epg_data->rating; if (prog_rating > 0) { @@ -1870,7 +1869,7 @@ static void show_program_info(int x, int y, int max_x, int max_y, int* last_y, /* Print the description. */ if (epg_data->description && strlen(epg_data->description) > 0) { renderer->set_font(osd, "sans", EPG_DESCRIPTION_FONT_SIZE); - sprintf(buffer, "%s", epg_data->description); + strcpy(buffer, epg_data->description); /* If the description is not complete (i.e., there is no comma at the end), add "..." to the end. In my locale they often seem to send incomplete description texts :( */ diff --git a/src/input/input_dvd.c b/src/input/input_dvd.c index ef5f1e055..012d695ec 100644 --- a/src/input/input_dvd.c +++ b/src/input/input_dvd.c @@ -1313,7 +1313,7 @@ static int dvd_plugin_get_optional_data (input_plugin_t *this_gen, if(this && this->stream && this->dvdnav) { if(!(dvdnav_is_domain_vts(this->dvdnav))) { - sprintf(data, "%s", "menu"); + strcpy(data, "menu"); if (channel <= 0) return INPUT_OPTIONAL_SUCCESS; else @@ -1336,7 +1336,7 @@ static int dvd_plugin_get_optional_data (input_plugin_t *this_gen, return INPUT_OPTIONAL_SUCCESS; } else { if(channel == -1) { - sprintf(data, "%s", "none"); + strcpy(data, "none"); return INPUT_OPTIONAL_SUCCESS; } } diff --git a/src/input/input_vcd.c b/src/input/input_vcd.c index 02c2e83ab..760037e93 100644 --- a/src/input/input_vcd.c +++ b/src/input/input_vcd.c @@ -997,16 +997,9 @@ static xine_mrl_t **vcd_class_get_dir (input_class_t *this_gen, const char *file memset(this->mrls[(i-1)], 0, sizeof(xine_mrl_t)); } - if(this->mrls[(i-1)]->mrl) { - this->mrls[(i-1)]->mrl = (char *) - realloc(this->mrls[(i-1)]->mrl, strlen(mrl) + 1); - } - else { - this->mrls[(i-1)]->mrl = (char *) xine_xmalloc(strlen(mrl) + 1); - } - this->mrls[i-1]->origin = NULL; - sprintf(this->mrls[i-1]->mrl, "%s", mrl); + free(this->mrls[(i-1)]->mrl); + this->mrls[i-1]->mrl = strdup(mrl); this->mrls[i-1]->link = NULL; this->mrls[i-1]->type = (0 | mrl_vcd); diff --git a/src/input/vcd/xineplug_inp_vcd.c b/src/input/vcd/xineplug_inp_vcd.c index d024c5bff..f4f823918 100644 --- a/src/input/vcd/xineplug_inp_vcd.c +++ b/src/input/vcd/xineplug_inp_vcd.c @@ -272,11 +272,9 @@ vcd_add_mrl_slot(vcd_input_class_t *this, const char *mrl, off_t size, this->mrls[*i]->type = mrl_vcd; this->mrls[*i]->size = size * M2F2_SECTOR_SIZE; - this->mrls[*i]->mrl = (char *) malloc(strlen(mrl) + 1); + this->mrls[*i]->mrl = strdup(mrl); if (NULL==this->mrls[*i]->mrl) { LOG_ERR("Can't malloc %zu bytes for MRL name %s", sizeof(xine_mrl_t), mrl); - } else { - sprintf(this->mrls[*i]->mrl, "%s", mrl); } (*i)++; } |