fix build failure 21/182221/1
authorJeonghoon Park <jh1979.park@samsung.com>
Thu, 21 Jun 2018 08:48:25 +0000 (17:48 +0900)
committerJeonghoon Park <jh1979.park@samsung.com>
Thu, 21 Jun 2018 08:48:25 +0000 (17:48 +0900)
Change-Id: Id73b55f89105bb8eeb895b0d521d45f7eff58c20

lib/things-service/CMakeLists.txt
lib/things-service/src/things-service.c

index 17291b8..8581190 100644 (file)
@@ -11,6 +11,7 @@ pkg_check_modules(LIB_TTS_PKGS REQUIRED
        gio-unix-2.0
        capi-appfw-app-common
        dlog
+       json-c
 )
 
 FOREACH (flag ${LIB_TTS_PKGS_CFLAGS})
index 8771cae..4835eb3 100644 (file)
@@ -21,6 +21,7 @@
 #include <gio/gio.h>
 #include <gio/gunixsocketaddress.h>
 #include <app_common.h>
+#include <json.h>
 #include "log-private.h"
 #include "things-service.h"
 #include "common-app-inf.h"
@@ -76,9 +77,9 @@ __add_timebased_int_to_json_object(gpointer data, gpointer user_data)
        ret_if(!a_obj);
 
        obj = json_object_new_object();
-       retv_if(!obj);
+       ret_if(!obj);
 
-       time_o = json_object_new_int64(tb_int->time);
+       time_o = json_object_new_int64(tb_int->i_time);
        goto_if(!time_o, ERROR);
        json_object_object_add(obj, "x", time_o);
 
@@ -103,13 +104,13 @@ __add_timebased_double_to_json_object(gpointer data, gpointer user_data)
        struct json_object *value_o = NULL;
        struct json_object *time_o = NULL;
 
-       ret_if(!tb_int);
+       ret_if(!tb_double);
        ret_if(!a_obj);
 
        obj = json_object_new_object();
-       retv_if(!obj, NULL);
+       ret_if(!obj);
 
-       time_o = json_object_new_int64(tb_double->time);
+       time_o = json_object_new_int64(tb_double->i_time);
        goto_if(!time_o, ERROR);
        json_object_object_add(obj, "x", time_o);
 
@@ -131,8 +132,6 @@ static char *__timebased_data_to_json(timebased_data *tb_data)
        struct json_object *obj = NULL;
        struct json_object *a_obj = NULL;
        char *json_str = NULL;
-       int i = 0;
-       GList *temp_l = NULL;
 
        retv_if(!tb_data, NULL);
        retvm_if(!((tb_data->type == TS_VALUE_TYPE_INT) ||
@@ -157,7 +156,7 @@ static char *__timebased_data_to_json(timebased_data *tb_data)
                break;
        default:
                _E("invalid type [%d]", tb_data->type);
-               goto ERROR:
+               goto ERROR;
                break;
        }
 
@@ -538,11 +537,7 @@ void thing_service_timebased_data_free(timebased_data *tb_data)
 {
        ret_if(!tb_data);
 
-       t_data = g_try_malloc0(sizeof(timebased_data));
-       if (!t_data)
-               return NULL;
-
-       if (t_data->v_list)
+       if (tb_data->v_list)
                g_list_free_full(tb_data->v_list, __timebase_value_free);
 
        g_free(tb_data);