Modify the map agent for gtest
[platform/core/connectivity/bluetooth-agent.git] / map-agent / bluetooth_map_sms.c
index acc0bd3..3e918e0 100644 (file)
@@ -710,7 +710,11 @@ static char *__bt_prepare_msg_bmseg(msg_struct_t msg_info, gboolean attach,
                                        MSG_MESSAGE_SMS_DATA_STR,
                                        msg_body, BT_MAP_MSG_BODY_MAX);
                if (ret == MSG_SUCCESS) {
+#ifdef ARCH64
+                       g_string_append_printf(msg, LENGTH, (int)(unsigned int)strlen(msg_body));
+#else
                        g_string_append_printf(msg, LENGTH, strlen(msg_body));
+#endif
                        g_string_append_printf(msg, MSG_BODY, msg_body);
                }
        } else {
@@ -724,7 +728,7 @@ static char *__bt_prepare_msg_bmseg(msg_struct_t msg_info, gboolean attach,
                                        msg_body, BT_MAP_MSG_BODY_MAX);
                if (ret == MSG_SUCCESS) {
                        int msg_pdu_len = 0;
-                       msg_pdu = __bt_get_sms_pdu_from_msg_data(addr_value,
+                       msg_pdu = _bt_get_sms_pdu_from_msg_data(addr_value,
                                                        msg_body, dptime,
                                                        &msg_pdu_len);
                        if (msg_pdu) {
@@ -819,7 +823,7 @@ static char *__bt_get_truncated_utf8_string(char *src)
                while (count > 0 && ((i + count) < sizeof(dest))) {
                        dest[i++] = *p;
                        p++;
-                       count --;
+                       count--;
                }
                p = next;
        }
@@ -865,12 +869,15 @@ static message_info_t *__bt_message_info_get(msg_struct_t msg_struct_handle,
        msg_struct_t addr_info = NULL;
 
        ret = msg_get_int_value(msg_struct_handle, MSG_MESSAGE_ID_INT, &msg_id);
-       if (ret != MSG_SUCCESS) {
+       if (ret != MSG_SUCCESS)
                ERR("Could not get Message ID");
-       }
 
        uid = _bt_add_id(msg_id, BT_MAP_ID_SMS);
+#ifdef ARCH64
+       snprintf(msg_handle, sizeof(msg_handle), "%lx", uid);
+#else
        snprintf(msg_handle, sizeof(msg_handle), "%llx", uid);
+#endif
        DBG("HANDLE: %s, MAP Id: %d, MSG ID:%d", msg_handle, uid, msg_id);
        msg_info->handle = g_strdup(msg_handle);
 
@@ -943,10 +950,10 @@ next:
        msg_release_struct(&send_opt);
 
        ret = msg_get_int_value(msg_struct_handle,
-                               MSG_MESSAGE_DISPLAY_TIME_INT, &dptime);
-       if (ret == MSG_SUCCESS) {
+                               MSG_MESSAGE_DISPLAY_TIME_INT, (int *)&dptime);
+       if (ret == MSG_SUCCESS)
                _get_msg_timestamp(&dptime, msg_datetime);
-       }
+
        DBG("Got date time: %s", msg_datetime);
 
        msg_info->datetime = g_strdup(msg_datetime);
@@ -954,9 +961,8 @@ next:
 
        ret = msg_get_int_value(msg_struct_handle, MSG_MESSAGE_TYPE_INT,
                                                                &m_type);
-       if (ret == MSG_SUCCESS) {
+       if (ret == MSG_SUCCESS)
                DBG("m_type %d\n", m_type);
-       }
 
        msg_info->type = g_strdup("SMS_GSM");