]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
tests: Fix compilation errors on 32-bit.
authorNaveen Albert <asterisk@phreaknet.org>
Sun, 23 Oct 2022 15:16:31 +0000 (15:16 +0000)
committerN A <asterisk@phreaknet.org>
Thu, 27 Oct 2022 19:29:40 +0000 (14:29 -0500)
Fix compilation errors caused by using size_t
instead of uintmax_t and non-portable format
specifiers.

ASTERISK-30273 #close

Change-Id: I363e6057ef84d54b88af80d23ad6147eef9216ee

res/res_pjsip_outbound_authenticator_digest.c
tests/test_mwi.c
tests/test_stasis.c
tests/test_stasis_state.c

index 4821082a9f538eb2b0fc636f09a26894ae046d5b..aee4afc90ec5a23b9b4090ce1c278eb9c5f24380 100644 (file)
@@ -384,9 +384,9 @@ static pj_status_t set_outbound_authentication_credentials(pjsip_auth_clt_sess *
        res = pjsip_auth_clt_set_credentials(auth_sess, cred_count, creds_array);
        ast_free(creds_array);
        if (res == PJ_SUCCESS) {
-               ast_debug(3, "Set %"PRIu64" credentials in auth session\n", cred_count);
+               ast_debug(3, "Set %zu credentials in auth session\n", cred_count);
        } else {
-               ast_log(LOG_ERROR, "Failed to set %"PRIu64" credentials in auth session\n", cred_count);
+               ast_log(LOG_ERROR, "Failed to set %zu credentials in auth session\n", cred_count);
        }
 
 cleanup:
index 3f633b37271454e9cca08ec724c086fd759708d1..c9999633b443ef3ed9b87ec0a04fcc9fb2aaf13a 100644 (file)
@@ -63,6 +63,7 @@ static int num_to_mailbox(char *mailbox, size_t size, size_t num)
 
 static int mailbox_to_num(const char *mailbox, size_t *num)
 {
+       uintmax_t tmp;
        const char *p = strchr(mailbox, '~');
 
        if (!p) {
@@ -70,10 +71,11 @@ static int mailbox_to_num(const char *mailbox, size_t *num)
                return -1;
        }
 
-       if (ast_str_to_umax(++p, num)) {
+       if (ast_str_to_umax(++p, &tmp)) {
                ast_log(LOG_ERROR, "Unable to convert mailbox '%s' to numeric\n", mailbox);
                return -1;
        }
+       *num = (size_t) tmp;
 
        return 0;
 }
index 5efb1ec1e6cdb7b720dcea2e040dc1ecb75fe042..71026a6cced3cc6e7d0dc8be64316f8ba71badda 100644 (file)
@@ -2195,7 +2195,7 @@ static void dump_consumer(struct ast_test *test, struct cts *cts)
        int i;
        struct stasis_subscription_change *data;
 
-       ast_test_status_update(test, "Messages received: %ld  Final? %s\n", cts->consumer->messages_rxed_len,
+       ast_test_status_update(test, "Messages received: %zu  Final? %s\n", cts->consumer->messages_rxed_len,
                cts->consumer->complete ? "yes" : "no");
        for (i = 0; i < cts->consumer->messages_rxed_len; i++) {
                data = stasis_message_data(cts->consumer->messages_rxed[i]);
index 3ad450d111100cccb601a90786815e2b3476d956..3dc53345e55c1bed85b5925686b7276d6ab32f4b 100644 (file)
@@ -63,11 +63,13 @@ static int expect_null;
 static int validate_data(const char *id, struct foo_data *foo)
 {
        size_t num;
+       uintmax_t tmp;
 
-       if (ast_str_to_umax(id, &num)) {
+       if (ast_str_to_umax(id, &tmp)) {
                ast_log(LOG_ERROR, "Unable to convert the state's id '%s' to numeric\n", id);
                return -1;
        }
+       num = (size_t) tmp;
 
        running_total += num;
 
@@ -247,6 +249,7 @@ static struct stasis_message *create_foo_type_message(const char *id)
 {
        struct stasis_message *msg;
        struct foo_data *foo;
+       uintmax_t tmp;
 
        foo = ao2_alloc(sizeof(*foo), NULL);
        if (!foo) {
@@ -254,11 +257,12 @@ static struct stasis_message *create_foo_type_message(const char *id)
                return NULL;
        }
 
-       if (ast_str_to_umax(id, &foo->bar)) {
+       if (ast_str_to_umax(id, &tmp)) {
                ast_log(LOG_ERROR, "Unable to convert the state's id '%s' to numeric\n", id);
                ao2_ref(foo, -1);
                return NULL;
        }
+       foo->bar = (size_t) tmp;
 
        msg = stasis_message_create_full(foo_type(), foo, NULL);
        if (!msg) {