[Spice-devel] [PATCH 2/7] red_channel_client_test_remote_cap() returns bool
Jonathon Jongsma
jjongsma at redhat.com
Fri Apr 7 15:23:56 UTC 2017
Both _test_remote_cap() and _test_remote_common_cap() are used as
boolean values, so change the return type from int to bool to follow our
coding standard.
---
server/main-channel-client.c | 4 ++--
server/red-channel-client.c | 4 ++--
server/red-channel-client.h | 4 ++--
server/sound.c | 10 +++++-----
server/stream.c | 2 +-
5 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/server/main-channel-client.c b/server/main-channel-client.c
index 8d3d9a4..9eb60c9 100644
--- a/server/main-channel-client.c
+++ b/server/main-channel-client.c
@@ -620,8 +620,8 @@ gboolean main_channel_client_migrate_src_complete(MainChannelClient *mcc,
gboolean ret = FALSE;
RedChannelClient *rcc = RED_CHANNEL_CLIENT(mcc);
RedClient *client = red_channel_client_get_client(rcc);
- int semi_seamless_support = red_channel_client_test_remote_cap(rcc,
- SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE);
+ bool semi_seamless_support = red_channel_client_test_remote_cap(rcc,
+ SPICE_MAIN_CAP_SEMI_SEAMLESS_MIGRATE);
if (semi_seamless_support && mcc->priv->mig_connect_ok) {
if (success) {
spice_printerr("client %p MIGRATE_END", client);
diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index ef0e892..4eac231 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -664,14 +664,14 @@ static gboolean red_channel_client_pipe_remove(RedChannelClient *rcc, RedPipeIte
return g_queue_remove(&rcc->priv->pipe, item);
}
-int red_channel_client_test_remote_common_cap(RedChannelClient *rcc, uint32_t cap)
+bool red_channel_client_test_remote_common_cap(RedChannelClient *rcc, uint32_t cap)
{
return test_capability(rcc->priv->remote_caps.common_caps,
rcc->priv->remote_caps.num_common_caps,
cap);
}
-int red_channel_client_test_remote_cap(RedChannelClient *rcc, uint32_t cap)
+bool red_channel_client_test_remote_cap(RedChannelClient *rcc, uint32_t cap)
{
return test_capability(rcc->priv->remote_caps.caps,
rcc->priv->remote_caps.num_caps,
diff --git a/server/red-channel-client.h b/server/red-channel-client.h
index ae83109..5252739 100644
--- a/server/red-channel-client.h
+++ b/server/red-channel-client.h
@@ -51,8 +51,8 @@ gboolean red_channel_client_is_connected(RedChannelClient *rcc);
void red_channel_client_default_migrate(RedChannelClient *rcc);
bool red_channel_client_is_waiting_for_migrate_data(RedChannelClient *rcc);
void red_channel_client_destroy(RedChannelClient *rcc);
-int red_channel_client_test_remote_common_cap(RedChannelClient *rcc, uint32_t cap);
-int red_channel_client_test_remote_cap(RedChannelClient *rcc, uint32_t cap);
+bool red_channel_client_test_remote_common_cap(RedChannelClient *rcc, uint32_t cap);
+bool red_channel_client_test_remote_cap(RedChannelClient *rcc, uint32_t cap);
/* 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. */
diff --git a/server/sound.c b/server/sound.c
index c80716d..ff9a37a 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -1044,9 +1044,9 @@ playback_channel_client_constructed(GObject *object)
SND_CHANNEL_CLIENT(playback_client)->on_message_done = snd_playback_on_message_done;
RedChannelClient *rcc = RED_CHANNEL_CLIENT(playback_client);
- int client_can_celt = red_channel_client_test_remote_cap(rcc,
+ bool client_can_celt = red_channel_client_test_remote_cap(rcc,
SPICE_PLAYBACK_CAP_CELT_0_5_1);
- int client_can_opus = red_channel_client_test_remote_cap(rcc,
+ bool client_can_opus = red_channel_client_test_remote_cap(rcc,
SPICE_PLAYBACK_CAP_OPUS);
bool playback_compression =
reds_config_get_playback_compression(red_channel_get_server(red_channel));
@@ -1192,7 +1192,7 @@ SPICE_GNUC_VISIBLE uint32_t spice_server_record_get_samples(SpiceRecordInstance
static uint32_t snd_get_best_rate(SndChannelClient *client, uint32_t cap_opus)
{
- int client_can_opus = TRUE;
+ bool client_can_opus = TRUE;
if (client) {
client_can_opus = red_channel_client_test_remote_cap(RED_CHANNEL_CLIENT(client), cap_opus);
}
@@ -1460,9 +1460,9 @@ void snd_set_playback_compression(bool on)
if (type == SPICE_CHANNEL_PLAYBACK && now->connection) {
PlaybackChannelClient* playback = (PlaybackChannelClient*)now->connection;
RedChannelClient *rcc = RED_CHANNEL_CLIENT(playback);
- int client_can_celt = red_channel_client_test_remote_cap(rcc,
+ bool client_can_celt = red_channel_client_test_remote_cap(rcc,
SPICE_PLAYBACK_CAP_CELT_0_5_1);
- int client_can_opus = red_channel_client_test_remote_cap(rcc,
+ bool client_can_opus = red_channel_client_test_remote_cap(rcc,
SPICE_PLAYBACK_CAP_OPUS);
int desired_mode = snd_desired_audio_mode(on, now->frequency,
client_can_opus, client_can_celt);
diff --git a/server/stream.c b/server/stream.c
index 04af050..f6ff0de 100644
--- a/server/stream.c
+++ b/server/stream.c
@@ -689,7 +689,7 @@ static VideoEncoder* dcc_create_video_encoder(DisplayChannelClient *dcc,
VideoEncoderRateControlCbs *cbs)
{
RedChannelClient *rcc = RED_CHANNEL_CLIENT(dcc);
- int client_has_multi_codec = red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_MULTI_CODEC);
+ bool client_has_multi_codec = red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_MULTI_CODEC);
int i;
GArray *video_codecs;
--
2.9.3
More information about the Spice-devel
mailing list