aboutsummaryrefslogtreecommitdiff
path: root/osc.lv2
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2017-05-10 23:02:31 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2017-05-10 23:02:31 +0200
commit330935d914174f38d2a81c5b57e68a8ec405bbea (patch)
tree33a03bba4bde8043228d40a496e7932eb400cb90 /osc.lv2
parent7593d396ea341729673711669e97013841f53a34 (diff)
parente9316bc2e11b88365aabf478c546f53b8af458ee (diff)
downloadsherlock.lv2-330935d914174f38d2a81c5b57e68a8ec405bbea.tar.xz
Merge commit 'e9316bc2e11b88365aabf478c546f53b8af458ee'
Diffstat (limited to 'osc.lv2')
-rw-r--r--osc.lv2/osc.lv2/util.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/osc.lv2/osc.lv2/util.h b/osc.lv2/osc.lv2/util.h
index b9d3746..a026e21 100644
--- a/osc.lv2/osc.lv2/util.h
+++ b/osc.lv2/osc.lv2/util.h
@@ -22,6 +22,7 @@
#include <ctype.h>
#include <inttypes.h>
#include <stdio.h>
+#include <stdlib.h>
#include <osc.lv2/osc.h>
@@ -312,10 +313,10 @@ lv2_osc_impulse_get(LV2_OSC_URID *osc_urid, const LV2_Atom *atom)
}
static inline const LV2_Atom *
-lv2_osc_symbol_get(LV2_OSC_URID *osc_urid, const LV2_Atom *atom, const char **s)
+lv2_osc_symbol_get(LV2_OSC_URID *osc_urid, const LV2_Atom *atom, LV2_URID *S)
{
- assert(s);
- *s = LV2_ATOM_BODY_CONST(atom);
+ assert(S);
+ *S = ((const LV2_Atom_URID *)atom)->body;
return lv2_atom_tuple_next(atom);
}
@@ -347,7 +348,20 @@ lv2_osc_rgba_get(LV2_OSC_URID *osc_urid, const LV2_Atom *atom,
{
assert(r && g && b && a);
const char *str = LV2_ATOM_CONTENTS_CONST(LV2_Atom_Literal, atom);
- sscanf(str, "%02"SCNx8"%02"SCNx8"%02"SCNx8"%02"SCNx8, r, g, b, a);
+
+ uint8_t *key [4] = {
+ r, g, b, a
+ };
+
+ const char *pos = str;
+ char *endptr;
+
+ for(unsigned count = 0; count < 4; count++, pos += 2)
+ {
+ char buf [5] = {'0', 'x', pos[0], pos[1], '\0'};
+
+ *key[count] = strtol(buf, &endptr, 16);
+ }
return lv2_atom_tuple_next(atom);
}