sharedmem: Fix pointer arithmetic warnings.

Building rmtfs on AOSP, we see a lot of the following:
  warning: arithmetic on a pointer to void is a GNU extension

Fix this by casting the void* ptrs to char* when doing pointer
arithmatic.

Signed-off-by: John Stultz <john.stultz@linaro.org>
[AmitP: Fixed cherry-pick conflicts and updated commit log]
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
John Stultz
2020-03-03 06:35:48 +00:00
committed by Bjorn Andersson
parent 5b1471efa8
commit 0d00985e5e
2 changed files with 4 additions and 4 deletions

View File

@@ -348,7 +348,7 @@ static void *rmtfs_mem_ptr(struct rmtfs_mem *rmem, unsigned long phys_address, s
if (start < rmem->address || end > rmem->address + rmem->size)
return NULL;
return rmem->base + phys_address - rmem->address;
return (char*)rmem->base + phys_address - rmem->address;
}
ssize_t rmtfs_mem_read(struct rmtfs_mem *rmem, unsigned long phys_address, void *buf, ssize_t len)

View File

@@ -203,13 +203,13 @@ ssize_t storage_pread(const struct rmtfd *rmtfd, void *buf, size_t nbyte, off_t
} else {
n = MIN(nbyte, rmtfd->shadow_len - offset);
if (n > 0)
memcpy(buf, rmtfd->shadow_buf + offset, n);
memcpy(buf, (char*)rmtfd->shadow_buf + offset, n);
else
n = 0;
}
if (n < nbyte)
memset(buf + n, 0, nbyte - n);
memset((char*)buf + n, 0, nbyte - n);
return nbyte;
}
@@ -239,7 +239,7 @@ ssize_t storage_pwrite(struct rmtfd *rmtfd, const void *buf, size_t nbyte, off_t
rmtfd->shadow_len = new_len;
}
memcpy(rmtfd->shadow_buf + offset, buf, nbyte);
memcpy((char*)rmtfd->shadow_buf + offset, buf, nbyte);
return nbyte;
}