From: softworkz <softwo...@hotmail.com>

Reviewed-by: Stefano Sabatini <stefa...@gmail.com>
Signed-off-by: softworkz <softwo...@hotmail.com>
---
 fftools/textformat/avtextformat.c  | 86 ++++++++++++++--------------
 fftools/textformat/avtextformat.h  | 16 +++---
 fftools/textformat/avtextwriters.h | 11 ++--
 fftools/textformat/tf_compact.c    | 91 +++++++++++++++++-------------
 fftools/textformat/tf_default.c    | 20 +++----
 fftools/textformat/tf_flat.c       | 26 +++++----
 fftools/textformat/tf_ini.c        | 36 ++++++------
 fftools/textformat/tf_json.c       | 10 ++--
 fftools/textformat/tf_xml.c        | 30 +++++-----
 9 files changed, 172 insertions(+), 154 deletions(-)

diff --git a/fftools/textformat/avtextformat.c 
b/fftools/textformat/avtextformat.c
index 9200b9b1ad..74d179c516 100644
--- a/fftools/textformat/avtextformat.c
+++ b/fftools/textformat/avtextformat.c
@@ -34,9 +34,9 @@
 #include "libavutil/opt.h"
 #include "avtextformat.h"
 
-#define SECTION_ID_NONE -1
+#define SECTION_ID_NONE (-1)
 
-#define SHOW_OPTIONAL_FIELDS_AUTO       -1
+#define SHOW_OPTIONAL_FIELDS_AUTO      (-1)
 #define SHOW_OPTIONAL_FIELDS_NEVER       0
 #define SHOW_OPTIONAL_FIELDS_ALWAYS      1
 
@@ -64,14 +64,14 @@ static const char *textcontext_get_formatter_name(void *p)
 
 static const AVOption textcontext_options[] = {
     { "string_validation", "set string validation mode",
-      OFFSET(string_validation), AV_OPT_TYPE_INT, 
{.i64=AV_TEXTFORMAT_STRING_VALIDATION_REPLACE}, 0, 
AV_TEXTFORMAT_STRING_VALIDATION_NB-1, .unit = "sv" },
+      OFFSET(string_validation), AV_OPT_TYPE_INT, { .i64 = 
AV_TEXTFORMAT_STRING_VALIDATION_REPLACE }, 0, 
AV_TEXTFORMAT_STRING_VALIDATION_NB - 1, .unit = "sv" },
     { "sv", "set string validation mode",
-      OFFSET(string_validation), AV_OPT_TYPE_INT, 
{.i64=AV_TEXTFORMAT_STRING_VALIDATION_REPLACE}, 0, 
AV_TEXTFORMAT_STRING_VALIDATION_NB-1, .unit = "sv" },
-        { "ignore",  NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 
AV_TEXTFORMAT_STRING_VALIDATION_IGNORE},  .unit = "sv" },
-        { "replace", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 
AV_TEXTFORMAT_STRING_VALIDATION_REPLACE}, .unit = "sv" },
-        { "fail",    NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 
AV_TEXTFORMAT_STRING_VALIDATION_FAIL},    .unit = "sv" },
-    { "string_validation_replacement", "set string validation replacement 
string", OFFSET(string_validation_replacement), AV_OPT_TYPE_STRING, {.str=""}},
-    { "svr", "set string validation replacement string", 
OFFSET(string_validation_replacement), AV_OPT_TYPE_STRING, 
{.str="\xEF\xBF\xBD"}},
+      OFFSET(string_validation), AV_OPT_TYPE_INT, { .i64 = 
AV_TEXTFORMAT_STRING_VALIDATION_REPLACE }, 0, 
AV_TEXTFORMAT_STRING_VALIDATION_NB - 1, .unit = "sv" },
+        { "ignore",  NULL, 0, AV_OPT_TYPE_CONST,  { .i64 = 
AV_TEXTFORMAT_STRING_VALIDATION_IGNORE },  .unit = "sv" },
+        { "replace", NULL, 0, AV_OPT_TYPE_CONST,  { .i64 = 
AV_TEXTFORMAT_STRING_VALIDATION_REPLACE }, .unit = "sv" },
+        { "fail",    NULL, 0, AV_OPT_TYPE_CONST,  { .i64 = 
AV_TEXTFORMAT_STRING_VALIDATION_FAIL },    .unit = "sv" },
+    { "string_validation_replacement", "set string validation replacement 
string", OFFSET(string_validation_replacement), AV_OPT_TYPE_STRING, { .str = "" 
} },
+    { "svr", "set string validation replacement string", 
OFFSET(string_validation_replacement), AV_OPT_TYPE_STRING, { .str = 
"\xEF\xBF\xBD" } },
     { NULL }
 };
 
