GUACAMOLE-279: Use guac_terminal_color for color palette assignments.
Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/c53575b1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/c53575b1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/c53575b1 Branch: refs/heads/master Commit: c53575b18c0e2fcd8e03fcd26ec5be20fbc73a49 Parents: eec3607 Author: Michael Jumper <mjum...@apache.org> Authored: Mon Jul 10 21:13:23 2017 -0700 Committer: Michael Jumper <mjum...@apache.org> Committed: Tue Jul 11 08:24:18 2017 -0700 ---------------------------------------------------------------------- src/terminal/display.c | 9 ++++----- src/terminal/terminal/display.h | 20 +++++--------------- 2 files changed, 9 insertions(+), 20 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/c53575b1/src/terminal/display.c ---------------------------------------------------------------------- diff --git a/src/terminal/display.c b/src/terminal/display.c index 90bc6f0..fff61d1 100644 --- a/src/terminal/display.c +++ b/src/terminal/display.c @@ -26,7 +26,6 @@ #include "terminal/types.h" #include <math.h> -#include <stdint.h> #include <stdlib.h> #include <string.h> #include <wchar.h> @@ -333,16 +332,16 @@ void guac_terminal_display_reset_palette(guac_terminal_display* display) { } int guac_terminal_display_assign_color(guac_terminal_display* display, - int index, uint8_t red, uint8_t green, uint8_t blue) { + int index, const guac_terminal_color* color) { /* Assignment fails if out-of-bounds */ if (index < 0 || index > 255) return 1; /* Copy color components */ - display->palette[index].red = red; - display->palette[index].green = green; - display->palette[index].blue = blue; + display->palette[index].red = color->red; + display->palette[index].green = color->green; + display->palette[index].blue = color->blue; /* Color successfully stored */ return 0; http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/c53575b1/src/terminal/terminal/display.h ---------------------------------------------------------------------- diff --git a/src/terminal/terminal/display.h b/src/terminal/terminal/display.h index c843bb8..e51b07f 100644 --- a/src/terminal/terminal/display.h +++ b/src/terminal/terminal/display.h @@ -232,9 +232,8 @@ void guac_terminal_display_free(guac_terminal_display* display); void guac_terminal_display_reset_palette(guac_terminal_display* display); /** - * Replaces the color in the palette at the given index with a new color having - * the given RGB components. If the index is invalid, the assignment is - * ignored. + * Replaces the color in the palette at the given index with the given color. + * If the index is invalid, the assignment is ignored. * * @param display * The display whose palette is being changed. @@ -242,24 +241,15 @@ void guac_terminal_display_reset_palette(guac_terminal_display* display); * @param index * The index of the palette entry to change. * - * @param red - * The red color component of the color to assign to the palette entry - * having the given index. - * - * @param green - * The green color component of the color to assign to the palette entry - * having the given index. - * - * @param blue - * The blue color component of the color to assign to the palette entry - * having the given index. + * @param color + * The color to assign to the palette entry having the given index. * * @returns * Zero if the assignment was successful, non-zero if the assignment * failed. */ int guac_terminal_display_assign_color(guac_terminal_display* display, - int index, uint8_t red, uint8_t green, uint8_t blue); + int index, const guac_terminal_color* color); /** * Retrieves the color within the palette at the given index, if such a color