Fix coding style 92/126492/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Mon, 24 Apr 2017 00:27:33 +0000 (09:27 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Mon, 24 Apr 2017 00:27:33 +0000 (09:27 +0900)
Change-Id: I134cd04f3541d64d950fba52ffd55c54b64ece03
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
include/analyzer_iface.h
include/event.h
include/json.h
include/smartreply_util.h
include/types_internal.h
src/dbus_client.cpp
src/dbus_client.h
src/event.cpp
src/json.cpp
src/request_handler.cpp
src/smartreply_service.cpp

index 68da14497f9f8704a47a17e63aeffab105b9f259..64d745496da5827b8c9046ac811e8266f156c424 100755 (executable)
@@ -37,9 +37,7 @@ namespace smr {
                        virtual int read(const char* subject, smr::json option, smr::json* request_result) = 0;
 
                        virtual int write(const char* subject, smr::json data, smr::json* request_result) = 0;
-
        };      /* class analyzer_iface */
-
 }      /* namespace smr */
 
 #endif /* End of __SMARTREPLY_ANALYZER_INTERFACE_H__ */
index 698f17b6fb224761dc7851e680e2a36ef84c8762..5576d222c9bf9850498aa6212600cd504ac87686 100755 (executable)
@@ -48,7 +48,6 @@ class event_driven_thread {
                bool start();
                bool stop();
                bool is_running();
-
 };     /* class event_driven_thread */
 
 #endif /* _EVENT_DRIVEN_THREAD_H_ */
index 29c444beea4e5e9e9a18fb5e845096c2125998f7..da2bc4ae1c39481757bf8b950b6b8ee0949eb78d 100755 (executable)
@@ -26,7 +26,7 @@
 #define _J(cmt, jobj) \
 do { \
        _SD("%s: %s", (cmt), jobj.str().c_str()); \
-} while(0)
+} while (0)
 
 #define EMPTY_JSON_OBJECT      "{}"
 #define DEFAULT_PRECISION      3
index 429d6b2249764ca29d95e342a1405e43b08d165b..c7e97fb8bc955cc208a69ec5744cae34262c7c3a 100755 (executable)
 /*
 * Internal Macros
 */
