From: Jarno Rajahalme Date: Mon, 7 Mar 2016 19:00:44 +0000 (-0800) Subject: ofpbuf: Make offset calculation more consistent. X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=b1b401391a910a72b6d683712139084ae1025e1c ofpbuf: Make offset calculation more consistent. Use the same method of offset calculation in ofpbuf_clone_with_headroom() as in ofpbuf_resize__(). Signed-off-by: Jarno Rajahalme Acked-by: Joe Stringer --- diff --git a/lib/ofpbuf.c b/lib/ofpbuf.c index 02c9d15f8..f050a84a3 100644 --- a/lib/ofpbuf.c +++ b/lib/ofpbuf.c @@ -183,9 +183,9 @@ ofpbuf_clone_with_headroom(const struct ofpbuf *buffer, size_t headroom) buffer->size, headroom); if (buffer->header) { - ptrdiff_t data_delta = (char *)new_buffer->data - (char *)buffer->data; + ptrdiff_t data_delta = (char *) buffer->header - (char *) buffer->data; - new_buffer->header = (char *) buffer->header + data_delta; + new_buffer->header = (char *) new_buffer->data + data_delta; } new_buffer->msg = buffer->msg;