diff options
author | Dan Williams <dcbw@redhat.com> | 2012-05-30 11:40:20 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2012-05-31 17:25:49 -0500 |
commit | 166844b946e110bced999ed01638fa7bc29b589e (patch) | |
tree | 9cf90fb88b7b79a1dc1551cd477f0b23cf5f1006 | |
parent | 1e0cdf43737e90a3828a54f74ca607dd34885abc (diff) |
wmc: namespace stuff properly
-rw-r--r-- | libwmc/src/utils.c | 8 | ||||
-rw-r--r-- | libwmc/src/utils.h | 8 | ||||
-rw-r--r-- | libwmc/tests/test-wmc-crc.c | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/libwmc/src/utils.c b/libwmc/src/utils.c index 059038ca..408e1077 100644 --- a/libwmc/src/utils.c +++ b/libwmc/src/utils.c @@ -33,7 +33,7 @@ */ /* Table of CRCs for each possible byte, with a generator polynomial of 0x8408 */ -const u_int16_t crc_table[256] = { +static const u_int16_t crc_table[256] = { 0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, @@ -70,7 +70,7 @@ const u_int16_t crc_table[256] = { /* Calculate the CRC for a buffer using a seed of 0xffff */ u_int16_t -crc16 (const char *buffer, size_t len, u_int16_t seed) +wmc_crc16 (const char *buffer, size_t len, u_int16_t seed) { u_int16_t crc = seed ? seed : 0xFFFF; @@ -209,7 +209,7 @@ hdlc_encapsulate_buffer (char *inbuf, wmc_return_val_if_fail (outbuf != NULL, 0); /* Add the CRC */ - crc = crc16 (inbuf, cmd_len, crc_seed ? crc_seed : 0xFFFF); + crc = wmc_crc16 (inbuf, cmd_len, crc_seed ? crc_seed : 0xFFFF); inbuf[cmd_len++] = crc & 0xFF; inbuf[cmd_len++] = (crc >> 8) & 0xFF; @@ -402,7 +402,7 @@ hdlc_decapsulate_buffer (const char *inbuf, } /* Check the CRC of the packet's data */ - crc = crc16 (outbuf, unesc_len - 2, 0); + crc = wmc_crc16 (outbuf, unesc_len - 2, 0); pkt_crc = outbuf[unesc_len - 2] & 0xFF; pkt_crc |= (outbuf[unesc_len - 1] & 0xFF) << 8; if (crc != pkt_crc) { diff --git a/libwmc/src/utils.h b/libwmc/src/utils.h index 6db590f5..f1fc4236 100644 --- a/libwmc/src/utils.h +++ b/libwmc/src/utils.h @@ -15,8 +15,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef UTILS_H -#define UTILS_H +#ifndef LIBWMC_UTILS_H +#define LIBWMC_UTILS_H #include <sys/types.h> @@ -33,7 +33,7 @@ typedef u_int8_t wmcbool; /* Utility and testcase functions */ -u_int16_t crc16 (const char *buffer, size_t len, u_int16_t seed); +u_int16_t wmc_crc16 (const char *buffer, size_t len, u_int16_t seed); size_t hdlc_escape (const char *inbuf, size_t inbuf_len, @@ -84,5 +84,5 @@ wmcbool wmc_decapsulate (const char *inbuf, wmcbool *out_need_more, wmcbool uml290); -#endif /* UTILS_H */ +#endif /* LIBWMC_UTILS_H */ diff --git a/libwmc/tests/test-wmc-crc.c b/libwmc/tests/test-wmc-crc.c index a767481d..29650113 100644 --- a/libwmc/tests/test-wmc-crc.c +++ b/libwmc/tests/test-wmc-crc.c @@ -42,7 +42,7 @@ test_crc16_2 (void *f, void *data) guint16 expected = 0x6D69; /* CRC check */ - crc = crc16 (buf, sizeof (buf), 0); + crc = wmc_crc16 (buf, sizeof (buf), 0); g_assert (crc == expected); } @@ -59,7 +59,7 @@ test_crc16_1 (void *f, void *data) guint16 expected = 0x097A; /* CRC check */ - crc = crc16 (buf, sizeof (buf), 0); + crc = wmc_crc16 (buf, sizeof (buf), 0); g_assert (crc == expected); } |