From 9bd28321e5d4b900765539422a9baae917542d1a Mon Sep 17 00:00:00 2001 From: Nick Couchman Date: Tue, 27 Feb 2018 09:13:01 -0500 Subject: [PATCH] GUACAMOLE-269: Fix up style in comments. --- src/protocols/ssh/settings.h | 2 +- src/protocols/ssh/ttymode.c | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/protocols/ssh/settings.h b/src/protocols/ssh/settings.h index 65f60fa8..175ece93 100644 --- a/src/protocols/ssh/settings.h +++ b/src/protocols/ssh/settings.h @@ -224,7 +224,7 @@ typedef struct guac_ssh_settings { int server_alive_interval; /** - * The decismal ASCII code of the command to send for backspace. + * The integer ASCII code of the command to send for backspace. */ int backspace; diff --git a/src/protocols/ssh/ttymode.c b/src/protocols/ssh/ttymode.c index 286f124f..f1e21d3f 100644 --- a/src/protocols/ssh/ttymode.c +++ b/src/protocols/ssh/ttymode.c @@ -24,10 +24,10 @@ #include guac_ssh_ttymodes init_ttymodes() { - // Simple allocation for a placeholder + /* Simple allocation for a placeholder */ guac_ssh_ttymode* ttymode_array = malloc(1); - // Set up the initial data structure. + /* Set up the initial data structure. */ guac_ssh_ttymodes empty_modes = { ttymode_array, 0 @@ -45,33 +45,35 @@ void add_ttymode(guac_ssh_ttymodes *tty_modes, char opcode, uint32_t value) { } int sizeof_ttymodes(guac_ssh_ttymodes *tty_modes) { - // Each opcode pair is 5 bytes (1 opcode, 4 value) - // Add one for the ending opcode + /* Each opcode pair is 5 bytes (1 opcode, 4 value) + Add one for the ending opcode */ + return (tty_modes->num_opcodes * 5) + 1; } char* ttymodes_to_array(guac_ssh_ttymodes *tty_modes) { - // Total data size should be number of tracked opcodes - // plus one final byte for the TTY_OP_END code. + /* Total data size should be number of tracked opcodes + plus one final byte for the TTY_OP_END code. */ int data_size = (tty_modes->num_opcodes * 5) + 1; char* temp = malloc(data_size); - // Loop through the array based on number of tracked - // opcodes and convert each one. + /* Loop through the array based on number of tracked + opcodes and convert each one. */ for (int i = 0; i < tty_modes->num_opcodes; i++) { int idx = i * 5; uint32_t value = tty_modes->ttymode_array[i].value; - // Opcode goes in first byte. + + /* Opcode goes in first byte. */ temp[idx] = tty_modes->ttymode_array[i].opcode; - // Convert 32-bit int to individual bytes. + /* Convert 32-bit int to individual bytes. */ temp[idx+1] = (value >> 24) & 0xFF; temp[idx+2] = (value >> 16) & 0xFF; temp[idx+3] = (value >> 8) & 0xFF; temp[idx+4] = value & 0xFF; } - // Add the ending opcode + /* Add the ending opcode */ temp[data_size - 1] = GUAC_SSH_TTY_OP_END; return temp;