[Spice-commits] 2 commits - server/main-channel.c server/red-channel.c server/reds.c server/spice-bitmap-utils.c
Frediano Ziglio
fziglio at kemper.freedesktop.org
Tue Feb 23 17:50:08 UTC 2016
server/main-channel.c | 2 +-
server/red-channel.c | 32 ++++++++++++++++----------------
server/reds.c | 6 +++---
server/spice-bitmap-utils.c | 2 +-
4 files changed, 21 insertions(+), 21 deletions(-)
New commits:
commit badb08a859d9d192357f6bf0ca463e627c4e8193
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Tue Feb 23 16:01:55 2016 +0000
use G_N_ELEMENTS instead of manually compute array size
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/reds.c b/server/reds.c
index 444d7ac..e58cec5 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -880,7 +880,7 @@ static const int secondary_channels[] = {
static int channel_is_secondary(RedChannel *channel)
{
int i;
- for (i = 0 ; i < sizeof(secondary_channels)/sizeof(secondary_channels[0]); ++i) {
+ for (i = 0 ; i < G_N_ELEMENTS(secondary_channels); ++i) {
if (channel->type == secondary_channels[i]) {
return TRUE;
}
commit b92588bf2c593c0cacf252a3325a443774514e61
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Tue Feb 23 16:02:09 2016 +0000
constify some global variables
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/main-channel.c b/server/main-channel.c
index 52a0078..9fa066d 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -57,7 +57,7 @@
#define CLIENT_CONNECTIVITY_TIMEOUT (MSEC_PER_SEC * 30)
-static uint8_t zero_page[ZERO_BUF_SIZE] = {0};
+static const uint8_t zero_page[ZERO_BUF_SIZE] = {0};
enum {
PIPE_ITEM_TYPE_MAIN_CHANNELS_LIST = PIPE_ITEM_TYPE_CHANNEL_BASE,
diff --git a/server/red-channel.c b/server/red-channel.c
index d7ff37e..3ee6192 100644
--- a/server/red-channel.c
+++ b/server/red-channel.c
@@ -176,21 +176,21 @@ static void mini_header_set_msg_sub_list(SpiceDataHeaderOpaque *header, uint32_t
spice_error("attempt to set header sub list on mini header");
}
-static SpiceDataHeaderOpaque full_header_wrapper = {NULL, sizeof(SpiceDataHeader),
- full_header_set_msg_type,
- full_header_set_msg_size,
- full_header_set_msg_serial,
- full_header_set_msg_sub_list,
- full_header_get_msg_type,
- full_header_get_msg_size};
-
-static SpiceDataHeaderOpaque mini_header_wrapper = {NULL, sizeof(SpiceMiniDataHeader),
- mini_header_set_msg_type,
- mini_header_set_msg_size,
- mini_header_set_msg_serial,
- mini_header_set_msg_sub_list,
- mini_header_get_msg_type,
- mini_header_get_msg_size};
+static const SpiceDataHeaderOpaque full_header_wrapper = {NULL, sizeof(SpiceDataHeader),
+ full_header_set_msg_type,
+ full_header_set_msg_size,
+ full_header_set_msg_serial,
+ full_header_set_msg_sub_list,
+ full_header_get_msg_type,
+ full_header_get_msg_size};
+
+static const SpiceDataHeaderOpaque mini_header_wrapper = {NULL, sizeof(SpiceMiniDataHeader),
+ mini_header_set_msg_type,
+ mini_header_set_msg_size,
+ mini_header_set_msg_serial,
+ mini_header_set_msg_sub_list,
+ mini_header_get_msg_type,
+ mini_header_get_msg_size};
/* return the number of bytes read. -1 in case of error */
static int red_peer_receive(RedsStream *stream, uint8_t *buf, uint32_t size)
@@ -1092,7 +1092,7 @@ static void dummy_watch_remove(SpiceWatch *watch)
}
// TODO: actually, since I also use channel_client_dummy, no need for core. Can be NULL
-SpiceCoreInterfaceInternal dummy_core = {
+static const SpiceCoreInterfaceInternal dummy_core = {
.watch_update_mask = dummy_watch_update_mask,
.watch_add = dummy_watch_add,
.watch_remove = dummy_watch_remove,
diff --git a/server/reds.c b/server/reds.c
index b917f26..444d7ac 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -874,7 +874,7 @@ SPICE_GNUC_VISIBLE int spice_server_get_num_clients(SpiceServer *s)
return reds_get_n_clients(reds);
}
-static int secondary_channels[] = {
+static const int secondary_channels[] = {
SPICE_CHANNEL_MAIN, SPICE_CHANNEL_DISPLAY, SPICE_CHANNEL_CURSOR, SPICE_CHANNEL_INPUTS};
static int channel_is_secondary(RedChannel *channel)
@@ -3733,7 +3733,7 @@ SPICE_GNUC_VISIBLE int spice_server_set_zlib_glz_compression(SpiceServer *s, spi
SPICE_GNUC_VISIBLE int spice_server_set_channel_security(SpiceServer *s, const char *channel, int security)
{
- static const char *names[] = {
+ static const char *const names[] = {
[ SPICE_CHANNEL_MAIN ] = "main",
[ SPICE_CHANNEL_DISPLAY ] = "display",
[ SPICE_CHANNEL_INPUTS ] = "inputs",
diff --git a/server/spice-bitmap-utils.c b/server/spice-bitmap-utils.c
index 8350e7f..d13d757 100644
--- a/server/spice-bitmap-utils.c
+++ b/server/spice-bitmap-utils.c
@@ -172,7 +172,7 @@ write_err:
static bool dump_line(FILE *f, uint8_t* line, uint16_t n_pixel_bits, int width, int row_size)
{
- static char zeroes[4] = { 0 };
+ static const char zeroes[4] = { 0 };
int copy_bytes_size = SPICE_ALIGN(n_pixel_bits * width, 8) / 8;
WRITE(line, copy_bytes_size, f);
More information about the Spice-commits
mailing list