summaryrefslogtreecommitdiff
path: root/src/demuxers
diff options
context:
space:
mode:
Diffstat (limited to 'src/demuxers')
-rw-r--r--src/demuxers/asfheader.c9
-rw-r--r--src/demuxers/demux_4xm.c2
-rw-r--r--src/demuxers/demux_aiff.c2
-rw-r--r--src/demuxers/demux_avi.c10
-rw-r--r--src/demuxers/demux_film.c8
-rw-r--r--src/demuxers/demux_iff.c6
-rw-r--r--src/demuxers/demux_mpeg_pes.c5
-rw-r--r--src/demuxers/demux_ogg.c2
-rw-r--r--src/demuxers/demux_qt.c3
-rw-r--r--src/demuxers/demux_real.c2
-rw-r--r--src/demuxers/demux_realaudio.c2
-rw-r--r--src/demuxers/demux_slave.c6
-rw-r--r--src/demuxers/demux_str.c4
-rw-r--r--src/demuxers/demux_ts.c6
-rw-r--r--src/demuxers/demux_wav.c2
-rw-r--r--src/demuxers/demux_wc3movie.c4
16 files changed, 25 insertions, 48 deletions
diff --git a/src/demuxers/asfheader.c b/src/demuxers/asfheader.c
index f95c68e41..5db25d07f 100644
--- a/src/demuxers/asfheader.c
+++ b/src/demuxers/asfheader.c
@@ -581,10 +581,9 @@ static int asf_header_parse_content_description(asf_header_t *header_pub, uint8_
if (buffer_len < 10)
return 0;
- content = malloc(sizeof(asf_content_t));
+ content = calloc(1, sizeof(asf_content_t));
if (!content)
return 0;
- memset(content, 0, sizeof(asf_content_t));
asf_reader_init(&reader, buffer, buffer_len);
asf_reader_get_16(&reader, &title_length);
@@ -617,10 +616,9 @@ asf_header_t *asf_header_new (uint8_t *buffer, int buffer_len) {
uint32_t object_count;
uint16_t junk;
- asf_header = malloc(sizeof(asf_header_internal_t));
+ asf_header = calloc(1, sizeof(asf_header_internal_t));
if (!asf_header)
return NULL;
- memset(asf_header, 0, sizeof(asf_header_internal_t));
lprintf("parsing_asf_header\n");
if (buffer_len < 6) {
@@ -703,10 +701,9 @@ asf_header_t *asf_header_new (uint8_t *buffer, int buffer_len) {
}
if (!asf_header->pub.content) {
lprintf("no content object present\n");
- asf_header->pub.content = malloc(sizeof(asf_content_t));
+ asf_header->pub.content = calloc(1, sizeof(asf_content_t));
if (!asf_header->pub.content)
goto exit_error;
- memset(asf_header->pub.content, 0, sizeof(asf_content_t));
}
return &asf_header->pub;
diff --git a/src/demuxers/demux_4xm.c b/src/demuxers/demux_4xm.c
index a5fcd6568..c264e4421 100644
--- a/src/demuxers/demux_4xm.c
+++ b/src/demuxers/demux_4xm.c
@@ -158,7 +158,7 @@ static int open_fourxm_file(demux_fourxm_t *fourxm) {
/* read the whole header */
header_size = _X_LE_32(&preview[4]) - 4;
- header = xine_xmalloc(header_size);
+ header = malloc(header_size);
if (!header || fourxm->input->read(fourxm->input, header, header_size) != header_size) {
free(header);
return 0;
diff --git a/src/demuxers/demux_aiff.c b/src/demuxers/demux_aiff.c
index ae3f1ebf2..6f8953a90 100644
--- a/src/demuxers/demux_aiff.c
+++ b/src/demuxers/demux_aiff.c
@@ -85,7 +85,7 @@ typedef struct {
} demux_aiff_class_t;
/* converts IEEE 80bit extended into int, based on FFMPEG code */
-int extended_to_int(const unsigned char p[10])
+static int extended_to_int(const unsigned char p[10])
{
uint64_t m = 0;
int e, i;
diff --git a/src/demuxers/demux_avi.c b/src/demuxers/demux_avi.c
index 01efe0e53..37f74ddb1 100644
--- a/src/demuxers/demux_avi.c
+++ b/src/demuxers/demux_avi.c
@@ -790,7 +790,7 @@ static avi_t *AVI_init(demux_avi_t *this) {
if(strncasecmp(data,"hdrl",4) == 0) {
hdrl_len = n;
- hdrl_data = (unsigned char *) xine_xmalloc(n);
+ hdrl_data = (unsigned char *) malloc(n);
if(hdrl_data==0)
ERR_EXIT(AVI_ERR_NO_MEM);
if (this->input->read(this->input, hdrl_data,n) != n )
@@ -812,9 +812,8 @@ static avi_t *AVI_init(demux_avi_t *this) {
break if this is not the case */
AVI->n_idx = AVI->max_idx = n / 16;
- if (AVI->idx)
- free(AVI->idx); /* On the off chance there are multiple index chunks */
- AVI->idx = (unsigned char((*)[16])) xine_xmalloc(n);
+ free(AVI->idx); /* On the off chance there are multiple index chunks */
+ AVI->idx = (unsigned char((*)[16])) malloc(n);
if (AVI->idx == 0)
ERR_EXIT(AVI_ERR_NO_MEM);
@@ -882,7 +881,6 @@ static avi_t *AVI_init(demux_avi_t *this) {
this->AVI_errno = AVI_ERR_NO_MEM;
return 0;
}
- memset((void *)a,0,sizeof(avi_audio_t));
AVI->audio[AVI->n_audio] = a;
a->audio_strn = num_stream;
@@ -922,7 +920,7 @@ static avi_t *AVI_init(demux_avi_t *this) {
if(lasttag == 1) {
/* lprintf ("size : %d\n",sizeof(AVI->bih)); */
AVI->bih = (xine_bmiheader *)
- xine_xmalloc((n < sizeof(xine_bmiheader)) ? sizeof(xine_bmiheader) : n);
+ malloc((n < sizeof(xine_bmiheader)) ? sizeof(xine_bmiheader) : n);
if(AVI->bih == NULL) {
this->AVI_errno = AVI_ERR_NO_MEM;
return 0;
diff --git a/src/demuxers/demux_film.c b/src/demuxers/demux_film.c
index 7abbf7134..27986d9e1 100644
--- a/src/demuxers/demux_film.c
+++ b/src/demuxers/demux_film.c
@@ -151,7 +151,7 @@ static int open_film_file(demux_film_t *film) {
/* header size = header size - 16-byte FILM signature */
film_header_size = _X_BE_32(&scratch[4]) - 16;
- film_header = xine_xmalloc(film_header_size);
+ film_header = malloc(film_header_size);
if (!film_header)
return 0;
strncpy(film->version, &scratch[8], 4);
@@ -331,10 +331,8 @@ static int open_film_file(demux_film_t *film) {
/* allocate enough space in the interleave preload buffer for the
* first chunk (which will be more than enough for successive chunks) */
if (film->audio_type) {
- if (film->interleave_buffer)
- free(film->interleave_buffer);
- film->interleave_buffer =
- xine_xmalloc(film->sample_table[0].sample_size);
+ free(film->interleave_buffer);
+ film->interleave_buffer = calloc(1, film->sample_table[0].sample_size);
if (!film->interleave_buffer)
goto film_abort;
}
diff --git a/src/demuxers/demux_iff.c b/src/demuxers/demux_iff.c
index d43eebf22..1785e86d7 100644
--- a/src/demuxers/demux_iff.c
+++ b/src/demuxers/demux_iff.c
@@ -399,7 +399,7 @@ static int read_iff_chunk(demux_iff_t *this) {
case IFF_CMAP_CHUNK:
/* every color contains red, green and blue componente using 8Bit */
this->cmap_num = junk_size / PIC_SIZE_OF_COLOR_REGISTER;
- this->cmap = (ColorRegister *)xine_xmalloc(junk_size);
+ this->cmap = (ColorRegister *)malloc(junk_size);
this->video_send_palette = 1;
if (!this->cmap || this->input->read(this->input, (char *)this->cmap, junk_size) != junk_size)
return 0;
@@ -711,14 +711,14 @@ static int demux_iff_send_chunk(demux_plugin_t *this_gen) {
if (this->audio_interleave_buffer_size > 0)
{
this->audio_interleave_buffer =
- xine_xmalloc(this->audio_interleave_buffer_size);
+ calloc(1, this->audio_interleave_buffer_size);
if (!this->audio_interleave_buffer)
return this->status = DEMUX_FINISHED;
}
if (this->audio_read_buffer_size > 0)
{
this->audio_read_buffer =
- xine_xmalloc(this->audio_read_buffer_size);
+ calloc(1, this->audio_read_buffer_size);
if (!this->audio_read_buffer)
return this->status = DEMUX_FINISHED;
}
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_ogg.c b/src/demuxers/demux_ogg.c
index c8c39c991..e0cddfcf4 100644
--- a/src/demuxers/demux_ogg.c
+++ b/src/demuxers/demux_ogg.c
@@ -2027,7 +2027,6 @@ static demux_plugin_t *anx_open_plugin (demux_class_t *class_gen,
*/
this = calloc(1, sizeof(demux_ogg_t));
- memset (this, 0, sizeof(demux_ogg_t));
this->stream = stream;
this->input = input;
@@ -2073,7 +2072,6 @@ static demux_plugin_t *ogg_open_plugin (demux_class_t *class_gen,
*/
this = calloc(1, sizeof(demux_ogg_t));
- memset (this, 0, sizeof(demux_ogg_t));
this->stream = stream;
this->input = input;
diff --git a/src/demuxers/demux_qt.c b/src/demuxers/demux_qt.c
index bb7d62082..e51344798 100644
--- a/src/demuxers/demux_qt.c
+++ b/src/demuxers/demux_qt.c
@@ -134,7 +134,7 @@ typedef unsigned int qt_atom;
#define MAX_PTS_DIFF 100000
/* network bandwidth, cribbed from src/input/input_mms.c */
-const int64_t bandwidths[]={14400,19200,28800,33600,34430,57600,
+static const int64_t bandwidths[]={14400,19200,28800,33600,34430,57600,
115200,262200,393216,524300,1544000,10485800};
/* these are things that can go wrong */
@@ -1736,7 +1736,6 @@ static qt_error build_frame_table(qt_trak *trak,
media_id_counts = calloc(trak->stsd_atoms_count, sizeof(int));
if (!media_id_counts)
return QT_NO_MEMORY;
- memset(media_id_counts, 0, trak->stsd_atoms_count * sizeof(int));
/* iterate through each start chunk in the stsc table */
for (i = 0; i < trak->sample_to_chunk_count; i++) {
diff --git a/src/demuxers/demux_real.c b/src/demuxers/demux_real.c
index ad5daf5ea..48bf24969 100644
--- a/src/demuxers/demux_real.c
+++ b/src/demuxers/demux_real.c
@@ -440,7 +440,7 @@ static void real_parse_headers (demux_real_t *this) {
case CONT_TAG:
chunk_size -= PREAMBLE_SIZE;
- chunk_buffer = xine_xmalloc(chunk_size);
+ chunk_buffer = malloc(chunk_size);
if (this->input->read(this->input, chunk_buffer, chunk_size) !=
chunk_size) {
free (chunk_buffer);
diff --git a/src/demuxers/demux_realaudio.c b/src/demuxers/demux_realaudio.c
index e34fe0857..bc132adae 100644
--- a/src/demuxers/demux_realaudio.c
+++ b/src/demuxers/demux_realaudio.c
@@ -110,7 +110,7 @@ static int open_ra_file(demux_ra_t *this) {
}
/* allocate for and read header data */
- this->header = xine_xmalloc(this->header_size);
+ this->header = malloc(this->header_size);
if (!this->header || _x_demux_read_header(this->input, this->header, this->header_size) != this->header_size) {
xprintf(this->stream->xine, XINE_VERBOSITY_DEBUG, "demux_realaudio: unable to read header\n");
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_wav.c b/src/demuxers/demux_wav.c
index b8d3a8229..4a1cc78ec 100644
--- a/src/demuxers/demux_wav.c
+++ b/src/demuxers/demux_wav.c
@@ -126,7 +126,7 @@ static int open_wav_file(demux_wav_t *this) {
return 0;
this->input->seek(this->input, wave_pos, SEEK_SET);
- this->wave = xine_xmalloc( this->wave_size );
+ this->wave = malloc( this->wave_size );
if (!this->wave || this->input->read(this->input, (void *)this->wave, this->wave_size) !=
this->wave_size) {
diff --git a/src/demuxers/demux_wc3movie.c b/src/demuxers/demux_wc3movie.c
index e84dab9c6..64ae431fb 100644
--- a/src/demuxers/demux_wc3movie.c
+++ b/src/demuxers/demux_wc3movie.c
@@ -102,7 +102,7 @@ typedef struct {
} demux_mve_class_t;
/* bizarre palette lookup table */
-const unsigned char wc3_pal_lookup[] = {
+static const unsigned char wc3_pal_lookup[] = {
0x00, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0E, 0x10, 0x12, 0x13, 0x15, 0x16,
0x18, 0x19, 0x1A,
0x1C, 0x1D, 0x1F, 0x20, 0x21, 0x23, 0x24, 0x25, 0x27, 0x28, 0x29, 0x2A, 0x2C,
@@ -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);