summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-07-23 00:45:23 +0200
committerwm4 <wm4@nowhere>2013-07-23 00:45:23 +0200
commite83cbde1a4b816a64cefde1fb8bdbac403079600 (patch)
tree1ac71b13723174ab48465915fd5e9916faa7df35 /demux
parent78ebb3c6fa637206bb369349ba93328b36895e2b (diff)
downloadmpv-e83cbde1a4b816a64cefde1fb8bdbac403079600.tar.bz2
mpv-e83cbde1a4b816a64cefde1fb8bdbac403079600.tar.xz
Fix some -Wshadow warnings
In general, this warning can hint to actual bugs. We don't enable it yet, because it would conflict with some unmerged code, and we should check with clang too (this commit was done by testing with gcc).
Diffstat (limited to 'demux')
-rw-r--r--demux/demux_mkv.c15
-rw-r--r--demux/ebml.c7
-rw-r--r--demux/mf.c10
3 files changed, 15 insertions, 17 deletions
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c
index 408e69390a..cc84565a60 100644
--- a/demux/demux_mkv.c
+++ b/demux/demux_mkv.c
@@ -734,9 +734,9 @@ static int demux_mkv_read_cues(demuxer_t *demuxer)
continue;
}
uint64_t time = cuepoint->cue_time;
- for (int i = 0; i < cuepoint->n_cue_track_positions; i++) {
+ for (int c = 0; c < cuepoint->n_cue_track_positions; c++) {
struct ebml_cue_track_positions *trackpos =
- &cuepoint->cue_track_positions[i];
+ &cuepoint->cue_track_positions[c];
uint64_t pos = mkv_d->segment_start + trackpos->cue_cluster_position;
cue_index_add(demuxer, trackpos->cue_track, pos, time);
mp_msg(MSGT_DEMUX, MSGL_DBG2,
@@ -853,9 +853,9 @@ static int demux_mkv_read_chapters(struct demuxer *demuxer)
memcpy(chapter.segment_uid, ca->chapter_segment_uid.start,
len);
mp_msg(MSGT_DEMUX, MSGL_V, "[mkv] Chapter segment uid ");
- for (int i = 0; i < len; i++)
+ for (int n = 0; n < len; n++)
mp_msg(MSGT_DEMUX, MSGL_V, "%02x ",
- chapter.segment_uid[i]);
+ chapter.segment_uid[n]);
mp_msg(MSGT_DEMUX, MSGL_V, "\n");
}
}
@@ -1979,16 +1979,15 @@ static void handle_realaudio(demuxer_t *demuxer, mkv_track_t *track,
|| (track->a_formattag == mmioFOURCC('s', 'i', 'p', 'r'))) {
// if(!block_bref)
// spc = track->sub_packet_cnt = 0;
- int x;
switch (track->a_formattag) {
case mmioFOURCC('2', '8', '_', '8'):
- for (x = 0; x < sph / 2; x++)
+ for (int x = 0; x < sph / 2; x++)
memcpy(track->audio_buf + x * 2 * w + spc * cfs,
buffer + cfs * x, cfs);
break;
case mmioFOURCC('c', 'o', 'o', 'k'):
case mmioFOURCC('a', 't', 'r', 'c'):
- for (x = 0; x < w / sps; x++)
+ for (int x = 0; x < w / sps; x++)
memcpy(track->audio_buf +
sps * (sph * x + ((sph + 1) / 2) * (spc & 1) +
(spc >> 1)), buffer + sps * x, sps);
@@ -2039,7 +2038,7 @@ static void handle_realaudio(demuxer_t *demuxer, mkv_track_t *track,
int apk_usize = track->stream->audio->wf->nBlockAlign;
track->sub_packet_cnt = 0;
// Release all the audio packets
- for (x = 0; x < sph * w / apk_usize; x++) {
+ for (int x = 0; x < sph * w / apk_usize; x++) {
dp = new_demux_packet_from(track->audio_buf + x * apk_usize,
apk_usize);
/* Put timestamp only on packets that correspond to original
diff --git a/demux/ebml.c b/demux/ebml.c
index 98ab1ef306..2314121f5e 100644
--- a/demux/ebml.c
+++ b/demux/ebml.c
@@ -459,12 +459,12 @@ static void ebml_parse_element(struct ebml_parse_ctx *ctx, void *target,
level, " ", type->name);
char *s = target;
- int len;
uint8_t *end = data + size;
uint8_t *p = data;
int num_elems[MAX_EBML_SUBELEMENTS] = {};
while (p < end) {
uint8_t *startp = p;
+ int len;
uint32_t id = ebml_parse_id(p, &len);
if (len > end - p)
goto past_end_error;
@@ -523,9 +523,8 @@ static void ebml_parse_element(struct ebml_parse_ctx *ctx, void *target,
case EBML_TYPE_SUBELEMENTS:
num_elems[i] = FFMIN(num_elems[i],
1000000000 / type->fields[i].desc->size);
- int size = num_elems[i] * type->fields[i].desc->size;
- *(generic_struct **) ptr = talloc_zero_size(ctx->talloc_ctx,
- size);
+ int sz = num_elems[i] * type->fields[i].desc->size;
+ *(generic_struct **) ptr = talloc_zero_size(ctx->talloc_ctx, sz);
break;
case EBML_TYPE_UINT:
*(uint64_t **) ptr = talloc_zero_array(ctx->talloc_ctx,
diff --git a/demux/mf.c b/demux/mf.c
index 21c3fad186..726bc8f394 100644
--- a/demux/mf.c
+++ b/demux/mf.c
@@ -96,20 +96,20 @@ mf_t* open_mf_pattern(char * filename)
{
bstr bfname;
bstr_split_tok(bfilename, ",", &bfname, &bfilename);
- char *fname = bstrdup0(NULL, bfname);
+ char *fname2 = bstrdup0(NULL, bfname);
- if ( !mp_path_exists( fname ) )
+ if ( !mp_path_exists( fname2 ) )
{
- mp_msg( MSGT_STREAM,MSGL_V,"[mf] file not found: '%s'\n",fname );
+ mp_msg( MSGT_STREAM,MSGL_V,"[mf] file not found: '%s'\n",fname2 );
}
else
{
mf->names=realloc( mf->names,( mf->nr_of_files + 1 ) * sizeof( char* ) );
- mf->names[mf->nr_of_files] = strdup(fname);
+ mf->names[mf->nr_of_files] = strdup(fname2);
// mp_msg( MSGT_STREAM,MSGL_V,"[mf] added file %d.: %s\n",mf->nr_of_files,mf->names[mf->nr_of_files] );
mf->nr_of_files++;
}
- talloc_free(fname);
+ talloc_free(fname2);
}
mp_msg( MSGT_STREAM,MSGL_INFO,"[mf] number of files: %d\n",mf->nr_of_files );