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.
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;
}