Prefer sigrok's endianess conversion helper over the inet htons()
routine which is harder to read (is "network order" little or big?).
Writing the conversion results in units of bytes also avoids misaligned
memory access. The header length is odd, each payload item got written
as an uint16_t item to an odd address.
p += sizeof(mso_head);
for (i = 0; i < n; i++) {
- *(uint16_t *) p = g_htons(payload[i]);
- p += 2;
+ WB16(p, payload[i]);
+ p += sizeof(uint16_t);
}
memcpy(p, mso_foot, sizeof(mso_foot));