[FFmpeg-cvslog] Employ FF_ARRAY_ELEMS instead of manually calculating array length.

Diego Biurrun git at videolan.org
Wed Sep 21 21:08:30 CEST 2011


ffmpeg | branch: release/0.8 | Diego Biurrun <diego at biurrun.de> | Thu Sep  8 14:21:38 2011 +0200| [5cc5152e80bd041e7ba47d174a83013c335539a9] | committer: Michael Niedermayer

Employ FF_ARRAY_ELEMS instead of manually calculating array length.
(cherry picked from commit 6376362d15ccbc02e15d0b3b7a7a5d862efd6b91)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5cc5152e80bd041e7ba47d174a83013c335539a9
---

 libavformat/avlanguage.c |    3 ++-
 libavformat/mxf.c        |    3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/avlanguage.c b/libavformat/avlanguage.c
index 525bf07..39f2560 100644
--- a/libavformat/avlanguage.c
+++ b/libavformat/avlanguage.c
@@ -20,6 +20,7 @@
 
 #include "avlanguage.h"
 #include "libavutil/avstring.h"
+#include "libavutil/common.h"
 #include <stdlib.h>
 #include <stdint.h>
 #include <string.h>
@@ -736,7 +737,7 @@ const char *av_convert_lang_to(const char *lang, enum AVLangCodespace target_cod
 {
     int i;
     const LangEntry *entry = NULL;
-    const int NB_CODESPACES = sizeof(lang_table_counts)/sizeof(*lang_table_counts);
+    const int NB_CODESPACES = FF_ARRAY_ELEMS(lang_table_counts);
 
     if (target_codespace >= NB_CODESPACES)
         return NULL;
diff --git a/libavformat/mxf.c b/libavformat/mxf.c
index 643a952..50ea3b5 100644
--- a/libavformat/mxf.c
+++ b/libavformat/mxf.c
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include "libavutil/common.h"
 #include "mxf.h"
 
 /**
@@ -80,7 +81,7 @@ static const struct {
     {PIX_FMT_PAL8,    {'P', 8                                           }},
 };
 
-static const int num_pixel_layouts = sizeof(ff_mxf_pixel_layouts) / sizeof(*ff_mxf_pixel_layouts);
+static const int num_pixel_layouts = FF_ARRAY_ELEMS(ff_mxf_pixel_layouts);
 
 int ff_mxf_decode_pixel_layout(const char pixel_layout[16], enum PixelFormat *pix_fmt)
 {



More information about the ffmpeg-cvslog mailing list