]> git.tue.mpg.de Git - paraslash.git/commitdiff
mp4: Whitespace and indentation cleanups for create_ilst().
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 9 Aug 2021 22:23:52 +0000 (00:23 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 30 May 2022 19:37:35 +0000 (21:37 +0200)
The only non-trivial cleanup is the reversed logic to reduce the
indentation of the code in the body of the for loop.

mp4.c

diff --git a/mp4.c b/mp4.c
index ae2488996d40044c3258a77552ff84552fa5c27b..0956dff1152102b1462d23b90c558aa6355c7b1f 100644 (file)
--- a/mp4.c
+++ b/mp4.c
@@ -1796,9 +1796,11 @@ static uint32_t create_ilst(const struct mp4ff_metadata *data, void **out_buffer
        const char *tracknumber_ptr = 0, *totaltracks_ptr = 0;
        const char *discnumber_ptr = 0, *totaldiscs_ptr = 0;
        const char *genre_ptr = 0, *tempo_ptr = 0;
+
        for (metaptr = 0; metaptr < data->count; metaptr++) {
                struct mp4ff_tag *tag = &data->tags[metaptr];
-               if (!strcasecmp(tag->item, "tracknumber") || !strcasecmp(tag->item, "track")) {
+               if (!strcasecmp(tag->item, "tracknumber")
+                               || !strcasecmp(tag->item, "track")) {
                        if (tracknumber_ptr == 0)
                                tracknumber_ptr = tag->value;
                        mask[metaptr] = 1;
@@ -1827,38 +1829,34 @@ static uint32_t create_ilst(const struct mp4ff_metadata *data, void **out_buffer
        }
 
        if (tracknumber_ptr)
-               membuffer_write_track_tag(buf, "trkn",
-                                         myatoi(tracknumber_ptr),
-                                         myatoi(totaltracks_ptr));
+               membuffer_write_track_tag(buf, "trkn", myatoi(tracknumber_ptr),
+                        myatoi(totaltracks_ptr));
        if (discnumber_ptr)
-               membuffer_write_track_tag(buf, "disk",
-                                         myatoi(discnumber_ptr),
-                                         myatoi(totaldiscs_ptr));
+               membuffer_write_track_tag(buf, "disk", myatoi(discnumber_ptr),
+                        myatoi(totaldiscs_ptr));
        if (tempo_ptr)
                membuffer_write_int16_tag(buf, "tmpo", myatoi(tempo_ptr));
 
        if (genre_ptr) {
                uint32_t index = meta_genre_to_index(genre_ptr);
                if (index == 0)
-                       membuffer_write_std_tag(buf, "©gen",
-                                               genre_ptr);
+                       membuffer_write_std_tag(buf, "©gen", genre_ptr);
                else
                        membuffer_write_int16_tag(buf, "gnre", index);
        }
        for (metaptr = 0; metaptr < data->count; metaptr++) {
-               if (!mask[metaptr]) {
-                       struct mp4ff_tag *tag = &data->tags[metaptr];
-                       const char *std_meta_atom = find_standard_meta(tag->item);
-                       if (std_meta_atom) {
-                               membuffer_write_std_tag(buf, std_meta_atom,
-                                                       tag->value);
-                       } else {
-                               membuffer_write_custom_tag(buf, tag->item,
-                                       tag->value);
-                       }
-               }
-       }
+               struct mp4ff_tag *tag;
+               const char *std_meta_atom;
 
+               if (mask[metaptr])
+                       continue;
+               tag = &data->tags[metaptr];
+               std_meta_atom = find_standard_meta(tag->item);
+               if (std_meta_atom)
+                       membuffer_write_std_tag(buf, std_meta_atom, tag->value);
+               else
+                       membuffer_write_custom_tag(buf, tag->item, tag->value);
+       }
        free(mask);
 
        if (membuffer_error(buf)) {