struct dlist *n;
struct block *block;
- if (!handle)
+ if (!handle) {
return LB_STATUS_ERROR_INVALID;
+ }
dlist_foreach_safe(handle->block_list, l, n, block) {
handle->block_list = dlist_remove(handle->block_list, l);
fprintf(handle->fp, "{\n");
- if (block->type)
+ if (block->type) {
fprintf(handle->fp, "type=%s\n", block->type);
+ }
- if (block->part)
+ if (block->part) {
fprintf(handle->fp, "part=%s\n", block->part);
+ }
- if (block->data)
+ if (block->data) {
fprintf(handle->fp, "data=%s\n", block->data);
+ }
- if (block->option)
+ if (block->option) {
fprintf(handle->fp, "option=%s\n", block->option);
+ }
- if (block->id)
+ if (block->id) {
fprintf(handle->fp, "id=%s\n", block->id);
+ }
- if (block->target_id)
+ if (block->target_id) {
fprintf(handle->fp, "target=%s\n", block->target_id);
+ }
fprintf(handle->fp, "}\n");
free(block->type);
free(block);
}
- fclose(handle->fp);
+ if (fclose(handle->fp) != 0) {
+ ErrPrint("fclose: %s\n", strerror(errno));
+ }
free(handle);
return LB_STATUS_SUCCESS;
}
{
struct block *block;
- if (!handle || !category)
+ if (!handle || !category) {
return LB_STATUS_ERROR_INVALID;
+ }
block = calloc(1, sizeof(*block));
- if (!block)
+ if (!block) {
return LB_STATUS_ERROR_MEMORY;
+ }
block->type = strdup(LB_DESC_TYPE_INFO);
if (!block->type) {
struct block *block;
char buffer[BUFSIZ];
- if (!handle)
+ if (!handle) {
return LB_STATUS_ERROR_INVALID;
+ }
block = calloc(1, sizeof(*block));
- if (!block)
+ if (!block) {
return LB_STATUS_ERROR_MEMORY;
+ }
block->type = strdup(LB_DESC_TYPE_INFO);
if (!block->type) {
char *ret;
char *ptr;
- if (!str)
+ if (!str) {
return NULL;
+ }
len = strlen(str);
- if (!len)
+ if (!len) {
return NULL;
+ }
ret = malloc(len + 1);
- if (!ret)
+ if (!ret) {
return NULL;
+ }
ptr = ret;
i = 0;
free(block->target_id);
block->target_id = NULL;
- if (!id || !strlen(id))
+ if (!id || !strlen(id)) {
return LB_STATUS_SUCCESS;
+ }
block->target_id = strdup(id);
if (!block->target_id) {
{
struct block *block;
- if (!handle || !type)
+ if (!handle || !type) {
return LB_STATUS_ERROR_INVALID;
+ }
- if (!part)
+ if (!part) {
part = "";
+ }
- if (!data)
+ if (!data) {
data = "";
+ }
block = calloc(1, sizeof(*block));
if (!block) {
case BUFFER_EVENT_SCROLL_DOWN:
case BUFFER_EVENT_UNHIGHLIGHT:
DbgPrint("Accessibility event: %d\n", event);
- if (ret < 0)
+ if (ret < 0) {
(void)provider_send_access_status(pkgname, id, LB_ACCESS_STATUS_ERROR);
- else
+ } else {
(void)provider_send_access_status(pkgname, id, ret);
+ }
break;
default:
break;
{
struct livebox_buffer_data *user_data;
- if (!handle)
+ if (!handle) {
return LB_STATUS_ERROR_INVALID;
+ }
user_data = provider_buffer_user_data(handle);
if (user_data) {
int w, h, size;
int ret;
- if (!handle)
+ if (!handle) {
return NULL;
+ }
user_data = provider_buffer_user_data(handle);
- if (!user_data)
+ if (!user_data) {
return NULL;
+ }
if (user_data->accelerated) {
DbgPrint("H/W accelerated buffer is allocated\n");
PUBLIC int livebox_unref_buffer(void *buffer)
{
- if (!buffer)
+ if (!buffer) {
return LB_STATUS_ERROR_INVALID;
+ }
DbgPrint("Unref buffer\n");
return provider_buffer_unref(buffer);
const char *pkgname;
const char *id;
- if (!handle)
+ if (!handle) {
return LB_STATUS_ERROR_INVALID;
+ }
user_data = provider_buffer_user_data(handle);
if (!user_data) {
provider_buffer_sync(handle);
if (user_data->is_pd) {
- if (provider_send_desc_updated(pkgname, id, NULL) < 0)
+ if (provider_send_desc_updated(pkgname, id, NULL) < 0) {
ErrPrint("Failed to send PD updated (%s)\n", id);
+ }
} else {
int w;
int h;
int pixel_size;
- if (provider_buffer_get_size(handle, &w, &h, &pixel_size) < 0)
+ if (provider_buffer_get_size(handle, &w, &h, &pixel_size) < 0) {
ErrPrint("Failed to get size (%s)\n", id);
+ }
- if (provider_send_updated(pkgname, id, w, h, -1.0f, NULL, NULL) < 0)
+ if (provider_send_updated(pkgname, id, w, h, -1.0f, NULL, NULL) < 0) {
ErrPrint("Failed to send updated (%s)\n", id);
+ }
}
return LB_STATUS_SUCCESS;
PUBLIC int livebox_support_hw_buffer(struct livebox_buffer *handle)
{
- if (!handle)
+ if (!handle) {
return LB_STATUS_ERROR_INVALID;
+ }
return provider_buffer_pixmap_is_support_hw(handle);
}
struct livebox_buffer_data *user_data;
int ret;
- if (!handle)
+ if (!handle) {
return LB_STATUS_ERROR_INVALID;
+ }
user_data = provider_buffer_user_data(handle);
- if (!user_data)
+ if (!user_data) {
return LB_STATUS_ERROR_INVALID;
+ }
- if (user_data->accelerated)
+ if (user_data->accelerated) {
return -EALREADY;
+ }
ret = provider_buffer_pixmap_create_hw(handle);
user_data->accelerated = (ret == 0);
PUBLIC int livebox_destroy_hw_buffer(struct livebox_buffer *handle)
{
struct livebox_buffer_data *user_data;
- if (!handle)
+ if (!handle) {
return LB_STATUS_ERROR_INVALID;
+ }
user_data = provider_buffer_user_data(handle);
- if (!user_data || !user_data->accelerated)
+ if (!user_data || !user_data->accelerated) {
return LB_STATUS_ERROR_INVALID;
+ }
user_data->accelerated = 0;
{
struct livebox_buffer_data *user_data;
- if (!handle)
+ if (!handle) {
return NULL;
+ }
user_data = provider_buffer_user_data(handle);
- if (!user_data || !user_data->accelerated)
+ if (!user_data || !user_data->accelerated) {
return NULL;
+ }
return provider_buffer_pixmap_hw_addr(handle);
}
{
struct livebox_buffer_data *user_data;
- if (!handle)
+ if (!handle) {
return LB_STATUS_ERROR_INVALID;
+ }
user_data = provider_buffer_user_data(handle);
- if (!user_data)
+ if (!user_data) {
return LB_STATUS_ERROR_INVALID;
+ }
- if (!user_data->accelerated)
+ if (!user_data->accelerated) {
return LB_STATUS_SUCCESS;
+ }
/*!
* \note
const char *id;
struct livebox_buffer_data *user_data;
- if (!handle)
+ if (!handle) {
return LB_STATUS_ERROR_INVALID;
+ }
user_data = provider_buffer_user_data(handle);
- if (!user_data)
+ if (!user_data) {
return LB_STATUS_ERROR_INVALID;
+ }
- if (!user_data->accelerated)
+ if (!user_data->accelerated) {
return LB_STATUS_SUCCESS;
+ }
pkgname = provider_buffer_pkgname(handle);
if (!pkgname) {
}
if (user_data->is_pd == 1) {
- if (provider_send_desc_updated(pkgname, id, NULL) < 0)
+ if (provider_send_desc_updated(pkgname, id, NULL) < 0) {
ErrPrint("Failed to send PD updated (%s)\n", id);
+ }
} else {
int w;
int h;
int pixel_size;
- if (provider_buffer_get_size(handle, &w, &h, &pixel_size) < 0)
+ if (provider_buffer_get_size(handle, &w, &h, &pixel_size) < 0) {
ErrPrint("Failed to get size (%s)\n", id);
+ }
- if (provider_send_updated(pkgname, id, w, h, -1.0f, NULL, NULL) < 0)
+ if (provider_send_updated(pkgname, id, w, h, -1.0f, NULL, NULL) < 0) {
ErrPrint("Failed to send updated (%s)\n", id);
+ }
}
return LB_STATUS_SUCCESS;
struct snapshot_info *info;
info = evas_object_data_del(obj, "snapshot,info");
- if (!info)
+ if (!info) {
return;
+ }
SECURE_LOGD("Delete object (%s)\n", info->id);
e = evas_object_evas_get(snapshot_win);
if (!e) {
LOGE("Invalid object, failed to get Evas\n");
- if (flush_cb)
+ if (flush_cb) {
flush_cb(snapshot_win, info->id, LB_STATUS_ERROR_FAULT, info->data);
+ }
return ECORE_CALLBACK_CANCEL;
}
ee = ecore_evas_ecore_evas_get(e);
if (!ee) {
LOGE("Unable to get Ecore_Evas object\n");
- if (flush_cb)
+ if (flush_cb) {
flush_cb(snapshot_win, info->id, LB_STATUS_ERROR_FAULT, info->data);
+ }
return ECORE_CALLBACK_CANCEL;
}
canvas = ecore_evas_buffer_pixels_get(ee);
if (!canvas) {
LOGE("Failed to get canvas\n");
- if (flush_cb)
+ if (flush_cb) {
flush_cb(snapshot_win, info->id, LB_STATUS_ERROR_FAULT, info->data);
+ }
return ECORE_CALLBACK_CANCEL;
}
status = flush_to_file(canvas, info->id, w, h);
- if (flush_cb)
+ if (flush_cb) {
flush_cb(snapshot_win, info->id, status, info->data);
+ }
return ECORE_CALLBACK_CANCEL;
}
e = evas_object_evas_get(snapshot_win);
if (!e) {
LOGE("Invalid object\n");
- if (flush_cb)
+ if (flush_cb) {
flush_cb(snapshot_win, info->id, LB_STATUS_ERROR_FAULT, info->data);
+ }
return ECORE_CALLBACK_CANCEL;
}
ee = ecore_evas_ecore_evas_get(e);
if (!ee) {
LOGE("Invalid object (ee)\n");
- if (flush_cb)
+ if (flush_cb) {
flush_cb(snapshot_win, info->id, LB_STATUS_ERROR_FAULT, info->data);
+ }
return ECORE_CALLBACK_CANCEL;
}
canvas = (void*)ecore_evas_buffer_pixels_get(ee);
if (!canvas) {
LOGD("Failed to get pixel canvas\n");
- if (flush_cb)
+ if (flush_cb) {
flush_cb(snapshot_win, info->id, LB_STATUS_ERROR_FAULT, info->data);
+ }
return ECORE_CALLBACK_CANCEL;
}
int oh;
ee = ecore_evas_ecore_evas_get(e);
- if (!ee)
+ if (!ee) {
return;
+ }
ecore_evas_geometry_get(ee, NULL, NULL, &w, &h);
evas_object_geometry_get(obj, NULL, NULL, &ow, &oh);
* or the developer will get confused
*/
info->flush_timer = ecore_timer_add(0.0001f, direct_snapshot_cb, snapshot_win);
- if (!info->flush_timer)
+ if (!info->flush_timer) {
return LB_STATUS_ERROR_FAULT;
+ }
} else if (info->render_cnt) {
/*!
* Try to watit pre-render callback.
*/
DbgPrint("Rendered %d times already\n", info->render_cnt);
info->flush_timer = ecore_timer_add(info->timeout, snapshot_cb, snapshot_win);
- if (!info->flush_timer)
+ if (!info->flush_timer) {
return LB_STATUS_ERROR_FAULT;
+ }
}
info->flush_cb = flush_cb;
PUBLIC int livebox_snapshot_window_del(Evas_Object *snapshot_win)
{
Evas *e;
- if (!snapshot_win || !evas_object_data_get(snapshot_win, "snapshot,info"))
+ if (!snapshot_win || !evas_object_data_get(snapshot_win, "snapshot,info")) {
return LB_STATUS_ERROR_INVALID;
+ }
e = evas_object_evas_get(snapshot_win);
evas_event_callback_del(e, EVAS_CALLBACK_RENDER_POST, post_render_cb);