[Bug 3318] New: renew Q_IsColorString()

bugzilla-daemon at icculus.org bugzilla-daemon at icculus.org
Fri Aug 17 09:53:14 EDT 2007


http://bugzilla.icculus.org/show_bug.cgi?id=3318

           Summary: renew Q_IsColorString()
           Product: Quake 3
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P3
         Component: Misc
        AssignedTo: zakk at icculus.org
        ReportedBy: devhc97 at gmail.com
         QAContact: quake3-bugzilla at icculus.org


Currently, Q3 defines a color escape codes as a '^' followed by anything except
'\0':
#define Q_IsColorString(p) ( p && *(p) == Q_COLOR_ESCAPE && *((p)+1) &&
*((p)+1) != Q_COLOR_ESCAPE )

I see no reason why ^a, ^b, etc. should be recongized as color escapes (It's
not even consistent throughout platforms). Also, in a message ending with ^,
after which a newline should have been outputted (like any server message, such
as a chat), ^\n is a color code, and not a ^ and a new line (bug!). I think ^1
^2 ^3 ^4 ^5 ^6 ^7 ^8 ^9 and ^0 should be the only color escape codes.

We also shouldn't check wether p is a valid pointer, because we usually
guarantee it, check it and whatsoever, and if we do check p, and
Q_IsColorString doesn't result in crash, then the code after it will.

So my recommended method is:
#define Q_IsColorString(p) ( *(p) == Q_COLOR_ESCAPE && isdigit( *((p)+1) ) )


-- 
Configure bugmail: http://bugzilla.icculus.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.



More information about the quake3-bugzilla mailing list