From: Andre Noll Date: Mon, 9 Aug 2021 16:29:34 +0000 (+0200) Subject: mp4: Kill pointless macro membuffer_write_data. X-Git-Tag: v0.7.1~7^2~134 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=1827a074cce4cf2083b6bef0ceb51c26b7abf695;p=paraslash.git mp4: Kill pointless macro membuffer_write_data. All callers can instead call membuffer_write() directly. --- diff --git a/mp4.c b/mp4.c index bb5409e6..e6f6a0b7 100644 --- a/mp4.c +++ b/mp4.c @@ -1710,24 +1710,22 @@ static unsigned membuffer_write(membuffer * buf, const void *ptr, unsigned bytes return bytes; } -#define membuffer_write_data membuffer_write - static unsigned membuffer_write_atom_name(membuffer * buf, const char *data) { - return membuffer_write_data(buf, data, 4) == 4 ? 1 : 0; + return membuffer_write(buf, data, 4) == 4 ? 1 : 0; } static unsigned membuffer_write_int16(membuffer * buf, uint16_t data) { uint8_t temp[2] = { (uint8_t) (data >> 8), (uint8_t) data }; - return membuffer_write_data(buf, temp, 2); + return membuffer_write(buf, temp, 2); } static unsigned membuffer_write_int32(membuffer * buf, uint32_t data) { uint8_t temp[4] = { (uint8_t) (data >> 24), (uint8_t) (data >> 16), (uint8_t) (data >> 8), (uint8_t) data }; - return membuffer_write_data(buf, temp, 4); + return membuffer_write(buf, temp, 4); } static void membuffer_write_track_tag(membuffer * buf, const char *name, @@ -1828,7 +1826,7 @@ static void membuffer_write_std_tag(membuffer * buf, const char *name, membuffer_write_atom_name(buf, "data"); membuffer_write_int32(buf, flags); //flags membuffer_write_int32(buf, 0); //reserved - membuffer_write_data(buf, value, strlen(value)); + membuffer_write(buf, value, strlen(value)); } static void membuffer_write_custom_tag(membuffer * buf, const char *name, @@ -1843,18 +1841,18 @@ static void membuffer_write_custom_tag(membuffer * buf, const char *name, membuffer_write_int32(buf, 0x1C); //weirdo itunes atom membuffer_write_atom_name(buf, "mean"); membuffer_write_int32(buf, 0); - membuffer_write_data(buf, "com.apple.iTunes", 16); + membuffer_write(buf, "com.apple.iTunes", 16); membuffer_write_int32(buf, 12 + strlen(name)); membuffer_write_atom_name(buf, "name"); membuffer_write_int32(buf, 0); - membuffer_write_data(buf, name, strlen(name)); + membuffer_write(buf, name, strlen(name)); membuffer_write_int32(buf, 8 /*data atom header */ + 8 /*flags + reserved */ + strlen(value)); membuffer_write_atom_name(buf, "data"); membuffer_write_int32(buf, 1); //flags membuffer_write_int32(buf, 0); //reserved - membuffer_write_data(buf, value, strlen(value)); + membuffer_write(buf, value, strlen(value)); } static unsigned membuffer_error(const membuffer * buf) @@ -1991,7 +1989,7 @@ static void membuffer_write_atom(membuffer * buf, const char *name, unsigned siz { membuffer_write_int32(buf, size + 8); membuffer_write_atom_name(buf, name); - membuffer_write_data(buf, data, size); + membuffer_write(buf, data, size); } static void *membuffer_get_ptr(const membuffer * buf) @@ -2011,7 +2009,7 @@ static unsigned membuffer_transfer_from_file(membuffer * buf, mp4ff_t * src, void *bufptr; oldsize = membuffer_get_size(buf); - if (membuffer_write_data(buf, 0, bytes) != bytes) + if (membuffer_write(buf, 0, bytes) != bytes) return 0; bufptr = membuffer_get_ptr(buf);