summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy White <jwhite@codeweavers.com>2020-04-20 14:48:20 -0500
committerFrediano Ziglio <freddy77@gmail.com>2020-04-21 15:57:28 +0100
commit8e22084f66a698a4790ce1fbef7485f314b07055 (patch)
tree8f886b8b0e0465c06feaff0ae2996aab1f1c58ce
parent54e08ccc090d7628007ea35feae1b953c3d29679 (diff)
Apply style to the main source tree.
Acked-by: Frediano Ziglio <fziglio@redhat.com>
-rwxr-xr-xdoc/spice_indent5
-rw-r--r--src/agent.c56
-rw-r--r--src/display.c8
-rw-r--r--src/display.h2
-rw-r--r--src/gui.c14
-rw-r--r--src/listen.c8
-rw-r--r--src/options.c181
-rw-r--r--src/options.h2
-rw-r--r--src/scan.c33
-rw-r--r--src/session.c57
-rw-r--r--src/spice.c39
11 files changed, 197 insertions, 208 deletions
diff --git a/doc/spice_indent b/doc/spice_indent
index 9fc0cec..f582bc8 100755
--- a/doc/spice_indent
+++ b/doc/spice_indent
@@ -45,6 +45,8 @@ indent \
--space-after-casts \
--space-after-if \
--cuddle-else \
+ -cd0 \
+ -c0 \
-T agent_t \
-T SpiceCharDeviceInstance \
-T SpiceChannelEventInfo \
@@ -83,4 +85,7 @@ indent \
-T test_t \
-T Bool \
-T shm_segment_t \
+ -T GtkWidget \
+ -T ssl_options_t \
+ -T GAsyncQueue \
"$@"
diff --git a/src/agent.c b/src/agent.c
index 82d1828..05c14dd 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -42,15 +42,15 @@ static void uinput_handle_key(agent_t *agent, struct input_event *ev)
int button = 0;
switch (ev->code) {
- case BTN_LEFT:
- button = 1 << 0;
- break;
- case BTN_MIDDLE:
- button = 1 << 2;
- break;
- case BTN_RIGHT:
- button = 1 << 1;
- break;
+ case BTN_LEFT:
+ button = 1 << 0;
+ break;
+ case BTN_MIDDLE:
+ button = 1 << 2;
+ break;
+ case BTN_RIGHT:
+ button = 1 << 1;
+ break;
}
if (ev->value > 0)
@@ -78,16 +78,16 @@ static void uinput_handle_relative(agent_t *agent, struct input_event *ev)
static void uinput_handle_absolute(agent_t *agent, struct input_event *ev)
{
switch (ev->code) {
- case ABS_X:
- agent->uinput_x = ev->value;
- break;
- case ABS_Y:
- agent->uinput_y = ev->value;
- break;
- default:
- g_debug("%s: unknown axis %d, ignoring\n", __func__, ev->code);
- return;
- break;
+ case ABS_X:
+ agent->uinput_x = ev->value;
+ break;
+ case ABS_Y:
+ agent->uinput_y = ev->value;
+ break;
+ default:
+ g_debug("%s: unknown axis %d, ignoring\n", __func__, ev->code);
+ return;
+ break;
}
session_handle_mouse_position(agent->spice->session, agent->uinput_x, agent->uinput_y,
agent->uinput_buttons_state);
@@ -117,17 +117,17 @@ static void uinput_read_cb(int fd G_GNUC_UNUSED, int event G_GNUC_UNUSED, void *
memmove(agent->uinput_buffer, agent->uinput_buffer + sizeof(*ev), agent->uinput_offset);
switch (ev->type) {
- case EV_KEY:
- uinput_handle_key(agent, ev);
- break;
+ case EV_KEY:
+ uinput_handle_key(agent, ev);
+ break;
- case EV_REL:
- uinput_handle_relative(agent, ev);
- break;
+ case EV_REL:
+ uinput_handle_relative(agent, ev);
+ break;
- case EV_ABS:
- uinput_handle_absolute(agent, ev);
- break;
+ case EV_ABS:
+ uinput_handle_absolute(agent, ev);
+ break;
}
}
diff --git a/src/display.c b/src/display.c
index 2b1204b..f296aef 100644
--- a/src/display.c
+++ b/src/display.c
@@ -91,7 +91,7 @@ static void handle_cursor_notify(display_t *display,
ir = xcb_xfixes_get_cursor_image_reply(display->c, icookie, &error);
if (error) {
g_warning("Could not get cursor_image_reply; type %d; code %d; major %d; minor %d\n",
- error->response_type, error->error_code, error->major_code, error->minor_code);
+ error->response_type, error->error_code, error->major_code, error->minor_code);
return;
}
@@ -149,8 +149,7 @@ static void handle_damage_notify(display_t *display, xcb_damage_notify_event_t *
scanner_push(&display->session->scanner, DAMAGE_SCAN_REPORT,
p[i].x1, p[i].y1, p[i].x2 - p[i].x1, p[i].y2 - p[i].y1);
} else {
- scanner_push(&display->session->scanner, PERIODIC_SCAN_REQUEST,
- 0, 0, 0, 0);
+ scanner_push(&display->session->scanner, PERIODIC_SCAN_REQUEST, 0, 0, 0, 0);
}
pixman_region_clear(damage_region);
@@ -523,7 +522,7 @@ shm_image_t *create_shm_image(display_t *d, unsigned int w, unsigned int h)
error = xcb_request_check(d->c, cookie);
if (error) {
g_warning("Could not attach; type %d; code %d; major %d; minor %d\n",
- error->response_type, error->error_code, error->major_code, error->minor_code);
+ error->response_type, error->error_code, error->major_code, error->minor_code);
return NULL;
}
@@ -573,7 +572,6 @@ int display_find_changed_tiles(display_t *d, int row, int *tiles, int tiles_acro
}
}
}
-
#if defined(DEBUG_SCANLINES)
fprintf(stderr, "%d: ", row);
for (i = 0; i < tiles_across; i++)
diff --git a/src/display.h b/src/display.h
index ecf0655..75e83aa 100644
--- a/src/display.h
+++ b/src/display.h
@@ -32,7 +32,7 @@ struct session_struct;
** Structure definitions
**--------------------------------------------------------------------------*/
typedef struct {
- int shmid; /* if shmid is -1: the shm_segment_t is "empty", other members are undefined */
+ int shmid; /* if shmid is -1: the shm_segment_t is "empty", other members are undefined */
size_t size;
xcb_shm_seg_t shmseg;
void *shmaddr;
diff --git a/src/gui.c b/src/gui.c
index 3c26b86..744f5d1 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -56,7 +56,7 @@ void gui_remote_disconnected(gui_t *gui)
void gui_disconnect_clicked(GtkWidget *widget G_GNUC_UNUSED, gpointer data)
{
- gui_t *gui = (gui_t *)data;
+ gui_t *gui = (gui_t *) data;
session_disconnect_client(gui->session);
}
@@ -127,14 +127,12 @@ void gui_report_error(gui_t *gui, const char *message)
{
GtkWidget *dialog;
- dialog = gtk_message_dialog_new (GTK_WINDOW(gui->window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- message);
+ dialog = gtk_message_dialog_new(GTK_WINDOW(gui->window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, message);
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(dialog);
}
#if defined(GUI_MAIN)
diff --git a/src/listen.c b/src/listen.c
index 76c0798..3ca6906 100644
--- a/src/listen.c
+++ b/src/listen.c
@@ -157,10 +157,10 @@ static int try_port(const char *addr, int port)
close(sock);
/*
- ** Oddly, you seem to get situations where the ipv6 bind will fail,
- ** with address in use; you can then try again and bind to the ipv4,
- ** but you then go on to get other failures.
- */
+ ** Oddly, you seem to get situations where the ipv6 bind will fail,
+ ** with address in use; you can then try again and bind to the ipv4,
+ ** but you then go on to get other failures.
+ */
break;
}
diff --git a/src/options.c b/src/options.c
index fb5f1b2..41bddb8 100644
--- a/src/options.c
+++ b/src/options.c
@@ -83,7 +83,8 @@ void options_free(options_t *options)
}
-static void string_option(gchar **dest, GKeyFile *u, GKeyFile *s, const gchar *section, const gchar *key)
+static void string_option(gchar **dest, GKeyFile *u, GKeyFile *s, const gchar *section,
+ const gchar *key)
{
gchar *ret = NULL;
GError *error = NULL;
@@ -171,29 +172,29 @@ static int options_handle_ssl(options_t *options, const char *spec)
if (strlen(p) == 0)
continue;
- switch(i) {
- case 0:
- str_replace(&options->ssl.ca_cert_file, p);
- break;
- case 1:
- str_replace(&options->ssl.certs_file, p);
- break;
- case 2:
- str_replace(&options->ssl.private_key_file, p);
- break;
- case 3:
- str_replace(&options->ssl.key_password, p);
- break;
- case 4:
- str_replace(&options->ssl.dh_key_file, p);
- break;
- case 5:
- str_replace(&options->ssl.ciphersuite, p);
- break;
- default:
- fprintf(stderr, "Error: invalid ssl specification.");
- rc = X11SPICE_ERR_BADARGS;
- break;
+ switch (i) {
+ case 0:
+ str_replace(&options->ssl.ca_cert_file, p);
+ break;
+ case 1:
+ str_replace(&options->ssl.certs_file, p);
+ break;
+ case 2:
+ str_replace(&options->ssl.private_key_file, p);
+ break;
+ case 3:
+ str_replace(&options->ssl.key_password, p);
+ break;
+ case 4:
+ str_replace(&options->ssl.dh_key_file, p);
+ break;
+ case 5:
+ str_replace(&options->ssl.ciphersuite, p);
+ break;
+ default:
+ fprintf(stderr, "Error: invalid ssl specification.");
+ rc = X11SPICE_ERR_BADARGS;
+ break;
}
}
@@ -202,7 +203,7 @@ static int options_handle_ssl(options_t *options, const char *spec)
}
static void options_handle_ssl_file_options(options_t *options,
- GKeyFile *userkey, GKeyFile *systemkey)
+ GKeyFile *userkey, GKeyFile *systemkey)
{
options->ssl.enabled = bool_option(userkey, systemkey, "ssl", "enabled");
string_option(&options->ssl.ca_cert_file, userkey, systemkey, "ssl", "ca-cert-file");
@@ -218,13 +219,14 @@ static int options_parse_arguments(int argc, char *argv[], options_t *options)
int rc;
int longindex = 0;
- enum option_types { OPTION_ALLOW_CONTROL, OPTION_DISALLOW_CONTROL,
- OPTION_TIMEOUT, OPTION_AUTO, OPTION_HIDE,
- OPTION_PASSWORD, OPTION_PASSWORD_FILE, OPTION_CONFIG, OPTION_SSL,
- OPTION_GENERATE_PASSWORD, OPTION_DISPLAY, OPTION_MINIMIZE,
- OPTION_HELP
+ enum option_types { OPTION_ALLOW_CONTROL, OPTION_DISALLOW_CONTROL,
+ OPTION_TIMEOUT, OPTION_AUTO, OPTION_HIDE,
+ OPTION_PASSWORD, OPTION_PASSWORD_FILE, OPTION_CONFIG, OPTION_SSL,
+ OPTION_GENERATE_PASSWORD, OPTION_DISPLAY, OPTION_MINIMIZE,
+ OPTION_HELP
};
+ /* *INDENT-OFF* - Prevent indent from shifting style on us */
static struct option long_options[] =
{
{"allow-control", 0, 0, OPTION_ALLOW_CONTROL },
@@ -242,6 +244,7 @@ static int options_parse_arguments(int argc, char *argv[], options_t *options)
{"help", 0, 0, OPTION_HELP},
{0, 0, 0, 0}
};
+ /* *INDENT-ON* */
optind = 1; /* Allow reuse of this function */
while (1) {
@@ -252,60 +255,60 @@ static int options_parse_arguments(int argc, char *argv[], options_t *options)
}
switch (rc) {
- case OPTION_ALLOW_CONTROL:
- options->allow_control = 1;
- break;
-
- case OPTION_DISALLOW_CONTROL:
- options->allow_control = 0;
- break;
-
- case OPTION_TIMEOUT:
- options->timeout = atol(optarg);
- break;
-
- case OPTION_HIDE:
- options->hide = 1;
- break;
-
- case OPTION_PASSWORD:
- str_replace(&options->spice_password, optarg);
- break;
-
- case OPTION_PASSWORD_FILE:
- str_replace(&options->password_file, optarg);
- break;
-
- case OPTION_CONFIG:
- str_replace(&options->user_config_file, optarg);
- break;
-
- case OPTION_SSL:
- options->ssl.enabled = 1;
- if (optarg) {
- rc = options_handle_ssl(options, optarg);
- if (rc)
- return rc;
- }
- break;
-
- case OPTION_GENERATE_PASSWORD:
- options->generate_password = DEFAULT_PASSWORD_LENGTH;
- if (optarg)
- options->generate_password = atol(optarg);
- break;
-
- case OPTION_DISPLAY:
- str_replace(&options->display, optarg);
- break;
-
- case OPTION_MINIMIZE:
- options->minimize = 1;
- break;
-
- default:
- usage(argv[0]);
- return X11SPICE_ERR_BADARGS;
+ case OPTION_ALLOW_CONTROL:
+ options->allow_control = 1;
+ break;
+
+ case OPTION_DISALLOW_CONTROL:
+ options->allow_control = 0;
+ break;
+
+ case OPTION_TIMEOUT:
+ options->timeout = atol(optarg);
+ break;
+
+ case OPTION_HIDE:
+ options->hide = 1;
+ break;
+
+ case OPTION_PASSWORD:
+ str_replace(&options->spice_password, optarg);
+ break;
+
+ case OPTION_PASSWORD_FILE:
+ str_replace(&options->password_file, optarg);
+ break;
+
+ case OPTION_CONFIG:
+ str_replace(&options->user_config_file, optarg);
+ break;
+
+ case OPTION_SSL:
+ options->ssl.enabled = 1;
+ if (optarg) {
+ rc = options_handle_ssl(options, optarg);
+ if (rc)
+ return rc;
+ }
+ break;
+
+ case OPTION_GENERATE_PASSWORD:
+ options->generate_password = DEFAULT_PASSWORD_LENGTH;
+ if (optarg)
+ options->generate_password = atol(optarg);
+ break;
+
+ case OPTION_DISPLAY:
+ str_replace(&options->display, optarg);
+ break;
+
+ case OPTION_MINIMIZE:
+ options->minimize = 1;
+ break;
+
+ default:
+ usage(argv[0]);
+ return X11SPICE_ERR_BADARGS;
}
}
@@ -317,7 +320,7 @@ static int options_parse_arguments(int argc, char *argv[], options_t *options)
count += options->generate_password ? 1 : 0;
if (count > 1) {
fprintf(stderr, "Error: you can specify only one of password, password-file, "
- "and generate-password\n");
+ "and generate-password\n");
rc = X11SPICE_ERR_BADARGS;
}
}
@@ -348,7 +351,8 @@ static void options_from_config(options_t *options)
int config_file_given = options->user_config_file ? TRUE : FALSE;
if (!config_file_given) {
- options->user_config_file = g_build_filename(g_get_user_config_dir(), "x11spice/x11spice.conf", NULL);
+ options->user_config_file =
+ g_build_filename(g_get_user_config_dir(), "x11spice/x11spice.conf", NULL);
systemkey = g_key_file_new();
if (!g_key_file_load_from_dirs(systemkey, "x11spice/x11spice.conf",
@@ -419,8 +423,7 @@ static int process_password_file(options_t *options)
printf("Enter password: ");
fflush(stdout);
fp = stdin;
- }
- else {
+ } else {
fp = fopen(options->password_file, "r");
if (!fp)
return X11SPICE_ERR_OPEN;
@@ -496,7 +499,7 @@ int options_load(options_t *options, int argc, char *argv[])
if (rc == 0) {
options_from_config(options);
/* We parse command line arguments a second time to ensure
- ** that command line options take precedence over config files */
+ ** that command line options take precedence over config files */
rc = options_parse_arguments(argc, argv, options);
if (rc == 0)
rc = options_process_io(options);
diff --git a/src/options.h b/src/options.h
index ecd934d..19e22e4 100644
--- a/src/options.h
+++ b/src/options.h
@@ -30,7 +30,7 @@
** Structure definitions
**--------------------------------------------------------------------------*/
typedef struct {
- int enabled;
+ int enabled;
char *ca_cert_file;
char *certs_file;
char *private_key_file;
diff --git a/src/scan.c b/src/scan.c
index 52493c3..a516021 100644
--- a/src/scan.c
+++ b/src/scan.c
@@ -147,16 +147,14 @@ static void handle_scan_report(session_t *session, scan_report_t *r)
g_async_queue_push(session->draw_queue, drawable);
spice_qxl_wakeup(&session->spice.display_sin);
/*
- ** NOTE: the shmi is intentionally not freed at this point.
- ** The call path will take care of that once it's been
- ** pushed to Spice.
- */
+ ** NOTE: the shmi is intentionally not freed at this point.
+ ** The call path will take care of that once it's been
+ ** pushed to Spice.
+ */
return;
- }
- else
+ } else
g_debug("Unexpected failure to create drawable");
- }
- else
+ } else
g_debug("Unexpected failure to read shm of area %dx%d", r->w, r->h);
if (shmi)
@@ -197,8 +195,7 @@ static void push_tiles_report(scanner_t *scanner, int start_row, int start_col,
static void grow_changed_tiles(scanner_t *scanner G_GNUC_UNUSED,
int *tiles_changed_in_row,
- int tiles_changed[][NUM_HORIZONTAL_TILES],
- int num_vertical_tiles)
+ int tiles_changed[][NUM_HORIZONTAL_TILES], int num_vertical_tiles)
{
int i;
int j;
@@ -242,7 +239,8 @@ static void grow_changed_tiles(scanner_t *scanner G_GNUC_UNUSED,
}
}
-static void push_changes_across_rows(scanner_t *scanner, int *tiles_changed_in_row, int num_vertical_tiles)
+static void push_changes_across_rows(scanner_t *scanner, int *tiles_changed_in_row,
+ int num_vertical_tiles)
{
int i = 0;
int start_row = -1;
@@ -253,8 +251,7 @@ static void push_changes_across_rows(scanner_t *scanner, int *tiles_changed_in_r
if (start_row == -1)
start_row = i;
current_row = i;
- }
- else {
+ } else {
if (current_row != -1) {
push_tiles_report(scanner, start_row, 0, current_row, NUM_HORIZONTAL_TILES - 1);
start_row = current_row = -1;
@@ -291,8 +288,7 @@ static void push_changes_in_one_row(scanner_t *scanner, int row, int *tiles_chan
}
static void push_changed_tiles(scanner_t *scanner, int *tiles_changed_in_row,
- int tiles_changed[][NUM_HORIZONTAL_TILES],
- int num_vertical_tiles)
+ int tiles_changed[][NUM_HORIZONTAL_TILES], int num_vertical_tiles)
{
int i = 0;
@@ -456,19 +452,16 @@ int scanner_push(scanner_t *scanner, scan_type_t type, int x, int y, int w, int
pixman_region_union_rect(&scanner->region, &scanner->region, x, y, w, h);
g_async_queue_push(scanner->queue, r);
- }
- else {
+ } else {
free(r);
}
rc = 0;
- }
- else {
+ } else {
free(r);
rc = X11SPICE_ERR_SHUTTING_DOWN;
}
g_mutex_unlock(scanner->lock);
}
-
#if defined(DEBUG_SCANLINES)
fprintf(stderr, "scan: type %d, %dx%d @ %dx%d\n", type, w, h, x, y);
fflush(stderr);
diff --git a/src/session.c b/src/session.c
index bdd550d..7909787 100644
--- a/src/session.c
+++ b/src/session.c
@@ -129,7 +129,7 @@ int session_cursor_waiting(session_t *session)
void session_handle_key(session_t *session, uint8_t keycode, int is_press)
{
- if (! session->options.allow_control)
+ if (!session->options.allow_control)
return;
xcb_test_fake_input(session->display.c, is_press ? XCB_KEY_PRESS : XCB_KEY_RELEASE,
@@ -141,7 +141,7 @@ void session_handle_key(session_t *session, uint8_t keycode, int is_press)
void session_handle_mouse_position(session_t *session, int x, int y,
uint32_t buttons_state G_GNUC_UNUSED)
{
- if (! session->options.allow_control)
+ if (!session->options.allow_control)
return;
xcb_test_fake_input(session->display.c, XCB_MOTION_NOTIFY, 0, XCB_CURRENT_TIME,
@@ -153,7 +153,7 @@ void session_handle_mouse_position(session_t *session, int x, int y,
static void session_handle_button_change(session_t *s, uint32_t buttons_state)
{
int i;
- if (! s->options.allow_control)
+ if (!s->options.allow_control)
return;
for (i = 0; i < BUTTONS; i++) {
@@ -176,7 +176,7 @@ static uint32_t convert_spice_buttons(int wheel, uint32_t buttons_state)
(buttons_state & ~(SPICE_MOUSE_BUTTON_MASK_LEFT | SPICE_MOUSE_BUTTON_MASK_MIDDLE
| SPICE_MOUSE_BUTTON_MASK_RIGHT));
return buttons_state | (wheel > 0 ? (1 << 4) : 0)
- | (wheel < 0 ? (1 << 3) : 0);
+ | (wheel < 0 ? (1 << 3) : 0);
}
@@ -258,19 +258,15 @@ static int begin_audit(session_t *s)
int rc = X11SPICE_ERR_NOAUDIT;
#if defined(HAVE_LIBAUDIT) && defined(HAVE_LIBAUDIT_H)
s->audit_id = audit_open();
- if (s->audit_id != -1)
- {
+ if (s->audit_id != -1) {
rc = audit_log_user_message(s->audit_id, s->options.audit_message_type,
- "x11spice begin", NULL, NULL, NULL, 1);
- if (rc <= 0)
- {
+ "x11spice begin", NULL, NULL, NULL, 1);
+ if (rc <= 0) {
perror("audit_log_user_message");
rc = X11SPICE_ERR_NOAUDIT;
- }
- else
+ } else
rc = 0;
- }
- else
+ } else
perror("audit_open");
#else
fprintf(stderr, "Error: audit requested, but not libaudit available.\n");
@@ -281,10 +277,9 @@ static int begin_audit(session_t *s)
static void end_audit(session_t *s)
{
#if defined(HAVE_LIBAUDIT) && defined(HAVE_LIBAUDIT_H)
- if (s->audit_id != -1)
- {
+ if (s->audit_id != -1) {
audit_log_user_message(s->audit_id, s->options.audit_message_type,
- "x11spice close", NULL, NULL, NULL, 1);
+ "x11spice close", NULL, NULL, NULL, 1);
audit_close(s->audit_id);
}
s->audit_id = -1;
@@ -441,7 +436,8 @@ int session_get_one_led(session_t *session, const char *name)
XCB_XKB_ID_DFLT_XI_ID, atom_reply->atom);
free(atom_reply);
- indicator_reply = xcb_xkb_get_named_indicator_reply(session->display.c, indicator_cookie, &error);
+ indicator_reply =
+ xcb_xkb_get_named_indicator_reply(session->display.c, indicator_cookie, &error);
if (error) {
g_warning("Could not get indicator; type %d; code %d; major %d; minor %d",
error->response_type, error->error_code, error->major_code, error->minor_code);
@@ -456,12 +452,12 @@ int session_get_one_led(session_t *session, const char *name)
void session_disconnect_client(session_t *session)
{
/*
- ** TODO: This is using a side effect of set_ticket that is not intentional.
- ** It would be better to ask for a deliberate method of achieving this result.
- */
+ ** TODO: This is using a side effect of set_ticket that is not intentional.
+ ** It would be better to ask for a deliberate method of achieving this result.
+ */
g_debug("client disconnect");
spice_server_set_ticket(session->spice.server, session->options.spice_password, 0, 0, TRUE);
- if (! session->options.spice_password || session->options.disable_ticketing)
+ if (!session->options.spice_password || session->options.disable_ticketing)
spice_server_set_noauth(session->spice.server);
}
@@ -470,10 +466,9 @@ static void invoke_on_connect(session_t *session, const char *from)
if (session->connect_pid)
cleanup_process(session->connect_pid);
session->connect_pid = fork();
- if (session->connect_pid == 0)
- {
+ if (session->connect_pid == 0) {
/* TODO: If would be nice to either close the spice socket after
- the fork, or to get CLOEXEC set on the socket after open. */
+ the fork, or to get CLOEXEC set on the socket after open. */
setsid();
execl(session->options.on_connect, session->options.on_connect, from, NULL);
g_error("Exec of connect command [%s %s] failed", session->options.on_connect, from);
@@ -491,10 +486,9 @@ static void invoke_on_disconnect(session_t *session)
cleanup_process(session->disconnect_pid);
session->disconnect_pid = fork();
- if (session->disconnect_pid == 0)
- {
+ if (session->disconnect_pid == 0) {
/* TODO: If would be nice to either close the spice socket after
- the fork, or to get CLOEXEC set on the socket after open. */
+ the fork, or to get CLOEXEC set on the socket after open. */
setsid();
execl(session->options.on_disconnect, session->options.on_disconnect, NULL);
g_error("Exec of disconnect command [%s] failed", session->options.on_disconnect);
@@ -504,7 +498,7 @@ static void invoke_on_disconnect(session_t *session)
void session_remote_connected(const char *from)
{
- #define GUI_FROM_PREFIX "Connection from "
+#define GUI_FROM_PREFIX "Connection from "
char *from_string;
if (!global_session || global_session->connected)
return;
@@ -512,8 +506,7 @@ void session_remote_connected(const char *from)
global_session->connected = TRUE;
from_string = calloc(1, strlen(from) + strlen(GUI_FROM_PREFIX) + 1);
- if (from_string)
- {
+ if (from_string) {
strcpy(from_string, GUI_FROM_PREFIX);
strcat(from_string, from);
gui_remote_connected(&global_session->gui, from_string);
@@ -525,7 +518,7 @@ void session_remote_connected(const char *from)
#if defined(HAVE_LIBAUDIT)
if (global_session->options.audit && global_session->audit_id != -1)
audit_log_user_message(global_session->audit_id, global_session->options.audit_message_type,
- "x11spice connect", NULL, NULL, NULL, 1);
+ "x11spice connect", NULL, NULL, NULL, 1);
#endif
}
@@ -542,6 +535,6 @@ void session_remote_disconnected(void)
#if defined(HAVE_LIBAUDIT)
if (global_session->options.audit && global_session->audit_id != -1)
audit_log_user_message(global_session->audit_id, global_session->options.audit_message_type,
- "x11spice disconnect", NULL, NULL, NULL, 1);
+ "x11spice disconnect", NULL, NULL, NULL, 1);
#endif
}
diff --git a/src/spice.c b/src/spice.c
index 9e64ad7..205edc3 100644
--- a/src/spice.c
+++ b/src/spice.c
@@ -274,8 +274,7 @@ static int req_cmd_notification(QXLInstance *qin)
return 1;
}
-static void release_resource(QXLInstance *qin G_GNUC_UNUSED,
- struct QXLReleaseInfoExt release_info)
+static void release_resource(QXLInstance *qin G_GNUC_UNUSED, struct QXLReleaseInfoExt release_info)
{
spice_free_release((spice_release_t *) (uintptr_t) release_info.info->id);
}
@@ -341,6 +340,7 @@ static void update_area_complete(QXLInstance *qin G_GNUC_UNUSED,
* xf86PostKeyboardEvent(device, scanCode + MIN_KEYCODE, down); */
#define MIN_KEYCODE 8
+/* *INDENT-OFF* - Prevent indent from shifting style on us */
static uint8_t escaped_map[256] = {
[0x1c] = 104, //KEY_KP_Enter,
[0x1d] = 105, //KEY_RCtrl,
@@ -364,6 +364,7 @@ static uint8_t escaped_map[256] = {
[0x5c] = 134, //0, // REDKEY_RIGHT_CMD,
[0x5d] = 135, //KEY_Menu,
};
+/* *INDENT-ON* */
static void kbd_push_key(SpiceKbdInstance *sin, uint8_t frag)
{
@@ -382,8 +383,7 @@ static void kbd_push_key(SpiceKbdInstance *sin, uint8_t frag)
g_warning("spiceqxl_inputs.c: kbd_push_key: escaped_map[%d] == 0", frag);
}
frag = escaped_map[frag];
- }
- else {
+ } else {
frag += MIN_KEYCODE;
}
@@ -522,9 +522,9 @@ void initialize_spice_instance(spice_t *s)
.flush_resources = flush_resources,
.async_complete = async_complete,
.update_area_complete = update_area_complete,
- .client_monitors_config = NULL, /* Specifying NULL here causes
- the better logic in the agent
- to operate */
+ .client_monitors_config = NULL, /* Specifying NULL here causes
+ the better logic in the agent
+ to operate */
.set_client_capabilities = NULL, /* Allowed to be unset */
};
@@ -583,7 +583,7 @@ static int try_listen(spice_t *s, options_t *options)
return rc;
if (start != -1) {
- fd = listen_find_open_port(addr, start, port, &port);
+ fd = listen_find_open_port(addr, start, port, &port);
fflush(stdout);
if (fd >= 0)
@@ -599,12 +599,11 @@ static int try_listen(spice_t *s, options_t *options)
if (options->ssl.enabled) {
spice_server_set_tls(s->server, port,
- options->ssl.ca_cert_file,
- options->ssl.certs_file,
- options->ssl.private_key_file,
- options->ssl.key_password,
- options->ssl.dh_key_file,
- options->ssl.ciphersuite);
+ options->ssl.ca_cert_file,
+ options->ssl.certs_file,
+ options->ssl.private_key_file,
+ options->ssl.key_password,
+ options->ssl.dh_key_file, options->ssl.ciphersuite);
} else {
spice_server_set_port(s->server, port);
}
@@ -693,13 +692,13 @@ void spice_free_release(spice_release_t *r)
return;
switch (r->type) {
- case RELEASE_SHMI:
- destroy_shm_image(&r->s->session->display, (shm_image_t *) r->data);
- break;
+ case RELEASE_SHMI:
+ destroy_shm_image(&r->s->session->display, (shm_image_t *) r->data);
+ break;
- case RELEASE_MEMORY:
- free(r->data);
- break;
+ case RELEASE_MEMORY:
+ free(r->data);
+ break;
}
free(r);