GUACAMOLE-269: Fix minor style issues and update comments.

This commit is contained in:
Nick Couchman 2018-02-27 15:49:57 -05:00
parent 64ca77f3a5
commit c3e1b2afef
6 changed files with 16 additions and 11 deletions

View File

@ -211,8 +211,8 @@ enum SSH_ARGS_IDX {
IDX_SERVER_ALIVE_INTERVAL, IDX_SERVER_ALIVE_INTERVAL,
/** /**
* The ASCII code, in decimal, to send for the backspace key, as configured * 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 0x7f, * by the SSH connection from the client. By default this will be 127,
* the ASCII DELETE code. * the ASCII DELETE code.
*/ */
IDX_BACKSPACE, IDX_BACKSPACE,

View File

@ -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) { void guac_ssh_ttymodes_add(guac_ssh_ttymodes *tty_modes, char opcode, uint32_t value) {
/* Increment number of opcodes */
tty_modes->num_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); 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].opcode = opcode;
tty_modes->ttymode_array[tty_modes->num_opcodes - 1].value = value; tty_modes->ttymode_array[tty_modes->num_opcodes - 1].value = value;
} }
int guac_ssh_ttymodes_size(guac_ssh_ttymodes *tty_modes) { int guac_ssh_ttymodes_size(guac_ssh_ttymodes *tty_modes) {
/* Each opcode pair is 5 bytes (1 opcode, 4 value) /* Each opcode pair is 5 bytes (1 opcode, 4 value)
Add one for the ending opcode */ Add one for the ending opcode */
return (tty_modes->num_opcodes * 5) + 1; return (tty_modes->num_opcodes * 5) + 1;
} }

View File

@ -176,7 +176,8 @@ enum TELNET_ARGS_IDX {
IDX_READ_ONLY, 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, IDX_BACKSPACE,

View File

@ -208,9 +208,9 @@ typedef struct guac_telnet_settings {
bool recording_include_keys; bool recording_include_keys;
/** /**
* The ASCII code, in decimal, that the telnet client will use when the * The ASCII code, as an integer, that the telnet client will use when the
* backspace key is pressed. By default, this is 0x7f, ASCII delete, * backspace key is pressed. By default, this is 127, ASCII delete, if
* but can be configured in the client settings. * not specified in the client settings.
*/ */
int backspace; int backspace;

View File

@ -1598,11 +1598,12 @@ static int __guac_terminal_send_key(guac_terminal* term, int keysym, int pressed
/* Non-printable keys */ /* Non-printable keys */
else { else {
/* Backspace can vary based on configuration of terminal by client. */
if (keysym == 0xFF08) { if (keysym == 0xFF08) {
char* backspace_str = malloc(sizeof(char) * 2); char* backspace_str = malloc(sizeof(char) * 2);
backspace_str[0] = term->backspace; backspace_str[0] = term->backspace;
backspace_str[1] = '\0'; 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 == 0xFF09 || keysym == 0xFF89) return guac_terminal_send_string(term, "\x09"); /* Tab */
if (keysym == 0xFF0D || keysym == 0xFF8D) return guac_terminal_send_string(term, "\x0D"); /* Enter */ if (keysym == 0xFF0D || keysym == 0xFF8D) return guac_terminal_send_string(term, "\x0D"); /* Enter */

View File

@ -433,7 +433,7 @@ struct guac_terminal {
guac_common_clipboard* clipboard; guac_common_clipboard* clipboard;
/** /**
* Hexidecimal ASCII code sent when backspace is pressed. * ASCII character to send when backspace is pressed.
*/ */
char backspace; char backspace;
@ -470,7 +470,7 @@ struct guac_terminal {
* GUAC_TERMINAL_SCHEME_GRAY_BLACK. * GUAC_TERMINAL_SCHEME_GRAY_BLACK.
* *
* @param backspace * @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. * this terminal.
* *
* @return * @return