fs/shmfs: Fix illegal usage of void* arithmetics

Fixes build error with -Werror:

shm/shmfs.c: In function 'shmfs_read':
shm/shmfs.c:122:33: error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith]
  122 |       memcpy(buffer, sho->paddr + startpos, nread);
      |                                 ^
shm/shmfs.c: In function 'shmfs_write':
shm/shmfs.c:166:25: error: pointer of type 'void *' used in arithmetic [-Werror=pointer-arith]
  166 |       memcpy(sho->paddr + startpos, buffer, nwritten);
      |                         ^
cc1: all warnings being treated as errors
This commit is contained in:
Ville Juven 2023-08-22 11:55:40 +03:00 committed by Xiang Xiao
parent 8071a55198
commit a37d094f31

View File

@ -119,7 +119,7 @@ static ssize_t shmfs_read(FAR struct file *filep, FAR char *buffer,
if (sho->paddr != NULL)
{
memcpy(buffer, sho->paddr + startpos, nread);
memcpy(buffer, (FAR char *)sho->paddr + startpos, nread);
filep->f_pos += nread;
}
else
@ -163,7 +163,7 @@ static ssize_t shmfs_write(FAR struct file *filep, FAR const char *buffer,
if (sho->paddr != NULL)
{
memcpy(sho->paddr + startpos, buffer, nwritten);
memcpy((FAR char *)sho->paddr + startpos, buffer, nwritten);
filep->f_pos += nwritten;
}
else