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,15 +2495,25 @@ _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)
|
||||||
|
{
|
||||||
|
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)
|
if (atom)
|
||||||
formats = atom->formats;
|
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)
|
||||||
{
|
{
|
||||||
|
if ((is_uri) || ((!is_uri) &&
|
||||||
|
strcmp(_atoms[i].name, "text/uri-list")))
|
||||||
len += strlen(_atoms[i].name) + strlen(sep);
|
len += strlen(_atoms[i].name) + strlen(sep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2512,11 +2522,15 @@ _wl_targets_converter(char *target, Wl_Cnp_Selection *sel EINA_UNUSED, void *dat
|
||||||
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)
|
||||||
|
{
|
||||||
|
if ((is_uri) || ((!is_uri) &&
|
||||||
|
strcmp(_atoms[i].name, "text/uri-list")))
|
||||||
{
|
{
|
||||||
aret = strcat(aret, _atoms[i].name);
|
aret = strcat(aret, _atoms[i].name);
|
||||||
aret = strcat(aret, sep);
|
aret = strcat(aret, sep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
*data_ret = aret;
|
*data_ret = aret;
|
||||||
if (size_ret) *size_ret = len;
|
if (size_ret) *size_ret = len;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue