[Asterisk-code-review] tests: Fix compilation errors. (asterisk[master])
N A
asteriskteam at digium.com
Sun Oct 23 10:17:42 CDT 2022
N A has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19418 )
Change subject: tests: Fix compilation errors.
......................................................................
tests: Fix compilation errors.
Fix compilation errors caused by using size_t
instead of uintmax_t.
ASTERISK-30273 #close
Change-Id: I363e6057ef84d54b88af80d23ad6147eef9216ee
---
M tests/test_mwi.c
M tests/test_stasis.c
M tests/test_stasis_state.c
3 files changed, 24 insertions(+), 4 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/18/19418/1
diff --git a/tests/test_mwi.c b/tests/test_mwi.c
index 3f633b3..053c044 100644
--- a/tests/test_mwi.c
+++ b/tests/test_mwi.c
@@ -63,6 +63,7 @@
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 @@
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 = tmp;
return 0;
}
diff --git a/tests/test_stasis.c b/tests/test_stasis.c
index 5efb1ec..d0cce4c 100644
--- a/tests/test_stasis.c
+++ b/tests/test_stasis.c
@@ -2195,7 +2195,7 @@
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: %u 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]);
diff --git a/tests/test_stasis_state.c b/tests/test_stasis_state.c
index 3ad450d..4009dda 100644
--- a/tests/test_stasis_state.c
+++ b/tests/test_stasis_state.c
@@ -63,11 +63,13 @@
static int validate_data(const char *id, struct foo_data *foo)
{
size_t num;
+ unsigned int 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 @@
{
struct stasis_message *msg;
struct foo_data *foo;
+ uintmax_t tmp;
foo = ao2_alloc(sizeof(*foo), NULL);
if (!foo) {
@@ -254,11 +257,12 @@
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 = tmp;
msg = stasis_message_create_full(foo_type(), foo, NULL);
if (!msg) {
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19418
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I363e6057ef84d54b88af80d23ad6147eef9216ee
Gerrit-Change-Number: 19418
Gerrit-PatchSet: 1
Gerrit-Owner: N A <asterisk at phreaknet.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221023/73f9d14b/attachment.html>
More information about the asterisk-code-review
mailing list