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

Victor Toso victortoso at redhat.com
Mon Jan 29 13:36:31 UTC 2018


Hi,

On Mon, Jan 22, 2018 at 05:54:53PM +0000, Frediano Ziglio wrote:
> 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>

Acked-by: Victor Toso <victortoso 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
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180129/df0f4f96/attachment.sig>


More information about the Spice-devel mailing list