diff options
-rw-r--r-- | src/bin/elementary/test_dnd.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/bin/elementary/test_dnd.c b/src/bin/elementary/test_dnd.c index faeee2e78c..3b44c2bd40 100644 --- a/src/bin/elementary/test_dnd.c +++ b/src/bin/elementary/test_dnd.c | |||
@@ -61,21 +61,14 @@ _drag_data_build(Eina_List **items) | |||
61 | const char *drag_data = NULL; | 61 | const char *drag_data = NULL; |
62 | if (*items) | 62 | if (*items) |
63 | { | 63 | { |
64 | Eina_Strbuf *str; | ||
64 | Eina_List *l; | 65 | Eina_List *l; |
65 | Elm_Object_Item *it; | 66 | Elm_Object_Item *it; |
66 | const char *t; | 67 | const char *t; |
67 | unsigned int len = 0; | ||
68 | int i = 0; | 68 | int i = 0; |
69 | 69 | ||
70 | EINA_LIST_FOREACH(*items, l, it) | 70 | str = eina_strbuf_new(); |
71 | { | 71 | if (!str) return NULL; |
72 | t = (char *)elm_object_item_data_get(it); | ||
73 | if (t) | ||
74 | len += strlen(t); | ||
75 | } | ||
76 | |||
77 | drag_data = malloc(len + eina_list_count(*items) * (FILESEP_LEN + 1)); | ||
78 | strcpy((char *) drag_data, ""); | ||
79 | 72 | ||
80 | /* drag data in form: file://URI1\nfile://URI2 */ | 73 | /* drag data in form: file://URI1\nfile://URI2 */ |
81 | EINA_LIST_FOREACH(*items, l, it) | 74 | EINA_LIST_FOREACH(*items, l, it) |
@@ -84,12 +77,14 @@ _drag_data_build(Eina_List **items) | |||
84 | if (t) | 77 | if (t) |
85 | { | 78 | { |
86 | if (i > 0) | 79 | if (i > 0) |
87 | strcat((char *) drag_data, "\n"); | 80 | eina_strbuf_append(str, "\n"); |
88 | strcat((char *) drag_data, FILESEP); | 81 | eina_strbuf_append(str, FILESEP); |
89 | strcat((char *) drag_data, t); | 82 | eina_strbuf_append(str, t); |
90 | i++; | 83 | i++; |
91 | } | 84 | } |
92 | } | 85 | } |
86 | drag_data = eina_strbuf_string_steal(str); | ||
87 | eina_strbuf_free(str); | ||
93 | } | 88 | } |
94 | return drag_data; | 89 | return drag_data; |
95 | } | 90 | } |