-static const unsigned short cplens[] = { /* Copy lengths for literal codes 257..285 */
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31,
- 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0
-};
-
-/* note: see note #13 above about the 258 in this list. */
-static const extra_bits_t cplext[] = { /* Extra bits for literal codes 257..285 */
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2,
- 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 99, 99
-}; /* 99==invalid */
-static const unsigned short cpdist[] = { /* Copy offsets for distance codes 0..29 */
- 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
- 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
- 8193, 12289, 16385, 24577
-};
-static const extra_bits_t cpdext[] = { /* Extra bits for distance codes */
- 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6,
- 7, 7, 8, 8, 9, 9, 10, 10, 11, 11,
- 12, 12, 13, 13
-};
+static int inflate_stored(int my_n, int my_b_stored, int my_k_stored, int setup)
+{
+ static int n, b_stored, k_stored, w;
+ if (setup) {
+ n = my_n;
+ b_stored = my_b_stored;
+ k_stored = my_k_stored;
+ w = gunzip_outbuf_count; /* initialize gunzip_window position */
+ return 0; // Don't do anything first time
+ }
+
+ /* read and output the compressed data */
+ while (n--) {
+ b_stored = fill_bitbuffer(b_stored, &k_stored, 8);
+ gunzip_window[w++] = (unsigned char) b_stored;
+ if (w == (unsigned int) gunzip_wsize) {
+ gunzip_outbuf_count = (w);
+ //flush_gunzip_window();
+ w = 0;
+ b_stored >>= 8;
+ k_stored -= 8;
+ return 1; // We have a block
+ }
+ b_stored >>= 8;
+ k_stored -= 8;
+ }