The R Project SVN R

Rev

Rev 58272 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 58272 Rev 62873
Line 144... Line 144...
144
local void scan_tree      OF((deflate_state *s, ct_data *tree, int max_code));
144
local void scan_tree      OF((deflate_state *s, ct_data *tree, int max_code));
145
local void send_tree      OF((deflate_state *s, ct_data *tree, int max_code));
145
local void send_tree      OF((deflate_state *s, ct_data *tree, int max_code));
146
local int  build_bl_tree  OF((deflate_state *s));
146
local int  build_bl_tree  OF((deflate_state *s));
147
local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
147
local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
148
                              int blcodes));
148
                              int blcodes));
149
local void compress_block OF((deflate_state *s, ct_data *ltree,
149
local void compress_block OF((deflate_state *s, const ct_data *ltree,
150
                              ct_data *dtree));
150
                              const ct_data *dtree));
151
local int  detect_data_type OF((deflate_state *s));
151
local int  detect_data_type OF((deflate_state *s));
152
local unsigned bi_reverse OF((unsigned value, int length));
152
local unsigned bi_reverse OF((unsigned value, int length));
153
local void bi_windup      OF((deflate_state *s));
153
local void bi_windup      OF((deflate_state *s));
154
local void bi_flush       OF((deflate_state *s));
154
local void bi_flush       OF((deflate_state *s));
155
local void copy_block     OF((deflate_state *s, charf *buf, unsigned len,
155
local void copy_block     OF((deflate_state *s, charf *buf, unsigned len,
Line 970... Line 970...
970
    } else if (static_lenb >= 0) { /* force static trees */
970
    } else if (static_lenb >= 0) { /* force static trees */
971
#else
971
#else
972
    } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
972
    } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) {
973
#endif
973
#endif
974
        send_bits(s, (STATIC_TREES<<1)+last, 3);
974
        send_bits(s, (STATIC_TREES<<1)+last, 3);
975
        compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree);
975
        compress_block(s, (const ct_data *)static_ltree,
-
 
976
                       (const ct_data *)static_dtree);
976
#ifdef DEBUG
977
#ifdef DEBUG
977
        s->compressed_len += 3 + s->static_len;
978
        s->compressed_len += 3 + s->static_len;
978
#endif
979
#endif
979
    } else {
980
    } else {
980
        send_bits(s, (DYN_TREES<<1)+last, 3);
981
        send_bits(s, (DYN_TREES<<1)+last, 3);
981
        send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
982
        send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1,
982
                       max_blindex+1);
983
                       max_blindex+1);
983
        compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree);
984
        compress_block(s, (const ct_data *)s->dyn_ltree,
-
 
985
                       (const ct_data *)s->dyn_dtree);
984
#ifdef DEBUG
986
#ifdef DEBUG
985
        s->compressed_len += 3 + s->opt_len;
987
        s->compressed_len += 3 + s->opt_len;
986
#endif
988
#endif
987
    }
989
    }
988
    Assert (s->compressed_len == s->bits_sent, "bad compressed size");
990
    Assert (s->compressed_len == s->bits_sent, "bad compressed size");
Line 1055... Line 1057...
1055
/* ===========================================================================
1057
/* ===========================================================================
1056
 * Send the block data compressed using the given Huffman trees
1058
 * Send the block data compressed using the given Huffman trees
1057
 */
1059
 */
1058
local void compress_block(s, ltree, dtree)
1060
local void compress_block(s, ltree, dtree)
1059
    deflate_state *s;
1061
    deflate_state *s;
1060
    ct_data *ltree; /* literal tree */
1062
    const ct_data *ltree; /* literal tree */
1061
    ct_data *dtree; /* distance tree */
1063
    const ct_data *dtree; /* distance tree */
1062
{
1064
{
1063
    unsigned dist;      /* distance of matched string */
1065
    unsigned dist;      /* distance of matched string */
1064
    int lc;             /* match length or unmatched char (if dist == 0) */
1066
    int lc;             /* match length or unmatched char (if dist == 0) */
1065
    unsigned lx = 0;    /* running index in l_buf */
1067
    unsigned lx = 0;    /* running index in l_buf */
1066
    unsigned code;      /* the code to send */
1068
    unsigned code;      /* the code to send */