]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix two bugs in handling of invalid ^xRGB codes
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 30 Dec 2008 08:30:17 +0000 (08:30 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 30 Dec 2008 08:30:17 +0000 (08:30 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8615 d7cf8633-e32d-0410-b094-e92efae38249

common.c
console.c

index aac01fba3709b022bdb7ce0b2c8dc1a6ec4a9f3b..18affb8da16a901582a6d95c2345dbb21fc0f65e 100644 (file)
--- a/common.c
+++ b/common.c
@@ -1835,7 +1835,7 @@ for example).
 
 If the output buffer size did not suffice for converting, the function returns
 FALSE. Generally, if escape_carets is false, the output buffer needs
-strlen(str)+1 bytes, and if escape_carets is true, it can need strlen(str)+2
+strlen(str)+1 bytes, and if escape_carets is true, it can need strlen(str)*1.5+2
 bytes. In any case, the function makes sure that the resulting string is
 zero terminated.
 
@@ -1869,6 +1869,11 @@ COM_StringDecolorize(const char *in, size_t size_in, char *out, size_t size_out,
                                                        in+=3;
                                                        break;
                                                }
+                                               APPEND(STRING_COLOR_TAG);
+                                               if(escape_carets)
+                                                       APPEND(STRING_COLOR_TAG);
+                                               APPEND(STRING_COLOR_RGB_DEFAULT);
+                                               break;
                                        /*case 'a':
                                                if ( in+1 != end && ( isxdigit(in[1]) || (in[1] == '+' || in[1] == '-') ) )
                                                {
index 421e0379afc343a79943e8fe68359fcb8949555a..4d9b71b8cca0a79804ab1e25440afd0a6cb86571 100644 (file)
--- a/console.c
+++ b/console.c
@@ -1167,6 +1167,10 @@ void Con_Print(const char *msg)
                                                                                        in+=4;
                                                                                        break;
                                                                                }
+                                                                               *out++ = STRING_COLOR_TAG;
+                                                                               *out++ = STRING_COLOR_RGB_DEFAULT;
+                                                                               ++in;
+                                                                               break;
                                                                        /*case 'a':
                                                                                if ( isxdigit(in[2]) || in[2] == '+' || in[2] == '-' )
                                                                                {
@@ -2344,11 +2348,13 @@ int Nicks_AddLastColor(char *buffer, int pos)
                                else if(buffer[match+1] == STRING_COLOR_RGB_DEFAULT)
                                {
                                        if ( isxdigit(buffer[match+2]) && isxdigit(buffer[match+3]) && isxdigit(buffer[match+4]) )
+                                       {
                                                r = buffer[match+2];
                                                g = buffer[match+3];
                                                b = buffer[match+4];
                                                color = -1;
                                                break;
+                                       }
                                }
                        }
                }