(add): Use size of struct natstr members nat_cnam and nat_pnam instead
of literals.
This commit is contained in:
parent
717b8e96be
commit
47316b593b
1 changed files with 4 additions and 4 deletions
|
@ -54,8 +54,8 @@ add(void)
|
||||||
struct sctstr sect;
|
struct sctstr sect;
|
||||||
struct nstr_sect nstr;
|
struct nstr_sect nstr;
|
||||||
int i;
|
int i;
|
||||||
s_char cntryname[21];
|
char cntryname[sizeof(natp->nat_cnam)];
|
||||||
s_char pname[21];
|
char pname[sizeof(natp->nat_pnam)];
|
||||||
natid coun;
|
natid coun;
|
||||||
natid freecn;
|
natid freecn;
|
||||||
s_char prompt[128];
|
s_char prompt[128];
|
||||||
|
@ -89,7 +89,7 @@ add(void)
|
||||||
}
|
}
|
||||||
natp = getnatp(coun);
|
natp = getnatp(coun);
|
||||||
while ((p = getstarg(player->argp[2], "Country Name? ", buf)) && *p) {
|
while ((p = getstarg(player->argp[2], "Country Name? ", buf)) && *p) {
|
||||||
if (strlen(p) < 20) {
|
if (strlen(p) < sizeof(cntryname)) {
|
||||||
(void)strcpy(cntryname, p);
|
(void)strcpy(cntryname, p);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ add(void)
|
||||||
if (p == 0 || *p == 0)
|
if (p == 0 || *p == 0)
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
while ((p = getstarg(player->argp[3], "Representative? ", buf)) && *p) {
|
while ((p = getstarg(player->argp[3], "Representative? ", buf)) && *p) {
|
||||||
if (strlen(p) < 20) {
|
if (strlen(p) < sizeof(pname)) {
|
||||||
(void)strcpy(pname, p);
|
(void)strcpy(pname, p);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue