GATT Test Tool: [Klocwork] Fixing KW issue.
This change fixes all reported KW issue related to gatt
test tool.
Change-Id: Ic51c919cd7139c2123121a432119211624144ccd
CRs-Fixed: 2419845
diff --git a/certification_tools/blegatt_test/gatt_test.cpp b/certification_tools/blegatt_test/gatt_test.cpp
index 2c42333..383ad5f 100644
--- a/certification_tools/blegatt_test/gatt_test.cpp
+++ b/certification_tools/blegatt_test/gatt_test.cpp
@@ -457,13 +457,13 @@
std::vector<btgatt_db_element_t> service1;
//1st service
- btgatt_db_element_t svc1;
+ btgatt_db_element_t svc1 = {0};
svc1.uuid = Uuid::FromString(IMMEDIATE_ALERT_UUID, &is_valid);
svc1.type = BTGATT_DB_PRIMARY_SERVICE;
service1.push_back(svc1);
//1st char
- btgatt_db_element_t char1;
+ btgatt_db_element_t char1 = {0};
char1.uuid = Uuid::FromString(ALERT_LEVEL_UUID1, &is_valid);
char1.type = BTGATT_DB_CHARACTERISTIC;
char1.properties = 58;
@@ -472,7 +472,7 @@
service1.push_back(char1);
//1st desc
- btgatt_db_element_t desc1;
+ btgatt_db_element_t desc1 = {0};
desc1.uuid = Uuid::FromString(ClientCharConfigUUID, &is_valid);
desc1.type = BTGATT_DB_DESCRIPTOR;
desc1.permissions = 17;
@@ -480,7 +480,7 @@
service1.push_back(desc1);
//2nd char
- btgatt_db_element_t char2;
+ btgatt_db_element_t char2 = {0};
char2.uuid = Uuid::FromString(ALERT_LEVEL_UUID2, &is_valid);
char2.type = BTGATT_DB_CHARACTERISTIC;
char2.properties = 58;
@@ -489,7 +489,7 @@
service1.push_back(char2);
//2nd desc
- btgatt_db_element_t desc2;
+ btgatt_db_element_t desc2 = {0};
desc2.uuid = Uuid::FromString(ClientCharConfigUUID, &is_valid);
desc2.type = BTGATT_DB_DESCRIPTOR;
desc2.permissions = 34;
@@ -498,7 +498,7 @@
//3rd char
- btgatt_db_element_t char3;
+ btgatt_db_element_t char3 = {0};
char3.uuid = Uuid::FromString(ALERT_LEVEL_UUID3, &is_valid);
char3.type = BTGATT_DB_CHARACTERISTIC;
char3.properties = 58;
@@ -507,7 +507,7 @@
service1.push_back(char3);
//3rd desc
- btgatt_db_element_t desc3;
+ btgatt_db_element_t desc3 = {0};
desc3.uuid = Uuid::FromString(ClientCharConfigUUID, &is_valid);
desc3.type = BTGATT_DB_DESCRIPTOR;
desc3.permissions = 68;
@@ -516,7 +516,7 @@
//4th char
- btgatt_db_element_t char4;
+ btgatt_db_element_t char4 = {0};
char4.uuid = Uuid::FromString(AUTHENTICATION_LEVEL_UUID1, &is_valid);
char4.type = BTGATT_DB_CHARACTERISTIC;
char4.properties = 58;
@@ -525,7 +525,7 @@
service1.push_back(char4);
//4th desc
- btgatt_db_element_t desc4;
+ btgatt_db_element_t desc4 = {0};
desc4.uuid = Uuid::FromString(AUTHENTICATION_LEVEL_DESC_UUID1, &is_valid);
desc4.type = BTGATT_DB_DESCRIPTOR;
desc4.permissions = 34;
@@ -534,7 +534,7 @@
//5th char
- btgatt_db_element_t char5;
+ btgatt_db_element_t char5 = {0};
char5.uuid = Uuid::FromString(AUTHENTICATION_LEVEL_UUID2, &is_valid);
char5.type = BTGATT_DB_CHARACTERISTIC;
char5.properties = 58;
@@ -543,7 +543,7 @@
service1.push_back(char5);
//5th desc
- btgatt_db_element_t desc5;
+ btgatt_db_element_t desc5 = {0};
desc5.uuid = Uuid::FromString(AUTHENTICATION_LEVEL_DESC_UUID2, &is_valid);
desc5.type = BTGATT_DB_DESCRIPTOR;
desc5.permissions = 68;
@@ -551,7 +551,7 @@
service1.push_back(desc5);
//6th char
- btgatt_db_element_t char6;
+ btgatt_db_element_t char6 = {0};
char6.uuid = Uuid::FromString(ALERT_LEVEL_UUID4, &is_valid);
char6.type = BTGATT_DB_CHARACTERISTIC;
char6.properties = 4;
@@ -560,7 +560,7 @@
service1.push_back(char6);
//6th desc
- btgatt_db_element_t desc6;
+ btgatt_db_element_t desc6 = {0};
desc6.uuid = Uuid::FromString(DISC_LEVEL_UUID1, &is_valid);
desc6.type = BTGATT_DB_DESCRIPTOR;
desc6.permissions = 16;
@@ -568,7 +568,7 @@
service1.push_back(desc6);
//7th char
- btgatt_db_element_t char7;
+ btgatt_db_element_t char7 = {0};
char7.uuid = Uuid::FromString(ALERT_LEVEL_UUID5, &is_valid);
char7.type = BTGATT_DB_CHARACTERISTIC;
char7.properties = 114;
@@ -577,7 +577,7 @@
service1.push_back(char7);
//7th desc
- btgatt_db_element_t desc7;
+ btgatt_db_element_t desc7 = {0};
desc7.uuid = Uuid::FromString(ClientCharConfigUUID, &is_valid);
desc7.type = BTGATT_DB_DESCRIPTOR;
desc7.permissions = 129;
@@ -585,7 +585,7 @@
service1.push_back(desc7);
//8th char
- btgatt_db_element_t char8;
+ btgatt_db_element_t char8 = {0};
char8.uuid = Uuid::FromString(ALERT_LEVEL_UUID6, &is_valid);
char8.type = BTGATT_DB_CHARACTERISTIC;
char8.properties = 66;
@@ -594,7 +594,7 @@
service1.push_back(char8);
//8th desc
- btgatt_db_element_t desc8;
+ btgatt_db_element_t desc8 = {0};
desc8.uuid = Uuid::FromString(DISC_LEVEL_UUID2, &is_valid);
desc8.type = BTGATT_DB_DESCRIPTOR;
desc8.permissions = 129;
@@ -602,7 +602,7 @@
service1.push_back(desc8);
//9th char
- btgatt_db_element_t char9;
+ btgatt_db_element_t char9 = {0};
char9.uuid = Uuid::FromString(ALERT_LEVEL_WRITENORESPONSEWITHREADABLE2, &is_valid);
char9.type = BTGATT_DB_CHARACTERISTIC;
char9.properties = 6;
@@ -611,7 +611,7 @@
service1.push_back(char9);
//9th desc
- btgatt_db_element_t desc9;
+ btgatt_db_element_t desc9 = {0};
desc9.uuid = Uuid::FromString(DISC_LEVEL_UUID7, &is_valid);
desc9.type = BTGATT_DB_DESCRIPTOR;
desc9.permissions = 17;
@@ -619,7 +619,7 @@
service1.push_back(desc9);
//10th char
- btgatt_db_element_t char10;
+ btgatt_db_element_t char10 = {0};
char10.uuid = Uuid::FromString(ALERT_LEVEL_UUID18, &is_valid);
char10.type = BTGATT_DB_CHARACTERISTIC;
char10.properties = 58;
@@ -628,7 +628,7 @@
service1.push_back(char10);
//10th desc
- btgatt_db_element_t desc10;
+ btgatt_db_element_t desc10 = {0};
desc10.uuid = Uuid::FromString(ClientCharConfigUUID, &is_valid);
desc10.type = BTGATT_DB_DESCRIPTOR;
desc10.permissions = 17;
@@ -636,7 +636,7 @@
service1.push_back(desc10);
//11th char
- btgatt_db_element_t char11;
+ btgatt_db_element_t char11 = {0};
char11.uuid = Uuid::FromString(ALERT_LEVEL_UUID19, &is_valid);
char11.type = BTGATT_DB_CHARACTERISTIC;
char11.properties = 58;
@@ -645,7 +645,7 @@
service1.push_back(char11);
//11th desc
- btgatt_db_element_t desc11;
+ btgatt_db_element_t desc11 = {0};
desc11.uuid = Uuid::FromString(ClientCharConfigUUID, &is_valid);
desc11.type = BTGATT_DB_DESCRIPTOR;
desc11.permissions = 17;
@@ -659,7 +659,7 @@
//Second Service - longvalue service
std::vector<btgatt_db_element_t> service2;
//2nd service
- btgatt_db_element_t svc2;
+ btgatt_db_element_t svc2 = {0};
svc2.uuid = Uuid::FromString(IMMEDIATE_ALERT_UUID1, &is_valid);
svc2.type = BTGATT_DB_PRIMARY_SERVICE;
service2.push_back(svc2);
@@ -814,7 +814,7 @@
//3rd service
std::vector<btgatt_db_element_t> service3;
- btgatt_db_element_t svc3;
+ btgatt_db_element_t svc3 = {0};
svc3.uuid = Uuid::FromString(IMMEDIATE_ALERT_UUID2, &is_valid);
svc3.type = BTGATT_DB_PRIMARY_SERVICE;
service3.push_back(svc3);
@@ -860,7 +860,7 @@
//4th service with no value set
std::vector<btgatt_db_element_t> service4;
- btgatt_db_element_t svc4;
+ btgatt_db_element_t svc4 = {0};
svc4.uuid = Uuid::FromString(IMMEDIATE_ALERT_UUID3, &is_valid);
svc4.type = BTGATT_DB_PRIMARY_SERVICE;
service4.push_back(svc4);
@@ -881,7 +881,7 @@
//5th service will all kinds of descriptors
std::vector<btgatt_db_element_t> service5;
- btgatt_db_element_t svc5;
+ btgatt_db_element_t svc5 = {0};
svc5.uuid = Uuid::FromString(IMMEDIATE_ALERT_UUID6, &is_valid);
svc5.type = BTGATT_DB_PRIMARY_SERVICE;
service5.push_back(svc5);
@@ -971,7 +971,7 @@
service5.push_back(desc11);
//12th desc
- btgatt_db_element_t desc12;
+ btgatt_db_element_t desc12 = {0};
desc12.uuid = Uuid::FromString(CharacteristicAggregateFormat, &is_valid);
desc12.type = BTGATT_DB_DESCRIPTOR;
desc12.permissions = 17;
@@ -1002,7 +1002,7 @@
btgatt_response_t gatt_resp;
int status = BT_STATUS_SUCCESS;
std::vector<uint8_t> cccd_val;
- uint8_t val[2];
+ uint8_t val[2] = {};
gatt_resp.handle = attr_handle;
gatt_resp.attr_value.handle = attr_handle;
gatt_resp.attr_value.offset = offset;
@@ -1062,7 +1062,7 @@
printf("%s:: conn_id=%d, trans_id=%d, attr_handle=%d \n", __FUNCTION__, conn_id, trans_id, attr_handle);
bt_status_t Ret;
int status = BT_STATUS_SUCCESS;
- uint8_t cccd_val[2];
+ uint8_t cccd_val[2] = {};
btgatt_response_t gatt_resp;
gatt_resp.handle = attr_handle;
gatt_resp.attr_value.handle = attr_handle;
@@ -2994,13 +2994,13 @@
std::vector<btgatt_db_element_t> service;
//1st service
- btgatt_db_element_t svc1;
+ btgatt_db_element_t svc1 = {0};
svc1.uuid = Uuid::FromString("00001800-0000-1000-8000-00805f9b34fb", &is_valid);//00001800-0000-1000-8000-00805f9b34fb
svc1.type = BTGATT_DB_PRIMARY_SERVICE;
service.push_back(svc1);
//2nd service
- btgatt_db_element_t svc2;
+ btgatt_db_element_t svc2 = {0};
svc2.uuid = Uuid::FromString("00001801-0000-1000-8000-00805f9b34fb", &is_valid);//00001801-0000-1000-8000-00805f9b34fb
svc2.type = BTGATT_DB_PRIMARY_SERVICE;
service.push_back(svc2);