Fix svace 2.2 version issues
[platform/core/connectivity/bluetooth-frwk.git] / test / bluetooth-frwk-test.c
index 643679b..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"
@@ -40,7 +41,7 @@ bluetooth_device_address_t searched_device = { {0} };
 #define DISCOVER_TIMEOUT 20
 #define DISCOVER_CANCEL_INTERVAL 3
 
-#define PRT(format, args...) printf("%s:%d() "format, __FUNCTION__, __LINE__, ##args)
+#define PRT(format, args...) printf("%s:() "format, __FUNCTION__, ##args)
 #define TC_PRT(format, args...) PRT(format"\n", ##args)
 
 #define TC_PASS 1
@@ -232,8 +233,12 @@ tc_table_t tc_table[] = {
 
 };
 
+#if 0
 #define tc_result(success, tc_index) \
        TC_PRT("Test case [%d - %s] %s", tc_table[tc_index].tc_code, tc_table[tc_index].tc_name, ((success == TC_PASS) ? "Success" : "Failed"));
+#else
+#define tc_result(success, tc_index)
+#endif
 
 bluetooth_device_info_t bond_dev;
 int is_bond_device = FALSE;
@@ -270,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) {
@@ -280,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);
@@ -288,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);
@@ -1745,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));
 
@@ -1762,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;
 }