GUACAMOLE-470: Set palette index for parsed RGB colors.

Parsed RGB colors do not correspond to any palette entry, so set the
palette index to -1.


Project: http://git-wip-us.apache.org/repos/asf/guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-server/commit/7e68901c
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-server/tree/7e68901c
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-server/diff/7e68901c

Branch: refs/heads/master
Commit: 7e68901cebac639f615fc87449cfc5a34e1c582f
Parents: 1bd537c
Author: Jim Chen <nc...@mozilla.com>
Authored: Tue Jan 9 22:08:13 2018 -0500
Committer: Jim Chen <nc...@mozilla.com>
Committed: Sat May 26 23:18:27 2018 -0400

----------------------------------------------------------------------
 src/terminal/xparsecolor.c | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/guacamole-server/blob/7e68901c/src/terminal/xparsecolor.c
----------------------------------------------------------------------
diff --git a/src/terminal/xparsecolor.c b/src/terminal/xparsecolor.c
index 5aa1fd4..779374d 100644
--- a/src/terminal/xparsecolor.c
+++ b/src/terminal/xparsecolor.c
@@ -33,6 +33,7 @@ int guac_terminal_xparsecolor(const char* spec,
 
     /* 12-bit RGB ("rgb:h/h/h"), zero-padded to 24-bit */
     if (sscanf(spec, "rgb:%1x/%1x/%1x", &red, &green, &blue) == 3) {
+        color->palette_index = -1; /* Not from palette. */
         color->red   = red   << 4;
         color->green = green << 4;
         color->blue  = blue  << 4;
@@ -41,6 +42,7 @@ int guac_terminal_xparsecolor(const char* spec,
 
     /* 24-bit RGB ("rgb:hh/hh/hh") */
     if (sscanf(spec, "rgb:%2x/%2x/%2x", &red, &green, &blue) == 3) {
+        color->palette_index = -1; /* Not from palette. */
         color->red   = red;
         color->green = green;
         color->blue  = blue;
@@ -49,6 +51,7 @@ int guac_terminal_xparsecolor(const char* spec,
 
     /* 36-bit RGB ("rgb:hhh/hhh/hhh"), truncated to 24-bit */
     if (sscanf(spec, "rgb:%3x/%3x/%3x", &red, &green, &blue) == 3) {
+        color->palette_index = -1; /* Not from palette. */
         color->red   = red   >> 4;
         color->green = green >> 4;
         color->blue  = blue  >> 4;
@@ -57,6 +60,7 @@ int guac_terminal_xparsecolor(const char* spec,
 
     /* 48-bit RGB ("rgb:hhhh/hhhh/hhhh"), truncated to 24-bit */
     if (sscanf(spec, "rgb:%4x/%4x/%4x", &red, &green, &blue) == 3) {
+        color->palette_index = -1; /* Not from palette. */
         color->red   = red   >> 8;
         color->green = green >> 8;
         color->blue  = blue  >> 8;

Reply via email to