aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2015-09-17 11:15:11 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2015-09-17 11:15:11 +0200
commitf881476ab38711db93ae46dc62decbdf3b4f137d (patch)
tree76b5ce81c7977506252afd578067d6af5498f8ec /bin
parentd16eba41bc83dc9c96f0ba9bbf367dbcd3d0c483 (diff)
downloadsynthpod-f881476ab38711db93ae46dc62decbdf3b4f137d.tar.xz
fix bugs reported by clang static analyzer.
Diffstat (limited to 'bin')
-rw-r--r--bin/ext_urid.c1
-rw-r--r--bin/synthpod_bin.h4
-rw-r--r--bin/synthpod_jack.c19
-rw-r--r--bin/synthpod_nsm.c40
4 files changed, 37 insertions, 27 deletions
diff --git a/bin/ext_urid.c b/bin/ext_urid.c
index 8f7c6925..d5534b89 100644
--- a/bin/ext_urid.c
+++ b/bin/ext_urid.c
@@ -101,7 +101,6 @@ _urid_map(LV2_URID_Map_Handle handle, const char *uri)
else
{
eina_hash_del(uri_hash->uris, uri_dup, urid);
- eina_lock_release(&uri_hash->mutex);
}
}
diff --git a/bin/synthpod_bin.h b/bin/synthpod_bin.h
index 8bf3bd4a..20952058 100644
--- a/bin/synthpod_bin.h
+++ b/bin/synthpod_bin.h
@@ -400,7 +400,9 @@ bin_run(bin_t *bin, char **argv, const synthpod_nsm_driver_t *nsm_driver)
// threads init
Eina_Bool status = eina_thread_create(&bin->worker_thread,
- EINA_THREAD_URGENT, -1, _worker_thread, bin); //TODO
+ EINA_THREAD_URGENT, -1, _worker_thread, bin);
+ if(!status)
+ fprintf(stderr, "creation of worker thread failed\n");
// main loop
elm_run();
diff --git a/bin/synthpod_jack.c b/bin/synthpod_jack.c
index 7b5ebdbe..15194012 100644
--- a/bin/synthpod_jack.c
+++ b/bin/synthpod_jack.c
@@ -177,14 +177,14 @@ _message(osc_time_t timestamp, const char *path, const char *fmt,
{
case 'i':
{
- int32_t i;
+ int32_t i = 0;
ptr = osc_get_int32(ptr, &i);
osc_forge_int32(&handle->oforge, forge, i);
break;
}
case 'f':
{
- float f;
+ float f = 0.f;
ptr = osc_get_float(ptr, &f);
osc_forge_float(&handle->oforge, forge, f);
break;
@@ -192,14 +192,14 @@ _message(osc_time_t timestamp, const char *path, const char *fmt,
case 's':
case 'S':
{
- const char *s;
+ const char *s = "";
ptr = osc_get_string(ptr, &s);
osc_forge_string(&handle->oforge, forge, s);
break;
}
case 'b':
{
- osc_blob_t b;
+ osc_blob_t b = {.size = 0, .payload=NULL};
ptr = osc_get_blob(ptr, &b);
osc_forge_blob(&handle->oforge, forge, b.size, b.payload);
break;
@@ -207,21 +207,21 @@ _message(osc_time_t timestamp, const char *path, const char *fmt,
case 'h':
{
- int64_t h;
+ int64_t h = 0;
ptr = osc_get_int64(ptr, &h);
osc_forge_int64(&handle->oforge, forge, h);
break;
}
case 'd':
{
- double d;
+ double d = 0.f;
ptr = osc_get_double(ptr, &d);
osc_forge_double(&handle->oforge, forge, d);
break;
}
case 't':
{
- uint64_t t;
+ uint64_t t = 0;
ptr = osc_get_timetag(ptr, &t);
osc_forge_timestamp(&handle->oforge, forge, t);
break;
@@ -237,14 +237,14 @@ _message(osc_time_t timestamp, const char *path, const char *fmt,
case 'c':
{
- char c;
+ char c = '\0';
ptr = osc_get_char(ptr, &c);
osc_forge_char(&handle->oforge, forge, c);
break;
}
case 'm':
{
- const uint8_t *m;
+ const uint8_t *m = NULL;
ptr = osc_get_midi(ptr, &m);
osc_forge_midi(&handle->oforge, forge, 3, m + 1); // skip port byte
break;
@@ -1135,7 +1135,6 @@ elm_main(int argc, char **argv)
bin_init(bin);
LV2_URID_Map *map = ext_urid_map_get(bin->ext_urid);
- LV2_URID_Unmap *unmap = ext_urid_unmap_get(bin->ext_urid);
lv2_atom_forge_init(&handle.forge, map);
osc_forge_init(&handle.oforge, map);
diff --git a/bin/synthpod_nsm.c b/bin/synthpod_nsm.c
index a34baf91..a07a6966 100644
--- a/bin/synthpod_nsm.c
+++ b/bin/synthpod_nsm.c
@@ -54,14 +54,14 @@ _reply(osc_time_t time, const char *path, const char *fmt, const osc_data_t *buf
{
synthpod_nsm_t *nsm = data;
- const char *target;
+ const char *target = NULL;
const osc_data_t *ptr = buf;
ptr = osc_get_string(ptr, &target);
//fprintf(stdout, "synthpod_nsm reply: %s\n", target);
- if(!strcmp(target, "/nsm/server/announce"))
+ if(target && !strcmp(target, "/nsm/server/announce"))
{
const char *message;
const char *manager;
@@ -69,7 +69,7 @@ _reply(osc_time_t time, const char *path, const char *fmt, const osc_data_t *buf
ptr = osc_get_string(ptr, &message);
ptr = osc_get_string(ptr, &manager);
- ptr = osc_get_string(ptr, &capabilities);
+ osc_get_string(ptr, &capabilities);
//TODO, e.g. toggle SM LED
}
@@ -83,14 +83,14 @@ _error(osc_time_t time, const char *path, const char *fmt, const osc_data_t *buf
{
synthpod_nsm_t *nsm = data;
- const char *msg;
- int32_t code;
- const char *err;
+ const char *msg = NULL;
+ int32_t code = 0;
+ const char *err = NULL;
const osc_data_t *ptr = buf;
ptr = osc_get_string(ptr, &msg);
ptr = osc_get_int32(ptr, &code);
- ptr = osc_get_string(ptr, &err);
+ osc_get_string(ptr, &err);
fprintf(stderr, "synthpod_nsm error: #%i in %s: %s\n", code, msg, err);
@@ -103,17 +103,18 @@ _client_open(osc_time_t time, const char *path, const char *fmt, const osc_data_
{
synthpod_nsm_t *nsm = data;
- const char *dir;
- const char *name;
- const char *id;
+ const char *dir = NULL;
+ const char *name = NULL;
+ const char *id = NULL;
const osc_data_t *ptr = buf;
ptr = osc_get_string(ptr, &path);
ptr = osc_get_string(ptr, &name);
- ptr = osc_get_string(ptr, &id);
+ osc_get_string(ptr, &id);
// open/create app
- int ret = nsm->driver->open(path, name, id, nsm->data); //TODO check
+ if(nsm->driver->open(path, name, id, nsm->data))
+ fprintf(stderr, "NSM load failed\n");
return 1;
}
@@ -126,7 +127,8 @@ _client_save(osc_time_t time, const char *path, const char *fmt, const osc_data_
const osc_data_t *ptr;
// save app
- int ret = nsm->driver->save(nsm->data); //TODO check
+ if(nsm->driver->save(nsm->data))
+ fprintf(stderr, "NSM save failed\n");
return 1;
}
@@ -138,7 +140,11 @@ _client_show_optional_gui(osc_time_t time, const char *path, const char *fmt, co
synthpod_nsm_t *nsm = data;
// show gui
- int ret = nsm->driver->show(nsm->data); //TODO check
+ if(nsm->driver->show(nsm->data))
+ {
+ fprintf(stderr, "NSM show GUI failed\n");
+ return 1;
+ }
// reply
const osc_data_t *ptr;
@@ -162,7 +168,11 @@ _client_hide_optional_gui(osc_time_t time, const char *path, const char *fmt, co
synthpod_nsm_t *nsm = data;
// hide gui
- int ret = nsm->driver->hide(nsm->data); //TODO check
+ if(nsm->driver->hide(nsm->data))
+ {
+ fprintf(stderr, "NSM hide GUI failed\n");
+ return 1;
+ }
// reply
const osc_data_t *ptr;