static void
pack_2_octets (dbus_uint16_t value,
int byte_order,
- unsigned char *data)
+ void *data)
{
_dbus_assert (_DBUS_ALIGN_ADDRESS (data, 2) == data);
static void
pack_4_octets (dbus_uint32_t value,
int byte_order,
- unsigned char *data)
+ void *data)
{
_dbus_assert (_DBUS_ALIGN_ADDRESS (data, 4) == data);
static void
pack_8_octets (dbus_uint64_t value,
int byte_order,
- unsigned char *data)
+ void *data)
{
_dbus_assert (_DBUS_ALIGN_ADDRESS (data, 8) == data);
_dbus_assert (_DBUS_ALIGN_ADDRESS (data, 2) == data);
if (byte_order == DBUS_LITTLE_ENDIAN)
- return DBUS_UINT16_FROM_LE (*(dbus_uint16_t*)data);
+ return DBUS_UINT16_FROM_LE (*(dbus_uint16_t *) (void *) data);
else
- return DBUS_UINT16_FROM_BE (*(dbus_uint16_t*)data);
+ return DBUS_UINT16_FROM_BE (*(dbus_uint16_t *) (void *) data);
}
#endif /* _dbus_unpack_uint16 */
_dbus_assert (_DBUS_ALIGN_ADDRESS (data, 4) == data);
if (byte_order == DBUS_LITTLE_ENDIAN)
- return DBUS_UINT32_FROM_LE (*(dbus_uint32_t*)data);
+ return DBUS_UINT32_FROM_LE (*(dbus_uint32_t *) (void *) data);
else
- return DBUS_UINT32_FROM_BE (*(dbus_uint32_t*)data);
+ return DBUS_UINT32_FROM_BE (*(dbus_uint32_t *) (void *) data);
}
#endif /* _dbus_unpack_uint32 */
{
volatile dbus_uint16_t *vp = value;
pos = _DBUS_ALIGN_VALUE (pos, 2);
- *vp = *(dbus_uint16_t *)(str_data + pos);
+ *vp = *(dbus_uint16_t *) (void *) (str_data + pos);
if (byte_order != DBUS_COMPILER_BYTE_ORDER)
*vp = DBUS_UINT16_SWAP_LE_BE (*vp);
pos += 2;
{
volatile dbus_uint32_t *vp = value;
pos = _DBUS_ALIGN_VALUE (pos, 4);
- *vp = *(dbus_uint32_t *)(str_data + pos);
+ *vp = *(dbus_uint32_t *) (void *) (str_data + pos);
if (byte_order != DBUS_COMPILER_BYTE_ORDER)
*vp = DBUS_UINT32_SWAP_LE_BE (*vp);
pos += 4;
volatile dbus_uint64_t *vp = value;
pos = _DBUS_ALIGN_VALUE (pos, 8);
if (byte_order != DBUS_COMPILER_BYTE_ORDER)
- *vp = DBUS_UINT64_SWAP_LE_BE (*(dbus_uint64_t*)(str_data + pos));
+ *vp = DBUS_UINT64_SWAP_LE_BE (
+ *(dbus_uint64_t *) (void *) (str_data + pos));
else
- *vp = *(dbus_uint64_t*)(str_data + pos);
+ *vp = *(dbus_uint64_t *) (void *) (str_data + pos);
pos += 8;
}
break;
int n_elements,
int alignment)
{
- unsigned char *d;
- unsigned char *end;
+ void *d;
+ void *end;
_dbus_assert (_DBUS_ALIGN_ADDRESS (data, alignment) == data);
* for the unit tests. don't ask.
*/
d = data;
- end = d + (n_elements * alignment);
+ end = data + (n_elements * alignment);
if (alignment == 8)
{
while (d != end)
{
*((dbus_uint64_t*)d) = DBUS_UINT64_SWAP_LE_BE (*((dbus_uint64_t*)d));
- d += 8;
+ d = ((unsigned char *) d) + 8;
}
}
else if (alignment == 4)
while (d != end)
{
*((dbus_uint32_t*)d) = DBUS_UINT32_SWAP_LE_BE (*((dbus_uint32_t*)d));
- d += 4;
+ d = ((unsigned char *) d) + 4;
}
}
else
while (d != end)
{
*((dbus_uint16_t*)d) = DBUS_UINT16_SWAP_LE_BE (*((dbus_uint16_t*)d));
- d += 2;
+ d = ((unsigned char *) d) + 2;
}
}
}
_DBUS_ALIGN_ADDRESS (&data[i], 8) == &data[i])
{
_dbus_verbose (" u64: 0x%" DBUS_INT64_MODIFIER "x",
- *(dbus_uint64_t*)&data[i-8]);
- _dbus_verbose (" dbl: %g",
- *(double*)&data[i-8]);
+ *(dbus_uint64_t *) (void *) &data[i - 8]);
+ _dbus_verbose (" dbl: %g", *(double *) (void *) &data[i - 8]);
}
_dbus_verbose ("\n");