[PATCH v4 12/19] Better encoders encapsulation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Avoid to access some fields from dcc.c

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 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 3547adc..22cfcf3 100644
--- a/server/dcc-encoders.c
+++ b/server/dcc-encoders.c
@@ -710,6 +710,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);
@@ -743,6 +745,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 3190c94..039229d 100644
--- a/server/dcc.c
+++ b/server/dcc.c
@@ -903,7 +903,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,
@@ -1008,8 +1007,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

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]