fp-print: Don't byte-swap two times the NBIS array contents

When serializing an image print in big endian machine we ended up
swapping the arrays contents two times, first when adding the values and
eventually when calling g_variant_byteswap which already handles this
properly.

With this, we get the test passing into s390x.

Fixes: #236
This commit is contained in:
Marco Trevisan (Treviño) 2020-12-02 14:58:09 +00:00 committed by Marco Trevisan
parent 12b0120a3d
commit de271a0e8d

View file

@ -667,36 +667,25 @@ fp_print_serialize (FpPrint *print,
for (i = 0; i < print->prints->len; i++) for (i = 0; i < print->prints->len; i++)
{ {
struct xyt_struct *xyt = g_ptr_array_index (print->prints, i); struct xyt_struct *xyt = g_ptr_array_index (print->prints, i);
gint j;
gint32 *col = g_new (gint32, xyt->nrows);
g_variant_builder_open (&nested, G_VARIANT_TYPE ("(aiaiai)")); g_variant_builder_open (&nested, G_VARIANT_TYPE ("(aiaiai)"));
for (j = 0; j < xyt->nrows; j++)
col[j] = GINT32_TO_LE (xyt->xcol[j]);
g_variant_builder_add_value (&nested, g_variant_builder_add_value (&nested,
g_variant_new_fixed_array (G_VARIANT_TYPE_INT32, g_variant_new_fixed_array (G_VARIANT_TYPE_INT32,
col, xyt->xcol,
xyt->nrows, xyt->nrows,
sizeof (col[0]))); sizeof (xyt->xcol[0])));
for (j = 0; j < xyt->nrows; j++)
col[j] = GINT32_TO_LE (xyt->ycol[j]);
g_variant_builder_add_value (&nested, g_variant_builder_add_value (&nested,
g_variant_new_fixed_array (G_VARIANT_TYPE_INT32, g_variant_new_fixed_array (G_VARIANT_TYPE_INT32,
col, xyt->ycol,
xyt->nrows, xyt->nrows,
sizeof (col[0]))); sizeof (xyt->ycol[0])));
for (j = 0; j < xyt->nrows; j++)
col[j] = GINT32_TO_LE (xyt->thetacol[j]);
g_variant_builder_add_value (&nested, g_variant_builder_add_value (&nested,
g_variant_new_fixed_array (G_VARIANT_TYPE_INT32, g_variant_new_fixed_array (G_VARIANT_TYPE_INT32,
col, xyt->thetacol,
xyt->nrows, xyt->nrows,
sizeof (col[0]))); sizeof (xyt->thetacol[0])));
g_variant_builder_close (&nested); g_variant_builder_close (&nested);
g_free (col);
} }
g_variant_builder_close (&nested); g_variant_builder_close (&nested);