From 5cf86f8ac89a7c7c96163addda005a115f1d38fa Mon Sep 17 00:00:00 2001 From: Michael Tuexen <tuexen@fh-muenster.de> Date: Mon, 21 Sep 2015 22:21:37 +0200 Subject: [PATCH] Don't use casts which are not necessary. --- gtests/net/packetdrill/run_system_call.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/gtests/net/packetdrill/run_system_call.c b/gtests/net/packetdrill/run_system_call.c index 1530ece3..2466eb95 100644 --- a/gtests/net/packetdrill/run_system_call.c +++ b/gtests/net/packetdrill/run_system_call.c @@ -1617,12 +1617,12 @@ static int syscall_getsockopt(struct state *state, struct syscall_spec *syscall, if (val_expression->type == EXPR_LINGER) { struct linger *ling = live_optval; if (ling->l_onoff != val_expression->value.linger.l_onoff) { - asprintf(error, "Bad getsockopt Linger onoff: expected: %d actual: %u", (int)val_expression->value.linger.l_onoff, (int)ling->l_onoff); + asprintf(error, "Bad getsockopt Linger onoff: expected: %d actual: %d", val_expression->value.linger.l_onoff, ling->l_onoff); free(live_optval); return STATUS_ERR; } if (ling->l_linger != val_expression->value.linger.l_linger) { - asprintf(error, "Bad getsockopt Linger Value: expected: %d actual: %d", (int)val_expression->value.linger.l_linger, (int)ling->l_linger); + asprintf(error, "Bad getsockopt Linger Value: expected: %d actual: %d", val_expression->value.linger.l_linger, ling->l_linger); free(live_optval); return STATUS_ERR; } @@ -1630,15 +1630,15 @@ static int syscall_getsockopt(struct state *state, struct syscall_spec *syscall, } else if (val_expression->type == EXPR_SCTP_RTOINFO) { struct sctp_rtoinfo *rtoinfo = live_optval; if (rtoinfo->srto_initial != val_expression->value.sctp_rtoinfo.srto_initial){ - asprintf(error, "Bad getsockopt SCTP_RTOINFO initial: expected: %d actual: %d", (int)val_expression->value.sctp_rtoinfo.srto_initial, (int)rtoinfo->srto_initial); + asprintf(error, "Bad getsockopt SCTP_RTOINFO initial: expected: %u actual: %u", val_expression->value.sctp_rtoinfo.srto_initial, rtoinfo->srto_initial); free(live_optval); return STATUS_ERR; } else if (rtoinfo->srto_max != val_expression->value.sctp_rtoinfo.srto_max){ - asprintf(error, "Bad getsockopt SCTP_RTOINFO SRTO_MAX: expected: %d actual: %d", (int)val_expression->value.sctp_rtoinfo.srto_max, (int)rtoinfo->srto_max); + asprintf(error, "Bad getsockopt SCTP_RTOINFO SRTO_MAX: expected: %u actual: %u", val_expression->value.sctp_rtoinfo.srto_max, rtoinfo->srto_max); free(live_optval); return STATUS_ERR; } else if (rtoinfo->srto_min != val_expression->value.sctp_rtoinfo.srto_min){ - asprintf(error, "Bad getsockopt SCTP_RTOINFO SRTO_MIN: expected: %d actual: %d", (int)val_expression->value.sctp_rtoinfo.srto_min, (int)rtoinfo->srto_min); + asprintf(error, "Bad getsockopt SCTP_RTOINFO SRTO_MIN: expected: %u actual: %u", val_expression->value.sctp_rtoinfo.srto_min, rtoinfo->srto_min); free(live_optval); return STATUS_ERR; } @@ -1652,27 +1652,27 @@ static int syscall_getsockopt(struct state *state, struct syscall_spec *syscall, free(live_optval); return STATUS_ERR; } else if (live_val->sstat_rwnd != expected_val->sstat_rwnd) { - asprintf(error, "Bad getsockopt SCTP_STATUS rwnd: expected: %d actual: %d ", (int) expected_val->sstat_rwnd, (int) live_val->sstat_rwnd); + asprintf(error, "Bad getsockopt SCTP_STATUS rwnd: expected: %u actual: %u ", expected_val->sstat_rwnd, live_val->sstat_rwnd); free(live_optval); return STATUS_ERR; } else if (live_val->sstat_unackdata != expected_val->sstat_unackdata) { - asprintf(error, "Bad getsockopt SCTP_STATUS unackdata: expected: %d actual: %d", (int) expected_val->sstat_unackdata, (int) live_val->sstat_unackdata); + asprintf(error, "Bad getsockopt SCTP_STATUS unackdata: expected: %u actual: %u", expected_val->sstat_unackdata, live_val->sstat_unackdata); free(live_optval); return STATUS_ERR; } else if (live_val->sstat_penddata != expected_val->sstat_penddata) { - asprintf(error, "Bad getsockopt SCTP_STATUS penddata: expected: %d actual: %d", (int) expected_val->sstat_penddata, (int) live_val->sstat_penddata); + asprintf(error, "Bad getsockopt SCTP_STATUS penddata: expected: %u actual: %u", expected_val->sstat_penddata, live_val->sstat_penddata); free(live_optval); return STATUS_ERR; } else if (live_val->sstat_instrms != expected_val->sstat_instrms) { - asprintf(error, "Bad getsockopt SCTP_STATUS instreams: expected: %d actual: %d", (int) expected_val->sstat_instrms, (int) live_val->sstat_instrms); + asprintf(error, "Bad getsockopt SCTP_STATUS instreams: expected: %u actual: %u", expected_val->sstat_instrms, live_val->sstat_instrms); free(live_optval); return STATUS_ERR; } else if (live_val->sstat_outstrms != expected_val->sstat_outstrms) { - asprintf(error, "Bad getsockopt SCTP_STATUS outstreams: expected: %d actual: %d", (int) expected_val->sstat_outstrms, (int) live_val->sstat_outstrms); + asprintf(error, "Bad getsockopt SCTP_STATUS outstreams: expected: %u actual: %u", expected_val->sstat_outstrms, live_val->sstat_outstrms); free(live_optval); return STATUS_ERR; } else if (live_val->sstat_fragmentation_point != expected_val->sstat_fragmentation_point){ - asprintf(error, "Bad getsockopt SCTP_STATUS fragmentation point: expected: %d actual: %d", (int) expected_val->sstat_fragmentation_point, (int) live_val->sstat_fragmentation_point); + asprintf(error, "Bad getsockopt SCTP_STATUS fragmentation point: expected: %u actual: %u", expected_val->sstat_fragmentation_point, live_val->sstat_fragmentation_point); free(live_optval); return STATUS_ERR; } -- GitLab