summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-08-09 02:29:04 +0000
committerDavid Robillard <d@drobilla.net>2012-08-09 02:29:04 +0000
commitd06c35c6603859a575993ee3dac5244c529e09f5 (patch)
treef256922db71cd71ac3e65e0238925edf35da32e5
parent3b899b4f8c72990679c33d480b968882b0e6f960 (diff)
downloadzix-d06c35c6603859a575993ee3dac5244c529e09f5.tar.gz
zix-d06c35c6603859a575993ee3dac5244c529e09f5.tar.bz2
zix-d06c35c6603859a575993ee3dac5244c529e09f5.zip
Fix warnings: -Wshadow -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wmissing-prototypes.
git-svn-id: http://svn.drobilla.net/zix/trunk@72 df6676b4-ccc9-40e5-b5d6-7c4628a128e3
-rw-r--r--src/ring.c2
-rw-r--r--src/strindex.c7
-rw-r--r--test/sorted_array_test.c10
-rw-r--r--test/tree_test.c10
4 files changed, 16 insertions, 13 deletions
diff --git a/src/ring.c b/src/ring.c
index 7ebbe67..b701497 100644
--- a/src/ring.c
+++ b/src/ring.c
@@ -216,7 +216,7 @@ zix_ring_write(ZixRing* ring, const void* src, uint32_t size)
} else {
const uint32_t this_size = ring->size - w;
memcpy(&ring->buf[w], src, this_size);
- memcpy(&ring->buf[0], (char*)src + this_size, size - this_size);
+ memcpy(&ring->buf[0], (const char*)src + this_size, size - this_size);
ZIX_WRITE_BARRIER();
ring->write_head = size - this_size;
}
diff --git a/src/strindex.c b/src/strindex.c
index 886d261..bd97db5 100644
--- a/src/strindex.c
+++ b/src/strindex.c
@@ -190,8 +190,11 @@ ZIX_API
ZixStatus
zix_strindex_find(ZixStrindex* t, const char* p, char** match)
{
- ZixStrindexNode* n = t->root;
- const char* orig_p = p;
+#ifndef NDEBUG
+ const char* orig_p = p;
+#endif
+
+ ZixStrindexNode* n = t->root;
size_t child_i;
*match = NULL;
diff --git a/test/sorted_array_test.c b/test/sorted_array_test.c
index 3b0a090..b235753 100644
--- a/test/sorted_array_test.c
+++ b/test/sorted_array_test.c
@@ -34,8 +34,8 @@ unsigned seed = 1;
static int
int_cmp(const void* a, const void* b, void* user_data)
{
- const intptr_t ia = *(intptr_t*)a;
- const intptr_t ib = *(intptr_t*)b;
+ const intptr_t ia = *(const intptr_t*)a;
+ const intptr_t ib = *(const intptr_t*)b;
return ia - ib;
}
@@ -54,7 +54,7 @@ ith_elem(int test_num, unsigned n_elems, int i)
}
static int
-test_fail()
+test_fail(void)
{
return EXIT_FAILURE;
}
@@ -121,8 +121,8 @@ stress(int test_num, unsigned n_elems)
srand(seed);
// Delete all elements
- for (unsigned i = 0; i < n_elems; i++) {
- r = ith_elem(test_num, n_elems, i);
+ for (unsigned e = 0; e < n_elems; e++) {
+ r = ith_elem(test_num, n_elems, e);
ZixSortedArrayIter item;
if (zix_sorted_array_find(t, &r, &item) != ZIX_STATUS_SUCCESS) {
fprintf(stderr, "Failed to find item to remove\n");
diff --git a/test/tree_test.c b/test/tree_test.c
index 6f25f6c..5eb5a11 100644
--- a/test/tree_test.c
+++ b/test/tree_test.c
@@ -53,7 +53,7 @@ ith_elem(int test_num, size_t n_elems, int i)
}
static int
-test_fail()
+test_fail(void)
{
return EXIT_FAILURE;
}
@@ -144,8 +144,8 @@ stress(int test_num, size_t n_elems)
srand(seed);
// Delete all elements
- for (size_t i = 0; i < n_elems; i++) {
- r = ith_elem(test_num, n_elems, i);
+ for (size_t e = 0; e < n_elems; e++) {
+ r = ith_elem(test_num, n_elems, e);
ZixTreeIter* item;
if (zix_tree_find(t, (void*)r, &item) != ZIX_STATUS_SUCCESS) {
fprintf(stderr, "Failed to find item to remove\n");
@@ -165,8 +165,8 @@ stress(int test_num, size_t n_elems)
srand(seed);
// Insert n_elems elements again (to test non-empty destruction)
- for (size_t i = 0; i < n_elems; ++i) {
- r = ith_elem(test_num, n_elems, i);
+ for (size_t e = 0; e < n_elems; ++e) {
+ r = ith_elem(test_num, n_elems, e);
int status = zix_tree_insert(t, (void*)r, &ti);
if (status) {
fprintf(stderr, "Insert failed\n");