/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
typedef struct {
alarm_registered_alarm_cb cb;
- void* user_data;
- bool* foreach_break;
+ void *user_data;
+ bool *foreach_break;
} alarm_foreach_item_cb_context;
static int alarm_registered_alarm_cb_broker(int alarm_id, void *user_data)
{
- alarm_foreach_item_cb_context* foreach_cb_context = NULL;
+ alarm_foreach_item_cb_context *foreach_cb_context = NULL;
if (user_data == NULL)
return 0;
- foreach_cb_context = (alarm_foreach_item_cb_context*)user_data;
+ foreach_cb_context = (alarm_foreach_item_cb_context *)user_data;
if (foreach_cb_context != NULL && *(foreach_cb_context->foreach_break) == false) {
if (foreach_cb_context->cb(alarm_id, foreach_cb_context->user_data) == false)
return 0;
}
-static int convert_error_code_to_alarm(const char* function, alarm_error_t alarm_error)
+static int convert_error_code_to_alarm(const char *function, alarm_error_t alarm_error)
{
switch (alarm_error) {
case ERR_ALARM_INVALID_PARAM:
}
}
-int alarm_get_scheduled_date(int alarm_id, struct tm* date)
+int alarm_get_scheduled_date(int alarm_id, struct tm *date)
{
alarm_error_t result;
time_t due_time = 0;
return ALARM_ERROR_NONE;
}
-int alarm_get_scheduled_period(int alarm_id, int* period)
+int alarm_get_scheduled_period(int alarm_id, int *period)
{
alarm_error_t result;
alarm_entry_t *entry = NULL;
int alarm_schedule_at_date(app_control_h app_control, struct tm *date, int period_in_second, int *alarm_id)
{
alarm_date_t internal_time;
- alarm_entry_t* alarm_info;
+ alarm_entry_t *alarm_info;
bundle *bundle_data;
int result;
int alarm_schedule_once_at_date(app_control_h app_control, struct tm *date, int *alarm_id)
{
alarm_date_t internal_time;
- alarm_entry_t* alarm_info;
+ alarm_entry_t *alarm_info;
bundle *bundle_data;
int result;
return convert_error_code_to_alarm(__FUNCTION__, result);
}
-int alarm_foreach_registered_alarm(alarm_registered_alarm_cb callback, void* user_data)
+int alarm_foreach_registered_alarm(alarm_registered_alarm_cb callback, void *user_data)
{
int result;
bool foreach_break = false;
return convert_error_code_to_alarm(__FUNCTION__, result);
}
-int alarm_get_current_time(struct tm* date)
+int alarm_get_current_time(struct tm *date)
{
time_t now;
int alarm_schedule_with_recurrence_week_flag(app_control_h app_control, struct tm *date, int week_flag, int *alarm_id)
{
alarm_date_t internal_time;
- alarm_entry_t* alarm_info;
+ alarm_entry_t *alarm_info;
bundle *bundle_data;
int result;
return ALARM_ERROR_NONE;
}
+
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
#define LOG_TAG "CAPI_APPFW_APPLICATION"
-static const char* app_error_to_string(app_error_e error)
+static const char *app_error_to_string(app_error_e error)
{
switch (error) {
case APP_ERROR_NONE:
}
}
-int app_error(app_error_e error, const char* function, const char *description)
+int app_error(app_error_e error, const char *function, const char *description)
{
if (description)
LOGE("[%s] %s(0x%08x) : %s", function, app_error_to_string(error), error, description);
return error;
}
+
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
return APP_ERROR_NONE;
}
+
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
finalizer_head.next = NULL;
}
+
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
return APP_ERROR_NONE;
}
-
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014 - 2016 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.
const char *buf = aul_get_app_tep_resource_path();
return _STRDUP(buf);
}
+
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
extern int appsvc_request_transient_app(bundle *b, unsigned int callee_id, appsvc_host_res_fn cbfunc, void *data);
static int app_control_create_reply(bundle *data, struct app_control_s **app_control);
-static const char* app_control_error_to_string(app_control_error_e error)
+static const char *app_control_error_to_string(app_control_error_e error)
{
switch (error) {
case APP_CONTROL_ERROR_NONE:
}
}
-int app_control_error(app_control_error_e error, const char* function, const char *description)
+int app_control_error(app_control_error_e error, const char *function, const char *description)
{
if (description)
LOGE("[%s] %s(0x%08x) : %s", function, app_control_error_to_string(error), error, description);
if (appsvc_data_is_array(app_control->data, key)) {
app_control_get_extra_data_array(app_control, key, &value_array, &value_array_length);
- appsvc_add_data_array(reply_data, key, (const char**)value_array, value_array_length);
+ appsvc_add_data_array(reply_data, key, (const char **)value_array, value_array_length);
for (value_array_index = 0; value_array_index < value_array_length; value_array_index++)
free(value_array[value_array_index]);
return app_control_error(APP_CONTROL_ERROR_KEY_NOT_FOUND, __FUNCTION__, NULL);
}
- array_data_clone = calloc(array_data_length, sizeof(char*));
+ array_data_clone = calloc(array_data_length, sizeof(char *));
if (array_data_clone == NULL)
return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
typedef struct {
app_control_h app_control;
app_control_extra_data_cb callback;
- void* user_data;
+ void *user_data;
bool foreach_break;
} foreach_context_extra_data_t;
static void app_control_cb_broker_bundle_iterator(const char *key, const int type, const bundle_keyval_t *kv, void *user_data)
{
- foreach_context_extra_data_t* foreach_context = NULL;
+ foreach_context_extra_data_t *foreach_context = NULL;
app_control_extra_data_cb extra_data_cb;
if (key == NULL || !(type == BUNDLE_TYPE_STR || type == BUNDLE_TYPE_STR_ARRAY))
return;
- foreach_context = (foreach_context_extra_data_t*)user_data;
+ foreach_context = (foreach_context_extra_data_t *)user_data;
if (foreach_context->foreach_break == true)
return;
typedef struct {
app_control_h app_control;
app_control_app_matched_cb callback;
- void* user_data;
+ void *user_data;
bool foreach_break;
} foreach_context_launchable_app_t;
return -1;
}
- foreach_context = (foreach_context_launchable_app_t*)data;
+ foreach_context = (foreach_context_launchable_app_t *)data;
if (foreach_context->foreach_break == true)
return -1;
return APP_CONTROL_ERROR_NONE;
}
+
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
* There are 3 ways to set an alarm.
* <table>
* <tr>
- * <th>FUNCTION</th>
- * <th>DESCRIPTION </th>
+ * <th>FUNCTION</th>
+ * <th>DESCRIPTION</th>
* </tr>
* <tr>
- * <td>alarm_schedule_once_after_delay()</td>
- * <td>Sets an alarm to be triggered at specific time once</td>
+ * <td>alarm_schedule_once_after_delay()</td>
+ * <td>Sets an alarm to be triggered at specific time once</td>
* </tr>
* <tr>
- * <td>alarm_schedule_once_at_date()</td>
- * <td>Sets an alarm to be triggered after specific delay once</td>
+ * <td>alarm_schedule_once_at_date()</td>
+ * <td>Sets an alarm to be triggered after specific delay once</td>
* </tr>
* <tr>
- * <td>alarm_schedule_with_recurrence_week_flag()</td>
- * <td>Sets an alarm to be triggered at specific time with recurrent days of the week(can repeat on days of the week)</td>
+ * <td>alarm_schedule_with_recurrence_week_flag()</td>
+ * <td>Sets an alarm to be triggered at specific time with recurrent days of the week(can repeat on days of the week)</td>
* </tr>
* <tr>
- * <td>alarm_schedule_after_delay()</td>
- * <td>Sets an alarm to be triggered after specific time(Since 2.4, this api does not support exact period and delay for minimizing the wakeups of the device. The system can adjust when the alarm expires.)</td>
+ * <td>alarm_schedule_after_delay()</td>
+ * <td>Sets an alarm to be triggered after specific time(Since 2.4, this api does not support exact period and delay for minimizing the wakeups of the device. The system can adjust when the alarm expires.)</td>
* </tr>
* </table>
* \n
*/
#endif /* __TIZEN_APPFW_ALARM_DOC_H__ */
+
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014 - 2016 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.
*/
#endif /* __TIZEN_APPFW_APP_COMMON_DOC_H__ */
+
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
*/
#endif /* __TIZEN_APPFW_APP_CONTROL_DOC_H__ */
+
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
*/
#endif /* __TIZEN_APPFW_APP_DOC_H__ */
+
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2015 - 2016 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.
*/
#endif /* __TIZEN_APPFW_EVENT_DOC_H__ */
+
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
#endif /* __TIZEN_APPFW_I18N_DOC_H__ */
+
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
*/
#endif /* __TIZEN_APPFW_PREFERENCE_DOC_H__ */
+
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2015 - 2016 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.
*/
#endif /* __TIZEN_APPFW_APP_RESOURCE_MANAGER_DOC_H__ */
+
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
}
#endif
#endif /* __TIZEN_APPFW_APP_H__ */
+
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
* @see alarm_get_scheduled_date()
* @see #alarm_week_flag_e
*/
-int alarm_schedule_with_recurrence_week_flag(app_control_h app_control, struct tm *date, int week_flag,int *alarm_id);
+int alarm_schedule_with_recurrence_week_flag(app_control_h app_control, struct tm *date, int week_flag, int *alarm_id);
/**
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014 - 2016 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.
* @see app_remove_event_handler
* @see app_event_info_h
*/
-typedef struct app_event_handler* app_event_handler_h;
+typedef struct app_event_handler *app_event_handler_h;
/**
* @see app_event_get_device_orientation
* @see app_event_get_suspended_state
*/
-typedef struct app_event_info* app_event_info_h;
+typedef struct app_event_info *app_event_info_h;
/**
#endif
#endif /* __TIZEN_APPFW_APP_H__ */
+
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014 - 2016 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.
* @brief App Control handle.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
-typedef struct app_control_s* app_control_h;
+typedef struct app_control_s *app_control_h;
/**
#endif
#endif /* __TIZEN_APPFW_APP_CONTROL_H__ */
+
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014 - 2016 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.
#endif
#endif /* __TIZEN_APPFW_APP_CONTROL_INTERNAL_H__ */
+
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2015 - 2016 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.
* @brief Event handle.
* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
*/
-typedef struct event_handler* event_handler_h;
+typedef struct event_handler *event_handler_h;
/**
* @brief Event callback.
#endif
#endif /* __TIZEN_APPFW_EVENT_H__ */
+
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
#endif
#endif /* __TIZEN_APPFW_APP_EXTENSION_H__ */
+
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
* @return The localized translation for the given @a message on success,
* otherwise the given @a message
*/
-char* i18n_get_text(const char *message);
+char *i18n_get_text(const char *message);
/**
* @}
#endif
#endif /* __TIZEN_APPFW_I18N_H__ */
+
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
typedef void (*app_finalizer_cb) (void *data);
-int app_error(app_error_e error, const char* function, const char *description);
+int app_error(app_error_e error, const char *function, const char *description);
app_device_orientation_e app_convert_appcore_rm(enum appcore_rm rm);
#endif
#endif /* __TIZEN_APPFW_APP_INTERNAL_H__ */
+
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
#endif
#endif /* __TIZEN_APPFW_PREFERENCE_H__ */
+
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
#define PREF_DIR ".pref/"
#define PREFERENCE_KEY_PATH_LEN 1024
-#define ERR_LEN 128
+#define ERR_LEN 1024
#define PREF_DB_NAME ".pref.db"
#define PREF_TBL_NAME "pref"
#endif
#endif /* __TIZEN_APPFW_PREFERENCE_INTERNAL_H__ */
+
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2015 - 2016 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.
#endif /* __PREFERENCE_LOG_H__ */
+
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
*
* @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
* @remarks Please make sure that the instance of resource manager should be released when the application is closing only.
- * It is highly recommended way to improve run-time performance.
+ * It is highly recommended way to improve run-time performance.
* @return @c 0 on success,
* otherwise a negative error value
* @retval #APP_RESOURCE_ERROR_NONE Successful
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
*/
#endif /* __TIZEN_APPFW_APP_TYPES_H__ */
+
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
}
#endif
-char* _preference_get_pref_dir_path()
+char *_preference_get_pref_dir_path()
{
char *app_data_path = NULL;
return PREFERENCE_ERROR_IO_ERROR;
}
- key = (const char*)convert_key;
+ key = (const char *)convert_key;
snprintf(path, PATH_MAX-1, "%s%s", pref_dir_path, key);
{
char *pref_dir_path = NULL;
mode_t dir_mode = 0664 | 0111;
+ char err_buf[ERR_LEN] = {0,};
pref_dir_path = _preference_get_pref_dir_path();
if (!pref_dir_path) {
if (access(pref_dir_path, F_OK) < 0) {
if (mkdir(pref_dir_path, dir_mode) < 0) {
- char err_buf[ERR_LEN] = {0,};
strerror_r(errno, err_buf, sizeof(err_buf));
ERR("mkdir() failed(%d/%s)", errno, err_buf);
return PREFERENCE_ERROR_IO_ERROR;
return PREFERENCE_ERROR_NONE;
}
-static int _preference_set_key_creation(const char* path)
+static int _preference_set_key_creation(const char *path)
{
int fd;
mode_t temp;
+ char err_buf[ERR_LEN] = {0,};
+
temp = umask(0000);
fd = open(path, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP);
umask(temp);
if (fd == -1) {
- char err_buf[ERR_LEN] = {0,};
strerror_r(errno, err_buf, sizeof(err_buf));
ERR("open(rdwr,create) error: %d(%s)", errno, err_buf);
return PREFERENCE_ERROR_IO_ERROR;
static int _preference_check_retry_err(keynode_t *keynode, int preference_errno, int io_errno, int op_type)
{
int is_busy_err = 0;
+ int rc = 0;
+ char path[PATH_MAX] = {0,};
+ char err_buf[ERR_LEN] = {0,};
if (preference_errno == PREFERENCE_ERROR_FILE_OPEN) {
switch (io_errno) {
case ENOENT:
if (op_type == PREFERENCE_OP_SET) {
- int rc = 0;
- char path[PATH_MAX] = {0,};
rc = _preference_get_key_path(keynode, path);
if (rc != PREFERENCE_ERROR_NONE) {
ERR("_preference_get_key_path error");
is_busy_err = 0;
}
- if (is_busy_err == 1)
+ if (is_busy_err == 1) {
return 1;
- else {
- char err_buf[ERR_LEN] = {0,};
+ } else {
strerror_r(errno, err_buf, sizeof(err_buf));
ERR("key(%s), check retry err: %d/(%d/%s).", keynode->keyname, preference_errno, io_errno, err_buf);
return 0;
*/
API int preference_set_int(const char *key, int intval)
{
+ int func_ret = PREFERENCE_ERROR_NONE;
+ keynode_t *pKeyNode;
+
START_TIME_CHECK
retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is NULL");
- int func_ret = PREFERENCE_ERROR_NONE;
-
- keynode_t* pKeyNode = _preference_keynode_new();
+ pKeyNode = _preference_keynode_new();
retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
func_ret = _preference_keynode_set_keyname(pKeyNode, key);
*/
API int preference_set_boolean(const char *key, bool boolval)
{
+ int func_ret = PREFERENCE_ERROR_NONE;
+ keynode_t *pKeyNode;
+
START_TIME_CHECK
retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is NULL");
- int func_ret = PREFERENCE_ERROR_NONE;
- keynode_t* pKeyNode = _preference_keynode_new();
+ pKeyNode = _preference_keynode_new();
retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
func_ret = _preference_keynode_set_keyname(pKeyNode, key);
*/
API int preference_set_double(const char *key, double dblval)
{
+ int func_ret = PREFERENCE_ERROR_NONE;
+ keynode_t *pKeyNode;
+
START_TIME_CHECK
retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is NULL");
- int func_ret = PREFERENCE_ERROR_NONE;
- keynode_t* pKeyNode = _preference_keynode_new();
+ pKeyNode = _preference_keynode_new();
retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
func_ret = _preference_keynode_set_keyname(pKeyNode, key);
*/
API int preference_set_string(const char *key, const char *strval)
{
+ int func_ret = PREFERENCE_ERROR_NONE;
+ keynode_t *pKeyNode;
+
START_TIME_CHECK
retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is NULL");
retvm_if(strval == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: value is NULL");
- int func_ret = PREFERENCE_ERROR_NONE;
- keynode_t* pKeyNode = _preference_keynode_new();
+ pKeyNode = _preference_keynode_new();
retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
func_ret = _preference_keynode_set_keyname(pKeyNode, key);
/* read data value */
switch (type) {
case PREFERENCE_TYPE_INT:
- read_size = fread((void*)&value_int, sizeof(int), 1, fp);
+ read_size = fread((void *)&value_int, sizeof(int), 1, fp);
if ((read_size <= 0) || (read_size > sizeof(int))) {
if (!ferror(fp))
LOGW("number of read items for value is wrong. err : %d", errno);
break;
case PREFERENCE_TYPE_DOUBLE:
- read_size = fread((void*)&value_dbl, sizeof(double), 1, fp);
+ read_size = fread((void *)&value_dbl, sizeof(double), 1, fp);
if ((read_size <= 0) || (read_size > sizeof(double))) {
if (!ferror(fp))
LOGW("number of read items for value is wrong. err : %d", errno);
break;
case PREFERENCE_TYPE_BOOLEAN:
- read_size = fread((void*)&value_int, sizeof(int), 1, fp);
+ read_size = fread((void *)&value_int, sizeof(int), 1, fp);
if ((read_size <= 0) || (read_size > sizeof(int))) {
if (!ferror(fp))
LOGW("number of read items for value is wrong. err : %d", errno);
*/
API int preference_get_int(const char *key, int *intval)
{
+ int func_ret = PREFERENCE_ERROR_IO_ERROR;
+ keynode_t *pKeyNode;
+
START_TIME_CHECK
retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is null");
retvm_if(intval == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: output buffer is null");
- int func_ret = PREFERENCE_ERROR_IO_ERROR;
- keynode_t* pKeyNode = _preference_keynode_new();
+ pKeyNode = _preference_keynode_new();
retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
func_ret = _preference_keynode_set_keyname(pKeyNode, key);
*/
API int preference_get_boolean(const char *key, bool *boolval)
{
+ int func_ret = PREFERENCE_ERROR_IO_ERROR;
+ keynode_t *pKeyNode;
+
START_TIME_CHECK
retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is null");
retvm_if(boolval == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: output buffer is null");
- int func_ret = PREFERENCE_ERROR_IO_ERROR;
- keynode_t* pKeyNode = _preference_keynode_new();
+ pKeyNode = _preference_keynode_new();
retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
func_ret = _preference_keynode_set_keyname(pKeyNode, key);
*/
API int preference_get_double(const char *key, double *dblval)
{
+ int func_ret = PREFERENCE_ERROR_IO_ERROR;
+ keynode_t *pKeyNode;
+
START_TIME_CHECK
retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is null");
retvm_if(dblval == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: output buffer is null");
- int func_ret = PREFERENCE_ERROR_IO_ERROR;
- keynode_t* pKeyNode = _preference_keynode_new();
+ pKeyNode = _preference_keynode_new();
retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
func_ret = _preference_keynode_set_keyname(pKeyNode, key);
*/
API int preference_get_string(const char *key, char **value)
{
+ int func_ret = PREFERENCE_ERROR_IO_ERROR;
+ keynode_t *pKeyNode;
+ char *tempstr = NULL;
+
START_TIME_CHECK
retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is null");
retvm_if(value == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: output buffer is null");
- int func_ret = PREFERENCE_ERROR_IO_ERROR;
- keynode_t* pKeyNode = _preference_keynode_new();
+ pKeyNode = _preference_keynode_new();
retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
func_ret = _preference_keynode_set_keyname(pKeyNode, key);
return PREFERENCE_ERROR_IO_ERROR;
}
- char *tempstr = NULL;
func_ret = _preference_get_key(pKeyNode);
-
if (func_ret != PREFERENCE_ERROR_NONE) {
ERR("preference_get_string(%d) : %s error", getpid(), key);
} else {
- if (pKeyNode->type == PREFERENCE_TYPE_STRING)
+ if (pKeyNode->type == PREFERENCE_TYPE_STRING) {
tempstr = pKeyNode->value.s;
- else {
+ } else {
ERR("The type(%d) of keynode(%s) is not STR", pKeyNode->type, pKeyNode->keyname);
func_ret = PREFERENCE_ERROR_INVALID_PARAMETER;
}
*/
API int preference_remove(const char *key)
{
- START_TIME_CHECK
-
char path[PATH_MAX] = {0,};
int ret = -1;
int err_retry = PREFERENCE_ERROR_RETRY_CNT;
int func_ret = PREFERENCE_ERROR_NONE;
+ char err_buf[ERR_LEN] = {0,};
+
+ START_TIME_CHECK
retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is null");
- keynode_t* pKeyNode = _preference_keynode_new();
+ keynode_t *pKeyNode = _preference_keynode_new();
retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
ret = _preference_keynode_set_keyname(pKeyNode, key);
do {
ret = remove(path);
if (ret == -1) {
- char err_buf[ERR_LEN] = {0,};
strerror_r(errno, err_buf, sizeof(err_buf));
ERR("preference_remove() failed. ret=%d(%s), key(%s)", errno, err_buf, key);
func_ret = PREFERENCE_ERROR_IO_ERROR;
API int preference_remove_all(void)
{
- START_TIME_CHECK
-
int ret = -1;
int err_retry = PREFERENCE_ERROR_RETRY_CNT;
int func_ret = PREFERENCE_ERROR_NONE;
struct dirent *result = NULL;
char *pref_dir_path = NULL;
char err_buf[ERR_LEN] = {0,};
+ const char *entry;
+ char *keyname = NULL;
+ char path[PATH_MAX] = {0,};
+
+ START_TIME_CHECK
pref_dir_path = _preference_get_pref_dir_path();
if (!pref_dir_path) {
return PREFERENCE_ERROR_IO_ERROR;
}
- keynode_t* pKeyNode = _preference_keynode_new();
+ keynode_t *pKeyNode = _preference_keynode_new();
if (pKeyNode == NULL) {
ERR("key malloc fail");
closedir(dir);
}
while (readdir_r(dir, &dent, &result) == 0 && result != NULL) {
- const char *entry = dent.d_name;
- char *keyname = NULL;
- char path[PATH_MAX] = {0,};
-
+ entry = dent.d_name;
if (entry[0] == '.')
continue;
int preference_is_existing(const char *key, bool *exist)
{
- START_TIME_CHECK
-
char path[PATH_MAX] = {0,};
int ret = -1;
int func_ret = PREFERENCE_ERROR_NONE;
+ keynode_t *pKeyNode;
+
+ START_TIME_CHECK
retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is null");
retvm_if(exist == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is null");
- keynode_t* pKeyNode = _preference_keynode_new();
+ pKeyNode = _preference_keynode_new();
retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
ret = _preference_keynode_set_keyname(pKeyNode, key);
return func_ret;
}
-
API int preference_set_changed_cb(const char *key, preference_changed_cb callback, void *user_data)
{
+ int func_ret = PREFERENCE_ERROR_IO_ERROR;
+ keynode_t *pKeyNode;
+
START_TIME_CHECK
retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is null");
retvm_if(callback == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: cb(%p)", callback);
- int func_ret = PREFERENCE_ERROR_IO_ERROR;
-
- keynode_t* pKeyNode = _preference_keynode_new();
+ pKeyNode = _preference_keynode_new();
retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
func_ret = _preference_keynode_set_keyname(pKeyNode, key);
API int preference_unset_changed_cb(const char *key)
{
- START_TIME_CHECK
-
int func_ret = PREFERENCE_ERROR_IO_ERROR;
+ keynode_t *pKeyNode;
+ char err_buf[ERR_LEN] = {0,};
+
+ START_TIME_CHECK
retvm_if(key == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: key is null");
- keynode_t* pKeyNode = _preference_keynode_new();
+ pKeyNode = _preference_keynode_new();
retvm_if(pKeyNode == NULL, PREFERENCE_ERROR_OUT_OF_MEMORY, "key malloc fail");
func_ret = _preference_keynode_set_keyname(pKeyNode, key);
_preference_keynode_free(pKeyNode);
return PREFERENCE_ERROR_NO_KEY;
} else if (errno != 0) {
- char err_buf[ERR_LEN] = {0,};
strerror_r(errno, err_buf, sizeof(err_buf));
ERR("preference_unset_changed_cb() failed: key(%s) error(%d/%s)", key, errno, err_buf);
_preference_keynode_free(pKeyNode);
API int preference_foreach_item(preference_item_cb callback, void *user_data)
{
- START_TIME_CHECK
-
- retvm_if(callback == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: cb(%p)", callback);
-
int ret = 0;
DIR *dir;
struct dirent dent;
struct dirent *result = NULL;
char *pref_dir_path = NULL;
char err_buf[ERR_LEN] = {0,};
+ const char *entry;
+ char *keyname = NULL;
+ char path[PATH_MAX] = {0,};
+
+
+ START_TIME_CHECK
+ retvm_if(callback == NULL, PREFERENCE_ERROR_INVALID_PARAMETER, "Invalid argument: cb(%p)", callback);
pref_dir_path = _preference_get_pref_dir_path();
if (!pref_dir_path) {
}
while (readdir_r(dir, &dent, &result) == 0 && result != NULL) {
- const char *entry = dent.d_name;
- char *keyname = NULL;
- char path[PATH_MAX] = {0,};
-
+ entry = dent.d_name;
if (entry[0] == '.')
continue;
return PREFERENCE_ERROR_NONE;
}
+
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2015 - 2016 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.
{
char type[2];
char data[BUF_LEN];
-
int ret;
if (value == NULL) {
{
char type[2];
char data[BUF_LEN];
-
int ret;
if (value == NULL) {
return PREFERENCE_ERROR_NONE;
}
-static pref_changed_cb_node_t* _find_node(const char *key)
+static pref_changed_cb_node_t *_find_node(const char *key)
{
pref_changed_cb_node_t *tmp_node;
tmp_node->cb = cb;
tmp_node->user_data = user_data;
} else {
- tmp_node = (pref_changed_cb_node_t*)malloc(sizeof(pref_changed_cb_node_t));
+ tmp_node = (pref_changed_cb_node_t *)malloc(sizeof(pref_changed_cb_node_t));
if (tmp_node == NULL) {
LOGE("OUT_OF_MEMORY(0x%08x)", PREFERENCE_ERROR_OUT_OF_MEMORY);
return PREFERENCE_ERROR_OUT_OF_MEMORY;
return PREFERENCE_ERROR_NONE;
}
+
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2015 - 2016 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.
static GSource *_kdb_handler;
-static GList* _preference_copy_noti_list(GList *orig_notilist)
+static GList *_preference_copy_noti_list(GList *orig_notilist)
{
GList *copy_notilist = NULL;
struct noti_node *n = NULL;
struct noti_node *t = NULL;
+ char err_buf[ERR_LEN] = {0,};
if (!orig_notilist)
return NULL;
while (orig_notilist) {
do {
t = orig_notilist->data;
-
if (t == NULL) {
WARN("noti item data is null");
break;
n->keyname = strndup(t->keyname, PREFERENCE_KEY_PATH_LEN);
if (n->keyname == NULL) {
- char err_buf[ERR_LEN] = {0,};
strerror_r(errno, err_buf, sizeof(err_buf));
ERR("The memory is insufficient, errno: %d (%s)", errno, err_buf);
free(n);
static void _preference_free_noti_node(gpointer data)
{
- struct noti_node *n = (struct noti_node*)data;
+ struct noti_node *n = (struct noti_node *)data;
g_free(n->keyname);
g_free(n);
}
int fd, r, res;
struct inotify_event ie;
GList *l_notilist = NULL;
+ struct noti_node *t = NULL;
+ GList *noti_list = NULL;
+ keynode_t *keynode;
fd = g_io_channel_unix_get_fd(src);
r = read(fd, &ie, sizeof(ie));
pthread_mutex_unlock(&_kdb_g_ns_mutex);
if (l_notilist) {
-
- struct noti_node *t = NULL;
- GList *noti_list = NULL;
-
noti_list = g_list_first(l_notilist);
-
while (noti_list) {
t = noti_list->data;
- keynode_t* keynode = _preference_keynode_new();
+ keynode = _preference_keynode_new();
if (keynode == NULL) {
ERR("key malloc fail");
break;
}
if ((t) && (t->wd == ie.wd) && (t->keyname)) {
-
res = _preference_keynode_set_keyname(keynode, t->keyname);
if (res != PREFERENCE_ERROR_NONE) {
ERR("_preference_keynode_set_keyname() failed(%d)", res);
{
GIOChannel *gio;
int ret = 0;
+ char err_buf[ERR_LEN] = { 0, };
pthread_mutex_lock(&_kdb_inoti_fd_mutex);
}
_kdb_inoti_fd = inotify_init();
if (_kdb_inoti_fd == -1) {
- char err_buf[100] = { 0, };
strerror_r(errno, err_buf, sizeof(err_buf));
ERR("inotify init: %s", err_buf);
pthread_mutex_unlock(&_kdb_inoti_fd_mutex);
ret = fcntl(_kdb_inoti_fd, F_SETFD, FD_CLOEXEC);
if (ret < 0) {
- char err_buf[100] = { 0, };
strerror_r(errno, err_buf, sizeof(err_buf));
ERR("inotify init: %s", err_buf);
pthread_mutex_unlock(&_kdb_inoti_fd_mutex);
ret = fcntl(_kdb_inoti_fd, F_SETFL, O_NONBLOCK);
if (ret < 0) {
- char err_buf[100] = { 0, };
strerror_r(errno, err_buf, sizeof(err_buf));
ERR("inotify init: %s", err_buf);
pthread_mutex_unlock(&_kdb_inoti_fd_mutex);
return PREFERENCE_ERROR_INVALID_PARAMETER;
}
- if (0 != access(path, F_OK)) {
+ if (access(path, F_OK) != 0) {
if (errno == ENOENT) {
ERR("_preference_kdb_add_notify : Key(%s) does not exist", keyname);
return PREFERENCE_ERROR_IO_ERROR;
return PREFERENCE_ERROR_INVALID_PARAMETER;
}
- if (0 != access(path, F_OK)) {
+ if (access(path, F_OK) != 0) {
if (errno == ENOENT) {
ERR("_preference_kdb_del_notify : Key(%s) does not exist", keyname);
return PREFERENCE_ERROR_IO_ERROR;
return func_ret;
}
+
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
return dev_orientation;
}
+
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
struct app_event_info event;
LOGI("_ui_app_appcore_suspended_state_changed");
- LOGI("[__SUSPEND__] suspended state: %d (0: suspend, 1: wake)", *(int*)event_info);
+ LOGI("[__SUSPEND__] suspended state: %d (0: suspend, 1: wake)", *(int *)event_info);
event.type = APP_EVENT_SUSPENDED_STATE_CHANGED;
event.value = event_info;
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
{
return elm_conformant_precreated_object_get();
}
+
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2015 - 2016 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.
/*
- * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011 - 2016 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.
#include <app_i18n.h>
-char* i18n_get_text(const char *message)
+char *i18n_get_text(const char *message)
{
return gettext(message);
}