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>
(cherry picked from commit 7a010beefe)
This commit is contained in:
Enrico Weigelt, metux IT consult
2024-02-19 13:45:15 +01:00
committed by Alan Coopersmith
parent 2ff89444b7
commit a24bad63f0

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;