Re: Variant tests failing on big endian machines





----- Original Message -----
From: "Torsten Schoenfeld" <kaffeetisch gmx de>
To: gtk-perl-list gnome org
Sent: Friday, 26 June, 2015 3:34:48 PM
Subject: Re: Variant tests failing on big endian machines

I found the culprit. On the GVariant.xs file, we have:

const char * g_variant_classify (GVariant *value);
    PREINIT:
        GVariantClass vclass;
    CODE:
        vclass = g_variant_classify (value);
        RETVAL = (const char *) &vclass;
    OUTPUT:
        RETVAL

The RETVAL value will be arch-dependent because of the way it's accessed.
I'm not familiar with .xs syntax, so what's the way to deal with
endianness on this type of files?

Does this work?

const char * g_variant_classify (GVariant *value);
    PREINIT:
        GVariantClass vclass;
    CODE:
        vclass = g_variant_classify (value);
        RETVAL = (const char *) &((char) vclass);

GVariant.xs: In function ‘XS_Glib__Variant_classify’:
GVariant.xs:285:26: error: lvalue required as unary ‘&’ operand
  RETVAL = (const char *) &((char) vclass);
                          ^
Makefile:468: recipe for target 'GVariant.o' failed
make: *** [GVariant.o] Error 1

Unfortunately, casting it to char makes it an rvalue which doesn't have an address.

Is it possible to include <endian.h> and then make a conditional 

#if BYTE_ORDER == BIG_ENDIAN ?


Att
--
Rafael Fonseca


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