]> git.tue.mpg.de Git - paraslash.git/commitdiff
mp4: Clean up membuffer_write_std_tag().
authorAndre Noll <maan@tuebingen.mpg.de>
Sat, 14 Aug 2021 17:38:21 +0000 (19:38 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 30 May 2022 19:37:35 +0000 (21:37 +0200)
Remove the check for the compilation flag since we never pass "cpil"
to this function. Remove the flags variable whose value is now always
one. Introduce a variable for the string length instead of calling
strlen() three times, and unify the way comments are formatted.

mp4.c

diff --git a/mp4.c b/mp4.c
index 3167a132b1b6ca7a230d37df8c49f1c9abc9a12b..9ea65d07e7d1823b3039739102ec5a05797df3f9 100644 (file)
--- a/mp4.c
+++ b/mp4.c
@@ -1206,24 +1206,19 @@ static unsigned membuffer_write_int32(struct membuffer *buf, uint32_t data)
 static void membuffer_write_std_tag(struct membuffer *buf, const char *name,
                const char *value)
 {
-       uint32_t flags = 1;
-
-       /* special check for compilation flag */
-       if (strcmp(name, "cpil") == 0) {
-               flags = 21;
-       }
-
-       membuffer_write_int32(buf,
-               8 /*atom header */  + 8 /*data atom header */  +
-               8 /*flags + reserved */  + strlen(value));
+       uint32_t len = strlen(value);
+       membuffer_write_int32(buf, 8 /* atom header */
+               + 8 /* data atom header */
+               + 8 /* flags + reserved */
+               + len);
        membuffer_write_atom_name(buf, name);
-       membuffer_write_int32(buf,
-               8 /*data atom header */  +
-               8 /*flags + reserved */  + strlen(value));
+       membuffer_write_int32(buf, 8 /* data atom header */
+               + 8 /* flags + reserved */
+               + len);
        membuffer_write_atom_name(buf, "data");
-       membuffer_write_int32(buf, flags);      //flags
-       membuffer_write_int32(buf, 0);  //reserved
-       membuffer_write(buf, value, strlen(value));
+       membuffer_write_int32(buf, 1);  /* flags */
+       membuffer_write_int32(buf, 0);  /* reserved */
+       membuffer_write(buf, value, len);
 }
 
 static unsigned membuffer_error(const struct membuffer *buf)