elementary: escape theme filename correctly.

SVN revision: 77046
This commit is contained in:
Cedric BAIL 2012-09-25 08:04:17 +00:00
parent 8e82a878e5
commit 8316dee00d
3 changed files with 38 additions and 25 deletions

View File

@ -534,3 +534,7 @@
2012-09-24 Flavio Ceolin 2012-09-24 Flavio Ceolin
* elementary_codegen: Adding support for box and table. * elementary_codegen: Adding support for box and table.
2012-09-25 Cedric Bail
* Escape theme filename correctly.

View File

@ -29,6 +29,7 @@ Fixes:
* Fix Ctxpopup direction if unknown priority used. * Fix Ctxpopup direction if unknown priority used.
* Fix diskselector when bounce off and round enabled. * Fix diskselector when bounce off and round enabled.
* Fix bubble info field set. * Fix bubble info field set.
* Escape theme filename correctly.
Removals: Removals:

View File

@ -320,33 +320,41 @@ _elm_theme_parse(Elm_Theme *th, const char *theme)
if (!th) th = &(theme_default); if (!th) th = &(theme_default);
if (theme) if (theme)
{ {
Eina_Strbuf *buf;
buf = eina_strbuf_new();
p = theme; p = theme;
pe = p; pe = p;
for (;;) for (;;)
{ {
if ((*pe == ':') || (!*pe)) if ((pe[0] == '\\') && (pe[1] == ':'))
{
eina_strbuf_append_char(buf, ':');
pe += 2;
}
else if ((*pe == ':') || (!*pe))
{ // p -> pe == 'name:' { // p -> pe == 'name:'
if (pe > p) if (pe > p)
{ {
char *n = malloc(pe - p + 1); const char *nn;
if (n)
{
const char *nn;
strncpy(n, p, pe - p); nn = eina_stringshare_add(eina_strbuf_string_get(buf));
n[pe - p] = 0; if (nn) names = eina_list_append(names, nn);
nn = eina_stringshare_add(n); eina_strbuf_reset(buf);
if (nn) names = eina_list_append(names, nn);
free(n);
}
} }
if (!*pe) break; if (!*pe) break;
p = pe + 1; p = pe + 1;
pe = p; pe = p;
} }
else else
pe++; {
eina_strbuf_append_char(buf, *pe);
pe++;
}
} }
eina_strbuf_free(buf);
} }
p = eina_list_data_get(eina_list_last(names)); p = eina_list_data_get(eina_list_last(names));
if ((!p) || ((p) && (strcmp(p, "default")))) if ((!p) || ((p) && (strcmp(p, "default"))))
@ -552,25 +560,25 @@ elm_theme_get(Elm_Theme *th)
if (!th) th = &(theme_default); if (!th) th = &(theme_default);
if (!th->theme) if (!th->theme)
{ {
Eina_Strbuf *buf;
Eina_List *l; Eina_List *l;
const char *f; const char *f;
char *tmp;
int len;
len = 0; buf = eina_strbuf_new();
EINA_LIST_FOREACH(th->themes, l, f) EINA_LIST_FOREACH(th->themes, l, f)
{ {
len += strlen(f); while (*f)
if (l->next) len += 1; {
if (*f == ':')
eina_strbuf_append_char(buf, '\\');
eina_strbuf_append_char(buf, *f);
f++;
}
if (l->next) eina_strbuf_append_char(buf, ':');
} }
tmp = alloca(len + 1); th->theme = eina_stringshare_add(eina_strbuf_string_get(buf));
tmp[0] = 0; eina_strbuf_free(buf);
EINA_LIST_FOREACH(th->themes, l, f)
{
strcat(tmp, f);
if (l->next) strcat(tmp, ":");
}
th->theme = eina_stringshare_add(tmp);
} }
return th->theme; return th->theme;
} }