Constify some methods

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Frediano Ziglio 2019-05-19 00:04:26 +01:00 committed by Frediano Ziglio
parent 552c26b0a8
commit 8671f659f4
4 changed files with 23 additions and 23 deletions

View File

@ -132,7 +132,7 @@ struct RedChannelClientPrivate
SpiceMarshaller *marshaller;
SpiceDataHeaderOpaque header;
uint32_t size;
int blocked;
bool blocked;
uint64_t last_sent_serial;
struct {
@ -676,14 +676,14 @@ static gboolean red_channel_client_pipe_remove(RedChannelClient *rcc, RedPipeIte
return g_queue_remove(&rcc->priv->pipe, item);
}
bool RedChannelClient::test_remote_common_cap(uint32_t cap)
bool RedChannelClient::test_remote_common_cap(uint32_t cap) const
{
return test_capability(priv->remote_caps.common_caps,
priv->remote_caps.num_common_caps,
cap);
}
bool RedChannelClient::test_remote_cap(uint32_t cap)
bool RedChannelClient::test_remote_cap(uint32_t cap) const
{
return test_capability(priv->remote_caps.caps,
priv->remote_caps.num_caps,
@ -1022,7 +1022,7 @@ void RedChannelClient::semi_seamless_migration_complete()
red_channel_client_start_ping_timer(this, PING_TEST_IDLE_NET_TIMEOUT_MS);
}
bool RedChannelClient::is_waiting_for_migrate_data()
bool RedChannelClient::is_waiting_for_migrate_data() const
{
return priv->wait_migrate_data;
}
@ -1352,7 +1352,7 @@ void RedChannelClient::push()
g_object_unref(this);
}
int RedChannelClient::get_roundtrip_ms()
int RedChannelClient::get_roundtrip_ms() const
{
if (priv->latency_monitor.roundtrip < 0) {
return priv->latency_monitor.roundtrip;
@ -1538,7 +1538,7 @@ SpiceMarshaller *RedChannelClient::switch_to_urgent_sender()
return priv->send_data.marshaller;
}
uint64_t RedChannelClient::get_message_serial()
uint64_t RedChannelClient::get_message_serial() const
{
return priv->send_data.last_sent_serial + 1;
}
@ -1663,12 +1663,12 @@ GQueue* RedChannelClient::get_pipe()
return &priv->pipe;
}
bool RedChannelClient::is_mini_header()
bool RedChannelClient::is_mini_header() const
{
return priv->is_mini_header;
}
gboolean RedChannelClient::is_connected()
bool RedChannelClient::is_connected() const
{
return priv->channel
&& (g_list_find(priv->channel->get_clients(), this) != NULL);
@ -1745,7 +1745,7 @@ void RedChannelClient::disconnect()
red_client_remove_channel(this);
}
gboolean RedChannelClient::is_blocked()
bool RedChannelClient::is_blocked() const
{
return priv->send_data.blocked;
}
@ -1848,7 +1848,7 @@ bool RedChannelClient::wait_outgoing_item(int64_t timeout)
}
}
gboolean RedChannelClient::no_item_being_sent()
bool RedChannelClient::no_item_being_sent() const
{
return priv->send_data.size == 0;
}
@ -1869,7 +1869,7 @@ void RedChannelClient::pipe_remove_and_release_pos(GList *item_pos)
}
/* client mutex should be locked before this call */
gboolean RedChannelClient::set_migration_seamless()
bool RedChannelClient::set_migration_seamless()
{
gboolean ret = FALSE;
uint32_t flags;

View File

@ -34,11 +34,11 @@ SPICE_DECLARE_TYPE(RedChannelClient, red_channel_client, CHANNEL_CLIENT);
struct RedChannelClient: public GObject
{
gboolean is_connected();
bool is_connected() const;
static void default_migrate(RedChannelClient *rcc);
bool is_waiting_for_migrate_data();
bool test_remote_common_cap(uint32_t cap);
bool test_remote_cap(uint32_t cap);
bool is_waiting_for_migrate_data() const;
bool test_remote_common_cap(uint32_t cap) const;
bool test_remote_cap(uint32_t cap) const;
/* shutdown is the only safe thing to do out of the client/channel
* thread. It will not touch the rings, just shutdown the socket.
* It should be followed by some way to guarantee a disconnection. */
@ -49,7 +49,7 @@ struct RedChannelClient: public GObject
/* when preparing send_data: should call init and then use marshaller */
void init_send_data(uint16_t msg_type);
uint64_t get_message_serial();
uint64_t get_message_serial() const;
/* When sending a msg. Should first call begin_send_message.
* It will first send the pending urgent data, if there is any, and then
@ -69,7 +69,7 @@ struct RedChannelClient: public GObject
SpiceMarshaller *switch_to_urgent_sender();
/* returns -1 if we don't have an estimation */
int get_roundtrip_ms();
int get_roundtrip_ms() const;
/* Checks periodically if the connection is still alive */
void start_connectivity_monitoring(uint32_t timeout_ms);
@ -89,18 +89,18 @@ struct RedChannelClient: public GObject
gboolean pipe_is_empty();
uint32_t get_pipe_size();
GQueue* get_pipe();
bool is_mini_header();
bool is_mini_header() const;
void ack_zero_messages_window();
void ack_set_client_window(int client_window);
void push_set_ack();
gboolean is_blocked();
bool is_blocked() const;
/* helper for channels that have complex logic that can possibly ready a send */
int send_message_pending();
gboolean no_item_being_sent();
bool no_item_being_sent() const;
void push();
void receive();
void send();
@ -131,7 +131,7 @@ struct RedChannelClient: public GObject
void semi_seamless_migration_complete();
void init_outgoing_messages_window();
gboolean set_migration_seamless();
bool set_migration_seamless();
/* allow to block or unblock reading */
void block_read();

View File

@ -449,7 +449,7 @@ int RedChannel::is_connected()
return priv->clients != NULL;
}
const char *RedChannel::get_name()
const char *RedChannel::get_name() const
{
return red_channel_type_to_str(priv->type);
}

View File

@ -106,7 +106,7 @@ struct RedChannelClass
struct RedChannel: public GObject
{
const char *get_name();
const char *get_name() const;
void add_client(RedChannelClient *rcc);
void remove_client(RedChannelClient *rcc);