constify some global variables

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
Frediano Ziglio 2016-02-23 16:02:09 +00:00
parent 39ab6b3279
commit b92588bf2c
4 changed files with 19 additions and 19 deletions

View File

@ -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,

View File

@ -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 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 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 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,

View File

@ -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",

View File

@ -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);