mirror of
https://github.com/linux-msm/cdba.git
synced 2026-02-25 13:11:56 -08:00
circ_buf: fix -Wpointer-arith
Pointer arithmetic should not be done on void pointers.
circ_buf.c: In function ‘circ_read’:
circ_buf.c:104:25: warning: pointer of type ‘void *’ used in subtraction [-Wpointer-arith]
104 | return (void*)p - buf;
| ^
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
This commit is contained in:
committed by
Bjorn Andersson
parent
c6d97d34c3
commit
352dc1abca
@@ -85,7 +85,7 @@ size_t circ_peak(struct circ_buf *circ, void *buf, size_t len)
|
||||
tail = (tail + 1) & (CIRC_BUF_SIZE - 1);
|
||||
}
|
||||
|
||||
return (void*)p - buf;
|
||||
return p - (char *)buf;
|
||||
}
|
||||
|
||||
size_t circ_read(struct circ_buf *circ, void *buf, size_t len)
|
||||
@@ -101,5 +101,5 @@ size_t circ_read(struct circ_buf *circ, void *buf, size_t len)
|
||||
circ->tail = (circ->tail + 1) & (CIRC_BUF_SIZE - 1);
|
||||
}
|
||||
|
||||
return (void*)p - buf;
|
||||
return p - (char *)buf;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user