summaryrefslogtreecommitdiff
path: root/src/demuxers/demux_slave.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/demuxers/demux_slave.c')
-rw-r--r--src/demuxers/demux_slave.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/demuxers/demux_slave.c b/src/demuxers/demux_slave.c
index 436d37579..abb4d01e5 100644
--- a/src/demuxers/demux_slave.c
+++ b/src/demuxers/demux_slave.c
@@ -90,10 +90,11 @@ static int demux_slave_next (demux_slave_t *this) {
/* fill the scratch buffer */
n = this->input->read(this->input, &this->scratch[this->scratch_used],
SCRATCH_SIZE - this->scratch_used);
- this->scratch_used += n;
+ if (n > 0)
+ this->scratch_used += n;
this->scratch[this->scratch_used] = '\0';
- if( !n ) {
+ if (n <= 0) {
lprintf("connection closed\n");
this->status = DEMUX_FINISHED;
return 0;
@@ -186,10 +187,8 @@ static int demux_slave_next (demux_slave_t *this) {
buf->decoder_flags = decoder_flags;
/* set decoder info */
- for( i = 0; i < BUF_NUM_DEC_INFO; i++ ) {
- buf->decoder_info[i] = this->decoder_info[i];
- buf->decoder_info_ptr[i] = this->decoder_info_ptr[i];
- }
+ memcpy(buf->decoder_info, this->decoder_info, sizeof(this->decoder_info));
+ memcpy(buf->decoder_info_ptr, this->decoder_info_ptr, sizeof(this->decoder_info));
memset(this->decoder_info, 0, sizeof(this->decoder_info));
memset(this->decoder_info_ptr, 0, sizeof(this->decoder_info_ptr));
@@ -331,7 +330,7 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, xine_stream_t *str
demux_slave_t *this;
static char slave_id_str[] = "master xine v1\n";
- this = xine_xmalloc (sizeof (demux_slave_t));
+ this = calloc(1, sizeof(demux_slave_t));
switch (stream->content_detection_method) {
@@ -414,7 +413,7 @@ static void class_dispose (demux_class_t *this_gen) {
static void *init_plugin (xine_t *xine, void *data) {
demux_slave_class_t *this;
- this = xine_xmalloc (sizeof (demux_slave_class_t));
+ this = calloc(1, sizeof(demux_slave_class_t));
this->demux_class.open_plugin = open_plugin;
this->demux_class.get_description = get_description;