[Spice-devel] [PATCH spice-server 02/10] lz4-encoder: Use GUINT32_TO_BE instead of htonl

Victor Toso victortoso at redhat.com
Mon Jan 29 13:44:55 UTC 2018


Hi,

On Mon, Jan 22, 2018 at 05:54:54PM +0000, Frediano Ziglio wrote:
> Just a style change, almost of the code use similar macros for such
> tasks.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>

Right, nothing wrong with htonl() and just a few more in the
source code:

 $ grepi "[hn]to[nh][ls]" *
  server/smartcard.c:129:    msg_len = ntohl(vheader->length);
  server/smartcard.c:155:        actual_length = ntohl(vheader->length);
  server/smartcard.c:212:    vheader->type = ntohl(vheader->type);
  server/smartcard.c:213:    vheader->length = ntohl(vheader->length);
  server/smartcard.c:214:    vheader->reader_id = ntohl(vheader->reader_id);
  server/smartcard.c:479:    vheader->type = htonl(vheader->type);
  server/smartcard.c:480:    vheader->length = htonl(vheader->length);
  server/smartcard.c:481:    vheader->reader_id = htonl(vheader->reader_id);
  spice-common/common/canvas_base.c:600:        enc_size = ntohl(*((uint32_t *)data));

Acked-by: Victor Toso <victortoso at redhat.com>

> ---
>  server/lz4-encoder.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/server/lz4-encoder.c b/server/lz4-encoder.c
> index 39aac012..a8f0d17c 100644
> --- a/server/lz4-encoder.c
> +++ b/server/lz4-encoder.c
> @@ -89,7 +89,7 @@ int lz4_encode(Lz4EncoderContext *lz4, int height, int stride, uint8_t *io_ptr,
>              LZ4_freeStream(stream);
>              return 0;
>          }
> -        *((uint32_t *)compressed_lines) = htonl(enc_size);
> +        *((uint32_t *)compressed_lines) = GUINT32_TO_BE(enc_size);
>  
>          out_size += enc_size += 4;
>          already_copied = 0;
> -- 
> 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/a797c3c6/attachment.sig>


More information about the Spice-devel mailing list