os: oscolor: fix BuiltinColor field naming

The "name" field doesn't actually hold the color's name, but instead the
offset of the name in the string table block. Thus, fix the field's name
to reflect this.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1313>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-02-19 13:45:15 +01:00 committed by Marge Bot
parent fdf483d862
commit 7a010beefe

View File

@ -56,7 +56,7 @@ typedef struct _builtinColor {
unsigned char red;
unsigned char green;
unsigned char blue;
unsigned short name;
unsigned short name_offs;
} BuiltinColor;
static const char BuiltinColorNames[] = {
@ -1645,8 +1645,8 @@ OsLookupColor(int screen,
while (high >= low) {
mid = (low + high) / 2;
c = &BuiltinColors[mid];
r = strncasecmp(&BuiltinColorNames[c->name], name, len);
if (r == 0 && len == strlen(&BuiltinColorNames[c->name])) {
r = strncasecmp(&BuiltinColorNames[c->name_offs], name, len);
if (r == 0 && len == strlen(&BuiltinColorNames[c->name_offs])) {
*pred = c->red * 0x101;
*pgreen = c->green * 0x101;
*pblue = c->blue * 0x101;