GUACAMOLE-269: Change struct to struct pointer.

This commit is contained in:
Nick Couchman 2018-02-27 09:59:18 -05:00
parent 33cca46346
commit 64ca77f3a5
3 changed files with 8 additions and 9 deletions

View File

@ -193,7 +193,7 @@ void* ssh_client_thread(void* data) {
} }
/* Initialize a ttymode array */ /* Initialize a ttymode array */
guac_ssh_ttymodes ssh_ttymodes = guac_ssh_ttymodes_init(); guac_ssh_ttymodes* ssh_ttymodes = guac_ssh_ttymodes_init();
/* Set up screen recording, if requested */ /* Set up screen recording, if requested */
if (settings->recording_path != NULL) { if (settings->recording_path != NULL) {
@ -213,7 +213,7 @@ void* ssh_client_thread(void* data) {
settings->color_scheme, settings->backspace); settings->color_scheme, settings->backspace);
/* Add the backspace key to the ttymode array */ /* Add the backspace key to the ttymode array */
guac_ssh_ttymodes_add(&ssh_ttymodes, GUAC_SSH_TTY_OP_VERASE, settings->backspace); guac_ssh_ttymodes_add(ssh_ttymodes, GUAC_SSH_TTY_OP_VERASE, settings->backspace);
/* Fail if terminal init failed */ /* Fail if terminal init failed */
if (ssh_client->term == NULL) { if (ssh_client->term == NULL) {
@ -305,7 +305,7 @@ void* ssh_client_thread(void* data) {
/* Request PTY */ /* Request PTY */
if (libssh2_channel_request_pty_ex(ssh_client->term_channel, "linux", sizeof("linux")-1, if (libssh2_channel_request_pty_ex(ssh_client->term_channel, "linux", sizeof("linux")-1,
guac_ssh_ttymodes_to_array(&ssh_ttymodes), guac_ssh_ttymodes_size(&ssh_ttymodes), guac_ssh_ttymodes_to_array(ssh_ttymodes), guac_ssh_ttymodes_size(ssh_ttymodes),
ssh_client->term->term_width, ssh_client->term->term_height, 0, 0)) { ssh_client->term->term_width, ssh_client->term->term_height, 0, 0)) {
guac_client_abort(client, GUAC_PROTOCOL_STATUS_UPSTREAM_ERROR, "Unable to allocate PTY."); guac_client_abort(client, GUAC_PROTOCOL_STATUS_UPSTREAM_ERROR, "Unable to allocate PTY.");
return NULL; return NULL;

View File

@ -23,15 +23,14 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
guac_ssh_ttymodes guac_ssh_ttymodes_init() { guac_ssh_ttymodes* guac_ssh_ttymodes_init() {
/* Simple allocation for a placeholder */ /* Simple allocation for a placeholder */
guac_ssh_ttymode* ttymode_array = malloc(1); guac_ssh_ttymode* ttymode_array = malloc(1);
/* Set up the initial data structure. */ /* Set up the initial data structure. */
guac_ssh_ttymodes empty_modes = { guac_ssh_ttymodes* empty_modes = malloc(sizeof(guac_ssh_ttymodes));
ttymode_array, empty_modes->ttymode_array = ttymode_array;
0 empty_modes->num_opcodes = 0;
};
return empty_modes; return empty_modes;
} }

View File

@ -62,7 +62,7 @@ typedef struct guac_ssh_ttymodes {
* with a null array of guac_ssh_ttymode and opcodes * with a null array of guac_ssh_ttymode and opcodes
* set to zero. * set to zero.
*/ */
guac_ssh_ttymodes guac_ssh_ttymodes_init(); guac_ssh_ttymodes* guac_ssh_ttymodes_init();
/** /**
* Add an item to the opcode array. This resizes the * Add an item to the opcode array. This resizes the