aboutsummaryrefslogtreecommitdiffstats
path: root/inflate.c
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2012-06-19 05:48:36 +0000
committerXin LI <delphij@FreeBSD.org>2012-06-19 05:48:36 +0000
commit11598cceda4aa6b2db006d9dc3b7c80e9e727174 (patch)
tree65f97a778a7643891e5d3b1724fd3e6f5acd6279 /inflate.c
parent48e633e3cf6760e7d6fe3be88fd4a393374433a7 (diff)
downloadsrc-vendor/zlib/1.2.7.tar.gz
src-vendor/zlib/1.2.7.zip
Vendor import of zlib 1.2.7.vendor/zlib/1.2.7
Diffstat (limited to 'inflate.c')
-rw-r--r--inflate.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/inflate.c b/inflate.c
index cc89517bc893..47418a1e1e1e 100644
--- a/inflate.c
+++ b/inflate.c
@@ -1,5 +1,5 @@
/* inflate.c -- zlib decompression
- * Copyright (C) 1995-2011 Mark Adler
+ * Copyright (C) 1995-2012 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
@@ -519,11 +519,6 @@ unsigned out;
bits -= bits & 7; \
} while (0)
-/* Reverse the bytes in a 32-bit value */
-#define REVERSE(q) \
- ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \
- (((q) & 0xff00) << 8) + (((q) & 0xff) << 24))
-
/*
inflate() uses a state machine to process as much input data and generate as
much output data as possible before returning. The state machine is
@@ -817,7 +812,7 @@ int flush;
#endif
case DICTID:
NEEDBITS(32);
- strm->adler = state->check = REVERSE(hold);
+ strm->adler = state->check = ZSWAP32(hold);
INITBITS();
state->mode = DICT;
case DICT:
@@ -1189,7 +1184,7 @@ int flush;
#ifdef GUNZIP
state->flags ? hold :
#endif
- REVERSE(hold)) != state->check) {
+ ZSWAP32(hold)) != state->check) {
strm->msg = (char *)"incorrect data check";
state->mode = BAD;
break;
@@ -1275,7 +1270,7 @@ const Bytef *dictionary;
uInt dictLength;
{
struct inflate_state FAR *state;
- unsigned long id;
+ unsigned long dictid;
unsigned char *next;
unsigned avail;
int ret;
@@ -1286,11 +1281,11 @@ uInt dictLength;
if (state->wrap != 0 && state->mode != DICT)
return Z_STREAM_ERROR;
- /* check for correct dictionary id */
+ /* check for correct dictionary identifier */
if (state->mode == DICT) {
- id = adler32(0L, Z_NULL, 0);
- id = adler32(id, dictionary, dictLength);
- if (id != state->check)
+ dictid = adler32(0L, Z_NULL, 0);
+ dictid = adler32(dictid, dictionary, dictLength);
+ if (dictid != state->check)
return Z_DATA_ERROR;
}