]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Fix again u8_COM_StringLengthNoColors returning always 0 if end is NULL (strlennocol...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 25 Sep 2010 08:39:29 +0000 (08:39 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 25 Sep 2010 08:39:29 +0000 (08:39 +0000)
Signed-off-by: terencehill <piuntn@gmail.com>
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10492 d7cf8633-e32d-0410-b094-e92efae38249

utf8lib.c

index 0461672d796688b3bee06f2ab17a2bc058a9067d..268ec7e3e84b75a24c2f61790cb83f8cf0995327 100644 (file)
--- a/utf8lib.c
+++ b/utf8lib.c
@@ -691,7 +691,7 @@ u8_COM_StringLengthNoColors(const char *_s, size_t size_s, qboolean *valid)
 
        for(;;)
        {
-               switch((s >= end) ? 0 : *s)
+               switch((s == end) ? 0 : *s)
                {
                        case 0:
                                if(valid)
@@ -756,7 +756,7 @@ u8_COM_StringLengthNoColors(const char *_s, size_t size_s, qboolean *valid)
                        return len;
                }
 
-               if(s + st + ln >= end)
+               if(end && s + st + ln > end)
                {
                        // string length exceeded by new character
                        if(valid)