Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
002d6a94
Commit
002d6a94
authored
Apr 19, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zlib: Run source files through zlib2ansi to avoid K&R function definitions.
parent
36203f1b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
239 additions
and
237 deletions
+239
-237
adler32.c
libs/zlib/adler32.c
+20
-20
crc32.c
libs/zlib/crc32.c
+54
-54
deflate.c
libs/zlib/deflate.c
+0
-0
inffast.c
libs/zlib/inffast.c
+3
-3
inflate.c
libs/zlib/inflate.c
+65
-65
inftrees.c
libs/zlib/inftrees.c
+7
-7
trees.c
libs/zlib/trees.c
+68
-66
zutil.c
libs/zlib/zutil.c
+22
-22
No files found.
libs/zlib/adler32.c
View file @
002d6a94
...
...
@@ -60,10 +60,10 @@ local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2));
#endif
/* ========================================================================= */
uLong
ZEXPORT
adler32_z
(
adler
,
buf
,
len
)
uLong
adler
;
const
Bytef
*
buf
;
z_size_t
len
;
uLong
ZEXPORT
adler32_z
(
uLong
adler
,
const
Bytef
*
buf
,
z_size_t
len
)
{
unsigned
long
sum2
;
unsigned
n
;
...
...
@@ -131,19 +131,19 @@ uLong ZEXPORT adler32_z(adler, buf, len)
}
/* ========================================================================= */
uLong
ZEXPORT
adler32
(
adler
,
buf
,
len
)
uLong
adler
;
const
Bytef
*
buf
;
uInt
len
;
uLong
ZEXPORT
adler32
(
uLong
adler
,
const
Bytef
*
buf
,
uInt
len
)
{
return
adler32_z
(
adler
,
buf
,
len
);
}
/* ========================================================================= */
local
uLong
adler32_combine_
(
adler1
,
adler2
,
len2
)
uLong
adler1
;
uLong
adler2
;
z_off64_t
len2
;
local
uLong
adler32_combine_
(
uLong
adler1
,
uLong
adler2
,
z_off64_t
len2
)
{
unsigned
long
sum1
;
unsigned
long
sum2
;
...
...
@@ -169,18 +169,18 @@ local uLong adler32_combine_(adler1, adler2, len2)
}
/* ========================================================================= */
uLong
ZEXPORT
adler32_combine
(
adler1
,
adler2
,
len2
)
uLong
adler1
;
uLong
adler2
;
z_off_t
len2
;
uLong
ZEXPORT
adler32_combine
(
uLong
adler1
,
uLong
adler2
,
z_off_t
len2
)
{
return
adler32_combine_
(
adler1
,
adler2
,
len2
);
}
uLong
ZEXPORT
adler32_combine64
(
adler1
,
adler2
,
len2
)
uLong
adler1
;
uLong
adler2
;
z_off64_t
len2
;
uLong
ZEXPORT
adler32_combine64
(
uLong
adler1
,
uLong
adler2
,
z_off64_t
len2
)
{
return
adler32_combine_
(
adler1
,
adler2
,
len2
);
}
libs/zlib/crc32.c
View file @
002d6a94
...
...
@@ -123,8 +123,8 @@ local z_crc_t x2nmodp OF((z_off64_t n, unsigned k));
instruction, if one is available. This assumes that word_t is either 32 bits
or 64 bits.
*/
local
z_word_t
byte_swap
(
word
)
z_word_t
word
;
local
z_word_t
byte_swap
(
z_word_t
word
)
{
# if W == 8
return
...
...
@@ -223,8 +223,8 @@ struct once_s {
/* Test and set. Alas, not atomic, but tries to minimize the period of
vulnerability. */
local
int
test_and_set
OF
((
int
volatile
*
));
local
int
test_and_set
(
flag
)
int
volatile
*
flag
;
local
int
test_and_set
(
int
volatile
*
flag
)
{
int
was
;
...
...
@@ -447,10 +447,10 @@ local void make_crc_table()
Write the 32-bit values in table[0..k-1] to out, five per line in
hexadecimal separated by commas.
*/
local
void
write_table
(
out
,
table
,
k
)
FILE
*
out
;
const
z_crc_t
FAR
*
table
;
int
k
;
local
void
write_table
(
FILE
*
out
,
const
z_crc_t
FAR
*
table
,
int
k
)
{
int
n
;
...
...
@@ -464,10 +464,10 @@ local void write_table(out, table, k)
Write the high 32-bits of each value in table[0..k-1] to out, five per line
in hexadecimal separated by commas.
*/
local
void
write_table32hi
(
out
,
table
,
k
)
FILE
*
out
;
const
z_word_t
FAR
*
table
;
int
k
;
local
void
write_table32hi
(
FILE
*
out
,
const
z_word_t
FAR
*
table
,
int
k
)
{
int
n
;
...
...
@@ -484,10 +484,10 @@ int k;
bits. If not, then the type cast and format string can be adjusted
accordingly.
*/
local
void
write_table64
(
out
,
table
,
k
)
FILE
*
out
;
const
z_word_t
FAR
*
table
;
int
k
;
local
void
write_table64
(
FILE
*
out
,
const
z_word_t
FAR
*
table
,
int
k
)
{
int
n
;
...
...
@@ -548,9 +548,9 @@ local void braid(ltl, big, n, w)
Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial,
reflected. For speed, this requires that a not be zero.
*/
local
z_crc_t
multmodp
(
a
,
b
)
z_crc_t
a
;
z_crc_t
b
;
local
z_crc_t
multmodp
(
z_crc_t
a
,
z_crc_t
b
)
{
z_crc_t
m
,
p
;
...
...
@@ -572,9 +572,9 @@ local z_crc_t multmodp(a, b)
Return x^(n * 2^k) modulo p(x). Requires that x2n_table[] has been
initialized.
*/
local
z_crc_t
x2nmodp
(
n
,
k
)
z_off64_t
n
;
unsigned
k
;
local
z_crc_t
x2nmodp
(
z_off64_t
n
,
unsigned
k
)
{
z_crc_t
p
;
...
...
@@ -619,10 +619,10 @@ const z_crc_t FAR * ZEXPORT get_crc_table()
#define Z_BATCH_ZEROS 0xa10d3d0c
/* computed from Z_BATCH = 3990 */
#define Z_BATCH_MIN 800
/* fewest words in a final batch */
unsigned
long
ZEXPORT
crc32_z
(
crc
,
buf
,
len
)
unsigned
long
crc
;
const
unsigned
char
FAR
*
buf
;
z_size_t
len
;
unsigned
long
ZEXPORT
crc32_z
(
unsigned
long
crc
,
const
unsigned
char
FAR
*
buf
,
z_size_t
len
)
{
z_crc_t
val
;
z_word_t
crc1
,
crc2
;
...
...
@@ -723,8 +723,8 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
least-significant byte of the word as the first byte of data, without any pre
or post conditioning. This is used to combine the CRCs of each braid.
*/
local
z_crc_t
crc_word
(
data
)
z_word_t
data
;
local
z_crc_t
crc_word
(
z_word_t
data
)
{
int
k
;
for
(
k
=
0
;
k
<
W
;
k
++
)
...
...
@@ -732,8 +732,8 @@ local z_crc_t crc_word(data)
return
(
z_crc_t
)
data
;
}
local
z_word_t
crc_word_big
(
data
)
z_word_t
data
;
local
z_word_t
crc_word_big
(
z_word_t
data
)
{
int
k
;
for
(
k
=
0
;
k
<
W
;
k
++
)
...
...
@@ -745,10 +745,10 @@ local z_word_t crc_word_big(data)
#endif
/* ========================================================================= */
unsigned
long
ZEXPORT
crc32_z
(
crc
,
buf
,
len
)
unsigned
long
crc
;
const
unsigned
char
FAR
*
buf
;
z_size_t
len
;
unsigned
long
ZEXPORT
crc32_z
(
unsigned
long
crc
,
const
unsigned
char
FAR
*
buf
,
z_size_t
len
)
{
/* Return initial CRC, if requested. */
if
(
buf
==
Z_NULL
)
return
0
;
...
...
@@ -1069,19 +1069,19 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
#endif
/* ========================================================================= */
unsigned
long
ZEXPORT
crc32
(
crc
,
buf
,
len
)
unsigned
long
crc
;
const
unsigned
char
FAR
*
buf
;
uInt
len
;
unsigned
long
ZEXPORT
crc32
(
unsigned
long
crc
,
const
unsigned
char
FAR
*
buf
,
uInt
len
)
{
return
crc32_z
(
crc
,
buf
,
len
);
}
/* ========================================================================= */
uLong
ZEXPORT
crc32_combine64
(
crc1
,
crc2
,
len2
)
uLong
crc1
;
uLong
crc2
;
z_off64_t
len2
;
uLong
ZEXPORT
crc32_combine64
(
uLong
crc1
,
uLong
crc2
,
z_off64_t
len2
)
{
#ifdef DYNAMIC_CRC_TABLE
once
(
&
made
,
make_crc_table
);
...
...
@@ -1090,17 +1090,17 @@ uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
}
/* ========================================================================= */
uLong
ZEXPORT
crc32_combine
(
crc1
,
crc2
,
len2
)
uLong
crc1
;
uLong
crc2
;
z_off_t
len2
;
uLong
ZEXPORT
crc32_combine
(
uLong
crc1
,
uLong
crc2
,
z_off_t
len2
)
{
return
crc32_combine64
(
crc1
,
crc2
,
(
z_off64_t
)
len2
);
}
/* ========================================================================= */
uLong
ZEXPORT
crc32_combine_gen64
(
len2
)
z_off64_t
len2
;
uLong
ZEXPORT
crc32_combine_gen64
(
z_off64_t
len2
)
{
#ifdef DYNAMIC_CRC_TABLE
once
(
&
made
,
make_crc_table
);
...
...
@@ -1109,17 +1109,17 @@ uLong ZEXPORT crc32_combine_gen64(len2)
}
/* ========================================================================= */
uLong
ZEXPORT
crc32_combine_gen
(
len2
)
z_off_t
len2
;
uLong
ZEXPORT
crc32_combine_gen
(
z_off_t
len2
)
{
return
crc32_combine_gen64
((
z_off64_t
)
len2
);
}
/* ========================================================================= */
uLong
ZEXPORT
crc32_combine_op
(
crc1
,
crc2
,
op
)
uLong
crc1
;
uLong
crc2
;
uLong
op
;
uLong
ZEXPORT
crc32_combine_op
(
uLong
crc1
,
uLong
crc2
,
uLong
op
)
{
return
multmodp
(
op
,
crc1
)
^
(
crc2
&
0xffffffff
);
}
libs/zlib/deflate.c
View file @
002d6a94
This diff is collapsed.
Click to expand it.
libs/zlib/inffast.c
View file @
002d6a94
...
...
@@ -47,9 +47,9 @@
requires strm->avail_out >= 258 for each loop to avoid checking for
output space.
*/
void
ZLIB_INTERNAL
inflate_fast
(
strm
,
start
)
z_streamp
strm
;
unsigned
start
;
/* inflate()'s starting value for strm->avail_out */
void
ZLIB_INTERNAL
inflate_fast
(
z_streamp
strm
,
unsigned
start
)
{
struct
inflate_state
FAR
*
state
;
z_const
unsigned
char
FAR
*
in
;
/* local strm->next_in */
...
...
libs/zlib/inflate.c
View file @
002d6a94
...
...
@@ -102,8 +102,8 @@ local int updatewindow OF((z_streamp strm, const unsigned char FAR *end,
local
unsigned
syncsearch
OF
((
unsigned
FAR
*
have
,
const
unsigned
char
FAR
*
buf
,
unsigned
len
));
local
int
inflateStateCheck
(
strm
)
z_streamp
strm
;
local
int
inflateStateCheck
(
z_streamp
strm
)
{
struct
inflate_state
FAR
*
state
;
if
(
strm
==
Z_NULL
||
...
...
@@ -116,8 +116,8 @@ z_streamp strm;
return
0
;
}
int
ZEXPORT
inflateResetKeep
(
strm
)
z_streamp
strm
;
int
ZEXPORT
inflateResetKeep
(
z_streamp
strm
)
{
struct
inflate_state
FAR
*
state
;
...
...
@@ -142,8 +142,8 @@ z_streamp strm;
return
Z_OK
;
}
int
ZEXPORT
inflateReset
(
strm
)
z_streamp
strm
;
int
ZEXPORT
inflateReset
(
z_streamp
strm
)
{
struct
inflate_state
FAR
*
state
;
...
...
@@ -155,9 +155,9 @@ z_streamp strm;
return
inflateResetKeep
(
strm
);
}
int
ZEXPORT
inflateReset2
(
strm
,
windowBits
)
z_streamp
strm
;
int
windowBits
;
int
ZEXPORT
inflateReset2
(
z_streamp
strm
,
int
windowBits
)
{
int
wrap
;
struct
inflate_state
FAR
*
state
;
...
...
@@ -195,11 +195,11 @@ int windowBits;
return
inflateReset
(
strm
);
}
int
ZEXPORT
inflateInit2_
(
strm
,
windowBits
,
version
,
stream_size
)
z_streamp
strm
;
int
windowBits
;
const
char
*
version
;
int
stream_size
;
int
ZEXPORT
inflateInit2_
(
z_streamp
strm
,
int
windowBits
,
const
char
*
version
,
int
stream_size
)
{
int
ret
;
struct
inflate_state
FAR
*
state
;
...
...
@@ -239,18 +239,18 @@ int stream_size;
return
ret
;
}
int
ZEXPORT
inflateInit_
(
strm
,
version
,
stream_size
)
z_streamp
strm
;
const
char
*
version
;
int
stream_size
;
int
ZEXPORT
inflateInit_
(
z_streamp
strm
,
const
char
*
version
,
int
stream_size
)
{
return
inflateInit2_
(
strm
,
DEF_WBITS
,
version
,
stream_size
);
}
int
ZEXPORT
inflatePrime
(
strm
,
bits
,
value
)
z_streamp
strm
;
int
bits
;
int
value
;
int
ZEXPORT
inflatePrime
(
z_streamp
strm
,
int
bits
,
int
value
)
{
struct
inflate_state
FAR
*
state
;
...
...
@@ -278,8 +278,8 @@ int value;
used for threaded applications, since the rewriting of the tables and virgin
may not be thread-safe.
*/
local
void
fixedtables
(
state
)
struct
inflate_state
FAR
*
state
;
local
void
fixedtables
(
struct
inflate_state
FAR
*
state
)
{
#ifdef BUILDFIXED
static
int
virgin
=
1
;
...
...
@@ -396,10 +396,10 @@ void makefixed()
output will fall in the output data, making match copies simpler and faster.
The advantage may be dependent on the size of the processor's data caches.
*/
local
int
updatewindow
(
strm
,
end
,
copy
)
z_streamp
strm
;
const
Bytef
*
end
;
unsigned
copy
;
local
int
updatewindow
(
z_streamp
strm
,
const
Bytef
*
end
,
unsigned
copy
)
{
struct
inflate_state
FAR
*
state
;
unsigned
dist
;
...
...
@@ -622,9 +622,9 @@ unsigned copy;
will return Z_BUF_ERROR if it has not reached the end of the stream.
*/
int
ZEXPORT
inflate
(
strm
,
flush
)
z_streamp
strm
;
int
flush
;
int
ZEXPORT
inflate
(
z_streamp
strm
,
int
flush
)
{
struct
inflate_state
FAR
*
state
;
z_const
unsigned
char
FAR
*
next
;
/* next input */
...
...
@@ -1301,8 +1301,8 @@ int flush;
return
ret
;
}
int
ZEXPORT
inflateEnd
(
strm
)
z_streamp
strm
;
int
ZEXPORT
inflateEnd
(
z_streamp
strm
)
{
struct
inflate_state
FAR
*
state
;
if
(
inflateStateCheck
(
strm
))
...
...
@@ -1315,10 +1315,10 @@ z_streamp strm;
return
Z_OK
;
}
int
ZEXPORT
inflateGetDictionary
(
strm
,
dictionary
,
dictLength
)
z_streamp
strm
;
Bytef
*
dictionary
;
uInt
*
dictLength
;
int
ZEXPORT
inflateGetDictionary
(
z_streamp
strm
,
Bytef
*
dictionary
,
uInt
*
dictLength
)
{
struct
inflate_state
FAR
*
state
;
...
...
@@ -1338,10 +1338,10 @@ uInt *dictLength;
return
Z_OK
;
}
int
ZEXPORT
inflateSetDictionary
(
strm
,
dictionary
,
dictLength
)
z_streamp
strm
;
const
Bytef
*
dictionary
;
uInt
dictLength
;
int
ZEXPORT
inflateSetDictionary
(
z_streamp
strm
,
const
Bytef
*
dictionary
,
uInt
dictLength
)
{
struct
inflate_state
FAR
*
state
;
unsigned
long
dictid
;
...
...
@@ -1373,9 +1373,9 @@ uInt dictLength;
return
Z_OK
;
}
int
ZEXPORT
inflateGetHeader
(
strm
,
head
)
z_streamp
strm
;
gz_headerp
head
;
int
ZEXPORT
inflateGetHeader
(
z_streamp
strm
,
gz_headerp
head
)
{
struct
inflate_state
FAR
*
state
;
...
...
@@ -1401,10 +1401,10 @@ gz_headerp head;
called again with more data and the *have state. *have is initialized to
zero for the first call.
*/
local
unsigned
syncsearch
(
have
,
buf
,
len
)
unsigned
FAR
*
have
;
const
unsigned
char
FAR
*
buf
;
unsigned
len
;
local
unsigned
syncsearch
(
unsigned
FAR
*
have
,
const
unsigned
char
FAR
*
buf
,
unsigned
len
)
{
unsigned
got
;
unsigned
next
;
...
...
@@ -1424,8 +1424,8 @@ unsigned len;
return
next
;
}
int
ZEXPORT
inflateSync
(
strm
)
z_streamp
strm
;
int
ZEXPORT
inflateSync
(
z_streamp
strm
)
{
unsigned
len
;
/* number of bytes to look at or looked at */
int
flags
;
/* temporary to save header status */
...
...
@@ -1482,8 +1482,8 @@ z_streamp strm;
block. When decompressing, PPP checks that at the end of input packet,
inflate is waiting for these length bytes.
*/
int
ZEXPORT
inflateSyncPoint
(
strm
)
z_streamp
strm
;
int
ZEXPORT
inflateSyncPoint
(
z_streamp
strm
)
{
struct
inflate_state
FAR
*
state
;
...
...
@@ -1492,9 +1492,9 @@ z_streamp strm;
return
state
->
mode
==
STORED
&&
state
->
bits
==
0
;
}
int
ZEXPORT
inflateCopy
(
dest
,
source
)
z_streamp
dest
;
z_streamp
source
;
int
ZEXPORT
inflateCopy
(
z_streamp
dest
,
z_streamp
source
)
{
struct
inflate_state
FAR
*
state
;
struct
inflate_state
FAR
*
copy
;
...
...
@@ -1539,9 +1539,9 @@ z_streamp source;
return
Z_OK
;
}
int
ZEXPORT
inflateUndermine
(
strm
,
subvert
)
z_streamp
strm
;
int
subvert
;
int
ZEXPORT
inflateUndermine
(
z_streamp
strm
,
int
subvert
)
{
struct
inflate_state
FAR
*
state
;
...
...
@@ -1557,9 +1557,9 @@ int subvert;
#endif
}
int
ZEXPORT
inflateValidate
(
strm
,
check
)
z_streamp
strm
;
int
check
;
int
ZEXPORT
inflateValidate
(
z_streamp
strm
,
int
check
)
{
struct
inflate_state
FAR
*
state
;
...
...
@@ -1572,8 +1572,8 @@ int check;
return
Z_OK
;
}
long
ZEXPORT
inflateMark
(
strm
)
z_streamp
strm
;
long
ZEXPORT
inflateMark
(
z_streamp
strm
)
{
struct
inflate_state
FAR
*
state
;
...
...
@@ -1585,8 +1585,8 @@ z_streamp strm;
(
state
->
mode
==
MATCH
?
state
->
was
-
state
->
length
:
0
));
}
unsigned
long
ZEXPORT
inflateCodesUsed
(
strm
)
z_streamp
strm
;
unsigned
long
ZEXPORT
inflateCodesUsed
(
z_streamp
strm
)
{
struct
inflate_state
FAR
*
state
;
if
(
inflateStateCheck
(
strm
))
return
(
unsigned
long
)
-
1
;
...
...
libs/zlib/inftrees.c
View file @
002d6a94
...
...
@@ -29,13 +29,13 @@ const char inflate_copyright[] =
table index bits. It will differ if the request is greater than the
longest code or if it is less than the shortest code.
*/
int
ZLIB_INTERNAL
inflate_table
(
type
,
lens
,
codes
,
table
,
bits
,
work
)
codetype
type
;
unsigned
short
FAR
*
lens
;
unsigned
codes
;
code
FAR
*
FAR
*
table
;
unsigned
FAR
*
bits
;
unsigned
short
FAR
*
work
;
int
ZLIB_INTERNAL
inflate_table
(
codetype
type
,
unsigned
short
FAR
*
lens
,
unsigned
codes
,
code
FAR
*
FAR
*
table
,
unsigned
FAR
*
bits
,
unsigned
short
FAR
*
work
)
{
unsigned
len
;
/* a code's length in bits */
unsigned
sym
;
/* index of code symbols */
...
...
libs/zlib/trees.c
View file @
002d6a94
...
...
@@ -183,10 +183,10 @@ local void gen_trees_header OF((void));
#ifdef ZLIB_DEBUG
local
void
send_bits
OF
((
deflate_state
*
s
,
int
value
,
int
length
));
local
void
send_bits
(
s
,
value
,
length
)
deflate_state
*
s
;
int
value
;
/* value to send */
int
length
;
/* number of bits */
local
void
send_bits
(
deflate_state
*
s
,
int
value
,
int
length
)
{
Tracevv
((
stderr
,
" l %2d v %4x "
,
length
,
value
));
Assert
(
length
>
0
&&
length
<=
15
,
"invalid length"
);
...
...
@@ -376,8 +376,8 @@ void gen_trees_header()
/* ===========================================================================
* Initialize the tree data structures for a new zlib stream.
*/
void
ZLIB_INTERNAL
_tr_init
(
s
)
deflate_state
*
s
;
void
ZLIB_INTERNAL
_tr_init
(
deflate_state
*
s
)
{
tr_static_init
();
...
...
@@ -404,8 +404,8 @@ void ZLIB_INTERNAL _tr_init(s)
/* ===========================================================================
* Initialize a new block.
*/
local
void
init_block
(
s
)
deflate_state
*
s
;
local
void
init_block
(
deflate_state
*
s
)
{
int
n
;
/* iterates over tree elements */
...
...
@@ -448,10 +448,10 @@ local void init_block(s)
* when the heap property is re-established (each father smaller than its
* two sons).
*/
local
void
pqdownheap
(
s
,
tree
,
k
)
deflate_state
*
s
;
ct_data
*
tree
;
/* the tree to restore */
int
k
;
/* node to move down */
local
void
pqdownheap
(
deflate_state
*
s
,
ct_data
*
tree
,
int
k
)
{
int
v
=
s
->
heap
[
k
];
int
j
=
k
<<
1
;
/* left son of k */
...
...
@@ -483,9 +483,9 @@ local void pqdownheap(s, tree, k)
* The length opt_len is updated; static_len is also updated if stree is
* not null.
*/
local
void
gen_bitlen
(
s
,
desc
)
deflate_state
*
s
;
tree_desc
*
desc
;
/* the tree descriptor */
local
void
gen_bitlen
(
deflate_state
*
s
,
tree_desc
*
desc
)
{
ct_data
*
tree
=
desc
->
dyn_tree
;
int
max_code
=
desc
->
max_code
;
...
...
@@ -569,10 +569,10 @@ local void gen_bitlen(s, desc)
* OUT assertion: the field code is set for all tree elements of non
* zero code length.
*/
local
void
gen_codes
(
tree
,
max_code
,
bl_count
)
ct_data
*
tree
;
/* the tree to decorate */
int
max_code
;
/* largest code with non zero frequency */
ushf
*
bl_count
;
/* number of codes at each bit length */
local
void
gen_codes
(
ct_data
*
tree
,
int
max_code
,
ushf
*
bl_count
)
{
ush
next_code
[
MAX_BITS
+
1
];
/* next code value for each bit length */
unsigned
code
=
0
;
/* running code value */
...
...
@@ -612,9 +612,9 @@ local void gen_codes(tree, max_code, bl_count)
* and corresponding code. The length opt_len is updated; static_len is
* also updated if stree is not null. The field max_code is set.
*/
local
void
build_tree
(
s
,
desc
)
deflate_state
*
s
;
tree_desc
*
desc
;
/* the tree descriptor */
local
void
build_tree
(
deflate_state
*
s
,
tree_desc
*
desc
)
{
ct_data
*
tree
=
desc
->
dyn_tree
;
const
ct_data
*
stree
=
desc
->
stat_desc
->
static_tree
;
...
...
@@ -700,10 +700,10 @@ local void build_tree(s, desc)
* Scan a literal or distance tree to determine the frequencies of the codes
* in the bit length tree.
*/
local
void
scan_tree
(
s
,
tree
,
max_code
)
deflate_state
*
s
;
ct_data
*
tree
;
/* the tree to be scanned */
int
max_code
;
/* and its largest code of non zero frequency */
local
void
scan_tree
(
deflate_state
*
s
,
ct_data
*
tree
,
int
max_code
)
{
int
n
;
/* iterates over all tree elements */
int
prevlen
=
-
1
;
/* last emitted length */
...
...
@@ -745,10 +745,10 @@ local void scan_tree(s, tree, max_code)
* Send a literal or distance tree in compressed form, using the codes in
* bl_tree.
*/
local
void
send_tree
(
s
,
tree
,
max_code
)
deflate_state
*
s
;
ct_data
*
tree
;
/* the tree to be scanned */
int
max_code
;
/* and its largest code of non zero frequency */
local
void
send_tree
(
deflate_state
*
s
,
ct_data
*
tree
,
int
max_code
)
{
int
n
;
/* iterates over all tree elements */
int
prevlen
=
-
1
;
/* last emitted length */
...
...
@@ -796,8 +796,8 @@ local void send_tree(s, tree, max_code)
* Construct the Huffman tree for the bit lengths and return the index in
* bl_order of the last bit length code to send.
*/
local
int
build_bl_tree
(
s
)
deflate_state
*
s
;
local
int
build_bl_tree
(
deflate_state
*
s
)
{
int
max_blindex
;
/* index of last bit length code of non zero freq */
...
...
@@ -831,9 +831,11 @@ local int build_bl_tree(s)
* lengths of the bit length codes, the literal tree and the distance tree.
* IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
*/
local
void
send_all_trees
(
s
,
lcodes
,
dcodes
,
blcodes
)
deflate_state
*
s
;
int
lcodes
,
dcodes
,
blcodes
;
/* number of codes for each tree */
local
void
send_all_trees
(
deflate_state
*
s
,
int
lcodes
,
int
dcodes
,
int
blcodes
)
{
int
rank
;
/* index in bl_order */
...
...
@@ -860,11 +862,11 @@ local void send_all_trees(s, lcodes, dcodes, blcodes)
/* ===========================================================================
* Send a stored block
*/
void
ZLIB_INTERNAL
_tr_stored_block
(
s
,
buf
,
stored_len
,
last
)
deflate_state
*
s
;
charf
*
buf
;
/* input block */
ulg
stored_len
;
/* length of input block */
int
last
;
/* one if this is the last block for a file */
void
ZLIB_INTERNAL
_tr_stored_block
(
deflate_state
*
s
,
charf
*
buf
,
ulg
stored_len
,
int
last
)
{
send_bits
(
s
,
(
STORED_BLOCK
<<
1
)
+
last
,
3
);
/* send block type */
bi_windup
(
s
);
/* align on byte boundary */
...
...
@@ -884,8 +886,8 @@ void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last)
/* ===========================================================================
* Flush the bits in the bit buffer to pending output (leaves at most 7 bits)
*/
void
ZLIB_INTERNAL
_tr_flush_bits
(
s
)
deflate_state
*
s
;
void
ZLIB_INTERNAL
_tr_flush_bits
(
deflate_state
*
s
)
{
bi_flush
(
s
);
}
...
...
@@ -894,8 +896,8 @@ void ZLIB_INTERNAL _tr_flush_bits(s)
* Send one empty static block to give enough lookahead for inflate.
* This takes 10 bits, of which 7 may remain in the bit buffer.
*/
void
ZLIB_INTERNAL
_tr_align
(
s
)
deflate_state
*
s
;
void
ZLIB_INTERNAL
_tr_align
(
deflate_state
*
s
)
{
send_bits
(
s
,
STATIC_TREES
<<
1
,
3
);
send_code
(
s
,
END_BLOCK
,
static_ltree
);
...
...
@@ -909,11 +911,11 @@ void ZLIB_INTERNAL _tr_align(s)
* Determine the best encoding for the current block: dynamic trees, static
* trees or store, and write out the encoded block.
*/
void
ZLIB_INTERNAL
_tr_flush_block
(
s
,
buf
,
stored_len
,
last
)
deflate_state
*
s
;
charf
*
buf
;
/* input block, or NULL if too old */
ulg
stored_len
;
/* length of input block */
int
last
;
/* one if this is the last block for a file */
void
ZLIB_INTERNAL
_tr_flush_block
(
deflate_state
*
s
,
charf
*
buf
,
ulg
stored_len
,
int
last
)
{
ulg
opt_lenb
,
static_lenb
;
/* opt_len and static_len in bytes */
int
max_blindex
=
0
;
/* index of last bit length code of non zero freq */
...
...
@@ -1011,10 +1013,10 @@ void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
* Save the match info and tally the frequency counts. Return true if
* the current block must be flushed.
*/
int
ZLIB_INTERNAL
_tr_tally
(
s
,
dist
,
lc
)
deflate_state
*
s
;
unsigned
dist
;
/* distance of matched string */
unsigned
lc
;
/* match length - MIN_MATCH or unmatched char (dist==0) */
int
ZLIB_INTERNAL
_tr_tally
(
deflate_state
*
s
,
unsigned
dist
,
unsigned
lc
)
{
s
->
sym_buf
[
s
->
sym_next
++
]
=
(
uch
)
dist
;
s
->
sym_buf
[
s
->
sym_next
++
]
=
(
uch
)(
dist
>>
8
);
...
...
@@ -1039,10 +1041,10 @@ int ZLIB_INTERNAL _tr_tally(s, dist, lc)
/* ===========================================================================
* Send the block data compressed using the given Huffman trees
*/
local
void
compress_block
(
s
,
ltree
,
dtree
)
deflate_state
*
s
;
const
ct_data
*
ltree
;
/* literal tree */
const
ct_data
*
dtree
;
/* distance tree */
local
void
compress_block
(
deflate_state
*
s
,
const
ct_data
*
ltree
,
const
ct_data
*
dtree
)
{
unsigned
dist
;
/* distance of matched string */
int
lc
;
/* match length or unmatched char (if dist == 0) */
...
...
@@ -1099,8 +1101,8 @@ local void compress_block(s, ltree, dtree)
* (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}).
* IN assertion: the fields Freq of dyn_ltree are set.
*/
local
int
detect_data_type
(
s
)
deflate_state
*
s
;
local
int
detect_data_type
(
deflate_state
*
s
)
{
/* block_mask is the bit mask of block-listed bytes
* set bits 0..6, 14..25, and 28..31
...
...
@@ -1133,9 +1135,9 @@ local int detect_data_type(s)
* method would use a table)
* IN assertion: 1 <= len <= 15
*/
local
unsigned
bi_reverse
(
code
,
len
)
unsigned
code
;
/* the value to invert */
int
len
;
/* its bit length */
local
unsigned
bi_reverse
(
unsigned
code
,
int
len
)
{
register
unsigned
res
=
0
;
do
{
...
...
@@ -1148,8 +1150,8 @@ local unsigned bi_reverse(code, len)
/* ===========================================================================
* Flush the bit buffer, keeping at most 7 bits in it.
*/
local
void
bi_flush
(
s
)
deflate_state
*
s
;
local
void
bi_flush
(
deflate_state
*
s
)
{
if
(
s
->
bi_valid
==
16
)
{
put_short
(
s
,
s
->
bi_buf
);
...
...
@@ -1165,8 +1167,8 @@ local void bi_flush(s)
/* ===========================================================================
* Flush the bit buffer and align the output on a byte boundary
*/
local
void
bi_windup
(
s
)
deflate_state
*
s
;
local
void
bi_windup
(
deflate_state
*
s
)
{
if
(
s
->
bi_valid
>
8
)
{
put_short
(
s
,
s
->
bi_buf
);
...
...
libs/zlib/zutil.c
View file @
002d6a94
...
...
@@ -121,8 +121,8 @@ uLong ZEXPORT zlibCompileFlags()
# endif
int
ZLIB_INTERNAL
z_verbose
=
verbose
;
void
ZLIB_INTERNAL
z_error
(
m
)
char
*
m
;
void
ZLIB_INTERNAL
z_error
(
char
*
m
)
{
fprintf
(
stderr
,
"%s
\n
"
,
m
);
exit
(
1
);
...
...
@@ -132,8 +132,8 @@ void ZLIB_INTERNAL z_error(m)
/* exported to allow conversion of error code to string for compress() and
* uncompress()
*/
const
char
*
ZEXPORT
zError
(
err
)
int
err
;
const
char
*
ZEXPORT
zError
(
int
err
)
{
return
ERR_MSG
(
err
);
}
...
...
@@ -148,10 +148,10 @@ const char * ZEXPORT zError(err)
#ifndef HAVE_MEMCPY
void
ZLIB_INTERNAL
zmemcpy
(
dest
,
source
,
len
)
Bytef
*
dest
;
const
Bytef
*
source
;
uInt
len
;
void
ZLIB_INTERNAL
zmemcpy
(
Bytef
*
dest
,
const
Bytef
*
source
,
uInt
len
)
{
if
(
len
==
0
)
return
;
do
{
...
...
@@ -159,10 +159,10 @@ void ZLIB_INTERNAL zmemcpy(dest, source, len)
}
while
(
--
len
!=
0
);
}
int
ZLIB_INTERNAL
zmemcmp
(
s1
,
s2
,
len
)
const
Bytef
*
s1
;
const
Bytef
*
s2
;
uInt
len
;
int
ZLIB_INTERNAL
zmemcmp
(
const
Bytef
*
s1
,
const
Bytef
*
s2
,
uInt
len
)
{
uInt
j
;
...
...
@@ -172,9 +172,9 @@ int ZLIB_INTERNAL zmemcmp(s1, s2, len)
return
0
;
}
void
ZLIB_INTERNAL
zmemzero
(
dest
,
len
)
Bytef
*
dest
;
uInt
len
;
void
ZLIB_INTERNAL
zmemzero
(
Bytef
*
dest
,
uInt
len
)
{
if
(
len
==
0
)
return
;
do
{
...
...
@@ -304,19 +304,19 @@ extern voidp calloc OF((uInt items, uInt size));
extern
void
free
OF
((
voidpf
ptr
));
#endif
voidpf
ZLIB_INTERNAL
zcalloc
(
opaque
,
items
,
size
)
voidpf
opaque
;
unsigned
items
;
unsigned
size
;
voidpf
ZLIB_INTERNAL
zcalloc
(
voidpf
opaque
,
unsigned
items
,
unsigned
size
)
{
(
void
)
opaque
;
return
sizeof
(
uInt
)
>
2
?
(
voidpf
)
malloc
(
items
*
size
)
:
(
voidpf
)
calloc
(
items
,
size
);
}
void
ZLIB_INTERNAL
zcfree
(
opaque
,
ptr
)
voidpf
opaque
;
voidpf
ptr
;
void
ZLIB_INTERNAL
zcfree
(
voidpf
opaque
,
voidpf
ptr
)
{
(
void
)
opaque
;
free
(
ptr
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment