}
static Eina_Bool
-edje_converter(char *target __UNUSED__, void *data, int size __UNUSED__, void **data_ret, int *size_ret, Ecore_X_Atom *ttype __UNUSED__, int *typesize __UNUSED__)
+edje_converter(char *target __UNUSED__, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *ttype __UNUSED__, int *typesize __UNUSED__)
{
- Cnp_Selection *sel;
-
- sel = selections + *((int *)data);
- if (data_ret) *data_ret = strdup(sel->selbuf);
- if (size_ret) *size_ret = strlen(sel->selbuf);
+ if (size == sizeof(int))
+ {
+ Cnp_Selection *sel;
+ sel = selections + *((int *)data);
+ if (data_ret) *data_ret = strdup(sel->selbuf);
+ if (size_ret) *size_ret = strlen(sel->selbuf);
+ }
+ else if (size)
+ {
+ if (data_ret) *data_ret = strndup(data, size - 1);
+ if (size_ret) *size_ret = size - 1;
+ }
return EINA_TRUE;
}
static Eina_Bool
html_converter(char *target __UNUSED__, void *data, int size __UNUSED__, void **data_ret, int *size_ret, Ecore_X_Atom *ttype __UNUSED__, int *typesize __UNUSED__)
{
- Cnp_Selection *sel;
+ if (size == sizeof(int))
+ {
+ Cnp_Selection *sel;
- sel = selections + *(int *)data;
- if (data_ret) *data_ret = strdup(sel->selbuf);
- if (size_ret) *size_ret = strlen(sel->selbuf);
+ sel = selections + *((int *)data);
+ if (data_ret) *data_ret = strdup(sel->selbuf);
+ if (size_ret) *size_ret = strlen(sel->selbuf);
+ }
+ else if (size)
+ {
+ if (data_ret) *data_ret = strndup(data, size - 1);
+ if (size_ret) *size_ret = size - 1;
+ }
return EINA_TRUE;
}
static Eina_Bool
uri_converter(char *target __UNUSED__, void *data, int size __UNUSED__, void **data_ret, int *size_ret, Ecore_X_Atom *ttype __UNUSED__, int *typesize __UNUSED__)
{
- Cnp_Selection *sel;
- sel = selections + *((int *)data);
- cnp_debug("Uri converter\n");
- if (data_ret) *data_ret = strdup(sel->selbuf);
- if (size_ret) *size_ret = strlen(sel->selbuf);
+ if (size == sizeof(int))
+ {
+ Cnp_Selection *sel;
+
+ sel = selections + *((int *)data);
+ if (data_ret) *data_ret = strdup(sel->selbuf);
+ if (size_ret) *size_ret = strlen(sel->selbuf);
+ }
+ else if (size)
+ {
+ if (data_ret) *data_ret = strndup(data, size - 1);
+ if (size_ret) *size_ret = size - 1;
+ }
+
return EINA_TRUE;
}