Use -Wall, and clean-up things so no warnings

This commit is contained in:
Nick Lanham 2012-02-15 12:20:11 +01:00
parent c284a0ba8e
commit 61bb1fe89e
5 changed files with 8 additions and 9 deletions

View File

@ -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)

4
drmr.c
View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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;