*
* Copyright 2012 Samsung Electronics Co., Ltd
-* Licensed under the Flora License, Version 1.0 (the "License");
+* Licensed under the Flora License, Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
const char *space = " ";
int len = strlen(filewithpath);
- if (len > 20) {
+ if (len >= 20) {
strptr = (char *) filewithpath + (len - 20);
start = 0;
} else if (len < 20) {
}
strncpy((char *) filename, space, strlen(space));
- strncpy((char *) filename + start, strptr, 50);
+ if(strptr)
+ strncpy((char *) filename + start, strptr, 50);
return (char *) filename;
#endif
{
__WFD_APP_FUNC_ENTER__;
- if(result == APP_CONTROL_RESULT_FAILED) {
+ if (result == APP_CONTROL_RESULT_FAILED) {
WFD_APP_LOG(WFD_APP_LOG_ERROR, "User cancel to reconnect screen mirroring\n");
#ifdef WFD_SCREEN_MIRRORING_ENABLED
ad->screen_mirroring_state = WFD_POP_SCREEN_MIRROR_NONE;
size_t size = 0;
- WFD_RET_IF(data == NULL || key == NULL || type == 0, , "Invialid parameter!");
+ WFD_RET_IF(data == NULL || key == NULL || type == 0, "Invialid parameter!");
app_control_h control = data;
- if (type == BUNDLE_TYPE_STR)
- {
+ if (type == BUNDLE_TYPE_STR) {
bundle_keyval_get_basic_val((bundle_keyval_t *) kv, &ptr, &size);
- buff = malloc(sizeof(char)* size + 1);
+ buff = malloc(sizeof(char) * size + 1);
+ if (buff == NULL) {
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to allocate memory");
+ __WFD_APP_FUNC_EXIT__;
+ return;
+ }
snprintf(buff, size + 1, "%s", ((char*) ptr));
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Found STR -KEY: %s, VAL: %s, SIZE: %d", key, buff, size);
free(buff);
} else if (type == BUNDLE_TYPE_BYTE) {
bundle_keyval_get_basic_val((bundle_keyval_t *) kv, &ptr, &size);
- buff = malloc(sizeof(char)* size + 1);
+ buff = malloc(sizeof(char) * size + 1);
+ if (buff == NULL) {
+ WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to allocate memory");
+ __WFD_APP_FUNC_EXIT__;
+ return;
+ }
snprintf(buff, size + 1, "%s", ((char*) ptr));
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Found STR -KEY: %s, VAL: %s, SIZE: %d", key, buff, size);
char *launch_type = NULL;
bundle_get_str(data, "-t", &launch_type);
- if (!strcmp(launch_type, "reconnect_by_connecting_wifi_ap")) {
+ if (!strcmp(launch_type, "reconnect_by_connecting_wifi_ap"))
ret = app_control_send_launch_request(control, __launch_app_result_cb, NULL);
- } else {
+ else
ret = app_control_send_launch_request(control, NULL, NULL);
- }
if (ret != APP_CONTROL_ERROR_NONE) {
WFD_APP_LOG(WFD_APP_LOG_ERROR, "app_control_send_launch_request() is failed : %d", ret);
ad->noti_screen_mirroring_play = NULL;
}
- if(ad->noti_screen_mirroring_on != NULL) {
+ if (ad->noti_screen_mirroring_on != NULL) {
noti_err = notification_free(ad->noti_screen_mirroring_on);
WFD_RET_IF(noti_err != NOTIFICATION_ERROR_NONE, "Failed to notification_free. [%d]", noti_err);
}
ad->noti_screen_mirroring_on = NULL;
}
- if(ad->noti_screen_mirroring_play != NULL) {
+ if (ad->noti_screen_mirroring_play != NULL) {
noti_err = notification_free(ad->noti_screen_mirroring_play);
WFD_RET_IF(noti_err != NOTIFICATION_ERROR_NONE, "Failed to notification_free. [%d]", noti_err);
}
#ifdef WFD_SCREEN_MIRRORING_ENABLED
/* checking Screen Mirroring */
if (vconf_get_int(VCONFKEY_SCREEN_MIRRORING_STATE, &screen_mirroring_status) < 0)
- {
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to get vconf VCONFKEY_SCREEN_MIRRORING_STATE\n");
- }
+
WFD_APP_LOG(WFD_APP_LOG_LOW, "screen_mirroring_status: %d\n", screen_mirroring_status);
- if(screen_mirroring_status > VCONFKEY_SCREEN_MIRRORING_DEACTIVATED) {
+ if (screen_mirroring_status > VCONFKEY_SCREEN_MIRRORING_DEACTIVATED) {
res = vconf_set_int(VCONFKEY_SCREEN_MIRRORING_STATE, VCONFKEY_SCREEN_MIRRORING_DEACTIVATED);
- if (res < 0) {
+ if (res < 0)
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to set vconf VCONFKEY_SCREEN_MIRRORING_STATE\n");
- }
}
#endif
return;
}
- if(vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_CUSTMODE_CPU, &cup_limit_mode) < 0) {
+ if (vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_CUSTMODE_CPU, &cup_limit_mode) < 0) {
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to get vconf VCONFKEY_SETAPPL_PWRSV_CUSTMODE_CPU\n");
return;
}
- if (vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &power_mode) < 0)
- {
+ if (vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &power_mode) < 0) {
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to get vconf VCONFKEY_SETAPPL_PSMODE\n");
return;
}
return;
}
- if (vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &power_mode) < 0)
- {
+ if (vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &power_mode) < 0) {
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to get vconf VCONFKEY_SETAPPL_PSMODE\n");
return;
}
bundle_free(b);
} else if (power_mode == SETTING_PSMODE_POWERFUL ||
power_mode == SETTING_PSMODE_ADVISOR){
- if(vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_CUSTMODE_CPU, &cup_limit_mode) < 0) {
+ if (vconf_get_bool(VCONFKEY_SETAPPL_PWRSV_CUSTMODE_CPU, &cup_limit_mode) < 0) {
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to get vconf VCONFKEY_SETAPPL_PWRSV_CUSTMODE_CPU\n");
return;
}
}
#endif
- if (vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_status) < 0)
- {
+ if (vconf_get_int(VCONFKEY_WIFI_STATE, &wifi_status) < 0) {
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to get vconf VCONFKEY_WIFI_STATE\n");
return;
}
WFD_RET_IF(NULL == ad, "NULL parameters.\n");
if (vconf_get_int(VCONFKEY_SCREEN_MIRRORING_STATE, &screen_mirroring_status) < 0)
- {
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to get vconf VCONFKEY_SCREEN_MIRRORING_STATE\n");
- }
WFD_APP_LOG(WFD_APP_LOG_ERROR, "VCONFKEY_SCREEN_MIRRORING_STATE:%d\n", screen_mirroring_status);
if (strnlen(ad->mac_addr_connecting, MACSTR_LENGTH) > 0) {
res = wifi_direct_reject_connection(ad->mac_addr_connecting);
- if (res != WIFI_DIRECT_ERROR_NONE) {
+ if (res != WIFI_DIRECT_ERROR_NONE)
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to reject connection(%d)", res);
- }
}
memset(ad->mac_addr_connecting, 0x00, MACSTR_LENGTH);
wfd_destroy_popup();
/* remove callback for flight mode */
ret = vconf_ignore_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE, _wfd_flight_mode_changed);
- if (ret == -1) {
+ if (ret == -1)
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to ignore vconf key callback for flight mode\n");
- }
#ifdef WFD_SCREEN_MIRRORING_ENABLED
/* remove callback for allshare cast */
ret = vconf_ignore_key_changed(VCONFKEY_SCREEN_MIRRORING_STATE, _wfd_allshare_cast_status_changed);
- if (ret == -1) {
+ if (ret == -1)
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to ignore vconf key callback for allshare cast\n");
- }
#endif
/* remove callback for wifi */
ret = vconf_ignore_key_changed(VCONFKEY_WIFI_STATE, _wfd_wifi_status_changed);
- if (ret == -1) {
+ if (ret == -1)
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to ignore vconf key callback for wifi\n");
- }
/* remove callback for power mode */
ret = vconf_ignore_key_changed(VCONFKEY_SETAPPL_PSMODE, _wfd_power_saving_mode_changed);
- if (ret == -1) {
+ if (ret == -1)
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to ignore vconf key callback for power mode\n");
- }
/* remove callback for cpu limit mode */
ret = vconf_ignore_key_changed(VCONFKEY_SETAPPL_PWRSV_CUSTMODE_CPU, _wfd_cpu_limit_mode_changed);
- if (ret == -1) {
+ if (ret == -1)
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to ignore vconf key callback for cpu limit mode\n");
- }
return 0;
}
if (ad->noti_screen_mirroring_on) {
noti_err = notification_free(ad->noti_screen_mirroring_on);
ad->noti_screen_mirroring_on = NULL;
- if (noti_err != NOTIFICATION_ERROR_NONE) {
+ if (noti_err != NOTIFICATION_ERROR_NONE)
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Fail to notification_free.(%d)\n", noti_err);
- }
}
if (ad->noti_screen_mirroring_play) {
noti_err = notification_free(ad->noti_screen_mirroring_play);
ad->noti_screen_mirroring_play = NULL;
- if (noti_err != NOTIFICATION_ERROR_NONE) {
+ if (noti_err != NOTIFICATION_ERROR_NONE)
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Fail to notification_free.(%d)\n", noti_err);
- }
}
#endif
if (ad->noti_wifi_direct_on) {
noti_err = notification_free(ad->noti_wifi_direct_on);
ad->noti_wifi_direct_on = NULL;
- if (noti_err != NOTIFICATION_ERROR_NONE) {
+ if (noti_err != NOTIFICATION_ERROR_NONE)
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Fail to notification_free.(%d)\n", noti_err);
- }
}
#endif
if (ad->noti_wifi_direct_connected) {
noti_err = notification_free(ad->noti_wifi_direct_connected);
ad->noti_wifi_direct_connected = NULL;
- if (noti_err != NOTIFICATION_ERROR_NONE) {
+ if (noti_err != NOTIFICATION_ERROR_NONE)
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Fail to notification_free.(%d)\n", noti_err);
- }
}
__WFD_APP_FUNC_EXIT__;
notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
WFD_RET_IF(ad->noti_wifi_direct_on, "Indicator already exists");
- if(ad->noti_wifi_direct_on != NULL) {
+ if (ad->noti_wifi_direct_on != NULL) {
noti_err = notification_free(ad->noti_wifi_direct_on);
WFD_RET_IF(noti_err != NOTIFICATION_ERROR_NONE, "Failed to notification_free. [%d]", noti_err);
}
return;
}
- if (vconf_get_int(VCONFKEY_SCREEN_MIRRORING_STATE, &screen_mirroring_status) < 0) {
+ if (vconf_get_int(VCONFKEY_SCREEN_MIRRORING_STATE, &screen_mirroring_status) < 0)
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to get vconf VCONFKEY_SCREEN_MIRRORING_STATE\n");
- }
WFD_APP_LOG(WFD_APP_LOG_LOW, "screen_mirroring_status: %d\n", screen_mirroring_status);
/* Set the vconf value to DEACTIVATED only when the previous vconf value is CONNECTED.
If the previous vconf value is ACTIVATED, it means that the Screen Mirroring UG changed that key already. So no need to change it. */
- if(screen_mirroring_status == VCONFKEY_SCREEN_MIRRORING_CONNECTED) {
+ if (screen_mirroring_status == VCONFKEY_SCREEN_MIRRORING_CONNECTED) {
result = vconf_set_int(VCONFKEY_SCREEN_MIRRORING_STATE, VCONFKEY_SCREEN_MIRRORING_DEACTIVATED);
- if (result < 0) {
+ if (result < 0)
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Failed to set vconf VCONFKEY_SCREEN_MIRRORING_STATE\n");
- }
+
notification_status_message_post(D_("IDS_SMR_POP_SCREEN_MIRRORING_HAS_BEEN_DISABLED"));
}
/* delete all notifications */
wfd_app_util_del_notification(ad);
- if(ad->noti_wifi_direct_connected!= NULL) {
+ if (ad->noti_wifi_direct_connected != NULL) {
noti_err = notification_free(ad->noti_wifi_direct_connected);
WFD_RET_IF(noti_err != NOTIFICATION_ERROR_NONE, "Failed to notification_free. [%d]", noti_err);
}
if (ad->noti_wifi_direct_connected) {
noti_err = notification_free(ad->noti_wifi_direct_connected);
ad->noti_wifi_direct_connected = NULL;
- if (noti_err != NOTIFICATION_ERROR_NONE) {
+ if (noti_err != NOTIFICATION_ERROR_NONE)
WFD_APP_LOG(WFD_APP_LOG_ERROR, "Fail to notification_free.(%d)\n", noti_err);
- }
}
__WFD_APP_FUNC_EXIT__;