}
*size = off_size;
+ if (!*size) {
+ *bufptr = NULL;
+ goto out;
+ }
+
#if HAVE_MMAP
ptr = mmap(NULL, *size, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
if (ptr == MAP_FAILED) {
read(fd, *bufptr, *size);
#endif
+out:
close(fd);
return 0;
}
void av_file_unmap(uint8_t *bufptr, size_t size)
{
+ if (!size)
+ return;
#if HAVE_MMAP
munmap(bufptr, size);
#elif HAVE_MAPVIEWOFFILE