From 89a8a29712c0d36f69646ace62fd02abe2ce0672 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Mon, 23 Aug 2021 21:30:14 +0200 Subject: [PATCH] mp4: Merge write_int32() into mp4_meta_update(). 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 | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/mp4.c b/mp4.c index 398a3dcf..535c785a 100644 --- 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); -- 2.39.2