-#define SMARTREPLY_LOGD(fmt,args...)  LOGD(fmt, ##args)
-#define SMARTREPLY_LOGW(fmt,args...)  LOGW(fmt, ##args)
-#define SMARTREPLY_LOGI(fmt,args...)  LOGI(fmt, ##args)
-#define SMARTREPLY_LOGE(fmt,args...)  LOGE(fmt, ##args)
-#define SMARTREPLY_SECLOG(fmt,args...)  SECURE_LOGD(fmt, ##args)
+#define SMARTREPLY_LOGD(fmt, args...)  LOGD(fmt, ##args)
+#define SMARTREPLY_LOGW(fmt, args...)  LOGW(fmt, ##args)
+#define SMARTREPLY_LOGI(fmt, args...)  LOGI(fmt, ##args)
+#define SMARTREPLY_LOGE(fmt, args...)  LOGE(fmt, ##args)
+#define SMARTREPLY_SECLOG(fmt, args...)  SECURE_LOGD(fmt, ##args)
 
 #define SMARTREPLY_CHECK_CONDITION(condition, error, msg)     \
         do { \
 
 #define SMARTREPLY_NULL_ARG_CHECK_RETURN_FALSE(arg)\
         do { \
-                if(arg != NULL) { \
+                if (arg != NULL) { \
                 } else  { \
                         SMARTREPLY_LOGE("SMARTREPLY_ERROR_INVALID_PARAMETER");  \
                         return false; };        \
         } while (0)
 
 #define SMARTREPLY_NULL_ARG_CHECK(arg)        \
-        SMARTREPLY_CHECK_CONDITION(arg != NULL,SMARTREPLY_ERROR_INVALID_PARAMETER,"SMARTREPLY_ERROR_INVALID_PARAMETER")
+        SMARTREPLY_CHECK_CONDITION(arg != NULL, SMARTREPLY_ERROR_INVALID_PARAMETER, "SMARTREPLY_ERROR_INVALID_PARAMETER")
 
 #define SMARTREPLY_PRINT_ERROR_CODE_RETURN(code) \
         do{ \
index 6b29d7a066f3a3be48ad54e7b2da600a179b3a22..9594b3bad759a052fd4ce9af8ca555830a8c5c89 100755 (executable)
                 return SMARTREPLY_ERROR_INVALID_PARAMETER; \
         }
 
-#define SMR_MEM_DATA_CPY(dest,src,len,type) \
+#define SMR_MEM_DATA_CPY(dest, src, len, type) \
                 do{ \
-                        if(src!=NULL&&len>0) \
+                        if (src != NULL && len > 0) \
                         { \
                                 dest = (type *) calloc (len+1 , sizeof (type)); \
                                 assert(dest); \
                                 memcpy(dest, src, len*sizeof(type)); \
                         } \
-                } while(0);
+                } while (0);
 
 
 
index ce09c50567433a915c764d37ef4f957c9fdcd0b5..3b27521a9df73746af419dd4224d787df94ed5ce 100755 (executable)
@@ -144,7 +144,7 @@ bool smr::dbus_client::init()
        guint reg_id = g_dbus_connection_register_object(dbus_connection, DBUS_PATH,
                        dbus_node_info->interfaces[0], &vtable, NULL, NULL, &gerr);
        HANDLE_GERROR(gerr);
-       IF_FAIL_RETURN_TAG(reg_id>0, false, _E, "Object registration failed");
+       IF_FAIL_RETURN_TAG(reg_id > 0, false, _E, "Object registration failed");
 
        _I("Dbus connection established: %s", g_dbus_connection_get_unique_name(dbus_connection));
        return true;
@@ -174,7 +174,6 @@ namespace {
        void g_async_ready_callback(GObject *source_object,
                                                        GAsyncResult *res,
                                                        gpointer user_data) {
-
                _I("g_async_ready_callback");
 
                GError *err = NULL;
index baa64cbc4f9cacf4c77d64122e1d1304767cada3..1e9ef31d4e0f7cde4d6891ba08694072f9dec781 100755 (executable)
@@ -33,7 +33,6 @@ namespace smr {
                        int request_async(int type, int req_id, const char* subject, const char* input, void* ext, dbus_client_request_callback cb);
                        int request(int type, int req_id, const char* subject, const char* input, std::string* req_result, std::string* data_read);
                        int request_with_no_reply(int type, int req_id, const char* subject, const char* input);
-
        };      /* classs smr::dbus_client */
 
 }      /* namespace smr */
index 99ba604f5ee6c05fe79d0a3aa5d2a7f006f36fdf..9c27c2f1821328f08623e8034c4b47120d5a70eb 100755 (executable)
@@ -104,7 +104,6 @@ void event_driven_thread::process_event_queue()
        event_message_s *event = NULL;
 
        while (g_atomic_int_get(&thread_info.is_running)) {
-
                event = static_cast<event_message_s*>(g_async_queue_pop(thread_info.event_queue));
 
                if (event) {
@@ -116,6 +115,5 @@ void event_driven_thread::process_event_queue()
                                delete event;
                        }
                }
-
        }
 }
index aece126b5d36caea3a6c407ed4a8a9a5ee340e9a..c4b8f509eef2f08e167e0947e4da2e985cb2ca47 100755 (executable)
@@ -250,7 +250,7 @@ static char** tokenize_path(const char* path, int* length)
        return tokens;
 
 CATCH:
