Jim Park's Unicode NSIS merging - Step 1 : switch to TCHARs where relevant.
Compiler output is identical before & after this step git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/branches/wizou@6036 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
4e48722b63
commit
752d7d239a
209 changed files with 9698 additions and 7658 deletions
|
@ -9,6 +9,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/27/2007
|
||||
*/
|
||||
|
||||
/* deflate.h -- internal compression state
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/27/2007
|
||||
* All messages and true strings turned into TCHARs for when we
|
||||
* create viewable messages.
|
||||
*/
|
||||
|
||||
#include "../Platform.h"
|
||||
|
@ -367,14 +371,14 @@ int ZEXPORT inflate(z_streamp z)
|
|||
switch (t >> 1)
|
||||
{
|
||||
case 0: /* stored */
|
||||
Tracev((stderr, "inflate: stored block%s\n",
|
||||
LAST ? " (last)" : ""));
|
||||
Tracev((stderr, _T("inflate: stored block%s\n"),
|
||||
LAST ? _T(" (last)") : _T("")));
|
||||
DUMPBITS(k&7)
|
||||
s->mode = LENS; /* get length of stored block */
|
||||
break;
|
||||
case 1: /* fixed */
|
||||
Tracev((stderr, "inflate: fixed codes block%s\n",
|
||||
LAST ? " (last)" : ""));
|
||||
Tracev((stderr, _T("inflate: fixed codes block%s\n"),
|
||||
LAST ? _T(" (last)") : _T("")));
|
||||
{
|
||||
if (!fixed_built)
|
||||
{
|
||||
|
@ -414,8 +418,8 @@ int ZEXPORT inflate(z_streamp z)
|
|||
s->mode = CODES_START;
|
||||
break;
|
||||
case 2: /* dynamic */
|
||||
Tracev((stderr, "inflate: dynamic codes block%s\n",
|
||||
LAST ? " (last)" : ""));
|
||||
Tracev((stderr, _T("inflate: dynamic codes block%s\n"),
|
||||
LAST ? _T(" (last)") : _T("")));
|
||||
s->mode = TABLE;
|
||||
break;
|
||||
case 3: /* illegal */
|
||||
|
@ -427,7 +431,7 @@ int ZEXPORT inflate(z_streamp z)
|
|||
NEEDBITS(16)
|
||||
s->sub.left = (uInt)b & 0xffff;
|
||||
b = k = 0; /* dump bits */
|
||||
Tracev((stderr, "inflate: stored length %u\n", s->sub.left));
|
||||
Tracev((stderr, _T("inflate: stored length %u\n"), s->sub.left));
|
||||
s->mode = s->sub.left ? STORED : s->last;
|
||||
break;
|
||||
case STORED:
|
||||
|
@ -457,7 +461,7 @@ int ZEXPORT inflate(z_streamp z)
|
|||
//t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f);
|
||||
DUMPBITS(14)
|
||||
s->sub.trees.index = 0;
|
||||
Tracev((stderr, "inflate: table sizes ok\n"));
|
||||
Tracev((stderr, _T("inflate: table sizes ok\n")));
|
||||
s->mode = BTREE;
|
||||
case BTREE:
|
||||
while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10))
|
||||
|
@ -483,7 +487,7 @@ int ZEXPORT inflate(z_streamp z)
|
|||
}
|
||||
|
||||
s->sub.trees.index = 0;
|
||||
Tracev((stderr, "inflate: bits tree ok\n"));
|
||||
Tracev((stderr, _T("inflate: bits tree ok\n")));
|
||||
s->mode = DTREE;
|
||||
case DTREE:
|
||||
while (t = s->sub.trees.table,
|
||||
|
@ -558,7 +562,7 @@ int ZEXPORT inflate(z_streamp z)
|
|||
s->mode = BAD;
|
||||
LEAVE(Z_DATA_ERROR);
|
||||
}
|
||||
Tracev((stderr, "inflate: trees ok\n"));
|
||||
Tracev((stderr, _T("inflate: trees ok\n")));
|
||||
|
||||
//s->sub.decode.t_codes.mode = CODES_START;
|
||||
s->sub.decode.t_codes.lbits = (Byte)bl;
|
||||
|
@ -682,7 +686,7 @@ int ZEXPORT inflate(z_streamp z)
|
|||
LEAVE(Z_OK)
|
||||
if (s->mode == CODES_WASH)
|
||||
{
|
||||
Tracev((stderr, "inflate: codes end, %lu total out\n",
|
||||
Tracev((stderr, _T("inflate: codes end, %lu total out\n"),
|
||||
z->total_out + (q >= s->read ? q - s->read :
|
||||
(s->end - s->read) + (q - s->window))));
|
||||
}
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/27/2007
|
||||
*/
|
||||
|
||||
/* zconf.h -- configuration of the zlib compression library
|
||||
|
@ -16,7 +18,7 @@
|
|||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id: ZCONF.H,v 1.2 2006/10/28 19:45:02 joostverburg Exp $ */
|
||||
/* @(#) $Id: ZCONF.H,v 1.3 2007/01/13 17:28:23 kichik Exp $ */
|
||||
|
||||
#ifndef _ZCONF_H
|
||||
#define _ZCONF_H
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/27/2007
|
||||
*/
|
||||
|
||||
/* zlib.h -- interface of the 'zlib' general purpose compression library
|
||||
|
@ -175,7 +177,7 @@ typedef struct z_stream_s {
|
|||
uLong total_out; /* total nb of bytes output so far */
|
||||
#endif
|
||||
|
||||
// char *msg; /* last error message, NULL if no error */
|
||||
// TCHAR *msg; /* last error message, NULL if no error */
|
||||
//struct internal_state FAR *state; /* not visible by applications */
|
||||
#ifdef EXEHEAD
|
||||
struct inflate_blocks_state blocks; /* current inflate_blocks state */
|
||||
|
@ -278,16 +280,16 @@ ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm));
|
|||
* and the compiler's view of z_stream:
|
||||
*/
|
||||
ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level,
|
||||
const char *version, int stream_size));
|
||||
const TCHAR *version, int stream_size));
|
||||
//ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm,
|
||||
// const char *version, int stream_size));
|
||||
// const TCHAR *version, int stream_size));
|
||||
ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method,
|
||||
int windowBits, int memLevel,
|
||||
int strategy, const char *version,
|
||||
int strategy, const TCHAR *version,
|
||||
int stream_size));
|
||||
|
||||
#define deflateInit(strm, level) \
|
||||
deflateInit_((strm), (level), "", sizeof(z_stream))
|
||||
deflateInit_((strm), (level), _T(""), sizeof(z_stream))
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -9,6 +9,11 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Reviewed for Unicode support by Jim Park -- 08/27/2007
|
||||
* The messages generated here are mostly #def'ed out, but are used
|
||||
* when debugging. So in order for the messages to be viewable in
|
||||
* Unicode version, using TCHAR macros.
|
||||
*/
|
||||
|
||||
/* zutil.h -- internal interface and configuration of the compression library
|
||||
|
@ -21,13 +26,14 @@
|
|||
subject to change. Applications should only use zlib.h.
|
||||
*/
|
||||
|
||||
/* @(#) $Id: ZUTIL.H,v 1.5 2007/01/13 17:28:23 kichik Exp $ */
|
||||
/* @(#) $Id: ZUTIL.H,v 1.6 2007/01/25 18:07:40 kichik Exp $ */
|
||||
|
||||
#ifndef _Z_UTIL_H
|
||||
#define _Z_UTIL_H
|
||||
|
||||
#include "../Platform.h"
|
||||
#include "ZLIB.H"
|
||||
#include "../tchar.h"
|
||||
|
||||
#ifndef local
|
||||
# define local static
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/27/2007
|
||||
* All messages and true strings turned into TCHARs for when we
|
||||
* create viewable messages.
|
||||
*/
|
||||
|
||||
/* deflate.c -- compress data using the deflation algorithm
|
||||
|
@ -19,8 +23,8 @@
|
|||
|
||||
#include "DEFLATE.H"
|
||||
|
||||
const char deflate_copyright[] =
|
||||
" deflate 1.1.3 Copyright 1995-1998 Jean-loup Gailly ";
|
||||
const TCHAR deflate_copyright[] =
|
||||
_T(" deflate 1.1.3 Copyright 1995-1998 Jean-loup Gailly ");
|
||||
/*
|
||||
If you use the zlib library in a product, an acknowledgment is welcome
|
||||
in the documentation of your product. If for some reason you cannot
|
||||
|
@ -113,7 +117,7 @@ struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
|
|||
int ZEXPORT deflateInit_(strm, level, version, stream_size)
|
||||
z_streamp strm;
|
||||
int level;
|
||||
const char *version;
|
||||
const TCHAR *version;
|
||||
int stream_size;
|
||||
{
|
||||
return deflateInit2_(strm, level, Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL,
|
||||
|
@ -130,7 +134,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
|||
int windowBits;
|
||||
int memLevel;
|
||||
int strategy;
|
||||
const char *version;
|
||||
const TCHAR *version;
|
||||
int stream_size;
|
||||
{
|
||||
deflate_state *s;
|
||||
|
@ -185,7 +189,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
|
|||
|
||||
if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
|
||||
s->pending_buf == Z_NULL) {
|
||||
// strm->msg = (char*)ERR_MSG(Z_MEM_ERROR);
|
||||
// strm->msg = (TCHAR*)ERR_MSG(Z_MEM_ERROR);
|
||||
deflateEnd (strm);
|
||||
return Z_MEM_ERROR;
|
||||
}
|
||||
|
@ -420,7 +424,7 @@ int ZEXPORT deflate (strm, flush)
|
|||
}
|
||||
}
|
||||
}
|
||||
Assert(strm->avail_out > 0, "bug2");
|
||||
Assert(strm->avail_out > 0, _T("bug2"));
|
||||
|
||||
if (flush != Z_FINISH) return Z_OK;
|
||||
if (s->noheader) return Z_STREAM_END;
|
||||
|
@ -546,7 +550,7 @@ local uInt longest_match(s, cur_match)
|
|||
/* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.
|
||||
* It is easy to get rid of this optimization if necessary.
|
||||
*/
|
||||
Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
|
||||
Assert(s->hash_bits >= 8 && MAX_MATCH == 258, _T("Code too clever"));
|
||||
|
||||
/* Do not waste too much time if we already have a good match: */
|
||||
if (s->prev_length >= s->good_match) {
|
||||
|
@ -557,10 +561,10 @@ local uInt longest_match(s, cur_match)
|
|||
*/
|
||||
if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead;
|
||||
|
||||
Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
|
||||
Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, _T("need lookahead"));
|
||||
|
||||
do {
|
||||
Assert(cur_match < s->strstart, "no future");
|
||||
Assert(cur_match < s->strstart, _T("no future"));
|
||||
match = s->window + cur_match;
|
||||
|
||||
/* Skip to next match if the match length cannot increase
|
||||
|
@ -573,7 +577,7 @@ local uInt longest_match(s, cur_match)
|
|||
if (*(ushf*)(match+best_len-1) != scan_end ||
|
||||
*(ushf*)match != scan_start) continue;
|
||||
|
||||
Assert(scan[2] == match[2], "scan[2]?");
|
||||
Assert(scan[2] == match[2], _T("scan[2]?"));
|
||||
scan++, match++;
|
||||
do {
|
||||
} while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) &&
|
||||
|
@ -584,7 +588,7 @@ local uInt longest_match(s, cur_match)
|
|||
/* The funny "do {}" generates better code on most compilers */
|
||||
|
||||
/* Here, scan <= window+strstart+257 */
|
||||
Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
|
||||
Assert(scan <= s->window+(unsigned)(s->window_size-1), _T("wild scan"));
|
||||
if (*scan == *match) scan++;
|
||||
|
||||
len = (MAX_MATCH - 1) - (int)(strend-scan);
|
||||
|
@ -598,7 +602,7 @@ local uInt longest_match(s, cur_match)
|
|||
*++match != scan[1]) continue;
|
||||
|
||||
scan += 2, match++;
|
||||
Assert(*scan == *match, "match[2]?");
|
||||
Assert(*scan == *match, _T("match[2]?"));
|
||||
do {
|
||||
} while (*++scan == *++match && *++scan == *++match &&
|
||||
*++scan == *++match && *++scan == *++match &&
|
||||
|
@ -606,7 +610,7 @@ local uInt longest_match(s, cur_match)
|
|||
*++scan == *++match && *++scan == *++match &&
|
||||
scan < strend);
|
||||
|
||||
Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
|
||||
Assert(scan <= s->window+(unsigned)(s->window_size-1), _T("wild scan"));
|
||||
|
||||
len = MAX_MATCH - (int)(strend - scan);
|
||||
scan = strend - MAX_MATCH;
|
||||
|
@ -644,11 +648,11 @@ local uInt longest_match(s, cur_match)
|
|||
register int len; /* length of current match */
|
||||
register Bytef *strend = s->window + s->strstart + MAX_MATCH;
|
||||
|
||||
Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever");
|
||||
Assert(s->hash_bits >= 8 && MAX_MATCH == 258, _T("Code too clever"));
|
||||
|
||||
Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead");
|
||||
Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, _T("need lookahead"));
|
||||
|
||||
Assert(cur_match < s->strstart, "no future");
|
||||
Assert(cur_match < s->strstart, _T("no future"));
|
||||
|
||||
match = s->window + cur_match;
|
||||
|
||||
|
@ -656,7 +660,7 @@ local uInt longest_match(s, cur_match)
|
|||
*/
|
||||
if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1;
|
||||
scan += 2, match += 2;
|
||||
Assert(*scan == *match, "match[2]?");
|
||||
Assert(*scan == *match, _T("match[2]?"));
|
||||
|
||||
do {
|
||||
} while (*++scan == *++match && *++scan == *++match &&
|
||||
|
@ -665,7 +669,7 @@ local uInt longest_match(s, cur_match)
|
|||
*++scan == *++match && *++scan == *++match &&
|
||||
scan < strend);
|
||||
|
||||
Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan");
|
||||
Assert(scan <= s->window+(unsigned)(s->window_size-1), _T("wild scan"));
|
||||
|
||||
len = MAX_MATCH - (int)(strend - scan);
|
||||
|
||||
|
@ -731,7 +735,7 @@ local void fill_window(s)
|
|||
more += wsize;
|
||||
}
|
||||
if (s->strm->avail_in == 0) return;
|
||||
Assert(more >= 2, "more < 2");
|
||||
Assert(more >= 2, _T("more < 2"));
|
||||
|
||||
n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more);
|
||||
s->lookahead += n;
|
||||
|
@ -756,7 +760,7 @@ local void fill_window(s)
|
|||
(eof)); \
|
||||
s->block_start = s->strstart; \
|
||||
flush_pending(s->strm); \
|
||||
Tracev((stderr,"[FLUSH]")); \
|
||||
Tracev((stderr,_T("[FLUSH]"))); \
|
||||
}
|
||||
|
||||
/* Same but force premature exit if necessary. */
|
||||
|
@ -829,7 +833,7 @@ local block_state deflate_slow(s, flush)
|
|||
if (bflush) FLUSH_BLOCK(s, 0);
|
||||
|
||||
} else if (s->match_available) {
|
||||
Tracevv((stderr,"%c", s->window[s->strstart-1]));
|
||||
Tracevv((stderr,_T("%c"), s->window[s->strstart-1]));
|
||||
_tr_tally_lit(s, s->window[s->strstart-1], bflush);
|
||||
if (bflush) {
|
||||
FLUSH_BLOCK_ONLY(s, 0);
|
||||
|
@ -846,9 +850,9 @@ local block_state deflate_slow(s, flush)
|
|||
s->lookahead--;
|
||||
}
|
||||
}
|
||||
Assert (flush != Z_NO_FLUSH, "no flush?");
|
||||
Assert (flush != Z_NO_FLUSH, _T("no flush?"));
|
||||
if (s->match_available) {
|
||||
Tracevv((stderr,"%c", s->window[s->strstart-1]));
|
||||
Tracevv((stderr,_T("%c"), s->window[s->strstart-1]));
|
||||
_tr_tally_lit(s, s->window[s->strstart-1], bflush);
|
||||
s->match_available = 0;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty.
|
||||
*
|
||||
* Unicode support by Jim Park -- 08/27/2007
|
||||
* All messages and true strings turned into TCHARs for when we
|
||||
* create viewable messages.
|
||||
*/
|
||||
|
||||
/* trees.c -- output deflated data using Huffman coding
|
||||
|
@ -126,7 +130,7 @@ local void gen_trees_header OF((void));
|
|||
|
||||
#else /* DEBUG */
|
||||
# define send_code(s, c, tree) \
|
||||
{ if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \
|
||||
{ if (z_verbose>2) _ftprintf(stderr,_T("\ncd %3d "),(c)); \
|
||||
send_bits(s, tree[c].Code, tree[c].Len); }
|
||||
#endif
|
||||
|
||||
|
@ -151,8 +155,8 @@ local void send_bits(s, value, length)
|
|||
int value; /* value to send */
|
||||
int length; /* number of bits */
|
||||
{
|
||||
Tracevv((stderr," l %2d v %4x ", length, value));
|
||||
Assert(length > 0 && length <= 15, "invalid length");
|
||||
Tracevv((stderr,_T(" l %2d v %4x "), length, value));
|
||||
Assert(length > 0 && length <= 15, _T("invalid length"));
|
||||
s->bits_sent += (ulg)length;
|
||||
|
||||
if (s->bi_valid > (int)Buf_size - length) {
|
||||
|
@ -217,7 +221,7 @@ local void tr_static_init()
|
|||
_length_code[length++] = (uch)code;
|
||||
}
|
||||
}
|
||||
Assert (length == 256, "tr_static_init: length != 256");
|
||||
Assert (length == 256, _T("tr_static_init: length != 256"));
|
||||
_length_code[length-1] = (uch)code;
|
||||
|
||||
/* Initialize the mapping dist (0..32K) -> dist code (0..29) */
|
||||
|
@ -228,7 +232,7 @@ local void tr_static_init()
|
|||
_dist_code[dist++] = (uch)code;
|
||||
}
|
||||
}
|
||||
Assert (dist == 256, "tr_static_init: dist != 256");
|
||||
Assert (dist == 256, _T("tr_static_init: dist != 256"));
|
||||
dist >>= 7; /* from now on, all distances are divided by 128 */
|
||||
for ( ; code < D_CODES; code++) {
|
||||
base_dist[code] = dist << 7;
|
||||
|
@ -236,7 +240,7 @@ local void tr_static_init()
|
|||
_dist_code[256 + dist++] = (uch)code;
|
||||
}
|
||||
}
|
||||
Assert (dist == 256, "tr_static_init: 256+dist != 512");
|
||||
Assert (dist == 256, _T("tr_static_init: 256+dist != 512"));
|
||||
|
||||
/* Construct the codes of the static literal tree */
|
||||
for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0;
|
||||
|
@ -373,7 +377,7 @@ local void gen_bitlen(s, desc)
|
|||
}
|
||||
if (overflow == 0) return;
|
||||
|
||||
Trace((stderr,"\nbit length overflow\n"));
|
||||
Trace((stderr,_T("\nbit length overflow\n")));
|
||||
do {
|
||||
bits = max_length-1;
|
||||
while (s->bl_count[bits] == 0) bits--;
|
||||
|
@ -389,7 +393,7 @@ local void gen_bitlen(s, desc)
|
|||
m = s->heap[--h];
|
||||
if (m > max_code) continue;
|
||||
if (tree[m].Len != (unsigned) bits) {
|
||||
Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits));
|
||||
Trace((stderr,_T("code %d bits %d->%d\n"), m, tree[m].Len, bits));
|
||||
s->opt_len += ((long)bits - (long)tree[m].Len)
|
||||
*(long)tree[m].Freq;
|
||||
tree[m].Len = (ush)bits;
|
||||
|
@ -413,8 +417,8 @@ local void gen_codes (tree, max_code, bl_count)
|
|||
next_code[bits] = code = (code + bl_count[bits-1]) << 1;
|
||||
}
|
||||
Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1,
|
||||
"inconsistent bit counts");
|
||||
Tracev((stderr,"\ngen_codes: max_code %d ", max_code));
|
||||
_T("inconsistent bit counts"));
|
||||
Tracev((stderr,_T("\ngen_codes: max_code %d "), max_code));
|
||||
|
||||
for (n = 0; n <= max_code; n++) {
|
||||
int len = tree[n].Len;
|
||||
|
@ -422,7 +426,7 @@ local void gen_codes (tree, max_code, bl_count)
|
|||
/* Now reverse the bits */
|
||||
tree[n].Code = bi_reverse(next_code[len]++, len);
|
||||
|
||||
Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ",
|
||||
Tracecv(tree != static_ltree, (stderr,_T("\nn %3d %c l %2d c %4x (%x) "),
|
||||
n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1));
|
||||
}
|
||||
}
|
||||
|
@ -473,7 +477,7 @@ local void build_tree(s, desc)
|
|||
tree[n].Dad = tree[m].Dad = (ush)node;
|
||||
#ifdef DUMP_BL_TREE
|
||||
if (tree == s->bl_tree) {
|
||||
fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)",
|
||||
_ftprintf(stderr,_T("\nnode %d(%d), sons %d(%d) %d(%d)"),
|
||||
node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq);
|
||||
}
|
||||
#endif
|
||||
|
@ -559,7 +563,7 @@ local void send_tree (s, tree, max_code)
|
|||
if (curlen != prevlen) {
|
||||
send_code(s, curlen, s->bl_tree); count--;
|
||||
}
|
||||
Assert(count >= 3 && count <= 6, " 3_6?");
|
||||
Assert(count >= 3 && count <= 6, _T(" 3_6?"));
|
||||
send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2);
|
||||
|
||||
} else if (count <= 10) {
|
||||
|
@ -595,7 +599,7 @@ local int build_bl_tree(s)
|
|||
}
|
||||
/* Update opt_len to include the bit length tree and counts */
|
||||
s->opt_len += 3*(max_blindex+1) + 5+5+4;
|
||||
Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld",
|
||||
Tracev((stderr, _T("\ndyn trees: dyn %ld, stat %ld"),
|
||||
s->opt_len, s->static_len));
|
||||
|
||||
return max_blindex;
|
||||
|
@ -607,24 +611,24 @@ local void send_all_trees(s, lcodes, dcodes, blcodes)
|
|||
{
|
||||
int rank; /* index in bl_order */
|
||||
|
||||
Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes");
|
||||
Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, _T("not enough codes"));
|
||||
Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES,
|
||||
"too many codes");
|
||||
Tracev((stderr, "\nbl counts: "));
|
||||
_T("too many codes"));
|
||||
Tracev((stderr, _T("\nbl counts: ")));
|
||||
send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */
|
||||
send_bits(s, dcodes-1, 5);
|
||||
send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */
|
||||
for (rank = 0; rank < blcodes; rank++) {
|
||||
Tracev((stderr, "\nbl code %2d ", bl_order[rank]));
|
||||
Tracev((stderr, _T("\nbl code %2d "), bl_order[rank]));
|
||||
send_bits(s, s->bl_tree[bl_order[rank]].Len, 3);
|
||||
}
|
||||
Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent));
|
||||
Tracev((stderr, _T("\nbl tree: sent %ld"), s->bits_sent));
|
||||
|
||||
send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */
|
||||
Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent));
|
||||
Tracev((stderr, _T("\nlit tree: sent %ld"), s->bits_sent));
|
||||
|
||||
send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */
|
||||
Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent));
|
||||
Tracev((stderr, _T("\ndist tree: sent %ld"), s->bits_sent));
|
||||
}
|
||||
|
||||
void _tr_stored_block(s, buf, stored_len, eof)
|
||||
|
@ -675,11 +679,11 @@ void _tr_flush_block(s, buf, stored_len, eof)
|
|||
|
||||
/* Construct the literal and distance trees */
|
||||
build_tree(s, (tree_desc *)(&(s->l_desc)));
|
||||
Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len,
|
||||
Tracev((stderr, _T("\nlit data: dyn %ld, stat %ld"), s->opt_len,
|
||||
s->static_len));
|
||||
|
||||
build_tree(s, (tree_desc *)(&(s->d_desc)));
|
||||
Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len,
|
||||
Tracev((stderr, _T("\ndist data: dyn %ld, stat %ld"), s->opt_len,
|
||||
s->static_len));
|
||||
max_blindex = build_bl_tree(s);
|
||||
|
||||
|
@ -687,14 +691,14 @@ void _tr_flush_block(s, buf, stored_len, eof)
|
|||
opt_lenb = (s->opt_len+3+7)>>3;
|
||||
static_lenb = (s->static_len+3+7)>>3;
|
||||
|
||||
Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ",
|
||||
Tracev((stderr, _T("\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u "),
|
||||
opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len,
|
||||
s->last_lit));
|
||||
|
||||
if (static_lenb <= opt_lenb) opt_lenb = static_lenb;
|
||||
|
||||
} else {
|
||||
Assert(buf != (char*)0, "lost buf");
|
||||
Assert(buf != (char*)0, _T("lost buf"));
|
||||
opt_lenb = static_lenb = stored_len + 5; /* force a stored block */
|
||||
}
|
||||
|
||||
|
@ -725,7 +729,7 @@ void _tr_flush_block(s, buf, stored_len, eof)
|
|||
s->compressed_len += 3 + s->opt_len;
|
||||
#endif
|
||||
}
|
||||
Assert (s->compressed_len == s->bits_sent, "bad compressed size");
|
||||
Assert (s->compressed_len == s->bits_sent, _T("bad compressed size"));
|
||||
|
||||
init_block(s);
|
||||
|
||||
|
@ -735,7 +739,7 @@ void _tr_flush_block(s, buf, stored_len, eof)
|
|||
s->compressed_len += 7; /* align on byte boundary */
|
||||
#endif
|
||||
}
|
||||
Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3,
|
||||
Tracev((stderr,_T("\ncomprlen %lu(%lu) "), s->compressed_len>>3,
|
||||
s->compressed_len-7*eof));
|
||||
}
|
||||
|
||||
|
@ -755,7 +759,7 @@ int _tr_tally (s, dist, lc)
|
|||
dist--; /* dist = match distance - 1 */
|
||||
Assert((ush)dist < (ush)MAX_DIST(s) &&
|
||||
(ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) &&
|
||||
(ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match");
|
||||
(ush)d_code(dist) < (ush)D_CODES, _T("_tr_tally: bad match"));
|
||||
|
||||
s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++;
|
||||
s->dyn_dtree[d_code(dist)].Freq++;
|
||||
|
@ -773,7 +777,7 @@ int _tr_tally (s, dist, lc)
|
|||
(5L+extra_dbits[dcode]);
|
||||
}
|
||||
out_length >>= 3;
|
||||
Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ",
|
||||
Tracev((stderr,_T("\nlast_lit %u, in %ld, out ~%ld(%ld%%) "),
|
||||
s->last_lit, in_length, out_length,
|
||||
100L - out_length*100L/in_length));
|
||||
if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1;
|
||||
|
@ -798,7 +802,7 @@ local void compress_block(s, ltree, dtree)
|
|||
lc = s->l_buf[lx++];
|
||||
if (dist == 0) {
|
||||
send_code(s, lc, ltree); /* send a literal byte */
|
||||
Tracecv(isgraph(lc), (stderr," '%c' ", lc));
|
||||
Tracecv(isgraph(lc), (stderr,_T(" '%c' "), lc));
|
||||
} else {
|
||||
/* Here, lc is the match length - MIN_MATCH */
|
||||
code = _length_code[lc];
|
||||
|
@ -810,7 +814,7 @@ local void compress_block(s, ltree, dtree)
|
|||
}
|
||||
dist--; /* dist is now the match distance - 1 */
|
||||
code = d_code(dist);
|
||||
Assert (code < D_CODES, "bad d_code");
|
||||
Assert (code < D_CODES, _T("bad d_code"));
|
||||
|
||||
send_code(s, code, dtree); /* send the distance code */
|
||||
extra = extra_dbits[code];
|
||||
|
@ -821,7 +825,7 @@ local void compress_block(s, ltree, dtree)
|
|||
} /* literal or match pair ? */
|
||||
|
||||
/* Check that the overlay between pending_buf and d_buf+l_buf is ok: */
|
||||
Assert(s->pending < s->lit_bufsize + 2*lx, "pendingBuf overflow");
|
||||
Assert(s->pending < s->lit_bufsize + 2*lx, _T("pendingBuf overflow"));
|
||||
|
||||
} while (lx < s->last_lit);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue