summaryrefslogtreecommitdiff
path: root/lib/zlib
diff options
context:
space:
mode:
Diffstat (limited to 'lib/zlib')
-rw-r--r--lib/zlib/deflate.c2
-rw-r--r--lib/zlib/deflate.h2
-rw-r--r--lib/zlib/inffast.c51
-rw-r--r--lib/zlib/trees.c2
-rw-r--r--lib/zlib/zlib.h1
-rw-r--r--lib/zlib/zutil.h1
6 files changed, 40 insertions, 19 deletions
diff --git a/lib/zlib/deflate.c b/lib/zlib/deflate.c
index 7e1ed4f9b20..af7542cc9a8 100644
--- a/lib/zlib/deflate.c
+++ b/lib/zlib/deflate.c
@@ -164,7 +164,6 @@ struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
*/
#define UPDATE_HASH(s,h,c) (h = (((h)<<s->hash_shift) ^ (c)) & s->hash_mask)
-
/* ===========================================================================
* Insert string str in the dictionary and set match_head to the previous head
* of the hash chain (the most recent string with same hash key). Return
@@ -966,7 +965,6 @@ int ZEXPORT deflateCopy (dest, source)
deflate_state *ds;
deflate_state *ss;
-
if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) {
return Z_STREAM_ERROR;
}
diff --git a/lib/zlib/deflate.h b/lib/zlib/deflate.h
index 4c53b94af0b..b4a4634ec78 100644
--- a/lib/zlib/deflate.h
+++ b/lib/zlib/deflate.h
@@ -57,7 +57,6 @@
#define FINISH_STATE 666
/* Stream status */
-
/* Data structure describing a single value and its code string. */
typedef struct ct_data_s {
union {
@@ -269,7 +268,6 @@ typedef struct internal_state {
*/
#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
-
#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
/* Minimum amount of lookahead, except at the end of the input file.
* See deflate.c for comments about the MIN_MATCH+1.
diff --git a/lib/zlib/inffast.c b/lib/zlib/inffast.c
index 5e2a65ad4d2..b5a0adcce69 100644
--- a/lib/zlib/inffast.c
+++ b/lib/zlib/inffast.c
@@ -236,18 +236,47 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
}
}
else {
+ unsigned short *sout;
+ unsigned long loops;
+
from = out - dist; /* copy direct from output */
- do { /* minimum length is three */
- *out++ = *from++;
- *out++ = *from++;
- *out++ = *from++;
- len -= 3;
- } while (len > 2);
- if (len) {
- *out++ = *from++;
- if (len > 1)
- *out++ = *from++;
- }
+ /* minimum length is three */
+ /* Align out addr */
+ if (!((long)(out - 1) & 1)) {
+ *out++ = *from++;
+ len--;
+ }
+ sout = (unsigned short *)out;
+ if (dist > 2 ) {
+ unsigned short *sfrom;
+
+ sfrom = (unsigned short *)from;
+ loops = len >> 1;
+ do
+ *sout++ = get_unaligned(sfrom++);
+ while (--loops);
+ out = (unsigned char *)sout;
+ from = (unsigned char *)sfrom;
+ } else { /* dist == 1 or dist == 2 */
+ unsigned short pat16;
+
+ pat16 = *(sout - 1);
+ if (dist == 1)
+#if defined(__BIG_ENDIAN)
+ pat16 = (pat16 & 0xff) | ((pat16 & 0xff ) << 8);
+#elif defined(__LITTLE_ENDIAN)
+ pat16 = (pat16 & 0xff00) | ((pat16 & 0xff00 ) >> 8);
+#else
+#error __BIG_ENDIAN nor __LITTLE_ENDIAN is defined
+#endif
+ loops = len >> 1;
+ do
+ *sout++ = pat16;
+ while (--loops);
+ out = (unsigned char *)sout;
+ }
+ if (len & 1)
+ *out++ = *from++;
}
}
else if ((op & 64) == 0) { /* 2nd level distance code */
diff --git a/lib/zlib/trees.c b/lib/zlib/trees.c
index e040617686a..569d44351e5 100644
--- a/lib/zlib/trees.c
+++ b/lib/zlib/trees.c
@@ -231,7 +231,6 @@ local void send_bits(s, value, length)
}
#endif /* DEBUG */
-
/* the arguments must not have side effects */
/* ===========================================================================
@@ -431,7 +430,6 @@ local void init_block(s)
#define SMALLEST 1
/* Index within the heap array of least frequent node in the Huffman tree */
-
/* ===========================================================================
* Remove the smallest element from the heap and recreate the heap with
* one less element. Updates heap and heap_len.
diff --git a/lib/zlib/zlib.h b/lib/zlib/zlib.h
index 560e7be97d3..f9b2f69ac02 100644
--- a/lib/zlib/zlib.h
+++ b/lib/zlib/zlib.h
@@ -10,7 +10,6 @@
/* avoid conflicts */
#undef OFF
#undef ASMINF
-#undef POSTINC
#undef NO_GZIP
#define GUNZIP
#undef STDC
diff --git a/lib/zlib/zutil.h b/lib/zlib/zutil.h
index e63bf68653f..c0c04196a02 100644
--- a/lib/zlib/zutil.h
+++ b/lib/zlib/zutil.h
@@ -114,7 +114,6 @@ extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
# define Tracecv(c,x)
#endif
-
voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
void zcfree OF((voidpf opaque, voidpf ptr, unsigned size));