From c0276353536ddb2872a03b8b76e56359c69e333c Mon Sep 17 00:00:00 2001 From: Kyuho Jo Date: Mon, 20 Apr 2015 22:30:14 +0900 Subject: [PATCH] Fix PREVENT issue Change-Id: I54133ebfd03860851d5f922833c647fbe1724c54 Signed-off-by: Kyuho Jo --- widget_viewer/src/client.c | 14 +-- widget_viewer/src/desc_parser.c | 16 ++-- widget_viewer/src/fb.c | 54 +++++++----- widget_viewer/src/fb_wayland.c | 30 +++---- widget_viewer/src/file_service.c | 40 ++++----- widget_viewer/src/util.c | 10 +-- widget_viewer/src/widget.c | 6 +- widget_viewer/src/widget_internal.c | 34 +++---- widget_viewer_evas/src/widget_viewer_evas.c | 132 ++++++++++++++++------------ 9 files changed, 181 insertions(+), 155 deletions(-) mode change 100644 => 100755 widget_viewer_evas/src/widget_viewer_evas.c diff --git a/widget_viewer/src/client.c b/widget_viewer/src/client.c index 7b996f1..7d87689 100755 --- a/widget_viewer/src/client.c +++ b/widget_viewer/src/client.c @@ -150,7 +150,7 @@ static struct packet *master_pinup(pid_t pid, int handle, const struct packet *p common->content = new_content; common->is_pinned_up = pinup; } else { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); status = WIDGET_ERROR_OUT_OF_MEMORY; } } @@ -1146,7 +1146,7 @@ static struct packet *master_gbar_extra_buffer_destroyed(pid_t pid, int handle, if (!common->gbar.extra_buffer && conf_extra_buffer_count()) { common->gbar.extra_buffer = calloc(conf_extra_buffer_count(), sizeof(*common->gbar.extra_buffer)); if (!common->gbar.extra_buffer) { - ErrPrint("WIDGET(%s) calloc: %s\n", id, strerror(errno)); + ErrPrint("WIDGET(%s) calloc: %d\n", id, errno); } } @@ -1204,7 +1204,7 @@ static struct packet *master_widget_extra_buffer_destroyed(pid_t pid, int handle if (!common->widget.extra_buffer && conf_extra_buffer_count()) { common->widget.extra_buffer = calloc(conf_extra_buffer_count(), sizeof(*common->widget.extra_buffer)); if (!common->widget.extra_buffer) { - ErrPrint("WIDGET(%s) calloc: %s\n", id, strerror(errno)); + ErrPrint("WIDGET(%s) calloc: %d\n", id, errno); } } @@ -1262,7 +1262,7 @@ static struct packet *master_widget_extra_buffer_created(pid_t pid, int handle, if (!common->widget.extra_buffer && conf_extra_buffer_count()) { common->widget.extra_buffer = calloc(conf_extra_buffer_count(), sizeof(*common->widget.extra_buffer)); if (!common->widget.extra_buffer) { - ErrPrint("WIDGET(%s) calloc: %s\n", id, strerror(errno)); + ErrPrint("WIDGET(%s) calloc: %d\n", id, errno); } } @@ -1318,7 +1318,7 @@ static struct packet *master_gbar_extra_buffer_created(pid_t pid, int handle, co if (!common->gbar.extra_buffer && conf_extra_buffer_count()) { common->gbar.extra_buffer = calloc(conf_extra_buffer_count(), sizeof(*common->gbar.extra_buffer)); if (!common->gbar.extra_buffer) { - ErrPrint("WIDGET(%s) calloc: %s\n", id, strerror(errno)); + ErrPrint("WIDGET(%s) calloc: %d\n", id, errno); } } @@ -2194,7 +2194,7 @@ static void prepare_direct_update(void) s_info.direct_addr = strdup(path); if (!s_info.direct_addr) { - ErrPrint("strdup: %s\n", strerror(errno)); + ErrPrint("strdup: %d\n", errno); return; } @@ -2215,7 +2215,7 @@ int client_init(int use_thread) if (!s_info.client_addr) { s_info.client_addr = strdup(CLIENT_SOCKET); if (!s_info.client_addr) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } } diff --git a/widget_viewer/src/desc_parser.c b/widget_viewer/src/desc_parser.c index cbb9dfe..de8f283 100755 --- a/widget_viewer/src/desc_parser.c +++ b/widget_viewer/src/desc_parser.c @@ -337,24 +337,24 @@ static inline char *load_file(const char *filename) fd = open(filename, O_RDONLY); if (fd < 0) { - ErrPrint("open: %s (%s)\n", strerror(errno), filename); + ErrPrint("open: %d (%s)\n", errno, filename); return NULL; } filesize = lseek(fd, 0L, SEEK_END); if (filesize == (off_t)-1) { - ErrPrint("lseek: %s\n", strerror(errno)); + ErrPrint("lseek: %d\n", errno); goto errout; } if (lseek(fd, 0L, SEEK_SET) < 0) { - ErrPrint("lseek: %s\n", strerror(errno)); + ErrPrint("lseek: %d\n", errno); goto errout; } filebuf = malloc(filesize + 1); if (!filebuf) { - ErrPrint("malloc: %s\n", strerror(errno)); + ErrPrint("malloc: %d\n", errno); goto errout; } @@ -366,7 +366,7 @@ static inline char *load_file(const char *filename) continue; } - ErrPrint("read: %s\n", strerror(errno)); + ErrPrint("read: %d\n", errno); free(filebuf); filebuf = NULL; break; @@ -386,7 +386,7 @@ static inline char *load_file(const char *filename) errout: if (close(fd) < 0) { - ErrPrint("close: %s\n", strerror(errno)); + ErrPrint("close: %d\n", errno); } return filebuf; @@ -428,9 +428,11 @@ int parse_desc(struct widget_common *common, const char *filename, int is_gbar) switch (state) { case BEGIN: if (*fileptr == '{') { + if (block) + free(block); block = calloc(1, sizeof(*block)); if (!block) { - ErrPrint("calloc: %s\n", strerror(errno)); + ErrPrint("calloc: %d\n", errno); state = ERROR; continue; } diff --git a/widget_viewer/src/fb.c b/widget_viewer/src/fb.c index 2a19827..05795b2 100755 --- a/widget_viewer/src/fb.c +++ b/widget_viewer/src/fb.c @@ -91,6 +91,7 @@ static int sync_for_file(struct fb_info *info, int x, int y, int w, int h) { int fd; widget_fb_t buffer; + const char *path = NULL; buffer = info->buffer; @@ -108,10 +109,17 @@ static int sync_for_file(struct fb_info *info, int x, int y, int w, int h) return WIDGET_ERROR_NONE; } - fd = open(util_uri_to_path(info->id), O_RDONLY); + path = util_uri_to_path(info->id); + + if (path == NULL) { + ErrPrint("Invalid parameter\n"); + return WIDGET_ERROR_INVALID_PARAMETER; + } + + fd = open(path, O_RDONLY); if (fd < 0) { - ErrPrint("Failed to open a file (%s) because of (%s)\n", - util_uri_to_path(info->id), strerror(errno)); + ErrPrint("Failed to open a file (%s) because of (%d)\n", + util_uri_to_path(info->id), errno); /** * @note @@ -137,9 +145,9 @@ static int sync_for_file(struct fb_info *info, int x, int y, int w, int h) width = w * info->pixels; if (lseek(fd, index * info->pixels, SEEK_SET) != index * info->pixels) { - ErrPrint("lseek: %s\n", strerror(errno)); + ErrPrint("lseek: %d\n", errno); if (close(fd) < 0) { - ErrPrint("close: %s\n", strerror(errno)); + ErrPrint("close: %d\n", errno); } /** * @note @@ -153,7 +161,7 @@ static int sync_for_file(struct fb_info *info, int x, int y, int w, int h) if (read(fd, ((unsigned int *)buffer->data) + index, width) != width) { if (close(fd) < 0) { - ErrPrint("close: %s\n", strerror(errno)); + ErrPrint("close: %d\n", errno); } /** * @note @@ -167,9 +175,9 @@ static int sync_for_file(struct fb_info *info, int x, int y, int w, int h) } } else { if (read(fd, buffer->data, info->bufsz) != info->bufsz) { - ErrPrint("read: %s\n", strerror(errno)); + ErrPrint("read: %d\n", errno); if (close(fd) < 0) { - ErrPrint("close: %s\n", strerror(errno)); + ErrPrint("close: %d\n", errno); } /** @@ -184,7 +192,7 @@ static int sync_for_file(struct fb_info *info, int x, int y, int w, int h) } if (close(fd) < 0) { - ErrPrint("close: %s\n", strerror(errno)); + ErrPrint("close: %d\n", errno); } return WIDGET_ERROR_NONE; } @@ -245,7 +253,7 @@ static int sync_for_pixmap(struct fb_info *info, int x, int y, int w, int h) si.shmid = shmget(IPC_PRIVATE, info->bufsz, IPC_CREAT | 0666); if (si.shmid < 0) { - ErrPrint("shmget: %s\n", strerror(errno)); + ErrPrint("shmget: %d\n", errno); return WIDGET_ERROR_FAULT; } @@ -253,7 +261,7 @@ static int sync_for_pixmap(struct fb_info *info, int x, int y, int w, int h) si.shmaddr = shmat(si.shmid, NULL, 0); if (si.shmaddr == (void *)-1) { if (shmctl(si.shmid, IPC_RMID, 0) < 0) { - ErrPrint("shmctl: %s\n", strerror(errno)); + ErrPrint("shmctl: %d\n", errno); } return WIDGET_ERROR_FAULT; @@ -269,11 +277,11 @@ static int sync_for_pixmap(struct fb_info *info, int x, int y, int w, int h) info->w, info->h); if (xim == NULL) { if (shmdt(si.shmaddr) < 0) { - ErrPrint("shmdt: %s\n", strerror(errno)); + ErrPrint("shmdt: %d\n", errno); } if (shmctl(si.shmid, IPC_RMID, 0) < 0) { - ErrPrint("shmctl: %s\n", strerror(errno)); + ErrPrint("shmctl: %d\n", errno); } return WIDGET_ERROR_FAULT; @@ -304,11 +312,11 @@ static int sync_for_pixmap(struct fb_info *info, int x, int y, int w, int h) XDestroyImage(xim); if (shmdt(si.shmaddr) < 0) { - ErrPrint("shmdt: %s\n", strerror(errno)); + ErrPrint("shmdt: %d\n", errno); } if (shmctl(si.shmid, IPC_RMID, 0) < 0) { - ErrPrint("shmctl: %s\n", strerror(errno)); + ErrPrint("shmctl: %d\n", errno); } return WIDGET_ERROR_NONE; @@ -349,13 +357,13 @@ struct fb_info *fb_create(const char *id, int w, int h) info = calloc(1, sizeof(*info)); if (!info) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return NULL; } info->id = strdup(id); if (!info->id) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); free(info); return NULL; } @@ -414,7 +422,7 @@ int fb_is_created(struct fb_info *info) if (path && access(path, F_OK | R_OK) == 0) { return 1; } else { - ErrPrint("access: %s (%s)\n", strerror(errno), path); + ErrPrint("access: %d (%s)\n", errno, path); } } @@ -437,7 +445,7 @@ void *fb_acquire_buffer(struct fb_info *info) buffer = calloc(1, sizeof(*buffer) + info->bufsz); if (!buffer) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); set_last_result(WIDGET_ERROR_OUT_OF_MEMORY); info->bufsz = 0; return NULL; @@ -459,7 +467,7 @@ void *fb_acquire_buffer(struct fb_info *info) buffer = calloc(1, sizeof(*buffer) + info->bufsz); if (!buffer) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); info->bufsz = 0; set_last_result(WIDGET_ERROR_OUT_OF_MEMORY); return NULL; @@ -475,7 +483,7 @@ void *fb_acquire_buffer(struct fb_info *info) } else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) { buffer = shmat(info->handle, NULL, 0); if (buffer == (void *)-1) { - ErrPrint("shmat: %s (%d)\n", strerror(errno), info->handle); + ErrPrint("shmat: %d (%d)\n", errno, info->handle); set_last_result(WIDGET_ERROR_FAULT); return NULL; } @@ -527,7 +535,7 @@ int fb_release_buffer(void *data) switch (buffer->type) { case WIDGET_FB_TYPE_SHM: if (shmdt(buffer) < 0) { - ErrPrint("shmdt: %s\n", strerror(errno)); + ErrPrint("shmdt: %d\n", errno); } break; case WIDGET_FB_TYPE_PIXMAP: @@ -590,7 +598,7 @@ int fb_refcnt(void *data) switch (buffer->type) { case WIDGET_FB_TYPE_SHM: if (shmctl(buffer->refcnt, IPC_STAT, &buf) < 0) { - ErrPrint("Error: %s\n", strerror(errno)); + ErrPrint("Error: %d\n", errno); set_last_result(WIDGET_ERROR_FAULT); return WIDGET_ERROR_FAULT; } diff --git a/widget_viewer/src/fb_wayland.c b/widget_viewer/src/fb_wayland.c index a2ff423..d69d17c 100755 --- a/widget_viewer/src/fb_wayland.c +++ b/widget_viewer/src/fb_wayland.c @@ -80,8 +80,8 @@ static inline int sync_for_file(struct fb_info *info, int x, int y, int w, int h fd = open(util_uri_to_path(info->id), O_RDONLY); if (fd < 0) { - ErrPrint("Failed to open a file (%s) because of (%s)\n", - util_uri_to_path(info->id), strerror(errno)); + ErrPrint("Failed to open a file (%s) because of (%d)\n", + util_uri_to_path(info->id), errno); /*! * \note @@ -103,9 +103,9 @@ static inline int sync_for_file(struct fb_info *info, int x, int y, int w, int h width = w * info->pixels; if (lseek(fd, index * info->pixels, SEEK_SET) != index * info->pixels) { - ErrPrint("lseek: %s\n", strerror(errno)); + ErrPrint("lseek: %d\n", errno); if (close(fd) < 0) { - ErrPrint("close: %s\n", strerror(errno)); + ErrPrint("close: %d\n", errno); } /** * @note @@ -119,7 +119,7 @@ static inline int sync_for_file(struct fb_info *info, int x, int y, int w, int h if (read(fd, ((unsigned int *)buffer->data) + index, width) != width) { if (close(fd) < 0) { - ErrPrint("close: %s\n", strerror(errno)); + ErrPrint("close: %d\n", errno); } /** * @note @@ -133,9 +133,9 @@ static inline int sync_for_file(struct fb_info *info, int x, int y, int w, int h } } else { if (read(fd, buffer->data, info->bufsz) != info->bufsz) { - ErrPrint("read: %s\n", strerror(errno)); + ErrPrint("read: %d\n", errno); if (close(fd) < 0) { - ErrPrint("close: %s\n", strerror(errno)); + ErrPrint("close: %d\n", errno); } /*! @@ -150,7 +150,7 @@ static inline int sync_for_file(struct fb_info *info, int x, int y, int w, int h } if (close(fd) < 0) { - ErrPrint("close: %s\n", strerror(errno)); + ErrPrint("close: %d\n", errno); } return WIDGET_ERROR_NONE; } @@ -192,13 +192,13 @@ struct fb_info *fb_create(const char *id, int w, int h) info = calloc(1, sizeof(*info)); if (!info) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return NULL; } info->id = strdup(id); if (!info->id) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); free(info); return NULL; } @@ -260,7 +260,7 @@ int fb_is_created(struct fb_info *info) if (path && access(path, F_OK | R_OK) == 0) { return 1; } else { - ErrPrint("access: %s (%s)\n", strerror(errno), path); + ErrPrint("access: %d (%s)\n", errno, path); } } @@ -287,7 +287,7 @@ void *fb_acquire_buffer(struct fb_info *info) buffer = calloc(1, sizeof(*buffer) + info->bufsz); if (!buffer) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); info->bufsz = 0; set_last_result(WIDGET_ERROR_OUT_OF_MEMORY); return NULL; @@ -303,7 +303,7 @@ void *fb_acquire_buffer(struct fb_info *info) } else if (!strncasecmp(info->id, SCHEMA_SHM, strlen(SCHEMA_SHM))) { buffer = shmat(info->handle, NULL, 0); if (buffer == (void *)-1) { - ErrPrint("shmat: %s (%d)\n", strerror(errno), info->handle); + ErrPrint("shmat: %d (%d)\n", errno, info->handle); set_last_result(WIDGET_ERROR_FAULT); return NULL; } @@ -353,7 +353,7 @@ int fb_release_buffer(void *data) switch (buffer->type) { case WIDGET_BUFFER_TYPE_SHM: if (shmdt(buffer) < 0) { - ErrPrint("shmdt: %s\n", strerror(errno)); + ErrPrint("shmdt: %d\n", errno); } break; case WIDGET_BUFFER_TYPE_FILE: @@ -403,7 +403,7 @@ int fb_refcnt(void *data) switch (buffer->type) { case WIDGET_FB_TYPE_SHM: if (shmctl(buffer->refcnt, IPC_STAT, &buf) < 0) { - ErrPrint("Error: %s\n", strerror(errno)); + ErrPrint("Error: %d\n", errno); set_last_result(WIDGET_ERROR_FAULT); return WIDGET_ERROR_FAULT; } diff --git a/widget_viewer/src/file_service.c b/widget_viewer/src/file_service.c index 21b7239..36395c3 100755 --- a/widget_viewer/src/file_service.c +++ b/widget_viewer/src/file_service.c @@ -77,11 +77,11 @@ int status; \ status = close(p[PIPE_READ]); \ if (status < 0) { \ - ErrPrint("close: %s\n", strerror(errno)); \ + ErrPrint("close: %d\n", errno); \ } \ status = close(p[PIPE_WRITE]); \ if (status < 0) { \ - ErrPrint("close: %s\n", strerror(errno)); \ + ErrPrint("close: %d\n", errno); \ } \ } while (0) @@ -135,7 +135,7 @@ static inline int put_event_ch(int fd, char ch) ret = write(fd, &ch, sizeof(ch)); if (ret != sizeof(ch)) { - ErrPrint("write: %s\n", strerror(errno)); + ErrPrint("write: %d\n", errno); return ret; } @@ -149,7 +149,7 @@ static inline int get_event_ch(int fd) ret = read(fd, &ch, sizeof(ch)); if (ret != sizeof(ch)) { - ErrPrint("read: %s\n", strerror(errno)); + ErrPrint("read: %d\n", errno); return ret; } @@ -172,7 +172,7 @@ static inline int file_service_open(void) addr = malloc(strlen(client_addr()) + 1); if (!addr) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return -ENOMEM; } @@ -188,7 +188,7 @@ static inline int file_service_open(void) file_addr = malloc(len); if (!file_addr) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); free(addr); return -ENOMEM; } @@ -209,7 +209,7 @@ static void write_item_to_pipe(struct request_item *item, int ret) { item->ret = WIDGET_ERROR_FAULT; if (write(s_info.evt_pipe[PIPE_WRITE], &item, sizeof(item)) != sizeof(item)) { - ErrPrint("write: %s\n", strerror(errno)); + ErrPrint("write: %d\n", errno); free(item->filename); free(item->save_to); free(item); @@ -258,7 +258,7 @@ static void *file_service_main(void *data) ret = 0; continue; } - ErrPrint("Error: %s\n", strerror(errno)); + ErrPrint("Error: %d\n", errno); break; } else if (ret == 0) { ErrPrint("Timeout\n"); @@ -274,7 +274,7 @@ static void *file_service_main(void *data) head = malloc(recvsz); if (!head) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); ret = WIDGET_ERROR_OUT_OF_MEMORY; write_item_to_pipe(item, ret); item = NULL; @@ -307,7 +307,7 @@ static void *file_service_main(void *data) tmp = realloc(head, recvsz); if (!tmp) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); free(head); head = NULL; @@ -336,7 +336,7 @@ static void *file_service_main(void *data) file_fd = open(item->save_to, O_WRONLY|O_CREAT, 0644); if (file_fd < 0) { - ErrPrint("open: %s\n", strerror(errno)); + ErrPrint("open: %d\n", errno); free(head); head = NULL; recv_state = RECV_INIT; @@ -412,7 +412,7 @@ static void *file_service_main(void *data) tmp = realloc(body, recvsz); if (!tmp) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); free(head); head = NULL; @@ -429,7 +429,7 @@ static void *file_service_main(void *data) /* Flush this to the file */ ret = write(file_fd, body->data, body->size); if (ret < 0) { - ErrPrint("write: %s\n", strerror(errno)); + ErrPrint("write: %d\n", errno); free(head); head = NULL; @@ -450,7 +450,7 @@ static void *file_service_main(void *data) file_offset += ret; if (file_offset == head->size) { if (close(file_fd) < 0) { - ErrPrint("close: %s\n", strerror(errno)); + ErrPrint("close: %d\n", errno); } ret = WIDGET_ERROR_NONE; write_item_to_pipe(item, ret); @@ -528,7 +528,7 @@ static gboolean evt_cb(GIOChannel *src, GIOCondition cond, gpointer data) } if (read(fd, &item, sizeof(item)) != sizeof(item)) { - ErrPrint("read: %s\n", strerror(errno)); + ErrPrint("read: %d\n", errno); } else { if (item->result_cb) { item->result_cb(item->filename, item->save_to, item->ret, item->data); @@ -548,20 +548,20 @@ int file_service_send_request(const char *filename, const char *save_to, void (* item = malloc(sizeof(*item)); if (!item) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return -ENOMEM; } item->filename = strdup(filename); if (!item->filename) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); free(item); return -ENOMEM; } item->save_to = strdup(save_to); if (!item->save_to) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); free(item->filename); free(item); return -ENOMEM; @@ -592,14 +592,14 @@ int file_service_init(void) } if (pipe2(s_info.ctrl_pipe, O_NONBLOCK | O_CLOEXEC) < 0) { - ErrPrint("file service: %s\n", strerror(errno)); + ErrPrint("file service: %d\n", errno); file_service_close(s_info.file_service_fd); s_info.file_service_fd = -1; return -EFAULT; } if (pipe2(s_info.evt_pipe, O_NONBLOCK | O_CLOEXEC) < 0) { - ErrPrint("file service: %s\n", strerror(errno)); + ErrPrint("file service: %d\n", errno); CLOSE_PIPE(s_info.ctrl_pipe); file_service_close(s_info.file_service_fd); s_info.file_service_fd = -1; diff --git a/widget_viewer/src/util.c b/widget_viewer/src/util.c index 031717c..5e44bbb 100755 --- a/widget_viewer/src/util.c +++ b/widget_viewer/src/util.c @@ -63,13 +63,13 @@ double util_timestamp(void) return ts.tv_sec + ts.tv_nsec / 1000000000.0f; } - ErrPrint("%d: %s\n", s_info.type, strerror(errno)); + ErrPrint("%d: %d\n", s_info.type, errno); if (s_info.type == CLOCK_MONOTONIC) { s_info.type = CLOCK_REALTIME; } else if (s_info.type == CLOCK_REALTIME) { struct timeval tv; if (gettimeofday(&tv, NULL) < 0) { - ErrPrint("gettimeofday: %s\n", strerror(errno)); + ErrPrint("gettimeofday: %d\n", errno); break; } @@ -82,7 +82,7 @@ double util_timestamp(void) struct timeval tv; if (gettimeofday(&tv, NULL) < 0) { - ErrPrint("gettimeofday: %s\n", strerror(errno)); + ErrPrint("gettimeofday: %d\n", errno); tv.tv_sec = 0; tv.tv_usec = 0; } @@ -129,13 +129,13 @@ int util_unlink(const char *filename) desclen = strlen(filename) + 6; /* .desc */ descfile = malloc(desclen); if (!descfile) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } ret = snprintf(descfile, desclen, "%s.desc", filename); if (ret < 0) { - ErrPrint("Error: %s\n", strerror(errno)); + ErrPrint("Error: %d\n", errno); free(descfile); return WIDGET_ERROR_FAULT; } diff --git a/widget_viewer/src/widget.c b/widget_viewer/src/widget.c index 516bd43..70a8279 100755 --- a/widget_viewer/src/widget.c +++ b/widget_viewer/src/widget.c @@ -956,7 +956,7 @@ static int job_add(widget_h handle, widget_ret_cb job_cb, int ret, void *data) item = malloc(sizeof(*item)); if (!item) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -1354,7 +1354,7 @@ EAPI widget_h widget_viewer_add_widget(const char *pkgname, const char *content, handle = calloc(1, sizeof(*handle)); if (!handle) { - ErrPrint("Error: %s\n", strerror(errno)); + ErrPrint("Error: %d\n", errno); free(widgetid); set_last_result(WIDGET_ERROR_OUT_OF_MEMORY); return NULL; @@ -4219,7 +4219,7 @@ EAPI int widget_viewer_get_instance_id(widget_h handle, char **instance_id) *instance_id = strdup(handle->common->id); if (!*instance_id) { - ErrPrint("Out of memory: %s\n", strerror(errno)); + ErrPrint("Out of memory: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } diff --git a/widget_viewer/src/widget_internal.c b/widget_viewer/src/widget_internal.c index c41277e..e556e08 100755 --- a/widget_viewer/src/widget_internal.c +++ b/widget_viewer/src/widget_internal.c @@ -106,7 +106,7 @@ struct widget_common *_widget_create_common_handle(widget_h handle, const char * common = calloc(1, sizeof(*common)); if (!common) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); set_last_result(WIDGET_ERROR_OUT_OF_MEMORY); return NULL; } @@ -120,7 +120,7 @@ struct widget_common *_widget_create_common_handle(widget_h handle, const char * common->cluster = strdup(cluster); if (!common->cluster) { - ErrPrint("Error: %s\n", strerror(errno)); + ErrPrint("Error: %d\n", errno); free(common->pkgname); free(common); set_last_result(WIDGET_ERROR_OUT_OF_MEMORY); @@ -129,7 +129,7 @@ struct widget_common *_widget_create_common_handle(widget_h handle, const char * common->category = strdup(category); if (!common->category) { - ErrPrint("Error: %s\n", strerror(errno)); + ErrPrint("Error: %d\n", errno); free(common->cluster); free(common->pkgname); free(common); @@ -221,7 +221,7 @@ int _widget_set_group(struct widget_common *common, const char *cluster, const c if (cluster) { pc = strdup(cluster); if (!pc) { - ErrPrint("Heap: %s (cluster: %s)\n", strerror(errno), cluster); + ErrPrint("Heap: %d (cluster: %s)\n", errno, cluster); return WIDGET_ERROR_OUT_OF_MEMORY; } } @@ -229,7 +229,7 @@ int _widget_set_group(struct widget_common *common, const char *cluster, const c if (category) { ps = strdup(category); if (!ps) { - ErrPrint("Heap: %s (category: %s)\n", strerror(errno), category); + ErrPrint("Heap: %d (category: %s)\n", errno, category); free(pc); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -378,7 +378,7 @@ widget_h _widget_new_widget(const char *pkgname, const char *id, double timestam handler->common = _widget_create_common_handle(handler, pkgname, cluster, category); if (!handler->common) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); free(handler); return NULL; } @@ -416,7 +416,7 @@ int _widget_set_content(struct widget_common *common, const char *content) if (content) { pc = strdup(content); if (!pc) { - ErrPrint("heap: %s [%s]\n", strerror(errno), content); + ErrPrint("heap: %d [%s]\n", errno, content); return WIDGET_ERROR_OUT_OF_MEMORY; } } @@ -433,7 +433,7 @@ int _widget_set_title(struct widget_common *common, const char *title) if (title) { pt = strdup(title); if (!pt) { - ErrPrint("heap: %s [%s]\n", strerror(errno), title); + ErrPrint("heap: %d [%s]\n", errno, title); return WIDGET_ERROR_OUT_OF_MEMORY; } } @@ -458,7 +458,7 @@ void _widget_set_auto_launch(struct widget_common *common, const char *auto_laun pa = strdup(auto_launch); if (!pa) { - ErrPrint("heap: %s, [%s]\n", strerror(errno), auto_launch); + ErrPrint("heap: %d, [%s]\n", errno, auto_launch); return; } @@ -478,7 +478,7 @@ void _widget_set_id(struct widget_common *common, const char *id) if (id) { pi = strdup(id); if (!pi) { - ErrPrint("heap: %s [%s]\n", strerror(errno), pi); + ErrPrint("heap: %d [%s]\n", errno, pi); return; } } @@ -491,7 +491,7 @@ void _widget_unlink_filename(struct widget_common *common) { if (common->widget.type == WIDGET_TYPE_FILE || common->widget.type == WIDGET_TYPE_TEXT) { if (common->filename && common->filename[0] && unlink(common->filename) < 0) { - ErrPrint("unlink: %s (%s)\n", strerror(errno), common->filename); + ErrPrint("unlink: %d (%s)\n", errno, common->filename); } } } @@ -504,7 +504,7 @@ void _widget_set_filename(struct widget_common *common, const char *filename) common->filename = strdup(filename); if (!common->filename) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); } } @@ -515,7 +515,7 @@ void _widget_set_alt_icon(struct widget_common *common, const char *icon) if (icon && strlen(icon)) { _icon = strdup(icon); if (!_icon) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); } } @@ -530,7 +530,7 @@ void _widget_set_alt_name(struct widget_common *common, const char *name) if (name && strlen(name)) { _name = strdup(name); if (!_name) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); } } @@ -959,7 +959,7 @@ int _widget_add_event_handler(widget_event_handler_cb widget_cb, void *data) struct event_info *info; info = malloc(sizeof(*info)); if (!info) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -1001,7 +1001,7 @@ int _widget_add_fault_handler(widget_fault_handler_cb widget_cb, void *data) struct fault_info *info; info = malloc(sizeof(*info)); if (!info) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -1044,7 +1044,7 @@ struct cb_info *_widget_create_cb_info(widget_ret_cb cb, void *data) info = malloc(sizeof(*info)); if (!info) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return NULL; } diff --git a/widget_viewer_evas/src/widget_viewer_evas.c b/widget_viewer_evas/src/widget_viewer_evas.c old mode 100644 new mode 100755 index c073d79..03e18c1 --- a/widget_viewer_evas/src/widget_viewer_evas.c +++ b/widget_viewer_evas/src/widget_viewer_evas.c @@ -538,14 +538,14 @@ static int append_script_object(struct widget_data *data, int gbar, const char * so = malloc(sizeof(*so)); if (!so) { - ErrPrint("malloc: %s\n", strerror(errno)); + ErrPrint("malloc: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } if (id) { so->id = strdup(id); if (!so->id) { - ErrPrint("strdup: %s\n", strerror(errno)); + ErrPrint("strdup: %d\n", errno); free(so); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -819,7 +819,7 @@ static void effect_resize(Evas_Object *obj, int w, int h, unsigned int effect_ma data = malloc(sizeof(*data)); if (!data) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return; } @@ -1465,7 +1465,7 @@ static void parse_size(struct image_option *img_opt, const char *value, int len) buf = strndup(value, len); if (!buf) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return; } @@ -2015,7 +2015,7 @@ static int do_text_update_script(struct widget_data *data, int gbar, Evas_Object } if (!file || !strlen(file) || access(file, R_OK) != 0) { - ErrPrint("path: %s (%s), Delete old object\n", file, strerror(errno)); + ErrPrint("path: %s (%d), Delete old object\n", file, errno); return WIDGET_ERROR_NONE; } @@ -2370,7 +2370,7 @@ static void gbar_create_text_object(struct widget_data *data) } if (access(script_file, R_OK) != 0) { - ErrPrint("Unable to access [%s] - %s\n", script_file, strerror(errno)); + ErrPrint("Unable to access [%s] - %d\n", script_file, errno); evas_object_del(gbar_content); return; } @@ -2449,7 +2449,9 @@ static void __widget_create_gbar_cb(struct widget *handle, int ret, void *cbdata * Evas Object is deleted. * Do not proceed this process anymore and destroy GBAR too */ - widget_viewer_destroy_glance_bar(data->handle, NULL, NULL); + if (widget_viewer_destroy_glance_bar(data->handle, NULL, NULL) != WIDGET_ERROR_NONE) { + DbgPrint("widget_viewer_destroy_glance_bar failed\n"); + } return; } @@ -2545,11 +2547,13 @@ static void __widget_create_gbar_cb(struct widget *handle, int ret, void *cbdata * and it is called when calling the widget_destroy_glance_bar function (via the last param) * So this function call will not release the data. */ - widget_unref(data); + data = widget_unref(data); } ErrPrint("Failed to create a GBAR, unknown type\n"); - smart_callback_call(data, WIDGET_SMART_SIGNAL_GBAR_ABORTED, &info); - widget_unref(data); + if (data) { + smart_callback_call(data, WIDGET_SMART_SIGNAL_GBAR_ABORTED, &info); + data = widget_unref(data); + } return; } @@ -2739,20 +2743,21 @@ static void __widget_up_cb(void *cbdata, Evas *e, Evas_Object *obj, void *event_ ret = WIDGET_ERROR_INVALID_PARAMETER; if (data->is.field.gbar_created) { ret = widget_viewer_destroy_glance_bar(data->handle, __widget_destroy_gbar_cb, widget_ref(data)); - if (ret < 0) { - widget_unref(data); - } + if (ret < 0) + data = widget_unref(data); } else if (data->is.field.cancel_click == CANCEL_DISABLED) { ret = widget_viewer_send_click_event(data->handle, minfo.x, minfo.y); } } - DbgPrint("Up: %lfx%lf [x:%d/%d/%d] [y:%d/%d/%d], ret: 0x%X, cancel: 0x%x\n", - minfo.x, minfo.y, - data->is.field.scroll_x, s_info.conf.field.is_scroll_x, data->is.field.cancel_scroll_x, - data->is.field.scroll_y, s_info.conf.field.is_scroll_y, data->is.field.cancel_scroll_y, - ret, data->is.field.cancel_click); - data->is.field.cancel_click = CANCEL_DISABLED; + if (data) { + DbgPrint("Up: %lfx%lf [x:%d/%d/%d] [y:%d/%d/%d], ret: 0x%X, cancel: 0x%x\n", + minfo.x, minfo.y, + data->is.field.scroll_x, s_info.conf.field.is_scroll_x, data->is.field.cancel_scroll_x, + data->is.field.scroll_y, s_info.conf.field.is_scroll_y, data->is.field.cancel_scroll_y, + ret, data->is.field.cancel_click); + data->is.field.cancel_click = CANCEL_DISABLED; + } } } @@ -2858,7 +2863,7 @@ static char *get_package_icon(struct widget_data *data) icon = strdup(WIDGET_VIEWER_EVAS_UNKNOWN); if (!icon) { - ErrPrint("strdup: %s\n", strerror(errno)); + ErrPrint("strdup: %d\n", errno); } return icon; @@ -2966,8 +2971,8 @@ static void __widget_overlay_clicked_cb(void *cbdata, Evas_Object *obj, const ch } else { DbgPrint("Activate: [%s]\n", data->widget_id); if (widget_viewer_activate_faulted_widget(data->widget_id, activate_ret_cb, widget_ref(data)) < 0) { - widget_unref(data); ErrPrint("Failed to activate %s\n", data->widget_id); + widget_unref(data); } } } @@ -3175,7 +3180,7 @@ static void __widget_add(Evas_Object *widget) data = calloc(1, sizeof(*data)); if (!data) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return; } @@ -3307,7 +3312,7 @@ static void __widget_destroy_widget_cb(widget_h handle, int ret, void *_data) static void __widget_del(Evas_Object *widget) { - struct widget_data *data; + struct widget_data *data = NULL; data = evas_object_smart_data_get(widget); if (!data) { @@ -3350,6 +3355,7 @@ static void __widget_del(Evas_Object *widget) if (data->is.field.created) { if (widget_viewer_delete_widget(data->handle, delete_type, __widget_destroy_widget_cb, widget_ref(data)) < 0) { widget_unref(data); + data = NULL; } } else { DbgPrint("Not created yet. this will be canceld by created callback, ignore delete callback\n"); @@ -3367,8 +3373,10 @@ static void __widget_del(Evas_Object *widget) /** * From now, the widget object is not valid */ - data->widget = NULL; - widget_unref(data); + if (data) { + data->widget = NULL; + widget_unref(data); + } } static Eina_Bool delayed_pause_resume_timer_cb(void *_data) @@ -4025,7 +4033,7 @@ static int widget_create_text_object(struct widget_data *data) } if (access(script_file, R_OK) != 0) { - ErrPrint("Unable to access [%s] - %s\n", script_file, strerror(errno)); + ErrPrint("Unable to access [%s] - %d\n", script_file, errno); evas_object_del(widget_viewer_get_content_string); return WIDGET_ERROR_FAULT; } @@ -4209,7 +4217,7 @@ static void __widget_update_pixmap_object(struct widget_data *data, Evas_Object acquire_data = malloc(sizeof(*acquire_data)); if (!acquire_data) { - ErrPrint("malloc: %s\n", strerror(errno)); + ErrPrint("malloc: %d\n", errno); return; } @@ -5087,7 +5095,7 @@ static void __widget_event_extra_info_updated(struct widget_data *data) } else { tmp = strdup(content_info); if (!tmp) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return; } @@ -5097,7 +5105,7 @@ static void __widget_event_extra_info_updated(struct widget_data *data) } else if (content_info) { tmp = strdup(content_info); if (!tmp) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return; } data->content = tmp; @@ -5351,7 +5359,7 @@ static void gbar_update_pixmap_object(struct widget_data *data, Evas_Object *gba acquire_data = malloc(sizeof(*acquire_data)); if (!acquire_data) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return; } @@ -5660,6 +5668,7 @@ static inline int handle_subscribed_group(struct widget *handle) if (!strcasecmp(group->cluster, cluster) && !strcasecmp(group->sub_cluster, sub_cluster)) { int nr; Evas_Object *widget; + struct widget_data *temp_widget_data = NULL; DbgPrint("Subscribed Group: (%s)(%s)\n", cluster, sub_cluster); @@ -5675,7 +5684,14 @@ static inline int handle_subscribed_group(struct widget *handle) /* Emit RAW_CREATE event */ nr = invoke_raw_event_callback(WIDGET_VIEWER_EVAS_RAW_CREATE, widget_viewer_get_pkgname(handle), widget, WIDGET_ERROR_NONE); - if (nr <= 0 || widget_system_created(handle, get_smart_data(widget)) != WIDGET_ERROR_NONE) { + + if ( (temp_widget_data = get_smart_data(widget)) == NULL) { + ErrPrint("Failed to get widget data\n"); + (void)widget_viewer_delete_widget(handle, WIDGET_DELETE_PERMANENTLY, NULL, NULL); + return WIDGET_ERROR_FAULT; + } + + if (nr <= 0 || widget_system_created(handle, temp_widget_data) != WIDGET_ERROR_NONE) { /* * Deleting evas object will invoke delete callback. * Then it will invoke the RAW_DELETE event and execute the proper procedures for deleting object @@ -5788,7 +5804,7 @@ static int widget_event_handler(struct widget *handle, enum widget_event_type ev if (!data->widget_extra) { data->widget_extra = calloc(widget_viewer_get_option(WIDGET_OPTION_EXTRA_BUFFER_CNT), sizeof(*data->widget_extra)); if (!data->widget_extra) { - ErrPrint("calloc: %s\n", strerror(errno)); + ErrPrint("calloc: %d\n", errno); } } @@ -5826,7 +5842,7 @@ static int widget_event_handler(struct widget *handle, enum widget_event_type ev if (!data->gbar_extra) { data->gbar_extra = calloc(widget_viewer_get_option(WIDGET_OPTION_EXTRA_BUFFER_CNT), sizeof(*data->gbar_extra)); if (!data->gbar_extra) { - ErrPrint("calloc: %s\n", strerror(errno)); + ErrPrint("calloc: %d\n", errno); break; } } @@ -6085,20 +6101,20 @@ EAPI Evas_Object *widget_viewer_evas_add_widget(Evas_Object *parent, const char _cluster = strdup(cluster); if (!_cluster) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return NULL; } _category = strdup(category); if (!_category) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); free(_cluster); return NULL; } _widget_id = strdup(widget_id); if (!_widget_id) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); free(_category); free(_cluster); return NULL; @@ -6107,7 +6123,7 @@ EAPI Evas_Object *widget_viewer_evas_add_widget(Evas_Object *parent, const char if (content_info) { _content_info = strdup(content_info); if (!_content_info) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); free(_widget_id); free(_category); free(_cluster); @@ -6446,7 +6462,7 @@ EAPI int widget_viewer_evas_feed_access_event(Evas_Object *widget, int type, voi case ELM_ACCESS_ACTION_READ: cb_data = calloc(1, sizeof(*cb_data)); if (!cb_data) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -6463,7 +6479,7 @@ EAPI int widget_viewer_evas_feed_access_event(Evas_Object *widget, int type, voi case ELM_ACCESS_ACTION_UNHIGHLIGHT: /* unhighlight an object */ cb_data = calloc(1, sizeof(*cb_data)); if (!cb_data) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -6480,7 +6496,7 @@ EAPI int widget_viewer_evas_feed_access_event(Evas_Object *widget, int type, voi case ELM_ACCESS_ACTION_HIGHLIGHT_NEXT: /* set highlight to next object */ cb_data = calloc(1, sizeof(*cb_data)); if (!cb_data) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -6497,7 +6513,7 @@ EAPI int widget_viewer_evas_feed_access_event(Evas_Object *widget, int type, voi case ELM_ACCESS_ACTION_HIGHLIGHT_PREV: /* set highlight to previous object */ cb_data = calloc(1, sizeof(*cb_data)); if (!cb_data) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -6514,7 +6530,7 @@ EAPI int widget_viewer_evas_feed_access_event(Evas_Object *widget, int type, voi case ELM_ACCESS_ACTION_ACTIVATE: /* activate a highlight object */ cb_data = calloc(1, sizeof(*cb_data)); if (!cb_data) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -6531,7 +6547,7 @@ EAPI int widget_viewer_evas_feed_access_event(Evas_Object *widget, int type, voi case ELM_ACCESS_ACTION_SCROLL: /* scroll if one of highlight object parents * is scrollable */ cb_data = calloc(1, sizeof(*cb_data)); if (!cb_data) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -6570,7 +6586,7 @@ EAPI int widget_viewer_evas_feed_access_event(Evas_Object *widget, int type, voi case ELM_ACCESS_ACTION_MOUSE: /* give mouse event to highlight object */ cb_data = calloc(1, sizeof(*cb_data)); if (!cb_data) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -6586,7 +6602,7 @@ EAPI int widget_viewer_evas_feed_access_event(Evas_Object *widget, int type, voi case ELM_ACCESS_ACTION_UP: /* change value up of highlight object */ cb_data = calloc(1, sizeof(*cb_data)); if (!cb_data) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -6602,7 +6618,7 @@ EAPI int widget_viewer_evas_feed_access_event(Evas_Object *widget, int type, voi case ELM_ACCESS_ACTION_DOWN: /* change value down of highlight object */ cb_data = calloc(1, sizeof(*cb_data)); if (!cb_data) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -6619,7 +6635,7 @@ EAPI int widget_viewer_evas_feed_access_event(Evas_Object *widget, int type, voi case ELM_ACCESS_ACTION_VALUE_CHANGE: /* TODO: deprecate this */ cb_data = calloc(1, sizeof(*cb_data)); if (!cb_data) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -6636,7 +6652,7 @@ EAPI int widget_viewer_evas_feed_access_event(Evas_Object *widget, int type, voi case ELM_ACCESS_ACTION_BACK: /* go back to a previous view ex: pop naviframe item */ cb_data = calloc(1, sizeof(*cb_data)); if (!cb_data) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -6653,7 +6669,7 @@ EAPI int widget_viewer_evas_feed_access_event(Evas_Object *widget, int type, voi case ELM_ACCESS_ACTION_OVER: /* mouse over an object */ cb_data = calloc(1, sizeof(*cb_data)); if (!cb_data) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -6670,7 +6686,7 @@ EAPI int widget_viewer_evas_feed_access_event(Evas_Object *widget, int type, voi case ELM_ACCESS_ACTION_ENABLE: /* enable highlight and read ability */ cb_data = calloc(1, sizeof(*cb_data)); if (!cb_data) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -6687,7 +6703,7 @@ EAPI int widget_viewer_evas_feed_access_event(Evas_Object *widget, int type, voi case ELM_ACCESS_ACTION_DISABLE: /* disable highlight and read ability */ cb_data = calloc(1, sizeof(*cb_data)); if (!cb_data) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -6784,7 +6800,7 @@ EAPI int widget_viewer_evas_set_raw_event_callback(widget_evas_raw_event_type_e cbdata = calloc(1, sizeof(*cbdata)); if (!cbdata) { - ErrPrint("calloc: %s\n", strerror(errno)); + ErrPrint("calloc: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -6954,20 +6970,20 @@ EAPI int widget_viewer_evas_subscribe_group(const char *cluster, const char *sub group = calloc(1, sizeof(*group)); if (!group) { - ErrPrint("calloc: %s\n", strerror(errno)); + ErrPrint("calloc: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } group->cluster = strdup(cluster); if (!group->cluster) { - ErrPrint("strdup: %s\n", strerror(errno)); + ErrPrint("strdup: %d\n", errno); free(group); return WIDGET_ERROR_OUT_OF_MEMORY; } group->sub_cluster = strdup(sub_cluster); if (!group->sub_cluster) { - ErrPrint("strdup: %s\n", strerror(errno)); + ErrPrint("strdup: %d\n", errno); free(group->cluster); free(group); return WIDGET_ERROR_OUT_OF_MEMORY; @@ -7020,20 +7036,20 @@ EAPI int widget_viewer_evas_subscribe_category(const char *category) } EINA_LIST_FOREACH(s_info.subscribed_category_list, l, item) { - if (!strcmp(item->category, item->category)) { + if (!strcmp(category, item->category)) { return WIDGET_ERROR_ALREADY_EXIST; } } item = calloc(1, sizeof(*item)); if (!item) { - ErrPrint("calloc: %s\n", strerror(errno)); + ErrPrint("calloc: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } item->category = strdup(category); if (!item->category) { - ErrPrint("strdup: %s\n", strerror(errno)); + ErrPrint("strdup: %d\n", errno); free(item); return WIDGET_ERROR_OUT_OF_MEMORY; } -- 2.7.4