From: Andre Noll Date: Sat, 14 Aug 2021 21:14:38 +0000 (+0200) Subject: mp4: Clean up membuffer_transfer_from_file(). X-Git-Tag: v0.7.1~7^2~67 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=fb18b57182f12b29147111ea9729e004518c385e;p=paraslash.git 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. --- 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; }