aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-08-25 15:49:06 +0200
committerEric Wong <normalperson@yhbt.net>2008-08-30 17:08:30 -0700
commitaa2fcfa7574ebdf3e348c051e496797841aa4f1d (patch)
tree33c72144c6748d3f8ac4566359ee5f867f27f499 /src
parent191ab3301cff60a87375f74f0122a2098dbe4dcd (diff)
downloadmpd-aa2fcfa7574ebdf3e348c051e496797841aa4f1d.tar.gz
mpd-aa2fcfa7574ebdf3e348c051e496797841aa4f1d.tar.xz
mpd-aa2fcfa7574ebdf3e348c051e496797841aa4f1d.zip
fixed ringbuf.c warnings
Fix a "signed/unsigned comparison warning", and several void pointer math warnings.
Diffstat (limited to 'src')
-rw-r--r--src/ringbuf.c8
-rw-r--r--src/ringbuf.h2
2 files changed, 5 insertions, 5 deletions
diff --git a/src/ringbuf.c b/src/ringbuf.c
index ed46c3beb..20a09b326 100644
--- a/src/ringbuf.c
+++ b/src/ringbuf.c
@@ -36,7 +36,7 @@ struct ringbuf *ringbuf_create(size_t sz)
struct ringbuf *rb = xmalloc(sizeof(struct ringbuf));
size_t power_of_two;
- for (power_of_two = 1; 1 << power_of_two < sz; power_of_two++)
+ for (power_of_two = 1; (size_t)(1 << power_of_two) < sz; power_of_two++)
/* next power_of_two... */;
rb->size = 1 << power_of_two;
@@ -137,7 +137,7 @@ size_t ringbuf_read(struct ringbuf * rb, void *dest, size_t cnt)
ringbuf_read_advance(rb, n1);
if (n2) {
- memcpy(dest + n1, rb->buf + rb->read_ptr, n2);
+ memcpy((char*)dest + n1, rb->buf + rb->read_ptr, n2);
ringbuf_read_advance(rb, n2);
}
@@ -175,7 +175,7 @@ size_t ringbuf_peek(struct ringbuf * rb, void *dest, size_t cnt)
advance_ptr(tmp_read_ptr, n1, rb->size_mask);
if (n2) {
- memcpy(dest + n1, rb->buf + tmp_read_ptr, n2);
+ memcpy((char*)dest + n1, rb->buf + tmp_read_ptr, n2);
advance_ptr(tmp_read_ptr, n2, rb->size_mask);
}
@@ -211,7 +211,7 @@ size_t ringbuf_write(struct ringbuf * rb, const void *src, size_t cnt)
ringbuf_write_advance(rb, n1);
if (n2) {
- memcpy(rb->buf + rb->write_ptr, src + n1, n2);
+ memcpy(rb->buf + rb->write_ptr, (const char*)src + n1, n2);
ringbuf_write_advance(rb, n2);
}
diff --git a/src/ringbuf.h b/src/ringbuf.h
index 43ba83a7c..93f753897 100644
--- a/src/ringbuf.h
+++ b/src/ringbuf.h
@@ -39,7 +39,7 @@
*/
struct ringbuf {
- void *buf;
+ unsigned char *buf;
size_t write_ptr;
size_t read_ptr;
size_t size;