diff --git a/addons/chan_ooh323.c b/addons/chan_ooh323.c index 170a3aebaa049f5dd13001113fe4571f8511c69f..673c5a5223e327e4a5b725b11659f0f72e106187 100644 --- a/addons/chan_ooh323.c +++ b/addons/chan_ooh323.c @@ -493,7 +493,7 @@ static struct ast_channel *ooh323_new(struct ooh323_pvt *i, int state, if (ch) { manager_event(EVENT_FLAG_SYSTEM, "ChannelUpdate", "Channel: %s\r\nChanneltype: %s\r\n" - "CallRef: %d\r\n", ast_channel_name(ch), "OOH323", i->call_reference); + "CallRef: %u\r\n", ast_channel_name(ch), "OOH323", i->call_reference); } } else ast_log(LOG_WARNING, "Unable to allocate channel structure\n"); @@ -1125,7 +1125,7 @@ static int ooh323_answer(struct ast_channel *ast) ast_channel_lock(ast); if (!p->alertsent) { if (gH323Debug) { - ast_debug(1, "Sending forced ringback for %s, res = %d\n", + ast_debug(1, "Sending forced ringback for %s, res = %u\n", callToken, ooManualRingback(callToken)); } else { ooManualRingback(callToken); @@ -1180,7 +1180,7 @@ static int ooh323_write(struct ast_channel *ast, struct ast_frame *f) p->lastrtptx = time(NULL); if (f->frametype == AST_FRAME_MODEM) { - ast_debug(1, "Send UDPTL %d/%d len %d for %s\n", + ast_debug(1, "Send UDPTL %u/%d len %d for %s\n", f->frametype, f->subclass.integer, f->datalen, ast_channel_name(ast)); if (p->udptl) res = ast_udptl_write(p->udptl, f); @@ -1225,7 +1225,7 @@ static int ooh323_write(struct ast_channel *ast, struct ast_frame *f) ast_mutex_unlock(&p->lock); return 0; } else { - ast_log(LOG_WARNING, "Can't send %d type frames with OOH323 write\n", + ast_log(LOG_WARNING, "Can't send %u type frames with OOH323 write\n", f->frametype); ast_mutex_unlock(&p->lock); return 0; @@ -1289,7 +1289,7 @@ static int ooh323_indicate(struct ast_channel *ast, int condition, const void *d if (ast_channel_state(ast) != AST_STATE_UP) { if (!p->progsent) { if (gH323Debug) { - ast_debug(1, "Sending manual progress for %s, res = %d\n", callToken, + ast_debug(1, "Sending manual progress for %s, res = %u\n", callToken, ooManualProgress(callToken)); } else { ooManualProgress(callToken); @@ -1302,7 +1302,7 @@ static int ooh323_indicate(struct ast_channel *ast, int condition, const void *d if (ast_channel_state(ast) == AST_STATE_RING || ast_channel_state(ast) == AST_STATE_RINGING) { if (!p->alertsent) { if (gH323Debug) { - ast_debug(1, "Sending manual ringback for %s, res = %d\n", + ast_debug(1, "Sending manual ringback for %s, res = %u\n", callToken, ooManualRingback(callToken)); } else { @@ -2153,7 +2153,7 @@ int onCallEstablished(ooCallData *call) ast_queue_control(c, AST_CONTROL_ANSWER); ast_channel_unlock(p->owner); manager_event(EVENT_FLAG_SYSTEM,"ChannelUpdate","Channel: %s\r\nChanneltype: %s\r\n" - "CallRef: %d\r\n", ast_channel_name(c), "OOH323", p->call_reference); + "CallRef: %u\r\n", ast_channel_name(c), "OOH323", p->call_reference); } ast_mutex_unlock(&p->lock); @@ -3190,7 +3190,7 @@ static char *handle_cli_ooh323_show_peer(struct ast_cli_entry *e, int cmd, struc ast_cli(a->fd, "%-15.15s%s\n", "AccountCode: ", peer->accountcode); ast_cli(a->fd, "%-15.15s%s\n", "AMA flags: ", ast_cdr_flags2str(peer->amaflags)); ast_cli(a->fd, "%-15.15s%s\n", "IP:Port: ", ip_port); - ast_cli(a->fd, "%-15.15s%d\n", "OutgoingLimit: ", peer->outgoinglimit); + ast_cli(a->fd, "%-15.15s%u\n", "OutgoingLimit: ", peer->outgoinglimit); ast_cli(a->fd, "%-15.15s%d\n", "rtptimeout: ", peer->rtptimeout); ast_cli(a->fd, "%-15.15s%s\n", "nat: ", peer->nat?"yes":"no"); if (peer->rtpmaskstr[0]) { @@ -3350,7 +3350,7 @@ static char *handle_cli_ooh323_show_user(struct ast_cli_entry *e, int cmd, struc ast_cli(a->fd, "%-15.15s%s\n", "AMA flags: ", ast_cdr_flags2str(user->amaflags)); ast_cli(a->fd, "%-15.15s%s\n", "Context: ", user->context); ast_cli(a->fd, "%-15.15s%d\n", "IncomingLimit: ", user->incominglimit); - ast_cli(a->fd, "%-15.15s%d\n", "InUse: ", user->inUse); + ast_cli(a->fd, "%-15.15s%u\n", "InUse: ", user->inUse); ast_cli(a->fd, "%-15.15s%d\n", "rtptimeout: ", user->rtptimeout); ast_cli(a->fd, "%-15.15s%s\n", "nat: ", user->nat?"yes":"no"); if (user->rtpmaskstr[0]) { @@ -4376,7 +4376,7 @@ static enum ast_rtp_glue_result ooh323_get_rtp_peer(struct ast_channel *chan, st ast_rtp_instance_get_remote_address(*rtp, &tmp); if (gH323Debug) { - ast_verb(0, "ooh323_get_rtp_peer %s -> %s:%d, %d\n", ast_channel_name(chan), ast_sockaddr_stringify_addr(&tmp), + ast_verb(0, "ooh323_get_rtp_peer %s -> %s:%d, %u\n", ast_channel_name(chan), ast_sockaddr_stringify_addr(&tmp), ast_sockaddr_port(&tmp), res); } if (gH323Debug) { @@ -4962,7 +4962,7 @@ struct ast_frame *ooh323_rtp_read(struct ast_channel *ast, struct ooh323_pvt *p) case 5: f = ast_udptl_read(p->udptl); /* UDPTL t.38 data */ if (gH323Debug) { - ast_debug(1, "Got UDPTL %d/%d len %d for %s\n", + ast_debug(1, "Got UDPTL %u/%d len %d for %s\n", f->frametype, f->subclass.integer, f->datalen, ast_channel_name(ast)); } p->lastrtprx = time(NULL); diff --git a/addons/ooh323c/src/ooq931.c b/addons/ooh323c/src/ooq931.c index a6bdea431b449a9333f74ff1b317280d9e182a93..86ecd920563f27b262d0ca45ef74da08e49f78c2 100644 --- a/addons/ooh323c/src/ooq931.c +++ b/addons/ooh323c/src/ooq931.c @@ -319,7 +319,7 @@ char* ooQ931GetMessageTypeName(int messageType, char* buf) { strcpy(buf, "Escape"); break; default: - sprintf(buf, "<%u>", messageType); + sprintf(buf, "<%d>", messageType); } return buf; } @@ -360,7 +360,7 @@ char* ooQ931GetIEName(int number, char* buf) { strcpy(buf, "User-User"); break; default: - sprintf(buf, "0x%02x", number); + sprintf(buf, "0x%02x", (unsigned)number); } return buf; } @@ -371,8 +371,8 @@ EXTERN void ooQ931Print (const Q931Message* q931msg) { unsigned int i; printf("Q.931 Message:\n"); - printf(" protocolDiscriminator: %i\n", q931msg->protocolDiscriminator); - printf(" callReference: %i\n", q931msg->callReference); + printf(" protocolDiscriminator: %u\n", q931msg->protocolDiscriminator); + printf(" callReference: %u\n", q931msg->callReference); printf(" from: %s\n", (q931msg->fromDestination ? "destination" : "originator")); printf(" messageType: %s (0x%X)\n\n", @@ -382,9 +382,9 @@ EXTERN void ooQ931Print (const Q931Message* q931msg) { for(i = 0, curNode = q931msg->ies.head; i < q931msg->ies.count; i++) { Q931InformationElement *ie = (Q931InformationElement*) curNode->data; int length = (ie->length >= 0) ? ie->length : -ie->length; - printf(" IE[%i] (offset 0x%X):\n", i, ie->offset); + printf(" IE[%u] (offset 0x%X):\n", i, (unsigned)ie->offset); printf(" discriminator: %s (0x%X)\n", - ooQ931GetIEName(ie->discriminator, buf), ie->discriminator); + ooQ931GetIEName(ie->discriminator, buf), (unsigned)ie->discriminator); printf(" data length: %i\n", length); curNode = curNode->next; diff --git a/addons/ooh323c/src/printHandler.c b/addons/ooh323c/src/printHandler.c index 39311697e2b42bb6be84afd59e3ff7d312650663..3986a865de6ee07647563517fec95d383af858c6 100644 --- a/addons/ooh323c/src/printHandler.c +++ b/addons/ooh323c/src/printHandler.c @@ -268,7 +268,7 @@ static const char* octStrToString if (bufsiz > 1) buffer[1] = '\0'; for (i = 0; i < numocts; i++) { if (i < bufsiz - 1) { - sprintf (lbuf, "%02x", data[i]); + sprintf (lbuf, "%02x", (unsigned)data[i]); strcat (&buffer[(i*2)+1], lbuf); } else break; diff --git a/apps/app_meetme.c b/apps/app_meetme.c index 21aba6d3d43b765726efae44d2f9a51d4268c6f9..6fa8cb17a7f4e0ca7e466ddf13423540be1b187e 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -2918,7 +2918,7 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc if (ast_test_flag64(confflags, CONFFLAG_DURATION_STOP) && !ast_strlen_zero(optargs[OPT_ARG_DURATION_STOP])) { calldurationlimit = atoi(optargs[OPT_ARG_DURATION_STOP]); - ast_verb(3, "Setting call duration limit to %d seconds.\n", calldurationlimit); + ast_verb(3, "Setting call duration limit to %u seconds.\n", calldurationlimit); } if (ast_test_flag64(confflags, CONFFLAG_DURATION_LIMIT) && !ast_strlen_zero(optargs[OPT_ARG_DURATION_LIMIT])) { @@ -4046,12 +4046,12 @@ static int conf_run(struct ast_channel *chan, struct ast_conference *conf, struc break; default: ast_debug(1, - "Got ignored control frame on channel %s, f->frametype=%d,f->subclass=%d\n", + "Got ignored control frame on channel %s, f->frametype=%u,f->subclass=%d\n", ast_channel_name(chan), f->frametype, f->subclass.integer); } } else { ast_debug(1, - "Got unrecognized frame on channel %s, f->frametype=%d,f->subclass=%d\n", + "Got unrecognized frame on channel %s, f->frametype=%u,f->subclass=%d\n", ast_channel_name(chan), f->frametype, f->subclass.integer); } ast_frfree(f); @@ -6906,7 +6906,7 @@ static int sla_station_exec(struct ast_channel *chan, const char *data) ast_cond_destroy(&cond); ast_autoservice_stop(chan); if (!trunk_ref->trunk->chan) { - ast_debug(1, "Trunk didn't get created. chan: %lx\n", (long) trunk_ref->trunk->chan); + ast_debug(1, "Trunk didn't get created. chan: %lx\n", (unsigned long) trunk_ref->trunk->chan); pbx_builtin_setvar_helper(chan, "SLASTATION_STATUS", "CONGESTION"); sla_change_trunk_state(trunk_ref->trunk, SLA_TRUNK_STATE_IDLE, ALL_TRUNK_REFS, NULL); trunk_ref->chan = NULL; diff --git a/res/res_jabber.c b/res/res_jabber.c index b465f509c2a6240f4b15ea214846edf135adeed8..afdcf59fb7c96c0c3f1b9fb24db69b04e2f8fa27 100644 --- a/res/res_jabber.c +++ b/res/res_jabber.c @@ -2623,7 +2623,7 @@ static void aji_handle_subscribe(struct aji_client *client, ikspak *pak) ASTOBJ_UNREF(buddy, ast_aji_buddy_destroy); } default: - ast_verb(5, "JABBER: This is a subcription of type %i\n", pak->subtype); + ast_verb(5, "JABBER: This is a subcription of type %u\n", pak->subtype); } } diff --git a/tests/test_abstract_jb.c b/tests/test_abstract_jb.c index f39b0b03b6e637948ae363f58c497e4d7028405d..ce25eb8c403c33a33ed8c252f4ecade9dfe181cb 100644 --- a/tests/test_abstract_jb.c +++ b/tests/test_abstract_jb.c @@ -116,6 +116,15 @@ static struct ast_frame *create_test_frame(long timestamp, return AST_TEST_FAIL; \ } } while (0) +/*! \internal + * \brief Test two numeric (unsigned int) values. +*/ +#define UINT_TEST(actual, expected) do { \ + if ((actual) != (expected)) { \ + ast_test_status_update(test, #actual ": expected [%u]; actual [%u]\n", (expected), (actual)); \ + return AST_TEST_FAIL; \ + } } while (0) + /*! \internal * \brief Test two string values */ @@ -129,7 +138,7 @@ static struct ast_frame *create_test_frame(long timestamp, * \brief Verify that two frames have the same properties */ #define VERIFY_FRAME(actual, expected) do { \ - INT_TEST((actual)->frametype, (expected)->frametype); \ + UINT_TEST((actual)->frametype, (expected)->frametype); \ INT_TEST((actual)->seqno, (expected)->seqno); \ LONG_INT_TEST((actual)->ts, (expected)->ts); \ LONG_INT_TEST((actual)->len, (expected)->len); \ diff --git a/tests/test_aoc.c b/tests/test_aoc.c index 7ac1d30b61bbb9ddf428c545d75c5d48f631ec79..35387df90ead673c8790db4243aa7516896ff4e7 100644 --- a/tests/test_aoc.c +++ b/tests/test_aoc.c @@ -411,7 +411,7 @@ AST_TEST_DEFINE(aoc_encode_decode_test) if (!(unit = ast_aoc_get_unit_info(decoded, i)) || ((unit->valid_amount) && (unit->amount != (i+1))) || ((unit->valid_type) && (unit->type != (i+2)))) { - ast_test_status_update(test, "TEST 2, invalid unit entry result, got %d,%d, expected %d,%d\n", + ast_test_status_update(test, "TEST 2, invalid unit entry result, got %u,%u, expected %d,%d\n", unit->amount, unit->type, i+1, diff --git a/tests/test_astobj2.c b/tests/test_astobj2.c index 275c260af5f1ee9bfe2c508ae95d8c034054a132..a0f0d34b5613c588d31781e17e1cd56b3703a5ce 100644 --- a/tests/test_astobj2.c +++ b/tests/test_astobj2.c @@ -154,7 +154,7 @@ static int astobj2_test_helper(int use_hash, int use_cmp, unsigned int lim, stru } } - ast_test_status_update(test, "Container created: random bucket size %d: number of items: %d\n", bucket_size, lim); + ast_test_status_update(test, "Container created: random bucket size %d: number of items: %u\n", bucket_size, lim); /* Testing ao2_container_clone */ c3 = ao2_container_clone(c1, 0); diff --git a/tests/test_astobj2_thrash.c b/tests/test_astobj2_thrash.c index f43445a051592348875608467cfc353c0325a600..814234cc301b88737cff6963f679b41725028497 100644 --- a/tests/test_astobj2_thrash.c +++ b/tests/test_astobj2_thrash.c @@ -82,7 +82,7 @@ static char *ht_new(int i) if (keybuf == NULL) { return NULL; } - needed = snprintf(keybuf, buflen, "key%08x", i); + needed = snprintf(keybuf, buflen, "key%08x", (unsigned)i); ast_atomic_fetchadd_int(&alloc_count, 1); ast_assert(needed + 1 <= buflen); return keybuf; diff --git a/tests/test_config.c b/tests/test_config.c index 8eeb9f8a9bf34c57e53d6db4ef5c121a361e1b8b..e7ee675fc3308a893bfade67f1e2a1b386c88707 100644 --- a/tests/test_config.c +++ b/tests/test_config.c @@ -885,19 +885,19 @@ AST_TEST_DEFINE(config_options_test) arr[3] = item_defaults; /* Test global and item against configs, global_defaults and item_defaults against defaults */ -#define NOT_EQUAL_FAIL(field) \ +#define NOT_EQUAL_FAIL(field, format) \ if (arr[x]->field != control->field) { \ - ast_test_status_update(test, "%s did not match: %d != %d with x = %d\n", #field, arr[x]->field, control->field, x); \ + ast_test_status_update(test, "%s did not match: " format " != " format " with x = %d\n", #field, arr[x]->field, control->field, x); \ res = AST_TEST_FAIL; \ } for (x = 0; x < 4; x++) { struct test_item *control = x < 2 ? &configs : &defaults; - NOT_EQUAL_FAIL(intopt); - NOT_EQUAL_FAIL(uintopt); - NOT_EQUAL_FAIL(boolopt); - NOT_EQUAL_FAIL(flags); - NOT_EQUAL_FAIL(customopt); + NOT_EQUAL_FAIL(intopt, "%d"); + NOT_EQUAL_FAIL(uintopt, "%u"); + NOT_EQUAL_FAIL(boolopt, "%d"); + NOT_EQUAL_FAIL(flags, "%u"); + NOT_EQUAL_FAIL(customopt, "%d"); if (fabs(arr[x]->doubleopt - control->doubleopt) > 0.001) { ast_test_status_update(test, "doubleopt did not match: %f vs %f on loop %d\n", arr[x]->doubleopt, control->doubleopt, x); res = AST_TEST_FAIL; diff --git a/tests/test_event.c b/tests/test_event.c index 9a4c2419fa6eee982ab88040187c8e615d5dcd01..5fb9cdeae870e48da707dcad31d6fadfdb485273 100644 --- a/tests/test_event.c +++ b/tests/test_event.c @@ -66,7 +66,7 @@ static int check_event(struct ast_event *event, struct ast_test *test, /* Check #1: Ensure event type is set properly. */ type = ast_event_get_type(event); if (ast_event_get_type(event) != type) { - ast_test_status_update(test, "Expected event type: '%d', got '%d'\n", + ast_test_status_update(test, "Expected event type: '%u', got '%u'\n", expected_type, type); return -1; } @@ -343,7 +343,7 @@ AST_TEST_DEFINE(event_sub_test) sub_res = ast_event_check_subscriber(AST_EVENT_CUSTOM, AST_EVENT_IE_END); if (sub_res != AST_EVENT_SUB_NONE) { - ast_test_status_update(test, "CUSTOM subscriptions should not exist! (%d)\n", + ast_test_status_update(test, "CUSTOM subscriptions should not exist! (%u)\n", sub_res); res = AST_TEST_FAIL; } @@ -376,7 +376,7 @@ AST_TEST_DEFINE(event_sub_test) sub_res = ast_event_check_subscriber(AST_EVENT_CUSTOM, AST_EVENT_IE_END); if (sub_res != AST_EVENT_SUB_EXISTS) { - ast_test_status_update(test, "A CUSTOM subscription should exist! (%d)\n", + ast_test_status_update(test, "A CUSTOM subscription should exist! (%u)\n", sub_res); res = AST_TEST_FAIL; } @@ -623,7 +623,7 @@ AST_TEST_DEFINE(event_sub_test) AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, "Money", AST_EVENT_IE_END); if (sub_res != AST_EVENT_SUB_NONE) { - ast_test_status_update(test, "Str Money subscription should not exist! (%d)\n", + ast_test_status_update(test, "Str Money subscription should not exist! (%u)\n", sub_res); res = AST_TEST_FAIL; } @@ -641,7 +641,7 @@ AST_TEST_DEFINE(event_sub_test) AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_RAW, "FOO/bar", sizeof("FOO/bar") - 1, AST_EVENT_IE_END); if (sub_res != AST_EVENT_SUB_NONE) { - ast_test_status_update(test, "Raw FOO/bar-1 subscription should not exist! (%d)\n", + ast_test_status_update(test, "Raw FOO/bar-1 subscription should not exist! (%u)\n", sub_res); res = AST_TEST_FAIL; } @@ -650,7 +650,7 @@ AST_TEST_DEFINE(event_sub_test) AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_RAW, "Monkeys", sizeof("Monkeys"), AST_EVENT_IE_END); if (sub_res != AST_EVENT_SUB_NONE) { - ast_test_status_update(test, "Raw Monkeys subscription should not exist! (%d)\n", + ast_test_status_update(test, "Raw Monkeys subscription should not exist! (%u)\n", sub_res); res = AST_TEST_FAIL; } @@ -668,7 +668,7 @@ AST_TEST_DEFINE(event_sub_test) AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_UINT, 1, AST_EVENT_IE_END); if (sub_res != AST_EVENT_SUB_NONE) { - ast_test_status_update(test, "UINT=1 subscription should not exist! (%d)\n", + ast_test_status_update(test, "UINT=1 subscription should not exist! (%u)\n", sub_res); res = AST_TEST_FAIL; } @@ -686,7 +686,7 @@ AST_TEST_DEFINE(event_sub_test) AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_BITFLAGS, 8, AST_EVENT_IE_END); if (sub_res != AST_EVENT_SUB_NONE) { - ast_test_status_update(test, "BITFLAGS=8 subscription should not exist! (%d)\n", + ast_test_status_update(test, "BITFLAGS=8 subscription should not exist! (%u)\n", sub_res); res = AST_TEST_FAIL; } @@ -705,7 +705,7 @@ AST_TEST_DEFINE(event_sub_test) AST_EVENT_IE_NEWMSGS, AST_EVENT_IE_PLTYPE_UINT, 4, AST_EVENT_IE_END); if (sub_res != AST_EVENT_SUB_NONE) { - ast_test_status_update(test, "EXISTS subscription should not exist! (%d)\n", + ast_test_status_update(test, "EXISTS subscription should not exist! (%u)\n", sub_res); res = AST_TEST_FAIL; } diff --git a/tests/test_format_api.c b/tests/test_format_api.c index c429e08954c56ca93201b32f5751bf1f561064d9..1a5a8c80b1c8dd97b0e3d7fe2ba10d3dd928273b 100644 --- a/tests/test_format_api.c +++ b/tests/test_format_api.c @@ -120,7 +120,7 @@ static void test_set(struct ast_format_attr *fattr, va_list ap) } break; default: - ast_log(LOG_WARNING, "unknown attribute type %d\n", key); + ast_log(LOG_WARNING, "unknown attribute type %u\n", key); } } } diff --git a/tests/test_hashtab_thrash.c b/tests/test_hashtab_thrash.c index 53601309b8a5d74ce3c3f5f47876d7a094fe2e1a..d124c0b40b68944685016f7adb351036aba89cb8 100644 --- a/tests/test_hashtab_thrash.c +++ b/tests/test_hashtab_thrash.c @@ -73,7 +73,7 @@ static char *ht_new(int i) if (keybuf == NULL) { return NULL; } - needed = snprintf(keybuf, buflen, "key%08x", i); + needed = snprintf(keybuf, buflen, "key%08x", (unsigned)i); ast_assert(needed + 1 <= buflen); return keybuf; } diff --git a/tests/test_logger.c b/tests/test_logger.c index 2cc811d2764d6d8b787b263b47229d85bfb7d7ee..b0df4c606c361116038cbe2c22006bd7130205d8 100644 --- a/tests/test_logger.c +++ b/tests/test_logger.c @@ -55,12 +55,12 @@ static void output_tests(struct test *tests, size_t num_tests, int fd) unsigned int x; for (x = 0; x < num_tests; x++) { - ast_cli(fd, "Test %d: %s\n", x + 1, tests[x].name); - ast_cli(fd, "\tExpected Successes: %d\n", tests[x].x_success); - ast_cli(fd, "\tExpected Failures: %d\n", tests[x].x_failure); - ast_cli(fd, "\tUnexpected Successes: %d\n", tests[x].u_success); - ast_cli(fd, "\tUnexpected Failures: %d\n", tests[x].u_failure); - ast_cli(fd, "Test %d Result: %s\n", x + 1, (tests[x].u_success + tests[x].u_failure) ? "FAIL" : "PASS"); + ast_cli(fd, "Test %u: %s\n", x + 1, tests[x].name); + ast_cli(fd, "\tExpected Successes: %u\n", tests[x].x_success); + ast_cli(fd, "\tExpected Failures: %u\n", tests[x].x_failure); + ast_cli(fd, "\tUnexpected Successes: %u\n", tests[x].u_success); + ast_cli(fd, "\tUnexpected Failures: %u\n", tests[x].u_failure); + ast_cli(fd, "Test %u Result: %s\n", x + 1, (tests[x].u_success + tests[x].u_failure) ? "FAIL" : "PASS"); } } @@ -88,11 +88,11 @@ static char *handle_cli_dynamic_level_test(struct ast_cli_entry *e, int cmd, str } for (test = 0; test < ARRAY_LEN(tests); test++) { - ast_cli(a->fd, "Test %d: %s.\n", test + 1, tests[test].name); + ast_cli(a->fd, "Test %u: %s.\n", test + 1, tests[test].name); switch (test) { case 0: if ((level = ast_logger_register_level("test")) != -1) { - ast_cli(a->fd, "Test: got level %d\n", level); + ast_cli(a->fd, "Test: got level %u\n", level); ast_log_dynamic_level(level, "Logger Dynamic Test: Test 1\n"); ast_logger_unregister_level("test"); tests[test].x_success++; @@ -106,7 +106,7 @@ static char *handle_cli_dynamic_level_test(struct ast_cli_entry *e, int cmd, str char level_name[18][8]; for (x = 0; x < ARRAY_LEN(level_name); x++) { - sprintf(level_name[x], "level%02d", x); + sprintf(level_name[x], "level%02u", x); if ((level = ast_logger_register_level(level_name[x])) == -1) { if (x < 16) { tests[test].u_failure++; @@ -115,7 +115,7 @@ static char *handle_cli_dynamic_level_test(struct ast_cli_entry *e, int cmd, str } level_name[x][0] = '\0'; } else { - ast_cli(a->fd, "Test: registered '%s', got level %d\n", level_name[x], level); + ast_cli(a->fd, "Test: registered '%s', got level %u\n", level_name[x], level); if (x < 16) { tests[test].x_success++; } else { @@ -159,7 +159,7 @@ static char *handle_cli_performance_test(struct ast_cli_entry *e, int cmd, struc } for (test = 0; test < ARRAY_LEN(tests); test++) { - ast_cli(a->fd, "Test %d: %s.\n", test + 1, tests[test].name); + ast_cli(a->fd, "Test %u: %s.\n", test + 1, tests[test].name); switch (test) { case 0: if ((level = ast_logger_register_level("perftest")) != -1) { @@ -167,7 +167,7 @@ static char *handle_cli_performance_test(struct ast_cli_entry *e, int cmd, struc struct timeval start, end; int elapsed; - ast_cli(a->fd, "Test: got level %d\n", level); + ast_cli(a->fd, "Test: got level %u\n", level); start = ast_tvnow(); for (x = 0; x < 10000; x++) { ast_log_dynamic_level(level, "Performance test log message\n"); diff --git a/tests/test_voicemail_api.c b/tests/test_voicemail_api.c index 85e7a1b98670b2fb501efd05483a65703b78b188..131b2915ae87e78fbb383ddc087d09161c94bbd9 100644 --- a/tests/test_voicemail_api.c +++ b/tests/test_voicemail_api.c @@ -87,7 +87,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") * object is test_mbox_snapshot */ #define VM_API_STRING_FIELD_VERIFY(expected, actual) do { \ - if (strncmp((expected), (actual), sizeof((expected)))) { \ + if (strncmp((expected), (actual), strlen((expected)))) { \ ast_test_status_update(test, "Test failed for parameter %s: Expected [%s], Actual [%s]\n", #actual, expected, actual); \ VM_API_SNAPSHOT_TEST_CLEANUP; \ return AST_TEST_FAIL; \ @@ -97,7 +97,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") * that it assumes the mailbox snapshot object is test_mbox_snapshot */ #define VM_API_INT_VERIFY(expected, actual) do { \ if ((expected) != (actual)) { \ - ast_test_status_update(test, "Test failed for parameter %s: Expected [%d], Actual [%d]\n", #actual, expected, actual); \ + ast_test_status_update(test, "Test failed for parameter %s: Expected [%d], Actual [%d]\n", #actual, (int)expected, (int)actual); \ VM_API_SNAPSHOT_TEST_CLEANUP; \ return AST_TEST_FAIL; \ } } while (0) @@ -365,9 +365,9 @@ static int test_vm_api_create_voicemail_files(const char *context, const char *m */ snprintf(folder_path, sizeof(folder_path), "%s/voicemail/%s/%s/%s", ast_config_AST_SPOOL_DIR, context, mailbox, snapshot->folder_name); - snprintf(msg_path, sizeof(msg_path), "%s/msg%04d.txt", + snprintf(msg_path, sizeof(msg_path), "%s/msg%04u.txt", folder_path, snapshot->msg_number); - snprintf(snd_path, sizeof(snd_path), "%s/msg%04d.gsm", + snprintf(snd_path, sizeof(snd_path), "%s/msg%04u.gsm", folder_path, snapshot->msg_number); snprintf(beep_path, sizeof(beep_path), "%s/sounds/en/beep.gsm", ast_config_AST_VAR_DIR); @@ -453,9 +453,9 @@ static void test_vm_api_remove_voicemail(struct ast_vm_msg_snapshot *snapshot) snprintf(folder_path, sizeof(folder_path), "%s/voicemail/%s/%s/%s", ast_config_AST_SPOOL_DIR, "default", snapshot->exten, snapshot->folder_name); - snprintf(msg_path, sizeof(msg_path), "%s/msg%04d.txt", + snprintf(msg_path, sizeof(msg_path), "%s/msg%04u.txt", folder_path, snapshot->msg_number); - snprintf(snd_path, sizeof(snd_path), "%s/msg%04d.gsm", + snprintf(snd_path, sizeof(snd_path), "%s/msg%04u.gsm", folder_path, snapshot->msg_number); unlink(msg_path); unlink(snd_path);