diff options
author | Aurelien Jacobs <aurel@gnuage.org> | 2008-10-21 21:40:24 +0000 |
---|---|---|
committer | Aurelien Jacobs <aurel@gnuage.org> | 2008-10-21 21:40:24 +0000 |
commit | 37d3e0667abd01124d783f3ca10a4aef05746a2a (patch) | |
tree | 284c171f9546a8f4dc4c12878ecb1c8333f63a76 /libavformat | |
parent | 03092e14089e086065bf05671260347ad94a6262 (diff) | |
download | ffmpeg-37d3e0667abd01124d783f3ca10a4aef05746a2a.tar.gz |
uses FF_ARRAY_ELEMS() where appropriate
Originally committed as revision 15662 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/img2.c | 2 | ||||
-rw-r--r-- | libavformat/isom.c | 4 | ||||
-rw-r--r-- | libavformat/matroskadec.c | 8 | ||||
-rw-r--r-- | libavformat/mxfenc.c | 11 | ||||
-rw-r--r-- | libavformat/utils.c | 4 |
5 files changed, 12 insertions, 17 deletions
diff --git a/libavformat/img2.c b/libavformat/img2.c index f15a6da62e..9706392817 100644 --- a/libavformat/img2.c +++ b/libavformat/img2.c @@ -88,7 +88,7 @@ static int infer_size(int *width_ptr, int *height_ptr, int size) { int i; - for(i=0;i<sizeof(sizes)/sizeof(sizes[0]);i++) { + for(i=0;i<FF_ARRAY_ELEMS(sizes);i++) { if ((sizes[i][0] * sizes[i][1]) == size) { *width_ptr = sizes[i][0]; *height_ptr = sizes[i][1]; diff --git a/libavformat/isom.c b/libavformat/isom.c index 304aa192a5..879135446f 100644 --- a/libavformat/isom.c +++ b/libavformat/isom.c @@ -248,7 +248,7 @@ int ff_mov_iso639_to_lang(const char *lang, int mp4) int i, code = 0; /* old way, only for QT? */ - for (i = 0; !mp4 && (i < (sizeof(mov_mdhd_language_map)/sizeof(char *))); i++) { + for (i = 0; !mp4 && i < FF_ARRAY_ELEMS(mov_mdhd_language_map); i++) { if (mov_mdhd_language_map[i] && !strcmp(lang, mov_mdhd_language_map[i])) return i; } @@ -284,7 +284,7 @@ int ff_mov_lang_to_iso639(int code, char *to) return 1; } /* old fashion apple lang code */ - if (code >= (sizeof(mov_mdhd_language_map)/sizeof(char *))) + if (code >= FF_ARRAY_ELEMS(mov_mdhd_language_map)) return 0; if (!mov_mdhd_language_map[code]) return 0; diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 0345f575c3..cedfb3d20d 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -226,8 +226,6 @@ typedef struct { EbmlList blocks; } MatroskaCluster; -#define ARRAY_SIZE(x) (sizeof(x)/sizeof(*x)) - static EbmlSyntax ebml_header[] = { { EBML_ID_EBMLREADVERSION, EBML_UINT, 0, offsetof(Ebml,version), {.u=EBML_VERSION} }, { EBML_ID_EBMLMAXSIZELENGTH, EBML_UINT, 0, offsetof(Ebml,max_size), {.u=8} }, @@ -980,7 +978,7 @@ static void matroska_convert_tags(AVFormatContext *s, EbmlList *list) int i, j; for (i=0; i < list->nb_elem; i++) { - for (j=0; j < ARRAY_SIZE(metadata); j++){ + for (j=0; j < FF_ARRAY_ELEMS(metadata); j++){ if (!strcmp(tags[i].name, metadata[j].name)) { int *ptr = (int *)((char *)s + metadata[j].offset); if (*ptr) continue; @@ -1050,7 +1048,7 @@ static int matroska_aac_profile(char *codec_id) static const char * const aac_profiles[] = { "MAIN", "LC", "SSR" }; int profile; - for (profile=0; profile<ARRAY_SIZE(aac_profiles); profile++) + for (profile=0; profile<FF_ARRAY_ELEMS(aac_profiles); profile++) if (strstr(codec_id, aac_profiles[profile])) break; return profile + 1; @@ -1060,7 +1058,7 @@ static int matroska_aac_sri(int samplerate) { int sri; - for (sri=0; sri<ARRAY_SIZE(ff_mpeg4audio_sample_rates); sri++) + for (sri=0; sri<FF_ARRAY_ELEMS(ff_mpeg4audio_sample_rates); sri++) if (ff_mpeg4audio_sample_rates[sri] == samplerate) break; return sri; diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index c649870aac..8f2a2909a8 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -74,8 +74,7 @@ static const MXFContainerEssenceEntry mxf_essence_container_uls[] = { typedef struct MXFContext { int64_t footer_partition_offset; int essence_container_count; - uint8_t essence_containers_indices[sizeof(mxf_essence_container_uls)/ - sizeof(*mxf_essence_container_uls)]; + uint8_t essence_containers_indices[FF_ARRAY_ELEMS(mxf_essence_container_uls)]; } MXFContext; static const uint8_t uuid_base[] = { 0xAD,0xAB,0x44,0x24,0x2f,0x25,0x4d,0xc7,0x92,0xff,0x29,0xbd }; @@ -207,8 +206,7 @@ static int klv_encode_ber_length(ByteIOContext *pb, uint64_t len) static int mxf_get_essence_container_ul_index(enum CodecID id) { int i; - for (i = 0; i < sizeof(mxf_essence_container_uls)/ - sizeof(*mxf_essence_container_uls); i++) + for (i = 0; i < FF_ARRAY_ELEMS(mxf_essence_container_uls); i++) if (mxf_essence_container_uls[i].id == id) return i; return -1; @@ -219,7 +217,7 @@ static void mxf_write_primer_pack(AVFormatContext *s) ByteIOContext *pb = s->pb; int local_tag_number, i = 0; - local_tag_number = sizeof(mxf_local_tag_batch)/sizeof(*mxf_local_tag_batch); + local_tag_number = FF_ARRAY_ELEMS(mxf_local_tag_batch); put_buffer(pb, primer_pack_key, 16); klv_encode_ber_length(pb, local_tag_number * 18 + 8); @@ -754,8 +752,7 @@ static int mxf_write_header(AVFormatContext *s) { MXFContext *mxf = s->priv_data; int i; - uint8_t present[sizeof(mxf_essence_container_uls)/ - sizeof(*mxf_essence_container_uls)] = {0}; + uint8_t present[FF_ARRAY_ELEMS(mxf_essence_container_uls)] = {0}; for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; diff --git a/libavformat/utils.c b/libavformat/utils.c index 51bc5c58fb..9ef1345236 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2904,7 +2904,7 @@ int64_t parse_date(const char *datestr, int duration) q = NULL; if (!duration) { /* parse the year-month-day part */ - for (i = 0; i < sizeof(date_fmt) / sizeof(date_fmt[0]); i++) { + for (i = 0; i < FF_ARRAY_ELEMS(date_fmt); i++) { q = small_strptime(p, date_fmt[i], &dt); if (q) { break; @@ -2928,7 +2928,7 @@ int64_t parse_date(const char *datestr, int duration) p++; /* parse the hour-minute-second part */ - for (i = 0; i < sizeof(time_fmt) / sizeof(time_fmt[0]); i++) { + for (i = 0; i < FF_ARRAY_ELEMS(time_fmt); i++) { q = small_strptime(p, time_fmt[i], &dt); if (q) { break; |