deflate_state reformatted

This commit is contained in:
Vitaly Puzrin 2014-02-15 00:52:33 +04:00
parent b4c0a04872
commit 3288124672

View file

@ -457,26 +457,23 @@ function lm_init(s) {
} }
function DeflateState() { function DeflateState() {
this.status = 0; // z_streamp strm; /* pointer back to this zlib stream */
/* as the name implies */ this.status = 0; /* as the name implies */
//this.pending_buf = Z_NULL; /* output still pending */ // pending_buf = Z_NULL; /* output still pending */
this.pending_buf_size = 0; this.pending_buf_size = 0; /* size of pending_buf */
/* size of pending_buf */ this.pending_out = 0; /* next pending byte to output to the stream */
this.pending_out = 0; this.pending = 0; /* nb of bytes in the pending buffer */
/* next pending byte to output to the stream */ this.wrap = 0; /* bit 0 true for zlib, bit 1 true for gzip */
this.pending = 0; // gz_headerp gzhead; /* gzip header information to write */
/* nb of bytes in the pending buffer */ // uInt gzindex; /* where in extra, name, or comment */
this.last_flush = Z_NULL; // Byte method; /* can only be DEFLATED */
/* value of flush param for previous deflate call */ this.last_flush = Z_NULL; /* value of flush param for previous deflate call */
this.w_size = 0; this.w_size = 0; /* LZ77 window size (32K by default) */
/* LZ77 window size (32K by default) */ this.w_bits = 0; /* log2(w_size) (8..16) */
this.w_bits = 0; this.w_mask = 0; /* w_size - 1 */
/* log2(w_size) (8..16) */
this.w_mask = 0;
/* w_size - 1 */
//this.window = Z_NULL; this.window = null;
/* Sliding window. Input bytes are read into the second half of the window, /* Sliding window. Input bytes are read into the second half of the window,
* and move to the first half later to keep a dictionary of at least wSize * and move to the first half later to keep a dictionary of at least wSize
* bytes. With this organization, matches are limited to a distance of * bytes. With this organization, matches are limited to a distance of
@ -495,17 +492,12 @@ function DeflateState() {
* An index in this array is thus a window index modulo 32K. * An index in this array is thus a window index modulo 32K.
*/ */
this.head = null; this.head = null; /* Heads of the hash chains or NIL. */
/* Heads of the hash chains or NIL. */
this.ins_h = 0; this.ins_h = 0; /* hash index of string to be inserted */
/* hash index of string to be inserted */ this.hash_size = 0; /* number of elements in hash table */
this.hash_size = 0; this.hash_bits = 0; /* log2(hash_size) */
/* number of elements in hash table */ this.hash_mask = 0; /* hash_size-1 */
this.hash_bits = 0;
/* log2(hash_size) */
this.hash_mask = 0;
/* hash_size-1 */
this.hash_shift = 0; this.hash_shift = 0;
/* Number of bits by which ins_h must be shifted at each input /* Number of bits by which ins_h must be shifted at each input
@ -519,18 +511,12 @@ function DeflateState() {
* negative when the window is moved backwards. * negative when the window is moved backwards.
*/ */
this.match_length = 0; this.match_length = 0; /* length of best match */
/* length of best match */ this.prev_match = 0; /* previous match */
this.prev_match = 0; this.match_available = 1; /* set if previous match exists */
/* previous match */ this.strstart = 0; /* start of string to insert */
this.match_available = 1; this.match_start = 0; /* start of matching string */
/* set if previous match exists */ this.lookahead = 0; /* number of valid bytes ahead in window */
this.strstart = 0;
/* start of string to insert */
this.match_start = 0;
/* start of matching string */
this.lookahead = 0;
/* number of valid bytes ahead in window */
this.prev_length = 0; this.prev_length = 0;
/* Length of the best match at previous step. Matches not greater than this /* Length of the best match at previous step. Matches not greater than this
@ -554,10 +540,8 @@ function DeflateState() {
* max_insert_length is used only for compression levels <= 3. * max_insert_length is used only for compression levels <= 3.
*/ */
this.level = 0; this.level = 0; /* compression level (1..9) */
/* compression level (1..9) */ this.strategy = 0; /* favor or force Huffman coding*/
this.strategy = 0;
/* favor or force Huffman coding*/
this.good_match = 0; this.good_match = 0;
/* Use a faster search when the previous match is longer than this */ /* Use a faster search when the previous match is longer than this */