]> git.tue.mpg.de Git - paraslash.git/commitdiff
mp4: Reduce indentation of create_ilst().
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 9 Aug 2021 22:14:53 +0000 (00:14 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 30 May 2022 19:37:35 +0000 (21:37 +0200)
This function contained an indented block for no good reason. No real
change except that a few variables are exposed to the code below the
former block, but this is not a problem.

mp4.c

diff --git a/mp4.c b/mp4.c
index 98bfc52bc8f00eede546cace4971f23bd60f2c1b..3765d813875ec4635cbf761982a24d3d2e4aa652 100644 (file)
--- a/mp4.c
+++ b/mp4.c
@@ -1793,64 +1793,60 @@ static uint32_t create_ilst(const struct mp4ff_metadata *data, void **out_buffer
        struct membuffer *buf = membuffer_create();
        unsigned metaptr;
        char *mask = para_calloc(data->count);
-       {
-               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 (tracknumber_ptr == 0)
-                                       tracknumber_ptr = tag->value;
-                               mask[metaptr] = 1;
-                       } else if (!strcasecmp(tag->item, "totaltracks")) {
-                               if (totaltracks_ptr == 0)
-                                       totaltracks_ptr = tag->value;
-                               mask[metaptr] = 1;
-                       } else if (!strcasecmp(tag->item, "discnumber")
-                                       || !strcasecmp(tag->item, "disc")) {
-                               if (discnumber_ptr == 0)
-                                       discnumber_ptr = tag->value;
-                               mask[metaptr] = 1;
-                       } else if (!strcasecmp(tag->item, "totaldiscs")) {
-                               if (totaldiscs_ptr == 0)
-                                       totaldiscs_ptr = tag->value;
-                               mask[metaptr] = 1;
-                       } else if (!strcasecmp(tag->item, "genre")) {
-                               if (genre_ptr == 0)
-                                       genre_ptr = tag->value;
-                               mask[metaptr] = 1;
-                       } else if (!strcasecmp(tag->item, "tempo")) {
-                               if (tempo_ptr == 0)
-                                       tempo_ptr = tag->value;
-                               mask[metaptr] = 1;
-                       }
-
-               }
-
-               if (tracknumber_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));
-               if (tempo_ptr)
-                       membuffer_write_int16_tag(buf, "tmpo",
-                                                 (uint16_t) 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);
-                       else
-                               membuffer_write_int16_tag(buf, "gnre",
-                                                         (uint16_t) index);
+       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 (tracknumber_ptr == 0)
+                               tracknumber_ptr = tag->value;
+                       mask[metaptr] = 1;
+               } else if (!strcasecmp(tag->item, "totaltracks")) {
+                       if (totaltracks_ptr == 0)
+                               totaltracks_ptr = tag->value;
+                       mask[metaptr] = 1;
+               } else if (!strcasecmp(tag->item, "discnumber")
+                               || !strcasecmp(tag->item, "disc")) {
+                       if (discnumber_ptr == 0)
+                               discnumber_ptr = tag->value;
+                       mask[metaptr] = 1;
+               } else if (!strcasecmp(tag->item, "totaldiscs")) {
+                       if (totaldiscs_ptr == 0)
+                               totaldiscs_ptr = tag->value;
+                       mask[metaptr] = 1;
+               } else if (!strcasecmp(tag->item, "genre")) {
+                       if (genre_ptr == 0)
+                               genre_ptr = tag->value;
+                       mask[metaptr] = 1;
+               } else if (!strcasecmp(tag->item, "tempo")) {
+                       if (tempo_ptr == 0)
+                               tempo_ptr = tag->value;
+                       mask[metaptr] = 1;
                }
        }
 
+       if (tracknumber_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));
+       if (tempo_ptr)
+               membuffer_write_int16_tag(buf, "tmpo",
+                                         (uint16_t) 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);
+               else
+                       membuffer_write_int16_tag(buf, "gnre",
+                                                 (uint16_t) index);
+       }
        for (metaptr = 0; metaptr < data->count; metaptr++) {
                if (!mask[metaptr]) {
                        struct mp4ff_tag *tag = &data->tags[metaptr];