forked from github/server
bugs found with gcc
This commit is contained in:
parent
857df3f300
commit
13a019335e
|
@ -3284,9 +3284,9 @@ simplename(region * r)
|
|||
{
|
||||
int i;
|
||||
static char name[17];
|
||||
const char * cp = rname(r, NULL);
|
||||
const xmlChar * cp = rname(r, NULL);
|
||||
for (i=0;*cp && i!=16;++i, ++cp) {
|
||||
int c = *(unsigned char*)cp;
|
||||
int c = *cp;
|
||||
while (c && !isalpha(c) && !isspace(c)) {
|
||||
++cp;
|
||||
c = *(unsigned char*)cp;
|
||||
|
|
|
@ -106,6 +106,7 @@ addfaction(const char *email, const xmlChar * password,
|
|||
{
|
||||
faction * f = calloc(sizeof(faction), 1);
|
||||
const char * pass = itoa36(rng_int());
|
||||
char buf[128];
|
||||
|
||||
assert(frace && frace != new_race[RC_ORC]);
|
||||
|
||||
|
@ -135,7 +136,7 @@ addfaction(const char *email, const xmlChar * password,
|
|||
addlist(&factions, f);
|
||||
fhash(f);
|
||||
|
||||
sprintf(buf, "%s %s", LOC(loc, "factiondefault"), factionid(f));
|
||||
snprintf(buf, sizeof(buf), "%s %s", LOC(loc, "factiondefault"), factionid(f));
|
||||
set_string(&f->name, (const xmlChar*)buf);
|
||||
|
||||
return f;
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
|
||||
/* util includes */
|
||||
#include <util/attrib.h>
|
||||
#include <util/bsdstring.h>
|
||||
#include <util/functions.h>
|
||||
#include <util/rng.h>
|
||||
|
||||
|
@ -290,12 +291,12 @@ racename(const struct locale *loc, const unit *u, const race * rc)
|
|||
const char * prefix = raceprefix(u);
|
||||
|
||||
if (prefix!=NULL) {
|
||||
static char lbuf[80];
|
||||
char * s = lbuf;
|
||||
strcpy(lbuf, locale_string(loc, mkname("prefix", prefix)));
|
||||
s += strlen(lbuf);
|
||||
strcpy(s, LOC(loc, rc_name(rc, u->number != 1)));
|
||||
s[0] = (char)tolower(s[0]);
|
||||
static xmlChar lbuf[80];
|
||||
xmlChar * s = lbuf;
|
||||
s += xstrlcpy(lbuf, LOC(loc, mkname("prefix", prefix)), sizeof(lbuf));
|
||||
xstrlcpy(s, LOC(loc, rc_name(rc, u->number != 1)), sizeof(lbuf)-(s-lbuf));
|
||||
assert(s[0]<=0x7F || !"unicode/not implemented");
|
||||
s[0] = (xmlChar)tolower(s[0]);
|
||||
return lbuf;
|
||||
}
|
||||
return LOC(loc, rc_name(rc, u->number != 1));
|
||||
|
|
Loading…
Reference in New Issue