aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHanspeter Portner <dev@open-music-kontrollers.ch>2016-04-19 11:10:27 +0200
committerHanspeter Portner <dev@open-music-kontrollers.ch>2016-04-19 11:10:27 +0200
commitdc4cd6c955f65a1a231d2e259850b46935cb8290 (patch)
tree75c4f010100c6ab657da8f4eae5e0f974b3a78b8
parent733ee87180cd392ecacc54e8a9f8d10730be80c9 (diff)
downloadsherlock.lv2-dc4cd6c955f65a1a231d2e259850b46935cb8290.tar.xz
escape '<>&\n\r' in osc strings.
-rw-r--r--midi_inspector_eo.c6
-rw-r--r--osc_inspector_eo.c38
2 files changed, 39 insertions, 5 deletions
diff --git a/midi_inspector_eo.c b/midi_inspector_eo.c
index 18183ee..0234d68 100644
--- a/midi_inspector_eo.c
+++ b/midi_inspector_eo.c
@@ -581,9 +581,11 @@ _content_get(UI *ui, Evas_Object *parent)
ui->list = elm_genlist_add(ui->table);
if(ui->list)
{
+ elm_genlist_homogeneous_set(ui->list, EINA_TRUE); // needef for lazy-loading
+ elm_genlist_mode_set(ui->list, ELM_LIST_LIMIT);
+ elm_genlist_block_count_set(ui->list, 64); // needef for lazy-loading
+ elm_genlist_reorder_mode_set(ui->list, EINA_FALSE);
elm_genlist_select_mode_set(ui->list, ELM_OBJECT_SELECT_MODE_DEFAULT);
- elm_genlist_homogeneous_set(ui->list, EINA_FALSE); // TRUE for lazy-loading
- elm_genlist_mode_set(ui->list, ELM_LIST_SCROLL);
evas_object_data_set(ui->list, "ui", ui);
evas_object_size_hint_weight_set(ui->list, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
evas_object_size_hint_align_set(ui->list, EVAS_HINT_FILL, EVAS_HINT_FILL);
diff --git a/osc_inspector_eo.c b/osc_inspector_eo.c
index 6550c5b..bd3ec01 100644
--- a/osc_inspector_eo.c
+++ b/osc_inspector_eo.c
@@ -161,8 +161,38 @@ _atom_stringify(UI *ui, char *ptr, char *end, const LV2_Atom *atom)
const char *str = LV2_ATOM_BODY_CONST(itm);
if(itm->size == 0)
str = "";
- sprintf(ptr, TYPE(" s:", "%s"), str);
+ sprintf(ptr, TYPE(" s:", ""));
ptr += strlen(ptr);
+
+ for(unsigned i=0; i<strlen(str) + 1; i++)
+ {
+ 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;
+ }
+ }
}
break;
}
@@ -642,9 +672,11 @@ _content_get(UI *ui, Evas_Object *parent)
ui->list = elm_genlist_add(ui->table);
if(ui->list)
{
+ elm_genlist_homogeneous_set(ui->list, EINA_TRUE); // needef for lazy-loading
+ elm_genlist_mode_set(ui->list, ELM_LIST_LIMIT);
+ elm_genlist_block_count_set(ui->list, 64); // needef for lazy-loading
+ elm_genlist_reorder_mode_set(ui->list, EINA_FALSE);
elm_genlist_select_mode_set(ui->list, ELM_OBJECT_SELECT_MODE_DEFAULT);
- elm_genlist_homogeneous_set(ui->list, EINA_FALSE); // TRUE for lazy-loading
- elm_genlist_mode_set(ui->list, ELM_LIST_SCROLL);
evas_object_data_set(ui->list, "ui", ui);
evas_object_smart_callback_add(ui->list, "expand,request",
_item_expand_request, ui);