Skip to content

array-test: Don't rely on endianness of multi-byte numbers

Simon McVittie requested to merge wip/smcv/garray-endian into main

The array is an array of bytes in this part of the test, so we need to append a single byte. Previously we were reusing val (a size_t variable) from earlier in the test, but because g_array_append_val passes the value by reference, appending a multi-byte number to an array of bytes will take the first byte of the number's memory representation, which has the desired value on little-endian CPUs but is zero on big-endian, leading to a test failure.

Resolves: #2918 (closed)
Bug-Debian: https://bugs.debian.org/1031271

Edited by Simon McVittie

Merge request reports