-       for (j=0; j<i; j++) {
+       for (j = 0; j < i; j++) {
                g_free(tokens[j]);
        }
        g_free(tokens);
@@ -261,7 +261,7 @@ static void free_tokenized_path(int length, char** tokens)
 {
        int i;
        if (tokens) {
-               for (i=0; i<length; i++) {
+               for (i = 0; i < length; i++) {
                        g_free(tokens[i]);
                }
                g_free(tokens);
@@ -287,7 +287,7 @@ static JsonObject* traverse(JsonNode* jnode, const char* path, bool force)
                IF_FAIL_RETURN_TAG(path_token, NULL, _E, "Invalid path");
        }
 
-       for (depth=0; depth<length; depth++) {
+       for (depth = 0; depth < length; depth++) {
                if (!json_object_has_member(jobj, path_token[depth])) {
                        if (force) {
                                child_obj = json_object_new();
@@ -899,7 +899,7 @@ bool smr::json::array_equals(json_node_t* lhs, json_node_t* rhs)
        int size = json_array_get_length(larr);
        IF_FAIL_RETURN(size == static_cast<int>(json_array_get_length(rarr)), false);
 
-       for (int i=0; i<size; ++i) {
+       for (int i = 0; i < size; ++i) {
                json_node_t *lhs_child = json_array_get_element(larr, i);
                json_node_t *rhs_child = json_array_get_element(rarr, i);
                IF_FAIL_RETURN(node_equals(lhs_child, rhs_child), false);
index f09b0fa8855b8d981fc4f1c8fa2709872c949bb2..25fe98bc2f73a5300f1fa2100193bfbb0c2e7d3e 100755 (executable)
@@ -118,10 +118,8 @@ int smr::request_handler::remove_engine(const char* language, int* req_id)
        _I("[remove_engine():Client Get Result] Error: %#x", error);
        _SI("[remove_engine():Client Get Result] Result: %s", result_str.c_str());
        return error;
-
 }
 
-
 namespace {
 
 struct UserData {
@@ -129,7 +127,6 @@ struct UserData {
        void* ext;
 };
 void dbus_callback(int req_id, int error, void* ext, const std::string& req_result, const std::string& data_read) {
-
        _I("dbus_callback");
 
        UserData* ud = (UserData*)ext;
@@ -224,8 +221,7 @@ int smr::request_handler::send_prepare_engine()
 
        int req_id = generate_req_id();
        int error = dbus_handle->request_with_no_reply(REQ_PREPARE_ENGINE, req_id, NULL, NULL);
-       
-       
+
        _I("[prepare_engine():Client Get Result] Error: %#x", error);
        return error;
 }
index 49779004346b57642c7c845247415252ddecbbe8..859377848534b90050d0f634cd71727afce7a55b 100755 (executable)
@@ -59,7 +59,6 @@ std::vector<std::string> split(const std::string &s, char delim) {
 
 std::string check_null_str(const char* str, const char* def) {
         return std::string(str == NULL || (strlen(str) == 0) ? def : str);
-
 }
 
 int _list_add_all(smartreply_reply_h** candidate_list, int* length, std::string result_str)
@@ -133,7 +132,7 @@ EXPORT_API int smartreply_service_get_replies(const char* app_id,
 const char* sender, const char* message, smartreply_reply_h** candidate_list, int* length)
 {
        int start = getTime();
-       
+
     ASSERT_NOT_NULL(message);
     ASSERT_NOT_NULL(candidate_list);
     ASSERT_NOT_NULL(length);
@@ -210,7 +209,7 @@ EXPORT_API int smartreply_service_get_nth_reply_message_with_type(smartreply_rep
                     smartreply_message_s * _message;
                     _message = (smartreply_message_s*)cursor->data;
                     int len =  strlen(_message->message);
-                                               
+
                                        string action_msg = _message->message;
                                        //cout << action_msg << endl;
                                        if (isAction(action_msg)) {
@@ -219,19 +218,18 @@ EXPORT_API int smartreply_service_get_nth_reply_message_with_type(smartreply_rep
                                                splitActionMessage(action_msg, atype, msg);
                                                //cout << atype << " " << msg << endl;
                        SMR_MEM_DATA_CPY(temp, msg.c_str(), msg.length(), char);
-                                               *reply_str = temp;                                               
+                                               *reply_str = temp;
                                                if (type != NULL) {
                                                        SMR_MEM_DATA_CPY(temp, atype.c_str(), atype.length(), char);
                                                        *type = temp;
-                                               }                                       
-                                       }
-                                       else {
+                                               }
+                                       } else {
                        SMR_MEM_DATA_CPY(temp, _message->message, len, char);
                                                *reply_str = temp;
                                                if (type != NULL) {
                                                        SMR_MEM_DATA_CPY(temp, "TEXT", strlen("TEXT"), char);
                                                        *type = temp;
-                                               }                                       
+                                               }
                                        }
                     return SMARTREPLY_ERROR_NONE;
             }
@@ -283,7 +281,7 @@ const char* sender, const char* received_message, const char* replied_message)
     return err;
 }
 
-EXPORT_API int smartreply_service_prepare_engine() 
+EXPORT_API int smartreply_service_prepare_engine()
 {
        int err = smr::request_handler::send_prepare_engine();
        return err;