From fca9010468f22536782bc55fa51f1dd7f082c67d Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Sun, 10 Mar 2019 09:56:52 +0000 Subject: [PATCH] Build with -Wall -Werror And fix a couple of related warnings. --- Makefile.am | 2 +- aux/verify-voice.c | 8 +++++--- engine/drumkit.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index 531f471..20018fe 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,4 @@ -AM_CPPFLAGS = -I$(top_srcdir)/engine $(SNDFILE_CFLAGS) $(SAMPLERATE_CFLAGS) +AM_CPPFLAGS = -Wall -Werror -I$(top_srcdir)/engine $(SNDFILE_CFLAGS) $(SAMPLERATE_CFLAGS) noinst_LTLIBRARIES = libengine.la diff --git a/aux/verify-voice.c b/aux/verify-voice.c index 1a5d6d1..c71f823 100644 --- a/aux/verify-voice.c +++ b/aux/verify-voice.c @@ -35,7 +35,7 @@ int main(int argc, char **argv) { struct voice voice; struct instrument *ins; struct layer *layer; - float *out_l, *out_r; + float *out_l = NULL, *out_r = NULL; int total_samples; int lead_samples = 100; int note_samples = 100000; @@ -88,8 +88,10 @@ int main(int argc, char **argv) { write_sample("out.wav", out_l, out_r, total_samples); cleanup: - free(out_l); - free(out_r); + if (out_l) + free(out_l); + if (out_r) + free(out_r); drumkit_free(&kit); /* diff --git a/engine/drumkit.c b/engine/drumkit.c index 98678b6..599d61c 100644 --- a/engine/drumkit.c +++ b/engine/drumkit.c @@ -473,7 +473,7 @@ int drumkit_load(struct drumkit *kit, const char *filename, int target_samplerat // libxml2 to parse it anyway by setting the proper namespace on all // elements. root_element = xmlDocGetRootElement(doc); - if (!strcmp(root_element->name, "drumkit_info") && root_element->ns == NULL) { + if (!strcmp((const char *)root_element->name, "drumkit_info") && root_element->ns == NULL) { fprintf(stderr, "spotted old-style (bad) XML\n"); ns = xmlNewNs(root_element, (xmlChar *)"http://www.hydrogen-music.org/drumkit", (xmlChar *)""); fix_bad_xml(root_element, ns); -- GitLab