--- libaitcrc/src/aitcrc.c 2012/07/04 14:46:33 1.4.2.3 +++ libaitcrc/src/aitcrc.c 2012/07/04 14:53:43 1.5 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitcrc.c,v 1.4.2.3 2012/07/04 14:46:33 misho Exp $ +* $Id: aitcrc.c,v 1.5 2012/07/04 14:53:43 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -141,10 +141,7 @@ crcCalc(u_char * __restrict psBuf, u_int bufLen, u_cha u_int poly, crchibit, crc; register u_int i, j, b, ch; - if (!psBuf) { - crc_SetErr(EINVAL, "Invalid parameters!"); - return -1; - } + assert(psBuf); switch (crcBits) { case 1: @@ -240,10 +237,7 @@ crcIP(u_char * __restrict buf, int bufLen) register u_int sum; u_short last = 0, *nBuf = (u_short*) buf; - if (!buf) { - crc_SetErr(EINVAL, "Invalid parameters!"); - return -1; - } + assert(buf); for (sum = 0; bufLen && bufLen > 1; bufLen -= 2) sum += *nBuf++; @@ -272,10 +266,7 @@ crcFletcher16(u_short * __restrict nBuf, int bufLen) register u_short s1, s2; register u_int clen; - if (!nBuf) { - crc_SetErr(EINVAL, "Invalid parameters!"); - return -1; - } + assert(nBuf); s1 = s2 = 0xFF; while (bufLen) { @@ -307,10 +298,7 @@ crcFletcher(u_short * __restrict nBuf, int bufLen) { register u_int s1, s2, clen; - if (!nBuf) { - crc_SetErr(EINVAL, "Invalid parameters!"); - return -1; - } + assert(nBuf); s1 = s2 = 0xFFFF; while (bufLen) { @@ -342,10 +330,7 @@ crcAdler(u_char * __restrict psBuf, int bufLen) { register u_int s1, s2, clen; - if (!psBuf) { - crc_SetErr(EINVAL, "Invalid parameters!"); - return -1; - } + assert(psBuf); s1 = 1L; s2 ^= s2;