[Spice-devel] [PATCH spice-server 01/10] utils: Use const for rgb32_data_has_alpha data argument

Frediano Ziglio fziglio at redhat.com
Mon Jan 22 17:54:53 UTC 2018


There's no reason to change data passed, the function just check
the alpha channel of the image.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/utils.c | 7 ++++---
 server/utils.h | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/server/utils.c b/server/utils.c
index 746132e5..1856db61 100644
--- a/server/utils.c
+++ b/server/utils.c
@@ -25,14 +25,15 @@
 #include "utils.h"
 
 int rgb32_data_has_alpha(int width, int height, size_t stride,
-                         uint8_t *data, int *all_set_out)
+                         const uint8_t *data, int *all_set_out)
 {
-    uint32_t *line, *end, alpha;
+    const uint32_t *line, *end;
+    uint32_t alpha;
     int has_alpha;
 
     has_alpha = FALSE;
     while (height-- > 0) {
-        line = (uint32_t *)data;
+        line = (const uint32_t *)data;
         end = line + width;
         data += stride;
         while (line != end) {
diff --git a/server/utils.h b/server/utils.h
index 3f735754..58d43caf 100644
--- a/server/utils.h
+++ b/server/utils.h
@@ -72,7 +72,7 @@ static inline red_time_t spice_get_monotonic_time_ms(void)
 }
 
 int rgb32_data_has_alpha(int width, int height, size_t stride,
-                         uint8_t *data, int *all_set_out);
+                         const uint8_t *data, int *all_set_out);
 
 const char *red_channel_type_to_str(int type);
 int red_channel_name_to_type(const char *name);
-- 
2.14.3



More information about the Spice-devel mailing list