summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2016-02-29 10:02:52 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2016-02-29 10:43:02 -0500
commitadf851de4cfc1cacaf129bc66bc539581032a814 (patch)
tree3cdfb2556b5fbe16c7a239021f4c8425d9c92b2c
parent1e1754466da1aefa0492a90505fd91e0dc14d59c (diff)
downloadenlightenment-adf851de4cfc1cacaf129bc66bc539581032a814.tar.gz
replace static buffer usage with binbuf in e_fm_ipc
CID 1039804
-rw-r--r--src/bin/e_fm/e_fm_ipc.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/src/bin/e_fm/e_fm_ipc.c b/src/bin/e_fm/e_fm_ipc.c
index 2e82455553..09fb470d4c 100644
--- a/src/bin/e_fm/e_fm_ipc.c
+++ b/src/bin/e_fm/e_fm_ipc.c
@@ -1016,12 +1016,10 @@ _e_fm_ipc_file_add_mod(E_Dir *ed, const char *path, E_Fm_Op_Type op, int listing
struct stat st;
char *lnk = NULL, *rlnk = NULL;
int broken_lnk = 0;
- int bsz = 0;
- unsigned char *p, buf
+ Eina_Binbuf *buf;
/* file add/change format is as follows:
*
* stat_info[stat size] + broken_link[1] + path[n]\0 + lnk[n]\0 + rlnk[n]\0 */
- [sizeof(struct stat) + 1 + 4096 + 4096 + 4096];
/* FIXME: handle BACKOFF */
if ((!listing) && (op == E_FM_OP_FILE_CHANGE) && (!ed->cleaning)) /* 5 == mod */
@@ -1082,29 +1080,21 @@ _e_fm_ipc_file_add_mod(E_Dir *ed, const char *path, E_Fm_Op_Type op, int listing
if (!lnk) lnk = strdup("");
if (!rlnk) rlnk = strdup("");
- p = buf;
+ buf = eina_binbuf_new();
/* NOTE: i am NOT converting this data to portable arch/os independent
* format. i am ASSUMING e_fm_main and e are local and built together
* and thus this will work. if this ever changes this here needs to
* change */
- memcpy(buf, &st, sizeof(struct stat));
- p += sizeof(struct stat);
+ eina_binbuf_append_length(buf, (void*)&st, sizeof(struct stat));
- p[0] = broken_lnk;
- p += 1;
+ eina_binbuf_append_char(buf, !!broken_lnk);
+ eina_binbuf_append_length(buf, (void*)path, strlen(path) + 1);
+ eina_binbuf_append_length(buf, (void*)lnk, strlen(lnk) + 1);
+ eina_binbuf_append_length(buf, (void*)rlnk, strlen(rlnk) + 1);
- strcpy((char *)p, path);
- p += strlen(path) + 1;
-
- strcpy((char *)p, lnk);
- p += strlen(lnk) + 1;
-
- strcpy((char *)p, rlnk);
- p += strlen(rlnk) + 1;
-
- bsz = p - buf;
ecore_ipc_server_send(_e_fm_ipc_server, 6 /*E_IPC_DOMAIN_FM*/, op, 0, ed->id,
- listing, buf, bsz);
+ listing, eina_binbuf_string_get(buf), eina_binbuf_length_get(buf));
+ eina_binbuf_free(buf);
free(lnk);
free(rlnk);
}