From 2a003020dc3b094df7eaa9b2f2cde53e97516fa8 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 9 Aug 2012 02:06:27 +0000 Subject: Fix warnings: -Wshadow -Wpointer-arith -Wcast-align -Wstrict-prototypes -Wmissing-prototypes. --- lv2/lv2plug.in/ns/ext/atom/atom-test.c | 14 +++++++------- plugins/eg-sampler.lv2/sampler.c | 6 +++--- wscript | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lv2/lv2plug.in/ns/ext/atom/atom-test.c b/lv2/lv2plug.in/ns/ext/atom/atom-test.c index 67396d9..3159156 100644 --- a/lv2/lv2plug.in/ns/ext/atom/atom-test.c +++ b/lv2/lv2plug.in/ns/ext/atom/atom-test.c @@ -24,7 +24,7 @@ char** uris = NULL; size_t n_uris = 0; -char* +static char* copy_string(const char* str) { const size_t len = strlen(str); @@ -33,7 +33,7 @@ copy_string(const char* str) return dup; } -LV2_URID +static LV2_URID urid_map(LV2_URID_Map_Handle handle, const char* uri) { for (size_t i = 0; i < n_uris; ++i) { @@ -47,7 +47,7 @@ urid_map(LV2_URID_Map_Handle handle, const char* uri) return n_uris; } -int +static int test_fail(const char* fmt, ...) { va_list args; @@ -59,7 +59,7 @@ test_fail(const char* fmt, ...) } int -main() +main(void) { LV2_URID_Map map = { NULL, urid_map }; LV2_Atom_Forge forge; @@ -241,8 +241,8 @@ main() LV2_Atom_Vector* vector2 = (LV2_Atom_Vector*)lv2_atom_forge_deref( &forge, lv2_atom_forge_vector_head( &forge, &vec_frame, sizeof(int32_t), forge.Int)); - for (unsigned i = 0; i < sizeof(elems) / sizeof(int32_t); ++i) { - lv2_atom_forge_int(&forge, elems[i]); + for (unsigned e = 0; e < sizeof(elems) / sizeof(int32_t); ++e) { + lv2_atom_forge_int(&forge, elems[e]); } lv2_atom_forge_pop(&forge, &vec_frame); if (!lv2_atom_equals(&vector->atom, &vector2->atom)) { @@ -339,7 +339,7 @@ main() }; unsigned n_matches = lv2_atom_object_query((LV2_Atom_Object*)obj, q); - for (int i = 0; i < 2; ++i) { + for (int n = 0; n < 2; ++n) { if (n_matches != n_props) { return test_fail("Query failed, %u matches != %u\n", n_matches, n_props); diff --git a/plugins/eg-sampler.lv2/sampler.c b/plugins/eg-sampler.lv2/sampler.c index e837517..a94518b 100644 --- a/plugins/eg-sampler.lv2/sampler.c +++ b/plugins/eg-sampler.lv2/sampler.c @@ -197,15 +197,15 @@ work(LV2_Handle instance, uint32_t size, const void* data) { - Sampler* self = (Sampler*)instance; - LV2_Atom* atom = (LV2_Atom*)data; + Sampler* self = (Sampler*)instance; + const LV2_Atom* atom = (const LV2_Atom*)data; if (atom->type == self->uris.eg_freeSample) { /* Free old sample */ SampleMessage* msg = (SampleMessage*)data; free_sample(self, msg->sample); } else { /* Handle set message (load sample). */ - LV2_Atom_Object* obj = (LV2_Atom_Object*)data; + const LV2_Atom_Object* obj = (const LV2_Atom_Object*)data; /* Get file path from message */ const LV2_Atom* file_path = read_set_file(&self->uris, obj); diff --git a/wscript b/wscript index fe00f66..8afe2a5 100644 --- a/wscript +++ b/wscript @@ -365,7 +365,7 @@ def build(bld): out = open(task.outputs[0].abspath(), 'w') for i in task.inputs: out.write('#include "%s"\n' % i.bldpath()) - out.write('int main() { return 0; }\n') + out.write('int main(void) { return 0; }\n') out.close() bld(rule = gen_build_test, -- cgit v1.2.1