aboutsummaryrefslogtreecommitdiffstats
path: root/lib/zlib_inflate/inflate.c
diff options
context:
space:
mode:
authorSergey Senozhatsky <sergey.senozhatsky@gmail.com>2014-08-06 19:09:21 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-06 21:01:24 -0400
commit62e7ca5280fd8cbf523970757e13f0324ce0daa0 (patch)
tree868d7046eec27d64a88f6c3299eb85b2032538a3 /lib/zlib_inflate/inflate.c
parent0f9859ca92c9182bcb8f18c55cae1a04627cbb59 (diff)
zlib: clean up some dead code
Cleanup unused `if 0'-ed functions, which have been dead since 2006 (commits 87c2ce3b9305 ("lib/zlib*: cleanups") by Adrian Bunk and 4f3865fb57a0 ("zlib_inflate: Upgrade library code to a recent version") by Richard Purdie): - zlib_deflateSetDictionary - zlib_deflateParams - zlib_deflateCopy - zlib_inflateSync - zlib_syncsearch - zlib_inflateSetDictionary - zlib_inflatePrime Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib/zlib_inflate/inflate.c')
-rw-r--r--lib/zlib_inflate/inflate.c132
1 files changed, 0 insertions, 132 deletions
diff --git a/lib/zlib_inflate/inflate.c b/lib/zlib_inflate/inflate.c
index f5ce87b0800e..58a733b10387 100644
--- a/lib/zlib_inflate/inflate.c
+++ b/lib/zlib_inflate/inflate.c
@@ -45,21 +45,6 @@ int zlib_inflateReset(z_streamp strm)
45 return Z_OK; 45 return Z_OK;
46} 46}
47 47
48#if 0
49int zlib_inflatePrime(z_streamp strm, int bits, int value)
50{
51 struct inflate_state *state;
52
53 if (strm == NULL || strm->state == NULL) return Z_STREAM_ERROR;
54 state = (struct inflate_state *)strm->state;
55 if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR;
56 value &= (1L << bits) - 1;
57 state->hold += value << state->bits;
58 state->bits += bits;
59 return Z_OK;
60}
61#endif
62
63int zlib_inflateInit2(z_streamp strm, int windowBits) 48int zlib_inflateInit2(z_streamp strm, int windowBits)
64{ 49{
65 struct inflate_state *state; 50 struct inflate_state *state;
@@ -761,123 +746,6 @@ int zlib_inflateEnd(z_streamp strm)
761 return Z_OK; 746 return Z_OK;
762} 747}
763 748
764#if 0
765int zlib_inflateSetDictionary(z_streamp strm, const Byte *dictionary,
766 uInt dictLength)
767{
768 struct inflate_state *state;
769 unsigned long id;
770
771 /* check state */
772 if (strm == NULL || strm->state == NULL) return Z_STREAM_ERROR;
773 state = (struct inflate_state *)strm->state;
774 if (state->wrap != 0 && state->mode != DICT)
775 return Z_STREAM_ERROR;
776
777 /* check for correct dictionary id */
778 if (state->mode == DICT) {
779 id = zlib_adler32(0L, NULL, 0);
780 id = zlib_adler32(id, dictionary, dictLength);
781 if (id != state->check)
782 return Z_DATA_ERROR;
783 }
784
785 /* copy dictionary to window */
786 zlib_updatewindow(strm, strm->avail_out);
787
788 if (dictLength > state->wsize) {
789 memcpy(state->window, dictionary + dictLength - state->wsize,
790 state->wsize);
791 state->whave = state->wsize;
792 }
793 else {
794 memcpy(state->window + state->wsize - dictLength, dictionary,
795 dictLength);
796 state->whave = dictLength;
797 }
798 state->havedict = 1;
799 return Z_OK;
800}
801#endif
802
803#if 0
804/*
805 Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found
806 or when out of input. When called, *have is the number of pattern bytes
807 found in order so far, in 0..3. On return *have is updated to the new
808 state. If on return *have equals four, then the pattern was found and the
809 return value is how many bytes were read including the last byte of the
810 pattern. If *have is less than four, then the pattern has not been found
811 yet and the return value is len. In the latter case, zlib_syncsearch() can be
812 called again with more data and the *have state. *have is initialized to
813 zero for the first call.
814 */
815static unsigned zlib_syncsearch(unsigned *have, unsigned char *buf,
816 unsigned len)
817{
818 unsigned got;
819 unsigned next;
820
821 got = *have;
822 next = 0;
823 while (next < len && got < 4) {
824 if ((int)(buf[next]) == (got < 2 ? 0 : 0xff))
825 got++;
826 else if (buf[next])
827 got = 0;
828 else
829 got = 4 - got;
830 next++;
831 }
832 *have = got;
833 return next;
834}
835#endif
836
837#if 0
838int zlib_inflateSync(z_streamp strm)
839{
840 unsigned len; /* number of bytes to look at or looked at */
841 unsigned long in, out; /* temporary to save total_in and total_out */
842 unsigned char buf[4]; /* to restore bit buffer to byte string */
843 struct inflate_state *state;
844
845 /* check parameters */
846 if (strm == NULL || strm->state == NULL) return Z_STREAM_ERROR;
847 state = (struct inflate_state *)strm->state;
848 if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR;
849
850 /* if first time, start search in bit buffer */
851 if (state->mode != SYNC) {
852 state->mode = SYNC;
853 state->hold <<= state->bits & 7;
854 state->bits -= state->bits & 7;
855 len = 0;
856 while (state->bits >= 8) {
857 buf[len++] = (unsigned char)(state->hold);
858 state->hold >>= 8;
859 state->bits -= 8;
860 }
861 state->have = 0;
862 zlib_syncsearch(&(state->have), buf, len);
863 }
864
865 /* search available input */
866 len = zlib_syncsearch(&(state->have), strm->next_in, strm->avail_in);
867 strm->avail_in -= len;
868 strm->next_in += len;
869 strm->total_in += len;
870
871 /* return no joy or set up to restart inflate() on a new block */
872 if (state->have != 4) return Z_DATA_ERROR;
873 in = strm->total_in; out = strm->total_out;
874 zlib_inflateReset(strm);
875 strm->total_in = in; strm->total_out = out;
876 state->mode = TYPE;
877 return Z_OK;
878}
879#endif
880
881/* 749/*
882 * This subroutine adds the data at next_in/avail_in to the output history 750 * This subroutine adds the data at next_in/avail_in to the output history
883 * without performing any output. The output buffer must be "caught up"; 751 * without performing any output. The output buffer must be "caught up";