diff --git a/src/give.test.c b/src/give.test.c index f2b0d60a9..029ee7c44 100644 --- a/src/give.test.c +++ b/src/give.test.c @@ -233,7 +233,6 @@ static void test_give_men_requires_contact(CuTest * tc) { struct give env = { 0 }; message * msg; order *ord; - char cmd[32]; test_setup_ex(tc); env.f1 = test_create_faction(0); @@ -244,8 +243,7 @@ static void test_give_men_requires_contact(CuTest * tc) { CuAssertIntEquals(tc, 1, env.dst->number); CuAssertIntEquals(tc, 1, env.src->number); - _snprintf(cmd, sizeof(cmd), "%s ALLES PERSONEN", itoa36(env.dst->no)); - ord = create_order(K_GIVE, env.f1->locale, cmd); + ord = create_order(K_GIVE, env.f1->locale, "%s ALLES PERSONEN", itoa36(env.dst->no)); test_clear_messages(env.f1); give_cmd(env.src, ord); CuAssertPtrEquals(tc, 0, test_find_messagetype(env.f1->msgs, "give_person")); @@ -307,7 +305,6 @@ static void test_give(CuTest * tc) { static void test_give_cmd(CuTest * tc) { struct give env = { 0 }; struct order *ord; - char cmd[32]; test_setup_ex(tc); env.lang = test_create_locale(); @@ -316,8 +313,7 @@ static void test_give_cmd(CuTest * tc) { i_change(&env.src->items, env.itype, 10); - _snprintf(cmd, sizeof(cmd), "%s 5 %s", itoa36(env.dst->no), LOC(env.f1->locale, env.itype->rtype->_name)); - ord = create_order(K_GIVE, env.f1->locale, cmd); + ord = create_order(K_GIVE, env.f1->locale, "%s 5 %s", itoa36(env.dst->no), LOC(env.f1->locale, env.itype->rtype->_name)); assert(ord); give_cmd(env.src, ord); CuAssertIntEquals(tc, 5, i_get(env.src->items, env.itype)); @@ -330,7 +326,6 @@ static void test_give_cmd(CuTest * tc) { static void test_give_herbs(CuTest * tc) { struct give env = { 0 }; struct order *ord; - char cmd[32]; test_setup_ex(tc); test_create_world(); @@ -338,8 +333,7 @@ static void test_give_herbs(CuTest * tc) { setup_give(&env); i_change(&env.src->items, env.itype, 10); - _snprintf(cmd, sizeof(cmd), "%s %s", itoa36(env.dst->no), LOC(env.f1->locale, parameters[P_HERBS])); - ord = create_order(K_GIVE, env.f1->locale, cmd); + ord = create_order(K_GIVE, env.f1->locale, "%s %s", itoa36(env.dst->no), LOC(env.f1->locale, parameters[P_HERBS])); assert(ord); give_cmd(env.src, ord); diff --git a/src/kernel/jsonconf.c b/src/kernel/jsonconf.c index dccfbb68a..69e02c3a0 100644 --- a/src/kernel/jsonconf.c +++ b/src/kernel/jsonconf.c @@ -801,10 +801,10 @@ static void json_settings(cJSON *json) { else { char value[32]; if (child->type == cJSON_Number && child->valuedouble && child->valueintvaluedouble) { - _snprintf(value, sizeof(value), "%f", child->valuedouble); + sprintf(value, "%f", child->valuedouble); } else { - _snprintf(value, sizeof(value), "%d", child->valueint); + sprintf(value, "%d", child->valueint); } config_set(child->string, value); } diff --git a/src/kernel/unit.test.c b/src/kernel/unit.test.c index 752627144..1a481960d 100644 --- a/src/kernel/unit.test.c +++ b/src/kernel/unit.test.c @@ -140,37 +140,34 @@ static void test_scale_number(CuTest *tc) { static void test_unit_name(CuTest *tc) { unit *u; - char name[32]; test_cleanup(); test_create_world(); u = test_create_unit(test_create_faction(test_create_race("human")), findregion(0, 0)); + renumber_unit(u, 666); unit_setname(u, "Hodor"); - _snprintf(name, sizeof(name), "Hodor (%s)", itoa36(u->no)); - CuAssertStrEquals(tc, name, unitname(u)); + CuAssertStrEquals(tc, "Hodor (ii)", unitname(u)); test_cleanup(); } static void test_unit_name_from_race(CuTest *tc) { unit *u; - char name[32]; struct locale *lang; test_cleanup(); test_create_world(); u = test_create_unit(test_create_faction(test_create_race("human")), findregion(0, 0)); + renumber_unit(u, 666); unit_setname(u, NULL); lang = get_or_create_locale("de"); locale_setstring(lang, rc_name_s(u->_race, NAME_SINGULAR), "Mensch"); locale_setstring(lang, rc_name_s(u->_race, NAME_PLURAL), "Menschen"); - _snprintf(name, sizeof(name), "Mensch (%s)", itoa36(u->no)); - CuAssertStrEquals(tc, name, unitname(u)); + CuAssertStrEquals(tc, "Mensch (ii)", unitname(u)); CuAssertStrEquals(tc, "Mensch", unit_getname(u)); u->number = 2; - _snprintf(name, sizeof(name), "Menschen (%s)", itoa36(u->no)); - CuAssertStrEquals(tc, name, unitname(u)); + CuAssertStrEquals(tc, "Menschen (ii)", unitname(u)); CuAssertStrEquals(tc, "Menschen", unit_getname(u)); test_cleanup(); diff --git a/src/laws.test.c b/src/laws.test.c index 1bec0e6b4..d4753ec19 100644 --- a/src/laws.test.c +++ b/src/laws.test.c @@ -521,7 +521,6 @@ static void test_pay_cmd_other_building(CuTest *tc) { order *ord; faction *f; building *b; - char cmd[32]; test_setup(); setup_pay_cmd(&fix); @@ -531,8 +530,7 @@ static void test_pay_cmd_other_building(CuTest *tc) { config_set("rules.region_owner_pay_building", "lighthouse"); update_owners(b->region); - _snprintf(cmd, sizeof(cmd), "NOT %s", itoa36(b->no)); - ord = create_order(K_PAY, f->locale, cmd); + ord = create_order(K_PAY, f->locale, "NOT %s", itoa36(b->no)); assert(ord); CuAssertPtrEquals(tc, fix.u1, building_owner(b)); CuAssertIntEquals(tc, 0, pay_cmd(fix.u1, ord));