Capitalize the be[bits]{enc,dec}() functions to avoid colliding

with the system provided version in NetBSD.

The irony is not lost on me:  I created that family of functions
myself: https://svnweb.freebsd.org/base?view=revision&revision=113005
This commit is contained in:
Poul-Henning Kamp 2015-01-09 10:55:38 +00:00
parent 27ca509920
commit 4eb6fde3b7
3 changed files with 13 additions and 13 deletions

View File

@ -35,7 +35,7 @@
/* Alignment-agnostic encode/decode bytestream to/from little/big endian. */
static __inline uint16_t
be16dec(const void *pp)
Be16dec(const void *pp)
{
uint8_t const *p = (uint8_t const *)pp;
@ -43,7 +43,7 @@ be16dec(const void *pp)
}
static __inline uint32_t
be32dec(const void *pp)
Be32dec(const void *pp)
{
uint8_t const *p = (uint8_t const *)pp;
@ -51,7 +51,7 @@ be32dec(const void *pp)
}
static __inline void
be16enc(void *pp, uint16_t u)
Be16enc(void *pp, uint16_t u)
{
uint8_t *p = (uint8_t *)pp;
@ -60,7 +60,7 @@ be16enc(void *pp, uint16_t u)
}
static __inline void
be32enc(void *pp, uint32_t u)
Be32enc(void *pp, uint32_t u)
{
uint8_t *p = (uint8_t *)pp;

View File

@ -78,8 +78,8 @@ ntp64_2ts(struct timestamp *ts, const uint8_t *ptr)
{
INIT_OBJ(ts, TIMESTAMP_MAGIC);
ts->sec = be32dec(ptr) - NTP_UNIX;
ts->frac = (uint64_t)be32dec(ptr + 4) << 32ULL;
ts->sec = Be32dec(ptr) - NTP_UNIX;
ts->frac = (uint64_t)Be32dec(ptr + 4) << 32ULL;
}
static void
@ -87,8 +87,8 @@ ntp32_2ts(struct timestamp *ts, const uint8_t *ptr)
{
INIT_OBJ(ts, TIMESTAMP_MAGIC);
ts->sec = be16dec(ptr);
ts->frac = (uint64_t)be16dec(ptr + 2) << 48ULL;
ts->sec = Be16dec(ptr);
ts->frac = (uint64_t)Be16dec(ptr + 2) << 48ULL;
}
@ -136,8 +136,8 @@ ts_2ntp32(uint8_t *dst, const struct timestamp *ts)
CHECK_OBJ_NOTNULL(ts, TIMESTAMP_MAGIC);
assert(ts->sec < 65536);
be16enc(dst, ts->sec);
be16enc(dst + 2, ts->frac >> 48ULL);
Be16enc(dst, ts->sec);
Be16enc(dst + 2, ts->frac >> 48ULL);
}
static void
@ -145,8 +145,8 @@ ts_2ntp64(uint8_t *dst, const struct timestamp *ts)
{
CHECK_OBJ_NOTNULL(ts, TIMESTAMP_MAGIC);
be32enc(dst, ts->sec + NTP_UNIX);
be32enc(dst + 4, ts->frac >> 32ULL);
Be32enc(dst, ts->sec + NTP_UNIX);
Be32enc(dst + 4, ts->frac >> 32ULL);
}
ssize_t

View File

@ -180,7 +180,7 @@ NTP_Tool_Scan(struct ntp_packet *pkt, const char *buf)
pkt->ntp_precision = (int8_t)floor(d_fields[0]);
TS_Double(&pkt->ntp_delay, d_fields[1]);
TS_Double(&pkt->ntp_dispersion, d_fields[2]);
be32enc(pkt->ntp_refid, u_fields[5]);
Be32enc(pkt->ntp_refid, u_fields[5]);
TS_Nanosec(&pkt->ntp_origin, u_fields[6], u_fields[7]);