diff options
author | Renato Botelho <renato@netgate.com> | 2017-02-23 06:37:07 -0300 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2017-02-23 06:37:07 -0300 |
commit | 4ef888db25896b2295f521c736ef04aa2e5e64ec (patch) | |
tree | 3fcc00dda536bd32ae85bc09f21be4081d32bad5 /contrib/tcpdump/cpack.c | |
parent | 272ffd7c3e4e5e27910eb918e2e36556f2a8ec3a (diff) | |
parent | af015c5bcac0e333adeec07eff0698bad3b91e95 (diff) | |
download | FreeBSD-src-4ef888db25896b2295f521c736ef04aa2e5e64ec.zip FreeBSD-src-4ef888db25896b2295f521c736ef04aa2e5e64ec.tar.gz |
Merge remote-tracking branch 'origin/stable/11' into devel-11
Diffstat (limited to 'contrib/tcpdump/cpack.c')
-rw-r--r-- | contrib/tcpdump/cpack.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/contrib/tcpdump/cpack.c b/contrib/tcpdump/cpack.c index 16bfd15..e37d813 100644 --- a/contrib/tcpdump/cpack.c +++ b/contrib/tcpdump/cpack.c @@ -27,20 +27,19 @@ * OF SUCH DAMAGE. */ -#define NETDISSECT_REWORKED #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <stdlib.h> #include <string.h> -#include <tcpdump-stdinc.h> +#include <netdissect-stdinc.h> #include "cpack.h" #include "extract.h" -uint8_t * -cpack_next_boundary(uint8_t *buf, uint8_t *p, size_t alignment) +const uint8_t * +cpack_next_boundary(const uint8_t *buf, const uint8_t *p, size_t alignment) { size_t misalignment = (size_t)(p - buf) % alignment; @@ -54,10 +53,10 @@ cpack_next_boundary(uint8_t *buf, uint8_t *p, size_t alignment) * wordsize bytes remain in the buffer after the boundary. Otherwise, * return a pointer to the boundary. */ -uint8_t * +const uint8_t * cpack_align_and_reserve(struct cpack_state *cs, size_t wordsize) { - uint8_t *next; + const uint8_t *next; /* Ensure alignment. */ next = cpack_next_boundary(cs->c_buf, cs->c_next, wordsize); @@ -81,7 +80,7 @@ cpack_advance(struct cpack_state *cs, const size_t toskip) } int -cpack_init(struct cpack_state *cs, uint8_t *buf, size_t buflen) +cpack_init(struct cpack_state *cs, const uint8_t *buf, size_t buflen) { memset(cs, 0, sizeof(*cs)); @@ -96,7 +95,7 @@ cpack_init(struct cpack_state *cs, uint8_t *buf, size_t buflen) int cpack_uint64(struct cpack_state *cs, uint64_t *u) { - uint8_t *next; + const uint8_t *next; if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL) return -1; @@ -112,7 +111,7 @@ cpack_uint64(struct cpack_state *cs, uint64_t *u) int cpack_uint32(struct cpack_state *cs, uint32_t *u) { - uint8_t *next; + const uint8_t *next; if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL) return -1; @@ -128,7 +127,7 @@ cpack_uint32(struct cpack_state *cs, uint32_t *u) int cpack_uint16(struct cpack_state *cs, uint16_t *u) { - uint8_t *next; + const uint8_t *next; if ((next = cpack_align_and_reserve(cs, sizeof(*u))) == NULL) return -1; |