Fix SAM tool violations (GlobalVariable) 32/240832/1
authorDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 12 Aug 2020 02:29:35 +0000 (11:29 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 12 Aug 2020 02:29:35 +0000 (11:29 +0900)
Change-Id: I1c590603b570d6dc9d0628ba22c597f073215a9e
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
20 files changed:
bt-api/bt-otp.c
bt-oal/bluez_hal/src/bt-hal-adapter-le.c
bt-oal/bluez_hal/src/bt-hal-dbus-common-utils.c
bt-oal/bluez_hal/src/bt-hal-gatt-client.c
bt-oal/bluez_hal/src/bt-hal-gatt-server.c
bt-oal/bluez_hal/src/bt-hal-gatt.c
bt-oal/bluez_hal/src/bt-hal-gatt.h
bt-oal/common/oal-event-dispatcher.c
bt-otp/bt-otpserver.c
bt-service/services/adapter/bt-service-core-adapter-le.c
bt-service/services/bt-request-handler.c
bt-service/services/bt-service-battery-monitor.c
bt-service/services/bt-service-event-receiver.c
bt-service/services/device/bt-service-core-device.c
bt-service/services/gatt/bt-service-gatt.c
bt-service/services/obex/bt-service-map-client.c
bt-service/services/obex/bt-service-opp-client.c
bt-service/services/obex/bt-service-pbap.c
bt-service/services/pan_nap/bt-service-pan-nap-event-receiver.c
bt-service/services/socket/bt-service-socket.c

index c748490..3a27e2a 100644 (file)
@@ -217,7 +217,7 @@ static const gchar otc_connection_xml[] =
 "  </interface>"
 "</node>";
 
-GDBusNodeInfo *otp_node_info = NULL;
+static GDBusNodeInfo *otp_node_info = NULL;
 static GDBusConnection *g_conn;
 static guint g_owner_id = 0;
 
index ac621d7..e0128fa 100644 (file)
@@ -100,7 +100,7 @@ typedef struct {
 #define BT_HAL_MULTI_ADV_UPDATE_EVT        5
 #define BT_HAL_LEGACY_ADV_STATUS           6
 
-handle_stack_msg gatt_le_event_cb;
+static handle_stack_msg gatt_le_event_cb;
 
 /* Advertising filter_policy */
 static int adv_filter_policy;
index 6d85936..adc2151 100644 (file)
@@ -67,10 +67,10 @@ struct avrcp_proxy {
        bt_bdaddr_t bd_addr;
 };
 
-struct avrcp_proxy proxy_array[BT_AUDIO_SOURCE_MAX];
+static struct avrcp_proxy proxy_array[BT_AUDIO_SOURCE_MAX];
 
 static guint bus_id;
-GDBusNodeInfo *new_conn_node;
+static GDBusNodeInfo *new_conn_node;
 static const gchar rfcomm_agent_xml[] =
 "<node name='/'>"
 " <interface name='org.bluez.Profile1'>"
index 863b4a7..4b677cc 100644 (file)
@@ -36,6 +36,7 @@
 #include "bt-hal-event-receiver.h"
 #include "bt-hal-adapter-le.h"
 
+#include "bt-hal-gatt.h"
 #include "bt-hal-gatt-client.h"
 #include "bt-hal-dbus-common-utils.h"
 #include "bt-hal-utils.h"
@@ -43,8 +44,7 @@
 /************************************************************************************
  **  Static variables
  ************************************************************************************/
-extern const btgatt_callbacks_t *bt_gatt_callbacks;
-#define CHECK_BTGATT_INIT() if (bt_gatt_callbacks == NULL)\
+#define CHECK_BTGATT_INIT() if (_bt_hal_gatt_interface_ready() == false)\
 {\
        ERR("%s: BTGATT not initialized", __FUNCTION__);\
        return BT_STATUS_NOT_READY;\
index 02fe240..1b36b19 100644 (file)
@@ -40,6 +40,7 @@
 #include "bt-hal-utils.h"
 #include "bt-hal-dbus-common-utils.h"
 
+#include "bt-hal-gatt.h"
 #include "bt-hal-adapter-le.h"
 #include "bt-hal-event-receiver.h"
 
@@ -58,11 +59,10 @@ static GDBusProxy *manager_gproxy = NULL;
  **  Static variables
  ************************************************************************************/
 extern const btgatt_callbacks_t *bt_gatt_callbacks;
-guint owner_id;
-GDBusConnection *g_conn = NULL;
-//GDBusConnection *conn = NULL;
-GDBusNodeInfo *manager_node_info = NULL;
-guint manager_id;
+static guint owner_id;
+static GDBusConnection *g_conn = NULL;
+static GDBusNodeInfo *manager_node_info = NULL;
+static guint manager_id;
 
 /* Global handles which needs to be incremented during each addition */
 static int gatt_service_handle = 10;
@@ -204,7 +204,7 @@ static int assigned_id = 0;
 
 static gboolean instance_id_used[BT_GATTS_MAX];
 
-#define CHECK_BTGATT_INIT() if (bt_gatt_callbacks == NULL)\
+#define CHECK_BTGATT_INIT() if (_bt_hal_gatt_interface_ready() == false)\
 {\
        ERR("%s: BTGATT not initialized", __FUNCTION__);\
        return BT_STATUS_NOT_READY;\
index 3032c79..5371784 100644 (file)
@@ -66,7 +66,7 @@ typedef struct {
 } bt_hal_le_adv_info_t;
 
 /****************************************** Global Variables ******************************************/
-const btgatt_callbacks_t *bt_gatt_callbacks = NULL;
+static const btgatt_callbacks_t *bt_gatt_callbacks = NULL;
 
 extern btgatt_client_interface_t btgatt_client_interface;
 extern btgatt_server_interface_t btgatt_server_interface;
@@ -91,7 +91,7 @@ static void __bt_hal_handle_gatt_client_service_changed(void *buf, uint16_t len)
 static void __bt_hal_handle_gatt_client_mtu_exchange_completed(void *buf, uint16_t len);
 /*****************************************************************************************************/
 
-static bool interface_ready(void)
+bool _bt_hal_gatt_interface_ready(void)
 {
        return bt_gatt_callbacks != NULL;
 }
@@ -294,7 +294,7 @@ static void __bt_hal_gatt_events(int message, void *buf, uint16_t len)
 {
        DBG("GATT event 0x%x", message);
        /* Check if GATT interface is Ready */
-       if (!interface_ready())
+       if (!_bt_hal_gatt_interface_ready())
                return;
 
        switch (message) {
index b27271e..888ed6c 100644 (file)
@@ -29,6 +29,8 @@
 #include <stdio.h>
 #include <hardware/bt_gatt.h>
 
+bool _bt_hal_gatt_interface_ready(void);
+
 btgatt_interface_t *bt_get_gatt_interface(void);
 void bt_hal_release_pending_adv_ind_list(void);
 
index 018c8a5..daf4cae 100644 (file)
@@ -40,7 +40,7 @@ typedef struct {
 
 static GMainContext *event_thread_context;
 static oal_event_callback event_handler_cb;
-GMainLoop *event_loop;
+static GMainLoop *event_loop;
 
 void _bt_event_dispatcher_deinit()
 {
index 76a8d9e..903caee 100644 (file)
 #define BT_DBG(fmt, arg...) SLOGD(fmt, ##arg)
 
 /* OTP object paths */
-char *otp_obj_path = NULL;
-char *otp_feature_obj_path = NULL;
-char *otp_object_name_obj_path = NULL;
-char *otp_object_type_obj_path = NULL;
-char *otp_object_size_obj_path = NULL;
-char *otp_object_first_created_obj_path = NULL;
-char *otp_object_last_modified_obj_path = NULL;
-char *otp_object_id_obj_path = NULL;
-char *otp_object_prop_obj_path = NULL;
-char *otp_oacp_obj_path = NULL;
-char *otp_olcp_obj_path = NULL;
-char *otp_oacp_desc_obj_path = NULL;
-char *otp_olcp_desc_obj_path = NULL;
+static char *otp_obj_path = NULL;
+static char *otp_feature_obj_path = NULL;
+static char *otp_object_name_obj_path = NULL;
+static char *otp_object_type_obj_path = NULL;
+static char *otp_object_size_obj_path = NULL;
+static char *otp_object_first_created_obj_path = NULL;
+static char *otp_object_last_modified_obj_path = NULL;
+static char *otp_object_id_obj_path = NULL;
+static char *otp_object_prop_obj_path = NULL;
+static char *otp_oacp_obj_path = NULL;
+static char *otp_olcp_obj_path = NULL;
+static char *otp_oacp_desc_obj_path = NULL;
+static char *otp_olcp_desc_obj_path = NULL;
 
 static GMainLoop *main_loop;
-GDBusNodeInfo *otp_node_info = NULL;
+static GDBusNodeInfo *otp_node_info = NULL;
 static GDBusConnection *conn;
 static GDBusConnection *g_conn;
 
@@ -113,13 +113,13 @@ static guint curr_obj_index;
 static int adv_handle = 0;
 static gboolean OACP_indicate = FALSE;
 static gboolean OLCP_indicate = FALSE;
-char *directory = NULL;
-gboolean mutiple_obj_support = false;
+static char *directory = NULL;
+static gboolean mutiple_obj_support = false;
 static gboolean otc_connection_status = FALSE;
-struct oacp_operation *oacp_op = NULL;
-unsigned int timeout_id;
-unsigned int oacp_create_timeout_id;
-uint64_t curr_obj_id, prev_obj_id;
+static struct oacp_operation *oacp_op = NULL;
+static unsigned int timeout_id;
+static unsigned int oacp_create_timeout_id;
+static uint64_t curr_obj_id, prev_obj_id;
 static gboolean oacp_create = FALSE;
 
 static const gchar otp_introspection_xml[] =
index 5cc0561..c7e5d1b 100644 (file)
@@ -100,7 +100,7 @@ typedef struct {
        gboolean is_scanning;
 } bt_adapter_le_scanner_t;
 
-GSList *scanner_list = NULL;
+static GSList *scanner_list = NULL;
 static gboolean is_le_set_scan_parameter = FALSE;
 static gboolean is_le_scanning = FALSE;
 static gboolean scan_filter_enabled = FALSE;
index c57e89b..25de426 100644 (file)
@@ -72,7 +72,7 @@
 #include "bt-service-ipsp.h"
 #endif
 /* For maintaining Application Sync API call requests */
-GSList *invocation_list = NULL;
+static GSList *invocation_list = NULL;
 
 static GDBusConnection *bt_service_conn;
 static guint owner_id = 0;
@@ -81,7 +81,7 @@ static gboolean is_le_intended = FALSE;
 
 static cynara *p_cynara;
 static cynara_configuration *conf;
-const char *requester_unique_creds = NULL;
+static const char *requester_unique_creds = NULL;
 
 static const gchar bt_service_introspection_xml[] =
 "<node name='/org/projectx/bt_service'>"
index d5e9c67..4770c16 100644 (file)
@@ -57,7 +57,7 @@ typedef struct {
         void *data;
 } bt_service_oal_event_data_t;
 
-_bt_battery_data_t *current_session_data = NULL;
+static _bt_battery_data_t *current_session_data = NULL;
 
 static void __bt_bm_add_prev_time(uint32_t scan_time);
 static int __bt_start_session_time(void);
index b4f634e..8289a3e 100644 (file)
@@ -36,22 +36,22 @@ typedef struct {
        void *data;
 } bt_service_oal_event_data_t;
 
-_bt_service_event_handler_callback adapter_cb;
-_bt_service_event_handler_callback device_cb;
-_bt_service_event_handler_callback hid_cb;
-_bt_service_event_handler_callback hid_device_cb;
-_bt_service_event_handler_callback socket_cb;
-_bt_service_event_handler_callback audio_event_cb;
-_bt_service_event_handler_callback a2dp_source_cb;
-_bt_service_event_handler_callback a2dp_sink_cb;
-_bt_service_event_handler_callback ag_cb;
-_bt_service_event_handler_callback hdp_cb;
-_bt_service_event_handler_callback avrcp_ctrl_cb;
-_bt_service_event_handler_callback avrcp_cb;
-_bt_service_event_handler_callback adapter_le_cb;
-_bt_service_event_handler_callback adapter_gatt_cb;
-_bt_service_event_handler_callback hf_client_cb;
-_bt_service_event_handler_callback mesh_cb;
+static _bt_service_event_handler_callback adapter_cb;
+static _bt_service_event_handler_callback device_cb;
+static _bt_service_event_handler_callback hid_cb;
+static _bt_service_event_handler_callback hid_device_cb;
+static _bt_service_event_handler_callback socket_cb;
+static _bt_service_event_handler_callback audio_event_cb;
+static _bt_service_event_handler_callback a2dp_source_cb;
+static _bt_service_event_handler_callback a2dp_sink_cb;
+static _bt_service_event_handler_callback ag_cb;
+static _bt_service_event_handler_callback hdp_cb;
+static _bt_service_event_handler_callback avrcp_ctrl_cb;
+static _bt_service_event_handler_callback avrcp_cb;
+static _bt_service_event_handler_callback adapter_le_cb;
+static _bt_service_event_handler_callback adapter_gatt_cb;
+static _bt_service_event_handler_callback hf_client_cb;
+static _bt_service_event_handler_callback mesh_cb;
 
 void _bt_service_register_event_handler_callback(
                bt_service_module_t module, _bt_service_event_handler_callback cb)
index 370de79..32b43c7 100644 (file)
@@ -113,12 +113,12 @@ typedef struct {
 } bt_incoming_bond_data_t;
 
 /* Bonding and Pairing Informations */
-bt_bond_data_t *trigger_bond_info;
-bt_bond_data_t *trigger_unbond_info;
-bt_pairing_data_t *trigger_pairing_info;
-bt_service_search_info_data_t *service_search_info;
+static bt_bond_data_t *trigger_bond_info;
+static bt_bond_data_t *trigger_unbond_info;
+static bt_pairing_data_t *trigger_pairing_info;
+static bt_service_search_info_data_t *service_search_info;
 
-bt_incoming_bond_data_t *incoming_bond_info;
+static bt_incoming_bond_data_t *incoming_bond_info;
 
 typedef enum {
        BT_DEVICE_BOND_STATE_NONE,
index cadf976..9ed8518 100644 (file)
@@ -69,7 +69,7 @@
 #define BDADDR_ANY   (&(bluetooth_device_address_t) {{0, 0, 0, 0, 0, 0} })
 
 #ifdef TIZEN_GATT_CLIENT
-char uuid_list[NUM_UUID][BT_UUID_STRING_MAX] = {"0000b00b-0000-0000-f065-080080fa49b5", /* Used by BLEAPP */
+static char uuid_list[NUM_UUID][BT_UUID_STRING_MAX] = {"0000b00b-0000-0000-f065-080080fa49b5", /* Used by BLEAPP */
        "0000b00b-1111-1111-0123-456789ab0cd2", /* Used by BLEAPP */
        "0000b00b-2222-1111-0123-456789ab0cd2",
        "0000b00b-3333-1111-0123-456789ab0cd2",
@@ -90,7 +90,7 @@ char uuid_list[NUM_UUID][BT_UUID_STRING_MAX] = {"0000b00b-0000-0000-f065-080080f
        "0000b00c-2222-1111-0123-456789ab0cd2",
        "0000b00c-3333-1111-0123-456789ab0cd2"};
 #else
-char uuid_list[NUM_UUID][BT_UUID_STRING_MAX] = {"0000b00b-0000-0000-f065-080080fa49b5", /* Used by BLEAPP */
+static char uuid_list[NUM_UUID][BT_UUID_STRING_MAX] = {"0000b00b-0000-0000-f065-080080fa49b5", /* Used by BLEAPP */
        "0000b00b-1111-1111-0123-456789ab0cd2", /* Used by BLEAPP */
        "0000b00b-2222-1111-0123-456789ab0cd2",
        "0000b00b-3333-1111-0123-456789ab0cd2",
index 326b2e8..0547197 100644 (file)
@@ -46,7 +46,7 @@ typedef struct {
 
 static GSList *transfer_list = NULL;
 
-bt_session_info_t *session_info;
+static bt_session_info_t *session_info;
 
 static void __bt_free_session_info(bt_session_info_t *info)
 {
index 4a96a08..8df2e3c 100755 (executable)
@@ -35,7 +35,7 @@
 #define BT_MIME_TYPE_MAX_LEN   20
 
 static GSList *transfer_list = NULL;
-bt_sending_info_t *sending_info;
+static bt_sending_info_t *sending_info;
 static int file_offset = 0;
 
 #define DBUS_TIEMOUT 20 * 1000  /* 20 Seconds */
index c5341f5..97e5f66 100644 (file)
@@ -44,7 +44,7 @@
 #define PBAP_DEFAULT_DOWNLAOD_PATH "/opt/usr/home/owner/media/Downloads"
 #define PBAP_DEFAULT_FILE_NAME "pb.vcf"
 
-char *FIELDS[] = {
+static char *FIELDS[] = {
                "VERSION",
                "FN",
                "N",
@@ -76,12 +76,12 @@ char *FIELDS[] = {
                "X-IRMC-CALL-DATETIME", /* 29 */
 };
 
-char *SOURCE[] = {
+static char *SOURCE[] = {
                "int",  //Phone memory
                "sim"   // SIM memory
 };
 
-char *TYPE[] = {
+static char *TYPE[] = {
                "pb",   //Phonebook for the saved contacts
                "ich",  //Incoming call history
                "och",  //Outgoing call history
@@ -89,18 +89,18 @@ char *TYPE[] = {
                "cch",  //Combined Call History cch = ich + och + mch
 };
 
-char *FORMAT[] = {
+static char *FORMAT[] = {
                "vcard21",      // vCard Format 2.1 (Default)
                "vcard30",      // vCard Format 3.0
 };
 
-char *ORDER[] = {
+static char *ORDER[] = {
                "indexed",              // Index (default)
                "alphanumeric", // Alphanumeric
                "phonetic",             // Phonetic
 };
 
-char *SEARCH_FIELD[] = {
+static char *SEARCH_FIELD[] = {
                "name",         // Search by Name(default)
                "number",       // Search by Phone Number
                "sound",        // Search by phonetic sound
index 3d6078b..76e1c80 100644 (file)
@@ -24,7 +24,7 @@
 #include "bt-service-event.h"
 //#include "bt-service-device.h"
 
-guint nap_connected_device_count = 0;
+static guint nap_connected_device_count = 0;
 static GDBusConnection *manager_conn;
 
 void bt_set_device_values(gboolean connected, int state)
index f89e941..444c757 100644 (file)
@@ -44,7 +44,7 @@ typedef struct {
        bt_socket_client_conn_cb conn_cb;
 } bt_socket_info_t;
 
-bt_socket_info_t *pending_conn_info;
+static bt_socket_info_t *pending_conn_info;
 
 /* Function to handle socket disconnection */
 void __handle_socket_disconnected(event_socket_client_conn_t *client_info)