mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
Remove -O2, check rfbInitClient return value, provide return value in client init
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
CFLAGS+=-O2 -fPIC -pedantic -Wall -Werror -Iinclude
|
CFLAGS+= -fPIC -pedantic -Wall -Werror -Iinclude
|
||||||
LDFLAGS=-lpng -luuid
|
LDFLAGS=-lpng -luuid
|
||||||
|
|
||||||
.PHONY: clean doc
|
.PHONY: clean doc
|
||||||
|
@@ -104,7 +104,9 @@ guac_client* guac_get_client(int client_fd, guac_client_registry* registry, guac
|
|||||||
guac_flush(client->io);
|
guac_flush(client->io);
|
||||||
}
|
}
|
||||||
|
|
||||||
client_init(client, argc, scratch_argv);
|
if (client_init(client, argc, scratch_argv) != 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -79,7 +79,7 @@ struct guac_client {
|
|||||||
* @code
|
* @code
|
||||||
* void handle_messages(guac_client* client);
|
* void handle_messages(guac_client* client);
|
||||||
*
|
*
|
||||||
* void guac_client_init(guac_client* client, int argc, char** argv) {
|
* int guac_client_init(guac_client* client, int argc, char** argv) {
|
||||||
* client->handle_messages = handle_messages;
|
* client->handle_messages = handle_messages;
|
||||||
* }
|
* }
|
||||||
* @endcode
|
* @endcode
|
||||||
@@ -106,7 +106,7 @@ struct guac_client {
|
|||||||
* @code
|
* @code
|
||||||
* void mouse_handler(guac_client* client, int x, int y, int button_mask);
|
* void mouse_handler(guac_client* client, int x, int y, int button_mask);
|
||||||
*
|
*
|
||||||
* void guac_client_init(guac_client* client, int argc, char** argv) {
|
* int guac_client_init(guac_client* client, int argc, char** argv) {
|
||||||
* client->mouse_handler = mouse_handler;
|
* client->mouse_handler = mouse_handler;
|
||||||
* }
|
* }
|
||||||
* @endcode
|
* @endcode
|
||||||
@@ -124,7 +124,7 @@ struct guac_client {
|
|||||||
* @code
|
* @code
|
||||||
* void key_handler(guac_client* client, int keysym, int pressed);
|
* void key_handler(guac_client* client, int keysym, int pressed);
|
||||||
*
|
*
|
||||||
* void guac_client_init(guac_client* client, int argc, char** argv) {
|
* int guac_client_init(guac_client* client, int argc, char** argv) {
|
||||||
* client->key_handler = key_handler;
|
* client->key_handler = key_handler;
|
||||||
* }
|
* }
|
||||||
* @endcode
|
* @endcode
|
||||||
@@ -145,7 +145,7 @@ struct guac_client {
|
|||||||
* @code
|
* @code
|
||||||
* void clipboard_handler(guac_client* client, char* copied);
|
* void clipboard_handler(guac_client* client, char* copied);
|
||||||
*
|
*
|
||||||
* void guac_client_init(guac_client* client, int argc, char** argv) {
|
* int guac_client_init(guac_client* client, int argc, char** argv) {
|
||||||
* client->clipboard_handler = clipboard_handler;
|
* client->clipboard_handler = clipboard_handler;
|
||||||
* }
|
* }
|
||||||
* @endcode
|
* @endcode
|
||||||
@@ -165,7 +165,7 @@ struct guac_client {
|
|||||||
* @code
|
* @code
|
||||||
* void free_handler(guac_client* client);
|
* void free_handler(guac_client* client);
|
||||||
*
|
*
|
||||||
* void guac_client_init(guac_client* client, int argc, char** argv) {
|
* int guac_client_init(guac_client* client, int argc, char** argv) {
|
||||||
* client->free_handler = free_handler;
|
* client->free_handler = free_handler;
|
||||||
* }
|
* }
|
||||||
* @endcode
|
* @endcode
|
||||||
@@ -174,7 +174,7 @@ struct guac_client {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef void guac_client_init_handler(guac_client* client, int argc, char** argv);
|
typedef int guac_client_init_handler(guac_client* client, int argc, char** argv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize and return a new guac_client using the specified client init handler (guac_client_init_handler).
|
* Initialize and return a new guac_client using the specified client init handler (guac_client_init_handler).
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
CFLAGS+=-O2 -pedantic -Wall -Werror -I../libguac/include
|
CFLAGS+= -pedantic -Wall -Werror -I../libguac/include
|
||||||
LDFLAGS=-L../libguac -lpng -lguac -ldl -lpthread
|
LDFLAGS=-L../libguac -lpng -lguac -ldl -lpthread
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
@@ -53,6 +53,12 @@ void* start_client_thread(void* data) {
|
|||||||
|
|
||||||
/* Load and start client */
|
/* Load and start client */
|
||||||
client = guac_get_client(thread_data->fd, thread_data->registry, thread_data->client_init, thread_data->argc, thread_data->argv);
|
client = guac_get_client(thread_data->fd, thread_data->registry, thread_data->client_init, thread_data->argc, thread_data->argv);
|
||||||
|
|
||||||
|
if (client == NULL) {
|
||||||
|
syslog(LOG_ERR, "Client retrieval failed");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
guac_start_client(client);
|
guac_start_client(client);
|
||||||
|
|
||||||
/* FIXME: Need to free client, but only if the client is not
|
/* FIXME: Need to free client, but only if the client is not
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
CFLAGS+=-O2 -fPIC -pedantic -Wall -Werror -I../libguac/include
|
CFLAGS+= -fPIC -pedantic -Wall -Werror -I../libguac/include
|
||||||
LDFLAGS=-L../libguac -lpng -lguac -lvncclient
|
LDFLAGS=-L../libguac -lpng -lguac -lvncclient
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
|
@@ -101,6 +101,8 @@ void guac_vnc_cursor(rfbClient* client, int x, int y, int w, int h, int bpp) {
|
|||||||
guac_send_cursor(io, x, y, png_buffer, w, h);
|
guac_send_cursor(io, x, y, png_buffer, w, h);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void guac_vnc_update(rfbClient* client, int x, int y, int w, int h) {
|
void guac_vnc_update(rfbClient* client, int x, int y, int w, int h) {
|
||||||
|
|
||||||
int dx, dy;
|
int dx, dy;
|
||||||
@@ -264,7 +266,7 @@ void vnc_guac_client_free_handler(guac_client* client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void guac_client_init(guac_client* client, int argc, char** argv) {
|
int guac_client_init(guac_client* client, int argc, char** argv) {
|
||||||
|
|
||||||
char* hostname_copy;
|
char* hostname_copy;
|
||||||
|
|
||||||
@@ -299,7 +301,9 @@ void guac_client_init(guac_client* client, int argc, char** argv) {
|
|||||||
rfb_client->serverHost = hostname_copy;
|
rfb_client->serverHost = hostname_copy;
|
||||||
rfb_client->serverPort = atoi(argv[1]);
|
rfb_client->serverPort = atoi(argv[1]);
|
||||||
|
|
||||||
rfbInitClient(rfb_client, NULL, NULL);
|
if (!rfbInitClient(rfb_client, NULL, NULL)) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Allocate buffers */
|
/* Allocate buffers */
|
||||||
png_buffer = guac_alloc_png_buffer(rfb_client->width, rfb_client->height, 3); /* No-alpha */
|
png_buffer = guac_alloc_png_buffer(rfb_client->width, rfb_client->height, 3); /* No-alpha */
|
||||||
@@ -328,5 +332,7 @@ void guac_client_init(guac_client* client, int argc, char** argv) {
|
|||||||
/* Send size */
|
/* Send size */
|
||||||
guac_send_size(client->io, rfb_client->width, rfb_client->height);
|
guac_send_size(client->io, rfb_client->width, rfb_client->height);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user