diff --git a/src/jsonconf.c b/src/jsonconf.c index e04c7690c..f1e781cb0 100644 --- a/src/jsonconf.c +++ b/src/jsonconf.c @@ -1036,12 +1036,14 @@ static int include_po(const char *uri) { const char *filename = uri_to_file(uri, name, sizeof(name)); const char *pos = strstr(filename, ".po"); if (pos) { + size_t len; const char *str = --pos; while (str > filename && *str != '.') --str; - if ((pos - str) < sizeof(lname)) { + len = (size_t)(pos - str); + if (len < sizeof(lname)) { struct locale * lang; - memcpy(lname, str+1, pos - str); - lname[pos - str] = 0; + memcpy(lname, str+1, len); + lname[len] = 0; lang = get_or_create_locale(lname); if (lang) { int err = pofile_read(filename, add_po_string, lang); diff --git a/src/xmlreader.c b/src/xmlreader.c index 1535cb208..b5dd272bd 100644 --- a/src/xmlreader.c +++ b/src/xmlreader.c @@ -83,16 +83,6 @@ static variant xml_fraction(xmlNodePtr node, const char *name) { return frac_make(0, 1); } -static void xml_readtext(xmlNodePtr node, struct locale **lang, xmlChar ** text) -{ - xmlChar *propValue = xmlGetProp(node, BAD_CAST "locale"); - assert(propValue != NULL); - *lang = get_locale((const char *)propValue); - xmlFree(propValue); - - *text = xmlNodeListGetString(node->doc, node->children, 1); -} - static spellref *xml_spellref(xmlNode * node, const char *name) { xmlChar *propValue = xmlGetProp(node, BAD_CAST name); @@ -104,31 +94,6 @@ static spellref *xml_spellref(xmlNode * node, const char *name) return NULL; } -static xmlChar *xml_cleanup_string(xmlChar * str) -{ - xmlChar *read = str; - xmlChar *write = str; - - while (*read) { - /* eat leading whitespace */ - if (*read && isspace(*read)) { - while (*read && isspace(*read)) { - ++read; - } - *write++ = ' '; - } - while (*read) { - if (*read == '\n') - break; - if (*read == '\r') - break; - *write++ = *read++; - } - } - *write = 0; - return str; -} - static resource_mod * xml_readmodifiers(xmlXPathObjectPtr result, xmlNodePtr node) { /* reading eressea/resources/resource/modifier */ if (result->nodesetval != NULL && result->nodesetval->nodeNr > 0) {