From 141521c17442de9c44330d5008d053047cebc5a9 Mon Sep 17 00:00:00 2001 From: Kyuho Jo Date: Mon, 20 Apr 2015 22:19:13 +0900 Subject: [PATCH] Fix PREVENT issues Change-Id: I51d9bb197693921957facfea885a40114a596aa5 Signed-off-by: Kyuho Jo --- src/snapshot_window.c | 4 ++-- src/virtual_window.c | 21 +++++++++++-------- src/virtual_window_wayland.c | 4 ++-- src/widget.c | 48 ++++++++++++++++++++++---------------------- 4 files changed, 41 insertions(+), 36 deletions(-) diff --git a/src/snapshot_window.c b/src/snapshot_window.c index 648d382..3e4a1db 100644 --- a/src/snapshot_window.c +++ b/src/snapshot_window.c @@ -401,13 +401,13 @@ PUBLIC void *widget_snapshot_window_add(const char *id, int size_type) info = malloc(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; } diff --git a/src/virtual_window.c b/src/virtual_window.c index 37a7280..6b6e352 100644 --- a/src/virtual_window.c +++ b/src/virtual_window.c @@ -119,7 +119,7 @@ static int event_handler_cb(widget_buffer_h handler, struct widget_buffer_event_ struct timeval tv; if (gettimeofday(&tv, NULL) < 0) { - ErrPrint("gettimeofday: %s\n", strerror(errno)); + ErrPrint("gettimeofday: %d\n", errno); } else { timestamp = (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f; timestamp -= event_info->timestamp; @@ -594,7 +594,7 @@ static Ecore_X_Pixmap alloc_pixmap_cb(void *data, Ecore_X_Window parent, int w, if (!info->resource_array) { info->resource_array = calloc(WIDGET_CONF_EXTRA_BUFFER_COUNT, sizeof(*info->resource_array)); if (!info->resource_array) { - ErrPrint("Out of memory: %s\n", strerror(errno)); + ErrPrint("Out of memory: %d\n", errno); return 0u; } @@ -866,11 +866,16 @@ static void post_render_cb(void *data, Evas *e, void *event_info) static void pre_destroy_cb(const char *id, void *data) { vwin_info_t info = data; + char *path = NULL; - if (id && strcmp(info->id, widget_util_uri_to_path(id))) { - /* Skip */ - DbgPrint("SKIP: Pre destroy event callback is called [%s], %s\n", id, info->id); - return; + if (id) { + path = widget_util_uri_to_path(id); + + if (path && strcmp(info->id, path)) { + /* Skip */ + DbgPrint("SKIP: Pre destroy event callback is called [%s], %s\n", id, info->id); + return; + } } DbgPrint("Pre destroy event callback is called [%s]\n", id); @@ -947,13 +952,13 @@ PUBLIC Evas *widget_get_evas(const char *id) 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; } diff --git a/src/virtual_window_wayland.c b/src/virtual_window_wayland.c index 4ae8122..1fab6d3 100644 --- a/src/virtual_window_wayland.c +++ b/src/virtual_window_wayland.c @@ -787,13 +787,13 @@ PUBLIC Evas *widget_get_evas(const char *id) 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; } diff --git a/src/widget.c b/src/widget.c index 9948de9..232232b 100644 --- a/src/widget.c +++ b/src/widget.c @@ -311,7 +311,7 @@ PUBLIC struct widget_desc *widget_desc_open(const char *filename, int for_pd) handle = calloc(1, sizeof(*handle)); if (!handle) { - ErrPrint("Error: %s\n", strerror(errno)); + ErrPrint("Error: %d\n", errno); return NULL; } @@ -320,7 +320,7 @@ PUBLIC struct widget_desc *widget_desc_open(const char *filename, int for_pd) len = strlen(filename) + strlen(".desc") + 1; new_fname = malloc(len); if (!new_fname) { - ErrPrint("Error: %s\n", strerror(errno)); + ErrPrint("Error: %d\n", errno); free(handle); return NULL; } @@ -328,7 +328,7 @@ PUBLIC struct widget_desc *widget_desc_open(const char *filename, int for_pd) } else { new_fname = strdup(filename); if (!new_fname) { - ErrPrint("Error: %s\n", strerror(errno)); + ErrPrint("Error: %d\n", errno); free(handle); return NULL; } @@ -341,7 +341,7 @@ PUBLIC struct widget_desc *widget_desc_open(const char *filename, int for_pd) handle->fp = fopen(new_fname, "at"); free(new_fname); if (!handle->fp) { - ErrPrint("Failed to open a file: %s\n", strerror(errno)); + ErrPrint("Failed to open a file: %d\n", errno); free(handle); return NULL; } @@ -398,7 +398,7 @@ PUBLIC int widget_desc_close(struct widget_desc *handle) } if (fclose(handle->fp) != 0) { - ErrPrint("fclose: %s\n", strerror(errno)); + ErrPrint("fclose: %d\n", errno); } free(handle); return WIDGET_ERROR_NONE; @@ -527,7 +527,7 @@ PUBLIC int widget_desc_set_id(struct widget_desc *handle, int idx, const char *i block->target_id = strdup(id); if (!block->target_id) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -559,20 +559,20 @@ PUBLIC int widget_desc_add_block(struct widget_desc *handle, const char *id, con block = calloc(1, sizeof(*block)); if (!block) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } block->type = strdup(type); if (!block->type) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); free(block); return WIDGET_ERROR_OUT_OF_MEMORY; } block->part = strdup(part); if (!block->part) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); free(block->type); free(block); return WIDGET_ERROR_OUT_OF_MEMORY; @@ -580,7 +580,7 @@ PUBLIC int widget_desc_add_block(struct widget_desc *handle, const char *id, con block->data = strdup(data); if (!block->data) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); free(block->type); free(block->part); free(block); @@ -590,7 +590,7 @@ PUBLIC int widget_desc_add_block(struct widget_desc *handle, const char *id, con if (option) { block->option = strdup(option); if (!block->option) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); free(block->data); free(block->type); free(block->part); @@ -602,7 +602,7 @@ PUBLIC int widget_desc_add_block(struct widget_desc *handle, const char *id, con if (id) { block->id = strdup(id); if (!block->id) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); free(block->option); free(block->data); free(block->type); @@ -686,7 +686,7 @@ PUBLIC widget_buffer_h widget_create_buffer(const char *filename, int is_gbar, i user_data = calloc(1, sizeof(*user_data)); if (!user_data) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return NULL; } @@ -696,7 +696,7 @@ PUBLIC widget_buffer_h widget_create_buffer(const char *filename, int is_gbar, i uri = id_to_uri(filename); if (!uri) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); free(user_data); return NULL; } @@ -742,7 +742,7 @@ PUBLIC int widget_request_update(const char *filename) uri = id_to_uri(filename); if (!uri) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -1222,13 +1222,13 @@ PUBLIC int widget_request_close_glance_bar(const char *pkgname, const char *id, if (strncmp(id, FILE_SCHEMA, schema_len)) { uri = id_to_uri(id); if (!uri) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } } else { uri = strdup(id); if (!uri) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } } @@ -1249,7 +1249,7 @@ PUBLIC int widget_freeze_scroller(const char *pkgname, const char *id) uri = id_to_uri(id); if (!uri) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -1269,7 +1269,7 @@ PUBLIC int widget_thaw_scroller(const char *pkgname, const char *id) uri = id_to_uri(id); if (!uri) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -1286,7 +1286,7 @@ PUBLIC int widget_set_extra_info(const char *id, const char *content, const char uri = id_to_uri(id); if (!uri) { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); return WIDGET_ERROR_OUT_OF_MEMORY; } @@ -1328,7 +1328,7 @@ PUBLIC int widget_set_extra_info(const char *id, const char *content, const char user_data->content = _content; } else { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); } } @@ -1343,7 +1343,7 @@ PUBLIC int widget_set_extra_info(const char *id, const char *content, const char user_data->title = _title; } else { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); } } @@ -1358,7 +1358,7 @@ PUBLIC int widget_set_extra_info(const char *id, const char *content, const char user_data->icon = _icon; } else { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); } } @@ -1373,7 +1373,7 @@ PUBLIC int widget_set_extra_info(const char *id, const char *content, const char user_data->name = _name; } else { - ErrPrint("Heap: %s\n", strerror(errno)); + ErrPrint("Heap: %d\n", errno); } } -- 2.7.4