*/
int create_database()
{
- snprintf(DB_PATH, sizeof(DB_PATH), "%s/dataprovider.db", app_get_data_path());
- DBG("database creation failed with error: %s",DB_PATH);
- remove(DB_PATH);
+
+ snprintf(DB_PATH, sizeof(DB_PATH), "%sdataprovider.db", app_get_data_path());
char* sql_command = "CREATE TABLE IF NOT EXISTS provider (ID INTEGER PRIMARY KEY AUTOINCREMENT,WORD VARCHAR(30), WORD_DESC TEXT, WORD_LEN INT, WORD_DESC_LEN INT64,WORD_NUMBER DOUBLE, WORD_BLOB VARBINARY(50))";
int open_flags = (SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE);
static inline device_type_e get_device_type()
{
- int width, height;
+ int width = -1, height = -1;
device_type_e device_type = DEVICE_TYPE_NONE;
system_info_get_platform_int("tizen.org/feature/screen.width", &width);
system_info_get_platform_int("tizen.org/feature/screen.height", &height);
+ RETVM_IF(width == -1, DEVICE_TYPE_NONE, "screen width is not correct");
+ RETVM_IF(height == -1, DEVICE_TYPE_NONE, "screen height is not correct");
+
if(width == 360 && height == 360)
{
//circle
if (!(wid->win))
{
DBG("widget_app win NULL");
+ SAFE_DELETE(wid);
return -1;
}
static int widget_instance_create(widget_context_h context, bundle *content, int w, int h, void *user_data)
{
widget_instance_data_s *wid = (widget_instance_data_s *)calloc(1, sizeof(widget_instance_data_s));
- int ret;
-
+ if(wid == NULL)
+ {
+ return WIDGET_ERROR_FAULT;
+ }
dlog_print(DLOG_DEBUG, LOG_TAG, "id: %s", widget_app_get_id(context));
/* window */
- ret = widget_app_get_elm_win(context, &wid->win);
+ int ret = widget_app_get_elm_win(context, &wid->win);
if (ret != WIDGET_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "failed to get window. err = %d", ret);
+ free(wid);
+ wid = NULL;
return WIDGET_ERROR_FAULT;
}
// elm_genlist_item_append(ad->files_list, _itc, "amlan", NULL, ELM_GENLIST_ITEM_NONE, list_item_clicked_cb, NULL);
// elm_genlist_item_class_free(_itc);
-
-
+ eina_list_free(file_list);
+ eina_list_free(ad->files_list);
}
}
}
this->video_player_data = (videoplayer_data_s*) malloc(sizeof(videoplayer_data_s));
+ if(this->video_player_data == NULL)
+ {
+ return;
+ }
this->video_player_data->video_rect = this->video_rect;
this->video_player_data->player = NULL;
this->video_player_data->uri = this->uri;
appdata_s *this = (appdata_s*) data;
this->sound_player_data = (soundplayer_data_s*) malloc(sizeof(soundplayer_data_s));
+ if(this->sound_player_data == NULL)
+ {
+ return;
+ }
this->sound_player_data->uri = this->uri;
this->sound_player_data->player = create_sound_player(this->sound_player_data);
char* get_video_player_state(player_state_e error_state)
{
+ char* player_state = "STATE_NOT_FOUND";
+
switch(error_state)
{
case PLAYER_STATE_NONE:
- return"PLAYER_STATE_NONE";
+ player_state = "PLAYER_STATE_NONE";
+ break;
case PLAYER_STATE_IDLE:
- return"PLAYER_STATE_IDLE";
+ player_state = "PLAYER_STATE_IDLE";
+ break;
case PLAYER_STATE_READY:
- return"PLAYER_STATE_READY";
+ player_state = "PLAYER_STATE_READY";
+ break;
case PLAYER_STATE_PLAYING:
- return"PLAYER_STATE_PLAYING";
+ player_state = "PLAYER_STATE_PLAYING";
+ break;
case PLAYER_STATE_PAUSED:
- return"PLAYER_STATE_PAUSED";
- default:
- return "STATE_NOT_FOUND";
+ player_state = "PLAYER_STATE_PAUSED";
+ break;
}
+ return player_state;
}
this->list = eina_list_append(this->list, attr);
ret = ime_update_preedit_string("abcd", this->list);
- RETM_IF(IME_ERROR_NONE!=ret, "ime_update_preedit_string fails :%s",_get_ime_error(ret));
if (ret != IME_ERROR_NONE)
{
EINA_LIST_FREE(this->list, attr)
SAFE_DELETE(attr);
+ return;
}
+ SAFE_DELETE(attr);
+
}
DBG("MSG :%s", MSG);
}
RETM_IF(NULL == data->info_msg, "Message is NULL");
- btn = _create_key_button(layout, ((char*)MSG == NULL || strlen(MSG) == 0)?data->info_msg:MSG);
+ btn = _create_key_button(layout, (strlen(MSG) == 0)?data->info_msg:MSG);
str = format_string("%s%d%d", "btn_", 0, 0);
elm_object_part_content_set(layout, str, btn);
SAFE_DELETE(str);
result = ime_event_set_option_window_destroyed_cb(ise_template_option_window_destroyed_cb, data);
// Start IME
ime_run(&basic_callback, data);
+ SAFE_DELETE(data);
}
static char* get_ecore_imf_device_class(Ecore_IMF_Device_Class e)
{
- char* str = NULL;
+ char* str = "UNKWON_CLASS";
switch(e)
{
case ECORE_IMF_DEVICE_CLASS_NONE:
case ECORE_IMF_DEVICE_CLASS_GAMEPAD:
str = "ECORE_IMF_DEVICE_CLASS_GAMEPAD";
break;
- default:
- str = "UNKWON_CLASS";
- break;
}
return str;
}
return true;
}
-static char* get_xml_element_value (xmlDocPtr doc, xmlNodePtr cur, const char* tag)
+void get_xml_element_value(xmlDocPtr doc, xmlNodePtr cur, const char* tag, char** str)
{
-
+DBG("get_xml_element_value");
xmlChar *key;
- char* str;
cur = cur->xmlChildrenNode;
while (cur != NULL) {
if ((!xmlStrcmp(cur->name, (const xmlChar *)tag))) {
key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
- str = strdup((char*)key);
+ *str = strdup((char*)key);
xmlFree(key);
+ break;
}
cur = cur->next;
}
- return str;
}
static void start_push_operation(void* data)
init_xml_operation(this);
- this->push_app_id_text = get_xml_element_value(this->doc, this->root_node_ptr, "TestappID");
+ get_xml_element_value(this->doc, this->root_node_ptr, "TestappID",&(this->push_app_id_text));
DBG("appID: %s", this->push_app_id_text);
//this->push_app_id_text = PUSH_APP_ID;
ret = push_service_connect(this->push_app_id_text, _state_changed_cb, _notify_cb, this, &connection);
RETM_IF(ret != PUSH_SERVICE_ERROR_NONE, "push_service_connect :%s",push_service_get_error(ret));
-
-
+ free(this->push_app_id_text);
}
static void init_xml_operation(void* data)
ui_menu *menu = ui_view_get_menu(view);
int rotation;
- if (ui_view_get_orientation_mode(view) == UI_VIEW_ORIENTATION_MODE_PORTRAIT)
- {
- /* Portrait mode. */
- rotation = ui_menu_get_degree(menu);
- }
- else
- {
- /* Landscape mode. */
- rotation = ui_menu_get_degree(menu);
- }
+ rotation = ui_menu_get_degree(menu);
DBG("rotation %d", rotation);
char str[256];
bool UiUtils::OnPassButtonClick(Button button)
{
DBG("UiUtils::OnPassButtonClick");
- app_control_h reply;
- int nStatus = app_control_create(&reply);
+ app_control_h reply = NULL;
+ int nStatus = -1;
+ nStatus = app_control_create(&reply);
+
+ RETVM_IF(nStatus == -1, false, "control handle creation failed");
+ RETVM_IF(reply == NULL, false, "control handle creation failed");
app_control_result_e res = APP_CONTROL_RESULT_SUCCEEDED;
nStatus = app_control_reply_to_launch_request(reply, _control, res);
bool UiUtils::OnFailButtonClick(Button button)
{
DBG("UiUtils::OnFailButtonClick");
- app_control_h reply;
- int nStatus = app_control_create(&reply);
+ app_control_h reply = NULL;
+ int nStatus = -1;
+ nStatus = app_control_create(&reply);
+
+ RETVM_IF(nStatus == -1, false, "control handle creation failed");
+ RETVM_IF(reply == NULL, false, "control handle creation failed");
app_control_result_e res = APP_CONTROL_RESULT_FAILED;
nStatus = app_control_reply_to_launch_request(reply, _control, res);
std::string GetState ( TouchPoint::State state )
{
- std::string ret="";
+ std::string ret="None";
switch(state)
{
case TouchPoint::Started:
- {
- if(TouchPoint::Started==state)
- ret="Started";
- else
- ret="Down";
- }
+ ret="Started";
break;
case TouchPoint::Finished:
- {
- if(TouchPoint::Finished==state)
- ret="Finished";
- else
- ret="Up";
- }
- break;
+ ret="Finished";
+ break;
case TouchPoint::Motion:
ret="Motion";
case TouchPoint::Last:
ret="Last";
break;
-
- default:
- ret="None";
- break;
}
return ret;
}
std::string GetPointState ( PointState::Type state )
{
- std::string str="";
+ std::string str="None";
switch(state)
{
case PointState::STARTED:
case PointState::INTERRUPTED:
str="INTERRUPTED";
break;
- default:
- str="None";
- break;
}
return str;
}
Stage stage = Stage::GetCurrent();
Vector2 stageSize = stage.GetSize();
-
+ bCheck = false;
Property::Map ctl;
//ctl["lbl1"]=" Context lost signal not call";
//ctl["lbl2"]=" Context regain signal not call";
styleManager.ApplyDefaultTheme();
styleManager.ApplyStyle( btnStyle, IMAGE_PATH, "testbutton" );
styleManager.ApplyStyle( lblStyleManager, IMAGE_PATH, "textlabel" );
+ free(IMAGE_PATH);
return true;
}
void TBTDaliStyleManagerView::OnStyleChange(StyleManager style,StyleChange::Type type)
#include "view/tbt-dali-touch-data-view.h"
std::string GetTouchDataState ( TouchPoint::State state )
{
- std::string ret="";
+ std::string ret="None";
switch(state)
{
case TouchPoint::Started:
- {
- if(TouchPoint::Started==state)
- ret="Started";
- else
- ret="Down";
- }
- break;
+ ret="Started";
+ break;
case TouchPoint::Finished:
- {
- if(TouchPoint::Finished==state)
- ret="Finished";
- else
- ret="Up";
- }
- break;
+ ret="Finished";
+ break;
case TouchPoint::Motion:
ret="Motion";
case TouchPoint::Last:
ret="Last";
break;
-
- default:
- ret="None";
- break;
}
return ret;
}
std::string GetTouchDataPointState ( PointState::Type state )
{
- std::string str="";
+ std::string str="None";
switch(state)
{
case PointState::STARTED:
case PointState::INTERRUPTED:
str="INTERRUPTED";
break;
- default:
- str="None";
- break;
}
return str;
}
#endif
int num = strlen(file_name);
+ if(num<0)
+ {
+ return NULL;
+ }
if(strlen(file_path)+strlen(file_name) <= MAX_LENGTH)
{
num = strlen(file_name);
} \
}
+#define RETM_IF_CLEANUP(expr, fmt, FreeResource, arg...) \
+{ \
+ if (expr) \
+ { \
+ ERR(fmt, ##arg); \
+ FreeResource; \
+ return; \
+ } \
+}
+
+
#define RETVM_IF(expr, val, fmt, arg...) \
{ \
if (expr) \
} \
}
+#define RETVM_IF_CLEANUP(expr, val, fmt, FreeResource, arg...) \
+{ \
+ if (expr) \
+ { \
+ ERR(fmt, ##arg); \
+ FreeResource; \
+ return (val); \
+ } \
+}
+
#define SAFE_DELETE(a) if( (a) != NULL ) free (a); (a) = NULL;
#endif /* __LOGGER_H__ */
if(transition==NULL)
{
transition=malloc(sizeof(util_state_transition));
+ RETVM_IF(transition == NULL,NULL,"transition is null");
+
transition->destination=to;
transition->input=feed_value;
from->transitions = g_list_append(from->transitions,transition);
// get summary info
for (i = 0; i < testDataCount; i++)
{
-
DBG("3 %d %s",i,moduleList[i].name);
- test=&moduleList[i];
- // just for safety
- if(moduleList[i].result>3) moduleList[i].result=TBT_INFO_RESULT_NOT_TESTED; // set result not tested
- passfail[moduleList[i].result]++;
+ test = &moduleList[i];
+ // just for safety
+ if(moduleList[i].result>3)
+ moduleList[i].result=TBT_INFO_RESULT_NOT_TESTED; // set result not tested
+ passfail[moduleList[i].result]++;
}
break;
}
}
+ free(file_path);
return bubble_table;
}
}
else
{
+ ui_utils_label_set_text(this->create_label, "Device Discovery Invoked, No Status yet", "left");
switch ( discovery_state )
{
case BT_ADAPTER_DEVICE_DISCOVERY_STARTED:
case BT_ADAPTER_DEVICE_DISCOVERY_FOUND:
ui_utils_label_set_text(this->create_label, "Device Discovery Invoked, device is found", "left");
break;
- default:
- ui_utils_label_set_text(this->create_label, "Device Discovery Invoked, No Status yet", "left");
- break;
}
}
}
else if(this->view->tbt_info->apptype == TBT_APP_BT_OPP_SERVER && this->is_opp_server_accecpt == EINA_FALSE)
{
DBG("TBT_APP_BT_OPP_SERVER");
- result = bt_opp_server_initialize_by_connection_request(get_storage_image_dir_path(), _adpter_bt_opp_server_connection_requested_cb,this);
+ char *server_path = get_storage_image_dir_path();
+ result = bt_opp_server_initialize_by_connection_request(server_path, _adpter_bt_opp_server_connection_requested_cb,this);
DBG("bt_opp_server_initialize_by_connection_request %s %s ", get_bluetooth_error(result), app_get_resource_path());
RETM_IF(result != BT_ERROR_NONE, "[bt_opp_server_initialize_by_connection_request] Failed. > Error = %s", get_bluetooth_error(result));
+ free(server_path);
}
}
else if(this->view->tbt_info->apptype == TBT_APP_BT_AUDIO_CONNECT ||
}
else
{
- elm_list_item_append(this->bluetooth_list, format_string("%s(Paired)", device_info->remote_name), NULL, NULL, _device_item_selected_cb, device_info);
+ char* str = format_string("%s(Paired)", device_info->remote_name);
+ elm_list_item_append(this->bluetooth_list,str , NULL, NULL, _device_item_selected_cb, device_info);
+ SAFE_DELETE(str);
}
}
}
result = bt_opp_client_initialize();
RETM_IF(result != BT_ERROR_NONE, "bt_opp_client_initialize fail > Error = %d", result);
- result = bt_opp_client_add_file(get_shared_resource_path(this->view->tbt_info->file_name));
+ char *file_path = get_shared_resource_path(this->view->tbt_info->file_name);
+ result = bt_opp_client_add_file(file_path);
+ SAFE_DELETE(file_path);
RETM_IF(result != BT_ERROR_NONE, "bt_opp_client_add_file fail > Error = %d", result);
if(this->selected_device_info != NULL)
app_control_h service = NULL;
result = app_control_create(&service);
RETM_IF(result != APP_CONTROL_ERROR_NONE, "app_control_create Failed. > Error = %d", result);
+ RETM_IF(service == NULL, "app_control_create Failed - handle is NULL");
app_control_set_operation(service, "http://tizen.org/appcontrol/operation/edit");
app_control_set_mime(service, "application/x-bluetooth-visibility");
//Hold the last deviceinfo pointer;
this->devices_list = g_list_append(this->devices_list, (gpointer)device_info);
+ if(this->devices_list == NULL)
+ {
+ if(device_info)
+ {
+ free(device_info->remote_name);
+ free(device_info->remote_address);
+ free(device_info);
+ }
+ }
}
}
}
//Hold the last deviceinfo pointer;
this->devices_list = g_list_append(this->devices_list, (gpointer)device_info);
+ if(this->devices_list == NULL)
+ {
+ if(device_info)
+ {
+ free(device_info->remote_name);
+ free(device_info->remote_address);
+ free(device_info);
+ }
+ }
}
}
//Hold the last deviceinfo pointer;
this->devices_list = g_list_append(this->devices_list, (gpointer)device_info);
+ if(this->devices_list == NULL)
+ {
+ if(device_info)
+ {
+ free(device_info->remote_name);
+ free(device_info->remote_address);
+ free(device_info);
+ }
+ }
}
}
//Hold the last deviceinfo pointer;
this->devices_list = g_list_append(this->devices_list, (gpointer)device_info);
+ if(this->devices_list == NULL)
+ {
+ if(device_info)
+ {
+ free(device_info->remote_name);
+ free(device_info->remote_address);
+ free(device_info);
+ }
+ }
}
}
//Hold the last deviceinfo pointer;
this->devices_list = g_list_append(this->devices_list, (gpointer)device_info);
+ if(this->devices_list == NULL)
+ {
+ if(device_info)
+ {
+ free(device_info->remote_name);
+ free(device_info->remote_address);
+ free(device_info);
+ }
+ }
}
}
//Hold the last deviceinfo pointer;
this->devices_list = g_list_append(this->devices_list, (gpointer)device_info);
+ if(this->devices_list == NULL)
+ {
+ if(device_info)
+ {
+ free(device_info->remote_name);
+ free(device_info->remote_address);
+ free(device_info);
+ }
+ }
}
}
}
if(authorization == BT_DEVICE_AUTHORIZED)
{
- elm_object_item_text_set(this->selected_device_item, format_string("%s(Authorized)", this->selected_device_info->remote_name));
+ char *item_text = format_string("%s(Authorized)", this->selected_device_info->remote_name);
+ elm_object_item_text_set(this->selected_device_item, item_text);
+ SAFE_DELETE(item_text);
#ifdef TIZEN_3_0
ui_utils_label_set_text(this->bluetooth_label, "Authorized", "left");
#endif
}
else if(authorization == BT_DEVICE_UNAUTHORIZED)
{
- elm_object_item_text_set(this->selected_device_item, format_string("%s(Unauthorized)", this->selected_device_info->remote_name));
+ char *item_text = format_string("%s(Unauthorized)", this->selected_device_info->remote_name);
+ elm_object_item_text_set(this->selected_device_item,item_text );
+ SAFE_DELETE(item_text);
#ifdef TIZEN_3_0
ui_utils_label_set_text(this->bluetooth_label, "Unauthorized", "left");
#endif
//Hold the last deviceinfo pointer;
this->bonded_devices_list = g_list_append(this->bonded_devices_list, (gpointer)device_info_bonded);
+ if(this->bonded_devices_list == NULL)
+ {
+ free(device_info_bonded->remote_name);
+ free(device_info_bonded->remote_address);
+ free(device_info_bonded);
+ }
if(this->view->tbt_info->apptype == TBT_APP_BT_SERVER_PAIRED ||
this->view->tbt_info->apptype == TBT_APP_BT_SERVER_SOCKET ||
if(view->bt_player)
{
- player_stop(view->bt_player);
- player_unprepare(view->bt_player);
- player_destroy(view->bt_player);
+ result = player_stop(view->bt_player);
+ if(result != PLAYER_ERROR_NONE)
+ {
+ DBG("[player_stop] Failed.");
+ }
+ result = player_unprepare(view->bt_player);
+ if(result != PLAYER_ERROR_NONE)
+ {
+ DBG("[player_unprepare] Failed.");
+ }
+ result = player_destroy(view->bt_player);
+ if(result != PLAYER_ERROR_NONE)
+ {
+ DBG("[player_destroy] Failed.");
+ }
view->bt_player = NULL;
}
elm_object_disabled_set(this->action_btn, EINA_FALSE);
evas_object_data_set(this->bluetooth_list, "bluetooth_view", this);
- elm_object_item_text_set(this->selected_device_item, format_string("%s(Paired)", this->selected_device_info->remote_name));
+ char *item_text = format_string("%s(Paired)", this->selected_device_info->remote_name);
+ elm_object_item_text_set(this->selected_device_item, item_text);
+ SAFE_DELETE(item_text);
#ifdef TIZEN_3_0
ui_utils_label_set_text(this->bluetooth_label, "Paired", "left");
#endif
case BT_BOND_TIMED_OUT:
elm_object_disabled_set(this->action_btn, EINA_FALSE);
evas_object_data_set(this->bluetooth_list, "bluetooth_view", this);
- elm_object_item_text_set(this->selected_device_item, format_string("%s(Timedout)", this->selected_device_info->remote_name));
+ char *item_text1 = format_string("%s(Timedout)", this->selected_device_info->remote_name);
+ elm_object_item_text_set(this->selected_device_item, item_text1);
+ SAFE_DELETE(item_text1);
#ifdef TIZEN_3_0
ui_utils_label_set_text(this->bluetooth_label, "Timed Out", "left");
#endif
case BT_BOND_REMOTE_DEVICE_NOT_FOUND:
elm_object_disabled_set(this->action_btn, EINA_FALSE);
evas_object_data_set(this->bluetooth_list, "bluetooth_view", this);
- elm_object_item_text_set(this->selected_device_item, format_string("%s(Device Not Found)", this->selected_device_info->remote_name));
+ char *item_text2 = format_string("%s(Device Not Found)", this->selected_device_info->remote_name);
+ elm_object_item_text_set(this->selected_device_item, item_text2);
+ SAFE_DELETE(item_text2);
#ifdef TIZEN_3_0
ui_utils_label_set_text(this->bluetooth_label, "Device Not Found", "left");
#endif
case BT_BOND_CANCELLED:
elm_object_disabled_set(this->action_btn, EINA_FALSE);
evas_object_data_set(this->bluetooth_list, "bluetooth_view", this);
- elm_object_item_text_set(this->selected_device_item, format_string("%s(Cancelled)", this->selected_device_info->remote_name));
+ char *item_text3 = format_string("%s(Cancelled)", this->selected_device_info->remote_name);
+ elm_object_item_text_set(this->selected_device_item, item_text3);
+ SAFE_DELETE(item_text3);
#ifdef TIZEN_3_0
ui_utils_label_set_text(this->bluetooth_label, "Cancelled", "left");
#endif
case BT_BOND_AUTH_FAILED:
elm_object_disabled_set(this->action_btn, EINA_FALSE);
evas_object_data_set(this->bluetooth_list, "bluetooth_view", this);
- elm_object_item_text_set(this->selected_device_item, format_string("%s(Auth Failed)", this->selected_device_info->remote_name));
+ char *item_text4 = format_string("%s(Auth Failed)", this->selected_device_info->remote_name);
+ elm_object_item_text_set(this->selected_device_item, item_text4);
+ SAFE_DELETE(item_text4);
#ifdef TIZEN_3_0
ui_utils_label_set_text(this->bluetooth_label, "Auth Failed", "left");
#endif
DBG("bt_device_start_service_search");
result = bt_device_start_service_search(this->selected_device_info->remote_address);
RETM_IF(result != BT_ERROR_NONE, "bt_device_start_service_search fail > Error = %d", result);
-
- elm_object_item_text_set(this->selected_device_item, format_string("%s(Pairing)", this->selected_device_info->remote_name));
+ char *item_text = format_string("%s(Pairing)", this->selected_device_info->remote_name);
+ elm_object_item_text_set(this->selected_device_item, item_text);
+ SAFE_DELETE(item_text);
#ifdef TIZEN_3_0
ui_utils_label_set_text(this->bluetooth_label, "Pairing..", "left");
#endif
{
elm_object_disabled_set(this->action_btn, EINA_TRUE);
evas_object_data_set(this->bluetooth_list, "bluetooth_view", NULL);
- elm_object_item_text_set(this->selected_device_item, format_string("%s(Unpairing)", this->selected_device_info->remote_name));
+ char *item_text = format_string("%s(Unpairing)", this->selected_device_info->remote_name);
+ elm_object_item_text_set(this->selected_device_item, item_text);
+ SAFE_DELETE(item_text);
#ifdef TIZEN_3_0
ui_utils_label_set_text(this->bluetooth_label, "Unpairing..", "left");
#endif
//Hold the last deviceinfo pointer;
this->devices_list = g_list_append(this->devices_list, (gpointer) device_info);
+ if(this->devices_list == NULL)
+ {
+ free(device_info->remote_address);
+ free(device_info);
+ }
}
}
}
char* svc_uuid;
char* str;
- bt_gatt_get_uuid(service_handle, &svc_uuid);
+ int ret = bt_gatt_get_uuid(service_handle, &svc_uuid);
+ RETM_IF(ret != BT_ERROR_NONE, "bt_gatt_get_uuid fail > Error = %s", get_bluetooth_error(ret));
str = format_string("Service UUID: %s",svc_uuid);
return "CAMERA_STATE_CAPTURING";
case CAMERA_STATE_CAPTURED:
return "CAMERA_STATE_CAPTURED";
- default:
- return "Unknown Error";
}
}
{
if (view->file_path != NULL)
{
- remove(view->file_path);
SAFE_DELETE(view->file_path);
}
RETM_IF(NULL == view->image, "ui_utils_create_image fail > Error = %s", view->file_path);
elm_object_part_content_set(view->view->layout, "video_view", view->image);
+ if(view->file_path)
+ {
+ free(view->file_path);
+ }
}
}
//draw_lines(faces[i].x, faces[i].y, faces[i].width, faces[i].height, i, view);
//DBG("x: %d, y: %d, w: %d, h: %d", faces[i].y, faces[i].x+faces[i].width, faces[i].height, faces[i].width);
//draw_lines(faces[i].y, faces[i].x+faces[i].width, faces[i].height, faces[i].width, i, view);
- draw_lines((canvas_width-faces[i].width)-faces[i].y, canvas_height-faces[i].x, faces[i].width, faces[i].height, i, view);
+ draw_lines((canvas_width-faces[i].width)-faces[i].y, canvas_height-faces[i].x, faces[i].height, faces[i].width, i, view);
//draw_lines(canvas_x-faces[i].x, canvas_y-faces[i].y, faces[i].height, faces[i].width, i, view);
DBG("x: %d, y: %d, w: %d, h: %d", faces[i].y, faces[i].x, faces[i].width, faces[i].height);
}
result = connection_get_cellular_state(g_hConenctionHandle, &eFindCellularState);
RETVM_IF(result != CONNECTION_ERROR_NONE, NULL, "connection_get_cellular_state fail > Error = %s", get_connection_error(result));
-
+ ui_utils_label_set_text(this->connection_label, "Unknown status", "left");
switch(eFindCellularState)
{
case CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE:
case CONNECTION_CELLULAR_STATE_CONNECTED:
ui_utils_label_set_text(this->connection_label, "Connected ", "left");
break;
-
- default:
- ui_utils_label_set_text(this->connection_label, "Unknown status", "left");
- break;
-
}
}
else
RETVM_IF(APP_CONTROL_ERROR_NONE != ret, NULL, "app_control_set_operation failed :%s", get_app_control_error(ret));
this->dali = (view_item*)malloc(sizeof(view_item));
+ RETVM_IF(this->dali == NULL,NULL,"dali is null");
+
this->dali->uri = NULL;
this->dali->mime = "text/plain";
this->module_name = module_name;
RETVM_IF(NULL == navi, NULL, "navi is null");
this = calloc(1, sizeof(datacontrol_view));
+ RETVM_IF(!this, NULL, "calloc failed");
this->view = calloc(1, sizeof(common_view));
RETVM_IF(!this->view, NULL, "calloc failed");
evas_object_geometry_get(this->image, &x, &y, &w, &h);
DBG("Dim: %d %d %d %d", x, y, w, h);
- RETVM_IF(NULL == this->image, false, "create of layout elements failed");
+ RETVM_IF_CLEANUP(NULL == this->image, false, "create of layout elements failed",SAFE_DELETE(file_path));
if(EINA_TRUE == elm_image_animated_available_get(this->image))
{
}
elm_object_part_content_set(this->view->layout, "image_view", this->image);
+ SAFE_DELETE(file_path);
return this;
}
itc->func.del = _gl_del_cb;
item_data *id = calloc(sizeof(item_data), 1);
+ RETVM_IF(id == NULL,NULL,"id is null");
+
id->index = index++;
id->text = strdup(item_text);
#ifndef USE_GENLIST
elm_list_go(this->info_list);
#endif
- if (0 != ret)
- {
- _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
- return;
- }
ret = iotcon_request_get_observe_type(request, &observe_type);
if (IOTCON_ERROR_NONE != ret)
evas_object_event_callback_add(view->list, EVAS_CALLBACK_FREE, _list_view_destroy_cb, view);
view->navi_item = elm_naviframe_item_push(view->navi, "TBT", NULL, NULL, view->list, NULL);
- RETVM_IF(!view->navi_item, NULL, "elm_naviframe_item_push failed");
+ RETVM_IF_CLEANUP(!view->navi_item, NULL,"elm_naviframe_item_push failed",SAFE_DELETE(view));
return view->list;
}
RETVM_IF(result != PLAYER_ERROR_NONE, NULL, "player_set_volume fail > Error = %s", get_local_view_error(result));
result = player_set_looping(player, true);
RETVM_IF(result != PLAYER_ERROR_NONE, NULL, "player_set_looping fail > Error = %s", get_local_view_error(result));
- result = player_set_uri(player, get_resource_path(this->view->tbt_info->file_name));
+ char *path= get_resource_path(this->view->tbt_info->file_name);
+ result = player_set_uri(player, path);
+ SAFE_DELETE(path);
RETVM_IF(result != PLAYER_ERROR_NONE, NULL, "player_set_uri fail > Error = %s", get_local_view_error(result));
#ifdef DEVICE_TYPE_MOBILE
result = player_set_display(player, PLAYER_DISPLAY_TYPE_EVAS, GET_DISPLAY(this->video_rect));
RETM_IF(NULL == this, "view is NULL");
DBG("value: %d", status);
-
+ ui_utils_label_set_text(this->mediakey_label, "unknown state", "left");
switch (status)
{
case MEDIA_KEY_STATUS_PRESSED:
case MEDIA_KEY_STATUS_UNKNOWN:
ui_utils_label_set_text(this->mediakey_label, "Unknown status", "left");
break;
- default:
- ui_utils_label_set_text(this->mediakey_label, "unknown state", "left");
- break;
}
-
+
+ ui_utils_label_set_text(this->mediakey2_label, "unknown state", "left");
DBG("value: %d", key);
switch (key)
{
case MEDIA_KEY_UNKNOWN:
ui_utils_label_set_text(this->mediakey2_label, "Unknown key", "left");
break;
- default:
- ui_utils_label_set_text(this->mediakey_label, "unknown state", "left");
- break;
}
return ;
}
const char *file_path;
file_path = get_resource_path(this->view->tbt_info->file_name);
this->activity_image = ui_utils_create_image(this->view->layout, file_path);
+ SAFE_DELETE(file_path);
- //int x,y,w,h;
evas_object_geometry_get(this->activity_image, &x, &y, &w, &h);
DBG("Dim: %d %d %d %d", x, y, w, h);
elm_naviframe_item_pop(this->view->navi);
activity_stop_recognition(this->handle);
activity_release(this->handle);
- RETM_IF(nRet != ACTIVITY_ERROR_NONE, "activity_start_recognition failed for activity type = %s",_motion_get_activity_type(activity_type));
+ char * error_string = _motion_get_activity_type(activity_type);
+ RETM_IF_CLEANUP(nRet != ACTIVITY_ERROR_NONE, "activity_start_recognition failed for activity type = %s", SAFE_DELETE(error_string), error_string);
+ SAFE_DELETE(error_string);
}
}
DBG("activity_recognition_callback_check_type");
RETM_IF(NULL == user_data, "User data is NULL");
motion_detection_view *this = (motion_detection_view*)user_data;
- snprintf(label, sizeof(label), "%s : %s" , "Activity Status is : ", _motion_get_activity_type(activity));
+ char* error_string = NULL;
+ error_string = _motion_get_activity_type(activity);
+ snprintf(label, sizeof(label), "%s : %s" , "Activity Status is : ", error_string);
+ SAFE_DELETE(error_string);
ui_utils_label_set_text(this->activity_label, label, "left");
return;
}
mtp_object_h *folder_list2;
int folder_count2;
res = mtp_get_object_handles(this->mtp_devices[i], this->mtp_storages[j], MTP_FILETYPE_FOLDER, folder_list[k], &folder_list2, &folder_count2);
+ RETM_IF(res != MTP_ERROR_NONE, "mtp_get_object_handles > Error = %s", get_mtp_info_error(res));
res = mtp_get_object_handles(this->mtp_devices[i], this->mtp_storages[j], MTP_FILETYPE_JPEG, folder_list2[folder_count2 >0 ? folder_count2-1:0], &this->file_list, &file_count);
+ RETM_IF(res != MTP_ERROR_NONE, "mtp_get_object_handles > Error = %s", get_mtp_info_error(res));
char* folder_name2;
mtp_objectinfo_get_file_name(this->mtp_devices[i], folder_list2[folder_count2 >0 ? folder_count2-1:0], &folder_name2);
for (k = 0; k < file_count; k++)
{
mtp_data *data = (mtp_data*) malloc(sizeof(mtp_data));
+ RETM_IF(data == NULL,"data is null");
deallocate_me[count++] = data;
static char* get_mtp_storage_type(mtp_storage_type_e type_e)
{
- char* type_str;
+ char* type_str="Unknown Type";
switch(type_e){
case MTP_STORAGE_TYPE_UNDEFINED:
type_str = "MTP_STORAGE_TYPE_UNDEFINED";
type_str = "MTP_STORAGE_TYPE_REMOVABLE_RAM";
break;
- default:
- type_str = "Unknown Type";
- break;
}
return type_str;
DBG("Image Path %s", image_path);
res = mtp_get_object(device_handle, file_handle, image_path);
- RETM_IF(res != MTP_ERROR_NONE, "mtp_get_object fail > Error = %s", get_mtp_info_error(res));
+ RETM_IF_CLEANUP(res != MTP_ERROR_NONE, "mtp_get_object fail > Error = %s", SAFE_DELETE(image_path), get_mtp_info_error(res));
Evas_Object* image = ui_utils_create_image(this->view->layout, image_path);
+ SAFE_DELETE(image_path);
elm_object_part_content_set(this->view->layout, "mtp_image_view", image);
}
static char* get_mtp_file_type_str(mtp_filetype_e file_type){
- char* type_str;
+ char* type_str = "Unknown Type";
switch (file_type) {
case MTP_FILETYPE_FOLDER:
type_str = "MTP_FILETYPE_FOLDER";
case MTP_FILETYPE_ALL_IMAGE:
type_str = "MTP_FILETYPE_ALL_IMAGE";
break;
- default:
- type_str = "Unknown Type";
- break;
}
return type_str;
{
int ret = 0;
app_control_h service = NULL;
- app_control_create(&service);
+ ret = app_control_create(&service);
+ if ( ret != APP_CONTROL_ERROR_NONE)
+ {
+ DBG("app_control_create failed!");
+ return -1;
+ }
if (service == NULL)
{
DBG("service_create failed!");
- return 0;
+ return -1;
+ }
+ ret = app_control_set_operation(service, "http://tizen.org/appcontrol/operation/setting/nfc");
+ if ( ret != APP_CONTROL_ERROR_NONE)
+ {
+ DBG("app_control_set_operation failed!");
+ return -1;
+ }
+ ret = app_control_add_extra_data(service, "type", "nfc");
+ if ( ret != APP_CONTROL_ERROR_NONE)
+ {
+ DBG("app_control_add_extra_data failed!");
+ return -1;
}
- app_control_set_operation(service, "http://tizen.org/appcontrol/operation/setting/nfc");
- app_control_add_extra_data(service, "type", "nfc");
ret = app_control_send_launch_request(service, NULL, NULL);
-
- app_control_destroy(service);
if (ret == APP_CONTROL_ERROR_NONE)
{
DBG("Succeeded to NFC On/Off app!");
- return 0;
}
else
{
DBG("Failed to relaunch NFC On/Off app!");
- return -1;
+ ret = app_control_destroy(service);
+ if (ret != APP_CONTROL_ERROR_NONE)
+ {
+ DBG("app_control_destroy Fail");
+ }
+ return -1;
}
+
+ ret = app_control_destroy(service);
+ if (ret != APP_CONTROL_ERROR_NONE)
+ {
+ DBG("app_control_destroy Fail");
+ return -1;
+ }
+
return 0;
}
*/
static char* get_nfc_tag_name(nfc_tag_type_e type)
{
- char* type_name;
+ char* type_name = "UNKNOWN_TYPE";
switch(type)
{
case NFC_NFCIP1_INITIATOR:
type_name = "NFC_NFCIP1_INITIATOR";
break;
- default:
- type_name = "UNKNOWN_TYPE";
- break;
-
}
return type_name;
}
this = (nfc_view*)user_data;
RETM_IF(NULL == this, "view is NULL");
- if(result != NFC_ERROR_NONE)
- {
- ui_utils_show_toast(get_nfc_string_error(result), this->view->layout, 3);
- }
ret = nfc_ndef_message_get_record_count(message, &count);
RETM_IF(ret != NFC_ERROR_NONE, "nfc_ndef_message_get_record_count failed with error: %s", get_nfc_error(ret));
res = dnssd_service_get_name(remote_service, &service_name);
RETM_IF(res != DNSSD_ERROR_NONE, "dnssd_service_get_name fail > Error = %s", get_dns_sd_error(res));
- if(service_name != NULL && sizeof(service_name) >0)
+ if(service_name != NULL)
{
str = format_string("service name: %s", service_name);
elm_list_item_append(this->list, str, NULL, NULL, NULL, NULL);
res = dnssd_service_get_type(remote_service, &service_type);
RETM_IF(res != DNSSD_ERROR_NONE, "dnssd_service_get_type fail > Error = %s", get_dns_sd_error(res));
- if(service_type != NULL && sizeof(service_type) >0)
+ if(service_type != NULL)
{
str = format_string("service type: %s", service_type);
elm_list_item_append(this->list, str, NULL, NULL, NULL, NULL);
res = dnssd_service_get_ip(remote_service, &ipv4, &ipv6);
RETM_IF(res != DNSSD_ERROR_NONE, "dnssd_service_get_ip fail > Error = %s", get_dns_sd_error(res));
- if(ipv4 != NULL && sizeof(ipv4) >0)
+ if(ipv4 != NULL)
{
str = format_string("ipv4: %s", ipv4);
elm_list_item_append(this->list, str, NULL, NULL, NULL, NULL);
SAFE_DELETE(str);
}
- if(ipv6 != NULL && sizeof(ipv6) >0)
+ if(ipv6 != NULL)
{
str = format_string("ipv6: %s", ipv6);
elm_list_item_append(this->list, str, NULL, NULL, NULL, NULL);
RETM_IF(res != DNSSD_ERROR_NONE, "dnssd_destroy_local_service fail > Error = %s", get_dns_sd_error(res));
res = dnssd_service_unset_record(view->dnssd_local_service, 16);
+ RETM_IF(res != DNSSD_ERROR_NONE, "dnssd_service_unset_record > Error = %s", get_dns_sd_error(res));
}
if(view->is_btn_browse_clicked == true)
{
size_t idx = 0;
char* token = strtok(a_str, delim);
+ RETVM_IF(token == NULL, NULL,"strtok failed");
while (token)
{
- RETVM_IF(idx >= count, NULL, "idx >= count");
- *(result + idx++) = strdup(token);
- token = strtok(0, delim);
+ if(idx < count)
+ {
+ *(result + idx++) = strdup(token);
+ token = strtok(0, delim);
+ }
+ else
+ {
+ break;
+ }
}
*(result + idx) = 0;
}
RETM_IF(NULL == a, "a is NULL");
DBG("strip json: %s", a);
parser = json_parser_new();
- RETM_IF(NULL == parser, "parser is NULL");
+ RETM_IF_CLEANUP(NULL == parser, "parser is NULL",SAFE_DELETE(a));
+
gboolean result = json_parser_load_from_data(parser, a, strlen(a), &error);
//DBG("json_parser_load_from_data error = %s", (char*)error->message);
if(result)
this->google_pic = picture;
this->google_gender = gender;
}
-
+ SAFE_DELETE(a);
}
RETM_IF(NULL == this, "view is NULL");
DBG("value: %d", event_type);
+ ui_utils_label_set_text(this->packagemanager_label, "unknown state", "left");
switch (event_type)
{
case PACKAGE_MANAGER_EVENT_TYPE_UPDATE:
ui_utils_label_set_text(this->packagemanager_label, "Update event type", "left");
break;
- default:
- ui_utils_label_set_text(this->packagemanager_label, "unknown state", "left");
- break;
+
}
+
+ ui_utils_label_set_text(this->packagemanagerstate_label, "unknown state", "left");
switch(event_state)
{
case PACKAGE_MANAGER_EVENT_STATE_STARTED:
case PACKAGE_MANAGER_EVENT_STATE_FAILED:
ui_utils_label_set_text(this->packagemanagerstate_label, "Failed event state", "left");
break;
- default:
- ui_utils_label_set_text(this->packagemanagerstate_label, "unknown state", "left");
- break;
}
return ;
}
Elm_Object_Item* it;
this->all = (view_item*)malloc(sizeof(view_item));
+ RETM_IF(this->all == NULL, "malloc failed");
+
this->all->uri = NULL;
this->all->mime = "*/*";
it = elm_list_item_append(this->data_list, "All", NULL, NULL, _view, this->all);
Elm_Object_Item* it;
this->image = (view_item*)malloc(sizeof(view_item));
+ RETM_IF(this->image == NULL, "malloc failed");
this->image->uri = NULL;
this->image->mime = "image/*";
it = elm_list_item_append(this->data_list, "Image", NULL, NULL, _view, this->image);
Elm_Object_Item* it;
this->video = (view_item*)malloc(sizeof(view_item));
+ RETM_IF(this->video == NULL, "malloc failed");
this->video->uri = NULL;
this->video->mime = "video/*";
it = elm_list_item_append(this->data_list, "Video", NULL, NULL, _view, this->video);
Elm_Object_Item* it;
this->audio = (view_item*)malloc(sizeof(view_item));
+ RETM_IF(this->audio == NULL, "malloc failed");
this->audio->uri = NULL;
this->audio->mime = "audio/*";
it = elm_list_item_append(this->data_list, "Audio", NULL, NULL, _view, this->audio);
{
this->http = (view_item*)malloc(sizeof(view_item));
+ RETM_IF(this->http == NULL, "malloc failed");
this->http->uri = PICK_VIEW_URL_HTTP;
this->http->mime = NULL;
it = elm_list_item_append(this->data_list, PICK_VIEW_URL_HTTP, NULL, NULL, _view, this->http);
this->https = (view_item*)malloc(sizeof(view_item));
+ RETM_IF(this->https == NULL, "malloc failed");
this->https->uri = PICK_VIEW_URL_HTTPS;
this->https->mime = NULL;
it = elm_list_item_append(this->data_list, PICK_VIEW_URL_HTTPS, NULL, NULL, _view, this->https);
{
this->all = (view_item*)malloc(sizeof(view_item));
+ RETM_IF(this->all == NULL, "malloc failed");
this->all->uri = NULL;
this->all->mime = "*/*";
it = elm_list_item_append(this->data_list, "All", NULL, NULL, _view, this->all);
this->image = (view_item*)malloc(sizeof(view_item));
+ RETM_IF(this->image == NULL, "malloc failed");
this->image->uri = NULL;
this->image->mime = "image/*";
it = elm_list_item_append(this->data_list, "Image", NULL, NULL, _view, this->image);
this->video = (view_item*)malloc(sizeof(view_item));
+ RETM_IF(this->video == NULL, "malloc failed");
this->video->uri = NULL;
this->video->mime = "video/*";
it = elm_list_item_append(this->data_list, "Video", NULL, NULL, _view, this->video);
this->audio = (view_item*)malloc(sizeof(view_item));
+ RETM_IF(this->audio == NULL, "malloc failed");
this->audio->uri = NULL;
this->audio->mime = "audio/*";
it = elm_list_item_append(this->data_list, "Audio", NULL, NULL, _view, this->audio);
//elm_list_clear(this->data_list);
this->bmp = (view_item*)malloc(sizeof(view_item));
+ RETM_IF(this->bmp == NULL, "malloc failed");
this->bmp->uri = format_string("file://%s%s", this->shared_res_path, PICK_VIEW_IMAGE_BMP);
DBG("PICK_VIEW_IMAGE_BMP:%s", this->bmp->uri);
this->bmp->mime = "image/bmp";
//elm_object_item_data_set(it, "image/bmp");
this->jpg = (view_item*)malloc(sizeof(view_item));
+ RETM_IF(this->jpg == NULL, "malloc failed");
this->jpg->uri = format_string("file://%s%s", this->shared_res_path, PICK_VIEW_IMAGE_JPG);
DBG("PICK_VIEW_IMAGE_JPG:%s", this->jpg->uri);
this->jpg->mime = "image/jpeg";
//elm_object_item_data_set(it, "image/jpeg");
this->gif = (view_item*)malloc(sizeof(view_item));
+ RETM_IF(this->gif == NULL, "malloc failed");
this->gif->uri = format_string("file://%s%s", this->shared_res_path, PICK_VIEW_IMAGE_GIF);
DBG("PICK_VIEW_IMAGE_GIF:%s", this->gif->uri);
this->gif->mime = "image/gif";
//elm_object_item_data_set(it, "image/gif");
this->png = (view_item*)malloc(sizeof(view_item));
+ RETM_IF(this->png == NULL, "malloc failed");
this->png->uri = format_string("file://%s%s", this->shared_res_path, PICK_VIEW_IMAGE_PNG);
DBG("PICK_VIEW_IMAGE_PNG:%s", this->png->uri);
this->png->mime = "image/png";
//elm_list_clear(this->data_list);
this->aac = (view_item*)malloc(sizeof(view_item));
+ RETM_IF(this->aac == NULL, "malloc failed");
this->aac->uri = format_string("file://%s%s", this->shared_res_path, PICK_VIEW_SOUND_AAC);
DBG("PICK_VIEW_SOUND_AAC:%s", this->aac->uri);
this->aac->mime = "audio/aac";
//elm_object_item_data_set(it, "image/bmp");
this->amr = (view_item*)malloc(sizeof(view_item));
+ RETM_IF(this->amr == NULL, "malloc failed");
this->amr->uri = format_string("file://%s%s", this->shared_res_path, PICK_VIEW_SOUND_AMR);
DBG("PICK_VIEW_SOUND_AMR:%s", this->amr->uri);
this->amr->mime = "audio/amr";
//elm_object_item_data_set(it, "image/jpeg");
this->mp3 = (view_item*)malloc(sizeof(view_item));
+ RETM_IF(this->mp3 == NULL, "malloc failed");
this->mp3->uri = format_string("file://%s%s", this->shared_res_path, PICK_VIEW_SOUND_MP3);
DBG("PICK_VIEW_SOUND_MP3:%s", this->mp3->uri);
this->mp3->mime = "audio/mp3";
//elm_object_item_data_set(it, "image/gif");
this->wav = (view_item*)malloc(sizeof(view_item));
+ RETM_IF(this->wav == NULL, "malloc failed");
this->wav->uri = format_string("file://%s%s", this->shared_res_path, PICK_VIEW_SOUND_WAV);
DBG("PICK_VIEW_SOUND_WAV:%s", this->wav->uri);
this->wav->mime = "audio/wav";
//elm_list_clear(this->data_list);
this->gp3 = (view_item*)malloc(sizeof(view_item));
+ RETM_IF(this->gp3 == NULL, "malloc failed");
this->gp3->uri = format_string("file://%s%s", this->shared_res_path, PICK_VIEW_VIDEO_3GP);
DBG("PICK_VIEW_VIDEO_3GP:%s", this->gp3->uri);
this->gp3->mime = "video/3gpp";
//elm_object_item_data_set(it, "image/bmp");
this->mp4 = (view_item*)malloc(sizeof(view_item));
+ RETM_IF(this->mp4 == NULL, "malloc failed");
this->mp4->uri = format_string("file://%s%s", this->shared_res_path, PICK_VIEW_VIDEO_MP4);
DBG("PICK_VIEW_VIDEO_MP4:%s", this->mp4->uri);
this->mp4->mime = "video/mp4";
static char* get_xml_element_value (xmlDocPtr doc, xmlNodePtr cur, const char* tag)
{
- xmlChar *key;
- char* str;
+ xmlChar *key = NULL;
+ char* str = NULL;
cur = cur->xmlChildrenNode;
while (cur != NULL) {
if ((!xmlStrcmp(cur->name, (const xmlChar *)tag))) {
static void create_notification_template()
{
-
- DBG("TEST %s", get_shared_resource_path("test.wav"));
+ char *resource_path = NULL;
+ resource_path = get_shared_resource_path("test.wav");
+ DBG("TEST %s", resource_path);
+ SAFE_DELETE(resource_path);
notification_h n = NULL;
n = notification_create(NOTIFICATION_TYPE_NOTI);
+ notification_set_text(n, NOTIFICATION_TEXT_TYPE_TITLE, "template title", NULL, NOTIFICATION_TEXT_TYPE_NONE);
+ notification_set_text(n, NOTIFICATION_TEXT_TYPE_CONTENT, "template content", NULL, NOTIFICATION_TEXT_TYPE_NONE);
+
+ resource_path = get_shared_resource_path("test.wav");
+ notification_set_sound(n, NOTIFICATION_SOUND_TYPE_USER_DATA, resource_path);
+ SAFE_DELETE(resource_path);
+
+ resource_path = get_shared_resource_path("icon.png");
+ notification_set_image(n, NOTIFICATION_IMAGE_TYPE_ICON, resource_path);
+ SAFE_DELETE(resource_path);
- notification_set_text(n, NOTIFICATION_TEXT_TYPE_TITLE, "template title", NULL, NOTIFICATION_TEXT_TYPE_NONE);
- notification_set_text(n, NOTIFICATION_TEXT_TYPE_CONTENT, "template content", NULL, NOTIFICATION_TEXT_TYPE_NONE);
- notification_set_sound(n, NOTIFICATION_SOUND_TYPE_USER_DATA, get_shared_resource_path("test.wav"));
- notification_set_image(n, NOTIFICATION_IMAGE_TYPE_ICON, get_shared_resource_path("icon.png"));
- notification_set_image(n, NOTIFICATION_IMAGE_TYPE_BACKGROUND, get_shared_resource_path("background.png"));
- notification_save_as_template(n, "template_test");
+ resource_path = get_shared_resource_path("background.png");
+ notification_set_image(n, NOTIFICATION_IMAGE_TYPE_BACKGROUND, resource_path);
+ SAFE_DELETE(resource_path);
- notification_free(n);
+ notification_save_as_template(n, "template_test");
+ notification_free(n);
}
/**
int i = 0;
for (i = 0; i < message_length; i++) {
id = calloc(sizeof(item_data_s), 1);
+ RETM_IF(id == NULL,"id is null");
+
id->index = i;
/* Append genlist item for list */
id->item = elm_genlist_item_append(genlist, itc, id, NULL, ELM_GENLIST_ITEM_NONE, NULL, this);
// adding header
curl_err = curl_easy_setopt(this->curl_handle, CURLOPT_HTTPHEADER, header_list);
- RETM_IF(curl_err != CURLE_OK, "curl_easy_setopt - Adding header_list Failed %d", curl_err);
+ RETM_IF_CLEANUP(curl_err != CURLE_OK, "curl_easy_setopt - Adding header_list Failed %d", SAFE_DELETE(post_data), curl_err);
// adding body/post
curl_err = curl_easy_setopt(this->curl_handle, CURLOPT_POSTFIELDS, post_data);
- RETM_IF(curl_err != CURLE_OK, "curl_easy_setopt - Adding post_data Failed %d", curl_err);
-
-
+ RETM_IF_CLEANUP(curl_err != CURLE_OK, "curl_easy_setopt - Adding post_data Failed %d", SAFE_DELETE(post_data), curl_err);
char* server = push_service_get_server_address(this->reg_id);
DBG("Server Address: %s", server);
curl_err = curl_easy_setopt(this->curl_handle, CURLOPT_URL, server);
- RETM_IF(curl_err != CURLE_OK, "curl_easy_setopt - Adding CURLOPT_URL Failed %d", curl_err);
+ RETM_IF_CLEANUP(curl_err != CURLE_OK, "curl_easy_setopt - Adding CURLOPT_URL Failed %d", SAFE_DELETE(post_data), curl_err);
curl_easy_setopt(this->curl_handle, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(this->curl_handle, CURLOPT_WRITEFUNCTION, _curl_response_cb);
ret = connection_create(&connection);
if (CONNECTION_ERROR_NONE != ret) {
DBG("fail to create conn_handle[%d]", ret);
+ SAFE_DELETE(post_data);
return;
}
DBG("Distance: %f %f %f ", distance, SENSOR_PROXIMITY_NEAR, SENSOR_PROXIMITY_FAR);
if(values[0] == 0.0f)
{
- const char *file_path;
+ const char *file_path = NULL;
file_path = get_resource_path(view->view->tbt_info->file_name);
view->proximity_off_image = ui_utils_create_image(view->view->layout, file_path);
- RETM_IF(NULL == view->proximity_off_image, "create of proximity_on_image failed");
+ RETM_IF_CLEANUP(NULL == view->proximity_off_image, "create of proximity_on_image failed", SAFE_DELETE(file_path));
+
DBG("File loaded successfull");
+ SAFE_DELETE(file_path);
elm_object_part_content_set(view->view->layout, "image_view", view->proximity_off_image);
if (values[0] >= 1.0f)
{
- const char *file_path;
+ const char *file_path = NULL;
file_path = get_resource_path(view->view->tbt_info->extra_file_name);
view->proximity_on_image = ui_utils_create_image(view->view->layout, file_path);
- RETM_IF(NULL == view->proximity_on_image, "create of proximity_on_image failed");
+ RETM_IF_CLEANUP(NULL == view->proximity_on_image, "create of proximity_on_image failed", SAFE_DELETE(file_path));
+
DBG("File loaded successfull");
+ SAFE_DELETE(file_path);
elm_object_part_content_set(view->view->layout, "image_view", view->proximity_on_image);
DBG("icon path = %s",icon);
DBG("Inside shortcut_add_to_home %s, allow_duplicate = %d, result = %d, %s", get_shortcut_error(result), allow_duplicate, result, get_error_message(result));
+ SAFE_DELETE(icon);
}
char* get_shortcut_error(int err){
soundmanager_view *this = NULL;
this = (soundmanager_view*) user_data;
+ char* status = "Unknown status";
+ char* direction = "left";
+
DBG("changed_info: %d", changed_info);
switch(changed_info)
{
case SOUND_DEVICE_CHANGED_INFO_STATE :
- ui_utils_label_set_text(this->info_label, "State of the device was changed", "left");
+ status = "State of the device was changed";
break;
case SOUND_DEVICE_CHANGED_INFO_IO_DIRECTION:
- ui_utils_label_set_text(this->info_label, "IO direction of the device was changed", "left");
- break;
- default:
- ui_utils_label_set_text(this->info_label, "Unknown status", "left");
+ status = "IO direction of the device was changed";
break;
}
+ ui_utils_label_set_text(this->info_label, status, direction);
}
RETVM_IF(!this, NULL, "calloc failed");
RETVM_IF(NULL == this->view, NULL, "navi is null");
- this->audio_icon = ui_utils_create_image(this->view->layout, get_resource_path("images/audio-icon.png"));
- RETVM_IF(NULL == this->audio_icon, false, "create of layout elements failed");
+ char* image_path = NULL;
+ image_path = get_resource_path("images/audio-icon.png");
+ this->audio_icon = ui_utils_create_image(this->view->layout, image_path);
+ RETVM_IF_CLEANUP(NULL == this->audio_icon, false, "create of layout elements failed", SAFE_DELETE(image_path));
+ SAFE_DELETE(image_path);
+
elm_object_part_content_set(this->view->layout, "icon_view", this->audio_icon);
if(this->view->tbt_info->apptype == TBT_APP_SOUND_VOLUME)
player_h player = NULL;
int ret ;
+ char* file_path = NULL;
ret = player_create(&player);
RETVM_IF(ret != PLAYER_ERROR_NONE, NULL, "player_create fail > Error = %s", get_player_error(ret));
DBG( "player_set_looping fail > Error = %s", get_player_error(ret));
}
- ret = player_set_uri(player, get_resource_path(this->view->tbt_info->file_name));
+ file_path = get_resource_path(this->view->tbt_info->file_name);
+ ret = player_set_uri(player, file_path);
+ SAFE_DELETE(file_path);
+
if(ret != PLAYER_ERROR_NONE)
{
DBG( "player_set_uri fail > Error = %s", get_player_error(ret));
RETM_IF(NULL == view, "view is NULL");
double val = elm_slider_value_get(obj);
- player_set_volume(view->player, val, val);
+ int ret = player_set_volume(view->player, val, val);
+ RETM_IF(ret != PLAYER_ERROR_NONE, "player_set_volume fail > Error = %s", get_player_error(ret));
}
static char* get_stt_state_str(stt_state_e state)
{
- char* state_str;
+ char* state_str = "UNKNOWN_STATE";
switch (state)
{
case STT_STATE_CREATED:
case STT_STATE_PROCESSING:
state_str = "STT_STATE_PROCESSING";
break;
- default:
- state_str = "UNKNOWN_STATE";
- break;
- }
+ }
return state_str;
}
systemsettings_view *systemsettings_view_add(Evas_Object *navi, tbt_info *tbt_info, Elm_Object_Item *item)
{
RETVM_IF(NULL == navi, NULL, "navi is null");
- int ret, value;
+ int ret, value = -1;
int timevalue = 0;
- bool bvalue;
+ bool bvalue = false;
+
systemsettings_view *this = NULL;
this = calloc(1, sizeof(systemsettings_view));
RETVM_IF(!this, NULL, "calloc failed");
static char* get_tts_state_str(tts_state_e state)
{
+ char* state_str = "UNKNOWN_STATE";
- char* state_str;
switch(state)
{
case TTS_STATE_CREATED:
case TTS_STATE_PAUSED:
state_str = "TTS_STATE_PAUSED";
break;
- default:
- state_str = "UNKNOWN_STATE";
- break;
}
return state_str;
}
+
static void _btn_tts_pressed_cb(void *data, Evas_Object *obj, void *event_info)
{
DBG("_btn_tts_pressed_cb");
{
calc_coordinate(this);
+ char* file_path = NULL;
this->ui_element = elm_image_add(this->view->layout);
- elm_image_file_set(this->ui_element, get_resource_path(this->view->tbt_info->file_name), NULL);
+
+ file_path = get_resource_path(this->view->tbt_info->file_name);
+ elm_image_file_set(this->ui_element, file_path, NULL);
+ SAFE_DELETE(file_path);
+
elm_image_no_scale_set(this->ui_element, EINA_TRUE);
elm_image_resizable_set(this->ui_element, EINA_TRUE, EINA_TRUE);
elm_image_smooth_set(this->ui_element, EINA_FALSE);
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 = "usb_host_viewer";
tbt_info->layout_file = get_edje_path("usb_host_viewer.edj");
common_view_add(navi, tbt_info, item, this->view, _app_destroy_cb, this);
RETVM_IF(NULL == this->view, NULL, "navi is null");
- //ui_utils_guide_instruction_popup_button(navi, "* Please run "devicectl usb-host-test start" or "devicectl usb-host-test stop" command in sdb shell<br/><b>Note:You can also refer info section</b><br/>");
-
ret = usb_host_create(&hCtxHandle);
RETVM_IF(ret != USB_HOST_ERROR_NONE && ret != USB_HOST_ERROR_NOT_SUPPORTED, NULL, "usb_host_create failed : %s", get_usbhost_error(ret));
if(ret == USB_HOST_ERROR_NOT_SUPPORTED)