From nobody Sat Nov 15 19:23:09 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1747909901; cv=none; d=zohomail.com; s=zohoarc; b=BmsNqFVGikgDeYbFh37LqVVUl6O+J/muVMratGI2coAwx6g9UkCKXWP0e/8RPCkQomIi0604a5hjYQaQxf4mNZfd9/a0OsF2l5z536WVyVBcS07gSe7e6zakyA9+AL9R1USpzHHV29OPhvrtbFaBIbsj+F3dBeMjFb3OWUNB130= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1747909901; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8jfTVts1uQnnQOq04ScY/y3ND2kZkyWDQrlQ9FP3OdE=; b=L7eLV8jvMNIm8HpGizMJzr1j+HpqfmsUDJJI/XqBa+z0qFTdYVgcTRlOQl8WzPaGr5oRfjOaWNIY+qqHJEJablArzzoZJRI0IAuZsbMzN6cKAhIZ1RgIJFy2gL6pXKjYXvkslKfxmE5duAJ1MAJQgTd4hfC3Ail2150F/0CvAHk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1747909901959919.465469477944; Thu, 22 May 2025 03:31:41 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uI3BG-0002z6-KG; Thu, 22 May 2025 06:29:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uI3BD-0002yY-KK for qemu-devel@nongnu.org; Thu, 22 May 2025 06:29:39 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uI3BB-0006MT-OZ for qemu-devel@nongnu.org; Thu, 22 May 2025 06:29:39 -0400 Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-486-T5fhH__9P_2qdCk-8Tgg3Q-1; Thu, 22 May 2025 06:29:33 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2F7411956080; Thu, 22 May 2025 10:29:32 +0000 (UTC) Received: from toolbx.redhat.com (unknown [10.42.28.179]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 32A7C1958014; Thu, 22 May 2025 10:29:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1747909776; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8jfTVts1uQnnQOq04ScY/y3ND2kZkyWDQrlQ9FP3OdE=; b=J7iGG1qem7Y76g5VWiLyp909usdKG3PvuDKgQTq8ZPs8NFm/u4A5zJY7giL59Bow3zZSpA 7WWQwA2rcq0p0BFdlnG+ozuiD+KcP3eaBaDtwHS1W/F6vBN0/fow4QZjx2BVpgs8vnK1Zo VA39Rlfyrcs7eccqWIm+DF29+0JQJus= X-MC-Unique: T5fhH__9P_2qdCk-8Tgg3Q-1 X-Mimecast-MFC-AGG-ID: T5fhH__9P_2qdCk-8Tgg3Q_1747909772 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Markus Armbruster , Paolo Bonzini , Eric Blake , =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , BALATON Zoltan Subject: [PULL 01/23] ui/vnc.c: replace big endian flag with byte order value Date: Thu, 22 May 2025 11:29:01 +0100 Message-ID: <20250522102923.309452-2-berrange@redhat.com> In-Reply-To: <20250522102923.309452-1-berrange@redhat.com> References: <20250522102923.309452-1-berrange@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.184, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1747909902539116600 It will make it easier to do certain comparisons in future if we store G_BIG_ENDIAN/G_LITTLE_ENDIAN directly, instead of a boolean flag, as we can then compare directly to the G_BYTE_ORDER constant. Reviewed-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Daniel P. Berrang=C3=A9 --- ui/vnc-enc-tight.c | 2 +- ui/vnc-enc-zrle.c | 2 +- ui/vnc-jobs.c | 2 +- ui/vnc.c | 6 +++--- ui/vnc.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ui/vnc-enc-tight.c b/ui/vnc-enc-tight.c index 41f559eb83..f8aaa8f346 100644 --- a/ui/vnc-enc-tight.c +++ b/ui/vnc-enc-tight.c @@ -150,7 +150,7 @@ tight_detect_smooth_image24(VncState *vs, int w, int h) * If client is big-endian, color samples begin from the second * byte (offset 1) of a 32-bit pixel value. */ - off =3D vs->client_be; + off =3D vs->client_endian =3D=3D G_BIG_ENDIAN ? 1 : 0; =20 memset(stats, 0, sizeof (stats)); =20 diff --git a/ui/vnc-enc-zrle.c b/ui/vnc-enc-zrle.c index bd33b89063..97ec6c7119 100644 --- a/ui/vnc-enc-zrle.c +++ b/ui/vnc-enc-zrle.c @@ -255,7 +255,7 @@ static void zrle_write_u8(VncState *vs, uint8_t value) static int zrle_send_framebuffer_update(VncState *vs, int x, int y, int w, int h) { - bool be =3D vs->client_be; + bool be =3D vs->client_endian =3D=3D G_BIG_ENDIAN; size_t bytes; int zywrle_level; =20 diff --git a/ui/vnc-jobs.c b/ui/vnc-jobs.c index fcca7ec632..d3486af9e2 100644 --- a/ui/vnc-jobs.c +++ b/ui/vnc-jobs.c @@ -188,7 +188,7 @@ static void vnc_async_encoding_start(VncState *orig, Vn= cState *local) local->lossy_rect =3D orig->lossy_rect; local->write_pixels =3D orig->write_pixels; local->client_pf =3D orig->client_pf; - local->client_be =3D orig->client_be; + local->client_endian =3D orig->client_endian; local->tight =3D orig->tight; local->zlib =3D orig->zlib; local->hextile =3D orig->hextile; diff --git a/ui/vnc.c b/ui/vnc.c index 9e097dc4b4..ab18172c4d 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -891,7 +891,7 @@ void vnc_convert_pixel(VncState *vs, uint8_t *buf, uint= 32_t v) buf[0] =3D v; break; case 2: - if (vs->client_be) { + if (vs->client_endian =3D=3D G_BIG_ENDIAN) { buf[0] =3D v >> 8; buf[1] =3D v; } else { @@ -901,7 +901,7 @@ void vnc_convert_pixel(VncState *vs, uint8_t *buf, uint= 32_t v) break; default: case 4: - if (vs->client_be) { + if (vs->client_endian =3D=3D G_BIG_ENDIAN) { buf[0] =3D v >> 24; buf[1] =3D v >> 16; buf[2] =3D v >> 8; @@ -2312,7 +2312,7 @@ static void set_pixel_format(VncState *vs, int bits_p= er_pixel, vs->client_pf.bits_per_pixel =3D bits_per_pixel; vs->client_pf.bytes_per_pixel =3D bits_per_pixel / 8; vs->client_pf.depth =3D bits_per_pixel =3D=3D 32 ? 24 : bits_per_pixel; - vs->client_be =3D big_endian_flag; + vs->client_endian =3D big_endian_flag ? G_BIG_ENDIAN : G_LITTLE_ENDIAN; =20 if (!true_color_flag) { send_color_map(vs); diff --git a/ui/vnc.h b/ui/vnc.h index acc53a2cc1..02613aa63a 100644 --- a/ui/vnc.h +++ b/ui/vnc.h @@ -323,7 +323,7 @@ struct VncState VncWritePixels *write_pixels; PixelFormat client_pf; pixman_format_code_t client_format; - bool client_be; + int client_endian; /* G_LITTLE_ENDIAN or G_BIG_ENDIAN */ =20 CaptureVoiceOut *audio_cap; struct audsettings as; --=20 2.49.0