This is a GCC extension not supported by other compilers.
continue;
}
- ofpbuf_pull(&b, b.l7 - b.data);
+ ofpbuf_pull(&b, (char *)b.l7 - (char*)b.data);
error = dhcp_parse(msg, &b);
if (!error) {
VLOG_DBG_RL(&rl, "received %s",
tail = ofpbuf_tail(msg);
while (p < tail) {
- size_t offset = p - msg->data;
+ size_t offset = (char*)p - (char*)msg->data;
struct nlattr *nla = p;
size_t len, aligned_len;
uint16_t type;
}
len = nla->nla_len - NLA_HDRLEN;
aligned_len = NLA_ALIGN(len);
- if (aligned_len > tail - p) {
+ if (aligned_len > (char*)tail - (char*)p) {
VLOG_DBG_RL(&rl, "%zu: attr %"PRIu16" aligned data len (%zu) "
"> bytes left (%tu)",
- offset, nla->nla_type, aligned_len, tail - p);
+ offset, nla->nla_type, aligned_len,
+ (char*)tail - (char*)p);
return false;
}
} else {
/* Skip attribute type that we don't care about. */
}
- p += NLA_ALIGN(nla->nla_len);
+ p = (char*)p + NLA_ALIGN(nla->nla_len);
}
if (n_required) {
VLOG_DBG_RL(&rl, "%zu required attrs missing", n_required);
size_t
ofpbuf_headroom(struct ofpbuf *b)
{
- return b->data - b->base;
+ return (char*)b->data - (char*)b->base;
}
/* Returns the number of bytes that may be appended to the tail end of ofpbuf
size_t
ofpbuf_tailroom(struct ofpbuf *b)
{
- return ofpbuf_end(b) - ofpbuf_tail(b);
+ return (char*)ofpbuf_end(b) - (char*)ofpbuf_tail(b);
}
/* Ensures that 'b' has room for at least 'size' bytes at its tail end,
if (size > ofpbuf_tailroom(b)) {
size_t new_allocated = b->allocated + MAX(size, 64);
void *new_base = xmalloc(new_allocated);
- uintptr_t base_delta = new_base - b->base;
+ uintptr_t base_delta = (char*)new_base - (char*)b->base;
memcpy(new_base, b->base, b->allocated);
free(b->base);
b->base = new_base;
b->allocated = new_allocated;
- b->data += base_delta;
+ b->data = (char*)b->data + base_delta;
if (b->l2) {
- b->l2 += base_delta;
+ b->l2 = (char*)b->l2 + base_delta;
}
if (b->l3) {
- b->l3 += base_delta;
+ b->l3 = (char*)b->l3 + base_delta;
}
if (b->l4) {
- b->l4 += base_delta;
+ b->l4 = (char*)b->l4 + base_delta;
}
if (b->l7) {
- b->l7 += base_delta;
+ b->l7 = (char*)b->l7 + base_delta;
}
}
}
{
assert(!b->size);
ofpbuf_prealloc_tailroom(b, size);
- b->data += size;
+ b->data = (char*)b->data + size;
}
void *
ofpbuf_push_uninit(struct ofpbuf *b, size_t size)
{
ofpbuf_prealloc_headroom(b, size);
- b->data -= size;
+ b->data = (char*)b->data - size;
b->size += size;
return b->data;
}
{
void *data = b->data;
assert(b->size >= size);
- b->data += size;
+ b->data = (char*)b->data + size;
b->size -= size;
return data;
}
const int hard_header = VLAN_ETH_HEADER_LEN;
const int mtu = netdev_get_mtu(p->netdev);
buffer = ofpbuf_new(headroom + hard_header + mtu);
- buffer->data += headroom;
+ buffer->data = (char*)buffer->data + headroom;
}
error = netdev_recv(p->netdev, buffer);
if (!error) {
veh = ofpbuf_push_uninit(buffer, VLAN_HEADER_LEN);
memcpy(veh, &tmp, sizeof tmp);
- buffer->l2 -= VLAN_HEADER_LEN;
+ buffer->l2 = (char*)buffer->l2 - VLAN_HEADER_LEN;
}
} else {
/* Remove an existing vlan header if it exists */
tmp.eth_type = veh->veth_next_type;
buffer->size -= VLAN_HEADER_LEN;
- buffer->data += VLAN_HEADER_LEN;
- buffer->l2 += VLAN_HEADER_LEN;
+ buffer->data = (char*)buffer->data + VLAN_HEADER_LEN;
+ buffer->l2 = (char*)buffer->l2 + VLAN_HEADER_LEN;
memcpy(buffer->data, &tmp, sizeof tmp);
}
}