[Spice-devel] [PATCH v2 24/30] Better encoders encapsulation
Frediano Ziglio
fziglio at redhat.com
Thu Jun 9 12:31:44 UTC 2016
Avoid to access some fields from dcc.c
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/dcc-encoders.c | 4 ++++
server/dcc.c | 3 ---
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/server/dcc-encoders.c b/server/dcc-encoders.c
index b3643bd..dcefecd 100644
--- a/server/dcc-encoders.c
+++ b/server/dcc-encoders.c
@@ -706,6 +706,8 @@ gboolean image_encoders_get_glz_dictionary(ImageEncoders *enc,
{
GlzSharedDictionary *shared_dict;
+ spice_return_val_if_fail(!enc->glz_dict, FALSE);
+
pthread_mutex_lock(&glz_dictionary_list_lock);
shared_dict = find_glz_dictionary(client, id);
@@ -739,6 +741,8 @@ gboolean image_encoders_restore_glz_dictionary(ImageEncoders *enc,
{
GlzSharedDictionary *shared_dict = NULL;
+ spice_return_val_if_fail(!enc->glz_dict, FALSE);
+
pthread_mutex_lock(&glz_dictionary_list_lock);
shared_dict = find_glz_dictionary(client, id);
diff --git a/server/dcc.c b/server/dcc.c
index 1994962..c935f8d 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -909,7 +909,6 @@ static int dcc_handle_init(DisplayChannelClient *dcc, SpiceMsgcDisplayInit *init
init->pixmap_cache_size);
spice_return_val_if_fail(dcc->pixmap_cache, FALSE);
- spice_return_val_if_fail(!dcc->encoders.glz_dict, FALSE);
success = image_encoders_get_glz_dictionary(&dcc->encoders,
RED_CHANNEL_CLIENT(dcc)->client,
init->glz_dictionary_id,
@@ -1014,8 +1013,6 @@ int dcc_handle_message(RedChannelClient *rcc, uint32_t size, uint16_t type, void
static int dcc_handle_migrate_glz_dictionary(DisplayChannelClient *dcc,
SpiceMigrateDataDisplay *migrate)
{
- spice_return_val_if_fail(!dcc->encoders.glz_dict, FALSE);
-
return image_encoders_restore_glz_dictionary(&dcc->encoders,
RED_CHANNEL_CLIENT(dcc)->client,
migrate->glz_dict_id,
--
2.7.4
More information about the Spice-devel
mailing list