diff options
author | Guy Harris <guy@alum.mit.edu> | 2003-08-26 06:18:18 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2003-08-26 06:18:18 +0000 |
commit | b73e8138a8456cdc0e3b40fb6d0ac25a47eb6602 (patch) | |
tree | 19dbd5781994835a4360c76337d44eb96bb9d12f /crc32.c | |
parent | cdd8b24d5c8d9e2cd685a2491d14d3fce7c13fc0 (diff) |
Make the CRC-32 routines take a tvbuff and a length as arguments.
Rename "crc32()" so as not to collide with the one in zlib; rename
"crc32_802()" to match.
svn path=/trunk/; revision=8268
Diffstat (limited to 'crc32.c')
-rw-r--r-- | crc32.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -1,7 +1,7 @@ /* crc32.c * CRC-32 routine * - * $Id: crc32.c,v 1.2 2003/08/26 05:52:43 guy Exp $ + * $Id: crc32.c,v 1.3 2003/08/26 06:18:16 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -30,6 +30,7 @@ */ #include <glib.h> +#include <epan/tvbuff.h> #include "crc32.h" /* @@ -96,9 +97,10 @@ const guint32 crc32_table[256] = { }; guint32 -crc32(const unsigned char* buf, unsigned int len) +crc32_tvb(tvbuff_t *tvb, unsigned int len) { unsigned int i; + const unsigned char* buf = tvb_get_ptr(tvb, 0, len); guint32 crc32 = 0xFFFFFFFF; for (i = 0; i < len; i++) @@ -117,11 +119,11 @@ crc32(const unsigned char* buf, unsigned int len) * to cope with 802.x sending stuff out in reverse bit order? */ guint32 -crc32_802(const unsigned char* buf, unsigned int len) +crc32_tvb_802(tvbuff_t *tvb, unsigned int len) { guint32 c_crc; - c_crc = crc32(buf, len); + c_crc = crc32_tvb(tvb, len); /* Byte reverse. */ c_crc = ((unsigned char)(c_crc>>0)<<24) | |