Fix svace 2.2 version issues
[platform/core/connectivity/bluetooth-frwk.git] / test / bluetooth-frwk-test.c
index efbfb61..7cdc870 100644 (file)
@@ -26,6 +26,7 @@
 #include <dbus/dbus-glib.h>
 #include <pthread.h>
 #include <dbus/dbus.h>
+#include <stdint.h>
 
 #include "bluetooth-api.h"
 #include "bluetooth-hid-api.h"
@@ -274,7 +275,14 @@ int test_input_callback(void *data)
        int ret = 0;
        int test_id;
 
+#ifdef ARCH64
+       test_id = find_tc_number((uintptr_t)data);
+#else
        test_id = find_tc_number((int)data);
+#endif
+       if (test_id == -1)
+               return 0;
+
        TC_PRT("TC : %s[%d]", tc_table[test_id].tc_name, tc_table[test_id].tc_code);
 
        switch (tc_table[test_id].tc_code) {
@@ -284,7 +292,7 @@ int test_input_callback(void *data)
                break;
 
        case 1:
-               bluetooth_register_callback(bt_event_callback, NULL);
+               ret = bluetooth_register_callback(bt_event_callback, NULL);
                if (ret < 0) {
                        TC_PRT("%s failed with [0x%04x]", tc_table[0].tc_name, ret);
                        tc_result(TC_FAIL, 1);
@@ -292,7 +300,7 @@ int test_input_callback(void *data)
                break;
 
        case 2:
-               bluetooth_unregister_callback();
+               ret = bluetooth_unregister_callback();
                if (ret < 0) {
                        TC_PRT("%s failed with [0x%04x]", tc_table[1].tc_name, ret);
                        tc_result(TC_FAIL, 1);
@@ -1749,9 +1757,13 @@ void bt_event_callback(int event, bluetooth_event_param_t* param, void *user_dat
 
 static gboolean key_event_cb(GIOChannel * chan, GIOCondition cond , gpointer data)
 {
-       char buf[10] = {0};
+       char buf[49] = {0};
 
+#ifdef ARCH64
+       unsigned long len = 0;
+#else
        unsigned int len = 0;
+#endif
        int test_id;
        memset(buf, 0, sizeof(buf));
 
@@ -1766,8 +1778,11 @@ static gboolean key_event_cb(GIOChannel * chan, GIOCondition cond , gpointer dat
 
        test_id = atoi(buf);
 
-       if (test_id)
-               g_idle_add(test_input_callback, (void*)test_id);
+#ifdef ARCH64
+       g_idle_add(test_input_callback, (void *)(uintptr_t)test_id);
+#else
+       g_idle_add(test_input_callback, (void *)test_id);
+#endif
 
        return TRUE;
 }