forked from enlightenment/efl
elm cnp/wl: add uri data type checking
When selection owner provides uri type (uri/text-list), it should check if data is in correct format.
This commit is contained in:
parent
ae1b2a124f
commit
bcba96656a
|
@ -2495,16 +2495,26 @@ _wl_targets_converter(char *target, Wl_Cnp_Selection *sel EINA_UNUSED, void *dat
|
||||||
int len = 0;
|
int len = 0;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
Elm_Sel_Format formats = ELM_SEL_FORMAT_NONE;
|
Elm_Sel_Format formats = ELM_SEL_FORMAT_NONE;
|
||||||
Cnp_Atom *atom = NULL;
|
Eina_Bool is_uri = EINA_FALSE;
|
||||||
|
|
||||||
atom = eina_hash_find(_types_hash, target);
|
if (sel->format)
|
||||||
if (atom)
|
{
|
||||||
formats = atom->formats;
|
formats = sel->format;
|
||||||
|
is_uri = _wl_is_uri_type_data(sel->selbuf, sel->buflen);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Cnp_Atom *atom = eina_hash_find(_types_hash, target);
|
||||||
|
if (atom)
|
||||||
|
formats = atom->formats;
|
||||||
|
}
|
||||||
for (i = 0; i < CNP_N_ATOMS; i++)
|
for (i = 0; i < CNP_N_ATOMS; i++)
|
||||||
{
|
{
|
||||||
if (formats & _atoms[i].formats)
|
if (formats & _atoms[i].formats)
|
||||||
{
|
{
|
||||||
len += strlen(_atoms[i].name) + strlen(sep);
|
if ((is_uri) || ((!is_uri) &&
|
||||||
|
strcmp(_atoms[i].name, "text/uri-list")))
|
||||||
|
len += strlen(_atoms[i].name) + strlen(sep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aret = calloc(1, len * sizeof(char));
|
aret = calloc(1, len * sizeof(char));
|
||||||
|
@ -2513,8 +2523,12 @@ _wl_targets_converter(char *target, Wl_Cnp_Selection *sel EINA_UNUSED, void *dat
|
||||||
{
|
{
|
||||||
if (formats & _atoms[i].formats)
|
if (formats & _atoms[i].formats)
|
||||||
{
|
{
|
||||||
aret = strcat(aret, _atoms[i].name);
|
if ((is_uri) || ((!is_uri) &&
|
||||||
aret = strcat(aret, sep);
|
strcmp(_atoms[i].name, "text/uri-list")))
|
||||||
|
{
|
||||||
|
aret = strcat(aret, _atoms[i].name);
|
||||||
|
aret = strcat(aret, sep);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*data_ret = aret;
|
*data_ret = aret;
|
||||||
|
|
Loading…
Reference in New Issue