Re: Variant tests failing on big endian machines



On 26.06.2015 15:23, Rafael dos Santos wrote:
the variant tests added with commit d0c52b8bb are failing on big endian
machines. As it can be seen from the log output below, the VariantClass
field is always empty.

Could somebody help me debug the issue and/or point me on the right direction
about looking into it?

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);
    OUTPUT:
        RETVAL


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