]> granicus.if.org Git - nethack/commitdiff
Fix resurfacing of "foxen" pluralization bug
authorcopperwater <aosdict@gmail.com>
Sun, 9 Dec 2018 14:51:47 +0000 (09:51 -0500)
committercopperwater <aosdict@gmail.com>
Sun, 9 Dec 2018 14:51:47 +0000 (09:51 -0500)
Inadvertently reintroduced in f9f1236. It was just the conditional
that was bad: due to resolving the possible buffer underflow when
comparing to "muskox", the pluralizer now only adds -es when the length
of the string is greater than 5. So for "box" and "fox" the pluralizer
will never add the -es ending, since they are greater than 5.

This commit checks for "does not end in muskox" correctly.

src/objnam.c

index 7ed8f33fb3a7d0620b3f0ce207ce69853a2fffee..05aade6955302f23206a7120dd13a143be858497 100644 (file)
@@ -2115,7 +2115,7 @@ const char *const *alt_as_is; /* another set like as_is[] */
     /* skip "ox" -> "oxen" entry when pluralizing "<something>ox"
        unless it is muskox */
     if (to_plural && baselen > 2 && !strcmpi(endstring - 2, "ox")
-        && baselen > 5 && strcmpi(endstring - 6, "muskox")) {
+        && !(baselen > 5 && !strcmpi(endstring - 6, "muskox"))) {
         /* "fox" -> "foxes" */
         Strcasecpy(endstring, "es");
         return TRUE;