debugpanel: fix debug process.

Reviewers: ajwillia.ms

Reviewed By: ajwillia.ms

Subscribers: bu5hm4n

Differential Revision: https://phab.enlightenment.org/D4987
This commit is contained in:
Al Poole 2017-06-28 19:41:59 +01:00 committed by Andy Williams
parent 849619d32b
commit 4c4ec6e21b
1 changed files with 20 additions and 15 deletions

View File

@ -52,24 +52,28 @@ static Eina_Bool
_debugpanel_stdout_handler(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
Ecore_Exe_Event_Data *ev;
char buf[65535];
char *pos, *start, *end = NULL;
int idx;
char *start, *end = NULL;
ev = event;
if (ev)
{
if (ev->size >= (int)(sizeof(buf) -2)) return ECORE_CALLBACK_DONE;
memcpy(buf, ev->data, ev->size);
buf[ev->size] = 0;
pos = buf;
start = pos;
if (*start == '\n') start++;
while (*pos++ != '\0')
if (ev && ev->size)
{
if (!ev->data) return ECORE_CALLBACK_DONE;
char buf[ev->size + 1];
memcpy(buf, ev->data, ev->size);
buf[ev->size] = '\0';
idx = 0;
if (buf[idx] == '\n')
idx++;
start = &buf[idx];
while (idx < ev->size)
{
if (*pos == '\n')
end = pos;
if (buf[idx] == '\n')
end = &buf[idx];
if (start && end)
{
@ -77,6 +81,7 @@ _debugpanel_stdout_handler(void *data EINA_UNUSED, int type EINA_UNUSED, void *e
start = end + 1;
end = NULL;
}
idx++;
}
}