forked from enlightenment/efl
elm test dnd: replace strcat with eina_strbuf
replace strcat with eina_strbuf.
This commit is contained in:
parent
0c4880e99d
commit
780b964427
|
@ -61,21 +61,14 @@ _drag_data_build(Eina_List **items)
|
||||||
const char *drag_data = NULL;
|
const char *drag_data = NULL;
|
||||||
if (*items)
|
if (*items)
|
||||||
{
|
{
|
||||||
|
Eina_Strbuf *str;
|
||||||
Eina_List *l;
|
Eina_List *l;
|
||||||
Elm_Object_Item *it;
|
Elm_Object_Item *it;
|
||||||
const char *t;
|
const char *t;
|
||||||
unsigned int len = 0;
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
EINA_LIST_FOREACH(*items, l, it)
|
str = eina_strbuf_new();
|
||||||
{
|
if (!str) return NULL;
|
||||||
t = (char *)elm_object_item_data_get(it);
|
|
||||||
if (t)
|
|
||||||
len += strlen(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
drag_data = malloc(len + eina_list_count(*items) * (FILESEP_LEN + 1));
|
|
||||||
strcpy((char *) drag_data, "");
|
|
||||||
|
|
||||||
/* drag data in form: file://URI1\nfile://URI2 */
|
/* drag data in form: file://URI1\nfile://URI2 */
|
||||||
EINA_LIST_FOREACH(*items, l, it)
|
EINA_LIST_FOREACH(*items, l, it)
|
||||||
|
@ -84,12 +77,14 @@ _drag_data_build(Eina_List **items)
|
||||||
if (t)
|
if (t)
|
||||||
{
|
{
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
strcat((char *) drag_data, "\n");
|
eina_strbuf_append(str, "\n");
|
||||||
strcat((char *) drag_data, FILESEP);
|
eina_strbuf_append(str, FILESEP);
|
||||||
strcat((char *) drag_data, t);
|
eina_strbuf_append(str, t);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
drag_data = eina_strbuf_string_steal(str);
|
||||||
|
eina_strbuf_free(str);
|
||||||
}
|
}
|
||||||
return drag_data;
|
return drag_data;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue