Applied Tizen coding rule 75/53575/1
authorYounho Park <younho.park@samsung.com>
Tue, 8 Dec 2015 04:22:55 +0000 (13:22 +0900)
committerYounho Park <younho.park@samsung.com>
Tue, 8 Dec 2015 04:22:55 +0000 (13:22 +0900)
Change-Id: I3658ef530da413ddd6e06bb7ae1b424976feebff
Signed-off-by: Younho Park <younho.park@samsung.com>
28 files changed:
adaptor/auth-adaptor/auth_adaptor.c
adaptor/auth-adaptor/oauth1_service.c
adaptor/auth-adaptor/oauth2_service.c
adaptor/storage-adaptor/cloud_service.c
adaptor/storage-adaptor/storage_adaptor.c
client/sal_auth_provider.c
client/sal_service_adaptor.c
client/sal_service_auth.c
client/sal_service_provider.c
client/sal_service_storage.c
client/sal_service_task.c
client/sal_storage_provider.c
common/ipc-client/sal_ipc_client.c
common/ipc-client/sal_ipc_client_auth.c
common/ipc-client/sal_ipc_client_core.c
common/ipc-client/sal_ipc_client_storage.c
common/ipc-server/sal_ipc_server.c
common/ipc-server/sal_ipc_server_auth.c
common/ipc-server/sal_ipc_server_core.c
common/ipc-server/sal_ipc_server_storage.c
common/sal_ipc.c
server/sal_auth.c
server/sal_contact.c
server/sal_main.c
server/sal_observer.c
server/sal_resource.c
server/sal_storage.c
test/test.c

