From 61bb1fe89e98139ac3e259d70874f4f84358213f Mon Sep 17 00:00:00 2001 From: Nick Lanham Date: Wed, 15 Feb 2012 12:20:11 +0100 Subject: [PATCH] Use -Wall, and clean-up things so no warnings --- Makefile | 4 ++-- drmr.c | 4 ++-- drmr_hydrogen.c | 7 +++---- drmr_hydrogen.h | 1 + drmr_ui.c | 1 - 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 1b970a4..e67151a 100644 --- a/Makefile +++ b/Makefile @@ -8,10 +8,10 @@ $(BUNDLE): manifest.ttl drmr.ttl drmr.so drmr_ui.so cp manifest.ttl drmr.ttl drmr.so drmr_ui.so $(BUNDLE) drmr.so: drmr.c drmr_hydrogen.c - $(CC) -shared -fPIC -DPIC drmr.c drmr_hydrogen.c `pkg-config --cflags --libs lv2-plugin sndfile samplerate` -lexpat -lm -o drmr.so + $(CC) -shared -Wall -fPIC -DPIC drmr.c drmr_hydrogen.c `pkg-config --cflags --libs lv2-plugin sndfile samplerate` -lexpat -lm -o drmr.so drmr_ui.so: drmr_ui.c drmr_hydrogen.c - $(CC) -shared -fPIC -DPIC drmr_ui.c drmr_hydrogen.c `pkg-config --cflags --libs lv2-plugin gtk+-2.0 sndfile samplerate` -lexpat -lm -o drmr_ui.so + $(CC) -shared -Wall -fPIC -DPIC drmr_ui.c drmr_hydrogen.c `pkg-config --cflags --libs lv2-plugin gtk+-2.0 sndfile samplerate` -lexpat -lm -o drmr_ui.so install: $(BUNDLE) mkdir -p $(INSTALL_DIR) diff --git a/drmr.c b/drmr.c index d68361b..0598ec6 100644 --- a/drmr.c +++ b/drmr.c @@ -150,7 +150,7 @@ static inline void layer_to_sample(drmr_sample *sample, float gain) { for(i = 0;i < sample->layer_count;i++) { if (sample->layers[i].min <= mapped_gain && (sample->layers[i].max > mapped_gain || - sample->layers[i].max == 1 && mapped_gain == 1)) { + (sample->layers[i].max == 1 && mapped_gain == 1))) { sample->limit = sample->layers[i].limit; sample->info = sample->layers[i].info; sample->data = sample->layers[i].data; @@ -186,7 +186,7 @@ static void run(LV2_Handle instance, uint32_t n_samples) { while (lv2_event_is_valid(&eit)) { cur_ev = lv2_event_get(&eit,&data); if (cur_ev->type == drmr->uris.midi_event) { - int channel = *data & 15; + //int channel = *data & 15; switch ((*data) >> 4) { case 8: // ignore note-offs for now, should probably be a setting //if (drmr->cur_samp) drmr->cur_samp->active = 0; diff --git a/drmr_hydrogen.c b/drmr_hydrogen.c index b2c14f9..a7d3e56 100644 --- a/drmr_hydrogen.c +++ b/drmr_hydrogen.c @@ -254,7 +254,7 @@ kits* scan_kits() { int cp = 0; char* cur_path = default_drumkit_locations[cp++]; kits* ret = malloc(sizeof(kits)); - struct kit_list* scanned_kits = NULL,*cur_kit; + struct kit_list* scanned_kits = NULL; char buf[BUFSIZ], path_buf[BUFSIZ]; ret->num_kits = 0; @@ -267,7 +267,7 @@ kits* scan_kits() { } dp = opendir (cur_path); if (dp != NULL) { - while (ep = readdir (dp)) { + while ((ep = readdir (dp))) { if (ep->d_name[0]=='.') continue; if (snprintf(buf,BUFSIZ,"%s/%s/drumkit.xml",cur_path,ep->d_name) >= BUFSIZ) { fprintf(stderr,"Warning: Skipping scan of %s as path name is too long\n",cur_path); @@ -438,7 +438,7 @@ int load_sample(char* path, drmr_layer* layer, double target_rate) { } if (src_data.input_frames_used != layer->info->frames) - fprintf(stderr,"Didn't consume all input frames. used: %i had: %i gened: %i\n", + fprintf(stderr,"Didn't consume all input frames. used: %li had: %li gened: %li\n", src_data.input_frames_used, layer->info->frames,src_data.output_frames_gen); free(layer->data); @@ -452,7 +452,6 @@ int load_sample(char* path, drmr_layer* layer, double target_rate) { } int load_hydrogen_kit(DrMr* drmr, char* path) { - char* fp_buf; FILE* file; char buf[BUFSIZ]; XML_Parser parser; diff --git a/drmr_hydrogen.h b/drmr_hydrogen.h index 7e64466..1b9fa29 100644 --- a/drmr_hydrogen.h +++ b/drmr_hydrogen.h @@ -19,6 +19,7 @@ #define DRMR_HYDRO_H kits* scan_kits(); +void free_kits(kits* kits); void free_samples(drmr_sample* samples, int num_samples); int load_sample(char* path,drmr_layer* layer,double target_rate); int load_hydrogen_kit(DrMr* drmr, char* path); diff --git a/drmr_ui.c b/drmr_ui.c index 6bcb46d..4951f0c 100644 --- a/drmr_ui.c +++ b/drmr_ui.c @@ -224,7 +224,6 @@ instantiate(const LV2UI_Descriptor* descriptor, LV2UI_Widget* widget, const LV2_Feature* const* features) { DrMrUi *ui = (DrMrUi*)malloc(sizeof(DrMrUi)); - int i; ui->write = write_function; ui->controller = controller;