@@ -126,7 +126,7 @@ void avtext_context_close(AVTextFormatContext **ptctx)
 
 
 int avtext_context_open(AVTextFormatContext **ptctx, const AVTextFormatter 
*formatter, AVTextWriterContext *writer_context, const char *args,
-                        const struct AVTextFormatSection *sections, int 
nb_sections,
+                        const AVTextFormatSection *sections, int nb_sections,
                         int show_value_unit,
                         int use_value_prefix,
                         int use_byte_value_binary_prefix,
@@ -200,7 +200,7 @@ int avtext_context_open(AVTextFormatContext **ptctx, const 
AVTextFormatter *form
         av_dict_free(&opts);
     }
 
-    if (show_data_hash) {
+    if (show_data_hash)
         if ((ret = av_hash_alloc(&tctx->hash, show_data_hash)) < 0) {
             if (ret == AVERROR(EINVAL)) {
                 const char *n;
@@ -211,7 +211,6 @@ int avtext_context_open(AVTextFormatContext **ptctx, const 
AVTextFormatter *form
             }
             return ret;
         }
-    }
 
     /* validate replace string */
     {
@@ -224,7 +223,7 @@ int avtext_context_open(AVTextFormatContext **ptctx, const 
AVTextFormatter *form
             if (ret < 0) {
                 AVBPrint bp;
                 av_bprint_init(&bp, 0, AV_BPRINT_SIZE_AUTOMATIC);
-                bprint_bytes(&bp, p0, p-p0),
+                bprint_bytes(&bp, p0, p - p0),
                     av_log(tctx, AV_LOG_ERROR,
                            "Invalid UTF8 sequence %s found in string 
validation replace '%s'\n",
                            bp.str, tctx->string_validation_replacement);
@@ -248,15 +247,13 @@ fail:
 }
 
 /* Temporary definitions during refactoring */
-static const char unit_second_str[]         = "s"    ;
-static const char unit_hertz_str[]          = "Hz"   ;
-static const char unit_byte_str[]           = "byte" ;
+static const char unit_second_str[]         = "s";
+static const char unit_hertz_str[]          = "Hz";
+static const char unit_byte_str[]           = "byte";
 static const char unit_bit_per_second_str[] = "bit/s";
 
 
-void avtext_print_section_header(AVTextFormatContext *tctx,
-                                               const void *data,
-                                               int section_id)
+void avtext_print_section_header(AVTextFormatContext *tctx, const void *data, 
int section_id)
 {
     tctx->level++;
     av_assert0(tctx->level < SECTION_MAX_NB_LEVELS);
@@ -272,8 +269,9 @@ void avtext_print_section_header(AVTextFormatContext *tctx,
 void avtext_print_section_footer(AVTextFormatContext *tctx)
 {
     int section_id = tctx->section[tctx->level]->id;
-    int parent_section_id = tctx->level ?
-        tctx->section[tctx->level-1]->id : SECTION_ID_NONE;
+    int parent_section_id = tctx->level
+        ? tctx->section[tctx->level - 1]->id
+        : SECTION_ID_NONE;
 
     if (parent_section_id != SECTION_ID_NONE) {
         tctx->nb_item[tctx->level - 1]++;
@@ -285,8 +283,7 @@ void avtext_print_section_footer(AVTextFormatContext *tctx)
     tctx->level--;
 }
 
-void avtext_print_integer(AVTextFormatContext *tctx,
-                                        const char *key, int64_t val)
+void avtext_print_integer(AVTextFormatContext *tctx, const char *key, int64_t 
val)
 {
     const struct AVTextFormatSection *section = tctx->section[tctx->level];
 
@@ -324,11 +321,9 @@ static inline int validate_string(AVTextFormatContext 
*tctx, char **dstp, const
 
             switch (tctx->string_validation) {
             case AV_TEXTFORMAT_STRING_VALIDATION_FAIL:
-                av_log(tctx, AV_LOG_ERROR,
-                       "Invalid UTF-8 sequence found in string '%s'\n", src);
+                av_log(tctx, AV_LOG_ERROR, "Invalid UTF-8 sequence found in 
string '%s'\n", src);
                 ret = AVERROR_INVALIDDATA;
                 goto end;
-                break;
 
             case AV_TEXTFORMAT_STRING_VALIDATION_REPLACE:
                 av_bprintf(&dstbuf, "%s", tctx->string_validation_replacement);
@@ -340,11 +335,10 @@ static inline int validate_string(AVTextFormatContext 
*tctx, char **dstp, const
             av_bprint_append_data(&dstbuf, p0, p-p0);
     }
 
-    if (invalid_chars_nb && tctx->string_validation == 
AV_TEXTFORMAT_STRING_VALIDATION_REPLACE) {
+    if (invalid_chars_nb && tctx->string_validation == 
AV_TEXTFORMAT_STRING_VALIDATION_REPLACE)
         av_log(tctx, AV_LOG_WARNING,
                "%d invalid UTF-8 sequence(s) found in string '%s', replaced 
with '%s'\n",
                invalid_chars_nb, src, tctx->string_validation_replacement);
-    }
 
 end:
     av_bprint_finalize(&dstbuf, dstp);
@@ -352,7 +346,11 @@ end:
 }
 
 struct unit_value {
-    union { double d; int64_t i; } val;
+    union {
+        double  d;
+        int64_t i;
+    } val;
+
     const char *unit;
 };
 
@@ -402,8 +400,9 @@ static char *value_string(AVTextFormatContext *tctx, char 
*buf, int buf_size, st
             snprintf(buf, buf_size, "%f", vald);
         else
             snprintf(buf, buf_size, "%"PRId64, vali);
+
         av_strlcatf(buf, buf_size, "%s%s%s", *prefix_string || 
tctx->show_value_unit ? " " : "",
-                 prefix_string, tctx->show_value_unit ? uv.unit : "");
+                    prefix_string, tctx->show_value_unit ? uv.unit : "");
     }
 
     return buf;
@@ -427,8 +426,8 @@ int avtext_print_string(AVTextFormatContext *tctx, const 
char *key, const char *
 
     if (tctx->show_optional_fields == SHOW_OPTIONAL_FIELDS_NEVER ||
         (tctx->show_optional_fields == SHOW_OPTIONAL_FIELDS_AUTO
-        && (flags & AV_TEXTFORMAT_PRINT_STRING_OPTIONAL)
-        && !(tctx->formatter->flags & 
AV_TEXTFORMAT_FLAG_SUPPORTS_OPTIONAL_FIELDS)))
+            && (flags & AV_TEXTFORMAT_PRINT_STRING_OPTIONAL)
+            && !(tctx->formatter->flags & 
AV_TEXTFORMAT_FLAG_SUPPORTS_OPTIONAL_FIELDS)))
         return 0;
 
     if (section->show_all_entries || av_dict_get(section->entries_to_show, 
key, NULL, 0)) {
@@ -440,11 +439,10 @@ int avtext_print_string(AVTextFormatContext *tctx, const 
char *key, const char *
             if (ret < 0) goto end;
             tctx->formatter->print_string(tctx, key1, val1);
         end:
-            if (ret < 0) {
+            if (ret < 0)
                 av_log(tctx, AV_LOG_ERROR,
                        "Invalid key=value string combination %s=%s in section 
%s\n",
                        key, val, section->unique_name);
-            }
             av_free(key1);
             av_free(val1);
         } else {
@@ -457,8 +455,7 @@ int avtext_print_string(AVTextFormatContext *tctx, const 
char *key, const char *
     return ret;
 }
 
-void avtext_print_rational(AVTextFormatContext *tctx,
-                                         const char *key, AVRational q, char 
sep)
+void avtext_print_rational(AVTextFormatContext *tctx, const char *key, 
AVRational q, char sep)
 {
     char buf[44];
     snprintf(buf, sizeof(buf), "%d%c%d", q.num, sep, q.den);
@@ -466,7 +463,7 @@ void avtext_print_rational(AVTextFormatContext *tctx,
 }
 
 void avtext_print_time(AVTextFormatContext *tctx, const char *key,
-                              int64_t ts, const AVRational *time_base, int 
is_duration)
+                       int64_t ts, const AVRational *time_base, int 
is_duration)
 {
     char buf[128];
 
@@ -484,15 +481,14 @@ void avtext_print_time(AVTextFormatContext *tctx, const 
char *key,
 
 void avtext_print_ts(AVTextFormatContext *tctx, const char *key, int64_t ts, 
int is_duration)
 {
-    if ((!is_duration && ts == AV_NOPTS_VALUE) || (is_duration && ts == 0)) {
+    if ((!is_duration && ts == AV_NOPTS_VALUE) || (is_duration && ts == 0))
         avtext_print_string(tctx, key, "N/A", 
AV_TEXTFORMAT_PRINT_STRING_OPTIONAL);
-    } else {
+    else
         avtext_print_integer(tctx, key, ts);
-    }
 }
 
 void avtext_print_data(AVTextFormatContext *tctx, const char *name,
-                              const uint8_t *data, int size)
+                       const uint8_t *data, int size)
 {
     AVBPrint bp;
     int offset = 0, l, i;
@@ -520,12 +516,13 @@ void avtext_print_data(AVTextFormatContext *tctx, const 
char *name,
 }
 
 void avtext_print_data_hash(AVTextFormatContext *tctx, const char *name,
-                                   const uint8_t *data, int size)
+                            const uint8_t *data, int size)
 {
     char *p, buf[AV_HASH_MAX_SIZE * 2 + 64] = { 0 };
 
     if (!tctx->hash)
         return;
+
     av_hash_init(tctx->hash);
     av_hash_update(tctx->hash, data, size);
     snprintf(buf, sizeof(buf), "%s:", av_hash_get_name(tctx->hash));
@@ -551,7 +548,7 @@ void avtext_print_integers(AVTextFormatContext *tctx, const 
char *name,
             else if (bytes == 2) av_bprintf(&bp, format, AV_RN16(data));
             else if (bytes == 4) av_bprintf(&bp, format, AV_RN32(data));
             data += bytes;
-            size --;
+            size--;
         }
         av_bprintf(&bp, "\n");
         offset += offset_add;
@@ -641,7 +638,8 @@ fail:
     return ret;
 }
 
-static const AVTextFormatter *registered_formatters[7+1];
+static const AVTextFormatter *registered_formatters[10 + 1];
+
 static void formatters_register_all(void)
 {
     static int initialized;
diff --git a/fftools/textformat/avtextformat.h 
b/fftools/textformat/avtextformat.h
index c2c56dc1a7..c598af3450 100644
--- a/fftools/textformat/avtextformat.h
+++ b/fftools/textformat/avtextformat.h
@@ -86,17 +86,17 @@ typedef struct AVTextFormatter {
 #define SECTION_MAX_NB_SECTIONS 100
 
 struct AVTextFormatContext {
-    const AVClass *class;           ///< class of the formatter
-    const AVTextFormatter *formatter;           ///< the AVTextFormatter of 
which this is an instance
-    AVTextWriterContext *writer;           ///< the AVTextWriterContext
+    const AVClass *class;              ///< class of the formatter
+    const AVTextFormatter *formatter;  ///< the AVTextFormatter of which this 
is an instance
+    AVTextWriterContext *writer;       ///< the AVTextWriterContext
 
-    char *name;                     ///< name of this formatter instance
-    void *priv;                     ///< private data for use by the filter
+    char *name;                        ///< name of this formatter instance
+    void *priv;                        ///< private data for use by the filter
 
-    const struct AVTextFormatSection *sections; ///< array containing all 
sections
-    int nb_sections;                ///< number of sections
+    const AVTextFormatSection *sections; ///< array containing all sections
+    int nb_sections;                   ///< number of sections
 
-    int level;                      ///< current level, starting from 0
+    int level;                         ///< current level, starting from 0
 
     /** number of the item printed in the given section, starting from 0 */
     unsigned int nb_item[SECTION_MAX_NB_LEVELS];
diff --git a/fftools/textformat/avtextwriters.h 
b/fftools/textformat/avtextwriters.h
index c99d6b3548..34db3f1832 100644
--- a/fftools/textformat/avtextwriters.h
+++ b/fftools/textformat/avtextwriters.h
@@ -37,11 +37,11 @@ typedef struct AVTextWriter {
     int priv_size;                  ///< private size for the writer private 
class
     const char *name;
 
-    int (* init)(AVTextWriterContext *wctx);
-    void (* uninit)(AVTextWriterContext *wctx);
-    void (* writer_w8)(AVTextWriterContext *wctx, int b);
-    void (* writer_put_str)(AVTextWriterContext *wctx, const char *str);
-    void (* writer_printf)(AVTextWriterContext *wctx, const char *fmt, ...);
+    int (*init)(AVTextWriterContext *wctx);
+    void (*uninit)(AVTextWriterContext *wctx);
+    void (*writer_w8)(AVTextWriterContext *wctx, int b);
+    void (*writer_put_str)(AVTextWriterContext *wctx, const char *str);
+    void (*writer_printf)(AVTextWriterContext *wctx, const char *fmt, ...);
 } AVTextWriter;
 
 typedef struct AVTextWriterContext {
@@ -49,7 +49,6 @@ typedef struct AVTextWriterContext {
     const AVTextWriter *writer;
     const char *name;
     void *priv;                     ///< private data for use by the writer
-
 } AVTextWriterContext;
 
 
diff --git a/fftools/textformat/tf_compact.c b/fftools/textformat/tf_compact.c
index 31bfc81513..d4ac296a42 100644
--- a/fftools/textformat/tf_compact.c
+++ b/fftools/textformat/tf_compact.c
@@ -58,10 +58,10 @@ static const char *c_escape_str(AVBPrint *dst, const char 
*src, const char sep,
 
     for (p = src; *p; p++) {
         switch (*p) {
-        case '\b': av_bprintf(dst, "%s", "\\b");  break;
-        case '\f': av_bprintf(dst, "%s", "\\f");  break;
-        case '\n': av_bprintf(dst, "%s", "\\n");  break;
-        case '\r': av_bprintf(dst, "%s", "\\r");  break;
+        case '\b': av_bprintf(dst, "%s", "\\b"); break;
+        case '\f': av_bprintf(dst, "%s", "\\f"); break;
+        case '\n': av_bprintf(dst, "%s", "\\n"); break;
+        case '\r': av_bprintf(dst, "%s", "\\r"); break;
         case '\\': av_bprintf(dst, "%s", "\\\\"); break;
         default:
             if (*p == sep)
@@ -78,6 +78,7 @@ static const char *c_escape_str(AVBPrint *dst, const char 
*src, const char sep,
 static const char *csv_escape_str(AVBPrint *dst, const char *src, const char 
sep, void *log_ctx)
 {
     char meta_chars[] = { sep, '"', '\n', '\r', '\0' };
+
     int needs_quoting = !!src[strcspn(src, meta_chars)];
 
     if (needs_quoting)
@@ -114,16 +115,16 @@ typedef struct CompactContext {
 #undef OFFSET
 #define OFFSET(x) offsetof(CompactContext, x)
 
-static const AVOption compact_options[]= {
-    {"item_sep", "set item separator",    OFFSET(item_sep_str),    
AV_OPT_TYPE_STRING, {.str="|"},  0, 0 },
-    {"s",        "set item separator",    OFFSET(item_sep_str),    
AV_OPT_TYPE_STRING, {.str="|"},  0, 0 },
-    {"nokey",    "force no key printing", OFFSET(nokey),           
AV_OPT_TYPE_BOOL,   {.i64=0},    0,        1        },
-    {"nk",       "force no key printing", OFFSET(nokey),           
AV_OPT_TYPE_BOOL,   {.i64=0},    0,        1        },
-    {"escape",   "set escape mode",       OFFSET(escape_mode_str), 
AV_OPT_TYPE_STRING, {.str="c"},  0, 0 },
-    {"e",        "set escape mode",       OFFSET(escape_mode_str), 
AV_OPT_TYPE_STRING, {.str="c"},  0, 0 },
-    {"print_section", "print section name", OFFSET(print_section), 
AV_OPT_TYPE_BOOL,   {.i64=1},    0,        1        },
-    {"p",             "print section name", OFFSET(print_section), 
AV_OPT_TYPE_BOOL,   {.i64=1},    0,        1        },
-    {NULL},
+static const AVOption compact_options[] = {
+    { "item_sep", "set item separator",      OFFSET(item_sep_str),    
AV_OPT_TYPE_STRING, { .str = "|" },  0, 0 },
+    { "s",        "set item separator",      OFFSET(item_sep_str),    
AV_OPT_TYPE_STRING, { .str = "|" },  0, 0 },
+    { "nokey",    "force no key printing",   OFFSET(nokey),           
AV_OPT_TYPE_BOOL,   { .i64 = 0   },  0, 1 },
+    { "nk",       "force no key printing",   OFFSET(nokey),           
AV_OPT_TYPE_BOOL,   { .i64 = 0   },  0, 1 },
+    { "escape",   "set escape mode",         OFFSET(escape_mode_str), 
AV_OPT_TYPE_STRING, { .str = "c" },  0, 0 },
+    { "e",        "set escape mode",         OFFSET(escape_mode_str), 
AV_OPT_TYPE_STRING, { .str = "c" },  0, 0 },
+    { "print_section", "print section name", OFFSET(print_section),   
AV_OPT_TYPE_BOOL,   { .i64 = 1   },  0, 1 },
+    { "p",             "print section name", OFFSET(print_section),   
AV_OPT_TYPE_BOOL,   { .i64 = 1   },  0, 1 },
+    { NULL },
 };
 
 DEFINE_FORMATTER_CLASS(compact);
@@ -139,10 +140,13 @@ static av_cold int compact_init(AVTextFormatContext *wctx)
     }
     compact->item_sep = compact->item_sep_str[0];
 
-    if      (!strcmp(compact->escape_mode_str, "none")) compact->escape_str = 
none_escape_str;
-    else if (!strcmp(compact->escape_mode_str, "c"   )) compact->escape_str = 
c_escape_str;
-    else if (!strcmp(compact->escape_mode_str, "csv" )) compact->escape_str = 
csv_escape_str;
-    else {
+    if        (!strcmp(compact->escape_mode_str, "none")) {
+        compact->escape_str = none_escape_str;
+    } else if (!strcmp(compact->escape_mode_str, "c"   )) {
+        compact->escape_str = c_escape_str;
+    } else if (!strcmp(compact->escape_mode_str, "csv" )) {
+        compact->escape_str = csv_escape_str;
+    } else {
         av_log(wctx, AV_LOG_ERROR, "Unknown escape mode '%s'\n", 
compact->escape_mode_str);
         return AVERROR(EINVAL);
     }
@@ -162,8 +166,8 @@ static void 
compact_print_section_header(AVTextFormatContext *wctx, const void *
     av_bprint_clear(&wctx->section_pbuf[wctx->level]);
     if (parent_section &&
         (section->flags & AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE ||
-         (!(section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY) &&
-          !(parent_section->flags & 
(AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER|AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY))))) 
{
+            (!(section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY) &&
+                !(parent_section->flags & 
(AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER | 
AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY))))) {
 
         /* define a prefix for elements not contained in an array or
            in a wrapper, or for array elements with a type */
@@ -171,10 +175,10 @@ static void 
compact_print_section_header(AVTextFormatContext *wctx, const void *
         AVBPrint *section_pbuf = &wctx->section_pbuf[wctx->level];
 
         compact->nested_section[wctx->level] = 1;
-        compact->has_nested_elems[wctx->level-1] = 1;
+        compact->has_nested_elems[wctx->level - 1] = 1;
 
         av_bprintf(section_pbuf, "%s%s",
-                   wctx->section_pbuf[wctx->level-1].str, element_name);
+                   wctx->section_pbuf[wctx->level - 1].str, element_name);
 
         if (section->flags & AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE) {
             // add /TYPE to prefix
@@ -185,30 +189,33 @@ static void 
compact_print_section_header(AVTextFormatContext *wctx, const void *
                 char c =
                     (*p >= '0' && *p <= '9') ||
                     (*p >= 'a' && *p <= 'z') ||
-                    (*p >= 'A' && *p <= 'Z') ? av_tolower(*p) : '_';
+                    (*p >= 'A' && *p <= 'Z')
+                    ? (char)(char)av_tolower(*p)
+                    : '_';
                 av_bprint_chars(section_pbuf, c, 1);
             }
         }
         av_bprint_chars(section_pbuf, ':', 1);
 
-        wctx->nb_item[wctx->level] = wctx->nb_item[wctx->level-1];
+        wctx->nb_item[wctx->level] = wctx->nb_item[wctx->level - 1];
     } else {
-        if (parent_section && !(parent_section->flags & 
(AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER|AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY)) &&
-            wctx->level && wctx->nb_item[wctx->level-1])
+        if (parent_section && !(parent_section->flags & 
(AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER | AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY)) 
&&
+            wctx->level && wctx->nb_item[wctx->level - 1])
             writer_w8(wctx, compact->item_sep);
         if (compact->print_section &&
-            !(section->flags & 
(AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER|AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY)))
+            !(section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER | 
AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY)))
             writer_printf(wctx, "%s%c", section->name, compact->item_sep);
     }
 }
 
 static void compact_print_section_footer(AVTextFormatContext *wctx)
 {
+    const struct AVTextFormatSection *section = wctx->section[wctx->level];
     CompactContext *compact = wctx->priv;
 
     if (!compact->nested_section[wctx->level] &&
         compact->terminate_line[wctx->level] &&
-        !(wctx->section[wctx->level]->flags & 
(AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER|AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY)))
+        !(section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER | 
AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY)))
         writer_w8(wctx, '\n');
 }
 
@@ -217,9 +224,12 @@ static void compact_print_str(AVTextFormatContext *wctx, 
const char *key, const
     CompactContext *compact = wctx->priv;
     AVBPrint buf;
 
-    if (wctx->nb_item[wctx->level]) writer_w8(wctx, compact->item_sep);
+    if (wctx->nb_item[wctx->level])
+        writer_w8(wctx, compact->item_sep);
+
     if (!compact->nokey)
         writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
+
     av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
     writer_put_str(wctx, compact->escape_str(&buf, value, compact->item_sep, 
wctx));
     av_bprint_finalize(&buf, NULL);
@@ -229,9 +239,12 @@ static void compact_print_int(AVTextFormatContext *wctx, 
const char *key, int64_
 {
     CompactContext *compact = wctx->priv;
 
-    if (wctx->nb_item[wctx->level]) writer_w8(wctx, compact->item_sep);
+    if (wctx->nb_item[wctx->level])
+        writer_w8(wctx, compact->item_sep);
+
     if (!compact->nokey)
         writer_printf(wctx, "%s%s=", wctx->section_pbuf[wctx->level].str, key);
+
     writer_printf(wctx, "%"PRId64, value);
 }
 
@@ -253,15 +266,15 @@ const AVTextFormatter avtextformatter_compact = {
 #define OFFSET(x) offsetof(CompactContext, x)
 
 static const AVOption csv_options[] = {
-    {"item_sep", "set item separator",    OFFSET(item_sep_str),    
AV_OPT_TYPE_STRING, {.str=","},  0, 0 },
-    {"s",        "set item separator",    OFFSET(item_sep_str),    
AV_OPT_TYPE_STRING, {.str=","},  0, 0 },
-    {"nokey",    "force no key printing", OFFSET(nokey),           
AV_OPT_TYPE_BOOL,   {.i64=1},    0,        1        },
-    {"nk",       "force no key printing", OFFSET(nokey),           
AV_OPT_TYPE_BOOL,   {.i64=1},    0,        1        },
-    {"escape",   "set escape mode",       OFFSET(escape_mode_str), 
AV_OPT_TYPE_STRING, {.str="csv"}, 0, 0 },
-    {"e",        "set escape mode",       OFFSET(escape_mode_str), 
AV_OPT_TYPE_STRING, {.str="csv"}, 0, 0 },
-    {"print_section", "print section name", OFFSET(print_section), 
AV_OPT_TYPE_BOOL,   {.i64=1},    0,        1        },
-    {"p",             "print section name", OFFSET(print_section), 
AV_OPT_TYPE_BOOL,   {.i64=1},    0,        1        },
-    {NULL},
+    { "item_sep", "set item separator",      OFFSET(item_sep_str),    
AV_OPT_TYPE_STRING, { .str = ","   }, 0, 0 },
+    { "s",        "set item separator",      OFFSET(item_sep_str),    
AV_OPT_TYPE_STRING, { .str = ","   }, 0, 0 },
+    { "nokey",    "force no key printing",   OFFSET(nokey),           
AV_OPT_TYPE_BOOL,   { .i64 = 1     }, 0, 1 },
+    { "nk",       "force no key printing",   OFFSET(nokey),           
AV_OPT_TYPE_BOOL,   { .i64 = 1     }, 0, 1 },
+    { "escape",   "set escape mode",         OFFSET(escape_mode_str), 
AV_OPT_TYPE_STRING, { .str = "csv" }, 0, 0 },
+    { "e",        "set escape mode",         OFFSET(escape_mode_str), 
AV_OPT_TYPE_STRING, { .str = "csv" }, 0, 0 },
+    { "print_section", "print section name", OFFSET(print_section),   
AV_OPT_TYPE_BOOL,   { .i64 = 1     }, 0, 1 },
+    { "p",             "print section name", OFFSET(print_section),   
AV_OPT_TYPE_BOOL,   { .i64 = 1     }, 0, 1 },
+    { NULL },
 };
 
 DEFINE_FORMATTER_CLASS(csv);
diff --git a/fftools/textformat/tf_default.c b/fftools/textformat/tf_default.c
index 86582829e4..2c5047eafd 100644
--- a/fftools/textformat/tf_default.c
+++ b/fftools/textformat/tf_default.c
@@ -56,11 +56,11 @@ typedef struct DefaultContext {
 #define OFFSET(x) offsetof(DefaultContext, x)
 
 static const AVOption default_options[] = {
-    { "noprint_wrappers", "do not print headers and footers", 
OFFSET(noprint_wrappers), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
-    { "nw",               "do not print headers and footers", 
OFFSET(noprint_wrappers), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
-    { "nokey",          "force no key printing",     OFFSET(nokey),          
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
-    { "nk",             "force no key printing",     OFFSET(nokey),          
AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1 },
-    {NULL},
+    { "noprint_wrappers", "do not print headers and footers", 
OFFSET(noprint_wrappers), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1 },
+    { "nw",               "do not print headers and footers", 
OFFSET(noprint_wrappers), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1 },
+    { "nokey",            "force no key printing",            OFFSET(nokey),   
         AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1 },
+    { "nk",               "force no key printing",            OFFSET(nokey),   
         AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1 },
+    { NULL },
 };
 
 DEFINE_FORMATTER_CLASS(default);
@@ -69,7 +69,7 @@ DEFINE_FORMATTER_CLASS(default);
 static inline char *upcase_string(char *dst, size_t dst_size, const char *src)
 {
     int i;
-    for (i = 0; src[i] && i < dst_size-1; i++)
+    for (i = 0; src[i] && i < dst_size - 1; i++)
         dst[i] = av_toupper(src[i]);
     dst[i] = 0;
     return dst;
@@ -85,10 +85,10 @@ static void 
default_print_section_header(AVTextFormatContext *wctx, const void *
 
     av_bprint_clear(&wctx->section_pbuf[wctx->level]);
     if (parent_section &&
-        !(parent_section->flags & 
(AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER|AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY))) {
+        !(parent_section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER | 
AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY))) {
         def->nested_section[wctx->level] = 1;
         av_bprintf(&wctx->section_pbuf[wctx->level], "%s%s:",
-                   wctx->section_pbuf[wctx->level-1].str,
+                   wctx->section_pbuf[wctx->level - 1].str,
                    upcase_string(buf, sizeof(buf),
                                  av_x_if_null(section->element_name, 
section->name)));
     }
@@ -96,7 +96,7 @@ static void default_print_section_header(AVTextFormatContext 
*wctx, const void *
     if (def->noprint_wrappers || def->nested_section[wctx->level])
         return;
 
-    if (!(section->flags & 
(AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER|AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY)))
+    if (!(section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER | 
AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY)))
         writer_printf(wctx, "[%s]\n", upcase_string(buf, sizeof(buf), 
section->name));
 }
 
@@ -109,7 +109,7 @@ static void 
default_print_section_footer(AVTextFormatContext *wctx)
     if (def->noprint_wrappers || def->nested_section[wctx->level])
         return;
 
-    if (!(section->flags & 
(AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER|AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY)))
+    if (!(section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER | 
AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY)))
         writer_printf(wctx, "[/%s]\n", upcase_string(buf, sizeof(buf), 
section->name));
 }
 
diff --git a/fftools/textformat/tf_flat.c b/fftools/textformat/tf_flat.c
index 919d44bc6b..f692971bcc 100644
--- a/fftools/textformat/tf_flat.c
+++ b/fftools/textformat/tf_flat.c
@@ -57,12 +57,12 @@ typedef struct FlatContext {
 #undef OFFSET
 #define OFFSET(x) offsetof(FlatContext, x)
 
-static const AVOption flat_options[]= {
-    {"sep_char", "set separator",    OFFSET(sep_str),    AV_OPT_TYPE_STRING, 
{.str="."},  0, 0 },
-    {"s",        "set separator",    OFFSET(sep_str),    AV_OPT_TYPE_STRING, 
{.str="."},  0, 0 },
-    {"hierarchical", "specify if the section specification should be 
hierarchical", OFFSET(hierarchical), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
-    {"h",            "specify if the section specification should be 
hierarchical", OFFSET(hierarchical), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
-    {NULL},
+static const AVOption flat_options[] = {
+    { "sep_char",     "set separator",                                         
      OFFSET(sep_str),      AV_OPT_TYPE_STRING, { .str = "." }, 0, 0 },
+    { "s",            "set separator",                                         
      OFFSET(sep_str),      AV_OPT_TYPE_STRING, { .str = "." }, 0, 0 },
+    { "hierarchical", "specify if the section specification should be 
hierarchical", OFFSET(hierarchical), AV_OPT_TYPE_BOOL,   { .i64 = 1   }, 0, 1 },
+    { "h",            "specify if the section specification should be 
hierarchical", OFFSET(hierarchical), AV_OPT_TYPE_BOOL,   { .i64 = 1   }, 0, 1 },
+    { NULL },
 };
 
 DEFINE_FORMATTER_CLASS(flat);
@@ -126,16 +126,18 @@ static void flat_print_section_header(AVTextFormatContext 
*wctx, const void *dat
     av_bprint_clear(buf);
     if (!parent_section)
         return;
-    av_bprintf(buf, "%s", wctx->section_pbuf[wctx->level-1].str);
+
+    av_bprintf(buf, "%s", wctx->section_pbuf[wctx->level - 1].str);
 
     if (flat->hierarchical ||
-        !(section->flags & 
(AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY|AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER))) {
+        !(section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY | 
AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER))) {
         av_bprintf(buf, "%s%s", wctx->section[wctx->level]->name, 
flat->sep_str);
 
         if (parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY) {
-            int n = parent_section->flags & 
AV_TEXTFORMAT_SECTION_FLAG_NUMBERING_BY_TYPE ?
-                wctx->nb_item_type[wctx->level-1][section->id] :
-                wctx->nb_item[wctx->level-1];
+            int n = parent_section->flags & 
AV_TEXTFORMAT_SECTION_FLAG_NUMBERING_BY_TYPE
+                ? wctx->nb_item_type[wctx->level - 1][section->id]
+                : wctx->nb_item[wctx->level - 1];
+
             av_bprintf(buf, "%d%s", n, flat->sep_str);
         }
     }
@@ -166,6 +168,6 @@ const AVTextFormatter avtextformatter_flat = {
     .print_section_header  = flat_print_section_header,
     .print_integer         = flat_print_int,
     .print_string          = flat_print_str,
-    .flags = 
AV_TEXTFORMAT_FLAG_SUPPORTS_OPTIONAL_FIELDS|AV_TEXTFORMAT_FLAG_SUPPORTS_MIXED_ARRAY_CONTENT,
+    .flags = AV_TEXTFORMAT_FLAG_SUPPORTS_OPTIONAL_FIELDS | 
AV_TEXTFORMAT_FLAG_SUPPORTS_MIXED_ARRAY_CONTENT,
     .priv_class            = &flat_class,
 };
diff --git a/fftools/textformat/tf_ini.c b/fftools/textformat/tf_ini.c
index d8099ff92e..88add0819a 100644
--- a/fftools/textformat/tf_ini.c
+++ b/fftools/textformat/tf_ini.c
@@ -64,9 +64,9 @@ typedef struct INIContext {
 #define OFFSET(x) offsetof(INIContext, x)
 
 static const AVOption ini_options[] = {
-    {"hierarchical", "specify if the section specification should be 
hierarchical", OFFSET(hierarchical), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
-    {"h",            "specify if the section specification should be 
hierarchical", OFFSET(hierarchical), AV_OPT_TYPE_BOOL, {.i64=1}, 0, 1 },
-    {NULL},
+    { "hierarchical", "specify if the section specification should be 
hierarchical", OFFSET(hierarchical), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1 },
+    { "h",            "specify if the section specification should be 
hierarchical", OFFSET(hierarchical), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1 },
+    { NULL },
 };
 
 DEFINE_FORMATTER_CLASS(ini);
@@ -74,9 +74,9 @@ DEFINE_FORMATTER_CLASS(ini);
 static char *ini_escape_str(AVBPrint *dst, const char *src)
 {
     int i = 0;
-    char c = 0;
+    char c;
 
-    while (c = src[i++]) {
+    while ((c = src[i++])) {
         switch (c) {
         case '\b': av_bprintf(dst, "%s", "\\b"); break;
         case '\f': av_bprintf(dst, "%s", "\\f"); break;
@@ -84,9 +84,11 @@ static char *ini_escape_str(AVBPrint *dst, const char *src)
         case '\r': av_bprintf(dst, "%s", "\\r"); break;
         case '\t': av_bprintf(dst, "%s", "\\t"); break;
         case '\\':
-        case '#' :
-        case '=' :
-        case ':' : av_bprint_chars(dst, '\\', 1);
+        case '#':
+        case '=':
+        case ':':
+            av_bprint_chars(dst, '\\', 1);
+            /* fallthrough */
         default:
             if ((unsigned char)c < 32)
                 av_bprintf(dst, "\\x00%02x", c & 0xff);
@@ -112,23 +114,23 @@ static void ini_print_section_header(AVTextFormatContext 
*wctx, const void *data
         return;
     }
 
-    if (wctx->nb_item[wctx->level-1])
+    if (wctx->nb_item[wctx->level - 1])
         writer_w8(wctx, '\n');
 
-    av_bprintf(buf, "%s", wctx->section_pbuf[wctx->level-1].str);
+    av_bprintf(buf, "%s", wctx->section_pbuf[wctx->level - 1].str);
     if (ini->hierarchical ||
-        !(section->flags & 
(AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY|AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER))) {
+        !(section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY | 
AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER))) {
         av_bprintf(buf, "%s%s", buf->str[0] ? "." : "", 
wctx->section[wctx->level]->name);
 
         if (parent_section->flags & AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY) {
-            int n = parent_section->flags & 
AV_TEXTFORMAT_SECTION_FLAG_NUMBERING_BY_TYPE ?
-                wctx->nb_item_type[wctx->level-1][section->id] :
-                wctx->nb_item[wctx->level-1];
-            av_bprintf(buf, ".%d", n);
+            unsigned n = parent_section->flags & 
AV_TEXTFORMAT_SECTION_FLAG_NUMBERING_BY_TYPE
+                ? wctx->nb_item_type[wctx->level - 1][section->id]
+                : wctx->nb_item[wctx->level - 1];
+            av_bprintf(buf, ".%u", n);
         }
     }
 
-    if (!(section->flags & 
(AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY|AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER)))
+    if (!(section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY | 
AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER)))
         writer_printf(wctx, "[%s]\n", buf->str);
 }
 
@@ -154,6 +156,6 @@ const AVTextFormatter avtextformatter_ini = {
     .print_section_header  = ini_print_section_header,
     .print_integer         = ini_print_int,
     .print_string          = ini_print_str,
-    .flags = 
AV_TEXTFORMAT_FLAG_SUPPORTS_OPTIONAL_FIELDS|AV_TEXTFORMAT_FLAG_SUPPORTS_MIXED_ARRAY_CONTENT,
+    .flags = AV_TEXTFORMAT_FLAG_SUPPORTS_OPTIONAL_FIELDS | 
AV_TEXTFORMAT_FLAG_SUPPORTS_MIXED_ARRAY_CONTENT,
     .priv_class            = &ini_class,
 };
diff --git a/fftools/textformat/tf_json.c b/fftools/textformat/tf_json.c
index c26a912435..b61d3740c6 100644
--- a/fftools/textformat/tf_json.c
+++ b/fftools/textformat/tf_json.c
@@ -56,9 +56,9 @@ typedef struct JSONContext {
 #undef OFFSET
 #define OFFSET(x) offsetof(JSONContext, x)
 
-static const AVOption json_options[]= {
-    { "compact", "enable compact output", OFFSET(compact), AV_OPT_TYPE_BOOL, 
{.i64=0}, 0, 1 },
-    { "c",       "enable compact output", OFFSET(compact), AV_OPT_TYPE_BOOL, 
{.i64=0}, 0, 1 },
+static const AVOption json_options[] = {
+    { "compact", "enable compact output", OFFSET(compact), AV_OPT_TYPE_BOOL, { 
.i64 = 0 }, 0, 1 },
+    { "c",       "enable compact output", OFFSET(compact), AV_OPT_TYPE_BOOL, { 
.i64 = 0 }, 0, 1 },
     { NULL }
 };
 
@@ -76,8 +76,8 @@ static av_cold int json_init(AVTextFormatContext *wctx)
 
 static const char *json_escape_str(AVBPrint *dst, const char *src, void 
*log_ctx)
 {
-    static const char json_escape[] = {'"', '\\', '\b', '\f', '\n', '\r', 
'\t', 0};
-    static const char json_subst[]  = {'"', '\\',  'b',  'f',  'n',  'r',  
't', 0};
+    static const char json_escape[] = { '"', '\\', '\b', '\f', '\n', '\r', 
'\t', 0 };
+    static const char json_subst[]  = { '"', '\\',  'b',  'f',  'n',  'r',  
't', 0 };
     const char *p;
 
     for (p = src; *p; p++) {
diff --git a/fftools/textformat/tf_xml.c b/fftools/textformat/tf_xml.c
index 6c89d01e9d..befb39246d 100644
--- a/fftools/textformat/tf_xml.c
+++ b/fftools/textformat/tf_xml.c
@@ -58,11 +58,11 @@ typedef struct XMLContext {
 #define OFFSET(x) offsetof(XMLContext, x)
 
 static const AVOption xml_options[] = {
-    {"fully_qualified", "specify if the output should be fully qualified", 
OFFSET(fully_qualified), AV_OPT_TYPE_BOOL, {.i64=0},  0, 1 },
-    {"q",               "specify if the output should be fully qualified", 
OFFSET(fully_qualified), AV_OPT_TYPE_BOOL, {.i64=0},  0, 1 },
-    {"xsd_strict",      "ensure that the output is XSD compliant",         
OFFSET(xsd_strict),      AV_OPT_TYPE_BOOL, {.i64=0},  0, 1 },
-    {"x",               "ensure that the output is XSD compliant",         
OFFSET(xsd_strict),      AV_OPT_TYPE_BOOL, {.i64=0},  0, 1 },
-    {NULL},
+    { "fully_qualified", "specify if the output should be fully qualified", 
OFFSET(fully_qualified), AV_OPT_TYPE_BOOL, { .i64 = 0 },  0, 1 },
+    { "q",               "specify if the output should be fully qualified", 
OFFSET(fully_qualified), AV_OPT_TYPE_BOOL, { .i64 = 0 },  0, 1 },
+    { "xsd_strict",      "ensure that the output is XSD compliant",         
OFFSET(xsd_strict),      AV_OPT_TYPE_BOOL, { .i64 = 0 },  0, 1 },
+    { "x",               "ensure that the output is XSD compliant",         
OFFSET(xsd_strict),      AV_OPT_TYPE_BOOL, { .i64 = 0 },  0, 1 },
+    { NULL },
 };
 
 DEFINE_FORMATTER_CLASS(xml);
@@ -104,8 +104,8 @@ static void xml_print_section_header(AVTextFormatContext 
*wctx, const void *data
 
         writer_put_str(wctx, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
         writer_printf(wctx, "<%sffprobe%s>\n",
-               xml->fully_qualified ? "ffprobe:" : "",
-               xml->fully_qualified ? qual : "");
+                      xml->fully_qualified ? "ffprobe:" : "",
+                      xml->fully_qualified ? qual : "");
         return;
     }
 
@@ -115,12 +115,13 @@ static void xml_print_section_header(AVTextFormatContext 
*wctx, const void *data
     }
 
     if (parent_section && (parent_section->flags & 
AV_TEXTFORMAT_SECTION_FLAG_IS_WRAPPER) &&
-        wctx->level && wctx->nb_item[wctx->level-1])
+        wctx->level && wctx->nb_item[wctx->level - 1])
         writer_w8(wctx, '\n');
     xml->indent_level++;
 
-    if (section->flags & 
(AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY|AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS))
 {
-        XML_INDENT(); writer_printf(wctx, "<%s", section->name);
+    if (section->flags & (AV_TEXTFORMAT_SECTION_FLAG_IS_ARRAY | 
AV_TEXTFORMAT_SECTION_FLAG_HAS_VARIABLE_FIELDS)) {
+        XML_INDENT();
+        writer_printf(wctx, "<%s", section->name);
 
         if (section->flags & AV_TEXTFORMAT_SECTION_FLAG_HAS_TYPE) {
             AVBPrint buf;
@@ -131,7 +132,8 @@ static void xml_print_section_header(AVTextFormatContext 
*wctx, const void *data
         }
         writer_printf(wctx, ">\n", section->name);
     } else {
-        XML_INDENT(); writer_printf(wctx, "<%s ", section->name);
+        XML_INDENT();
+        writer_printf(wctx, "<%s ", section->name);
         xml->within_tag = 1;
     }
 }
@@ -148,7 +150,8 @@ static void xml_print_section_footer(AVTextFormatContext 
*wctx)
         writer_put_str(wctx, "/>\n");
         xml->indent_level--;
     } else {
-        XML_INDENT(); writer_printf(wctx, "</%s>\n", section->name);
+        XML_INDENT();
+        writer_printf(wctx, "</%s>\n", section->name);
         xml->indent_level--;
     }
 }
@@ -195,7 +198,8 @@ static void xml_print_value(AVTextFormatContext *wctx, 
const char *key,
     av_bprint_finalize(&buf, NULL);
 }
 
-static inline void xml_print_str(AVTextFormatContext *wctx, const char *key, 
const char *value) {
+static inline void xml_print_str(AVTextFormatContext *wctx, const char *key, 
const char *value)
+{
     xml_print_value(wctx, key, value, 0, 0);
 }
 
-- 
ffmpeg-codebot

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to