From: Youngjae Shin Date: Thu, 21 May 2020 07:36:49 +0000 (+0900) Subject: revise log macro and pointer allign X-Git-Tag: submit/tizen/20200602.052302~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7df65e86fd28909d810f6c3e82e6a897b0576bf6;p=platform%2Fcore%2Fapi%2Fsystem-settings.git revise log macro and pointer allign Change-Id: Icb63bdc837bc1ef53f1ba666b234c74eff814213 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index c02b061..b26420b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,12 +25,16 @@ ADD_DEFINITIONS("-D_TZ_SYS_SHARE=\"${TZ_SYS_SHARE}\"") ADD_DEFINITIONS("-DSETTING_DEF_RES=\"${SETTING_DEF_RES}\"") IF(TIZEN_WEARABLE) - ADD_DEFINITIONS(-DTIZEN_WEARABLE) + ADD_DEFINITIONS(-DTIZEN_WEARABLE) ENDIF(TIZEN_WEARABLE) IF(TIZEN_MOBILE) - ADD_DEFINITIONS(-DTIZEN_MOBILE) + ADD_DEFINITIONS(-DTIZEN_MOBILE) ENDIF(TIZEN_MOBILE) +IF(STDOUT_LOG) + ADD_DEFINITIONS("-DSST_STDOUT") +ENDIF(STDOUT_LOG) + FILE(GLOB SRCS src/*.c) ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LIBRARIES}) diff --git a/common/sst.h b/common/sst.h index c142578..712c131 100644 --- a/common/sst.h +++ b/common/sst.h @@ -15,10 +15,5 @@ */ #pragma once -//#include "sst_log.h" - -#ifdef API -#undef API -#endif -#define API __attribute__((visibility("default"))) - +#include "sst_log.h" +#include "sst_define.h" diff --git a/common/sst_define.h b/common/sst_define.h new file mode 100644 index 0000000..69699cd --- /dev/null +++ b/common/sst_define.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#ifdef API +#undef API +#endif +#define API __attribute__((visibility("default"))) + +#ifndef SETTING_DEF_RES +#define SETTING_DEF_RES "/opt/usr/data/settings" +#warning "SETTING_DEF_RES is redefined" +#endif +#define DEF_RINGTONE_FILE_PATH SETTING_DEF_RES"/Ringtones" + +#define USR_RINGTONE_FILE_PATH "/home/owner/content/Sounds/Ringtones" +#define SST_RINGTONE_JSONFILE "/opt/home/owner/apps_rw/org.tizen.setting/data/.user-ringtones.json" + +#define SETTING_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf" +#define SETTING_DEFAULT_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf" + +#define SETTING_TIME_ZONEINFO_PATH "/usr/share/zoneinfo/" +#define SETTING_TIME_SHARE_LOCAL_PATH "/usr/share/locale" +#define SETTING_TZONE_SYMLINK_PATH "/opt/etc/localtime" \ No newline at end of file diff --git a/common/sst_log.h b/common/sst_log.h index 58adb69..688c5cb 100644 --- a/common/sst_log.h +++ b/common/sst_log.h @@ -54,10 +54,8 @@ #define __WARN(fmt, arg...) SLOGW(fmt, ##arg) #define __ERR(fmt, arg...) SLOGE(fmt, ##arg) #define __SECU_DBG(fmt, arg...) SECURE_SLOGD(fmt, ##arg) -#define __SECU_INFO(fmt, arg...) SECURE_SLOGI(fmt, ##arg) #endif /* SST_STDOUT */ - #ifdef SST_TEST #define _DBG(fmt, arg...) __DBG(SST_LOG_BROWN "" SST_LOG_END fmt, ##arg) #define _INFO(fmt, arg...) __INFO(SST_LOG_BLUE "" SST_LOG_END fmt, ##arg) @@ -77,10 +75,7 @@ #define WARN(fmt, arg...) _WARN(fmt, ##arg) #define ERR(fmt, arg...) _ERR(fmt, ##arg) #define INFO(fmt, arg...) _INFO(fmt, ##arg) -#define SST_SECURE_DEBUG(fmt, arg...) __SECU_DBG(SST_LOG_BROWN fmt SST_LOG_END, ##arg) -#define SST_SECURE_TRACE(fmt, arg...) __SECU_INFO(SST_LOG_GREEN fmt SST_LOG_END, ##arg) -#define SST_SECURE_BEGIN __SECU_DBG(SST_LOG_BLUE "ENTER FUNCTION: %s\n" SST_LOG_END, __FUNCTION__) -#define SST_SECURE_END __SECU_DBG(SST_LOG_BLUE "EXIT FUNCTION: %s\n" SST_LOG_END, __FUNCTION__) +#define SST_SECURE_TRACE(fmt, arg...) __SECU_DBG(SST_LOG_GREEN fmt SST_LOG_END, ##arg) #else /* SST_DEBUGGING */ #define DBG(fmt, arg...) diff --git a/include/system_settings.h b/include/system_settings.h index 5402076..7fd1473 100644 --- a/include/system_settings.h +++ b/include/system_settings.h @@ -32,7 +32,6 @@ extern "C" * @{ */ - /** * @brief Enumeration for system settings error. * @since_tizen 2.3 @@ -41,16 +40,15 @@ typedef enum { SYSTEM_SETTINGS_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ SYSTEM_SETTINGS_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */ - SYSTEM_SETTINGS_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< Internal I/O error */ - SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ - SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported @if MOBILE (Since 2.3.1) @endif */ + SYSTEM_SETTINGS_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< Internal I/O error */ + SYSTEM_SETTINGS_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */ + SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported @if MOBILE (Since 2.3.1) @endif */ SYSTEM_SETTINGS_ERROR_CALL_UNSUPPORTED_API = TIZEN_ERROR_NOT_SUPPORTED, /**< Not supported @if MOBILE (Since 2.3.1) @endif */ /* lock screen app error code */ SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE = TIZEN_ERROR_SYSTEM_SETTING | 0x01, /**< Current lock screen app set 'password' type */ } system_settings_error_e; - /** * @brief Enumeration for System Settings Key. * @since_tizen 2.3 @@ -65,7 +63,7 @@ typedef enum { SYSTEM_SETTINGS_KEY_EMAIL_ALERT_RINGTONE, /**< (string) The file path of the current email alert ringtone */ SYSTEM_SETTINGS_KEY_USB_DEBUGGING_ENABLED, /**< (bool) Indicates whether the USB debugging is enabled (Since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif) */ SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED, /**< (bool) Indicates whether the 3G data network is enabled (Since @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif) */ - SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP = SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED+2, /**< (string) Indicates lockscreen app pkg name */ + SYSTEM_SETTINGS_KEY_LOCKSCREEN_APP = SYSTEM_SETTINGS_KEY_3G_DATA_NETWORK_ENABLED + 2, /**< (string) Indicates lockscreen app pkg name */ SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE,/**< (string) The current system default font type (only support Get) */ SYSTEM_SETTINGS_KEY_LOCALE_COUNTRY, /**< (string) Indicates the current country setting in the _ syntax. The country setting is in the ISO 639-2 format, and the region setting is in the ISO 3166-1 alpha-2 format */ SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, /**< (string) Indicates the current language setting in the _ syntax. The language setting is in the ISO 639-2 format and the region setting is in the ISO 3166-1 alpha-2 format. */ @@ -107,7 +105,6 @@ typedef enum { SYSTEM_SETTINGS_LOCK_STATE_LAUNCHING_LOCK /**< Device is being locked */ } system_settings_idle_lock_state_e; - /** * @brief Enumeration for font size. * @since_tizen 2.3 @@ -130,8 +127,6 @@ typedef enum { SYSTEM_SETTINGS_UDS_ON_WHITELISTED, /**< UDS on and the app is whitelisted */ } system_settings_uds_state_e; - - /** * @brief Called when the system settings changes. * @since_tizen 2.3 @@ -177,7 +172,6 @@ int system_settings_set_value_int(system_settings_key_e key, int value); */ int system_settings_get_value_int(system_settings_key_e key, int *value); - /** * @platform * @brief Sets the system settings value associated with the given key as a boolean. @@ -283,7 +277,6 @@ int system_settings_set_changed_cb(system_settings_key_e key, system_settings_ch */ int system_settings_unset_changed_cb(system_settings_key_e key); - /** * @platform * @brief Called to get each string value from string typed list. @@ -293,7 +286,7 @@ int system_settings_unset_changed_cb(system_settings_key_e key); * @param[in] cb_data The user data passed from the foreach function * @return @c true to continue with the next iteration of the loop, otherwise false to break out of the loop */ -typedef bool (*system_settings_iter_cb)(int index, const char* value, void *cb_data); +typedef bool (*system_settings_iter_cb)(int index, const char *value, void *cb_data); /** * @platform @@ -350,7 +343,6 @@ int system_settings_add_value_string(system_settings_key_e key, const char *valu */ int system_settings_delete_value_string(system_settings_key_e key, const char *value); - /** * @brief Adds a change event callback for the given system settings key. * @details The difference between this function and system_settings_set_changed_cb() is that system_settings_set_changed_cb() can set only one callback for a given key, while system_settings_add_changed_cb() can set multiple callbacks for a given key. @@ -391,7 +383,6 @@ int system_settings_remove_changed_cb(system_settings_key_e key, system_settings * @} */ - #ifdef __cplusplus } #endif diff --git a/packaging/capi-system-system-settings.spec b/packaging/capi-system-system-settings.spec index a76785a..3ff6522 100644 --- a/packaging/capi-system-system-settings.spec +++ b/packaging/capi-system-system-settings.spec @@ -85,18 +85,6 @@ export CXXFLAGS="$CXXFLAGS -DTIZEN_MOBILE" export FFLAGS="$FFLAGS -DTIZEN_MOBILE" %endif -%if 0%{?sec_build_binary_debug_enable} -export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE" -export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE" -export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE" -%endif - -%if 0%{?tizen_build_binary_release_type_eng} -export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE" -export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE" -export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE" -%endif - %if 0%{?gcov:1} export CFLAGS+=" -fprofile-arcs -ftest-coverage" export CXXFLAGS+=" -fprofile-arcs -ftest-coverage" @@ -113,12 +101,14 @@ MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` -DTZ_SYS_SHARE=%{TZ_SYS_SHARE} \ -DBUILD_GCOV=%{?gcov:1}%{!?gcov:0} \ -DTEST_INSTALL_DIR:PATH=%{sys_setting_test_dir} \ + -DSETTING_DEF_RES=%{TZ_SYS_GLOBALUSER_DATA}/settings \ + -DSTDOUT_LOG=%{?stdlog:1}%{!?stdlog:0} \ %if 0%{?thread_number} - -DN_THREADS=%{thread_number} \ + -DN_THREADS=%{thread_number} %else - -DN_THREADS=1 \ + -DN_THREADS=1 %endif - -DSETTING_DEF_RES=%{TZ_SYS_GLOBALUSER_DATA}/settings + make %{?_smp_mflags} %install diff --git a/src/sys_settings.c b/src/sys_settings.c index 0a58966..54da6a2 100644 --- a/src/sys_settings.c +++ b/src/sys_settings.c @@ -16,7 +16,6 @@ #include #include #include -#include #include "sst.h" #include "system_settings.h" @@ -24,17 +23,10 @@ #include -#ifdef LOG_TAG -#undef LOG_TAG -#endif - -#define LOG_TAG "TIZEN_N_SYSTEM_SETTINGS" - #define SYSTEM_SETTINGS_MAX -1 #define GET_SLOT(x) ((x)%4) system_setting_s system_setting_table[] = { - { SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, VCONFKEY_SETAPPL_CALL_RINGTONE_PATH_STR, @@ -666,19 +658,18 @@ static void _dump_context() int max = sizeof(system_setting_table) / sizeof(system_setting_s) - 1; for (i = 0; i < max; i++) { - LOGE("[%s] system_setting_table[i].key = %d", __FUNCTION__, system_setting_table[i].key); - LOGE("[%s] system_setting_table[i].data_type = %d", __FUNCTION__, system_setting_table[i].data_type); - LOGE("[%s] system_setting_table[i].get_value_cb = %x", __FUNCTION__, system_setting_table[i].get_value_cb); - LOGE("[%s] system_setting_table[i].set_value_cb = %x", __FUNCTION__, system_setting_table[i].set_value_cb); - - LOGE("[%s] system_setting_table[i].set_changed_cb = %x <---", __FUNCTION__, system_setting_table[i].set_changed_cb); - LOGE("[%s] system_setting_table[i].unset_changed_cb = %x", __FUNCTION__, system_setting_table[i].unset_changed_cb); - LOGE("[%s] system_setting_table[i].changed_cb = %x", __FUNCTION__, system_setting_table[i].changed_cb); + ERR("[%s] system_setting_table[i].key = %d", __FUNCTION__, system_setting_table[i].key); + ERR("[%s] system_setting_table[i].data_type = %d", __FUNCTION__, system_setting_table[i].data_type); + ERR("[%s] system_setting_table[i].get_value_cb = %x", __FUNCTION__, system_setting_table[i].get_value_cb); + ERR("[%s] system_setting_table[i].set_value_cb = %x", __FUNCTION__, system_setting_table[i].set_value_cb); + + ERR("[%s] system_setting_table[i].set_changed_cb = %x <---", __FUNCTION__, system_setting_table[i].set_changed_cb); + ERR("[%s] system_setting_table[i].unset_changed_cb = %x", __FUNCTION__, system_setting_table[i].unset_changed_cb); + ERR("[%s] system_setting_table[i].changed_cb = %x", __FUNCTION__, system_setting_table[i].changed_cb); } } #endif -/* LCOV_EXCL_START */ static int _dump_context_node(int key) { int index = 0; @@ -689,13 +680,13 @@ static int _dump_context_node(int key) while (system_setting_table[index].key != SYSTEM_SETTINGS_MAX) { if (system_setting_table[index].key == key) { int i = index; - LOGE("[%s] system_setting_table[i].key = %d", __FUNCTION__, system_setting_table[i].key); - LOGE("[%s] system_setting_table[i].data_type = %d", __FUNCTION__, system_setting_table[i].data_type); - LOGE("[%s] system_setting_table[i].get_value_cb = %p", __FUNCTION__, system_setting_table[i].get_value_cb); - LOGE("[%s] system_setting_table[i].set_value_cb = %p", __FUNCTION__, system_setting_table[i].set_value_cb); - LOGE("[%s] system_setting_table[i].set_changed_cb = %p <---", __FUNCTION__, system_setting_table[i].set_changed_cb); - LOGE("[%s] system_setting_table[i].unset_changed_cb = %p", __FUNCTION__, system_setting_table[i].unset_changed_cb); - LOGE("[%s] system_setting_table[i].changed_cb = %p", __FUNCTION__, system_setting_table[i].changed_cb); + ERR("[%s] system_setting_table[i].key = %d", __FUNCTION__, system_setting_table[i].key); + ERR("[%s] system_setting_table[i].data_type = %d", __FUNCTION__, system_setting_table[i].data_type); + ERR("[%s] system_setting_table[i].get_value_cb = %p", __FUNCTION__, system_setting_table[i].get_value_cb); + ERR("[%s] system_setting_table[i].set_value_cb = %p", __FUNCTION__, system_setting_table[i].set_value_cb); + ERR("[%s] system_setting_table[i].set_changed_cb = %p <---", __FUNCTION__, system_setting_table[i].set_changed_cb); + ERR("[%s] system_setting_table[i].unset_changed_cb = %p", __FUNCTION__, system_setting_table[i].unset_changed_cb); + ERR("[%s] system_setting_table[i].changed_cb = %p", __FUNCTION__, system_setting_table[i].changed_cb); return 0; } index++; @@ -703,14 +694,13 @@ static int _dump_context_node(int key) return -1; } -/* LCOV_EXCL_STOP */ #if 0 int system_settings_get_item(system_settings_key_e key, system_setting_h *item) { - LOGE("Enter [%s], key=%d", __FUNCTION__, key); + ERR("Enter [%s], key=%d", __FUNCTION__, key); if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) { - LOGE("Enter [%s] catch invalid parameter error (%d) ", __FUNCTION__, key); + ERR("Enter [%s] catch invalid parameter error (%d) ", __FUNCTION__, key); return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; } #if DEBUG_DUMP_CONTEXT @@ -720,11 +710,11 @@ int system_settings_get_item(system_settings_key_e key, system_setting_h *item) while (system_setting_table[index].key != SYSTEM_SETTINGS_MAX) { if (system_setting_table[index].key == key) { *item = &system_setting_table[index]; - LOGE("Enter [%s], index = %d, key = %d, type = %d", __FUNCTION__, index, key, (*item)->data_type); + ERR("Enter [%s], index = %d, key = %d, type = %d", __FUNCTION__, index, key, (*item)->data_type); if (system_setting_table[index].feature_check_cb != NULL) { int ret = system_setting_table[index].feature_check_cb(item); if (ret == SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED) - LOGE("Not supported API, because there is no feature!"); + ERR("Not supported API, because there is no feature!"); return ret; } else { @@ -739,7 +729,6 @@ int system_settings_get_item(system_settings_key_e key, system_setting_h *item) } #else -/* LCOV_EXCL_START */ int binary_search_for_item(system_settings_key_e key) { int start = 0; @@ -755,19 +744,16 @@ int binary_search_for_item(system_settings_key_e key) end = mid - 1; } - LOGE("Enter [%s], key=%d, Can NOT find the key", __FUNCTION__, key); + ERR("Enter [%s], key=%d, Can NOT find the key", __FUNCTION__, key); return -1; } -/* LCOV_EXCL_STOP */ - -/* LCOV_EXCL_START */ int system_settings_get_item(system_settings_key_e key, system_setting_h *item) { - LOGE("Enter [%s], key=%d", __FUNCTION__, key); + ERR("Enter [%s], key=%d", __FUNCTION__, key); if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) { - LOGE("Enter [%s] catch invalid parameter error (%d) ", __FUNCTION__, key); + ERR("Enter [%s] catch invalid parameter error (%d) ", __FUNCTION__, key); return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; } #if DEBUG_DUMP_CONTEXT @@ -778,23 +764,20 @@ int system_settings_get_item(system_settings_key_e key, system_setting_h *item) return TIZEN_ERROR_INVALID_PARAMETER; *item = &system_setting_table[idx]; - LOGE("Enter [%s], key = %d, type = %d", __FUNCTION__, key, (*item)->data_type); + ERR("Enter [%s], key = %d, type = %d", __FUNCTION__, key, (*item)->data_type); if (system_setting_table[idx].feature_check_cb != NULL) { int ret = system_setting_table[idx].feature_check_cb(item); if (ret == SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED) - LOGE("Not supported API, because there is no feature!"); + ERR("Not supported API, because there is no feature!"); return ret; } return SYSTEM_SETTINGS_ERROR_NONE; - } #endif -/* LCOV_EXCL_STOP */ int system_setting_get_vconf(system_setting_h item, void **value) { - SETTING_TRACE_BEGIN; char *vconf_char; int vconf_int; int **val = (int**)value; @@ -814,21 +797,18 @@ int system_setting_get_vconf(system_setting_h item, void **value) case SYSTEM_SETTING_DATA_TYPE_BOOL: if (system_setting_vconf_get_value_bool(item->vconf_key, &vconf_bool)) return SYSTEM_SETTINGS_ERROR_IO_ERROR; - *value = (void *)vconf_bool; + *value = (void*)vconf_bool; break; default: - LOGE("Error system_setting_h struct data_type"); + ERR("Error system_setting_h struct data_type"); return SYSTEM_SETTINGS_ERROR_IO_ERROR; } return SYSTEM_SETTINGS_ERROR_NONE; } - -/* LCOV_EXCL_START */ int system_setting_set_vconf(system_setting_h item, void *value) { - SETTING_TRACE_BEGIN; char *vconf_char; int vconf_int; bool vconf_bool; @@ -850,17 +830,16 @@ int system_setting_set_vconf(system_setting_h item, void *value) return SYSTEM_SETTINGS_ERROR_IO_ERROR; break; default: - LOGE("Error system_setting_h struct data_type"); + ERR("Error system_setting_h struct data_type"); return SYSTEM_SETTINGS_ERROR_IO_ERROR; } return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ API int system_settings_get_value(system_settings_key_e key, system_setting_data_type_e data_type, void **value) { - LOGE("Enter [%s]", __FUNCTION__); + ERR("Enter [%s]", __FUNCTION__); if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; @@ -871,31 +850,30 @@ API int system_settings_get_value(system_settings_key_e key, system_setting_data if (ret != 0) { if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER) { _dump_context_node(key); - LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); + ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); } return ret; } if (system_setting_item->data_type != data_type) { _dump_context_node(key); - LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid data type --- key:(%d), datatype:(%d)", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, key, data_type); + ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid data type --- key:(%d), datatype:(%d)", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER, key, data_type); return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; } system_setting_getter = system_setting_item->get_value_cb; if (system_setting_getter == NULL) { - LOGE("[%s] IO_ERROR(0x%08x) : failed to call getter for the system settings", __FUNCTION__, SYSTEM_SETTINGS_ERROR_IO_ERROR); + ERR("[%s] IO_ERROR(0x%08x) : failed to call getter for the system settings", __FUNCTION__, SYSTEM_SETTINGS_ERROR_IO_ERROR); return SYSTEM_SETTINGS_ERROR_IO_ERROR; } return system_setting_getter(system_setting_item, value); } -/* LCOV_EXCL_START */ API int system_settings_set_value(system_settings_key_e key, system_setting_data_type_e data_type, void *value) { - LOGE("Enter [%s]", __FUNCTION__); + ERR("Enter [%s]", __FUNCTION__); if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key) || value == NULL) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; @@ -906,33 +884,29 @@ API int system_settings_set_value(system_settings_key_e key, system_setting_data if (ret != 0) { if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER) - LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); + ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); return ret; } /* type check */ if (system_setting_item->data_type != data_type) { - LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid data type", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); + ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid data type", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; } system_setting_setter = system_setting_item->set_value_cb; if (system_setting_setter == NULL) { - LOGE("[%s] IO_ERROR(0x%08x) : failed to call setter for the system settings", __FUNCTION__, SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED); + ERR("[%s] IO_ERROR(0x%08x) : failed to call setter for the system settings", __FUNCTION__, SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED); return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; } return system_setting_setter(system_setting_item, value); } -/* LCOV_EXCL_STOP */ - - -/* LCOV_EXCL_START */ int system_settings_add_value(system_settings_key_e key, system_setting_data_type_e data_type, void *value) { - LOGE("Enter [%s]", __FUNCTION__); + ERR("Enter [%s]", __FUNCTION__); if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key) || value == NULL) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; @@ -943,32 +917,29 @@ int system_settings_add_value(system_settings_key_e key, system_setting_data_typ if (ret != 0) { if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER) - LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); + ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); return ret; } /* type check */ if (system_setting_item->data_type != data_type) { - LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid data type", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); + ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid data type", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; } system_setting_adder = system_setting_item->add_value_cb; if (system_setting_adder == NULL) { - LOGE("[%s] IO_ERROR(0x%08x) : failed to call setter for the system settings", __FUNCTION__, SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED); + ERR("[%s] IO_ERROR(0x%08x) : failed to call setter for the system settings", __FUNCTION__, SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED); return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; } return system_setting_adder(key, value); } -/* LCOV_EXCL_STOP */ - -/* LCOV_EXCL_START */ API int system_settings_del_value(system_settings_key_e key, system_setting_data_type_e data_type, void *value) { - LOGE("Enter [%s]", __FUNCTION__); + ERR("Enter [%s]", __FUNCTION__); if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key) || value == NULL) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; @@ -978,32 +949,29 @@ API int system_settings_del_value(system_settings_key_e key, system_setting_data int ret = system_settings_get_item(key, &system_setting_item); if (0 != ret) { - LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); + ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; } /* type check */ if (system_setting_item->data_type != data_type) { - LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid data type", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); + ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid data type", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; } system_setting_deler = system_setting_item->del_value_cb; if (system_setting_deler == NULL) { - LOGE("[%s] IO_ERROR(0x%08x) : failed to call setter for the system settings", __FUNCTION__, SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED); + ERR("[%s] IO_ERROR(0x%08x) : failed to call setter for the system settings", __FUNCTION__, SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED); return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; } return system_setting_deler(key, value); } -/* LCOV_EXCL_STOP */ - -/* LCOV_EXCL_START */ API int system_settings_list_value(system_settings_key_e key, system_setting_data_type_e data_type, bool(*system_setting_data_iterator)(int, const char*, void *), void *user_data) { - LOGE("Enter [%s]", __FUNCTION__); + ERR("Enter [%s]", __FUNCTION__); if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; @@ -1014,13 +982,13 @@ API int system_settings_list_value(system_settings_key_e key, system_setting_dat if (ret != 0) { if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER) - LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); + ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); return ret; } /* type check */ if (system_setting_item->data_type != data_type) { - LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid data type", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); + ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid data type", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; } @@ -1028,30 +996,27 @@ API int system_settings_list_value(system_settings_key_e key, system_setting_dat system_setting_lister = system_setting_item->list_value_cb; if (system_setting_lister == NULL) { - LOGE("[%s] IO_ERROR(0x%08x) : failed to call setter for the system settings", __FUNCTION__, SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED); + ERR("[%s] IO_ERROR(0x%08x) : failed to call setter for the system settings", __FUNCTION__, SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED); return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; } return system_setting_lister(key, system_setting_data_iterator, user_data); } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ API int system_settings_set_value_int(system_settings_key_e key, int value) { - LOGE("Enter [%s]", __FUNCTION__); + ERR("Enter [%s]", __FUNCTION__); if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; int *ptr = &value; int **p_ptr = &ptr; - return system_settings_set_value(key, SYSTEM_SETTING_DATA_TYPE_INT, (void *)p_ptr); + return system_settings_set_value(key, SYSTEM_SETTING_DATA_TYPE_INT, (void*)p_ptr); } -/* LCOV_EXCL_STOP */ API int system_settings_get_value_int(system_settings_key_e key, int *value) { - LOGE("Enter [%s]", __FUNCTION__); + ERR("Enter [%s]", __FUNCTION__); if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; @@ -1064,22 +1029,20 @@ API int system_settings_get_value_int(system_settings_key_e key, int *value) return ret; } -/* LCOV_EXCL_START */ API int system_settings_set_value_bool(system_settings_key_e key, bool value) { - LOGE("Enter [%s]", __FUNCTION__); + ERR("Enter [%s]", __FUNCTION__); if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; bool *ptr = &value; - return system_settings_set_value(key, SYSTEM_SETTING_DATA_TYPE_BOOL, (void *)ptr); + return system_settings_set_value(key, SYSTEM_SETTING_DATA_TYPE_BOOL, (void*)ptr); } -/* LCOV_EXCL_STOP */ API int system_settings_get_value_bool(system_settings_key_e key, bool *value) { - LOGE("Enter [%s]", __FUNCTION__); - SETTING_TRACE(" SIGNED LONG here ******************* log here *************** "); + ERR("Enter [%s]", __FUNCTION__); + SST_SECURE_TRACE(" SIGNED LONG here ******************* log here *************** "); signed long flag = 0; int ret; @@ -1088,38 +1051,36 @@ API int system_settings_get_value_bool(system_settings_key_e key, bool *value) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; ret = system_settings_get_value(key, SYSTEM_SETTING_DATA_TYPE_BOOL, (void **)&flag); - SETTING_TRACE(" inf (flag) value : %ld ", flag); + SST_SECURE_TRACE(" inf (flag) value : %ld ", flag); if (flag == 0) { *value = false; - SETTING_TRACE(" flag == 0 "); + SST_SECURE_TRACE(" flag == 0 "); } else if (flag == 1) { *value = true; - SETTING_TRACE(" flag == 1 "); + SST_SECURE_TRACE(" flag == 1 "); } else { *value = false; - SETTING_TRACE(" exception here!!! "); + SST_SECURE_TRACE(" exception here!!! "); } return ret; } -/* LCOV_EXCL_START */ API int system_settings_set_value_string(system_settings_key_e key, const char *value) { - LOGE("Enter [%s]", __FUNCTION__); + ERR("Enter [%s]", __FUNCTION__); if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; if (key == SYSTEM_SETTINGS_KEY_DEFAULT_FONT_TYPE) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; - return system_settings_set_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void *)value); + return system_settings_set_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void*)value); } -/* LCOV_EXCL_STOP */ API int system_settings_get_value_string(system_settings_key_e key, char **value) { - LOGE("Enter [%s]", __FUNCTION__); + ERR("Enter [%s]", __FUNCTION__); if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; @@ -1128,19 +1089,17 @@ API int system_settings_get_value_string(system_settings_key_e key, char **value int system_setting_set_changed_vconf_genernal_callback(system_setting_h item, void *user_data) { - SETTING_TRACE_BEGIN; return system_setting_vconf_set_changed_cb(item->vconf_key, item->key, GET_SLOT(item->key), user_data); } int system_setting_unset_changed_vconf_genernal_callback(system_setting_h item) { - SETTING_TRACE_BEGIN; return system_setting_vconf_unset_changed_cb(item->vconf_key, GET_SLOT(item->key)); } API int system_settings_set_changed_cb(system_settings_key_e key, system_settings_changed_cb callback, void *user_data) { - LOGE("Enter [%s]", __FUNCTION__); + ERR("Enter [%s]", __FUNCTION__); system_setting_h system_setting_item; system_setting_set_changed_callback_cb system_setting_set_changed_cb; @@ -1153,13 +1112,12 @@ API int system_settings_set_changed_cb(system_settings_key_e key, system_setting int ret = system_settings_get_item(key, &system_setting_item); if (ret != 0) { if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER) - LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); + ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); return ret; } system_setting_set_changed_cb = system_setting_item->set_changed_cb; - /* Store the callback function from application side */ if (callback) system_setting_item->changed_cb = callback; @@ -1168,17 +1126,16 @@ API int system_settings_set_changed_cb(system_settings_key_e key, system_setting system_setting_item->user_data = user_data; if (system_setting_set_changed_cb == NULL) { - LOGE("[%s] IO_ERROR(0x%08x) : failed to call getter for the system settings", __FUNCTION__, SYSTEM_SETTINGS_ERROR_IO_ERROR); + ERR("[%s] IO_ERROR(0x%08x) : failed to call getter for the system settings", __FUNCTION__, SYSTEM_SETTINGS_ERROR_IO_ERROR); return SYSTEM_SETTINGS_ERROR_IO_ERROR; } return system_setting_set_changed_cb(system_setting_item, user_data); } - API int system_settings_unset_changed_cb(system_settings_key_e key) { - LOGE("Enter [%s]", __FUNCTION__); + ERR("Enter [%s]", __FUNCTION__); system_setting_h system_setting_item; system_setting_unset_changed_callback_cb system_setting_unset_changed_cb; @@ -1191,7 +1148,7 @@ API int system_settings_unset_changed_cb(system_settings_key_e key) int ret = system_settings_get_item(key, &system_setting_item); if (ret != 0) { if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER) - LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); + ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); return ret; } @@ -1203,7 +1160,7 @@ API int system_settings_unset_changed_cb(system_settings_key_e key) /*----------------------------------------------------- */ if (system_setting_unset_changed_cb == NULL) { - LOGE("[%s] IO_ERROR(0x%08x) : failed to call getter for the system settings", __FUNCTION__, SYSTEM_SETTINGS_ERROR_IO_ERROR); + ERR("[%s] IO_ERROR(0x%08x) : failed to call getter for the system settings", __FUNCTION__, SYSTEM_SETTINGS_ERROR_IO_ERROR); return SYSTEM_SETTINGS_ERROR_IO_ERROR; } @@ -1212,7 +1169,7 @@ API int system_settings_unset_changed_cb(system_settings_key_e key) API int system_settings_add_changed_cb(system_settings_key_e key, system_settings_changed_cb callback, void *user_data) { - LOGE("Enter [%s]", __FUNCTION__); + ERR("Enter [%s]", __FUNCTION__); system_setting_h system_setting_item; if (callback == NULL) @@ -1224,19 +1181,19 @@ API int system_settings_add_changed_cb(system_settings_key_e key, system_setting int ret = system_settings_get_item(key, &system_setting_item); if (ret != 0) { if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER) - LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); + ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); return ret; } if (system_setting_item->vconf_key == NULL) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; - LOGE("[%s] key = %d %s", __FUNCTION__, key, system_setting_item->vconf_key); + ERR("[%s] key = %d %s", __FUNCTION__, key, system_setting_item->vconf_key); /* Store the callback function from application side */ ret = add_multi_callback(&system_setting_item->changed_cb_list, callback, user_data); if (ret != SYSTEM_SETTINGS_ERROR_NONE) { - LOGE("[%s] IO_ERROR(0x%08x) : failed to add muti-callback for the system settings", __FUNCTION__, ret); + ERR("[%s] IO_ERROR(0x%08x) : failed to add muti-callback for the system settings", __FUNCTION__, ret); return ret; } @@ -1244,17 +1201,17 @@ API int system_settings_add_changed_cb(system_settings_key_e key, system_setting int ret = system_setting_vconf_set_changed_multi_cb(system_setting_item->vconf_key, key); if (ret == SYSTEM_SETTINGS_ERROR_NONE) system_setting_item->changed_cb_list.is_registered = 1; - LOGE("Leave [%s]", __FUNCTION__); + ERR("Leave [%s]", __FUNCTION__); return ret; } - LOGE("Leave [%s]", __FUNCTION__); + ERR("Leave [%s]", __FUNCTION__); return SYSTEM_SETTINGS_ERROR_NONE; } API int system_settings_remove_changed_cb(system_settings_key_e key, system_settings_changed_cb callback) { - LOGE("Enter [%s]", __FUNCTION__); + ERR("Enter [%s]", __FUNCTION__); system_setting_h system_setting_item; if (callback == NULL) @@ -1266,7 +1223,7 @@ API int system_settings_remove_changed_cb(system_settings_key_e key, system_sett int ret = system_settings_get_item(key, &system_setting_item); if (ret != 0) { if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER) - LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); + ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); return ret; } @@ -1279,11 +1236,11 @@ API int system_settings_remove_changed_cb(system_settings_key_e key, system_sett ret = system_setting_vconf_unset_changed_multi_cb(system_setting_item->vconf_key, key); if (ret == SYSTEM_SETTINGS_ERROR_NONE) system_setting_item->changed_cb_list.is_registered = 0; - LOGE("Leave [%s]", __FUNCTION__); + ERR("Leave [%s]", __FUNCTION__); return ret; } - LOGE("Leave [%s]", __FUNCTION__); + ERR("Leave [%s]", __FUNCTION__); return SYSTEM_SETTINGS_ERROR_NONE; } @@ -1293,11 +1250,11 @@ API int system_settings_remove_changed_cb(system_settings_key_e key, system_sett API int system_settings_foreach_value_string(system_settings_key_e key, system_settings_iter_cb callback, void *value) { - LOGE("Enter [%s]", __FUNCTION__); + ERR("Enter [%s]", __FUNCTION__); if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; - return system_settings_list_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, callback, (void *)value); + return system_settings_list_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, callback, (void*)value); } ////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1306,11 +1263,11 @@ API int system_settings_foreach_value_string(system_settings_key_e key, system_s API int system_settings_add_value_string(system_settings_key_e key, const char* value) { - LOGE("Enter [%s]", __FUNCTION__); + ERR("Enter [%s]", __FUNCTION__); if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; - return system_settings_add_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void *)value); + return system_settings_add_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void*)value); } ////////////////////////////////////////////////////////////////////////////////////////////////// @@ -1319,10 +1276,9 @@ API int system_settings_add_value_string(system_settings_key_e key, const char* API int system_settings_delete_value_string(system_settings_key_e key, const char* value) { - LOGE("Enter [%s]", __FUNCTION__); + ERR("Enter [%s]", __FUNCTION__); if (!(key >= 0 && SYSTEM_SETTINGS_KEY_MAX > key)) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; - return system_settings_del_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void *)value); + return system_settings_del_value(key, SYSTEM_SETTING_DATA_TYPE_STRING, (void*)value); } - diff --git a/src/sys_settings.h b/src/sys_settings.h index 9388af5..cd9bcc8 100644 --- a/src/sys_settings.h +++ b/src/sys_settings.h @@ -21,7 +21,7 @@ extern "C" { #endif -#include +#include "sst.h" #include "system_settings.h" #include "sys_settings_multi_callback.h" @@ -33,44 +33,6 @@ extern "C" #define VCONFKEY_SETAPPL_ACCESSIBILITY_GREYSCALE "db/setting/accessibility/greyscale" #endif - -#ifdef LOG_TAG -#undef LOG_TAG -#endif - -#define LOG_TAG "SYSTEM-SETTINGS" - -/* #define DEBUG_DUMP_CONTEXT */ -#define SYSTEM_SETTINGS_ENABLE_TRACE - -#ifdef SYSTEM_SETTINGS_ENABLE_TRACE - - -#define SETTING_TRACE_DEBUG(fmt, arg...) \ - do {\ - SECURE_LOGD("\033[0;32mDEBUG: " fmt "\033[0m\n", ##arg);\ - } while (0); - -#define SETTING_TRACE(fmt, arg...) \ - do {\ - SECURE_LOGI("\033[0;36m" fmt "\033[0m\n", ##arg);\ - } while (0); - -#define SETTING_TRACE_BEGIN do {\ - SECURE_LOGD("\033[0;35mENTER FUNCTION: %s. \033[0m\n", __FUNCTION__);\ - } while (0); - -#define SETTING_TRACE_END do {\ - SECURE_LOGD("\033[0;35mEXIT FUNCTION: %s. \033[0m\n", __FUNCTION__);\ - } while (0); -#else -#define SETTING_TRACE_DEBUG(fmt, arg...) -#define SETTING_TRACE(fmt, arg...) -#define SETTING_TRACE_BEGIN -#define SETTING_TRACE_END -#endif - - #define SETTING_PROFILE_PATH "tizen.org/feature/profile" #define SETTING_INCOMING_CALL_PATH "tizen.org/feature/systemsetting.incoming_call" #define SETTING_HOME_SCREEN_PATH "tizen.org/feature/systemsetting.home_screen" @@ -163,7 +125,6 @@ typedef int (*system_setting_set_changed_callback_cb)(system_setting_h item, voi */ typedef int (*system_setting_unset_changed_callback_cb)(system_setting_h item); - /** * @internal * @since_tizen 2.3 @@ -174,7 +135,7 @@ typedef int (*system_setting_unset_changed_callback_cb)(system_setting_h item); */ typedef struct _system_setting_s { system_settings_key_e key; /**< key */ - const char * const vconf_key; /**< vconf key */ + const char* const vconf_key; /**< vconf key */ system_setting_data_type_e data_type; /**< data type */ system_setting_get_value_cb get_value_cb; /**< function pointer for getter */ system_setting_set_value_cb set_value_cb; /**< function pointer for setter */ @@ -192,11 +153,8 @@ typedef struct _system_setting_s { callback_list changed_cb_list; void *user_data; /* user_data */ - } system_setting_s; - - /** * @internal * @since_tizen 2.3 @@ -209,7 +167,6 @@ typedef struct _system_setting_s { */ int system_settings_get_item(system_settings_key_e key, system_setting_h *item); - /* get */ /** @@ -382,7 +339,6 @@ int system_setting_vconf_unset_changed_cb(const char *vconf_key, system_setting_ */ int system_settings_vconf_get_key_string(system_settings_key_e key, char **key_string); - /** * @internal * @brief Unset the system settings notification callback @@ -442,19 +398,16 @@ int system_setting_get_incoming_call_ringtone(system_setting_h item, void **valu */ int system_setting_set_incoming_call_ringtone(system_setting_h item, void *value); - /** * @todo add comment here */ int system_setting_add_incoming_call_ringtone(system_settings_key_e key, void *value); - /** * @todo add comment here */ int system_setting_del_incoming_call_ringtone(system_settings_key_e key, void *value); - /** * @todo add comment here */ @@ -728,7 +681,7 @@ int system_setting_get_time_changed(system_setting_h item, void **value); * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API */ -int system_setting_feature_check_incoming_call(void * value); +int system_setting_feature_check_incoming_call(void *value); /** * @internal @@ -738,7 +691,7 @@ int system_setting_feature_check_incoming_call(void * value); * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API */ -int system_setting_feature_check_home_screen(void * value); +int system_setting_feature_check_home_screen(void *value); /** * @internal @@ -748,7 +701,7 @@ int system_setting_feature_check_home_screen(void * value); * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API */ -int system_setting_feature_check_lock_screen(void * value); +int system_setting_feature_check_lock_screen(void *value); /** * @internal @@ -758,7 +711,7 @@ int system_setting_feature_check_lock_screen(void * value); * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API */ -int system_setting_feature_check_notification_email(void * value); +int system_setting_feature_check_notification_email(void *value); /** * @internal @@ -768,7 +721,7 @@ int system_setting_feature_check_notification_email(void * value); * @retval #SYSTEM_SETTINGS_ERROR_IO_ERROR Internal I/O error * @retval #SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED Not support system-settings API */ -int system_setting_feature_check_wifi(void * value); +int system_setting_feature_check_wifi(void *value); /** * @internal @@ -827,6 +780,3 @@ int system_setting_feature_check_wearable_profile(void *value); #endif #endif /* __TIZEN_SYSTEM_SETTING_PRIVATE_H__ */ - - - diff --git a/src/sys_settings_json.c b/src/sys_settings_json.c index f4863c3..6e60e45 100644 --- a/src/sys_settings_json.c +++ b/src/sys_settings_json.c @@ -32,16 +32,15 @@ static void ss_json_ringtone_save(JsonNode *root) GError *error = NULL; gboolean ret = json_generator_to_file(generator, filename, &error); #else - gchar* result = json_generator_to_data(generator, NULL); + gchar *result = json_generator_to_data(generator, NULL); vconf_set_str(VCONFKEY_SETAPPL_CALL_RINGTONE_USER_LIST, (char*)result); #endif g_object_unref(generator); } /* LCOV_EXCL_STOP */ - /* LCOV_EXCL_START */ -JsonParser* ss_json_ringtone_open_file(char* path) +JsonParser* ss_json_ringtone_open_file(char *path) { JsonParser *parser; //JsonNode *root; @@ -52,7 +51,7 @@ JsonParser* ss_json_ringtone_open_file(char* path) error = NULL; json_parser_load_from_file(parser, path, &error); if (error) { - SETTING_TRACE("Unable to parse `%s': %s\n", path, error->message); + SST_SECURE_TRACE("Unable to parse `%s': %s\n", path, error->message); g_error_free(error); g_object_unref(parser); return NULL; @@ -71,10 +70,10 @@ JsonParser* ss_json_ringtone_load_from_data() parser = json_parser_new(); error = NULL; - char* load_data = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_USER_LIST); + char *load_data = vconf_get_str(VCONFKEY_SETAPPL_CALL_RINGTONE_USER_LIST); json_parser_load_from_data(parser, load_data, -1, &error); if (error) { - SETTING_TRACE("Unable to load data : %s \n", error->message); + SST_SECURE_TRACE("Unable to load data : %s \n", error->message); g_error_free(error); g_object_unref(parser); return NULL; @@ -82,17 +81,15 @@ JsonParser* ss_json_ringtone_load_from_data() return parser; } -void ss_json_ringtone_add(JsonNode *root, char* filename, char* nameval, char* pathval) +void ss_json_ringtone_add(JsonNode *root, char *filename, char *nameval, char *pathval) { - SETTING_TRACE_BEGIN; - - JsonNode* menu_item = json_node_new(JSON_NODE_OBJECT); + JsonNode *menu_item = json_node_new(JSON_NODE_OBJECT); JsonObject *object = json_object_new(); json_node_take_object(menu_item, object); json_object_set_string_member(object, "name", nameval); json_object_set_string_member(object, "path", pathval); - JsonArray* menu = json_node_get_array(root); + JsonArray *menu = json_node_get_array(root); json_array_add_element(menu, menu_item); ss_json_ringtone_save(root); @@ -107,37 +104,37 @@ void ss_json_ringtone_print(JsonNode *root) json_generator_set_pretty(generator, TRUE); gchar *data = json_generator_to_data(generator, NULL); //SETTING_TRACE("%s", (char * )data); - SETTING_TRACE("-------------------------------------------------------\n"); - SETTING_TRACE("%s", data); - SETTING_TRACE("-------------------------------------------------------\n"); + SST_SECURE_TRACE("-------------------------------------------------------\n"); + SST_SECURE_TRACE("%s", data); + SST_SECURE_TRACE("-------------------------------------------------------\n"); - SETTING_TRACE("VCONFKEY_SETAPPL_CALL_RINGTONE_USER_LIST SET !!!!\n"); + SST_SECURE_TRACE("VCONFKEY_SETAPPL_CALL_RINGTONE_USER_LIST SET !!!!\n"); vconf_set_str(VCONFKEY_SETAPPL_CALL_RINGTONE_USER_LIST, (char*)data); g_free(data); g_object_unref(generator); } -void ss_json_ringtone_remove(JsonNode *root, char* filename, char* path_to_del) +void ss_json_ringtone_remove(JsonNode *root, char *filename, char *path_to_del) { int size = json_array_get_length(json_node_get_array(root)); - SETTING_TRACE("BBB size : (%d) \n", size); + SST_SECURE_TRACE("BBB size : (%d) \n", size); int i = 0; for (i = 0; i < size; i++) { JsonObject *ringtone = json_array_get_object_element(json_node_get_array(root), i); - //char *nameval = (char *)json_object_get_string_member(ringtone, "name"); - char *pathval = (char *)json_object_get_string_member(ringtone, "path"); + //char *nameval = (char*)json_object_get_string_member(ringtone, "name"); + char *pathval = (char*)json_object_get_string_member(ringtone, "path"); if (pathval && !strcmp(pathval, path_to_del)) { json_array_remove_element(json_node_get_array(root), i); - SETTING_TRACE("remove BBB : (%s) --- (%s) \n", pathval, path_to_del); + SST_SECURE_TRACE("remove BBB : (%s) --- (%s) \n", pathval, path_to_del); } } ss_json_ringtone_save(root); } -bool ss_json_ringtone_contain(JsonNode *root, char* newfile) +bool ss_json_ringtone_contain(JsonNode *root, char *newfile) { int size = json_array_get_length(json_node_get_array(root)); @@ -146,11 +143,10 @@ bool ss_json_ringtone_contain(JsonNode *root, char* newfile) int i = 0; for (i = 0; i < size; i++) { JsonObject *ringtone = json_array_get_object_element(json_node_get_array(root), i); - //char *nameval = (char *)json_object_get_string_member(ringtone, "name"); - char *pathval = (char *)json_object_get_string_member(ringtone, "path"); + //char *nameval = (char*)json_object_get_string_member(ringtone, "name"); + char *pathval = (char*)json_object_get_string_member(ringtone, "path"); //SETTING_TRACE("(%s) --- (%s) \n", name, path); - if (pathval && !strcmp(pathval, newfile)) { //SETTING_TRACE("FOUND\n"); ret = true; @@ -172,9 +168,9 @@ void ss_json_ringtone_list(JsonNode *root) int i = 0; for (i = 0; i < size; i++) { JsonObject *ringtone = json_array_get_object_element(json_node_get_array(root), i); - char *name = (char *)json_object_get_string_member(ringtone, "name"); - char *path = (char *)json_object_get_string_member(ringtone, "path"); - SETTING_TRACE("(%s) --- (%s) \n", name, path); + char *name = (char*)json_object_get_string_member(ringtone, "name"); + char *path = (char*)json_object_get_string_member(ringtone, "path"); + SST_SECURE_TRACE("(%s) --- (%s) \n", name, path); } } /* LCOV_EXCL_STOP */ diff --git a/src/sys_settings_multi_callback.c b/src/sys_settings_multi_callback.c index 9129ef1..9c666dd 100644 --- a/src/sys_settings_multi_callback.c +++ b/src/sys_settings_multi_callback.c @@ -16,7 +16,7 @@ #include #include "sys_settings.h" -void clean_node(callback_node* node) +void clean_node(callback_node *node) { if (!node) return; @@ -25,14 +25,13 @@ void clean_node(callback_node* node) node->user_data = NULL; } - callback_node* alloc_multi_callback_node() { - callback_node* node = NULL; + callback_node *node = NULL; node = (callback_node*)malloc(sizeof(callback_node)); if (node == NULL) { - SETTING_TRACE("Not enough node...."); + SST_SECURE_TRACE("Not enough node...."); return NULL; } @@ -41,7 +40,7 @@ callback_node* alloc_multi_callback_node() return node; } -void free_multi_callback_node(callback_node* node) +void free_multi_callback_node(callback_node *node) { if (node) free(node); @@ -53,7 +52,7 @@ static gint _compare_cb(gconstpointer val, gconstpointer s_val) if (NULL == val) return 1; if (NULL == s_val) return 1; - callback_node* node = (callback_node*)val; + callback_node *node = (callback_node*)val; if (node->callback == s_val) return 0; return -1; @@ -61,7 +60,6 @@ static gint _compare_cb(gconstpointer val, gconstpointer s_val) int delete_multi_callback(callback_list *handle, system_settings_changed_cb ptr) { - SETTING_TRACE_BEGIN; if (!handle || !ptr) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; @@ -72,13 +70,11 @@ int delete_multi_callback(callback_list *handle, system_settings_changed_cb ptr) g_list_free(found); } - SETTING_TRACE_END; return SYSTEM_SETTINGS_ERROR_NONE; } int add_multi_callback(callback_list *handle, system_settings_changed_cb ptr, void *user_data) { - SETTING_TRACE_BEGIN; if (!handle || !ptr) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; @@ -86,7 +82,7 @@ int add_multi_callback(callback_list *handle, system_settings_changed_cb ptr, vo if (found != NULL) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; - callback_node* node = alloc_multi_callback_node(); + callback_node *node = alloc_multi_callback_node(); if (node == NULL) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; @@ -97,24 +93,21 @@ int add_multi_callback(callback_list *handle, system_settings_changed_cb ptr, vo /* append the node to list. free_multi_callback_node will free the node */ handle->list = g_list_append(handle->list, node); - SETTING_TRACE_END; return SYSTEM_SETTINGS_ERROR_NONE; } int invoke_callback_list(callback_list *handle, system_settings_key_e key) { - SETTING_TRACE_BEGIN; if (!handle) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; GList *itr = handle->list; while (itr != NULL) { - callback_node* node = (callback_node*)itr->data; + callback_node *node = (callback_node*)itr->data; if (node->callback) node->callback(key, node->user_data); itr = g_list_next(itr); } - SETTING_TRACE_END; return SYSTEM_SETTINGS_ERROR_NONE; } diff --git a/src/sys_settings_platform.c b/src/sys_settings_platform.c index a6d8cc9..0ca1576 100644 --- a/src/sys_settings_platform.c +++ b/src/sys_settings_platform.c @@ -28,7 +28,6 @@ #include #include -#include #include #include @@ -49,22 +48,6 @@ #include "sys_settings_ringtones.h" #include "sys_settings_json.h" -#define SETTING_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf" -#define SETTING_DEFAULT_FONT_CONF_FILE _TZ_SYS_ETC"/fonts/conf.avail/99-tizen.conf" - -#define SETTING_TIME_ZONEINFO_PATH "/usr/share/zoneinfo/" -#define SETTING_TIME_SHARE_LOCAL_PATH "/usr/share/locale" -#define SETTING_TZONE_SYMLINK_PATH "/opt/etc/localtime" - - -#define __FREE(del, arg) do { \ - if (arg) { \ - del((void *)(arg)); /*cast any argument to (void*) to avoid build warring*/\ - arg = NULL; \ - } \ -} while (0); -#define FREE(arg) __FREE(free, arg) - #define SETTING_UTILS_SO_FILE_PATH "libsystem-settings-util.so" int _is_file_accessible(const char *path); @@ -83,7 +66,6 @@ static void dl_font_config_set_notification(); */ int system_setting_get_incoming_call_ringtone(system_setting_h item, void **value) { - SETTING_TRACE_BEGIN; char *vconf_value = NULL; if (system_setting_vconf_get_value_string(item->vconf_key, &vconf_value)) return SYSTEM_SETTINGS_ERROR_IO_ERROR; @@ -102,11 +84,8 @@ int system_setting_get_incoming_call_ringtone(system_setting_h item, void **valu return SYSTEM_SETTINGS_ERROR_NONE; } - -/* LCOV_EXCL_START */ int system_setting_get_email_alert_ringtone(system_setting_h item, void **value) { - SETTING_TRACE_BEGIN; char *vconf_value = NULL; if (system_setting_vconf_get_value_string(item->vconf_key, &vconf_value)) return SYSTEM_SETTINGS_ERROR_IO_ERROR; @@ -123,32 +102,26 @@ int system_setting_get_email_alert_ringtone(system_setting_h item, void **value) return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ - int system_setting_get_default_font_type(system_setting_h item, void **value) { - SETTING_TRACE_BEGIN; char *font_name = dl_get_default_font_info(); if (font_name) { - *value = (void *)font_name; + *value = (void*)font_name; return SYSTEM_SETTINGS_ERROR_NONE; } else { return SYSTEM_SETTINGS_ERROR_IO_ERROR; } } - /*////////////////////////////////////////////////////////////////////////////////////////////////// */ /** * get current lock scren app package name (string) * * @return SYSTEM_SETTINGS_ERROR_LOCKSCREEN_APP_PASSWORD_MODE raise exception if current lock type is 'password' */ -/* LCOV_EXCL_START */ int system_setting_get_lockscreen_app(system_setting_h item, void **value) { - SETTING_TRACE_BEGIN; char *pkg_name = NULL; int locktype = -1; if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype)) @@ -165,39 +138,27 @@ int system_setting_get_lockscreen_app(system_setting_h item, void **value) *value = pkg_name; return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ /*////////////////////////////////////////////////////////////////////////////////////////////////// */ int _is_file_accessible(const char *path) { - SETTING_TRACE_BEGIN; int ret = access(path, R_OK); if (ret == 0) { - SETTING_TRACE("found the file %s", path); + SST_SECURE_TRACE("found the file %s", path); return 0; } else { /* error code : 13 */ - SETTING_TRACE("found the file %s --- error code : %d ", path, errno); + SST_SECURE_TRACE("found the file %s --- error code : %d ", path, errno); return -errno; } } - - -/*////////////////////////////////////////////////////////////////////////////////////////////////// */ -// @todo move to CMake -#define DEF_RINGTONE_FILE_PATH SETTING_DEF_RES"/Ringtones" - -#define USR_RINGTONE_FILE_PATH "/home/owner/content/Sounds/Ringtones" -#define JSONFILE "/opt/home/owner/apps_rw/org.tizen.setting/data/.user-ringtones.json" - int system_setting_add_incoming_call_ringtone(system_settings_key_e key, void *value) { - SETTING_TRACE_BEGIN; - char* pathval = (char*)value; - char* dnameval = NULL; - char* baseval = NULL; + char *pathval = value; + char *dnameval = NULL; + char *baseval = NULL; #ifdef USE_JSONFILE // NOT IN USE @@ -213,21 +174,21 @@ int system_setting_add_incoming_call_ringtone(system_settings_key_e key, void *v int ret = SYSTEM_SETTINGS_ERROR_NONE; if (false == ss_json_ringtone_contain(root, pathval)) { // @todo : MAKE SURE THE ACTUAL FILE IS THERE ON PATHVAL(SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER) - ss_json_ringtone_add(root, JSONFILE, pathval, pathval); - SETTING_TRACE("pathval is : %s -- OK", pathval); + ss_json_ringtone_add(root, SST_RINGTONE_JSONFILE, pathval, pathval); + SST_SECURE_TRACE("pathval is : %s -- OK", pathval); } else { - SETTING_TRACE("pathval is duplicated : %s", pathval); + SST_SECURE_TRACE("pathval is duplicated : %s", pathval); ret = SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; } dnameval = strdup(pathval); baseval = strdup(pathval); if (dnameval && baseval) { - SETTING_TRACE("---> dirname is : %s ", dirname(dnameval)); - SETTING_TRACE("---> basename is : %s ", basename(baseval)); + SST_SECURE_TRACE("---> dirname is : %s ", dirname(dnameval)); + SST_SECURE_TRACE("---> basename is : %s ", basename(baseval)); } - FREE(dnameval); - FREE(baseval); + free(dnameval); + free(baseval); if (parser) { g_object_unref(parser); @@ -239,17 +200,16 @@ int system_setting_add_incoming_call_ringtone(system_settings_key_e key, void *v int system_setting_del_incoming_call_ringtone(system_settings_key_e key, void *value) { - SETTING_TRACE_BEGIN; - char* pathval = (char*)value; + char *pathval = value; #ifdef USE_JSONFILE // NOT IN USE - JsonParser* parser = ss_json_ringtone_open_file(JSONFILE); + JsonParser *parser = ss_json_ringtone_open_file(JSONFILE); #else - JsonParser* parser = ss_json_ringtone_load_from_data(); + JsonParser *parser = ss_json_ringtone_load_from_data(); #endif JsonNode *root = json_parser_get_root(parser); - ss_json_ringtone_remove(root, JSONFILE, pathval); + ss_json_ringtone_remove(root, SST_RINGTONE_JSONFILE, pathval); //void ss_json_ringtone_remove(JsonNode *root, char* filename, char* path_to_del) ss_json_ringtone_print(root); @@ -261,23 +221,19 @@ int system_setting_del_incoming_call_ringtone(system_settings_key_e key, void *v return SYSTEM_SETTINGS_ERROR_NONE; } - -/* LCOV_EXCL_START */ gint _compare_cb(gconstpointer d1, gconstpointer d2) { - fileNodeInfo *pNode1 = (fileNodeInfo *)d1; - fileNodeInfo *pNode2 = (fileNodeInfo *)d2; + fileNodeInfo *pNode1 = (fileNodeInfo*)d1; + fileNodeInfo *pNode2 = (fileNodeInfo*)d2; return strcmp(pNode1->media_name, pNode2->media_name); } -/* LCOV_EXCL_STOP */ /* * get the RINGTONE list */ static void _get_default_ringtones(system_settings_key_e key, system_settings_iter_cb callback, void *data) { - SETTING_TRACE_BEGIN; /*Get file list */ GList *filelist = NULL; GList *iter; @@ -289,54 +245,53 @@ static void _get_default_ringtones(system_settings_key_e key, system_settings_it //----------------------------------------------------------------------------------------------------------------- int ret = get_filelist_from_dir_path(DEF_RINGTONE_FILE_PATH, &filelist); if (ret != 0) - SETTING_TRACE("Failed to get filelist, ret = %d %s", ret, DEF_RINGTONE_FILE_PATH); + SST_SECURE_TRACE("Failed to get filelist, ret = %d %s", ret, DEF_RINGTONE_FILE_PATH); filelist = g_list_sort(filelist, _compare_cb); for (iter = filelist; iter != NULL; iter = g_list_next(iter)) { - node = (fileNodeInfo *)iter->data; - SETTING_TRACE("file path = (%d) : name:%s path:%s [%s]", ret, node->name, node->path, node->media_name); + node = (fileNodeInfo*)iter->data; + SST_SECURE_TRACE("file path = (%d) : name:%s path:%s [%s]", ret, node->name, node->path, node->media_name); // @todo assert NULL check if (callback) { char temp[1024]; snprintf(temp, 1024, "%s/%s", node->path, node->name); - char* path = strdup(temp); + char *path = strdup(temp); bool ret = callback(idx, (void *)(path), data); if (path) { free(path); path = NULL; } if (ret == false) { - SETTING_TRACE("quit the iteration by return value == false : %d", ret); + SST_SECURE_TRACE("quit the iteration by return value == false : %d", ret); break; } - } else { - SETTING_TRACE("--> system_setting_data_iterator is NULL"); + SST_SECURE_TRACE("--> system_setting_data_iterator is NULL"); } } for (iter = filelist; iter != NULL; iter = g_list_next(iter)) { - node = (fileNodeInfo *)iter->data; - FREE(node->path); - FREE(node->name); - FREE(node->media_name); - FREE(node); + node = (fileNodeInfo*)iter->data; + free(node->path); + node->path = NULL; + free(node->name); + node->name = NULL; + free(node->media_name); + node->media_name = NULL; + free(node); } g_list_free(filelist); filelist = NULL; - } static void _get_user_ringtones(system_settings_key_e key, system_settings_iter_cb callback, void *data) { - SETTING_TRACE_BEGIN; - #ifdef USE_JSONFILE // NOT IN USE - JsonParser* parser = ss_json_ringtone_open_file(JSONFILE); + JsonParser *parser = ss_json_ringtone_open_file(JSONFILE); #else - JsonParser* parser = ss_json_ringtone_load_from_data(); + JsonParser *parser = ss_json_ringtone_load_from_data(); #endif JsonNode *root = json_parser_get_root(parser); @@ -345,19 +300,19 @@ static void _get_user_ringtones(system_settings_key_e key, system_settings_iter_ int i = 0; for (i = 0; i < size; i++) { JsonObject *ringtone = json_array_get_object_element(json_node_get_array(root), i); - char *nameval = (char *)json_object_get_string_member(ringtone, "name"); - char *pathval = (char *)json_object_get_string_member(ringtone, "path"); - SETTING_TRACE("(%s) --- (%s) \n", nameval, pathval); + char *nameval = (char*)json_object_get_string_member(ringtone, "name"); + char *pathval = (char*)json_object_get_string_member(ringtone, "path"); + SST_SECURE_TRACE("(%s) --- (%s) \n", nameval, pathval); if (callback && pathval) { - char* path = strdup(pathval); + char *path = strdup(pathval); bool ret = callback(i, (void *)(path), data); if (ret == false) { - SETTING_TRACE("quit the iteration by return value == false : %d", ret); + SST_SECURE_TRACE("quit the iteration by return value == false : %d", ret); break; } - FREE(path); + free(path); } else { - SETTING_TRACE("--> callback is NULL"); + SST_SECURE_TRACE("--> callback is NULL"); } } @@ -366,8 +321,6 @@ static void _get_user_ringtones(system_settings_key_e key, system_settings_iter_ int system_setting_list_incoming_call_ringtone(system_settings_key_e key, system_settings_iter_cb callback, void *data) { - SETTING_TRACE_BEGIN; - _get_default_ringtones(key, callback, data); //----------------------------------------------------------------------------------------------------------------- // 2. get the USER ringtone list @@ -377,13 +330,9 @@ int system_setting_list_incoming_call_ringtone(system_settings_key_e key, system return SYSTEM_SETTINGS_ERROR_NONE; } - -/* LCOV_EXCL_START */ int system_setting_set_incoming_call_ringtone(system_setting_h item, void *value) { - SETTING_TRACE_BEGIN; - char *vconf_value; - vconf_value = (char *)value; + char *vconf_value = value; int ret = _is_file_accessible(vconf_value); if (ret == 0) { @@ -396,15 +345,10 @@ int system_setting_set_incoming_call_ringtone(system_setting_h item, void *value return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ - -/* LCOV_EXCL_START */ int system_setting_set_email_alert_ringtone(system_setting_h item, void *value) { - SETTING_TRACE_BEGIN; - char *vconf_value; - vconf_value = (char *)value; + char *vconf_value = value; int ret = _is_file_accessible(vconf_value); if (ret == 0) { @@ -418,25 +362,23 @@ int system_setting_set_email_alert_ringtone(system_setting_h item, void *value) return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ static bool dl_is_supported_image_type_load(char *path) { void *handle = NULL; char *error; bool ret = false; - bool(*image_type_check)(char *path); + bool (*image_type_check)(char *path); handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY); if (!handle) { - SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so"); + SST_SECURE_TRACE("ERROR!! canNOT find libsystem-settings-util.so"); return false; } image_type_check = dlsym(handle, "__is_supported_image_type_load"); if ((error = dlerror()) != NULL) { - SETTING_TRACE("ERROR!! canNOT find __is_supported_image_type_load function at libsystem-settings-util.so"); + SST_SECURE_TRACE("ERROR!! canNOT find __is_supported_image_type_load function at libsystem-settings-util.so"); if (handle) dlclose(handle); return false; @@ -446,25 +388,23 @@ static bool dl_is_supported_image_type_load(char *path) dlclose(handle); return ret; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ static int dl_is_available_font(char *str) { void *handle = NULL; char *error; int ret = false; - int(*check_available_font)(char *font_name); + int (*check_available_font)(char *font_name); handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY); if (!handle) { - SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so"); + SST_SECURE_TRACE("ERROR!! canNOT find libsystem-settings-util.so"); return false; } check_available_font = dlsym(handle, "__is_available_font"); if ((error = dlerror()) != NULL) { - SETTING_TRACE("ERROR!! canNOT find __is_available_font function at libsystem-settings-util.so"); + SST_SECURE_TRACE("ERROR!! canNOT find __is_available_font function at libsystem-settings-util.so"); if (handle) dlclose(handle); return false; @@ -474,9 +414,7 @@ static int dl_is_available_font(char *str) dlclose(handle); return ret; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ static void dl_font_size_set() { void *handle = NULL; @@ -485,13 +423,13 @@ static void dl_font_size_set() handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY); if (!handle) { - SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so"); + SST_SECURE_TRACE("ERROR!! canNOT find libsystem-settings-util.so"); return; } set_font_size = dlsym(handle, "__font_size_set"); if ((error = dlerror()) != NULL) { - SETTING_TRACE("ERROR!! canNOT find __font_size_set function at libsystem-settings-util.so"); + SST_SECURE_TRACE("ERROR!! canNOT find __font_size_set function at libsystem-settings-util.so"); if (handle) dlclose(handle); return; @@ -501,24 +439,22 @@ static void dl_font_size_set() dlclose(handle); return; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ static void dl_font_config_set_notification() { void *handle = NULL; char *error; - void(*set_font_nodification)(); + void (*set_font_nodification)(); handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY); if (!handle) { - SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so"); + SST_SECURE_TRACE("ERROR!! canNOT find libsystem-settings-util.so"); return; } set_font_nodification = dlsym(handle, "font_config_set_notification"); if ((error = dlerror()) != NULL) { - SETTING_TRACE("ERROR!! canNOT find font_config_set_notification function at libsystem-settings-util.so"); + SST_SECURE_TRACE("ERROR!! canNOT find font_config_set_notification function at libsystem-settings-util.so"); if (handle) dlclose(handle); return; @@ -528,25 +464,23 @@ static void dl_font_config_set_notification() dlclose(handle); return; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ static bool dl_font_config_set(char *font_name) { void *handle = NULL; char *error; bool ret = false; - bool(*check_font_type)(char *font_name); + bool (*check_font_type)(char *font_name); handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY); if (!handle) { - SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so"); + SST_SECURE_TRACE("ERROR!! canNOT find libsystem-settings-util.so"); return false; } check_font_type = dlsym(handle, "font_config_set"); if ((error = dlerror()) != NULL) { - SETTING_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so"); + SST_SECURE_TRACE("ERROR!! canNOT find font_config_set function at libsystem-settings-util.so"); if (handle) dlclose(handle); return false; @@ -556,9 +490,7 @@ static bool dl_font_config_set(char *font_name) dlclose(handle); return ret; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ static char *dl_get_default_font_info() { void *handle = NULL; @@ -568,14 +500,14 @@ static char *dl_get_default_font_info() handle = dlopen(SETTING_UTILS_SO_FILE_PATH, RTLD_LAZY); if (!handle) { - SETTING_TRACE("ERROR!! canNOT find libsystem-settings-util.so"); + SST_SECURE_TRACE("ERROR!! canNOT find libsystem-settings-util.so"); return false; } get_font_info = dlsym(handle, "_get_default_font"); if ((error = dlerror()) != NULL) { - SETTING_TRACE("ERROR!! canNOT find _get_default_font function at libsystem-settings-util.so"); + SST_SECURE_TRACE("ERROR!! canNOT find _get_default_font function at libsystem-settings-util.so"); if (handle) dlclose(handle); return false; @@ -585,10 +517,8 @@ static char *dl_get_default_font_info() dlclose(handle); return ret; } -/* LCOV_EXCL_STOP */ #ifdef TIZEN_WEARABLE -/* LCOV_EXCL_START */ static int system_setting_get_extended_wallpaper_num(const char *file_path, unsigned int *num) { SETTING_TRACE_BEGIN; @@ -612,9 +542,7 @@ static int system_setting_get_extended_wallpaper_num(const char *file_path, unsi return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ static int system_setting_copy_extended_wallpaper(const char *dest_file_path, const char *source_file_path) { SETTING_TRACE_BEGIN; @@ -649,9 +577,7 @@ static int system_setting_copy_extended_wallpaper(const char *dest_file_path, co return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ static int system_setting_remove_oldest_extended_wallpaper() { SETTING_TRACE_BEGIN; @@ -672,7 +598,7 @@ static int system_setting_remove_oldest_extended_wallpaper() continue; if (system_setting_get_extended_wallpaper_num(dirp->d_name, &temp_image_num) - != SYSTEM_SETTINGS_ERROR_NONE) { + != SYSTEM_SETTINGS_ERROR_NONE) { return SYSTEM_SETTINGS_ERROR_IO_ERROR; } @@ -694,9 +620,7 @@ static int system_setting_remove_oldest_extended_wallpaper() return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ static int system_setting_check_extended_wallpaper(const char *file_path) { char buffer[512]; @@ -706,24 +630,20 @@ static int system_setting_check_extended_wallpaper(const char *file_path) snprintf(buffer, 512, "%s/.bgwallpaper", tzplatform_getenv(TZ_USER_CONTENT)); return (strstr(file_path, buffer) != NULL); } -/* LCOV_EXCL_STOP */ #define WALLPAPER_MAX_COUNT 10 #endif -/* LCOV_EXCL_START */ int system_setting_set_wallpaper_home_screen(system_setting_h item, void *value) { - SETTING_TRACE_BEGIN; - char *vconf_value; - vconf_value = (char *)value; + char *vconf_value = value; bool isok = dl_is_supported_image_type_load(vconf_value); if (!isok) { /* not supported */ - SETTING_TRACE("path : %s is not supported file format", vconf_value); + SST_SECURE_TRACE("path : %s is not supported file format", vconf_value); return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; } else { - SETTING_TRACE("path : %s is SUPPORT file format", vconf_value); + SST_SECURE_TRACE("path : %s is SUPPORT file format", vconf_value); } /* error handling here */ @@ -794,7 +714,7 @@ int system_setting_set_wallpaper_home_screen(system_setting_h item, void *value) return SYSTEM_SETTINGS_ERROR_IO_ERROR; if (system_setting_vconf_set_value_int(VCONFKEY_SETAPPL_WALLPAPER_CHANGED_NOTI_INT, - VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) { + VCONFKEY_WALLPAPER_CHANGED_NOTI_GEAR)) { return SYSTEM_SETTINGS_ERROR_IO_ERROR; } } else { @@ -805,22 +725,18 @@ int system_setting_set_wallpaper_home_screen(system_setting_h item, void *value) return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ int system_setting_set_wallpaper_lock_screen(system_setting_h item, void *value) { - SETTING_TRACE_BEGIN; - char *vconf_value; - vconf_value = (char *)value; + char *vconf_value = value; bool isok = dl_is_supported_image_type_load(vconf_value); if (!isok) { /* not supported */ - SETTING_TRACE("path : %s is not supported file format", vconf_value); + SST_SECURE_TRACE("path : %s is not supported file format", vconf_value); return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; } else { - SETTING_TRACE("path : %s is SUPPORT file format", vconf_value); + SST_SECURE_TRACE("path : %s is SUPPORT file format", vconf_value); } /* error handling here */ @@ -832,12 +748,9 @@ int system_setting_set_wallpaper_lock_screen(system_setting_h item, void *value) return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ int system_setting_set_font_size(system_setting_h item, void *value) { - SETTING_TRACE_BEGIN; int *vconf_value; vconf_value = *(int **)value; @@ -848,17 +761,13 @@ int system_setting_set_font_size(system_setting_h item, void *value) return SYSTEM_SETTINGS_ERROR_IO_ERROR; dl_font_size_set(); - SETTING_TRACE_END; return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ /** * [internal API] */ -/* LCOV_EXCL_START */ -void *font_conf_doc_parse(char *doc_name, char *font_name) +void* font_conf_doc_parse(char *doc_name, char *font_name) { - SETTING_TRACE_BEGIN; xmlDocPtr doc = NULL; xmlNodePtr cur = NULL; xmlNodePtr cur2 = NULL; @@ -875,7 +784,7 @@ void *font_conf_doc_parse(char *doc_name, char *font_name) return NULL; } - if (xmlStrcmp(cur->name, (const xmlChar *)"fontconfig")) { + if (xmlStrcmp(cur->name, (const xmlChar*)"fontconfig")) { xmlFreeDoc(doc); doc = NULL; return NULL; @@ -885,13 +794,13 @@ void *font_conf_doc_parse(char *doc_name, char *font_name) bool is_changed = false; while (cur != NULL) { - if ((!xmlStrcmp(cur->name, (const xmlChar *)"match"))) { + if ((!xmlStrcmp(cur->name, (const xmlChar*)"match"))) { cur2 = cur->xmlChildrenNode; while (cur2 != NULL) { - if ((!xmlStrcmp(cur2->name, (const xmlChar *)"edit"))) { - xmlChar *name = xmlGetProp(cur2, (const xmlChar *)"name"); + if ((!xmlStrcmp(cur2->name, (const xmlChar*)"edit"))) { + xmlChar *name = xmlGetProp(cur2, (const xmlChar*)"name"); /* if name is not 'family', break */ - if (xmlStrcmp(name, (const xmlChar *)"family")) { + if (xmlStrcmp(name, (const xmlChar*)"family")) { xmlFree(name); name = NULL; break; @@ -901,8 +810,8 @@ void *font_conf_doc_parse(char *doc_name, char *font_name) cur3 = cur2->xmlChildrenNode; while (cur3 != NULL) { - if ((!xmlStrcmp(cur3->name, (const xmlChar *)"string"))) { - xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name); + if ((!xmlStrcmp(cur3->name, (const xmlChar*)"string"))) { + xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar*)font_name); key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1); xmlFree(key); key = NULL; @@ -913,20 +822,20 @@ void *font_conf_doc_parse(char *doc_name, char *font_name) } cur2 = cur2->next; } - } else if ((!xmlStrcmp(cur->name, (const xmlChar *)"alias"))) { + } else if ((!xmlStrcmp(cur->name, (const xmlChar*)"alias"))) { cur2 = cur->xmlChildrenNode; while (cur2 != NULL) { - if ((!xmlStrcmp(cur2->name, (const xmlChar *)"family"))) { - xmlNodeSetContent(cur2->xmlChildrenNode, (const xmlChar *)font_name); + if ((!xmlStrcmp(cur2->name, (const xmlChar*)"family"))) { + xmlNodeSetContent(cur2->xmlChildrenNode, (const xmlChar*)font_name); key = xmlNodeListGetString(doc, cur2->xmlChildrenNode, 1); xmlFree(key); key = NULL; is_changed = true; - } else if ((!xmlStrcmp(cur2->name, (const xmlChar *)"prefer"))) { + } else if ((!xmlStrcmp(cur2->name, (const xmlChar*)"prefer"))) { cur3 = cur2->xmlChildrenNode; while (cur3 != NULL) { - if ((!xmlStrcmp(cur3->name, (const xmlChar *)"family"))) { - xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar *)font_name); + if ((!xmlStrcmp(cur3->name, (const xmlChar*)"family"))) { + xmlNodeSetContent(cur3->xmlChildrenNode, (const xmlChar*)font_name); key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1); xmlFree(key); key = NULL; @@ -951,32 +860,29 @@ void *font_conf_doc_parse(char *doc_name, char *font_name) return NULL; } } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ int system_setting_set_font_type(system_setting_h item, void *value) { - SETTING_TRACE_BEGIN; char *font_name = NULL; - font_name = (char *)value; + font_name = (char*)value; /* get current font list */ int is_found = dl_is_available_font(font_name); if (is_found == 1) { - SETTING_TRACE("found font : %s ", font_name); + SST_SECURE_TRACE("found font : %s ", font_name); } else { - SETTING_TRACE(" NOT found font : %s ", font_name); + SST_SECURE_TRACE(" NOT found font : %s ", font_name); return SYSTEM_SETTINGS_ERROR_IO_ERROR; } bool bsave = dl_font_config_set(font_name); if (!bsave) { - SETTING_TRACE(" font type save error by font_config_set() "); + SST_SECURE_TRACE(" font type save error by font_config_set() "); return SYSTEM_SETTINGS_ERROR_IO_ERROR; } else { - SETTING_TRACE(" save OK - font_config_set() "); + SST_SECURE_TRACE(" save OK - font_config_set() "); } xmlDocPtr doc = (xmlDocPtr)font_conf_doc_parse(SETTING_FONT_CONF_FILE, font_name); @@ -989,31 +895,27 @@ int system_setting_set_font_type(system_setting_h item, void *value) dl_font_config_set_notification(); char *vconf_value; - vconf_value = (char *)value; + vconf_value = (char*)value; if (system_setting_vconf_set_value_string(item->vconf_key, vconf_value)) return SYSTEM_SETTINGS_ERROR_IO_ERROR; return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ static int category_func(const char *name, void *user_data) { - SETTING_TRACE_BEGIN; static char *category = "lock-screen"; if (name && !strcmp(name, category)) { - SETTING_TRACE(" SAME "); + SST_SECURE_TRACE(" SAME "); return -1; } else { - SETTING_TRACE(" DIFFERENT -- %s, category -- %s ", name, category); + SST_SECURE_TRACE(" DIFFERENT -- %s, category -- %s ", name, category); return 0; } return 0; } -/* LCOV_EXCL_STOP */ /** * @@ -1021,24 +923,22 @@ static int category_func(const char *name, void *user_data) * */ -/* LCOV_EXCL_START */ int system_setting_set_lockscreen_app(system_setting_h item, void *value) { - SETTING_TRACE_BEGIN; char *vconf_value; - vconf_value = (char *)value; /* ex) com.samsung.lockscreen */ + vconf_value = (char*)value; /* ex) com.samsung.lockscreen */ int r = 0; pkgmgrinfo_appinfo_h handle; r = pkgmgrinfo_appinfo_get_appinfo(vconf_value, &handle); if (r != PMINFO_R_OK) { - SETTING_TRACE("*** pkginfo failed "); + SST_SECURE_TRACE("*** pkginfo failed "); return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; } else { - SETTING_TRACE("%p", handle); + SST_SECURE_TRACE("%p", handle); } - int ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, (void *)"lock-screen"); + int ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, (void*)"lock-screen"); if (ret != PMINFO_R_OK) { pkgmgrinfo_appinfo_destroy_appinfo(handle); return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; @@ -1062,31 +962,28 @@ int system_setting_set_lockscreen_app(system_setting_h item, void *value) } return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ /*/////////////////////////////////////////////////////////////////////////////////////////////// */ /** * @todo need to add custom event notification method */ - /*//////////////////////////////////////////////////////////////////////////////////////// */ /*--------------------------------------- */ int system_setting_get_locale_country(system_setting_h item, void **value) { - SETTING_TRACE_BEGIN; char *vconf_value = NULL; if (system_setting_vconf_get_value_string(item->vconf_key, &vconf_value)) return SYSTEM_SETTINGS_ERROR_IO_ERROR; /* parsing validation */ /* en_US.UTF-8 */ - char arr[21] = { 0, }; + char arr[21] = {0}; snprintf(arr, 20, "%s", vconf_value); for (int i = 0; i < strlen(arr); i++) { if ('.' == arr[i]) { arr[i] = 0; - SETTING_TRACE("replace . to NULL : %d", i); + SST_SECURE_TRACE("replace . to NULL : %d", i); break; } } @@ -1097,12 +994,10 @@ int system_setting_get_locale_country(system_setting_h item, void **value) return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_START */ int system_setting_set_locale_country(system_setting_h item, void *value) { - SETTING_TRACE_BEGIN; char *vconf_value = NULL; - vconf_value = (char *)value; + vconf_value = (char*)value; char *ext = "UTF-8"; @@ -1114,24 +1009,22 @@ int system_setting_set_locale_country(system_setting_h item, void *value) return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ /*--------------------------------------- */ int system_setting_get_locale_language(system_setting_h item, void **value) { - SETTING_TRACE_BEGIN; char *vconf_value = NULL; if (system_setting_vconf_get_value_string(item->vconf_key, &vconf_value)) return SYSTEM_SETTINGS_ERROR_IO_ERROR; /* parsing validation */ /* en_US.UTF-8 */ - char arr[21] = { 0, }; + char arr[21] = {0}; snprintf(arr, 20, "%s", vconf_value); for (int i = 0; i < strlen(arr); i++) { if ('.' == arr[i]) { arr[i] = 0; - SETTING_TRACE("replace . to NULL : %d", i); + SST_SECURE_TRACE("replace . to NULL : %d", i); break; } } @@ -1141,12 +1034,10 @@ int system_setting_get_locale_language(system_setting_h item, void **value) return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_START */ int system_setting_set_locale_language(system_setting_h item, void *value) { - SETTING_TRACE_BEGIN; char *vconf_value = NULL; - vconf_value = (char *)value; + vconf_value = (char*)value; char *ext = "UTF-8"; @@ -1158,13 +1049,10 @@ int system_setting_set_locale_language(system_setting_h item, void *value) return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ /*--------------------------------------- */ -/* LCOV_EXCL_START */ int system_setting_get_locale_timeformat_24hour(system_setting_h item, void **value) { - SETTING_TRACE_BEGIN; int vconf_value; if (system_setting_vconf_get_value_int(item->vconf_key, &vconf_value)) @@ -1176,19 +1064,16 @@ int system_setting_get_locale_timeformat_24hour(system_setting_h item, void **va else if (vconf_value == VCONFKEY_TIME_FORMAT_24) ret_value = true; - *value = (void *)ret_value; + *value = (void*)ret_value; return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ int system_setting_set_locale_timeformat_24hour(system_setting_h item, void *value) { - SETTING_TRACE_BEGIN; bool *vconf_value; - vconf_value = (bool *)value; + vconf_value = (bool*)value; if (*vconf_value) { if (system_setting_vconf_set_value_int(item->vconf_key, VCONFKEY_TIME_FORMAT_24)) @@ -1200,9 +1085,7 @@ int system_setting_set_locale_timeformat_24hour(system_setting_h item, void *val return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ int system_setting_get_locale_timezone(system_setting_h item, void **value) { char tzpath[256]; @@ -1210,22 +1093,19 @@ int system_setting_get_locale_timezone(system_setting_h item, void **value) if (len != -1) { tzpath[len] = '\0'; } else { - SETTING_TRACE("parse error for SETTING_TZONE_SYMLINK_PATH"); + SST_SECURE_TRACE("parse error for SETTING_TZONE_SYMLINK_PATH"); return SYSTEM_SETTINGS_ERROR_IO_ERROR; } - SETTING_TRACE("tzpath : %s ", &tzpath[20]); + SST_SECURE_TRACE("tzpath : %s ", &tzpath[20]); *value = strdup(&tzpath[20]); return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ int system_setting_set_locale_timezone(system_setting_h item, void *value) { - SETTING_TRACE_BEGIN; char *timezone_value = NULL; - timezone_value = (char *)value; + timezone_value = (char*)value; char tz_path[1024]; snprintf(tz_path, 1024, "/usr/share/zoneinfo/%s", timezone_value); @@ -1241,22 +1121,17 @@ int system_setting_set_locale_timezone(system_setting_h item, void *value) } return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ int system_setting_get_time_changed(system_setting_h item, void **value) { - SETTING_TRACE_BEGIN; time_t cur_tick; - int ** val = (int**)value; + int **val = (int**)value; cur_tick = time(NULL); **val = cur_tick; /* struct tm * localtime = time (cur_tick); */ /* printf("%s\n", ctime(&cur_tick); */ return SYSTEM_SETTINGS_ERROR_NONE; - } -/* LCOV_EXCL_STOP */ /** * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL(==item->vconf_key) b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL @@ -1265,10 +1140,8 @@ int system_setting_get_time_changed(system_setting_h item, void **value) * a == true, b == false --> sound mode * a == false, b == true --> vibration mode */ -/* LCOV_EXCL_START */ int system_setting_get_sound_silent_mode(system_setting_h item, void **value) { - SETTING_TRACE_BEGIN; bool sound_cond; bool vib_cond; @@ -1281,14 +1154,13 @@ int system_setting_get_sound_silent_mode(system_setting_h item, void **value) if (sound_cond == false && vib_cond == false) { vconf_value = true; - *value = (void *)vconf_value; + *value = (void*)vconf_value; } else { vconf_value = false; - *value = (void *)vconf_value; + *value = (void*)vconf_value; } return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ /** * a = VCONFKEY_SETAPPL_SOUND_STATUS_BOOL(==item->vconf_key) b = VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL @@ -1298,10 +1170,7 @@ int system_setting_get_sound_silent_mode(system_setting_h item, void **value) */ int system_setting_set_sound_silent_mode(system_setting_h item, void *value) { - SETTING_TRACE_BEGIN; - bool *vconf_value; - - vconf_value = (bool *)value; + bool *vconf_value = value; bool vconf_sound = false; bool vconf_vib = false; @@ -1323,32 +1192,24 @@ int system_setting_set_sound_silent_mode(system_setting_h item, void *value) return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_START */ int system_setting_set_screen_backlight_time(system_setting_h item, void *value) { - SETTING_TRACE_BEGIN; - int *vconf_value; - vconf_value = *(int **)value; + int *vconf_value = *(int **)value; if (!(*vconf_value > 0 && *vconf_value <= 600)) { - SETTING_TRACE(" ERR Betweeny here 0 ~ 600"); + SST_SECURE_TRACE(" ERR Betweeny here 0 ~ 600"); return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; } if (system_setting_vconf_set_value_int(item->vconf_key, *vconf_value)) return SYSTEM_SETTINGS_ERROR_IO_ERROR; - SETTING_TRACE_END; return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ int system_setting_set_sound_notification(system_setting_h item, void *value) { - SETTING_TRACE_BEGIN; - char *vconf_value = NULL; - vconf_value = (char *)value; + char *vconf_value = value; int is_load = _is_file_accessible(vconf_value); if (is_load == 0) { @@ -1364,25 +1225,19 @@ int system_setting_set_sound_notification(system_setting_h item, void *value) return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ int system_setting_set_device_name(system_settings_key_e key, void *value) { - SETTING_TRACE_BEGIN; - char *vconf_value = NULL; - vconf_value = (char *)value; + char *vconf_value = value; if (system_setting_vconf_set_value_string(VCONFKEY_SETAPPL_DEVICE_NAME_STR, vconf_value)) return SYSTEM_SETTINGS_ERROR_IO_ERROR; return SYSTEM_SETTINGS_ERROR_NONE; } -/* LCOV_EXCL_STOP */ int system_setting_get_network_wifi_notification(system_setting_h item, void **value) { - SETTING_TRACE_BEGIN; int vconf_value; if (system_setting_vconf_get_value_int(item->vconf_key, &vconf_value)) return SYSTEM_SETTINGS_ERROR_IO_ERROR; @@ -1390,7 +1245,7 @@ int system_setting_get_network_wifi_notification(system_setting_h item, void **v bool bret; bret = (vconf_value == VCONFKEY_WIFI_QS_ENABLE) ? true : false; - *value = (void *)bret; + *value = (void*)bret; return SYSTEM_SETTINGS_ERROR_NONE; } @@ -1400,7 +1255,6 @@ int system_setting_get_network_wifi_notification(system_setting_h item, void **v int system_setting_get_ads_id(system_setting_h item, void **value) { - SETTING_TRACE_BEGIN; int optout_value = 0; if (system_setting_vconf_get_value_int(VCONFKEY_SETAPPL_AD_ID_OPT_OUT, &optout_value)) return SYSTEM_SETTINGS_ERROR_IO_ERROR; @@ -1418,12 +1272,11 @@ int system_setting_get_ads_id(system_setting_h item, void **value) return SYSTEM_SETTINGS_ERROR_NONE; } - #if DEBUG_DUMP_CONTEXT void make_ad_id(void) { uuid_t uuid_value; - char uuid_unparsed[50] = { 0 }; + char uuid_unparsed[50] = {0}; uuid_generate(uuid_value); uuid_unparse(uuid_value, uuid_unparsed); system_setting_set_ad_id(key, uuid_unparsed); //example of setting the value @@ -1431,12 +1284,10 @@ void make_ad_id(void) #endif int system_setting_set_ads_id(system_setting_h item, void *value) { - SETTING_TRACE_BEGIN; - char *vconf_value = NULL; - vconf_value = (char *)value; + char *vconf_value = value; if (system_setting_vconf_set_value_string(item->vconf_key, vconf_value)) { - SETTING_TRACE("Setting VCONFKEY_SETAPPL_AD_ID failed"); + SST_SECURE_TRACE("Setting VCONFKEY_SETAPPL_AD_ID failed"); return SYSTEM_SETTINGS_ERROR_IO_ERROR; } @@ -1448,14 +1299,13 @@ int system_settings_feature_check_bool(char *path) bool feature_data = false; int ret = system_info_get_platform_bool(path, &feature_data); if (ret != SYSTEM_INFO_ERROR_NONE) { - SETTING_TRACE("Setting - reading feature data failed, %d", ret); + SST_SECURE_TRACE("Setting - reading feature data failed, %d", ret); return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; } ret = (feature_data == true) ? SYSTEM_SETTINGS_ERROR_NONE : SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; return ret; - } int system_setting_feature_check_incoming_call(void *value) @@ -1536,7 +1386,6 @@ int system_setting_feature_check_telephony(void *value) return ret; } - int system_setting_feature_check_font(void *value) { static bool first_query = true; @@ -1576,7 +1425,6 @@ int system_setting_feature_check_accessibility_negative(void *value) return ret; } -/* LCOV_EXCL_START */ int system_setting_feature_check_wearable_profile(void *value) { static bool first_query = true; @@ -1587,7 +1435,7 @@ int system_setting_feature_check_wearable_profile(void *value) int rotary_feature = SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; ret = system_info_get_platform_string(SETTING_PROFILE_PATH, &profile_data); if (ret != SYSTEM_INFO_ERROR_NONE) { - SETTING_TRACE("Setting - reading profile string failed, %d", ret); + SST_SECURE_TRACE("Setting - reading profile string failed, %d", ret); return SYSTEM_SETTINGS_ERROR_NOT_SUPPORTED; } @@ -1606,19 +1454,17 @@ int system_setting_feature_check_wearable_profile(void *value) return ret; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ int system_setting_get_uds_state(system_setting_h item, void **value) { - int ** p_value = (int**)value; + int **p_value = (int**)value; int vconf_value; char *vconf_string_value = NULL; if (system_setting_vconf_get_value_int(item->vconf_key, &vconf_value)) return SYSTEM_SETTINGS_ERROR_IO_ERROR; - SETTING_TRACE("[%s] udsm: %d", __FUNCTION__, vconf_value); + SST_SECURE_TRACE("[%s] udsm: %d", __FUNCTION__, vconf_value); if (vconf_value == SYSTEM_SETTINGS_UDS_ON) { if (system_setting_vconf_get_value_string(VCONFKEY_SETAPPL_UDSM_PKGID_LIST, &vconf_string_value)) @@ -1642,22 +1488,21 @@ int system_setting_get_uds_state(system_setting_h item, void **value) int result = 0; result = package_manager_get_package_id_by_app_id(app_id, &package_id); if (result != PACKAGE_MANAGER_ERROR_NONE) { - SETTING_TRACE("package_manager_get_package_id_by_app_id returned error! %d", result); + SST_SECURE_TRACE("package_manager_get_package_id_by_app_id returned error! %d", result); free(app_id); free(vconf_string_value); return SYSTEM_SETTINGS_ERROR_IO_ERROR; } - SETTING_TRACE("[%s] udsm_pkg_list : %s", __FUNCTION__, vconf_string_value); + SST_SECURE_TRACE("[%s] udsm_pkg_list : %s", __FUNCTION__, vconf_string_value); } if (package_id && strstr(vconf_string_value, package_id)) { vconf_value = SYSTEM_SETTINGS_UDS_ON_WHITELISTED; - SETTING_TRACE("[%s] pkg id : %s", __FUNCTION__, package_id); + SST_SECURE_TRACE("[%s] pkg id : %s", __FUNCTION__, package_id); } else { vconf_value = SYSTEM_SETTINGS_UDS_ON; } - } free(vconf_string_value); } @@ -1665,7 +1510,6 @@ int system_setting_get_uds_state(system_setting_h item, void **value) **p_value = vconf_value; - return SYSTEM_SETTINGS_ERROR_NONE; } /* LCOV_EXCL_STOP */ diff --git a/src/sys_settings_ringtones.c b/src/sys_settings_ringtones.c index 24ac1c0..a3d78e3 100644 --- a/src/sys_settings_ringtones.c +++ b/src/sys_settings_ringtones.c @@ -25,7 +25,7 @@ /* LCOV_EXCL_START */ /*remove ext name */ -char *get_filename_from_fullname(const char *fullname) +char* get_filename_from_fullname(const char *fullname) { //retvm_if(fullname == NULL, NULL, "fullname == NULL"); if (fullname == NULL) return NULL; @@ -41,12 +41,12 @@ char *get_filename_from_fullname(const char *fullname) } /* LCOV_EXCL_STOP */ -char *get_media_basename(const char *dir_path, const char *name) +char* get_media_basename(const char *dir_path, const char *name) { //retv_if(isEmptyStr(dir_path) || isEmptyStr(name), NULL); if (dir_path == NULL) return NULL; - char path[512] = { 0 }; + char path[512] = {0}; snprintf(path, sizeof(path), "%s/%s", dir_path, name); metadata_extractor_h metadata = NULL; @@ -56,11 +56,10 @@ char *get_media_basename(const char *dir_path, const char *name) ret = metadata_extractor_set_path(metadata, path); if (ret == METADATA_EXTRACTOR_ERROR_NONE) { ret = metadata_extractor_get_metadata( - metadata, METADATA_TITLE, &title); + metadata, METADATA_TITLE, &title); metadata_extractor_destroy(metadata); if (title) - /*return (char *)g_strdup(title);*/ - return (char *)title; + return title; else return strdup(name); } else { @@ -74,18 +73,17 @@ char *get_media_basename(const char *dir_path, const char *name) int get_filelist_from_dir_path(char *path, GList **file_list) { - SETTING_TRACE_BEGIN; DIR *pDir = NULL; struct dirent *ent; static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; if (path == NULL) { - SETTING_TRACE("dir path is null"); + SST_SECURE_TRACE("dir path is null"); return -1; } if (file_list == NULL) { - SETTING_TRACE("file_list is null"); + SST_SECURE_TRACE("file_list is null"); return -1; } @@ -111,15 +109,12 @@ int get_filelist_from_dir_path(char *path, GList **file_list) pNode->path = strdup(path); pNode->name = strdup(ent->d_name); pNode->media_name = get_media_basename( - pNode->path, pNode->name); + pNode->path, pNode->name); *file_list = g_list_append(*file_list, pNode); } pthread_mutex_unlock(&mutex); closedir(pDir); - //SETTING_TRACE_END; - return 0; } - diff --git a/src/sys_settings_vconf.c b/src/sys_settings_vconf.c index 0f28803..3a6fd05 100644 --- a/src/sys_settings_vconf.c +++ b/src/sys_settings_vconf.c @@ -18,17 +18,10 @@ #include #include -#include #include "system_settings.h" #include "sys_settings.h" -#ifdef LOG_TAG -#undef LOG_TAG -#endif - -#define LOG_TAG "TIZEN_N_SYSTEM_SETTINGS" - int system_setting_vconf_get_value_int(const char *vconf_key, int *value) { return vconf_get_int(vconf_key, value); @@ -80,7 +73,6 @@ int system_setting_vconf_set_value_string(const char *vconf_key, char *value) typedef void (*system_setting_vconf_event_cb)(keynode_t *node, void *event_data); -/* LCOV_EXCL_START */ static void system_setting_vconf_event_cb0(keynode_t *node, void *event_data) { system_settings_key_e pkey = (system_settings_key_e)event_data; @@ -91,7 +83,7 @@ static void system_setting_vconf_event_cb0(keynode_t *node, void *event_data) int ret = system_settings_get_item(pkey, &system_setting_item); if (ret != 0) { if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER) - LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); + ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); } void *user_data = NULL; @@ -99,37 +91,27 @@ static void system_setting_vconf_event_cb0(keynode_t *node, void *event_data) system_setting_item->changed_cb(pkey, user_data); } } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ static void system_setting_vconf_event_cb1(keynode_t *node, void *event_data) { system_setting_vconf_event_cb0(node, event_data); } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ static void system_setting_vconf_event_cb2(keynode_t *node, void *event_data) { system_setting_vconf_event_cb0(node, event_data); } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ static void system_setting_vconf_event_cb3(keynode_t *node, void *event_data) { system_setting_vconf_event_cb0(node, event_data); } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ static void system_setting_vconf_event_cb4(keynode_t *node, void *event_data) { system_setting_vconf_event_cb0(node, event_data); } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ static system_setting_vconf_event_cb system_setting_vconf_get_event_cb_slot(system_setting_callback_slot_e slot) { switch (slot) { @@ -147,7 +129,6 @@ static system_setting_vconf_event_cb system_setting_vconf_get_event_cb_slot(syst return NULL; } } -/* LCOV_EXCL_STOP */ int system_setting_vconf_set_changed_cb(const char *vconf_key, system_settings_key_e key, system_setting_callback_slot_e slot, void *user_data) { @@ -156,12 +137,12 @@ int system_setting_vconf_set_changed_cb(const char *vconf_key, system_settings_k vconf_event_cb = system_setting_vconf_get_event_cb_slot(slot); if (vconf_event_cb == NULL) { - LOGE("[%s] INVALID_error , %s", __FUNCTION__, "vconf_event_cb == 0"); + ERR("[%s] INVALID_error , %s", __FUNCTION__, "vconf_event_cb == 0"); return SYSTEM_SETTINGS_ERROR_IO_ERROR; } - if (vconf_notify_key_changed(vconf_key, vconf_event_cb, (void *)key)) { - LOGE("[%s] INVALID_error , %s", __FUNCTION__, "vconf_notify_key_changed error"); + if (vconf_notify_key_changed(vconf_key, vconf_event_cb, (void*)key)) { + ERR("[%s] INVALID_error , %s", __FUNCTION__, "vconf_notify_key_changed error"); return SYSTEM_SETTINGS_ERROR_IO_ERROR; } @@ -182,7 +163,7 @@ int system_setting_vconf_unset_changed_cb(const char *vconf_key, system_setting_ static void system_setting_vconf_event_multi_cb(keynode_t *node, void *event_data) { - LOGE("Enter [%s]", __FUNCTION__); + ERR("Enter [%s]", __FUNCTION__); system_settings_key_e pkey = (system_settings_key_e)event_data; if (node != NULL) { @@ -191,41 +172,33 @@ static void system_setting_vconf_event_multi_cb(keynode_t *node, void *event_dat int ret = system_settings_get_item(pkey, &system_setting_item); if (ret != 0) { if (ret == SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER) - LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); + ERR("[%s] INVALID_PARAMETER(0x%08x) : invalid key", __FUNCTION__, SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER); } invoke_callback_list(&system_setting_item->changed_cb_list, pkey); } - LOGE("Leave [%s]", __FUNCTION__); + ERR("Leave [%s]", __FUNCTION__); } -/* LCOV_EXCL_START */ static void system_setting_vconf_event_multi_cb_slot_0(keynode_t *node, void *event_data) { system_setting_vconf_event_multi_cb(node, event_data); } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ static void system_setting_vconf_event_multi_cb_slot_1(keynode_t *node, void *event_data) { system_setting_vconf_event_multi_cb(node, event_data); } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ static void system_setting_vconf_event_multi_cb_slot_2(keynode_t *node, void *event_data) { system_setting_vconf_event_multi_cb(node, event_data); } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ static void system_setting_vconf_event_multi_cb_slot_3(keynode_t *node, void *event_data) { system_setting_vconf_event_multi_cb(node, event_data); } -/* LCOV_EXCL_STOP */ static system_setting_vconf_event_cb system_setting_vconf_get_event_multi_cb_slot(system_settings_key_e key) { @@ -252,7 +225,7 @@ static system_setting_vconf_event_cb system_setting_vconf_get_event_multi_cb_slo int system_setting_vconf_set_changed_multi_cb(const char *vconf_key, system_settings_key_e key) { - LOGE("Enter [%s]", __FUNCTION__); + ERR("Enter [%s]", __FUNCTION__); system_setting_vconf_event_cb vconf_event_cb; vconf_event_cb = system_setting_vconf_get_event_multi_cb_slot(key); @@ -260,19 +233,19 @@ int system_setting_vconf_set_changed_multi_cb(const char *vconf_key, system_sett if (vconf_event_cb == NULL) return SYSTEM_SETTINGS_ERROR_INVALID_PARAMETER; - int ret = vconf_notify_key_changed(vconf_key, vconf_event_cb, (void *)key); + int ret = vconf_notify_key_changed(vconf_key, vconf_event_cb, (void*)key); if (ret != 0) { - LOGE("[%s] INVALID_error , ret = %d, %s", __FUNCTION__, ret, "vconf_notify_key_changed error"); + ERR("[%s] INVALID_error , ret = %d, %s", __FUNCTION__, ret, "vconf_notify_key_changed error"); return SYSTEM_SETTINGS_ERROR_IO_ERROR; } - LOGE("Leave [%s]", __FUNCTION__); + ERR("Leave [%s]", __FUNCTION__); return SYSTEM_SETTINGS_ERROR_NONE; } int system_setting_vconf_unset_changed_multi_cb(const char *vconf_key, system_settings_key_e key) { - LOGE("Enter [%s]", __FUNCTION__); + ERR("Enter [%s]", __FUNCTION__); system_setting_vconf_event_cb vconf_event_cb; vconf_event_cb = system_setting_vconf_get_event_multi_cb_slot(key); @@ -282,11 +255,11 @@ int system_setting_vconf_unset_changed_multi_cb(const char *vconf_key, system_se int ret = vconf_ignore_key_changed(vconf_key, vconf_event_cb); if (ret != 0) { - LOGE("[%s] INVALID_error , ret = %d, %s", __FUNCTION__, ret, "vconf_ignore_key_changed error"); + ERR("[%s] INVALID_error , ret = %d, %s", __FUNCTION__, ret, "vconf_ignore_key_changed error"); return SYSTEM_SETTINGS_ERROR_IO_ERROR; } - LOGE("Leave [%s]", __FUNCTION__); + ERR("Leave [%s]", __FUNCTION__); return SYSTEM_SETTINGS_ERROR_NONE; } diff --git a/tests/mocks/efl-extension.c b/tests/mocks/efl-extension.c index 05a09c9..53a720d 100644 --- a/tests/mocks/efl-extension.c +++ b/tests/mocks/efl-extension.c @@ -16,13 +16,9 @@ #include #include #include - -#ifndef API -#define API __attribute__ ((visibility("default"))) -#endif +#include "sst.h" API bool eext_config_font_set(char *name, int size) { return true; } - diff --git a/tests/mocks/libc.c b/tests/mocks/libc.c index 53c30d5..aaa29d6 100644 --- a/tests/mocks/libc.c +++ b/tests/mocks/libc.c @@ -38,7 +38,7 @@ API int access(const char *pathname, int mode) if (0 == strcmp(pathname, "/opt/usr/test/tct-content-tizen-tests_video.mp4")) return 0; - int (*org_fn)(const char *, int) = NULL; + int (*org_fn)(const char *, int); org_fn = dlsym(RTLD_NEXT, "access"); return org_fn(pathname, mode); } @@ -50,14 +50,14 @@ API ssize_t readlink(const char *restrict path, char *restrict buf, size_t len) return 30; } - ssize_t(*org_fn)(const char *restrict, char *restrict, size_t) = NULL; + ssize_t(*org_fn)(const char *restrict, char *restrict, size_t); org_fn = dlsym(RTLD_NEXT, "readlink"); return org_fn(path, buf, len); } -API DIR* opendir(const char *name) +API DIR *opendir(const char *name) { - DIR* (*org_fn)(const char *) = NULL; + DIR *(*org_fn)(const char *); org_fn = dlsym(RTLD_NEXT, "opendir"); if (0 == strcmp(name, SETTING_DEF_RES"/Ringtones")) { diff --git a/tests/mocks/vconf.cpp b/tests/mocks/vconf.cpp index e2a76b6..f69fa33 100644 --- a/tests/mocks/vconf.cpp +++ b/tests/mocks/vconf.cpp @@ -101,7 +101,7 @@ union UnionValue { char *s; /**< String type */ }; /**< Value for keynode */ -void checkNotifyCallBack(const char* in_key, int type, UnionValue* value) +void checkNotifyCallBack(const char *in_key, int type, UnionValue *value) { string str; str = in_key; @@ -112,7 +112,7 @@ void checkNotifyCallBack(const char* in_key, int type, UnionValue* value) if (str.compare(itr->first) == 0) { vconf_callback_fn cb = (vconf_callback_fn)itr->second.first; - void* user_data = itr->second.second; + void *user_data = itr->second.second; keynode_t node; node.keyname = (char*)str.c_str(); @@ -196,7 +196,6 @@ API char *vconf_keynode_get_str(keynode_t *keynode) return NULL; } - /************************************************ * keylist handling APIs ************************************************/ @@ -216,36 +215,36 @@ API int vconf_keylist_free(keylist_t *keylist) } API int vconf_keylist_lookup(keylist_t *keylist, const char *keyname, - keynode_t **return_node) + keynode_t **return_node) { return 0; } -API keynode_t *vconf_keylist_nextnode(keylist_t *keylist) +API keynode_t* vconf_keylist_nextnode(keylist_t *keylist) { return NULL; } API int vconf_keylist_add_int(keylist_t *keylist, const char *keyname, - const int value) + const int value) { return 0; } API int vconf_keylist_add_bool(keylist_t *keylist, const char *keyname, - const int value) + const int value) { return 0; } API int vconf_keylist_add_dbl(keylist_t *keylist, const char *keyname, - const double value) + const double value) { return 0; } API int vconf_keylist_add_str(keylist_t *keylist, const char *keyname, - const char *value) + const char *value) { return 0; } @@ -292,7 +291,6 @@ int _vconf_set_str(const char *in_key, const char *strval) } #endif - #if 0 /* select key */ { sqlite3_stmt *stmt = NULL; @@ -316,9 +314,9 @@ int _vconf_set_str(const char *in_key, const char *strval) } LOG_D(stdout, "vconf get: layer[%s] key[%s], value[%s]\n", - sqlite3_column_text(stmt, 0), - sqlite3_column_text(stmt, 1), - sqlite3_column_text(stmt, 2)); + sqlite3_column_text(stmt, 0), + sqlite3_column_text(stmt, 1), + sqlite3_column_text(stmt, 2)); sqlite3_finalize(stmt); } @@ -328,7 +326,7 @@ int _vconf_set_str(const char *in_key, const char *strval) { LOG_D(stdout, "[%s][%d] key[%s] value[%s]\n", __func__, __LINE__, in_key, strval); snprintf(sql, MAX_BUF_LEN, "INSERT OR REPLACE INTO vconf ( layer, key, value ) " - "VALUES ( \"%s\", \"%s\", \'%s\');", "system", in_key, strval); + "VALUES ( \"%s\", \"%s\", \'%s\');", "system", in_key, strval); rc = sqlite3_exec(db, sql, 0, 0, &err_msg); if (rc != SQLITE_OK) { @@ -347,7 +345,7 @@ int _vconf_set_str(const char *in_key, const char *strval) sqlite3_stmt *stmt = NULL; LOG_D(stdout, "[%s][%d] key[%s] value[%s]\n", __func__, __LINE__, in_key, strval); snprintf(sql, MAX_BUF_LEN, "INSERT OR REPLACE INTO vconf ( layer, key, value ) " - "VALUES ( \"%s\", ?, ?);", "system"); + "VALUES ( \"%s\", ?, ?);", "system"); rc = sqlite3_prepare(db, sql, strlen(sql), &stmt, 0); if (rc != SQLITE_OK) { @@ -460,7 +458,7 @@ API char *vconf_get_str(const char *in_key) { int rc; char sql[MAX_BUF_LEN + 1]; - char* str = NULL; + char *str = NULL; LOG_D(stdout, "[%s][%d] start! key [%s] \n", __func__, __LINE__, in_key); @@ -486,7 +484,6 @@ API char *vconf_get_str(const char *in_key) count++; usleep(1000000); - } else { break; } @@ -502,10 +499,10 @@ API char *vconf_get_str(const char *in_key) } LOG_D(stdout, "[%s][%d] vconf get: layer[%s] key[%s], value[%s]\n", - __func__, __LINE__, - sqlite3_column_text(stmt, 0), - sqlite3_column_text(stmt, 1), - sqlite3_column_text(stmt, 2)); + __func__, __LINE__, + sqlite3_column_text(stmt, 0), + sqlite3_column_text(stmt, 1), + sqlite3_column_text(stmt, 2)); str = (char*)malloc(MAX_BUF_LEN + 1); strncpy(str, (char*)sqlite3_column_text(stmt, 2), MAX_BUF_LEN); @@ -520,7 +517,7 @@ API int vconf_get_int(const char *in_key, int *intval) { LOG_D(stdout, "[%s][%d] start!\n", __func__, __LINE__); - char* value = vconf_get_str(in_key); + char *value = vconf_get_str(in_key); if (value == NULL) return VCONF_ERROR; @@ -535,7 +532,7 @@ API int vconf_get_bool(const char *in_key, int *boolval) { LOG_D(stdout, "[%s][%d] start! key [%s] \n", __func__, __LINE__, in_key); - char* value = vconf_get_str(in_key); + char *value = vconf_get_str(in_key); if (value == NULL) { LOG_E(stdout, "[%s][%d] value is NULL! \n", __func__, __LINE__); @@ -555,7 +552,7 @@ API int vconf_get_dbl(const char *in_key, double *dblval) { LOG_D(stdout, "[%s][%d] start!\n", __func__, __LINE__); - char* value = vconf_get_str(in_key); + char *value = vconf_get_str(in_key); char *ptr; if (value == NULL) @@ -583,7 +580,7 @@ API int vconf_unset_recursive(const char *in_dir) } API int vconf_notify_key_changed(const char *in_key, vconf_callback_fn cb, - void *user_data) + void *user_data) { string str; str = in_key; @@ -615,5 +612,3 @@ API int vconf_get_ext_errno(void) #ifdef __cplusplus } #endif - - diff --git a/tests/sys_settings_test.c b/tests/sys_settings_test.c index d662daf..919350e 100644 --- a/tests/sys_settings_test.c +++ b/tests/sys_settings_test.c @@ -16,6 +16,7 @@ #include #include +#include "sst.h" #include "sys_settings_test_fw.h" void unit_test_callback0(system_settings_key_e key, void *user_data) { } diff --git a/tests/sys_settings_test_fw.h b/tests/sys_settings_test_fw.h index 8024bf9..1619c28 100644 --- a/tests/sys_settings_test_fw.h +++ b/tests/sys_settings_test_fw.h @@ -24,7 +24,7 @@ #include "sys_settings_test.h" -void add_test_func(char * test_name, GTestFunc func_pointer); +void add_test_func(char *test_name, GTestFunc func_pointer); void unittest_api(); #ifndef SYS_SETTINGS_TEST_DIR diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 4db1ea7..8788d6a 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -4,7 +4,8 @@ SET(LIB_UTILS system-settings-util) FILE(GLOB UTILS_SRCS *.c) -PKG_CHECK_MODULES(utils_pkgs REQUIRED dlog vconf fontconfig libxml-2.0 pkgmgr pkgmgr-info libsystemd) +PKG_CHECK_MODULES(utils_pkgs REQUIRED dlog vconf fontconfig libxml-2.0 pkgmgr + pkgmgr-info libsystemd) INCLUDE_DIRECTORIES(${client_pkgs_INCLUDE_DIRS}) LINK_DIRECTORIES(${client_pkgs_LIBRARY_DIRS}) diff --git a/utils/sys_settings_font.h b/utils/sys_settings_font.h index ecdc3b4..3d6b299 100644 --- a/utils/sys_settings_font.h +++ b/utils/sys_settings_font.h @@ -46,6 +46,6 @@ typedef struct _e_libs { } e_libs; typedef struct _eext_libs { - bool(*d_eext_config_font_set)(char *name, int size); + bool (*d_eext_config_font_set)(char *name, int size); } ex_libs; diff --git a/utils/sys_settings_util.c b/utils/sys_settings_util.c index 2aaf48b..e8dbadc 100644 --- a/utils/sys_settings_util.c +++ b/utils/sys_settings_util.c @@ -4,12 +4,8 @@ #include #include #include - #include - -#include #include - #include #include #include @@ -20,7 +16,6 @@ #include #include "system_settings.h" -#include "sst.h" #include "sys_settings.h" #include "sys_settings_util.h" #include "sys_settings_font.h" @@ -61,12 +56,10 @@ void *d_ecore_evas_handle = NULL; void *d_evas_handle = NULL; void *d_efl_eext_handle = NULL; - - #define DYM_FUNC_LOADING(error, handle, pfunc, func_name) do { \ pfunc = (void*)dlsym(handle, func_name); \ if ((error = dlerror()) != NULL) { \ - SETTING_TRACE("ERROR!! canNOT find %s function at %s", func_name, #handle); \ + SST_SECURE_TRACE("ERROR!! canNOT find %s function at %s", func_name, #handle); \ if (handle) \ dlclose(handle); \ return false; \ @@ -90,7 +83,7 @@ int loading_dym_font(f_libs *font_lib) if (!d_font_handle) { d_font_handle = dlopen(SETTING_FONT_CONFIG_SO_PATH, RTLD_LAZY); if (!d_font_handle) { - SETTING_TRACE("ERROR!! canNOT find "SETTING_FONT_CONFIG_SO_PATH); + SST_SECURE_TRACE("ERROR!! canNOT find "SETTING_FONT_CONFIG_SO_PATH); return false; } } @@ -122,7 +115,7 @@ int loading_dym_efl(e_libs *efl_libs) if (!d_ecore_evas_handle) { d_ecore_evas_handle = dlopen(SETTING_ECORE_EVAS_SO_PATH, RTLD_LAZY); if (!d_ecore_evas_handle) { - SETTING_TRACE("ERROR!! canNOT find "SETTING_ECORE_EVAS_SO_PATH" %s", dlerror()); + SST_SECURE_TRACE("ERROR!! canNOT find "SETTING_ECORE_EVAS_SO_PATH" %s", dlerror()); return false; } @@ -131,7 +124,7 @@ int loading_dym_efl(e_libs *efl_libs) if (!d_evas_handle) { d_evas_handle = dlopen(SETTING_EVAS_SO_PATH, RTLD_LAZY); if (!d_evas_handle) { - SETTING_TRACE("ERROR!! canNOT find "SETTING_EVAS_SO_PATH" %s", dlerror()); + SST_SECURE_TRACE("ERROR!! canNOT find "SETTING_EVAS_SO_PATH" %s", dlerror()); return false; } } @@ -167,7 +160,7 @@ int loading_dym_efl_eext(ex_libs *eext_libs) if (!d_efl_eext_handle) { d_efl_eext_handle = dlopen(SETTING_EFL_EXTENSION_SO_PATH, RTLD_LAZY); if (!d_efl_eext_handle) { - SETTING_TRACE("ERROR!! canNOT find "SETTING_EFL_EXTENSION_SO_PATH" %s", dlerror()); + SST_SECURE_TRACE("ERROR!! canNOT find "SETTING_EFL_EXTENSION_SO_PATH" %s", dlerror()); return false; } } @@ -178,9 +171,8 @@ int loading_dym_efl_eext(ex_libs *eext_libs) } /* Returned family name should be free'd manually. */ -char *__get_main_font_family_name_by_alias(char *alias) +char* __get_main_font_family_name_by_alias(char *alias) { - SETTING_TRACE_BEGIN; FcFontSet *set = NULL; FcPattern *pat = NULL; FcConfig *font_config = NULL; @@ -198,7 +190,7 @@ char *__get_main_font_family_name_by_alias(char *alias) return ret; } - pat = font_libs.d_FcPatternBuild(0, FC_FAMILY, FcTypeString, alias, (char *)0); + pat = font_libs.d_FcPatternBuild(0, FC_FAMILY, FcTypeString, alias, (char*)0); if (pat == NULL) { if (font_config != NULL) { @@ -217,7 +209,7 @@ char *__get_main_font_family_name_by_alias(char *alias) if (set != NULL && (set->nfont > 0)) { font_libs.d_FcPatternGetString(set->fonts[0], FC_FAMILY, 0, &family); - ret = g_strdup((char *)family); + ret = g_strdup((char*)family); font_libs.d_FcFontSetDestroy(set); set = NULL; @@ -241,13 +233,11 @@ char *__get_main_font_family_name_by_alias(char *alias) return ret; } -/* LCOV_EXCL_START */ API bool __is_supported_image_type_load(char *path) { - SETTING_TRACE_BEGIN; e_libs efl_libs; if (!loading_dym_efl(&efl_libs)) { - SETTING_TRACE("ERROR!! canNOT loading efl!!"); + SST_SECURE_TRACE("ERROR!! canNOT loading efl!!"); return false; } @@ -268,10 +258,10 @@ API bool __is_supported_image_type_load(char *path) bool result = false; if (ret == 0) { - SETTING_TRACE("%s - OK", path); + SST_SECURE_TRACE("%s - OK", path); result = true; } else { - SETTING_TRACE("%s - NO", path); + SST_SECURE_TRACE("%s - NO", path); result = false; } efl_libs.d_ecore_evas_free(ee); @@ -279,25 +269,19 @@ API bool __is_supported_image_type_load(char *path) close_dym_efl(); return result; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ API void font_config_set_notification() { - SETTING_TRACE_BEGIN; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ API int __is_available_font(char *font_name) { - SETTING_TRACE_BEGIN; FcObjectSet *os = NULL; FcFontSet *fs = NULL; FcPattern *pat = NULL; FcConfig *font_config = NULL; int ret = 0; - f_libs font_libs = { 0 }; + f_libs font_libs = {0}; if (!loading_dym_font(&font_libs)) return -1; @@ -315,7 +299,7 @@ API int __is_available_font(char *font_name) pat = font_libs.d_FcPatternCreate(); - os = font_libs.d_FcObjectSetBuild(FC_FAMILY, FC_FILE, FC_FAMILYLANG, (char *)0); + os = font_libs.d_FcObjectSetBuild(FC_FAMILY, FC_FILE, FC_FAMILYLANG, (char*)0); if (os) { fs = font_libs.d_FcFontList(font_config, pat, os); @@ -330,7 +314,7 @@ API int __is_available_font(char *font_name) if (fs) { int j; - SETTING_TRACE("fs->nfont = %d", fs->nfont); + SST_SECURE_TRACE("fs->nfont = %d", fs->nfont); for (j = 0; j < fs->nfont; j++) { FcChar8 *family = NULL; @@ -340,8 +324,8 @@ API int __is_available_font(char *font_name) int preload_path_len = strlen(SETTING_FONT_PRELOAD_FONT_PATH); int download_path_len = strlen(SETTING_FONT_DOWNLOADED_FONT_PATH); - if (file && (!strncmp((const char *)file, SETTING_FONT_PRELOAD_FONT_PATH, preload_path_len) - || !strncmp((const char *)file, SETTING_FONT_DOWNLOADED_FONT_PATH, download_path_len))) { + if (file && (!strncmp((const char*)file, SETTING_FONT_PRELOAD_FONT_PATH, preload_path_len) + || !strncmp((const char*)file, SETTING_FONT_DOWNLOADED_FONT_PATH, download_path_len))) { char *family_result = NULL; FcChar8 *lang = NULL; int id = 0; @@ -349,20 +333,20 @@ API int __is_available_font(char *font_name) break; if (font_libs.d_FcPatternGetString(fs->fonts[j], FC_FAMILYLANG, id, &lang) != FcResultMatch) break; - family_result = (char *)family; + family_result = (char*)family; /* Find proper family name for current locale. */ while (locale && family && lang) { - if (!strncmp(locale, (char *)lang, strlen((char *)lang))) { - family_result = (char *)family; + if (!strncmp(locale, (char*)lang, strlen((char*)lang))) { + family_result = (char*)family; break; } /* I will set english as default family language. */ /* If there is no proper family language for current locale, */ /* we have to show the english family name. */ - if (!strcmp((char *)lang, (char *)"en")) - family_result = (char *)family; + if (!strcmp((char*)lang, (char*)"en")) + family_result = (char*)family; id++; if (font_libs.d_FcPatternGetString(fs->fonts[j], FC_FAMILY, id, &family) != FcResultMatch) @@ -372,7 +356,7 @@ API int __is_available_font(char *font_name) } if (family_result) { - SETTING_TRACE("-------- FONT - family_result = %s", (char *)family_result); + SST_SECURE_TRACE("-------- FONT - family_result = %s", (char*)family_result); if (strcmp(family_result, font_name) == 0) { ret = 1; break; @@ -389,19 +373,14 @@ API int __is_available_font(char *font_name) DYM_CLOSE_HANDLE(d_font_handle); return ret; } -/* LCOV_EXCL_STOP */ - -API char *_get_default_font() +API char* _get_default_font() { return __get_main_font_family_name_by_alias(SETTING_FONT_TIZEN_DEFAULT_FONT_ALIAS); } - -/* LCOV_EXCL_START */ API bool font_config_set(char *font_name) { - SETTING_TRACE_BEGIN; ex_libs eext_libs; if (!loading_dym_efl_eext(&eext_libs)) return false; @@ -410,12 +389,9 @@ API bool font_config_set(char *font_name) DYM_CLOSE_HANDLE(d_efl_eext_handle); return ret; } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ API void __font_size_set() { - SETTING_TRACE_BEGIN; ex_libs eext_libs; if (!loading_dym_efl_eext(&eext_libs)) return; @@ -428,12 +404,9 @@ API void __font_size_set() DYM_CLOSE_HANDLE(d_efl_eext_handle); free(font_name); } -/* LCOV_EXCL_STOP */ -/* LCOV_EXCL_START */ static int __font_size_get() { - SETTING_TRACE_BEGIN; int font_size = -1; int vconf_value = -1;