From c3e1b2afefb76a12a8c21361c15195e05fecfc84 Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Tue, 27 Feb 2018 15:49:57 -0500 Subject: [PATCH] GUACAMOLE-269: Fix minor style issues and update comments. --- src/protocols/ssh/settings.c | 4 ++-- src/protocols/ssh/ttymode.c | 7 +++++-- src/protocols/telnet/settings.c | 3 ++- src/protocols/telnet/settings.h | 6 +++--- src/terminal/terminal.c | 3 ++- src/terminal/terminal/terminal.h | 4 ++-- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/protocols/ssh/settings.c b/src/protocols/ssh/settings.c index 89b6e82b..983f7f08 100644 --- a/src/protocols/ssh/settings.c +++ b/src/protocols/ssh/settings.c @@ -211,8 +211,8 @@ enum SSH_ARGS_IDX { IDX_SERVER_ALIVE_INTERVAL, /** - * The ASCII code, in decimal, to send for the backspace key, as configured - * by the SSH connection from the client. By default this will be 0x7f, + * The ASCII code, as an integer, to send for the backspace key, as configured + * by the SSH connection from the client. By default this will be 127, * the ASCII DELETE code. */ IDX_BACKSPACE, diff --git a/src/protocols/ssh/ttymode.c b/src/protocols/ssh/ttymode.c index 02fb54ba..39830904 100644 --- a/src/protocols/ssh/ttymode.c +++ b/src/protocols/ssh/ttymode.c @@ -36,17 +36,20 @@ guac_ssh_ttymodes* guac_ssh_ttymodes_init() { } void guac_ssh_ttymodes_add(guac_ssh_ttymodes *tty_modes, char opcode, uint32_t value) { + /* Increment number of opcodes */ tty_modes->num_opcodes++; + + /* Increase size of the pointer array */ tty_modes->ttymode_array = realloc(tty_modes->ttymode_array, sizeof(guac_ssh_ttymode) * tty_modes->num_opcodes); + + /* Add new values */ tty_modes->ttymode_array[tty_modes->num_opcodes - 1].opcode = opcode; tty_modes->ttymode_array[tty_modes->num_opcodes - 1].value = value; - } int guac_ssh_ttymodes_size(guac_ssh_ttymodes *tty_modes) { /* Each opcode pair is 5 bytes (1 opcode, 4 value) Add one for the ending opcode */ - return (tty_modes->num_opcodes * 5) + 1; } diff --git a/src/protocols/telnet/settings.c b/src/protocols/telnet/settings.c index acb1f905..b49b773e 100644 --- a/src/protocols/telnet/settings.c +++ b/src/protocols/telnet/settings.c @@ -176,7 +176,8 @@ enum TELNET_ARGS_IDX { IDX_READ_ONLY, /** - * ASCII code to use for the backspace key, or 127 if not specified. + * ASCII code, as an integer to use for the backspace key, or 127 + * if not specified. */ IDX_BACKSPACE, diff --git a/src/protocols/telnet/settings.h b/src/protocols/telnet/settings.h index 71c807a3..9bc3dc37 100644 --- a/src/protocols/telnet/settings.h +++ b/src/protocols/telnet/settings.h @@ -208,9 +208,9 @@ typedef struct guac_telnet_settings { bool recording_include_keys; /** - * The ASCII code, in decimal, that the telnet client will use when the - * backspace key is pressed. By default, this is 0x7f, ASCII delete, - * but can be configured in the client settings. + * The ASCII code, as an integer, that the telnet client will use when the + * backspace key is pressed. By default, this is 127, ASCII delete, if + * not specified in the client settings. */ int backspace; diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c index 70a2640a..c19bd835 100644 --- a/src/terminal/terminal.c +++ b/src/terminal/terminal.c @@ -1598,11 +1598,12 @@ static int __guac_terminal_send_key(guac_terminal* term, int keysym, int pressed /* Non-printable keys */ else { + /* Backspace can vary based on configuration of terminal by client. */ if (keysym == 0xFF08) { char* backspace_str = malloc(sizeof(char) * 2); backspace_str[0] = term->backspace; backspace_str[1] = '\0'; - return guac_terminal_send_string(term, backspace_str); /* Backspace */ + return guac_terminal_send_string(term, backspace_str); } if (keysym == 0xFF09 || keysym == 0xFF89) return guac_terminal_send_string(term, "\x09"); /* Tab */ if (keysym == 0xFF0D || keysym == 0xFF8D) return guac_terminal_send_string(term, "\x0D"); /* Enter */ diff --git a/src/terminal/terminal/terminal.h b/src/terminal/terminal/terminal.h index 90cf06ac..c071b402 100644 --- a/src/terminal/terminal/terminal.h +++ b/src/terminal/terminal/terminal.h @@ -433,7 +433,7 @@ struct guac_terminal { guac_common_clipboard* clipboard; /** - * Hexidecimal ASCII code sent when backspace is pressed. + * ASCII character to send when backspace is pressed. */ char backspace; @@ -470,7 +470,7 @@ struct guac_terminal { * GUAC_TERMINAL_SCHEME_GRAY_BLACK. * * @param backspace - * The decimal ASCII code to send when backspace is pressed in + * The integer ASCII code to send when backspace is pressed in * this terminal. * * @return