Fixing new factions

This commit is contained in:
Enno Rehling 2007-12-09 13:56:13 +00:00
parent e18d5b849d
commit 305942414c
2 changed files with 4 additions and 2 deletions

View file

@ -89,9 +89,10 @@ xml_s(const char * str)
const char * inbuf = str;
unsigned char * outbuf = buffer;
size_t inbytes = strlen(str)+1;
size_t outbytes = sizeof(buffer);
size_t outbytes = sizeof(buffer) - 1;
unicode_latin1_to_utf8(outbuf, &outbytes, (const xmlChar *)inbuf, &inbytes);
buffer[outbytes] = 0;
return buffer;
}

View file

@ -244,9 +244,10 @@ read_newfactions(const char * filename)
nf->race = findrace(race, default_locale);
if (nf->race==NULL) {
char buffer[32];
size_t outbytes = sizeof(buffer);
size_t outbytes = sizeof(buffer) - 1;
size_t inbytes = strlen(race);
unicode_latin1_to_utf8((unsigned char *)buffer, &outbytes, (const unsigned char *)race, &inbytes);
buffer[outbytes] = 0;
nf->race = findrace(buffer, default_locale);
if (nf->race==NULL) {
log_error(("new faction has unknown race '%s'.\n", race));