diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-12-06 03:14:00 +0300 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-12-08 16:12:42 +0300 |
commit | 72745beb44b4ddf60b77833b2edddf80e8f79ef2 (patch) | |
tree | 5109f81b7f1ba2e05635c766a304aea98ad160e6 | |
parent | e5ba554edf961e1ff761d68d4ebf5a7ea4e5a3b7 (diff) |
avformat/aadec: Use smaller scope for variables
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
-rw-r--r-- | libavformat/aadec.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libavformat/aadec.c b/libavformat/aadec.c index 840a9968c6..b8a5428f1f 100644 --- a/libavformat/aadec.c +++ b/libavformat/aadec.c @@ -71,7 +71,7 @@ static int get_second_size(char *codec_name) static int aa_read_header(AVFormatContext *s) { - int i, idx, largest_idx = -1; + int largest_idx = -1; uint32_t toc_size, npairs, header_seed = 0, start; char codec_name[64] = {0}; uint8_t buf[24]; @@ -80,7 +80,6 @@ static int aa_read_header(AVFormatContext *s) uint32_t offset; uint32_t size; } TOC[MAX_TOC_ENTRIES]; - uint32_t header_key_part[4]; uint8_t header_key[16] = {0}; AADemuxContext *c = s->priv_data; char file_key[2 * sizeof(c->file_key) + 1]; @@ -96,7 +95,7 @@ static int aa_read_header(AVFormatContext *s) avio_skip(pb, 4); // unidentified integer if (toc_size > MAX_TOC_ENTRIES || toc_size < 2) return AVERROR_INVALIDDATA; - for (i = 0; i < toc_size; i++) { // read TOC + for (uint32_t i = 0; i < toc_size; i++) { // read TOC avio_skip(pb, 4); // TOC entry index TOC[i].offset = avio_rb32(pb); // block offset TOC[i].size = avio_rb32(pb); // block size @@ -105,7 +104,7 @@ static int aa_read_header(AVFormatContext *s) npairs = avio_rb32(pb); // read dictionary entries if (npairs > MAX_DICTIONARY_ENTRIES) return AVERROR_INVALIDDATA; - for (i = 0; i < npairs; i++) { + for (uint32_t i = 0; i < npairs; i++) { char key[128], val[128]; uint32_t nkey, nval; @@ -121,6 +120,7 @@ static int aa_read_header(AVFormatContext *s) av_log(s, AV_LOG_DEBUG, "HeaderSeed is <%s>\n", val); header_seed = atoi(val); } else if (!strcmp(key, "HeaderKey")) { // this looks like "1234567890 1234567890 1234567890 1234567890" + uint32_t header_key_part[4]; av_log(s, AV_LOG_DEBUG, "HeaderKey is <%s>\n", val); ret = sscanf(val, "%"SCNu32"%"SCNu32"%"SCNu32"%"SCNu32, @@ -128,9 +128,8 @@ static int aa_read_header(AVFormatContext *s) if (ret != 4) return AVERROR_INVALIDDATA; - for (idx = 0; idx < 4; idx++) { + for (int idx = 0; idx < 4; idx++) AV_WB32(&header_key[idx * 4], header_key_part[idx]); // convert each part to BE! - } ff_data_to_hex(key, header_key, sizeof(header_key), 1); av_log(s, AV_LOG_DEBUG, "Processed HeaderKey is %s\n", key); } else { @@ -195,7 +194,7 @@ static int aa_read_header(AVFormatContext *s) } /* determine, and jump to audio start offset */ - for (i = 1; i < toc_size; i++) { // skip the first entry! + for (uint32_t i = 1; i < toc_size; i++) { // skip the first entry! current_size = TOC[i].size; if (current_size > largest_size) { largest_idx = i; |