X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=bt-oal%2Fbluez_hal%2Fsrc%2Fbt-hal-utils.c;h=9a4753ffcbbc26334481d4a9d1686ac91f9d4a1e;hb=6672163e49694af69c93b50f5c284cb1bd5c52a8;hp=10ef16ee4041d0d879376ac0e676043150661ddd;hpb=a695ed44017c1888a021ad1fbc729000f4e5a9dd;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git diff --git a/bt-oal/bluez_hal/src/bt-hal-utils.c b/bt-oal/bluez_hal/src/bt-hal-utils.c index 10ef16e..9a4753f 100644 --- a/bt-oal/bluez_hal/src/bt-hal-utils.c +++ b/bt-oal/bluez_hal/src/bt-hal-utils.c @@ -56,9 +56,10 @@ const char *bt_uuid_t2str(const uint8_t *uuid, char *buf) buf[i * 2 + shift] = '-'; shift++; } - snprintf(buf + i * 2 + shift, (HAL_UUID_LEN -(i * 2 + shift)), "%02x", uuid[i]); + snprintf(buf + i * 2 + shift, (MAX_UUID_STR_LEN -(i * 2 + shift)), "%02x", uuid[i]); } + ERR("uuid %s", buf); return buf; } @@ -518,16 +519,16 @@ static void bonded_devices2string(char *str, void *prop, int prop_len) int count = prop_len / sizeof(bt_bdaddr_t); bt_bdaddr_t *addr = prop; - strncat(str, "{", strlen("{")); + strncat(str, "{", MAX_STR_BUF_LEN - strlen(str) - 1); while (count--) { strncat(str, bdaddr2str(addr), MAX_ADDR_STR_LEN); if (count) - strncat(str, ", ", strlen(", ")); + strncat(str, ", ", MAX_STR_BUF_LEN - strlen(str) - 1); addr++; } - strncat(str, "}", strlen("}")); + strncat(str, "}", MAX_STR_BUF_LEN - strlen(str) - 1); } static void uuids2string(char *str, void *prop, int prop_len) @@ -535,16 +536,16 @@ static void uuids2string(char *str, void *prop, int prop_len) int count = prop_len / sizeof(bt_uuid_t); bt_uuid_t *uuid = prop; - strncat(str, "{", strlen("{")); + strncat(str, "{", MAX_STR_BUF_LEN - strlen(str) - 1); while (count--) { strncat(str, btuuid2str(uuid->uu), MAX_UUID_STR_LEN); if (count) - strncat(str, ", ", strlen(", ")); + strncat(str, ", ", MAX_STR_BUF_LEN - strlen(str) - 1); uuid++; } - strncat(str, "}", strlen("}")); + strncat(str, "}", MAX_STR_BUF_LEN - strlen(str) - 1); } const char* bt_property_type_t2str(bt_property_type_t prop_type) @@ -721,12 +722,12 @@ static void local_le_feat2string(char *str, const bt_local_le_features_t *f, int const char *btproperty2str(const bt_property_t *property) { bt_service_record_t *rec; - static char buf[4096]; - int buf_len = 4096; + static char buf[MAX_STR_BUF_LEN]; + int buf_len = MAX_STR_BUF_LEN; int ret; char *p; - memset(buf, 0x00, 4096); + memset(buf, 0x00, MAX_STR_BUF_LEN); ret = snprintf(buf, buf_len, "type=%s len=%d val=", bt_property_type_t2str(property->type), property->len); @@ -837,8 +838,6 @@ bt_service_id_t _bt_convert_uuid_string_to_service_id(const char *uuid) { bt_service_id_t service_id = BT_RES_SERVICE_ID; - DBG("+"); - if (!strcasecmp(uuid, BT_HAL_HFP_AUDIO_GATEWAY_UUID)) service_id = BT_HFP_SERVICE_ID; else if (!strcasecmp(uuid, BT_HAL_HSP_AUDIO_GATEWAY_UUID)) @@ -887,7 +886,6 @@ bt_service_id_t _bt_convert_uuid_string_to_service_id(const char *uuid) ERR("Unknwon Service uuid, return BT_RES_SERVICE_ID"); DBG("service_id = [%d]", service_id); - DBG("-"); return service_id; } @@ -947,7 +945,7 @@ char *_bt_convert_service_id_to_uuid_string(bt_service_id_t service_id) return g_strdup(BT_HAL_IOTIVITY_UUID); #endif default: - ERR("Unknwon Service id: %d, return NULL"); + ERR("Unknwon Service id: %d, return NULL", service_id); } DBG("-");