summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/demuxers/demux_ogg.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/demuxers/demux_ogg.c b/src/demuxers/demux_ogg.c
index e0cddfcf4..a58304744 100644
--- a/src/demuxers/demux_ogg.c
+++ b/src/demuxers/demux_ogg.c
@@ -304,10 +304,10 @@ static void send_ogg_packet (demux_ogg_t *this,
buf_element_t *buf;
int done=0,todo=op->bytes;
- int op_size = sizeof(ogg_packet);
+ const size_t op_size = sizeof(ogg_packet);
while (done<todo) {
- int offset=0;
+ size_t offset=0;
buf = fifo->buffer_pool_alloc (fifo);
buf->decoder_flags = decoder_flags;
if (done==0) {
@@ -531,34 +531,34 @@ static void update_chapter_display (demux_ogg_t *this, int stream_num, ogg_packe
chapter--;
if (chapter != this->chapter_info->current_chapter){
- xine_event_t uevent;
- xine_ui_data_t data;
- int title_len;
- char *title;
+ xine_ui_data_t data = {
+ .str = { 0, },
+ .str_len = 0
+ };
+ xine_event_t uevent = {
+ .type = XINE_EVENT_UI_SET_TITLE,
+ .stream = this->stream,
+ .data = &data,
+ .data_length = sizeof(data)
+ };
this->chapter_info->current_chapter = chapter;
- if (chapter >= 0) {
- char t_title[256];
+ if (chapter >= 0) {
if (this->title) {
- snprintf(t_title, sizeof (t_title), "%s / %s", this->title, this->chapter_info->entries[chapter].name);
+ data.str_len = snprintf(data.str, sizeof(data.str), "%s / %s", this->title, this->chapter_info->entries[chapter].name);
} else {
- snprintf(t_title, sizeof (t_title), "%s", this->chapter_info->entries[chapter].name);
+ strncpy(data.str, this->chapter_info->entries[chapter].name, sizeof(data.str)-1);
}
- title = t_title;
} else {
- title = this->title;
+ strncpy(data.str, this->title, sizeof(data.str));
}
- _x_meta_info_set(this->stream, XINE_META_INFO_TITLE, title);
- lprintf("new TITLE: %s\n", title);
-
- uevent.type = XINE_EVENT_UI_SET_TITLE;
- uevent.stream = this->stream;
- uevent.data = &data;
- uevent.data_length = sizeof(data);
- title_len = strlen(title) + 1;
- memcpy(data.str, title, title_len);
- data.str_len = title_len;
+ if ( data.str_len == 0 )
+ data.str_len = strlen(data.str);
+
+ _x_meta_info_set(this->stream, XINE_META_INFO_TITLE, data.str);
+ lprintf("new TITLE: %s\n", data.str);
+
xine_event_send(this->stream, &uevent);
}
}