Skip to content

arg-cache: Don't set always the array length to an ulong in little endian

Marco Trevisan requested to merge 3v1n0/gjs:arg-cache-arraylength-auto into master

The size value we get may be in some cases a signed integer and in some others an unsigned one. However in case we're using a little endian architecture we always save it as the GIArgument unsigned value, while we read it depending on the type tag.

This seems to work properly in all the architectures, but the assumtion is wrong in armhf, causing a test failure:

  it('marshals an array with a 64-bit length parameter', function () {
    expect(() => GIMarshallingTests.array_in_guint64_len([-1, 0, 1, 2]))
      .not.toThrow();
  });

  ERROR:/usr/share/gobject-introspection-1.0/tests/gimarshallingtests.c
    gi_marshalling_tests_array_in_guint64_len:
      assertion failed (length == 4): (-498216206332 == 4)

At the end the switch check is just an extra operation that will ensure us safety, at a really minimal cost at this point (given we've got the tag anyways).

Closes: #342 (closed)

Edited by Marco Trevisan

Merge request reports