[glib] tests/gvariant: Fix test on big endian architectures



commit e6df67abe60654bc65317e05881be317ccbdc03b
Author: Colin Walters <walters verbum org>
Date:   Wed Sep 5 09:04:58 2012 -0400

    tests/gvariant: Fix test on big endian architectures
    
    We need to ensure we get the exact same byte-level GVariant, so
    byteswap on big endian architectures.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=683384

 glib/tests/gvariant.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/glib/tests/gvariant.c b/glib/tests/gvariant.c
index 4e8282d..968b703 100644
--- a/glib/tests/gvariant.c
+++ b/glib/tests/gvariant.c
@@ -4201,6 +4201,13 @@ verify_gvariant_checksum_va (const gchar *sha256,
 
   v = g_variant_new_va (fmt, NULL, &args);
   g_variant_ref_sink (v);
+#if G_BYTE_ORDER == G_BIG_ENDIAN
+  {
+    GVariant *byteswapped = g_variant_byteswap (v);
+    g_variant_unref (v);
+    v = byteswapped;
+  }
+#endif
 
   va_end (args);
 



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