]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
mp4: Merge write_int32() into mp4_meta_update().
authorAndre Noll <maan@tuebingen.mpg.de>
Mon, 23 Aug 2021 19:30:14 +0000 (21:30 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Mon, 30 May 2022 19:37:36 +0000 (21:37 +0200)
It has only this single caller, and it's short. Use uint8_t instead
of int8_t for the buffer as we do elsewhere and rename the buffer
variable while at it.

mp4.c

diff --git a/mp4.c b/mp4.c
index 398a3dcf888472704429220b2d53549b0f157fbc..535c785aa1c62443697d8f0c78fabb29759270c0 100644 (file)
--- a/mp4.c
+++ b/mp4.c
@@ -981,17 +981,11 @@ static int32_t write_data(struct mp4 *f, void *data, uint32_t size)
        return result;
 }
 
-static int32_t write_int32(struct mp4 *f, uint32_t data)
-{
-       int8_t temp[4];
-       write_u32_be(temp, data);
-       return write_data(f, temp, sizeof(temp));
-}
-
 int32_t mp4_meta_update(struct mp4 *f)
 {
        void *new_moov_data;
        uint32_t new_moov_size;
+       uint8_t buf[4];
 
        set_position(f, 0);
        new_moov_data = modify_moov(f, &new_moov_size);
@@ -1005,7 +999,8 @@ int32_t mp4_meta_update(struct mp4 *f)
                set_position(f, f->file_size); /* write new moov atom at EOF */
        } else /* overwrite old moov atom */
                set_position(f, f->moov_offset);
-       write_int32(f, new_moov_size + 8);
+       write_u32_be(buf, new_moov_size + 8);
+       write_data(f, buf, 4);
        write_data(f, "moov", 4);
        write_data(f, new_moov_data, new_moov_size);
        free(new_moov_data);