diff options
-rw-r--r-- | src/demuxers/demux_mpeg_pes.c | 5 | ||||
-rw-r--r-- | src/demuxers/demux_slave.c | 6 | ||||
-rw-r--r-- | src/demuxers/demux_str.c | 4 | ||||
-rw-r--r-- | src/demuxers/demux_ts.c | 6 | ||||
-rw-r--r-- | src/demuxers/demux_wc3movie.c | 2 | ||||
-rw-r--r-- | src/input/input_dvb.c | 6 | ||||
-rw-r--r-- | src/input/pnm.c | 5 | ||||
-rw-r--r-- | src/post/audio/upmix_mono.c | 32 | ||||
-rw-r--r-- | src/post/audio/volnorm.c | 5 | ||||
-rw-r--r-- | src/post/planar/eq2.c | 29 | ||||
-rw-r--r-- | src/video_out/video_out_xxmc.c | 12 | ||||
-rw-r--r-- | src/xine-engine/load_plugins.c | 11 | ||||
-rw-r--r-- | src/xine-utils/monitor.c | 10 |
13 files changed, 49 insertions, 84 deletions
diff --git a/src/demuxers/demux_mpeg_pes.c b/src/demuxers/demux_mpeg_pes.c index 477a071a4..32dd2cb51 100644 --- a/src/demuxers/demux_mpeg_pes.c +++ b/src/demuxers/demux_mpeg_pes.c @@ -274,7 +274,7 @@ static void demux_mpeg_pes_parse_pack (demux_mpeg_pes_t *this, int preview_mode) while ((p[2] != 1) || p[0] || p[1]) { /* resync code */ - for(n=0;n<5;n++) p[n]=p[n+1]; + memmove(p, p+1, 5); i = read_data(this, p+5, (off_t) 1); if (i != 1) { this->status = DEMUX_FINISHED; @@ -306,8 +306,7 @@ static void demux_mpeg_pes_parse_pack (demux_mpeg_pes_t *this, int preview_mode) p = buf->mem; /* copy local buffer to fifo element. */ - for (n = 0; n < sizeof (buf6); n++) - p[ n ] = buf6[ n ]; + memcpy(p, buf6, sizeof(buf6)); if (preview_mode) buf->decoder_flags = BUF_FLAG_PREVIEW; diff --git a/src/demuxers/demux_slave.c b/src/demuxers/demux_slave.c index c2d427d8c..28a89a973 100644 --- a/src/demuxers/demux_slave.c +++ b/src/demuxers/demux_slave.c @@ -186,10 +186,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)); diff --git a/src/demuxers/demux_str.c b/src/demuxers/demux_str.c index 97e025504..1e750f183 100644 --- a/src/demuxers/demux_str.c +++ b/src/demuxers/demux_str.c @@ -188,9 +188,7 @@ static int open_str_file(demux_str_t *this) { unsigned char check_bytes[STR_CHECK_BYTES]; int local_offset, sector, channel; - for (channel = 0; channel < STR_MAX_CHANNELS; channel++) { - this->channel_type[channel] = 0; - } + memset(this->channel_type, 0, sizeof(this->channel_type)); this->input->seek(this->input, 0, SEEK_SET); if (this->input->read(this->input, check_bytes, STR_CHECK_BYTES) != diff --git a/src/demuxers/demux_ts.c b/src/demuxers/demux_ts.c index c3b1c2bad..6d854e4c3 100644 --- a/src/demuxers/demux_ts.c +++ b/src/demuxers/demux_ts.c @@ -2278,12 +2278,6 @@ static demux_plugin_t *open_plugin (demux_class_t *class_gen, this->status = DEMUX_FINISHED; -#ifdef TS_READ_STATS - for (i=0; i<=NPKT_PER_READ; i++) { - this->rstat[i] = 0; - } -#endif - /* DVBSUB */ this->spu_pid = INVALID_PID; this->spu_langs_count = 0; diff --git a/src/demuxers/demux_wc3movie.c b/src/demuxers/demux_wc3movie.c index dab0d2619..64ae431fb 100644 --- a/src/demuxers/demux_wc3movie.c +++ b/src/demuxers/demux_wc3movie.c @@ -380,8 +380,6 @@ static int open_mve_file(demux_mve_t *this) { /* allocate space for the shot offset index and set offsets to 0 */ this->shot_offsets = calloc(this->number_of_shots, sizeof(off_t)); this->current_shot = 0; - for (i = 0; i < this->number_of_shots; i++) - this->shot_offsets[i] = 0; /* skip the SOND chunk */ this->input->seek(this->input, 12, SEEK_CUR); diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c index 121e11b11..669cd1e14 100644 --- a/src/input/input_dvb.c +++ b/src/input/input_dvb.c @@ -587,8 +587,7 @@ static tuner_t *tuner_init(xine_t * xine, int adapter) xprintf(this->xine, XINE_VERBOSITY_DEBUG, "tuner_init adapter=%d\n", adapter); this->fd_frontend = -1; - for (x = 0; x < MAX_FILTERS; x++) - this->fd_pidfilter[x] = 0; + memset(this->fd_pidfilter, 0, sizeof(this->fd_pidfilter)); this->xine = xine; this->adapter_num = adapter; @@ -933,8 +932,7 @@ static channel_t *load_channels(xine_t *xine, xine_stream_t *stream, int *num_ch /* Initially there's no EPG data in the EPG structs. */ channels[num_channels].epg_count = 0; - for (i = 0; i < MAX_EPG_ENTRIES_PER_CHANNEL; ++i) - channels[num_channels].epg[i] = NULL; + memset(channels[num_channels].epg, 0, sizeof(channels[num_channels].epg)); num_channels++; } diff --git a/src/input/pnm.c b/src/input/pnm.c index 47a24a620..5b8aa7c42 100644 --- a/src/input/pnm.c +++ b/src/input/pnm.c @@ -631,10 +631,7 @@ static int pnm_get_stream_chunk(pnm_t *p) { */ n=0; while (p->buffer[0] != 0x5a) { - int i; - for (i=1; i<8; i++) { - p->buffer[i-1]=p->buffer[i]; - } + memmove(p->buffer, &p->buffer[1], 8); _x_io_tcp_read (p->stream, p->s, &p->buffer[7], 1); n++; } diff --git a/src/post/audio/upmix_mono.c b/src/post/audio/upmix_mono.c index caf99a309..2d3429788 100644 --- a/src/post/audio/upmix_mono.c +++ b/src/post/audio/upmix_mono.c @@ -192,32 +192,32 @@ static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen, _x_extra_info_merge(buf1->extra_info, buf->extra_info); { - int step = buf->format.bits / 8; + const size_t step = buf->format.bits / 8; uint8_t *src = (uint8_t *)buf->mem; uint8_t *dst0 = (uint8_t *)buf0->mem; uint8_t *dst1 = (uint8_t *)buf1->mem; - int i, k; + int i; for (i = 0; i < buf->num_frames / 2; i++) { - for (k = 0; k < step; k++) - *dst0++ = *src++; + memcpy(dst0, src, step); + dst0 += step; - src -= step; + memcpy(dst0, src, step); + dst0 += step; - for (k = 0; k < step; k++) - *dst0++ = *src++; + src += step; } for (i = buf->num_frames / 2; i < buf->num_frames; i++) { - for (k = 0; k < step; k++) - *dst1++ = *src++; + memcpy(dst1, src, step); + dst1 += step; - src -= step; + memcpy(dst1, src, step); + dst1 += step; - for (k = 0; k < step; k++) - *dst1++ = *src++; + src += step; } } @@ -244,11 +244,11 @@ static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen, _x_extra_info_merge(buf0->extra_info, buf->extra_info); { - int step = buf->format.bits / 8; + const size_t step = buf->format.bits / 8; uint8_t *src = (uint8_t *)buf->mem; uint8_t *dst0 = (uint8_t *)buf0->mem; int cur_channel = this->params.channel; - int i, j, k; + int i, j; if( cur_channel >= this->channels ) cur_channel = this->channels-1; @@ -259,8 +259,8 @@ static void upmix_mono_port_put_buffer(xine_audio_port_t *port_gen, { for (j = 0; j < this->channels; j++ ) { - for (k = 0; k < step; k++) - *dst0++ = *(src+k); + memcpy(dst0, src, step); + dst0 += step; } src += this->channels * step; } diff --git a/src/post/audio/volnorm.c b/src/post/audio/volnorm.c index 07d06fe1c..4fdb7dbfc 100644 --- a/src/post/audio/volnorm.c +++ b/src/post/audio/volnorm.c @@ -426,9 +426,8 @@ static post_plugin_t *volnorm_open_plugin(post_class_t *class_gen, int inputs, this->mul = MUL_INIT; this->lastavg = MID_S16; this->idx = 0; - for (i = 0; i < NSAMPLES; i++) - this->mem[i].len = this->mem[i].avg = 0; - + memset(this->mem, 0, sizeof(this->mem)); + port = _x_post_intercept_audio_port(&this->post, audio_target[0], &input, &output); port->new_port.open = volnorm_port_open; port->new_port.close = volnorm_port_close; diff --git a/src/post/planar/eq2.c b/src/post/planar/eq2.c index 8894b9d06..0ead54f55 100644 --- a/src/post/planar/eq2.c +++ b/src/post/planar/eq2.c @@ -442,26 +442,15 @@ static post_plugin_t *eq2_open_plugin(post_class_t *class_gen, int inputs, _x_post_init(&this->post, 0, 1); - eq2 = &this->eq2; - for (i = 0; i < 3; i++) { - eq2->buf[i] = NULL; - eq2->buf_w[i] = 0; - eq2->buf_h[i] = 0; - - eq2->param[i].adjust = NULL; - eq2->param[i].c = 1.0; - eq2->param[i].b = 0.0; - eq2->param[i].g = 1.0; - eq2->param[i].lut_clean = 0; - } - - eq2->gamma = this->params.gamma = 1.0; - eq2->contrast = this->params.contrast = 1.0; - eq2->brightness = this->params.brightness = 0.0; - eq2->saturation = this->params.saturation = 1.0; - eq2->rgamma = this->params.rgamma = 1.0; - eq2->ggamma = this->params.ggamma = 1.0; - eq2->bgamma = this->params.bgamma = 1.0; + memset(&this->eq2, 0, sizeof(this->eq2)); + + this->eq2.gamma = this->params.gamma = 1.0; + this->eq2.contrast = this->params.contrast = 1.0; + this->eq2.brightness = this->params.brightness = 0.0; + this->eq2.saturation = this->params.saturation = 1.0; + this->eq2.rgamma = this->params.rgamma = 1.0; + this->eq2.ggamma = this->params.ggamma = 1.0; + this->eq2.bgamma = this->params.bgamma = 1.0; pthread_mutex_init(&this->lock, NULL); diff --git a/src/video_out/video_out_xxmc.c b/src/video_out/video_out_xxmc.c index 07dafa12d..0fedde6c6 100644 --- a/src/video_out/video_out_xxmc.c +++ b/src/video_out/video_out_xxmc.c @@ -162,14 +162,10 @@ static void xxmc_xvmc_surface_handler_construct(xxmc_driver_t *this) xvmc_surface_handler_t *handler = &this->xvmc_surf_handler; pthread_mutex_init(&handler->mutex,NULL); - for (i=0; i<XVMC_MAX_SURFACES; ++i) { - handler->surfInUse[i] = 0; - handler->surfValid[i] = 0; - } - for (i=0; i<XVMC_MAX_SUBPICTURES; ++i) { - handler->subInUse[i] = 0; - handler->subValid[i] = 0; - } + memset(handler->surfInUse, 0, sizeof(handler->surfInuse)); + memset(handler->surfValid, 0, sizeof(handler->surfValid)); + memset(handler->subInUse, 0, sizeof(handler->subInUse)); + memset(handler->subValid, 0, sizeof(handler->subValid)); } static void xxmc_xvmc_destroy_surfaces(xxmc_driver_t *this) diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index ed0106ffe..d08837dc5 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.c @@ -368,12 +368,13 @@ static void _insert_node (xine_t *this, info->id); _x_abort(); } - for (i=0; decoder_old->supported_types[i] != 0; ++i); - types = calloc((i+1), sizeof(uint32_t)); - for (i=0; decoder_old->supported_types[i] != 0; ++i){ - types[i] = decoder_old->supported_types[i]; + { + size_t supported_types_size; + for (supported_types_size=0; decoder_old->supported_types[supported_types_size] != 0; ++supported_types_size); + types = calloc((supported_types_size+1), sizeof(uint32_t)); + memcpy(types, decoder_old->supported_types, supported_types_size); + decoder_new->supported_types = types; } - decoder_new->supported_types = types; entry->priority = decoder_new->priority = decoder_old->priority; snprintf(key, sizeof(key), "engine.decoder_priorities.%s", info->id); diff --git a/src/xine-utils/monitor.c b/src/xine-utils/monitor.c index fb323055c..301d6c22f 100644 --- a/src/xine-utils/monitor.c +++ b/src/xine-utils/monitor.c @@ -39,12 +39,10 @@ static const char *profiler_label[MAX_ID] ; void xine_profiler_init () { int i; - for (i=0; i<MAX_ID; i++) { - profiler_times[i] = 0; - profiler_start[i] = 0; - profiler_calls[i] = 0; - profiler_label[i] = NULL; - } + memset(profiler_times, 0, sizeof(profiler_times)); + memset(profiler_start, 0, sizeof(profiler_start)); + memset(profiler_calls, 0, sizeof(profiler_calls)); + memset(profiler_label, 0, sizeof(profiler_label)); } int xine_profiler_allocate_slot (const char *label) { |