Kaydet (Commit) 7720e597 authored tarafından Chris Sherlock's avatar Chris Sherlock

rtl: fix equality conditions in crc.cxx and digest.cxx

Change-Id: I3408c2800a5cc41026e5fec8ef99c408e64d69ea
üst 42bd4103
...@@ -20,11 +20,9 @@ ...@@ -20,11 +20,9 @@
#include <sal/types.h> #include <sal/types.h>
#include <rtl/crc.h> #include <rtl/crc.h>
/*======================================================================== /**
* rtl_crc32Table (CRC polynomial 0xEDB88320).
* rtl_crc32Table (CRC polynomial 0xEDB88320). */
*
*======================================================================*/
static const sal_uInt32 rtl_crc32Table[256] = static const sal_uInt32 rtl_crc32Table[256] =
{ {
/* 0 */ /* 0 */
...@@ -124,17 +122,9 @@ static const sal_uInt32 rtl_crc32Table[256] = ...@@ -124,17 +122,9 @@ static const sal_uInt32 rtl_crc32Table[256] =
0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
}; };
/*========================================================================
*
* rtl_crc32 implementation.
*
*======================================================================*/
#define UPDCRC32(crc, octet) \ #define UPDCRC32(crc, octet) \
(rtl_crc32Table[((crc) ^ (octet)) & 0xff] ^ ((crc) >> 8)) (rtl_crc32Table[((crc) ^ (octet)) & 0xff] ^ ((crc) >> 8))
/*
* rtl_crc32.
*/
sal_uInt32 SAL_CALL rtl_crc32 ( sal_uInt32 SAL_CALL rtl_crc32 (
sal_uInt32 Crc, sal_uInt32 Crc,
const void *Data, sal_uInt32 DatLen) SAL_THROW_EXTERN_C() const void *Data, sal_uInt32 DatLen) SAL_THROW_EXTERN_C()
...@@ -145,8 +135,12 @@ sal_uInt32 SAL_CALL rtl_crc32 ( ...@@ -145,8 +135,12 @@ sal_uInt32 SAL_CALL rtl_crc32 (
const sal_uInt8 *q = p + DatLen; const sal_uInt8 *q = p + DatLen;
Crc = ~Crc; Crc = ~Crc;
while (p < q) while (p < q)
{
Crc = UPDCRC32(Crc, *(p++)); Crc = UPDCRC32(Crc, *(p++));
}
Crc = ~Crc; Crc = ~Crc;
} }
return Crc; return Crc;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment