]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - common.c
do not use non-standard strnlen function
[xonotic/darkplaces.git] / common.c
index 70f36e717067dec6a1b40427f4b52f2fbd316026..dcec77eb391d824d905e52da00c72d09af94454c 100644 (file)
--- a/common.c
+++ b/common.c
@@ -740,7 +740,9 @@ int COM_Wordwrap(const char *string, size_t length, float continuationWidth, flo
                                        }
                                }
                                out_inner:
-                               wordChars = strnlen(cursor, wordLen);
+                               wordChars = strlen(cursor);
+                               if (wordChars > wordLen)
+                                       wordChars = wordLen;
                                spaceUsedForWord = wordWidth(passthroughCW, cursor, &wordChars, maxWidth - continuationWidth); // this may have reduced wordLen when it won't fit - but this is GOOD. TODO fix words that do fit in a non-continuation line
                                if(wordChars < 1)
                                {