Typecast void* before doing pointer arithmetic
Caught by cppcheck
This commit is contained in:
parent
88c378154a
commit
687238b79b
|
@ -70,7 +70,7 @@ ssize_t writeall(int fd, const void *buf, size_t count) {
|
|||
size_t written = 0;
|
||||
|
||||
while (written < count) {
|
||||
const ssize_t n = write(fd, buf + written, count - written);
|
||||
const ssize_t n = write(fd, ((char *)buf) + written, count - written);
|
||||
if (n == -1) {
|
||||
if (errno == EINTR || errno == EAGAIN)
|
||||
continue;
|
||||
|
@ -86,7 +86,7 @@ ssize_t writeall_nonblock(int fd, const void *buf, size_t count) {
|
|||
size_t written = 0;
|
||||
|
||||
while (written < count) {
|
||||
const ssize_t n = write(fd, buf + written, count - written);
|
||||
const ssize_t n = write(fd, ((char *)buf) + written, count - written);
|
||||
if (n == -1) {
|
||||
if (errno == EAGAIN) {
|
||||
return written;
|
||||
|
|
Loading…
Reference in New Issue