- /* Read the main code and prepare its decode table.
- *
- * Note that the codeword lengths in the main code are encoded
- * in two parts: one part for literal symbols, and one part for
- * match symbols. */
-
- ret = lzx_read_codeword_lens(istream, tables->maincode_lens,
- LZX_NUM_CHARS);
- if (ret)
- return ret;
-
- ret = lzx_read_codeword_lens(istream,
- tables->maincode_lens + LZX_NUM_CHARS,
- num_main_syms - LZX_NUM_CHARS);
- if (ret)
- return ret;
-
- ret = make_huffman_decode_table(tables->maincode_decode_table,
- num_main_syms,
- LZX_MAINCODE_TABLEBITS,
- tables->maincode_lens,
- LZX_MAX_MAIN_CODEWORD_LEN);
- if (ret)
- return ret;
-
- /* Read the length code and prepare its decode table. */
-
- ret = lzx_read_codeword_lens(istream, tables->lencode_lens,
- LZX_LENCODE_NUM_SYMBOLS);
- if (ret)
- return ret;
-
- ret = make_huffman_decode_table(tables->lencode_decode_table,
- LZX_LENCODE_NUM_SYMBOLS,
- LZX_LENCODE_TABLEBITS,
- tables->lencode_lens,
- LZX_MAX_LEN_CODEWORD_LEN);
- if (ret)
- return ret;
+ /* Read the main codeword lengths, which are divided into two
+ * parts: literal symbols and match headers. */
+
+ if (lzx_read_codeword_lens(d, is, d->maincode_lens,
+ LZX_NUM_CHARS))
+ return -1;
+
+ if (lzx_read_codeword_lens(d, is, d->maincode_lens + LZX_NUM_CHARS,
+ d->num_main_syms - LZX_NUM_CHARS))
+ return -1;
+
+
+ /* Read the length codeword lengths. */
+
+ if (lzx_read_codeword_lens(d, is, d->lencode_lens,
+ LZX_LENCODE_NUM_SYMBOLS))
+ return -1;