Fix the Svace issue 54/67254/2 accepted/tizen/common/20160426.143644 submit/tizen/20160426.063339
authorHyuk Lee <hyuk0512.lee@samsung.com>
Tue, 26 Apr 2016 05:07:18 +0000 (14:07 +0900)
committerHyuk Lee <hyuk0512.lee@samsung.com>
Tue, 26 Apr 2016 06:29:37 +0000 (15:29 +0900)
Change-Id: I8eb891cbe03c28e97fee8b22177b740a211d28f6
Signed-off-by: Hyuk Lee <hyuk0512.lee@samsung.com>
src/bluetooth-gatt.c

index c7d8b669604339312a4c649b0f3127d7f39dbf31..80af36189e7e3abd30ca6c654edd45679ad5d856 100644 (file)
@@ -1150,6 +1150,9 @@ int bt_gatt_set_int_value(bt_gatt_h gatt_handle, bt_data_type_int_e type,
        switch (type) {
        case BT_DATA_TYPE_SINT8:
                value = __convert_int_to_signed_bits(value, 8);
+               if (*val)
+                       (*val)[idx] = (char)(value & 0xFF);
+               break;
        case BT_DATA_TYPE_UINT8:
                if (*val)
                        (*val)[idx] = (char)(value & 0xFF);
@@ -1157,6 +1160,11 @@ int bt_gatt_set_int_value(bt_gatt_h gatt_handle, bt_data_type_int_e type,
 
        case BT_DATA_TYPE_SINT16:
                value = __convert_int_to_signed_bits(value, 16);
+               if (*val) {
+                        (*val)[idx++] = (char)(value & 0xFF);
+                        (*val)[idx] = (char)((value >> 8) & 0xFF);
+               }
+               break;
        case BT_DATA_TYPE_UINT16:
                if (*val) {
                         (*val)[idx++] = (char)(value & 0xFF);
@@ -1166,6 +1174,13 @@ int bt_gatt_set_int_value(bt_gatt_h gatt_handle, bt_data_type_int_e type,
 
        case BT_DATA_TYPE_SINT32:
                value = __convert_int_to_signed_bits(value, 32);
+               if (*val) {
+                       (*val)[idx++] = (char)(value & 0xFF);
+                       (*val)[idx++] = (char)((value >> 8) & 0xFF);
+                       (*val)[idx++] = (char)((value >> 16) & 0xFF);
+                       (*val)[idx] = (char)((value >> 24) & 0xFF);
+               }
+               break;
        case BT_DATA_TYPE_UINT32:
                if (*val) {
                        (*val)[idx++] = (char)(value & 0xFF);