index 450be97..cdf7737 100644 (file)
 #include "auth_adaptor.h"
 #include "service_adaptor_internal.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
 static void _auth_adaptor_free_plugin(auth_plugin_h plugin)
 {
 }
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 API auth_adaptor_h auth_adaptor_create()
 {
@@ -62,8 +62,7 @@ API service_adaptor_error_e auth_adaptor_destroy(auth_adaptor_h auth)
 
        g_mutex_lock(&auth->mutex);
 
-       if (0 != auth->start)
-       {
+       if (0 != auth->start) {
                auth_adaptor_stop(auth);
        }
 
@@ -95,7 +94,7 @@ API service_adaptor_error_e auth_adaptor_stop(auth_adaptor_h auth)
 
        RETV_IF(NULL == auth, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-       // TODO: notify auth adaptor stop to each plugin
+       /* TODO: notify auth adaptor stop to each plugin */
 
        g_mutex_lock(&auth->mutex);
 
@@ -113,7 +112,7 @@ API service_adaptor_error_e auth_adaptor_register_listener(auth_adaptor_h auth,
        RETV_IF(NULL == auth, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == listener, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-       // TODO: register insert/ update/ delete callback for service-adaptor
+       /* TODO: register insert/ update/ delete callback for service-adaptor */
 
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
@@ -125,7 +124,7 @@ API service_adaptor_error_e auth_adaptor_unregister_listener(auth_adaptor_h auth
        RETV_IF(NULL == auth, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == listener, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-       // TODO: unregister insert/ update/ delete callback for service-adaptor
+       /* TODO: unregister insert/ update/ delete callback for service-adaptor */
 
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
@@ -176,8 +175,7 @@ API service_adaptor_error_e auth_adaptor_register_plugin_service(auth_plugin_h p
        plugin->oauth1 = (oauth1_service_h) g_malloc0(sizeof(oauth1_service_s));
        ret = oauth1_register_service(plugin->oauth1, service);
 
-       if (SERVICE_ADAPTOR_ERROR_NONE != ret)
-       {
+       if (SERVICE_ADAPTOR_ERROR_NONE != ret) {
                SAL_INFO("could not find the function for oauth 1.0");
                SAL_FREE(plugin->oauth1);
        }
@@ -185,8 +183,7 @@ API service_adaptor_error_e auth_adaptor_register_plugin_service(auth_plugin_h p
        plugin->oauth2 = (oauth2_service_h) g_malloc0(sizeof(oauth2_service_s));
        ret = oauth2_register_service(plugin->oauth2, service);
 
-       if (SERVICE_ADAPTOR_ERROR_NONE != ret)
-       {
+       if (SERVICE_ADAPTOR_ERROR_NONE != ret) {
                SAL_INFO("could not find the function for oauth 2.0");
                SAL_FREE(plugin->oauth2);
        }
@@ -200,14 +197,12 @@ API service_adaptor_error_e auth_adaptor_unregister_plugin_service(auth_plugin_h
 
        RETV_IF(NULL == plugin, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-       if (NULL != plugin->oauth1)
-       {
+       if (NULL != plugin->oauth1) {
                oauth1_unregister_service(plugin->oauth1);
                SAL_FREE(plugin->oauth1);
        }
 
-       if (NULL != plugin->oauth2)
-       {
+       if (NULL != plugin->oauth2) {
                oauth2_unregister_service(plugin->oauth2);
                SAL_FREE(plugin->oauth2);
        }
@@ -262,12 +257,10 @@ API auth_plugin_h auth_adaptor_get_plugin(auth_adaptor_h auth, const char *uri)
 
        auth_plugin_h plugin = NULL;
 
-       for (GList *list = g_list_first(auth->plugins); list != NULL; list = list->next)
-       {
+       for (GList *list = g_list_first(auth->plugins); list != NULL; list = list->next) {
                auth_plugin_h this = (auth_plugin_h) list->data;
 
-               if (0 == strcmp(this->uri, uri))
-               {
+               if (0 == strcmp(this->uri, uri)) {
                        plugin = this;
                        break;
                }
@@ -289,12 +282,10 @@ API char *auth_adaptor_get_uri(auth_adaptor_h auth, const char *package)
 
        char *uri = NULL;
 
-       for (GList *list = g_list_first(auth->plugins); list != NULL; list = list->next)
-       {
+       for (GList *list = g_list_first(auth->plugins); list != NULL; list = list->next) {
                auth_plugin_h this = (auth_plugin_h) list->data;
 
-               if (0 == strcmp(this->package, package))
-               {
+               if (0 == strcmp(this->package, package)) {
                        uri = this->uri;
                        break;
                }
@@ -316,14 +307,12 @@ API service_adaptor_error_e auth_adaptor_ref_plugin(auth_adaptor_h auth, const c
 
        int ret = SERVICE_ADAPTOR_ERROR_NO_DATA;
 
-       for (GList *list = g_list_first(auth->plugins); list != NULL; list = list->next)
-       {
+       for (GList *list = g_list_first(auth->plugins); list != NULL; list = list->next) {
                auth_plugin_h this = (auth_plugin_h) list->data;
 
-               if (0 == strcmp(this->uri, uri))
-               {
+               if (0 == strcmp(this->uri, uri)) {
                        ret = SERVICE_ADAPTOR_ERROR_NONE;
-                       // TODO: increase ref count
+                       /* TODO: increase ref count */
                        break;
                }
        }
@@ -344,14 +333,12 @@ API service_adaptor_error_e auth_adaptor_unref_plugin(auth_adaptor_h auth, const
 
        int ret = SERVICE_ADAPTOR_ERROR_NO_DATA;
 
-       for (GList *list = g_list_first(auth->plugins); list != NULL; list = list->next)
-       {
+       for (GList *list = g_list_first(auth->plugins); list != NULL; list = list->next) {
                auth_plugin_h this = (auth_plugin_h) list->data;
 
-               if (0 == strcmp(this->uri, uri))
-               {
+               if (0 == strcmp(this->uri, uri)) {
                        ret = SERVICE_ADAPTOR_ERROR_NONE;
-                       // TODO: decrease ref count
+                       /* TODO: decrease ref count */
                        break;
                }
        }
index 0ff7afc..541fa76 100644 (file)
 #include "sal_service_provider.h"
 #include "sal_auth_provider.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 
-typedef struct _app_control_user_data_s
-{
+typedef struct _app_control_user_data_s {
        void *callback;
        void *user_data;
 } app_control_user_data_s;
@@ -44,13 +43,13 @@ typedef struct _app_control_user_data_s *app_control_user_data_h;
 typedef int (*_get_access_token)(void *plugin, oauth1_cb callback, void *user_data);
 typedef int (*_get_extra_data)(void *plugin, const char *key, oauth1_cb callback, void *user_data);
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
 /**
  * @brief callback of service plugin
@@ -75,11 +74,10 @@ static void _oauth1_get_access_token_cb(app_control_h request, app_control_h rep
 
        RET_IF(NULL == callback);
 
-       // TODO: move this function for chaning result enum to general
+       /* TODO: move this function for chaning result enum to general */
        int ret = SERVICE_ADAPTOR_ERROR_NONE;
 
-       if (0 == strcmp(PLUGIN_RESULT_VALUE_FAILURE, ret_str))
-       {
+       if (0 == strcmp(PLUGIN_RESULT_VALUE_FAILURE, ret_str)) {
                ret = SERVICE_ADAPTOR_ERROR_INTERNAL;
        }
 
@@ -109,8 +107,7 @@ static int _oauth1_get_access_token(auth_plugin_h plugin, oauth1_cb callback, vo
 
        int res = app_control_send_launch_request(request, _oauth1_get_access_token_cb, app_control_user_data);
 
-       if (APP_CONTROL_ERROR_NONE != res)
-       {
+       if (APP_CONTROL_ERROR_NONE != res) {
                return SERVICE_ADAPTOR_ERROR_SYSTEM;
        }
 
@@ -126,9 +123,9 @@ static int _oauth1_get_extra_data(auth_plugin_h plugin, const char *key, oauth1_
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 API int oauth1_register_service(oauth1_service_h oauth1, GHashTable *service)
 {
@@ -141,15 +138,11 @@ API int oauth1_register_service(oauth1_service_h oauth1, GHashTable *service)
        gpointer iter_key, iter_value;
 
        g_hash_table_iter_init(&iter, service);
-       while (g_hash_table_iter_next(&iter, &iter_key, &iter_value))
-       {
-               if (0 == strcmp(iter_key, OAUTH1_0_GET_ACCESS_TOKEN_URI))
-               {
+       while (g_hash_table_iter_next(&iter, &iter_key, &iter_value)) {
+               if (0 == strcmp(iter_key, OAUTH1_0_GET_ACCESS_TOKEN_URI)) {
                        oauth1->oauth1_get_access_token = (_get_access_token) _oauth1_get_access_token;
                        ret = SERVICE_ADAPTOR_ERROR_NONE;
-               }
-               else if (0 == strcmp(iter_key, OAUTH1_0_GET_EXTRA_DATA_URI))
-               {
+               } else if (0 == strcmp(iter_key, OAUTH1_0_GET_EXTRA_DATA_URI)) {
                        oauth1->oauth1_get_extra_data = (_get_extra_data) _oauth1_get_extra_data;
                        ret = SERVICE_ADAPTOR_ERROR_NONE;
                }
index 409089e..9d66f74 100644 (file)
 
 #include "sal_auth_provider.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 
-typedef struct _app_control_user_data_s
-{
+typedef struct _app_control_user_data_s {
        void *callback;
        void *user_data;
 } app_control_user_data_s;
@@ -43,13 +42,13 @@ typedef struct _app_control_user_data_s *app_control_user_data_h;
 typedef int (*_get_access_token)(void *plugin, char **access_token, void *user_data);
 typedef int (*_get_extra_data)(void *plugin, const char *key, char **value, void *user_data);
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
 static int _oauth2_get_access_token(auth_plugin_h plugin, char **access_token, void *user_data)
 {
@@ -69,9 +68,9 @@ static int _oauth2_get_extra_data(auth_plugin_h plugin, const char *key, char **
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 API int oauth2_register_service(oauth2_service_h oauth2, GHashTable *service)
 {
@@ -84,15 +83,11 @@ API int oauth2_register_service(oauth2_service_h oauth2, GHashTable *service)
        gpointer iter_key, iter_value;
 
        g_hash_table_iter_init(&iter, service);
-       while (g_hash_table_iter_next(&iter, &iter_key, &iter_value))
-       {
-               if (0 == strcmp(iter_key, OAUTH2_0_GET_ACCESS_TOKEN_URI))
-               {
+       while (g_hash_table_iter_next(&iter, &iter_key, &iter_value)) {
+               if (0 == strcmp(iter_key, OAUTH2_0_GET_ACCESS_TOKEN_URI)) {
                        oauth2->oauth2_get_access_token = (_get_access_token) _oauth2_get_access_token;
                        ret = SERVICE_ADAPTOR_ERROR_NONE;
-               }
-               else if (0 == strcmp(iter_key, OAUTH2_0_GET_EXTRA_DATA_URI))
-               {
+               } else if (0 == strcmp(iter_key, OAUTH2_0_GET_EXTRA_DATA_URI)) {
                        oauth2->oauth2_get_extra_data = (_get_extra_data) _oauth2_get_extra_data;
                        ret = SERVICE_ADAPTOR_ERROR_NONE;
                }
index 1f86904..a7de505 100644 (file)
 #include "sal_service_provider.h"
 #include "sal_storage_provider.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 
-typedef struct _app_control_user_data_s
-{
+typedef struct _app_control_user_data_s {
        cloud_file_h file;
 
        void *callback;
@@ -49,13 +48,13 @@ typedef struct _app_control_user_data_s *app_control_user_data_h;
 
 typedef int (*_remove_file)(void *plugin, const char *cloud_path, cloud_file_cb callback, void *user_data);
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
 int _make_cloud_file_by_local(const char *local_path, cloud_file_h *file)
 {
@@ -75,8 +74,7 @@ int _make_cloud_file_by_local(const char *local_path, cloud_file_h *file)
        cloud_file->cloud_path = NULL;
        cloud_file->size = file_info.st_size;
 
-       if(S_ISDIR(file_info.st_mode))
-       {
+       if (S_ISDIR(file_info.st_mode)) {
                cloud_file->is_dir = true;
        }
 
@@ -119,11 +117,10 @@ static void _cloud_remove_file_cb(app_control_h request, app_control_h reply, ap
 
        RET_IF(NULL == callback);
 
-       // TODO: move this function for chaning result enum to general
+       /* TODO: move this function for chaning result enum to general */
        int ret = SERVICE_ADAPTOR_ERROR_NONE;
 
-       if (0 == strcmp(PLUGIN_RESULT_VALUE_FAILURE, ret_str))
-       {
+       if (0 == strcmp(PLUGIN_RESULT_VALUE_FAILURE, ret_str)) {
                ret = SERVICE_ADAPTOR_ERROR_INTERNAL;
        }
 
@@ -158,17 +155,16 @@ static int _cloud_remove_file(storage_plugin_h plugin, const char *cloud_path, c
 
        int res = app_control_send_launch_request(request, _cloud_remove_file_cb, app_control_user_data);
 
-       if (APP_CONTROL_ERROR_NONE != res)
-       {
+       if (APP_CONTROL_ERROR_NONE != res) {
                return SERVICE_ADAPTOR_ERROR_SYSTEM;
        }
 
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 API int cloud_register_service(cloud_service_h cloud, GHashTable *service)
 {
@@ -181,10 +177,8 @@ API int cloud_register_service(cloud_service_h cloud, GHashTable *service)
        gpointer iter_key, iter_value;
 
        g_hash_table_iter_init(&iter, service);
-       while (g_hash_table_iter_next(&iter, &iter_key, &iter_value))
-       {
-               if (0 == strcmp(iter_key, CLOUD_REMOVE_FILE_URI))
-               {
+       while (g_hash_table_iter_next(&iter, &iter_key, &iter_value)) {
+               if (0 == strcmp(iter_key, CLOUD_REMOVE_FILE_URI)) {
                        cloud->cloud_remove_file = (_remove_file) _cloud_remove_file;
                        ret = SERVICE_ADAPTOR_ERROR_NONE;
                }
index 5321fa0..c2738c0 100644 (file)
 #include "storage_adaptor.h"
 #include "service_adaptor_internal.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
 static void _storage_adaptor_free_plugin(storage_plugin_h plugin)
 {
 }
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 API storage_adaptor_h storage_adaptor_create()
 {
        SAL_FN_CALL;
 
-        storage_adaptor_h storage = (storage_adaptor_h) g_malloc0(sizeof(storage_adaptor_s));
+       storage_adaptor_h storage = (storage_adaptor_h) g_malloc0(sizeof(storage_adaptor_s));
 
-        g_mutex_init(&storage->mutex);
+       g_mutex_init(&storage->mutex);
 
        return storage;
 }
@@ -58,18 +58,17 @@ API service_adaptor_error_e storage_adaptor_destroy(storage_adaptor_h storage)
 {
        SAL_FN_CALL;
 
-        RETV_IF(NULL == storage, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == storage, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-        g_mutex_lock(&storage->mutex);
+       g_mutex_lock(&storage->mutex);
 
-        if (0 != storage->start)
-        {
-                storage_adaptor_stop(storage);
-        }
+       if (0 != storage->start) {
+               storage_adaptor_stop(storage);
+       }
 
-        SAL_FREE(storage);
+       SAL_FREE(storage);
 
-        g_mutex_unlock(&storage->mutex);
+       g_mutex_unlock(&storage->mutex);
 
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
@@ -78,13 +77,13 @@ API service_adaptor_error_e storage_adaptor_start(storage_adaptor_h storage)
 {
        SAL_FN_CALL;
 
-        RETV_IF(NULL == storage, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == storage, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-        g_mutex_lock(&storage->mutex);
+       g_mutex_lock(&storage->mutex);
 
-        storage->start = 1;
+       storage->start = 1;
 
-        g_mutex_unlock(&storage->mutex);
+       g_mutex_unlock(&storage->mutex);
 
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
@@ -93,15 +92,15 @@ API service_adaptor_error_e storage_adaptor_stop(storage_adaptor_h storage)
 {
        SAL_FN_CALL;
 
-        RETV_IF(NULL == storage, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == storage, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-        // TODO: notify storage adaptor stop to each plugin
+       /* TODO: notify storage adaptor stop to each plugin */
 
-        g_mutex_lock(&storage->mutex);
+       g_mutex_lock(&storage->mutex);
 
-        storage->start = 0;
+       storage->start = 0;
 
-        g_mutex_unlock(&storage->mutex);
+       g_mutex_unlock(&storage->mutex);
 
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
@@ -110,10 +109,10 @@ API service_adaptor_error_e storage_adaptor_register_listener(storage_adaptor_h
 {
        SAL_FN_CALL;
 
-        RETV_IF(NULL == storage, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
-        RETV_IF(NULL == listener, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == storage, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == listener, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-        // TODO: register insert/ update/ delete callback for service-adaptor
+       /* TODO: register insert/ update/ delete callback for service-adaptor */
 
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
@@ -122,241 +121,231 @@ API service_adaptor_error_e storage_adaptor_unregister_listener(storage_adaptor_
 {
        SAL_FN_CALL;
 
-        RETV_IF(NULL == storage, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
-        RETV_IF(NULL == listener, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == storage, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == listener, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-        // TODO: unregister insert/ update/ delete callback for service-adaptor
+       /* TODO: unregister insert/ update/ delete callback for service-adaptor */
 
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
 API service_adaptor_error_e storage_adaptor_create_plugin(const char *uri, const char *name, const char *package, storage_plugin_h *plugin)
 {
-        SAL_FN_CALL;
+       SAL_FN_CALL;
 
-        RETV_IF(NULL == uri, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
-        RETV_IF(NULL == name, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
-        RETV_IF(NULL == package, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == uri, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == name, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == package, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-        storage_plugin_h storage_plugin = (storage_plugin_h) g_malloc0(sizeof(storage_plugin_s));
-        storage_plugin->uri = strdup(uri);
-        storage_plugin->name = strdup(name);
-        storage_plugin->package = strdup(package);
+       storage_plugin_h storage_plugin = (storage_plugin_h) g_malloc0(sizeof(storage_plugin_s));
+       storage_plugin->uri = strdup(uri);
+       storage_plugin->name = strdup(name);
+       storage_plugin->package = strdup(package);
 
-        g_mutex_init(&storage_plugin->mutex);
-        g_cond_init(&storage_plugin->cond);
+       g_mutex_init(&storage_plugin->mutex);
+       g_cond_init(&storage_plugin->cond);
 
-        *plugin = storage_plugin;
+       *plugin = storage_plugin;
 
-        return SERVICE_ADAPTOR_ERROR_NONE;
+       return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
 API service_adaptor_error_e storage_adaptor_destroy_plugin(storage_plugin_h plugin)
 {
-        SAL_FN_CALL;
+       SAL_FN_CALL;
 
-        RETV_IF(NULL == plugin, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == plugin, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-        SAL_FREE(plugin->uri);
-        SAL_FREE(plugin->name);
-        SAL_FREE(plugin);
+       SAL_FREE(plugin->uri);
+       SAL_FREE(plugin->name);
+       SAL_FREE(plugin);
 
-        return SERVICE_ADAPTOR_ERROR_NONE;
+       return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
 API service_adaptor_error_e storage_adaptor_register_plugin_service(storage_plugin_h plugin, GHashTable *service)
 {
-        SAL_FN_CALL;
+       SAL_FN_CALL;
 
-        RETV_IF(NULL == plugin, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
-        RETV_IF(NULL == service, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == plugin, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == service, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-        int ret = SERVICE_ADAPTOR_ERROR_NONE;
+       int ret = SERVICE_ADAPTOR_ERROR_NONE;
 
-        plugin->cloud = (cloud_service_h) g_malloc0(sizeof(cloud_service_s));
-        ret = cloud_register_service(plugin->cloud, service);
+       plugin->cloud = (cloud_service_h) g_malloc0(sizeof(cloud_service_s));
+       ret = cloud_register_service(plugin->cloud, service);
 
-        if (SERVICE_ADAPTOR_ERROR_NONE != ret)
-        {
-                SAL_INFO("could not find the function for cloud");
-                SAL_FREE(plugin->cloud);
-        }
+       if (SERVICE_ADAPTOR_ERROR_NONE != ret) {
+               SAL_INFO("could not find the function for cloud");
+               SAL_FREE(plugin->cloud);
+       }
 /*
-        plugin->posix = (posix_service_h) g_malloc0(sizeof(posix_service_s));
-        ret = posix_register_service(plugin->posix, service);
-
-        if (SERVICE_ADAPTOR_ERROR_NONE != ret)
-        {
-                SAL_INFO("could not find the function for posix");
-                SAL_FREE(plugin->posix);
-        }
-*/
-        return SERVICE_ADAPTOR_ERROR_NONE;
+       plugin->posix = (posix_service_h) g_malloc0(sizeof(posix_service_s));
+       ret = posix_register_service(plugin->posix, service);
+
+       if (SERVICE_ADAPTOR_ERROR_NONE != ret)
+       {
+               SAL_INFO("could not find the function for posix");
+               SAL_FREE(plugin->posix);
+       }
+       */
+       return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
 API service_adaptor_error_e storage_adaptor_unregister_plugin_service(storage_plugin_h plugin)
 {
-        SAL_FN_CALL;
-
-        RETV_IF(NULL == plugin, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       SAL_FN_CALL;
 
-        if (NULL != plugin->cloud)
-        {
-                cloud_unregister_service(plugin->cloud);
-                SAL_FREE(plugin->cloud);
-        }
-/*
-        if (NULL != plugin->posix)
-        {
-                posix_unregister_service(plugin->posix);
-                SAL_FREE(plugin->posix);
-        }
-*/
-        return SERVICE_ADAPTOR_ERROR_NONE;
+       RETV_IF(NULL == plugin, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+
+       if (NULL != plugin->cloud) {
+               cloud_unregister_service(plugin->cloud);
+               SAL_FREE(plugin->cloud);
+       }
+       /*
+       if (NULL != plugin->posix)
+       {
+               posix_unregister_service(plugin->posix);
+               SAL_FREE(plugin->posix);
+       }
+       */
+       return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
 API service_adaptor_error_e storage_adaptor_add_plugin(storage_adaptor_h storage, storage_plugin_h plugin)
 {
-        SAL_FN_CALL;
+       SAL_FN_CALL;
 
-        RETV_IF(NULL == storage, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
-        RETV_IF(NULL == plugin, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == storage, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == plugin, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-        g_mutex_lock(&storage->mutex);
+       g_mutex_lock(&storage->mutex);
 
-        storage->plugins = g_list_append(storage->plugins, plugin);
+       storage->plugins = g_list_append(storage->plugins, plugin);
 
-        g_mutex_unlock(&storage->mutex);
+       g_mutex_unlock(&storage->mutex);
 
-        return SERVICE_ADAPTOR_ERROR_NONE;
+       return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
 API service_adaptor_error_e storage_adaptor_remove_plugin(storage_adaptor_h storage, storage_plugin_h plugin)
 {
-        SAL_FN_CALL;
+       SAL_FN_CALL;
 
-        RETV_IF(NULL == storage, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
-        RETV_IF(NULL == plugin, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == storage, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == plugin, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-        g_mutex_lock(&storage->mutex);
+       g_mutex_lock(&storage->mutex);
 
-        RETV_IF(NULL == g_list_find(storage->plugins, plugin), SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == g_list_find(storage->plugins, plugin), SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-        storage->plugins = g_list_remove(storage->plugins, plugin);
+       storage->plugins = g_list_remove(storage->plugins, plugin);
 
-        _storage_adaptor_free_plugin(plugin);
+       _storage_adaptor_free_plugin(plugin);
 
-        g_mutex_unlock(&storage->mutex);
+       g_mutex_unlock(&storage->mutex);
 
-        return SERVICE_ADAPTOR_ERROR_NONE;
+       return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
 API storage_plugin_h storage_adaptor_get_plugin(storage_adaptor_h storage, const char *uri)
 {
-        SAL_FN_CALL;
+       SAL_FN_CALL;
 
-        RETV_IF(NULL == storage, NULL);
-        RETV_IF(NULL == uri, NULL);
+       RETV_IF(NULL == storage, NULL);
+       RETV_IF(NULL == uri, NULL);
 
-        g_mutex_lock(&storage->mutex);
+       g_mutex_lock(&storage->mutex);
 
-        storage_plugin_h plugin = NULL;
+       storage_plugin_h plugin = NULL;
 
-        for (GList *list = g_list_first(storage->plugins); list != NULL; list = list->next)
-        {
-                storage_plugin_h this = (storage_plugin_h) list->data;
+       for (GList *list = g_list_first(storage->plugins); list != NULL; list = list->next) {
+               storage_plugin_h this = (storage_plugin_h) list->data;
 
-                if (0 == strcmp(this->uri, uri))
-                {
-                        plugin = this;
-                        break;
-                }
-        }
+               if (0 == strcmp(this->uri, uri)) {
+                       plugin = this;
+                       break;
+               }
+       }
 
-        g_mutex_unlock(&storage->mutex);
+       g_mutex_unlock(&storage->mutex);
 
-        return plugin;
+       return plugin;
 }
 
 API char *storage_adaptor_get_uri(storage_adaptor_h storage, const char *package)
 {
-        SAL_FN_CALL;
+       SAL_FN_CALL;
 
-        RETV_IF(NULL == storage, NULL);
-        RETV_IF(NULL == package, NULL);
+       RETV_IF(NULL == storage, NULL);
+       RETV_IF(NULL == package, NULL);
 
-        g_mutex_lock(&storage->mutex);
+       g_mutex_lock(&storage->mutex);
 
-        char *uri = NULL;
+       char *uri = NULL;
 
-        for (GList *list = g_list_first(storage->plugins); list != NULL; list = list->next)
-        {
-                storage_plugin_h this = (storage_plugin_h) list->data;
+       for (GList *list = g_list_first(storage->plugins); list != NULL; list = list->next) {
+               storage_plugin_h this = (storage_plugin_h) list->data;
 
-                if (0 == strcmp(this->package, package))
-                {
-                        uri = this->uri;
-                        break;
-                }
-        }
+               if (0 == strcmp(this->package, package)) {
+                       uri = this->uri;
+                       break;
+               }
+       }
 
-        g_mutex_unlock(&storage->mutex);
+       g_mutex_unlock(&storage->mutex);
 
-        return uri;
+       return uri;
 }
 
 API service_adaptor_error_e storage_adaptor_ref_plugin(storage_adaptor_h storage, const char *uri)
 {
-        SAL_FN_CALL;
+       SAL_FN_CALL;
 
-        RETV_IF(NULL == storage, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
-        RETV_IF(NULL == uri, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == storage, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == uri, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-        g_mutex_lock(&storage->mutex);
+       g_mutex_lock(&storage->mutex);
 
-        int ret = SERVICE_ADAPTOR_ERROR_NO_DATA;
+       int ret = SERVICE_ADAPTOR_ERROR_NO_DATA;
 
-        for (GList *list = g_list_first(storage->plugins); list != NULL; list = list->next)
-        {
-                storage_plugin_h this = (storage_plugin_h) list->data;
+       for (GList *list = g_list_first(storage->plugins); list != NULL; list = list->next) {
+               storage_plugin_h this = (storage_plugin_h) list->data;
 
-                if (0 == strcmp(this->uri, uri))
-                {
-                        ret = SERVICE_ADAPTOR_ERROR_NONE;
-                        // TODO: increase ref count
-                        break;
-                }
-        }
+               if (0 == strcmp(this->uri, uri)) {
+                       ret = SERVICE_ADAPTOR_ERROR_NONE;
+                       /* TODO: increase ref count */
+                       break;
+               }
+       }
 
-        g_mutex_unlock(&storage->mutex);
+       g_mutex_unlock(&storage->mutex);
 
-        return ret;
+       return ret;
 }
 
 API service_adaptor_error_e storage_adaptor_unref_plugin(storage_adaptor_h storage, const char *uri)
 {
-        SAL_FN_CALL;
+       SAL_FN_CALL;
 
-        RETV_IF(NULL == storage, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
-        RETV_IF(NULL == uri, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == storage, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
+       RETV_IF(NULL == uri, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-        g_mutex_lock(&storage->mutex);
+       g_mutex_lock(&storage->mutex);
 
-        int ret = SERVICE_ADAPTOR_ERROR_NO_DATA;
+       int ret = SERVICE_ADAPTOR_ERROR_NO_DATA;
 
-        for (GList *list = g_list_first(storage->plugins); list != NULL; list = list->next)
-        {
-                storage_plugin_h this = (storage_plugin_h) list->data;
+       for (GList *list = g_list_first(storage->plugins); list != NULL; list = list->next) {
+               storage_plugin_h this = (storage_plugin_h) list->data;
 
-                if (0 == strcmp(this->uri, uri))
-                {
-                        ret = SERVICE_ADAPTOR_ERROR_NONE;
-                        // TODO: decrease ref count
-                        break;
-                }
-        }
+               if (0 == strcmp(this->uri, uri)) {
+                       ret = SERVICE_ADAPTOR_ERROR_NONE;
+                       /* TODO: decrease ref count */
+                       break;
+               }
+       }
 
-        g_mutex_unlock(&storage->mutex);
+       g_mutex_unlock(&storage->mutex);
 
-        return ret;
+       return ret;
 }
index f1cccbd..8bdb5c7 100644 (file)
@@ -55,15 +55,13 @@ API app_control_h auth_provider_message(auth_provider_h provider, const char *op
 
        int ret = SERVICE_ADAPTOR_ERROR_NONE;
 
-       if (0 == strcmp(operation, OAUTH1_0_GET_ACCESS_TOKEN_URI))
-       {
+       if (0 == strcmp(operation, OAUTH1_0_GET_ACCESS_TOKEN_URI)) {
                app_control_create(&reply);
 
                char *access_token = NULL;
                ret = provider->oauth1_get_access_token(&access_token);
 
-               if (SERVICE_ADAPTOR_ERROR_NONE != ret)
-               {
+               if (SERVICE_ADAPTOR_ERROR_NONE != ret) {
                        SAL_ERR("oauth1_get_access_token() Fail (%d)", ret);
                        app_control_add_extra_data(reply, PLUGIN_RESULT_KEY, PLUGIN_RESULT_VALUE_FAILURE);
                        return reply;
@@ -85,23 +83,19 @@ API int auth_provider_add_extra_data(auth_provider_h provider, app_control_h rep
 
        app_control_add_extra_data(reply, PLUGIN_KEY_AUTH, PLUGIN_VALUE_TRUE);
 
-       if (NULL != provider->oauth1_get_access_token)
-       {
+       if (NULL != provider->oauth1_get_access_token) {
                app_control_add_extra_data(reply, OAUTH1_0_GET_ACCESS_TOKEN_URI, PLUGIN_VALUE_TRUE);
        }
 
-       if (NULL != provider->oauth1_get_extra_data)
-       {
+       if (NULL != provider->oauth1_get_extra_data) {
                app_control_add_extra_data(reply, OAUTH1_0_GET_EXTRA_DATA_URI, PLUGIN_VALUE_TRUE);
        }
 
-       if (NULL != provider->oauth2_get_access_token)
-       {
+       if (NULL != provider->oauth2_get_access_token) {
                app_control_add_extra_data(reply, OAUTH2_0_GET_ACCESS_TOKEN_URI, PLUGIN_VALUE_TRUE);
        }
 
-       if (NULL != provider->oauth2_get_extra_data)
-       {
+       if (NULL != provider->oauth2_get_extra_data) {
                app_control_add_extra_data(reply, OAUTH2_0_GET_EXTRA_DATA_URI, PLUGIN_VALUE_TRUE);
        }
 
index dbebe64..7c1d05e 100644 (file)
 #include "sal_ipc_client_core.h"
 #include "sal_ipc_client_auth.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************
 
 /**
  * @brief Describes infromation about Adaptor Handle
  */
-typedef struct _service_adaptor_s
-{
+typedef struct _service_adaptor_s {
        char *uri;
 
        GList *plugins;         /* char **plugins (uri) */
        GList *started_plugins; /* service_plugin_h **started_plugins */
 } service_adaptor_s;
-//typedef struct _service_adaptor_s *service_adaptor_h;
+/* typedef struct _service_adaptor_s *service_adaptor_h; */
 
 /**
  * @brief Describes infromation about Plugin Handle
  */
-typedef struct _service_plugin_s
-{
+typedef struct _service_plugin_s {
        char *uri;
        GHashTable *property;
 } service_plugin_s;
 
 service_adaptor_h service_adaptor = NULL;
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 API int service_adaptor_create(service_adaptor_h *service_adaptor)
 {
@@ -98,8 +96,7 @@ API int service_adaptor_connect()
 
        app_get_id(&uri);
 
-       if (NULL == uri)
-       {
+       if (NULL == uri) {
                char path[1024] = {0,};
                int path_len = 0;
 
@@ -145,7 +142,7 @@ API int service_adaptor_disconnect()
        ret = sal_ipc_client_deinit();
        RETV_IF(SERVICE_ADAPTOR_ERROR_NONE != ret, SERVICE_ADAPTOR_ERROR_INTERNAL);
 
-       // TODO: free memory in adaptor
+       /* TODO: free memory in adaptor */
        SAL_FREE(service_adaptor);
 
        return SERVICE_ADAPTOR_ERROR_NONE;
@@ -169,8 +166,7 @@ API int service_adaptor_foreach_service_plugin(service_adaptor_plugin_cb callbac
 
        RETV_IF(0 == g_list_length(service_adaptor->plugins), SERVICE_ADAPTOR_ERROR_NO_DATA);
 
-       for (GList *list = g_list_first(service_adaptor->plugins); list != NULL; list = list->next)
-       {
+       for (GList *list = g_list_first(service_adaptor->plugins); list != NULL; list = list->next) {
                char * uri = (char *) list->data;
 
                bool ret = callback(uri, 0, user_data);
@@ -238,7 +234,7 @@ API int service_plugin_destroy(service_plugin_h plugin)
        int ret = ipc_service_plugin_destroy(plugin->uri);
        RETV_IF(SERVICE_ADAPTOR_ERROR_NONE != ret, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-       // TODO: free memeory of plugin
+       /* TODO: free memeory of plugin */
        SAL_FREE(plugin);
 
        return SERVICE_ADAPTOR_ERROR_NONE;
@@ -274,16 +270,13 @@ API int service_plugin_get_property(service_plugin_h plugin, const char *key, ch
        RETV_IF(NULL == key, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == value, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-       if (0 < g_hash_table_size(plugin->property))
-       {
+       if (0 < g_hash_table_size(plugin->property)) {
                GHashTableIter iter;
                gpointer iter_key, iter_value;
 
                g_hash_table_iter_init(&iter, plugin->property);
-               while (g_hash_table_iter_next(&iter, &iter_key, &iter_value))
-               {
-                       if (strcmp(key, (char *) iter_key) == 0)
-                       {
+               while (g_hash_table_iter_next(&iter, &iter_key, &iter_value)) {
+                       if (strcmp(key, (char *) iter_key) == 0) {
                                *value = g_strdup(iter_value);
                                return SERVICE_ADAPTOR_ERROR_NONE;
                        }
@@ -301,7 +294,7 @@ API int service_plugin_login(service_plugin_h plugin, service_plugin_login_cb ca
        RETV_IF(NULL == plugin, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == callback, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-       // TODO: login this plugin via service adaptor (dbus)
+       /* TODO: login this plugin via service adaptor (dbus) */
 
        callback(SERVICE_ADAPTOR_ERROR_NONE, user_data);
 
@@ -322,7 +315,7 @@ API int service_plugin_start_all(service_plugin_h plugin)
        RETV_IF(NULL == service_adaptor, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == plugin, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-       // TODO: check this plugin via service adaptor (dbus), use or not use?, must be logined.
+       /* TODO: check this plugin via service adaptor (dbus), use or not use?, must be logined. */
 
        service_adaptor->started_plugins = g_list_append(service_adaptor->started_plugins, plugin);
 
@@ -336,14 +329,12 @@ API int service_plugin_stop(service_plugin_h plugin)
        RETV_IF(NULL == service_adaptor, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == plugin, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-       // TODO: notify to stop this plugin to service adaptor (dbus)
+       /* TODO: notify to stop this plugin to service adaptor (dbus) */
 
-       for (GList *list = g_list_first(service_adaptor->started_plugins); list != NULL; list = list->next)
-       {
+       for (GList *list = g_list_first(service_adaptor->started_plugins); list != NULL; list = list->next) {
                service_plugin_h service_plugin = (service_plugin_h) list->data;
 
-               if (0 == strcmp(service_plugin->uri, plugin->uri))
-               {
+               if (0 == strcmp(service_plugin->uri, plugin->uri)) {
                        service_adaptor->started_plugins = g_list_remove(service_adaptor->started_plugins, list);
 
                        return SERVICE_ADAPTOR_ERROR_NONE;
index 72ce859..2c57cbb 100644 (file)
 #include "sal_service_auth_internal.h"
 #include "sal_ipc_client_auth.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
 int service_auth_oauth1_start(service_auth_oauth1_h oauth1)
 {
@@ -78,9 +78,9 @@ int service_auth_oauth1_stop(service_auth_oauth1_h oauth1)
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 API int service_auth_oauth1_create(service_plugin_h plugin, service_auth_oauth1_h *oauth1)
 {
index 5bef6b9..019f8c7 100644 (file)
@@ -45,7 +45,7 @@ API int service_provider_destroy(service_provider_h provider)
 {
        SAL_FN_CALL;
 
-       // TODO: free internal value of provider
+       /* TODO: free internal value of provider */
        SAL_FREE(provider);
 
        return SERVICE_ADAPTOR_ERROR_NONE;
@@ -112,13 +112,11 @@ API int service_provider_message(service_provider_h provider, app_control_h app_
 
        app_control_h reply = NULL;
 
-       if (0 == strcmp(operation, PLUGIN_CONNECT_URI))
-       {
+       if (0 == strcmp(operation, PLUGIN_CONNECT_URI)) {
                app_control_create(&reply);
                ret = provider->connect();
 
-               if (SERVICE_ADAPTOR_ERROR_NONE != ret)
-               {
+               if (SERVICE_ADAPTOR_ERROR_NONE != ret) {
                        SAL_ERR("connect() Fail (%d)", ret);
                        app_control_add_extra_data(reply, PLUGIN_RESULT_KEY, PLUGIN_RESULT_VALUE_FAILURE);
                        goto catch;
@@ -129,24 +127,19 @@ API int service_provider_message(service_provider_h provider, app_control_h app_
                auth_provider_add_extra_data(provider->auth_provider, reply);
                storage_provider_add_extra_data(provider->storage_provider, reply);
 
-               // TODO: another adaptor
-       }
-       else if (0 == strcmp(operation, PLUGIN_DISCONNECT_URI))
-       {
+               /* TODO: another adaptor */
+       } else if (0 == strcmp(operation, PLUGIN_DISCONNECT_URI)) {
                app_control_create(&reply);
                ret = provider->disconnect();
 
-               if (SERVICE_ADAPTOR_ERROR_NONE != ret)
-               {
+               if (SERVICE_ADAPTOR_ERROR_NONE != ret) {
                        SAL_ERR("connect() Fail (%d)", ret);
                        app_control_add_extra_data(reply, PLUGIN_RESULT_KEY, PLUGIN_RESULT_VALUE_FAILURE);
                        goto catch;
                }
 
                app_control_add_extra_data(reply, PLUGIN_RESULT_KEY, PLUGIN_RESULT_VALUE_SUCCESS);
-       }
-       else
-       {
+       } else {
                reply = auth_provider_message(provider->auth_provider, operation, app_control);
                TRY_IF(NULL != reply, "auth_plugin_client_message() Finded");
 
index a6676dc..a8e1126 100644 (file)
 #include "sal_service_storage_internal.h"
 #include "sal_ipc_client_storage.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
 int service_storage_cloud_start(service_storage_cloud_file_h file)
 {
@@ -76,9 +76,9 @@ int service_storage_cloud_stop(service_storage_cloud_file_h file)
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 API int service_storage_cloud_file_create(service_plugin_h plugin, service_storage_cloud_file_h *file)
 {
@@ -119,13 +119,10 @@ API int service_storage_cloud_file_clone(service_storage_cloud_file_h src_file,
        cloud_file->local_path = g_strdup(src_file->local_path);
        cloud_file->cloud_path = g_strdup(src_file->cloud_path);
        cloud_file->operation = g_strdup(src_file->operation);
-       // TODO: g_list_copy_deep()
-       if (NULL != src_file->files)
-       {
+       /* TODO: g_list_copy_deep() */
+       if (NULL != src_file->files) {
                cloud_file->files = g_list_copy(src_file->files);
-       }
-       else
-       {
+       } else {
                cloud_file->files = NULL;
        }
 
@@ -292,8 +289,7 @@ API int service_storage_cloud_file_foreach_file(service_storage_cloud_file_h fil
 
        RETV_IF(0 == g_list_length(file->files), SERVICE_ADAPTOR_ERROR_NO_DATA);
 
-       for (GList *list = g_list_first(file->files); list != NULL; list = list->next)
-       {
+       for (GList *list = g_list_first(file->files); list != NULL; list = list->next) {
                service_storage_cloud_file_h file_data = (service_storage_cloud_file_h) list->data;
 
                bool ret = callback(SERVICE_ADAPTOR_ERROR_NONE, file_data, user_data);
@@ -329,9 +325,9 @@ API int service_storage_cloud_file_destroy_task(service_task_h task)
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
-//******************************************************************************
-//* 2.4 Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * 2.4 Public interface definition
+ ******************************************************************************/
 
 API int service_storage_get_file_list(service_plugin_h plugin,
                                                const char *dir_path,
@@ -425,11 +421,11 @@ API int service_storage_create_download_task(service_plugin_h plugin,
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
-API int service_storage_create_download_thumbnail_task (service_plugin_h plugin,
-                                                const char *storage_path,
-                                                const char *download_path,
-                                                int thumbnail_size,
-                                                service_storage_task_h *task)
+API int service_storage_create_download_thumbnail_task(service_plugin_h plugin,
+                                               const char *storage_path,
+                                               const char *download_path,
+                                               int thumbnail_size,
+                                               service_storage_task_h *task)
 {
        RETV_IF(NULL == plugin, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
        RETV_IF(NULL == storage_path, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
@@ -469,7 +465,7 @@ API int service_storage_cancel_task(service_storage_task_h task)
 {
        RETV_IF(NULL == task, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-//     return service_task_stop((service_task_h) task);
+/*     return service_task_stop((service_task_h) task); */
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
index ddc9ebc..c3960fd 100644 (file)
 #include "sal_service_auth_internal.h"
 #include "sal_service_storage_internal.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 
 GList *service_tasks = NULL;
 GThreadPool *thread_pool = NULL;
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
 static void _service_task_async_func(gpointer data, gpointer user_data)
 {
        service_task_h task = (service_task_h) data;
 
-       if (NULL != task->oauth1)
-       {
+       if (NULL != task->oauth1) {
                service_auth_oauth1_start(task->oauth1);
-       }
-       else if (NULL != task->cloud_file)
-       {
+       } else if (NULL != task->cloud_file) {
                service_storage_cloud_start(task->cloud_file);
-       }
-       else
-       {
+       } else {
                return;
        }
 
-       // TODO: in IPC
-       if (NULL != task->storage_progress_callback)
-       {
+       /* TODO: in IPC */
+       if (NULL != task->storage_progress_callback) {
                task->storage_progress_callback(100, 100, task->user_data);
        }
-       if (NULL != task->storage_state_callback)
-       {
+       if (NULL != task->storage_state_callback) {
                task->storage_state_callback(SERVICE_STORAGE_TASK_COMPLETED, task->user_data);
        }
-       if (NULL != task->storage_result_callback)
-       {
+       if (NULL != task->storage_result_callback) {
                task->storage_result_callback(SERVICE_ADAPTOR_ERROR_NONE, task->user_data);
        }
-       if (NULL != task->storage_file_list_callback)
-       {
+       if (NULL != task->storage_file_list_callback) {
                service_storage_cloud_file_h file_list = (service_storage_cloud_file_h) g_malloc0(sizeof(service_storage_cloud_file_s));
                file_list->is_dir = false;
                file_list->cloud_path = "/sample.txt";
@@ -88,9 +79,9 @@ static void _service_task_async_func(gpointer data, gpointer user_data)
        }
 }
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 API int service_task_connect()
 {
@@ -106,7 +97,7 @@ API int service_task_disconnect()
 {
        SAL_FN_CALL;
 
-       // TODO: stop current stated task
+       /* TODO: stop current stated task */
 
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
@@ -130,12 +121,9 @@ API int service_task_stop(service_task_h task)
 
        RETV_IF(NULL == task, SERVICE_ADAPTOR_ERROR_INVALID_PARAMETER);
 
-       if (NULL != task->cloud_file)
-       {
+       if (NULL != task->cloud_file) {
                service_storage_cloud_stop(task->cloud_file);
-       }
-       else
-       {
+       } else {
                return SERVICE_ADAPTOR_ERROR_NO_DATA;
        }
 
index f511241..60f56d8 100644 (file)
@@ -52,8 +52,7 @@ API app_control_h storage_provider_message(storage_provider_h provider, const ch
 
        int ret = SERVICE_ADAPTOR_ERROR_NONE;
 
-       if (0 == strcmp(operation, CLOUD_REMOVE_FILE_URI))
-       {
+       if (0 == strcmp(operation, CLOUD_REMOVE_FILE_URI)) {
                app_control_create(&reply);
 
                char *cloud_path = NULL;
@@ -61,8 +60,7 @@ API app_control_h storage_provider_message(storage_provider_h provider, const ch
 
                ret = provider->cloud_remove_file(cloud_path);
 
-               if (SERVICE_ADAPTOR_ERROR_NONE != ret)
-               {
+               if (SERVICE_ADAPTOR_ERROR_NONE != ret) {
                        SAL_ERR("cloud_remove_file() Fail (%d)", ret);
                        app_control_add_extra_data(reply, PLUGIN_RESULT_KEY, PLUGIN_RESULT_VALUE_FAILURE);
                        return reply;
@@ -83,8 +81,7 @@ API int storage_provider_add_extra_data(storage_provider_h provider, app_control
 
        app_control_add_extra_data(reply, PLUGIN_KEY_STORAGE, PLUGIN_VALUE_TRUE);
 
-       if (NULL != provider->cloud_remove_file)
-       {
+       if (NULL != provider->cloud_remove_file) {
                app_control_add_extra_data(reply, CLOUD_REMOVE_FILE_URI, PLUGIN_VALUE_TRUE);
        }
 
index 03df9db..9082af6 100644 (file)
 #include "service_adaptor_internal.h"
 #include "sal_ipc.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 
 /**
  * Service Adaptor D-Bus client thread data
  */
-typedef struct _dbus_client_thread_data_s
-{
-       GMutex connection_mutex;        // Mutex used to protect connection status data
-       GCond connection_cond;          // Conditional variable used to signal that connection was established
-       int connection_cond_signaled;   // Additional variable used to signal that connection was established
+typedef struct _dbus_client_thread_data_s {
+       GMutex connection_mutex;        /* Mutex used to protect connection status data */
+       GCond connection_cond;          /* Conditional variable used to signal that connection was established */
+       int connection_cond_signaled;   /* Additional variable used to signal that connection was established */
 } dbus_client_thread_data_s;
 typedef struct _dbus_client_thread_data_s *dbus_client_thread_data_h;
 
@@ -69,9 +68,9 @@ static GDBusConnection *connection = NULL;
  */
 static GDBusProxy *interface_proxy = NULL;
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
 static gpointer _dbus_client_thread_func(gpointer data);
 
@@ -94,9 +93,9 @@ static void _on_signal(GDBusProxy *proxy,
                GVariant *parameters,
                gpointer user_data);
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
 /**
  * @brief D-Bus client thread function.
@@ -117,8 +116,7 @@ static gpointer _dbus_client_thread_func(gpointer data)
 
        ret = _dbus_client_start(data);
 
-       if (SERVICE_ADAPTOR_ERROR_NONE == ret)
-       {
+       if (SERVICE_ADAPTOR_ERROR_NONE == ret) {
                g_main_loop_run(dbus_client_loop);
        }
 
@@ -153,8 +151,7 @@ static service_adaptor_error_e _dbus_client_start(dbus_client_thread_data_h thre
 
        connection = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
 
-       if (NULL == connection)
-       {
+       if (NULL == connection) {
                g_error_free(error);
 
                return SERVICE_ADAPTOR_ERROR_INTERNAL;
@@ -169,8 +166,7 @@ static service_adaptor_error_e _dbus_client_start(dbus_client_thread_data_h thre
                        NULL,
                        &error);
 
-       if (NULL == interface_proxy)
-       {
+       if (NULL == interface_proxy) {
                g_error_free(error);
 
                g_object_unref(connection);
@@ -187,8 +183,7 @@ static service_adaptor_error_e _dbus_client_start(dbus_client_thread_data_h thre
                        thread_data,
                        NULL);
 
-       if (0 == watcher_id)
-       {
+       if (0 == watcher_id) {
                g_object_unref(interface_proxy);
                interface_proxy = NULL;
 
@@ -203,8 +198,7 @@ static service_adaptor_error_e _dbus_client_start(dbus_client_thread_data_h thre
                        G_CALLBACK(_on_signal),
                        NULL);
 
-       if (0 == res)
-       {
+       if (0 == res) {
                g_object_unref(interface_proxy);
                interface_proxy = NULL;
 
@@ -229,20 +223,17 @@ static service_adaptor_error_e _dbus_client_stop()
 {
        SAL_FN_CALL;
 
-       if (NULL != interface_proxy)
-       {
+       if (NULL != interface_proxy) {
                g_object_unref(interface_proxy);
                interface_proxy = NULL;
        }
 
-       if (NULL != connection)
-       {
+       if (NULL != connection) {
                g_object_unref(connection);
                connection = NULL;
        }
 
-       if (0 != watcher_id)
-       {
+       if (0 != watcher_id) {
                g_bus_unwatch_name(watcher_id);
                watcher_id = 0;
        }
@@ -268,8 +259,7 @@ static void _on_name_appeared(GDBusConnection *connection,
 
        dbus_client_thread_data_h thread_data = (dbus_client_thread_data_h) user_data;
 
-       if (NULL != thread_data)
-       {
+       if (NULL != thread_data) {
                g_mutex_lock(&thread_data->connection_mutex);
                thread_data->connection_cond_signaled = 1;
                g_cond_signal(&thread_data->connection_cond);
@@ -291,20 +281,17 @@ static void _on_name_vanished(GDBusConnection *connection,
 {
        SAL_FN_CALL;
 
-       if (NULL != interface_proxy)
-       {
+       if (NULL != interface_proxy) {
                g_object_unref(interface_proxy);
                interface_proxy = NULL;
        }
 
-       if (NULL != connection)
-       {
+       if (NULL != connection) {
                g_object_unref(connection);
                connection = NULL;
        }
 
-       if (0 != watcher_id)
-       {
+       if (0 != watcher_id) {
                g_bus_unwatch_name(watcher_id);
                watcher_id = 0;
        }
@@ -328,9 +315,8 @@ static void _on_signal(GDBusProxy *proxy,
 {
        SAL_FN_CALL;
 
-       if (0 == strncmp(signal_name, DBUS_SERVICE_ADAPTOR, DBUS_NAME_LENGTH))
-       {
-               // TODO:
+       if (0 == strncmp(signal_name, DBUS_SERVICE_ADAPTOR, DBUS_NAME_LENGTH)) {
+               /* TODO: */
 /*
                on_service_signal(proxy,
                                sender_name,
@@ -341,9 +327,9 @@ static void _on_signal(GDBusProxy *proxy,
        }
 }
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 API service_adaptor_error_e sal_ipc_client_get_interface(GDBusProxy **interface)
 {
@@ -358,10 +344,10 @@ API service_adaptor_error_e sal_ipc_client_init()
 {
        SAL_FN_CALL;
 
-#if !GLIB_CHECK_VERSION(2,32,0)
+#if !GLIB_CHECK_VERSION(2, 32, 0)
        g_thread_init(NULL);
 #endif
-#if !GLIB_CHECK_VERSION(2,35,0)
+#if !GLIB_CHECK_VERSION(2, 35, 0)
        g_type_init();
 #endif
 
@@ -377,11 +363,9 @@ API service_adaptor_error_e sal_ipc_client_init()
        dbus_client_thread = g_thread_new("Service Adaptor D-Bus Client", _dbus_client_thread_func, thread_data);
 
        gint64 timeout = g_get_monotonic_time() + 5 * G_TIME_SPAN_SECOND;
-       g_mutex_lock(&thread_data->connection_mutex );
-       while (!thread_data->connection_cond_signaled)
-       {
-               if (!g_cond_wait_until(&thread_data->connection_cond, &thread_data->connection_mutex, timeout))
-               {
+       g_mutex_lock(&thread_data->connection_mutex);
+       while (!thread_data->connection_cond_signaled) {
+               if (!g_cond_wait_until(&thread_data->connection_cond, &thread_data->connection_mutex, timeout)) {
                        g_mutex_unlock(&thread_data->connection_mutex);
                        return SERVICE_ADAPTOR_ERROR_INTERNAL;
                }
@@ -396,28 +380,23 @@ API service_adaptor_error_e sal_ipc_client_deinit()
 {
        SAL_FN_CALL;
 
-       if (NULL != dbus_client_loop)
-       {
-               if (g_main_loop_is_running(dbus_client_loop))
-               {
+       if (NULL != dbus_client_loop) {
+               if (g_main_loop_is_running(dbus_client_loop)) {
                        g_main_loop_quit(dbus_client_loop);
                }
        }
 
-       if (NULL != dbus_client_thread)
-       {
+       if (NULL != dbus_client_thread) {
                g_thread_join(dbus_client_thread);
                dbus_client_thread = NULL;
        }
 
-       if (NULL != dbus_client_loop)
-       {
+       if (NULL != dbus_client_loop) {
                g_main_loop_unref(dbus_client_loop);
                dbus_client_loop = NULL;
        }
 
-       if (NULL != dbus_client_context)
-       {
+       if (NULL != dbus_client_context) {
                g_main_context_pop_thread_default(dbus_client_context);
                g_main_context_unref(dbus_client_context);
                dbus_client_context = NULL;
index 051837d..99cf1d8 100644 (file)
 #include "sal_service_auth.h"
 #include "sal_service_auth_internal.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
 int _get_oauth1(GVariant *reply_info, service_auth_oauth1_h *oauth1)
 {
@@ -65,9 +65,9 @@ int _get_oauth1(GVariant *reply_info, service_auth_oauth1_h *oauth1)
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 API int ipc_service_auth_oauth1(const char *uri, service_auth_oauth1_h req_oauth1, service_auth_oauth1_h *res_oauth1)
 {
index 8759940..d0a32ff 100644 (file)
 #include "sal_ipc_client.h"
 #include "sal_ipc_client_core.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 API int ipc_service_adaptor_connect(const char *uri, GList **plugins)
 {
@@ -71,8 +71,7 @@ API int ipc_service_adaptor_connect(const char *uri, GList **plugins)
        GList *plugin_list = NULL;
        gsize uri_info_size = g_variant_n_children(info[idx2]);
 
-       for (gsize i = 0; i < uri_info_size; i++)
-       {
+       for (gsize i = 0; i < uri_info_size; i++) {
                GVariant *uri_info_struct;
                GVariant *uri_info_entry_v = g_variant_get_child_value(info[idx2], i);
                uri_info_struct = g_variant_get_child_value(uri_info_entry_v, 0);
index 5dd6dfe..901709e 100644 (file)
 #include "sal_service_storage.h"
 #include "sal_service_storage_internal.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
 int _get_cloud_file(GVariant *reply_info, service_storage_cloud_file_h *file)
 {
@@ -64,8 +64,7 @@ int _get_cloud_file(GVariant *reply_info, service_storage_cloud_file_h *file)
 
        gsize files_size = g_variant_n_children(info[idx]);
 
-       for (gsize i = 0; i < files_size; i++)
-       {
+       for (gsize i = 0; i < files_size; i++) {
                GVariant *files_struct;
                GVariant *files_entry_v = g_variant_get_child_value(info[idx], i);
                files_struct = g_variant_get_child_value(files_entry_v, 0);
@@ -77,16 +76,16 @@ int _get_cloud_file(GVariant *reply_info, service_storage_cloud_file_h *file)
 
        ipc_destroy_variant_info(info, info_size);
 
-       // TODO: reorder files because it is just serialized. it makes tree structure.
+       /* TODO: reorder files because it is just serialized. it makes tree structure. */
 
        *file = cloud_file;
 
        return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 API int ipc_service_storage_cloud_file(const char *uri, service_storage_cloud_file_h req_file, service_storage_cloud_file_h *res_file)
 {
index e4a9fbe..e5b8ae0 100644 (file)
@@ -27,9 +27,9 @@
 #include "sal_ipc_server_auth.h"
 #include "sal_ipc_server_storage.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 
 /**
  * D-Bus server thread
@@ -115,8 +115,7 @@ static const gchar introspection_xml[] =
 /**
  * information for method call
  */
-typedef struct _method_call_s
-{
+typedef struct _method_call_s {
        GDBusConnection *connection;
        gchar *sender;
        gchar *object_path;
@@ -128,13 +127,13 @@ typedef struct _method_call_s
 } method_call_s;
 typedef struct _method_call_s *method_call_h;
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
 static void _method_call_async_func(gpointer data, gpointer user_data)
 {
@@ -146,8 +145,7 @@ static void _method_call_async_func(gpointer data, gpointer user_data)
 
        SAL_INFO("Call %s", handle->method_name);
 
-       if (0 == strncmp(handle->method_name, DBUS_SERVICE_ADAPTOR, DBUS_NAME_LENGTH))
-       {
+       if (0 == strncmp(handle->method_name, DBUS_SERVICE_ADAPTOR, DBUS_NAME_LENGTH)) {
                service_adaptor_method_call(handle->connection,
                                handle->sender,
                                handle->object_path,
@@ -156,9 +154,7 @@ static void _method_call_async_func(gpointer data, gpointer user_data)
                                handle->parameters,
                                handle->invocation,
                                handle->user_data);
-       }
-       else if (0 == strncmp(handle->method_name, DBUS_SERVICE_PLUGIN, DBUS_NAME_LENGTH))
-       {
+       } else if (0 == strncmp(handle->method_name, DBUS_SERVICE_PLUGIN, DBUS_NAME_LENGTH)) {
                service_plugin_method_call(handle->connection,
                                handle->sender,
                                handle->object_path,
@@ -167,9 +163,7 @@ static void _method_call_async_func(gpointer data, gpointer user_data)
                                handle->parameters,
                                handle->invocation,
                                handle->user_data);
-       }
-       else if (0 == strncmp(handle->method_name, DBUS_SERVICE_AUTH, DBUS_NAME_LENGTH))
-       {
+       } else if (0 == strncmp(handle->method_name, DBUS_SERVICE_AUTH, DBUS_NAME_LENGTH)) {
                service_auth_method_call(handle->connection,
                                handle->sender,
                                handle->object_path,
@@ -178,9 +172,7 @@ static void _method_call_async_func(gpointer data, gpointer user_data)
                                handle->parameters,
                                handle->invocation,
                                handle->user_data);
-       }
-       else if (0 == strncmp(handle->method_name, DBUS_SERVICE_STORAGE, DBUS_NAME_LENGTH))
-       {
+       } else if (0 == strncmp(handle->method_name, DBUS_SERVICE_STORAGE, DBUS_NAME_LENGTH)) {
                service_storage_method_call(handle->connection,
                                handle->sender,
                                handle->object_path,
@@ -287,8 +279,7 @@ static gboolean _handle_set_property(GDBusConnection *connection,
 
        gboolean ret = false;
 
-       if (NULL == *error)
-       {
+       if (NULL == *error) {
                ret = true;
        }
 
@@ -298,8 +289,7 @@ static gboolean _handle_set_property(GDBusConnection *connection,
 /**
  * D-Bus handlers vtable.
  */
-static const GDBusInterfaceVTable interface_vtable =
-{
+static const GDBusInterfaceVTable interface_vtable = {
        _handle_method_call,
        _handle_get_property,
        _handle_set_property
@@ -364,15 +354,14 @@ static void _on_name_lost(GDBusConnection *connection,
 {
        SAL_FN_CALL;
 
-       if (NULL != dbus_connection)
-       {
+       if (NULL != dbus_connection) {
                g_object_unref(dbus_connection);
                dbus_connection = NULL;
        }
 
        SAL_INFO("Unexpected D-bus bus name lost");
 
-       // Send SIGINT to main thread to stop File Manager process and cleanly close Service Adaptor
+       /* Send SIGINT to main thread to stop File Manager process and cleanly close Service Adaptor */
        kill(getpid(), SIGINT);
 }
 
@@ -398,8 +387,7 @@ service_adaptor_error_e _sal_ipc_server_start()
                        NULL,
                        NULL);
 
-       if (0 == owner_id)
-       {
+       if (0 == owner_id) {
                g_dbus_node_info_unref(introspection_data);
                introspection_data = NULL;
 
@@ -413,19 +401,16 @@ service_adaptor_error_e _sal_ipc_server_stop()
 {
        SAL_FN_CALL;
 
-       if (NULL != thread_pool)
-       {
+       if (NULL != thread_pool) {
                g_thread_pool_free(thread_pool, TRUE, TRUE);
        }
 
-       if (0 != owner_id)
-       {
+       if (0 != owner_id) {
                g_bus_unown_name(owner_id);
                owner_id = 0;
        }
 
-       if (NULL != introspection_data)
-       {
+       if (NULL != introspection_data) {
                g_dbus_node_info_unref(introspection_data);
                introspection_data = NULL;
        }
@@ -451,8 +436,7 @@ static gpointer _dbus_server_thread_func(gpointer data)
 
        ret = _sal_ipc_server_start();
 
-       if (SERVICE_ADAPTOR_ERROR_NONE == ret)
-       {
+       if (SERVICE_ADAPTOR_ERROR_NONE == ret) {
                g_main_loop_run(dbus_server_loop);
        }
 
@@ -467,9 +451,9 @@ static gpointer _dbus_server_thread_func(gpointer data)
        return NULL;
 }
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 API service_adaptor_error_e sal_ipc_server_init()
 {
@@ -486,28 +470,23 @@ API service_adaptor_error_e sal_ipc_server_deinit()
 {
        SAL_FN_CALL;
 
-       if (NULL != dbus_server_loop)
-       {
-               if (g_main_loop_is_running(dbus_server_loop))
-               {
+       if (NULL != dbus_server_loop) {
+               if (g_main_loop_is_running(dbus_server_loop)) {
                        g_main_loop_quit(dbus_server_loop);
                }
        }
 
-       if (NULL != dbus_server_thread)
-       {
+       if (NULL != dbus_server_thread) {
                g_thread_join(dbus_server_thread);
                dbus_server_thread = NULL;
        }
 
-       if (NULL != dbus_server_loop)
-       {
+       if (NULL != dbus_server_loop) {
                g_main_loop_unref(dbus_server_loop);
                dbus_server_loop = NULL;
        }
 
-       if (NULL != dbus_server_context)
-       {
+       if (NULL != dbus_server_context) {
                g_main_context_pop_thread_default(dbus_server_context);
                g_main_context_unref(dbus_server_context);
                dbus_server_context = NULL;
index 22a8962..7f38daf 100644 (file)
 #include "sal_service_auth.h"
 #include "sal_service_auth_internal.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
 void _oauth1_get_access_token_cb(int result, oauth1_h oauth1, void *user_data)
 {
@@ -91,23 +91,20 @@ int _oauth1_execute_operation(auth_plugin_h plugin, service_auth_oauth1_h oauth1
 
        int ret = SERVICE_ADAPTOR_ERROR_NONE;
 
-       if (0 == strcmp(oauth1->operation, SERVICE_AUTH_OAUTH1_0_GET_ACCESS_TOKEN_URI))
-       {
+       if (0 == strcmp(oauth1->operation, SERVICE_AUTH_OAUTH1_0_GET_ACCESS_TOKEN_URI)) {
                ret = plugin->oauth1->oauth1_get_access_token(plugin, _oauth1_get_access_token_cb, reply);
 
                return ret;
-       }
-       else if (0 == strcmp(oauth1->operation, SERVICE_AUTH_OAUTH1_0_GET_EXTRA_DATA_URI))
-       {
+       } else if (0 == strcmp(oauth1->operation, SERVICE_AUTH_OAUTH1_0_GET_EXTRA_DATA_URI)) {
                return ret;
        }
 
        return SERVICE_ADAPTOR_ERROR_INTERNAL;
 }
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 API void service_auth_method_call(GDBusConnection *connection,
                const gchar *sender,
@@ -129,8 +126,7 @@ API void service_auth_method_call(GDBusConnection *connection,
 
        GVariant *in_parameters = g_variant_get_child_value(parameters, 0);
 
-       if (0 == g_strcmp0(method_name, DBUS_SERVICE_AUTH_OAUTH1_METHOD))
-       {
+       if (0 == g_strcmp0(method_name, DBUS_SERVICE_AUTH_OAUTH1_METHOD)) {
                int idx = 0;
                int size = service_auth_oauth1_req_s_type_length;
                GVariant *req_info[size];
index 1f5f471..5af7b8b 100644 (file)
 #include "sal_ipc_server.h"
 #include "sal_ipc_server_core.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 API void service_adaptor_method_call(GDBusConnection *connection,
                const gchar *sender,
@@ -63,8 +63,7 @@ API void service_adaptor_method_call(GDBusConnection *connection,
 
        GVariant *in_parameters = g_variant_get_child_value(parameters, 0);
 
-       if (0 == g_strcmp0(method_name, DBUS_SERVICE_ADAPTOR_CONNECT_METHOD))
-       {
+       if (0 == g_strcmp0(method_name, DBUS_SERVICE_ADAPTOR_CONNECT_METHOD)) {
                int idx = 0;
                int size = service_adaptor_connect_req_s_type_length;
                GVariant *req_info[size];
@@ -84,8 +83,7 @@ API void service_adaptor_method_call(GDBusConnection *connection,
 
                ipc_ret = sal_adaptor_get_plugins(&plugins, &plugins_size);
 
-               for (gsize i = 0; i < plugins_size; i++)
-               {
+               for (gsize i = 0; i < plugins_size; i++) {
                        ipc_insure_g_variant_builder_add_array_string(builder, plugins[i]);
                }
 
@@ -94,9 +92,7 @@ API void service_adaptor_method_call(GDBusConnection *connection,
 
                g_variant_builder_unref(builder);
                ipc_destroy_variant_info(req_info, size);
-       }
-       else if (0 == g_strcmp0(method_name, DBUS_SERVICE_ADAPTOR_DISCONNECT_METHOD))
-       {
+       } else if (0 == g_strcmp0(method_name, DBUS_SERVICE_ADAPTOR_DISCONNECT_METHOD)) {
                int idx = 0;
                int size = service_adaptor_disconnect_s_type_length;
                GVariant *req_info[size];
@@ -144,8 +140,7 @@ API void service_plugin_method_call(GDBusConnection *connection,
 
        GVariant *in_parameters = g_variant_get_child_value(parameters, 0);
 
-       if (0 == g_strcmp0(method_name, DBUS_SERVICE_PLUGIN_CREATE_METHOD))
-       {
+       if (0 == g_strcmp0(method_name, DBUS_SERVICE_PLUGIN_CREATE_METHOD)) {
                int idx = 0;
                int size = service_plugin_create_s_type_length;
                GVariant *req_info[size];
@@ -160,8 +155,7 @@ API void service_plugin_method_call(GDBusConnection *connection,
 
                sal_h sal = sal_get_handle();
 
-               if (NULL != sal)
-               {
+               if (NULL != sal) {
                        ipc_ret = auth_adaptor_ref_plugin(sal->auth, uri);
                }
 
@@ -169,9 +163,7 @@ API void service_plugin_method_call(GDBusConnection *connection,
                ipc_data = g_variant_new(ipc_make_return_type(ipc_type), ipc_ret, SAL_IPC_STR(ipc_msg));
 
                ipc_destroy_variant_info(req_info, size);
-       }
-       else if (0 == g_strcmp0(method_name, DBUS_SERVICE_PLUGIN_DESTROY_METHOD))
-       {
+       } else if (0 == g_strcmp0(method_name, DBUS_SERVICE_PLUGIN_DESTROY_METHOD)) {
                int idx = 0;
                int size = service_plugin_destroy_s_type_length;
                GVariant *req_info[size];
@@ -186,8 +178,7 @@ API void service_plugin_method_call(GDBusConnection *connection,
 
                sal_h sal = sal_get_handle();
 
-               if (NULL != sal)
-               {
+               if (NULL != sal) {
                        ipc_ret = auth_adaptor_unref_plugin(sal->auth, uri);
                }
 
@@ -214,8 +205,7 @@ service_adaptor_internal_error_code_e dbus_service_adaptor_signal_callback(servi
        GError* error = NULL;
        GDBusConnection *dbus_connection = dbus_get_connection();
 
-       if (NULL != dbus_connection)
-       {
+       if (NULL != dbus_connection) {
                GVariant *response = g_variant_new("(ts)", (uint64_t) signal_code, signal_msg);
 
                g_dbus_connection_emit_signal(dbus_connection,
@@ -226,8 +216,7 @@ service_adaptor_internal_error_code_e dbus_service_adaptor_signal_callback(servi
                                response,
                                &error );
 
-               if (NULL != error)
-               {
+               if (NULL != error) {
                        service_adaptor_debug("Unable to send msg: %s", error->message);
                        return SERVICE_ADAPTOR_INTERNAL_ERROR_DBUS;
                }
index 8ac8805..565d4ad 100644 (file)
 #include "sal_service_storage.h"
 #include "sal_service_storage_internal.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
 void _cloud_remove_file_cb(int result, cloud_file_h file, void *user_data)
 {
@@ -100,32 +100,23 @@ int _cloud_execute_operation(storage_plugin_h plugin, service_storage_cloud_file
 
        int ret = SERVICE_ADAPTOR_ERROR_NONE;
 
-       if (0 == strcmp(file->operation, SERVICE_STORAGE_CLOUD_REMOVE_FILE_URI))
-       {
+       if (0 == strcmp(file->operation, SERVICE_STORAGE_CLOUD_REMOVE_FILE_URI)) {
                ret = plugin->cloud->cloud_remove_file(plugin, file->cloud_path, _cloud_remove_file_cb, reply);
 
                return ret;
-       }
-       else if (0 == strcmp(file->operation, SERVICE_STORAGE_CLOUD_DOWNLOAD_FILE_URI))
-       {
+       } else if (0 == strcmp(file->operation, SERVICE_STORAGE_CLOUD_DOWNLOAD_FILE_URI)) {
                ret = plugin->cloud->cloud_remove_file(plugin, file->cloud_path, _cloud_remove_file_cb, reply);
 
                return ret;
-       }
-       else if (0 == strcmp(file->operation, SERVICE_STORAGE_CLOUD_UPLOAD_FILE_URI))
-       {
+       } else if (0 == strcmp(file->operation, SERVICE_STORAGE_CLOUD_UPLOAD_FILE_URI)) {
                ret = plugin->cloud->cloud_remove_file(plugin, file->cloud_path, _cloud_remove_file_cb, reply);
 
                return ret;
-       }
-       else if (0 == strcmp(file->operation, SERVICE_STORAGE_CLOUD_DOWNLOAD_FILE_THUMBNAIL_URI))
-       {
+       } else if (0 == strcmp(file->operation, SERVICE_STORAGE_CLOUD_DOWNLOAD_FILE_THUMBNAIL_URI)) {
                ret = plugin->cloud->cloud_remove_file(plugin, file->cloud_path, _cloud_remove_file_cb, reply);
 
                return ret;
-       }
-       else if (0 == strcmp(file->operation, SERVICE_STORAGE_CLOUD_GET_FILE_LIST_URI))
-       {
+       } else if (0 == strcmp(file->operation, SERVICE_STORAGE_CLOUD_GET_FILE_LIST_URI)) {
                ret = plugin->cloud->cloud_remove_file(plugin, file->cloud_path, _cloud_remove_file_cb, reply);
 
                return ret;
@@ -134,9 +125,9 @@ int _cloud_execute_operation(storage_plugin_h plugin, service_storage_cloud_file
        return SERVICE_ADAPTOR_ERROR_INTERNAL;
 }
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 API void service_storage_method_call(GDBusConnection *connection,
                const gchar *sender,
@@ -158,8 +149,7 @@ API void service_storage_method_call(GDBusConnection *connection,
 
        GVariant *in_parameters = g_variant_get_child_value(parameters, 0);
 
-       if (0 == g_strcmp0(method_name, DBUS_SERVICE_STORAGE_CLOUD_FILE_METHOD))
-       {
+       if (0 == g_strcmp0(method_name, DBUS_SERVICE_STORAGE_CLOUD_FILE_METHOD)) {
                int idx = 0;
                int size = service_storage_cloud_file_req_s_type_length;
                GVariant *req_info[size];
index 814fdcf..5348ace 100644 (file)
 #include "service_adaptor_internal.h"
 #include "sal_ipc.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 API char *ipc_insure_g_variant_dup_string(GVariant *string)
 {
        char *ret = g_variant_dup_string(string, NULL);
 
-       if (0 == strcmp(ret, ""))
-       {
+       if (0 == strcmp(ret, "")) {
                SAL_FREE(ret);
        }
 
@@ -54,12 +53,9 @@ API char *ipc_insure_g_variant_dup_string(GVariant *string)
 
 API void ipc_insure_g_variant_builder_add_array_string(GVariantBuilder *builder, const char *str)
 {
-       if (NULL == str)
-       {
+       if (NULL == str) {
                g_variant_builder_add(builder, "(s)", "");
-       }
-       else
-       {
+       } else {
                g_variant_builder_add(builder, "(s)", str);
        }
 }
@@ -71,38 +67,29 @@ API char *ipc_make_return_type(const char *type)
 
 API void ipc_create_error_msg(int code, char **ipc_msg)
 {
-       switch (code)
-       {
-               case SERVICE_ADAPTOR_ERROR_NONE:
-               {
-                       *ipc_msg = NULL;
-                       break;
-               }
-               case SERVICE_ADAPTOR_ERROR_INTERNAL:
-               {
-                       *ipc_msg = strdup("SERVICE_ADAPTOR_ERROR_INTERNAL");
-                       break;
-               }
-               default:
-               {
-                       *ipc_msg = strdup("SERVICE_ADAPTOR_ERROR_UNKNOWN");
-                       break;
-               }
+       switch (code) {
+       case SERVICE_ADAPTOR_ERROR_NONE:
+               *ipc_msg = NULL;
+               break;
+       case SERVICE_ADAPTOR_ERROR_INTERNAL:
+               *ipc_msg = strdup("SERVICE_ADAPTOR_ERROR_INTERNAL");
+               break;
+       default:
+               *ipc_msg = strdup("SERVICE_ADAPTOR_ERROR_UNKNOWN");
+               break;
        }
 }
 
 API void ipc_create_variant_info(GVariant *parameters, int size, GVariant ***var_info)
 {
-       for (size_t i = 0; i < size; i++)
-       {
+       for (size_t i = 0; i < size; i++) {
                *(var_info +i) = (GVariant **) g_variant_get_child_value(parameters, i);
        }
 }
 
 API void ipc_destroy_variant_info(GVariant **var_info, int size)
 {
-       for (size_t i = 0; i < size; i++)
-       {
+       for (size_t i = 0; i < size; i++) {
                g_variant_unref(var_info[i]);
        }
 }
index 4af6d1a..484fa30 100644 (file)
 #include "sal_auth.h"
 #include "service_adaptor_internal.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 void _sal_auth_login_cb(const char *uri, void *user_data)
 {
 }
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 auth_adaptor_listener_h sal_auth_register_listener(auth_adaptor_h auth)
 {
@@ -52,8 +52,7 @@ auth_adaptor_listener_h sal_auth_register_listener(auth_adaptor_h auth)
 
        int ret = auth_adaptor_register_listener(auth, listener);
 
-       if (SERVICE_ADAPTOR_ERROR_NONE != ret)
-       {
+       if (SERVICE_ADAPTOR_ERROR_NONE != ret) {
                SAL_FREE(listener);
        }
 
index b8246cd..27be4f8 100644 (file)
 #include "sal_contact.h"
 #include "service_adaptor_internal.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 contact_adaptor_listener_h sal_contact_register_listener(contact_adaptor_h contact)
 {
@@ -47,8 +47,7 @@ contact_adaptor_listener_h sal_contact_register_listener(contact_adaptor_h conta
 
        ret = contact_adaptor_register_listener(contact, listener);
 
-       if (SERVICE_ADAPTOR_ERROR_NONE != ret)
-       {
+       if (SERVICE_ADAPTOR_ERROR_NONE != ret) {
                SAL_FREE(listener);
        }
 
index c75ddbf..7513996 100644 (file)
 #include "service_discovery.h"
 #include "service_federation.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 #define FILE_PATH_LEN  256
 
 static sal_h g_service_adaptor = NULL;
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
 /**
  * @brief callback of app control
@@ -92,17 +92,13 @@ static void _provider_connect_cb(app_control_h request, app_control_h reply, app
        gpointer iter_key, iter_value;
 
        g_hash_table_iter_init(&iter, service);
-       while (g_hash_table_iter_next(&iter, &iter_key, &iter_value))
-       {
-               if (0 == strcmp(iter_key, PLUGIN_KEY_AUTH))
-               {
+       while (g_hash_table_iter_next(&iter, &iter_key, &iter_value)) {
+               if (0 == strcmp(iter_key, PLUGIN_KEY_AUTH)) {
                        auth_plugin_h plugin = NULL;
                        auth_adaptor_create_plugin(provider_user_data->uri, provider_user_data->name, provider_user_data->package, &plugin);
                        auth_adaptor_register_plugin_service(plugin, service);
                        auth_adaptor_add_plugin(sal->auth, plugin);
-               }
-               else if (0 == strcmp(iter_key, PLUGIN_KEY_STORAGE))
-               {
+               } else if (0 == strcmp(iter_key, PLUGIN_KEY_STORAGE)) {
                        storage_plugin_h plugin = NULL;
                        storage_adaptor_create_plugin(provider_user_data->uri, provider_user_data->name, provider_user_data->package, &plugin);
                        storage_adaptor_register_plugin_service(plugin, service);
@@ -136,7 +132,7 @@ static void _provider_disconnect_cb(app_control_h request, app_control_h reply,
        auth_adaptor_unregister_plugin_service(plugin);
        auth_adaptor_destroy_plugin(plugin);
 
-       // TODO: destroy plugin of other adaptor
+       /* TODO: destroy plugin of other adaptor */
 
        SAL_FN_END;
 }
@@ -241,39 +237,39 @@ static sal_h _sal_create()
 
        sal_h sal = NULL;
 
-       // 1) create auth adaptor handle
+       /* 1) create auth adaptor handle */
        auth_adaptor_h auth = auth_adaptor_create();
        TRYM_IF(NULL == auth, "sal_auth_create_handle() Fail");
 
-       // 2) create contact adaptor handle
+       /* 2) create contact adaptor handle */
        contact_adaptor_h contact = contact_adaptor_create();
        TRYM_IF(NULL == contact, "sal_contact_create_handle() Fail");
 
-       // 3) create storage adaptor handle
+       /* 3) create storage adaptor handle */
        storage_adaptor_h storage = storage_adaptor_create();
        TRYM_IF(NULL == storage, "sal_storage_create_handle() Fail");
 
-       // 4) create resource adaptor handle
+       /* 4) create resource adaptor handle */
        resource_adaptor_h resource = resource_adaptor_create();
        TRYM_IF(NULL == resource, "sal_resource_create_handle() Fail");
 
-       // 5) register auth adaptor listener
+       /* 5) register auth adaptor listener */
        auth_adaptor_listener_h auth_listener = sal_auth_register_listener(auth);
        TRYM_IF(NULL == auth_listener, "sal_auth_register_listener() Fail");
 
-       // 6) register contact adaptor listener
+       /* 6) register contact adaptor listener */
        contact_adaptor_listener_h contact_listener = sal_contact_register_listener(contact);
        TRYM_IF(NULL == contact_listener, "sal_contact_register_listener() Fail");
 
-       // 7) register storage adaptor listener
+       /* 7) register storage adaptor listener */
        storage_adaptor_listener_h storage_listener = sal_storage_register_listener(storage);
        TRYM_IF(NULL == storage_listener, "sal_storage_register_listener() Fail");
 
-       // 8) register resource adaptor listener
+       /* 8) register resource adaptor listener */
        resource_adaptor_listener_h resource_listener = sal_resource_register_listener(resource);
        TRYM_IF(NULL == resource_listener, "sal_resource_register_listener() Fail");
 
-       // 9) create service adaptor
+       /* 9) create service adaptor */
        sal = (sal_h) g_malloc0(sizeof(sal_s));
        TRYM_IF(NULL == sal, "could not create service adaptor");
 
@@ -286,7 +282,7 @@ static sal_h _sal_create()
        g_cond_init(&sal->cond);
 
 catch:
-       // TODO: free
+       /* TODO: free */
 
        return sal;
 }
@@ -302,14 +298,13 @@ static void _sal_destroy(sal_h sal)
 
        RET_IF(NULL == sal);
 
-        // 1) destroy service list
-        if (NULL != sal->svc_list)
-        {
-                g_list_free(sal->svc_list);
-                sal->svc_list = NULL;
-        }
+       /* 1) destroy service list */
+       if (NULL != sal->svc_list) {
+               g_list_free(sal->svc_list);
+               sal->svc_list = NULL;
+       }
 
-       // 2) free service adaptor handle
+       /* 2) free service adaptor handle */
        SAL_FREE(sal);
 
        SAL_FN_END;
@@ -325,34 +320,34 @@ static service_adaptor_error_e _sal_init()
        SAL_FN_CALL;
        int ret = SERVICE_ADAPTOR_ERROR_NONE;
 
-       // 1) create adaptor (memory allocation)
+       /* 1) create adaptor (memory allocation) */
        sal_h sal = _sal_create();
        RETVM_IF(NULL == sal, SERVICE_ADAPTOR_ERROR_INTERNAL, "_sal_create() Fail");
 
-       // 2) start adaptor (plugin loading)
+       /* 2) start adaptor (plugin loading) */
        ret = _sal_start(sal);
        RETVM_IF(SERVICE_ADAPTOR_ERROR_NONE != ret, SERVICE_ADAPTOR_ERROR_INTERNAL, "_sal_start() Fail(%d)", ret);
 
-       // 3) start adaptor (spec file creation)
+       /* 3) start adaptor (spec file creation) */
        ret = _sal_create_spec_file(sal);
        RETVM_IF(SERVICE_ADAPTOR_ERROR_NONE != ret, SERVICE_ADAPTOR_ERROR_INTERNAL, "_sal_create_spec_file() Fail(%d)", ret);
 
-       // 4) init dbus server
+       /* 4) init dbus server */
        ret = sal_ipc_server_init();
        RETVM_IF(SERVICE_ADAPTOR_ERROR_NONE != ret, SERVICE_ADAPTOR_ERROR_IPC_UNSTABLE, "sal_ipc_server_init() Fail(%d)", ret);
 
-       // 5) assign to global service adaptor handle
+       /* 5) assign to global service adaptor handle */
        g_service_adaptor = sal;
 
-       // 6) register callback for package event
+       /* 6) register callback for package event */
        ret = sal_observer_start();
        RETVM_IF(SERVICE_ADAPTOR_ERROR_NONE != ret, ret, "sal_observer_start() Fail(%d)", ret);
 
-       // 7) create service discovery
+       /* 7) create service discovery */
        ret = service_discovery_create();
        RETVM_IF(SERVICE_ADAPTOR_ERROR_NONE != ret, ret, "service_discovery_create() Fail(%d)", ret);
 
-       // 8) create service federation
+       /* 8) create service federation */
        ret = service_federation_create();
        RETVM_IF(SERVICE_ADAPTOR_ERROR_NONE != ret, ret, "service_federation_create() Fail(%d)", ret);
 
@@ -375,8 +370,7 @@ static void _sal_deinit(sal_h sal)
 
        _sal_destroy_spec_file(sal);
 
-        if (0 < sal->start)
-        {
+       if (0 < sal->start) {
                _sal_stop(sal);
        }
 
@@ -410,29 +404,29 @@ int main(int argc, char *argv[])
        int ret = SERVICE_ADAPTOR_ERROR_NONE;
        GMainLoop *loop = NULL;
 
-#if !GLIB_CHECK_VERSION(2,32,0)
+#if !GLIB_CHECK_VERSION(2, 32, 0)
        g_thread_init(NULL);
 #endif
-#if !GLIB_CHECK_VERSION(2,35,0)
+#if !GLIB_CHECK_VERSION(2, 35, 0)
        g_type_init();
 #endif
 
        ret = _sal_init();
        RETVM_IF(SERVICE_ADAPTOR_ERROR_NONE != ret, 0, "_sal_init() Fail(%d)", ret);
 
-       // mainloop of main thread
+       /* mainloop of main thread */
        loop = g_main_loop_new(NULL, FALSE);
 
-       // installing signal handlers
+       /* installing signal handlers */
        g_unix_signal_add_full(G_PRIORITY_HIGH, SIGINT,
-                       _sigterm_callback, loop, NULL );
+                       _sigterm_callback, loop, NULL);
        g_unix_signal_add_full(G_PRIORITY_HIGH, SIGTERM,
-                       _sigterm_callback, loop, NULL );
+                       _sigterm_callback, loop, NULL);
 
-       // start application's main loop
+       /* start application's main loop */
        g_main_loop_run(loop);
 
-       // cleanup after mainloop
+       /* cleanup after mainloop */
        g_main_loop_unref(loop);
 
        sal_h sal = sal_get_handle();
@@ -441,29 +435,29 @@ int main(int argc, char *argv[])
        return 0;
 }
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 API sal_h sal_get_handle()
 {
        SAL_FN_CALL;
 
-        return g_service_adaptor;
+       return g_service_adaptor;
 }
 
 API char *sal_get_root_path()
 {
        SAL_FN_CALL;
 
-        char *root_path = NULL;
-        char tnfs_root_path[FILE_PATH_LEN] = {0,};
+       char *root_path = NULL;
+       char tnfs_root_path[FILE_PATH_LEN] = {0,};
 
-        // TODO: tmp -> need to use get_path APIs of TNFS
-        snprintf(tnfs_root_path, FILE_PATH_LEN, "%s", "/opt/storage/tnfs");
-        root_path = strdup(tnfs_root_path);
+       /* TODO: tmp -> need to use get_path APIs of TNFS */
+       snprintf(tnfs_root_path, FILE_PATH_LEN, "%s", "/opt/storage/tnfs");
+       root_path = strdup(tnfs_root_path);
 
-        return root_path;
+       return root_path;
 }
 
 API service_adaptor_error_e sal_adaptor_connect(const char *uri)
@@ -474,7 +468,7 @@ API service_adaptor_error_e sal_adaptor_connect(const char *uri)
 
        SAL_INFO("uri: %s", uri);
 
-        return SERVICE_ADAPTOR_ERROR_NONE;
+       return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
 API service_adaptor_error_e sal_adaptor_disconnect(const char *uri)
@@ -485,7 +479,7 @@ API service_adaptor_error_e sal_adaptor_disconnect(const char *uri)
 
        SAL_INFO("uri: %s", uri);
 
-        return SERVICE_ADAPTOR_ERROR_NONE;
+       return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
 API service_adaptor_error_e sal_adaptor_get_plugins(char ***plugins, int *plugins_size)
@@ -501,8 +495,7 @@ API service_adaptor_error_e sal_adaptor_get_plugins(char ***plugins, int *plugin
        int i = 0;
        char **uri = (char **) g_malloc0(sizeof(char *) * size);
 
-       for (GList *list = g_list_first(g_service_adaptor->auth->plugins); list != NULL; list = list->next)
-       {
+       for (GList *list = g_list_first(g_service_adaptor->auth->plugins); list != NULL; list = list->next) {
                auth_plugin_h this = (auth_plugin_h) list->data;
 
                uri[i] = strdup(this->uri);
@@ -537,7 +530,7 @@ API service_adaptor_error_e sal_provider_connect(const char *uri, const char *na
 
        app_control_destroy(request);
 
-        return SERVICE_ADAPTOR_ERROR_NONE;
+       return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
 API service_adaptor_error_e sal_provider_disconnect(const char *uri)
@@ -558,7 +551,7 @@ API service_adaptor_error_e sal_provider_disconnect(const char *uri)
 
        app_control_destroy(request);
 
-        return SERVICE_ADAPTOR_ERROR_NONE;
+       return SERVICE_ADAPTOR_ERROR_NONE;
 }
 
 API char *sal_provider_get_uri(const char *package)
@@ -572,5 +565,5 @@ API char *sal_provider_get_uri(const char *package)
 
        char *uri = auth_adaptor_get_uri(sal->auth, package);
 
-        return uri;
+       return uri;
 }
index a030eab..0d90000 100644 (file)
 #include "sal_observer.h"
 #include "auth_adaptor.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 #define SAL_PLUGIN_METADATA_KEY_ADAPTOR        "service-adaptor"
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
 /**
  * @brief callback of app info
@@ -56,10 +56,8 @@ static bool _sal_app_meta_cb(const char *key, const char *value, void *user_data
 
        provider_user_data_h provider_user_data = (provider_user_data_h) user_data;
 
-       if ((NULL != key) && (NULL != value))
-       {
-               if (0 == strncmp(SAL_PLUGIN_METADATA_KEY_ADAPTOR, key, strlen(SAL_PLUGIN_METADATA_KEY_ADAPTOR)))
-               {
+       if ((NULL != key) && (NULL != value)) {
+               if (0 == strncmp(SAL_PLUGIN_METADATA_KEY_ADAPTOR, key, strlen(SAL_PLUGIN_METADATA_KEY_ADAPTOR))) {
                        SAL_INFO("%s: %s", provider_user_data->uri, value);
                        int ret = sal_provider_connect(provider_user_data->uri, value, provider_user_data->package);
 
@@ -102,17 +100,16 @@ static bool _sal_app_info_cb(package_info_app_component_type_e comp_type, const
  * @return      void.
  */
 static void _sal_package_event_cb(const char *type,
-                const char *package,
-                package_manager_event_type_e event_type,
-                package_manager_event_state_e event_state,
-                int progress,
-                package_manager_error_e error,
-                void *user_data)
+               const char *package,
+               package_manager_event_type_e event_type,
+               package_manager_event_state_e event_state,
+               int progress,
+               package_manager_error_e error,
+               void *user_data)
 {
        SAL_FN_CALL;
 
-        if ((PACKAGE_MANAGER_EVENT_TYPE_INSTALL == event_type) && (PACKAGE_MANAGER_EVENT_STATE_COMPLETED == event_state))
-        {
+       if ((PACKAGE_MANAGER_EVENT_TYPE_INSTALL == event_type) && (PACKAGE_MANAGER_EVENT_STATE_COMPLETED == event_state)) {
                int ret = PACKAGE_MANAGER_ERROR_NONE;
                package_info_h p_info = NULL;
 
@@ -124,9 +121,7 @@ static void _sal_package_event_cb(const char *type,
 
                ret = package_info_destroy(p_info);
                RETM_IF(PACKAGE_MANAGER_ERROR_NONE != ret, "package_info_destroy() Fail(%d)", ret);
-       }
-        else if ((PACKAGE_MANAGER_EVENT_TYPE_UNINSTALL == event_type) && (PACKAGE_MANAGER_EVENT_STATE_COMPLETED == event_state))
-        {
+       } else if ((PACKAGE_MANAGER_EVENT_TYPE_UNINSTALL == event_type) && (PACKAGE_MANAGER_EVENT_STATE_COMPLETED == event_state)) {
                sal_h sal = sal_get_handle();
                RETM_IF(NULL == sal, "sal_get_handle() Fail");
 
@@ -142,7 +137,7 @@ static void _sal_package_event_cb(const char *type,
                storage_adaptor_unregister_plugin_service(storage_plugin);
                storage_adaptor_destroy_plugin(storage_plugin);
 
-               // TODO: destroy plugin of other adaptor
+               /* TODO: destroy plugin of other adaptor */
        }
 }
 
@@ -167,9 +162,9 @@ static bool _sal_package_info_cb(package_info_h package_info, void *user_data)
        return true;
 }
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 /**
  * @brief start observer using package manager
index c465e0c..7e7168a 100644 (file)
 #include "sal_resource.h"
 #include "service_adaptor_internal.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 resource_adaptor_listener_h sal_resource_register_listener(resource_adaptor_h resource)
 {
@@ -47,8 +47,7 @@ resource_adaptor_listener_h sal_resource_register_listener(resource_adaptor_h re
 
        ret = resource_adaptor_register_listener(resource, listener);
 
-       if (SERVICE_ADAPTOR_ERROR_NONE != ret)
-       {
+       if (SERVICE_ADAPTOR_ERROR_NONE != ret) {
                SAL_FREE(listener);
        }
 
index 64c0a4e..a7e99b8 100644 (file)
 #include "sal_storage.h"
 #include "service_adaptor_internal.h"
 
-//******************************************************************************
-//* Global variables and defines
-//******************************************************************************
+/******************************************************************************
+ * Global variables and defines
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface
-//******************************************************************************
+/******************************************************************************
+ * Private interface
+ ******************************************************************************/
 
-//******************************************************************************
-//* Private interface definition
-//******************************************************************************
+/******************************************************************************
+ * Private interface definition
+ ******************************************************************************/
 
-//******************************************************************************
-//* Public interface definition
-//******************************************************************************
+/******************************************************************************
+ * Public interface definition
+ ******************************************************************************/
 
 storage_adaptor_listener_h sal_storage_register_listener(storage_adaptor_h storage)
 {
@@ -47,8 +47,7 @@ storage_adaptor_listener_h sal_storage_register_listener(storage_adaptor_h stora
 
        ret = storage_adaptor_register_listener(storage, listener);
 
-       if (SERVICE_ADAPTOR_ERROR_NONE != ret)
-       {
+       if (SERVICE_ADAPTOR_ERROR_NONE != ret) {
                SAL_FREE(listener);
        }
 
index c3786ec..04d7691 100644 (file)
@@ -32,8 +32,7 @@ void _service_plugin_login_callback(int result, void *user_data)
 
        ret = service_plugin_start_all(service_plugin);
 
-       if (SERVICE_ADAPTOR_ERROR_NONE != ret)
-       {
+       if (SERVICE_ADAPTOR_ERROR_NONE != ret) {
                printf("service_plugin_start Failed(%d)\n", ret);
                return;
        }
@@ -47,8 +46,7 @@ void _service_plugin_login_callback(int result, void *user_data)
        service_task_h auth_task = NULL;
        ret = service_auth_oauth1_create_task(oauth1, &auth_task);
        ret = service_task_start(auth_task);
-       if (SERVICE_ADAPTOR_ERROR_NONE == ret)
-       {
+       if (SERVICE_ADAPTOR_ERROR_NONE == ret) {
                printf("service_auth_oauth1_get_access_token() Request Successed\n");
        }
 
@@ -62,16 +60,14 @@ void _service_plugin_login_callback(int result, void *user_data)
        service_task_h task = NULL;
        ret = service_storage_cloud_file_create_task(file, &task);
        ret = service_task_start(task);
-       if (SERVICE_ADAPTOR_ERROR_NONE == ret)
-       {
+       if (SERVICE_ADAPTOR_ERROR_NONE == ret) {
                printf("service_storage_cloud_remove_file() Request Successed: %s\n", cloud_path);
        }
 }
 
 bool _service_adaptor_plugin_callback(const char *uri, int service_mask, void *user_data)
 {
-       if (0 != strcmp(uri, "org.tizen.service-plugin-sample"))
-       {
+       if (0 != strcmp(uri, "org.tizen.service-plugin-sample")) {
                return true;
        }
 
@@ -79,16 +75,14 @@ bool _service_adaptor_plugin_callback(const char *uri, int service_mask, void *u
 
        ret = service_plugin_create(uri, &service_plugin);
 
-       if (SERVICE_ADAPTOR_ERROR_NONE != ret)
-       {
+       if (SERVICE_ADAPTOR_ERROR_NONE != ret) {
                printf("service_plugin_create(%s) Failed(%d)\n", uri, ret);
                return true;
        }
 
        ret = service_plugin_login(service_plugin, _service_plugin_login_callback, NULL);
 
-       if (SERVICE_ADAPTOR_ERROR_NONE != ret)
-       {
+       if (SERVICE_ADAPTOR_ERROR_NONE != ret) {
                printf("service_plugin_login(%s) Failed(%d)\n", uri, ret);
                return true;
        }
@@ -107,10 +101,10 @@ int main()
 {
        GMainLoop *loop = NULL;
 
-#if !GLIB_CHECK_VERSION(2,32,0)
+#if !GLIB_CHECK_VERSION(2, 32, 0)
        g_thread_init(NULL);
 #endif
-#if !GLIB_CHECK_VERSION(2,35,0)
+#if !GLIB_CHECK_VERSION(2, 35, 0)
        g_type_init();
 #endif
 
@@ -123,9 +117,9 @@ int main()
        loop = g_main_loop_new(NULL, FALSE);
 
        g_unix_signal_add_full(G_PRIORITY_HIGH, SIGINT,
-                       _sigterm_callback, loop, NULL );
+                       _sigterm_callback, loop, NULL);
        g_unix_signal_add_full(G_PRIORITY_HIGH, SIGTERM,
-                       _sigterm_callback, loop, NULL );
+                       _sigterm_callback, loop, NULL);
 
        g_main_loop_run(loop);