aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2016-06-12 12:07:45 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2016-06-12 12:07:45 +0200
commita833f44043df169fbebe45e7787d01ed92a28ab0 (patch)
tree3be375af32a8fd053ea74560c4c6aadfbed0993f
parentf9a8dc25278a3083bd3602eeaabc27be71863591 (diff)
downloadsherlock.lv2-a833f44043df169fbebe45e7787d01ed92a28ab0.tar.xz
properly escape reserved markup symbols.
-rw-r--r--VERSION2
-rw-r--r--osc_inspector_eo.c53
2 files changed, 21 insertions, 34 deletions
diff --git a/VERSION b/VERSION
index af88ba8..1a96df1 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.11.1
+0.11.3
diff --git a/osc_inspector_eo.c b/osc_inspector_eo.c
index d1a3ee6..0ba6461 100644
--- a/osc_inspector_eo.c
+++ b/osc_inspector_eo.c
@@ -156,40 +156,17 @@ _atom_stringify(UI *ui, char *ptr, char *end, const LV2_Atom *atom)
case LV2_OSC_STRING: // fall-through
{
const char *str = LV2_ATOM_BODY_CONST(itm);
- if(itm->size == 0)
- str = "";
- sprintf(ptr, TYPE(" s:", ""));
- ptr += strlen(ptr);
-
- for(unsigned i=0; i<strlen(str) + 1; i++)
+ char *markup = elm_entry_utf8_to_markup(str);
+ if(markup)
{
- switch(str[i])
- {
- case '<':
- strncpy(ptr, "&lt;", 4);
- ptr += 4;
- break;
- case '>':
- strncpy(ptr, "&gt;", 4);
- ptr += 4;
- break;
- case '&':
- strncpy(ptr, "&amp;", 5);
- ptr += 5;
- break;
- case '\n':
- strncpy(ptr, "\\n", 2);
- ptr += 2;
- break;
- case '\r':
- strncpy(ptr, "\\r", 2);
- ptr += 2;
- break;
- default:
- *ptr++ = str[i];
- break;
- }
+ sprintf(ptr, TYPE(" s:", "%s"), markup);
+ free(markup);
+ }
+ else
+ {
+ sprintf(ptr, TYPE(" s:", ""));
}
+ ptr += strlen(ptr);
break;
}
case LV2_OSC_BLOB:
@@ -235,7 +212,17 @@ _atom_stringify(UI *ui, char *ptr, char *end, const LV2_Atom *atom)
case LV2_OSC_SYMBOL:
{
- sprintf(ptr, TYPE(" S:", "%s"), ui->unmap->unmap(ui->unmap->handle, ((const LV2_Atom_URID *)itm)->body));
+ const char *str = ui->unmap->unmap(ui->unmap->handle, ((const LV2_Atom_URID *)itm)->body);
+ char *markup = str ? elm_entry_utf8_to_markup(str) : NULL;
+ if(markup)
+ {
+ sprintf(ptr, TYPE(" S:", "%s"), markup);
+ free(markup);
+ }
+ else
+ {
+ sprintf(ptr, TYPE(" S:", ""));
+ }
ptr += strlen(ptr);
break;
}