diff --git a/src/creport.c b/src/creport.c index cbfd0f181..55e2bccce 100644 --- a/src/creport.c +++ b/src/creport.c @@ -1242,7 +1242,7 @@ typedef struct travel_data { int n; } travel_data; -static void cb_cr_travelthru_ship(const region *r, unit *u, void *cbdata) { +static void cb_cr_travelthru_ship(region *r, unit *u, void *cbdata) { travel_data *data = (travel_data *)cbdata; const faction *f = data->f; FILE *F = data->file; @@ -1255,7 +1255,7 @@ static void cb_cr_travelthru_ship(const region *r, unit *u, void *cbdata) { } } -static void cb_cr_travelthru_unit(const region *r, unit *u, void *cbdata) { +static void cb_cr_travelthru_unit(region *r, unit *u, void *cbdata) { travel_data *data = (travel_data *)cbdata; const faction *f = data->f; FILE *F = data->file; diff --git a/src/reports.c b/src/reports.c index 6612c5d48..9d4d7f21c 100644 --- a/src/reports.c +++ b/src/reports.c @@ -988,7 +988,7 @@ typedef struct address_data { int stealthmod; } address_data; -static void cb_add_address(const region *r, unit *ut, void *cbdata) { +static void cb_add_address(region *r, unit *ut, void *cbdata) { address_data *data = (address_data *)cbdata; faction *f = data->f; @@ -2396,7 +2396,7 @@ typedef struct count_data { const struct faction *f; } count_data; -static void count_cb(const region *r, unit *u, void *cbdata) { +static void count_cb(region *r, unit *u, void *cbdata) { count_data *data = (count_data *)cbdata; const struct faction *f = data->f; if (r != u->region && (!u->ship || ship_owner(u->ship) == u)) { diff --git a/src/reports.test.c b/src/reports.test.c index 90e21e89a..b30c3214b 100644 --- a/src/reports.test.c +++ b/src/reports.test.c @@ -182,11 +182,6 @@ static void test_cr_unit(CuTest *tc) { test_cleanup(); } -static void reset_stream(stream *out) { - out->api->rewind(out->handle); - out->api->write(out->handle, "", 0); -} - static void test_write_travelthru(CuTest *tc) { stream out = { 0 }; char buf[1024]; @@ -212,21 +207,23 @@ static void test_write_travelthru(CuTest *tc) { out.api->rewind(out.handle); len = out.api->read(out.handle, buf, sizeof(buf)); CuAssertIntEquals_Msg(tc, "no travelers, no report", 0, (int)len); - - reset_stream(&out); + mstream_done(&out); + + mstream_init(&out); travelthru_add(r, u); write_travelthru(&out, r, f); out.api->rewind(out.handle); len = out.api->read(out.handle, buf, sizeof(buf)); buf[len] = '\0'; CuAssertStrEquals_Msg(tc, "list one unit", "Durchreise: Hodor (1).\n", buf); + mstream_done(&out); - reset_stream(&out); + mstream_init(&out); move_unit(u, r, 0); write_travelthru(&out, r, f); out.api->rewind(out.handle); len = out.api->read(out.handle, buf, sizeof(buf)); - CuAssertIntEquals_Msg(tc, "do not list units that stopped in the region", 0, len); + CuAssertIntEquals_Msg(tc, "do not list units that stopped in the region", 0, (int)len); mstream_done(&out); test_cleanup(); diff --git a/src/travelthru.test.c b/src/travelthru.test.c index 9f735fbe3..f92188751 100644 --- a/src/travelthru.test.c +++ b/src/travelthru.test.c @@ -13,7 +13,7 @@ struct attrib; -static void count_travelers(const region *r, unit *u, void *cbdata) { +static void count_travelers(region *r, unit *u, void *cbdata) { int *n = (int *)cbdata; unused_arg(r); *n += u->number;