[FFmpeg-cvslog] parseutils-test: Move some variable declarations to avoid block braces

Diego Biurrun git at videolan.org
Sun Apr 17 20:46:17 CEST 2016


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Mon Mar 21 16:55:42 2016 +0100| [a84713e70d06238100cb0f867ad6031c272054b0] | committer: Diego Biurrun

parseutils-test: Move some variable declarations to avoid block braces

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

 libavutil/parseutils.c |  164 +++++++++++++++++++++++-------------------------
 1 file changed, 80 insertions(+), 84 deletions(-)

diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c
index 39238f2..ba21a2e 100644
--- a/libavutil/parseutils.c
+++ b/libavutil/parseutils.c
@@ -659,94 +659,90 @@ int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info
 
 int main(void)
 {
+    int i;
+    uint8_t rgba[4];
+    static const char *const rates[] = {
+        "-inf",
+        "inf",
+        "nan",
+        "123/0",
+        "-123 / 0",
+        "",
+        "/",
+        " 123  /  321",
+        "foo/foo",
+        "foo/1",
+        "1/foo",
+        "0/0",
+        "/0",
+        "1/",
+        "1",
+        "0",
+        "-123/123",
+        "-foo",
+        "123.23",
+        ".23",
+        "-.23",
+        "-0.234",
+        "-0.0000001",
+        "  21332.2324   ",
+        " -21332.2324   ",
+    };
+    static const char *const color_names[] = {
+        "foo",
+        "red",
+        "Red ",
+        "RED",
+        "Violet",
+        "Yellow",
+        "Red",
+        "0x000000",
+        "0x0000000",
+        "0xff000000",
+        "0x3e34ff",
+        "0x3e34ffaa",
+        "0xffXXee",
+        "0xfoobar",
+        "0xffffeeeeeeee",
+        "#ff0000",
+        "#ffXX00",
+        "ff0000",
+        "ffXX00",
+        "red at foo",
+        "random at 10",
+        "0xff0000 at 1.0",
+        "red@",
+        "red at 0xfff",
+        "red at 0xf",
+        "red at 2",
+        "red at 0.1",
+        "red at -1",
+        "red at 0.5",
+        "red at 1.0",
+        "red at 256",
+        "red at 10foo",
+        "red at -1.0",
+        "red at -0.0",
+    };
+
     printf("Testing av_parse_video_rate()\n");
-    {
-        int i;
-        static const char *const rates[] = {
-            "-inf",
-            "inf",
-            "nan",
-            "123/0",
-            "-123 / 0",
-            "",
-            "/",
-            " 123  /  321",
-            "foo/foo",
-            "foo/1",
-            "1/foo",
-            "0/0",
-            "/0",
-            "1/",
-            "1",
-            "0",
-            "-123/123",
-            "-foo",
-            "123.23",
-            ".23",
-            "-.23",
-            "-0.234",
-            "-0.0000001",
-            "  21332.2324   ",
-            " -21332.2324   ",
-        };
-
-        for (i = 0; i < FF_ARRAY_ELEMS(rates); i++) {
-            int ret;
-            AVRational q = { 0, 0 };
-            ret = av_parse_video_rate(&q, rates[i]);
-            printf("'%s' -> %d/%d %s\n",
-                   rates[i], q.num, q.den, ret ? "ERROR" : "OK");
-        }
+
+    for (i = 0; i < FF_ARRAY_ELEMS(rates); i++) {
+        int ret;
+        AVRational q = { 0, 0 };
+        ret = av_parse_video_rate(&q, rates[i]);
+        printf("'%s' -> %d/%d %s\n",
+               rates[i], q.num, q.den, ret ? "ERROR" : "OK");
     }
 
     printf("\nTesting av_parse_color()\n");
-    {
-        int i;
-        uint8_t rgba[4];
-        static const char *const color_names[] = {
-            "foo",
-            "red",
-            "Red ",
-            "RED",
-            "Violet",
-            "Yellow",
-            "Red",
-            "0x000000",
-            "0x0000000",
-            "0xff000000",
-            "0x3e34ff",
-            "0x3e34ffaa",
-            "0xffXXee",
-            "0xfoobar",
-            "0xffffeeeeeeee",
-            "#ff0000",
-            "#ffXX00",
-            "ff0000",
-            "ffXX00",
-            "red at foo",
-            "random at 10",
-            "0xff0000 at 1.0",
-            "red@",
-            "red at 0xfff",
-            "red at 0xf",
-            "red at 2",
-            "red at 0.1",
-            "red at -1",
-            "red at 0.5",
-            "red at 1.0",
-            "red at 256",
-            "red at 10foo",
-            "red at -1.0",
-            "red at -0.0",
-        };
-
-        av_log_set_level(AV_LOG_DEBUG);
-
-        for (i = 0;  i < FF_ARRAY_ELEMS(color_names); i++) {
-            if (av_parse_color(rgba, color_names[i], -1, NULL) >= 0)
-                printf("%s -> R(%d) G(%d) B(%d) A(%d)\n",
-                       color_names[i], rgba[0], rgba[1], rgba[2], rgba[3]);
-        }
+
+    av_log_set_level(AV_LOG_DEBUG);
+
+    for (i = 0;  i < FF_ARRAY_ELEMS(color_names); i++) {
+        if (av_parse_color(rgba, color_names[i], -1, NULL) >= 0)
+            printf("%s -> R(%d) G(%d) B(%d) A(%d)\n",
+                   color_names[i], rgba[0], rgba[1], rgba[2], rgba[3]);
     }
 
     return 0;



More information about the ffmpeg-cvslog mailing list