GUACAMOLE-269: Fix up style in comments.
This commit is contained in:
parent
fd58d31eea
commit
9bd28321e5
@ -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;
|
||||
|
||||
|
@ -24,10 +24,10 @@
|
||||
#include <string.h>
|
||||
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user