static char *get_selection_type(cbhm_sel_type_e type)
{
char msg[40];
+ snprintf(msg, sizeof(msg), "Unknow Type");
+
switch(type)
{
case CBHM_SEL_TYPE_TEXT :
case CBHM_SEL_TYPE_IMAGE :
snprintf(msg, sizeof(msg), "CBHM_SEL_TYPE_IMAGE");
break;
- default :
- snprintf(msg, sizeof(msg), "Unknow Type");
}
return strdup(msg);
}
char *hello_str;
cbhm_view *this = (cbhm_view*) data;
hello_str = (char *) malloc(50);
- snprintf(hello_str, 50, "String : %s", get_selection_type(type));
+ char *selection_str = NULL;
+ selection_str = get_selection_type(type);
+
+ snprintf(hello_str, 50, "String : %s", selection_str);
nRet = cbhm_selection_type_set(this->cbhm_handle, type);
- RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_selection_type_set failed");
+ RETM_IF_CLEANUP(nRet != CBHM_ERROR_NONE, "cbhm_selection_type_set failed", SAFE_DELETE(hello_str); SAFE_DELETE(selection_str));
nRet = cbhm_selection_set(this->cbhm_handle, type, hello_str, strlen(hello_str));
- RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_selection_set failed");
+ RETM_IF_CLEANUP(nRet != CBHM_ERROR_NONE, "cbhm_selection_set failed", SAFE_DELETE(hello_str); SAFE_DELETE(selection_str));
+
+ SAFE_DELETE(selection_str);
+ SAFE_DELETE(hello_str);
}
RETVM_IF(!this, NULL, "calloc failed");
this->view = calloc(1, sizeof(common_view));
- RETVM_IF(!this->view, NULL, "calloc failed");
+ RETVM_IF_CLEANUP(!this->view, NULL, "calloc failed", SAFE_DELETE(this));
tbt_info->layout_group = "cbhm_test";
tbt_info->layout_file = get_edje_path("cbhm_viewer.edj");
common_view_add(navi, tbt_info, item, this->view, _app_destroy_cb, this);
- RETVM_IF(NULL == this->view, NULL, "navi is null");
nRet = cbhm_open_service(&(this->cbhm_handle));
- RETVM_IF(nRet != CBHM_ERROR_NONE, NULL, "cbhm_open_service failed");
- RETVM_IF(this->cbhm_handle == NULL, NULL, "cbhm_handle is NULL");
+ RETVM_IF_CLEANUP(nRet != CBHM_ERROR_NONE, NULL, "cbhm_open_service failed", SAFE_DELETE(this->view); SAFE_DELETE(this));
+ RETVM_IF_CLEANUP(this->cbhm_handle == NULL, NULL, "cbhm_handle is NULL", SAFE_DELETE(this->view); SAFE_DELETE(this));
this->apptype = tbt_info->apptype;
this->lat_label = ui_utils_label_add(this->view->layout, "???");
int nRet = cbhm_state_get(this->cbhm_handle, &sType);
RETM_IF(nRet != CBHM_ERROR_NONE, "cbhm_state_get failed");
+ ui_utils_label_set_text(this->lat_label, "Unknown State", "left");
+
switch(sType)
{
case CBHM_STATE_NONE :
case CBHM_STATE_HIDE :
ui_utils_label_set_text(this->lat_label, "Clip Board State is : Hide", "left");
break;
- default :
- ui_utils_label_set_text(this->lat_label, "Unknown State", "left");
}
}