From fb18b57182f12b29147111ea9729e004518c385e Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sat, 14 Aug 2021 23:14:38 +0200 Subject: [PATCH] mp4: Clean up membuffer_transfer_from_file(). The buffer pointer can never be NULL, so drop this check. Next, instead of defining a void * pointer and cast it to char *, use char * directly. Finally, the cast to unsigned has no effect, so drop it. --- mp4.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/mp4.c b/mp4.c index c0efc4fa..e20cf938 100644 --- a/mp4.c +++ b/mp4.c @@ -1275,17 +1275,12 @@ static void *membuffer_get_ptr(const struct membuffer *buf) static bool membuffer_transfer_from_file(struct membuffer *buf, struct mp4 *src, unsigned bytes) { - unsigned oldsize; - void *bufptr; + unsigned oldsize = membuffer_get_size(buf); + char *bufptr; - oldsize = membuffer_get_size(buf); membuffer_write(buf, 0, bytes); bufptr = membuffer_get_ptr(buf); - if (bufptr == 0) - return false; - - if ((unsigned)read_data(src, (char *) bufptr + oldsize, bytes) != - bytes) { + if (read_data(src, bufptr + oldsize, bytes) != bytes) { membuffer_free(buf); return false; } -- 2.39.2