Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
btwise
OpenCorePKG_MOD
提交
c2942135
O
OpenCorePKG_MOD
项目概览
btwise
/
OpenCorePKG_MOD
通知
26
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
OpenCorePKG_MOD
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
c2942135
编写于
8月 16, 2022
作者:
P
PMheart
提交者:
GitHub
8月 16, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
OcCompressionLib: Update to zlib 1.2.12 (#383)
上级
3e2e62ac
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
434 addition
and
191 deletion
+434
-191
Library/OcCompressionLib/OcCompressionLib.inf
Library/OcCompressionLib/OcCompressionLib.inf
+1
-0
Library/OcCompressionLib/zlib/crc32.c
Library/OcCompressionLib/zlib/crc32.c
+65
-63
Library/OcCompressionLib/zlib/deflate.c
Library/OcCompressionLib/zlib/deflate.c
+2
-2
Library/OcCompressionLib/zlib/deflate.h
Library/OcCompressionLib/zlib/deflate.h
+1
-1
Library/OcCompressionLib/zlib/infback.c
Library/OcCompressionLib/zlib/infback.c
+2
-1
Library/OcCompressionLib/zlib/inflate.c
Library/OcCompressionLib/zlib/inflate.c
+28
-5
Library/OcCompressionLib/zlib/inflate.h
Library/OcCompressionLib/zlib/inflate.h
+1
-1
Library/OcCompressionLib/zlib/inftrees.c
Library/OcCompressionLib/zlib/inftrees.c
+3
-3
Library/OcCompressionLib/zlib/trees.c
Library/OcCompressionLib/zlib/trees.c
+10
-10
Library/OcCompressionLib/zlib/zlib.h
Library/OcCompressionLib/zlib/zlib.h
+83
-84
Library/OcCompressionLib/zlib/zutil.c
Library/OcCompressionLib/zlib/zutil.c
+23
-0
Library/OcCompressionLib/zlib/zutil.h
Library/OcCompressionLib/zlib/zutil.h
+211
-19
Utilities/TestDiskImage/Makefile
Utilities/TestDiskImage/Makefile
+2
-1
Utilities/TestKextInject/Makefile
Utilities/TestKextInject/Makefile
+2
-1
未找到文件。
Library/OcCompressionLib/OcCompressionLib.inf
浏览文件 @
c2942135
...
...
@@ -57,6 +57,7 @@
zlib/zconf.h
zlib/zlib.h
zlib/zlib_uefi.c
zlib/zutil.c
zlib/zutil.h
[Packages]
...
...
Library/OcCompressionLib/zlib/crc32.c
浏览文件 @
c2942135
/* crc32.c -- compute the CRC-32 of a data stream
* Copyright (C) 1995-20
06, 2010, 2011, 2012, 2016, 2018
Mark Adler
* Copyright (C) 1995-20
22
Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*
* This interleaved implementation of a CRC makes use of pipelined multiple
...
...
@@ -101,11 +101,41 @@
/* Local functions. */
local
z_crc_t
multmodp
OF
((
z_crc_t
a
,
z_crc_t
b
));
local
z_crc_t
x2nmodp
OF
((
z_off64_t
n
,
unsigned
k
));
#ifdef W
local
z_word_t
byte_swap
OF
((
z_word_t
word
));
local
z_crc_t
crc_word
OF
((
z_word_t
data
));
local
z_word_t
crc_word_big
OF
((
z_word_t
data
));
#endif
/* W */
/* If available, use the ARM processor CRC32 instruction. */
#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8
# define ARMCRC32
#endif
#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE))
/*
Swap the bytes in a z_word_t to convert between little and big endian. Any
self-respecting compiler will optimize this to a single machine byte-swap
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
;
{
# if W == 8
return
(
word
&
0xff00000000000000
)
>>
56
|
(
word
&
0xff000000000000
)
>>
40
|
(
word
&
0xff0000000000
)
>>
24
|
(
word
&
0xff00000000
)
>>
8
|
(
word
&
0xff000000
)
<<
8
|
(
word
&
0xff0000
)
<<
24
|
(
word
&
0xff00
)
<<
40
|
(
word
&
0xff
)
<<
56
;
# else
/* W == 4 */
return
(
word
&
0xff000000
)
>>
24
|
(
word
&
0xff0000
)
>>
8
|
(
word
&
0xff00
)
<<
8
|
(
word
&
0xff
)
<<
24
;
# endif
}
#endif
/* CRC polynomial. */
#define POLY 0xedb88320
/* p(x) reflected, with x^32 implied */
...
...
@@ -549,62 +579,6 @@ local z_crc_t x2nmodp(n, k)
return
p
;
}
#ifdef W
/*
Swap the bytes in a z_word_t to convert between little and big endian. Any
self-respecting compiler will optimize this to a single machine byte-swap
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
;
{
#if W == 8
return
(
word
&
0xff00000000000000
)
>>
56
|
(
word
&
0xff000000000000
)
>>
40
|
(
word
&
0xff0000000000
)
>>
24
|
(
word
&
0xff00000000
)
>>
8
|
(
word
&
0xff000000
)
<<
8
|
(
word
&
0xff0000
)
<<
24
|
(
word
&
0xff00
)
<<
40
|
(
word
&
0xff
)
<<
56
;
#else
/* W == 4 */
return
(
word
&
0xff000000
)
>>
24
|
(
word
&
0xff0000
)
>>
8
|
(
word
&
0xff00
)
<<
8
|
(
word
&
0xff
)
<<
24
;
#endif
}
/*
Return the CRC of the W bytes in the word_t data, taking the
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
;
{
int
k
;
for
(
k
=
0
;
k
<
W
;
k
++
)
data
=
(
data
>>
8
)
^
crc_table
[
data
&
0xff
];
return
(
z_crc_t
)
data
;
}
local
z_word_t
crc_word_big
(
data
)
z_word_t
data
;
{
int
k
;
for
(
k
=
0
;
k
<
W
;
k
++
)
data
=
(
data
<<
8
)
^
crc_big_table
[(
data
>>
((
W
-
1
)
<<
3
))
&
0xff
];
return
data
;
}
#endif
/* W */
/* =========================================================================
* This function can be used by asm versions of crc32(), and to force the
* generation of the CRC tables in a threaded application.
...
...
@@ -626,7 +600,7 @@ const z_crc_t FAR * ZEXPORT get_crc_table()
* -march=armv8-a+crc, or -march=native if the compile machine has the crc32
* instructions.
*/
#if
defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8
#if
def ARMCRC32
/*
Constants empirically determined to maximize speed. These values are from
...
...
@@ -733,6 +707,34 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
#else
#ifdef W
/*
Return the CRC of the W bytes in the word_t data, taking the
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
;
{
int
k
;
for
(
k
=
0
;
k
<
W
;
k
++
)
data
=
(
data
>>
8
)
^
crc_table
[
data
&
0xff
];
return
(
z_crc_t
)
data
;
}
local
z_word_t
crc_word_big
(
data
)
z_word_t
data
;
{
int
k
;
for
(
k
=
0
;
k
<
W
;
k
++
)
data
=
(
data
<<
8
)
^
crc_big_table
[(
data
>>
((
W
-
1
)
<<
3
))
&
0xff
];
return
data
;
}
#endif
/* ========================================================================= */
unsigned
long
ZEXPORT
crc32_z
(
crc
,
buf
,
len
)
unsigned
long
crc
;
...
...
Library/OcCompressionLib/zlib/deflate.c
浏览文件 @
c2942135
/* deflate.c -- compress data using the deflation algorithm
* Copyright (C) 1995-20
17
Jean-loup Gailly and Mark Adler
* Copyright (C) 1995-20
22
Jean-loup Gailly and Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
...
...
@@ -52,7 +52,7 @@
#include "deflate.h"
const
char
deflate_copyright
[]
=
" deflate 1.2.1
1.1 Copyright 1995-2017
Jean-loup Gailly and Mark Adler "
;
" deflate 1.2.1
2 Copyright 1995-2022
Jean-loup Gailly and Mark Adler "
;
/*
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
...
...
Library/OcCompressionLib/zlib/deflate.h
浏览文件 @
c2942135
/* deflate.h -- internal compression state
* Copyright (C) 1995-201
6
Jean-loup Gailly
* Copyright (C) 1995-201
8
Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h
*/
...
...
Library/OcCompressionLib/zlib/infback.c
浏览文件 @
c2942135
/* infback.c -- inflate using a call-back interface
* Copyright (C) 1995-20
16
Mark Adler
* Copyright (C) 1995-20
22
Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
...
...
@@ -477,6 +477,7 @@ void FAR *out_desc;
}
Tracev
((
stderr
,
"inflate: codes ok
\n
"
));
state
->
mode
=
LEN
;
/* fallthrough */
case
LEN
:
/* use inflate_fast() if we have enough input and output */
...
...
Library/OcCompressionLib/zlib/inflate.c
浏览文件 @
c2942135
/* inflate.c -- zlib decompression
* Copyright (C) 1995-20
16
Mark Adler
* Copyright (C) 1995-20
22
Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
...
...
@@ -448,10 +448,10 @@ unsigned copy;
/* check function to use adler32() for zlib or crc32() for gzip */
#ifdef GUNZIP
# define UPDATE(check, buf, len) \
# define UPDATE
_CHECK
(check, buf, len) \
(state->flags ? crc32(check, buf, len) : adler32(check, buf, len))
#else
# define UPDATE(check, buf, len) adler32(check, buf, len)
# define UPDATE
_CHECK
(check, buf, len) adler32(check, buf, len)
#endif
/* check macros for header crc */
...
...
@@ -731,6 +731,7 @@ int flush;
#endif
INITBITS
();
state
->
mode
=
TIME
;
/* fallthrough */
case
TIME
:
NEEDBITS
(
32
);
if
(
state
->
head
!=
Z_NULL
)
...
...
@@ -741,6 +742,7 @@ int flush;
#endif
INITBITS
();
state
->
mode
=
OS
;
/* fallthrough */
case
OS
:
NEEDBITS
(
16
);
if
(
state
->
head
!=
Z_NULL
)
{
...
...
@@ -753,6 +755,7 @@ int flush;
#endif
INITBITS
();
state
->
mode
=
EXLEN
;
/* fallthrough */
case
EXLEN
:
if
(
state
->
flags
&
0x0400
)
{
NEEDBITS
(
16
);
...
...
@@ -768,6 +771,7 @@ int flush;
else
if
(
state
->
head
!=
Z_NULL
)
state
->
head
->
extra
=
Z_NULL
;
state
->
mode
=
EXTRA
;
/* fallthrough */
case
EXTRA
:
if
(
state
->
flags
&
0x0400
)
{
copy
=
state
->
length
;
...
...
@@ -792,6 +796,7 @@ int flush;
}
state
->
length
=
0
;
state
->
mode
=
NAME
;
/* fallthrough */
case
NAME
:
if
(
state
->
flags
&
0x0800
)
{
if
(
have
==
0
)
goto
inf_leave
;
...
...
@@ -815,6 +820,7 @@ int flush;
state
->
head
->
name
=
Z_NULL
;
state
->
length
=
0
;
state
->
mode
=
COMMENT
;
/* fallthrough */
case
COMMENT
:
if
(
state
->
flags
&
0x1000
)
{
if
(
have
==
0
)
goto
inf_leave
;
...
...
@@ -837,6 +843,7 @@ int flush;
else
if
(
state
->
head
!=
Z_NULL
)
state
->
head
->
comment
=
Z_NULL
;
state
->
mode
=
HCRC
;
/* fallthrough */
case
HCRC
:
if
(
state
->
flags
&
0x0200
)
{
NEEDBITS
(
16
);
...
...
@@ -866,6 +873,7 @@ int flush;
#endif
INITBITS
();
state
->
mode
=
DICT
;
/* fallthrough */
case
DICT
:
if
(
state
->
havedict
==
0
)
{
RESTORE
();
...
...
@@ -875,8 +883,10 @@ int flush;
strm
->
adler
=
state
->
check
=
adler32
(
0L
,
Z_NULL
,
0
);
#endif
state
->
mode
=
TYPE
;
/* fallthrough */
case
TYPE
:
if
(
flush
==
Z_BLOCK
||
flush
==
Z_TREES
)
goto
inf_leave
;
/* fallthrough */
case
TYPEDO
:
if
(
state
->
last
)
{
BYTEBITS
();
...
...
@@ -927,8 +937,10 @@ int flush;
INITBITS
();
state
->
mode
=
COPY_
;
if
(
flush
==
Z_TREES
)
goto
inf_leave
;
/* fallthrough */
case
COPY_
:
state
->
mode
=
COPY
;
/* fallthrough */
case
COPY
:
copy
=
state
->
length
;
if
(
copy
)
{
...
...
@@ -964,6 +976,7 @@ int flush;
Tracev
((
stderr
,
"inflate: table sizes ok
\n
"
));
state
->
have
=
0
;
state
->
mode
=
LENLENS
;
/* fallthrough */
case
LENLENS
:
while
(
state
->
have
<
state
->
ncode
)
{
NEEDBITS
(
3
);
...
...
@@ -985,6 +998,7 @@ int flush;
Tracev
((
stderr
,
"inflate: code lengths ok
\n
"
));
state
->
have
=
0
;
state
->
mode
=
CODELENS
;
/* fallthrough */
case
CODELENS
:
while
(
state
->
have
<
state
->
nlen
+
state
->
ndist
)
{
for
(;;)
{
...
...
@@ -1068,8 +1082,10 @@ int flush;
Tracev
((
stderr
,
"inflate: codes ok
\n
"
));
state
->
mode
=
LEN_
;
if
(
flush
==
Z_TREES
)
goto
inf_leave
;
/* fallthrough */
case
LEN_
:
state
->
mode
=
LEN
;
/* fallthrough */
case
LEN
:
if
(
have
>=
6
&&
left
>=
258
)
{
RESTORE
();
...
...
@@ -1119,6 +1135,7 @@ int flush;
}
state
->
extra
=
(
unsigned
)(
here
.
op
)
&
15
;
state
->
mode
=
LENEXT
;
/* fallthrough */
case
LENEXT
:
if
(
state
->
extra
)
{
NEEDBITS
(
state
->
extra
);
...
...
@@ -1129,6 +1146,7 @@ int flush;
Tracevv
((
stderr
,
"inflate: length %u
\n
"
,
state
->
length
));
state
->
was
=
state
->
length
;
state
->
mode
=
DIST
;
/* fallthrough */
case
DIST
:
for
(;;)
{
here
=
state
->
distcode
[
BITS
(
state
->
distbits
)];
...
...
@@ -1156,6 +1174,7 @@ int flush;
state
->
offset
=
(
unsigned
)
here
.
val
;
state
->
extra
=
(
unsigned
)(
here
.
op
)
&
15
;
state
->
mode
=
DISTEXT
;
/* fallthrough */
case
DISTEXT
:
if
(
state
->
extra
)
{
NEEDBITS
(
state
->
extra
);
...
...
@@ -1172,6 +1191,7 @@ int flush;
#endif
Tracevv
((
stderr
,
"inflate: distance %u
\n
"
,
state
->
offset
));
state
->
mode
=
MATCH
;
/* fallthrough */
case
MATCH
:
if
(
left
==
0
)
goto
inf_leave
;
copy
=
out
-
left
;
...
...
@@ -1232,7 +1252,7 @@ int flush;
#ifdef OC_INFLATE_VERIFY_DATA
if
((
state
->
wrap
&
4
)
&&
out
)
strm
->
adler
=
state
->
check
=
UPDATE
(
state
->
check
,
put
-
out
,
out
);
UPDATE
_CHECK
(
state
->
check
,
put
-
out
,
out
);
#endif
out
=
left
;
#ifdef OC_INFLATE_VERIFY_DATA
...
...
@@ -1251,6 +1271,7 @@ int flush;
}
#ifdef GUNZIP
state
->
mode
=
LENGTH
;
/* fallthrough */
case
LENGTH
:
if
(
state
->
wrap
&&
state
->
flags
)
{
NEEDBITS
(
32
);
...
...
@@ -1264,6 +1285,7 @@ int flush;
}
#endif
state
->
mode
=
DONE
;
/* fallthrough */
case
DONE
:
ret
=
Z_STREAM_END
;
goto
inf_leave
;
...
...
@@ -1273,6 +1295,7 @@ int flush;
case
MEM
:
return
Z_MEM_ERROR
;
case
SYNC
:
/* fallthrough */
default:
return
Z_STREAM_ERROR
;
}
...
...
@@ -1299,7 +1322,7 @@ int flush;
#ifdef OC_INFLATE_VERIFY_DATA
if
((
state
->
wrap
&
4
)
&&
out
)
strm
->
adler
=
state
->
check
=
UPDATE
(
state
->
check
,
strm
->
next_out
-
out
,
out
);
UPDATE
_CHECK
(
state
->
check
,
strm
->
next_out
-
out
,
out
);
#endif
strm
->
data_type
=
(
int
)
state
->
bits
+
(
state
->
last
?
64
:
0
)
+
(
state
->
mode
==
TYPE
?
128
:
0
)
+
...
...
Library/OcCompressionLib/zlib/inflate.h
浏览文件 @
c2942135
/* inflate.h -- internal inflate state definition
* Copyright (C) 1995-201
6
Mark Adler
* Copyright (C) 1995-201
9
Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
...
...
Library/OcCompressionLib/zlib/inftrees.c
浏览文件 @
c2942135
/* inftrees.c -- generate Huffman trees for efficient decoding
* Copyright (C) 1995-20
17
Mark Adler
* Copyright (C) 1995-20
22
Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
...
...
@@ -9,7 +9,7 @@
#define MAXBITS 15
const
char
inflate_copyright
[]
=
" inflate 1.2.1
1.1 Copyright 1995-2017
Mark Adler "
;
" inflate 1.2.1
2 Copyright 1995-2022
Mark Adler "
;
/*
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
...
...
@@ -62,7 +62,7 @@ unsigned short FAR *work;
35
,
43
,
51
,
59
,
67
,
83
,
99
,
115
,
131
,
163
,
195
,
227
,
258
,
0
,
0
};
static
const
unsigned
short
lext
[
31
]
=
{
/* Length codes 257..285 extra */
16
,
16
,
16
,
16
,
16
,
16
,
16
,
16
,
17
,
17
,
17
,
17
,
18
,
18
,
18
,
18
,
19
,
19
,
19
,
19
,
20
,
20
,
20
,
20
,
21
,
21
,
21
,
21
,
16
,
19
8
,
196
};
19
,
19
,
19
,
19
,
20
,
20
,
20
,
20
,
21
,
21
,
21
,
21
,
16
,
19
9
,
202
};
static
const
unsigned
short
dbase
[
32
]
=
{
/* Distance codes 0..29 base */
1
,
2
,
3
,
4
,
5
,
7
,
9
,
13
,
17
,
25
,
33
,
49
,
65
,
97
,
129
,
193
,
257
,
385
,
513
,
769
,
1025
,
1537
,
2049
,
3073
,
4097
,
6145
,
...
...
Library/OcCompressionLib/zlib/trees.c
浏览文件 @
c2942135
/* trees.c -- output deflated data using Huffman coding
* Copyright (C) 1995-20
17
Jean-loup Gailly
* Copyright (C) 1995-20
21
Jean-loup Gailly
* detect_data_type() function provided freely by Cosmin Truta, 2006
* For conditions of distribution and use, see copyright notice in zlib.h
*/
...
...
@@ -1091,9 +1091,9 @@ local void compress_block(s, ltree, dtree)
* Check if the data type is TEXT or BINARY, using the following algorithm:
* - TEXT if the two conditions below are satisfied:
* a) There are no non-portable control characters belonging to the
* "bl
a
ck list" (0..6, 14..25, 28..31).
* "bl
o
ck list" (0..6, 14..25, 28..31).
* b) There is at least one printable character belonging to the
* "
white
list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
* "
allow
list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255).
* - BINARY otherwise.
* - The following partially-portable control characters form a
* "gray list" that is ignored in this detection algorithm:
...
...
@@ -1103,19 +1103,19 @@ local void compress_block(s, ltree, dtree)
local
int
detect_data_type
(
s
)
deflate_state
*
s
;
{
/* bl
ack_mask is the bit mask of bla
ck-listed bytes
/* bl
ock_mask is the bit mask of blo
ck-listed bytes
* set bits 0..6, 14..25, and 28..31
* 0xf3ffc07f = binary 11110011111111111100000001111111
*/
unsigned
long
bl
a
ck_mask
=
0xf3ffc07fUL
;
unsigned
long
bl
o
ck_mask
=
0xf3ffc07fUL
;
int
n
;
/* Check for non-textual ("bl
a
ck-listed") bytes. */
for
(
n
=
0
;
n
<=
31
;
n
++
,
bl
a
ck_mask
>>=
1
)
if
((
bl
a
ck_mask
&
1
)
&&
(
s
->
dyn_ltree
[
n
].
Freq
!=
0
))
/* Check for non-textual ("bl
o
ck-listed") bytes. */
for
(
n
=
0
;
n
<=
31
;
n
++
,
bl
o
ck_mask
>>=
1
)
if
((
bl
o
ck_mask
&
1
)
&&
(
s
->
dyn_ltree
[
n
].
Freq
!=
0
))
return
Z_BINARY
;
/* Check for textual ("
white
-listed") bytes. */
/* Check for textual ("
allow
-listed") bytes. */
if
(
s
->
dyn_ltree
[
9
].
Freq
!=
0
||
s
->
dyn_ltree
[
10
].
Freq
!=
0
||
s
->
dyn_ltree
[
13
].
Freq
!=
0
)
return
Z_TEXT
;
...
...
@@ -1123,7 +1123,7 @@ local int detect_data_type(s)
if
(
s
->
dyn_ltree
[
n
].
Freq
!=
0
)
return
Z_TEXT
;
/* There are no "bl
ack-listed" or "white
-listed" bytes:
/* There are no "bl
ock-listed" or "allow
-listed" bytes:
* this stream either is empty or has tolerated ("gray-listed") bytes only.
*/
return
Z_BINARY
;
...
...
Library/OcCompressionLib/zlib/zlib.h
浏览文件 @
c2942135
/* zlib.h -- interface of the 'zlib' general purpose compression library
version 1.2.1
1.1, January xxth, 2017
version 1.2.1
2, March 11th, 2022
Copyright (C) 1995-20
17
Jean-loup Gailly and Mark Adler
Copyright (C) 1995-20
22
Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
...
...
@@ -37,12 +37,12 @@
extern
"C"
{
#endif
#define ZLIB_VERSION "1.2.1
1.1-motley
"
#define ZLIB_VERNUM 0x12
b1
#define ZLIB_VERSION "1.2.1
2
"
#define ZLIB_VERNUM 0x12
c0
#define ZLIB_VER_MAJOR 1
#define ZLIB_VER_MINOR 2
#define ZLIB_VER_REVISION 1
1
#define ZLIB_VER_SUBREVISION
1
#define ZLIB_VER_REVISION 1
2
#define ZLIB_VER_SUBREVISION
0
/*
The 'zlib' compression library provides in-memory compression and
...
...
@@ -1304,14 +1304,14 @@ typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */
/*
ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
Open
s a gzip (.gz) file for reading or writing. The mode parameter is as
in fopen ("rb" or "wb") but can also include a compression level ("wb9") or
a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only
compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F'
for fixed code compression as in "wb9F". (See the description of
deflateInit2 for more information about the strategy parameter.) 'T' will
request transparent writing or appending with no compression and not using
the gzip format.
Open
the gzip (.gz) file at path for reading and decompressing, or
compressing and writing. The mode parameter is as in fopen ("rb" or "wb")
but can also include a compression level ("wb9") or a strategy: 'f' for
filtered data as in "wb6f", 'h' for Huffman-only compression as in "wb1h",
'R' for run-length encoding as in "wb1R", or 'F' for fixed code compression
as in "wb9F". (See the description of deflateInit2 for more information
about the strategy parameter.) 'T' will request transparent writing or
appending with no compression and not using
the gzip format.
"a" can be used instead of "w" to request that the gzip stream that will
be written be appended to the file. "+" will result in an error, since
...
...
@@ -1341,9 +1341,9 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode));
ZEXTERN
gzFile
ZEXPORT
gzdopen
OF
((
int
fd
,
const
char
*
mode
));
/*
gzdopen associates a gzFile with the file descriptor fd. File descriptors
are obtained from calls like open, dup, creat, pipe or fileno (if the file
has
been previously opened with fopen). The mode parameter is as in gzopen.
Associate a gzFile with the file descriptor fd. File descriptors are
obtained from calls like open, dup, creat, pipe or fileno (if the file has
been previously opened with fopen). The mode parameter is as in gzopen.
The next call of gzclose on the returned gzFile will also close the file
descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor
...
...
@@ -1364,13 +1364,13 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode));
ZEXTERN
int
ZEXPORT
gzbuffer
OF
((
gzFile
file
,
unsigned
size
));
/*
Set the internal buffer size used by this library's functions
. The
default buffer size is 8192 bytes. This function must be called after
gzopen() or gzdopen(), and before any other calls that read or write th
e
file. The buffer memory allocation is always deferred to the first read or
write. Three times that size in buffer space is allocated. A larger buff
er
size of, for example, 64K or 128K bytes will noticeably increase the speed
of decompression (reading).
Set the internal buffer size used by this library's functions
for file to
size. The default buffer size is 8192 bytes. This function must be called
after gzopen() or gzdopen(), and before any other calls that read or writ
e
the file. The buffer memory allocation is always deferred to the first read
or write. Three times that size in buffer space is allocated. A larg
er
buffer size of, for example, 64K or 128K bytes will noticeably increase the
speed
of decompression (reading).
The new buffer size also affects the maximum length for gzprintf().
...
...
@@ -1380,9 +1380,9 @@ ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size));
ZEXTERN
int
ZEXPORT
gzsetparams
OF
((
gzFile
file
,
int
level
,
int
strategy
));
/*
Dynamically update the compression level
or strategy. See the description
of deflateInit2 for the meaning of these parameters. Previously provided
data is flushed before the parameter change
.
Dynamically update the compression level
and strategy for file. See the
description of deflateInit2 for the meaning of these parameters. Previously
provided data is flushed before applying the parameter changes
.
gzsetparams returns Z_OK if success, Z_STREAM_ERROR if the file was not
opened for writing, Z_ERRNO if there is an error writing the flushed data,
...
...
@@ -1391,7 +1391,7 @@ ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy));
ZEXTERN
int
ZEXPORT
gzread
OF
((
gzFile
file
,
voidp
buf
,
unsigned
len
));
/*
Read
s the given number of uncompressed bytes from the compressed file
. If
Read
and decompress up to len uncompressed bytes from file into buf
. If
the input file is not in gzip format, gzread copies the given number of
bytes into the buffer directly from the file.
...
...
@@ -1422,11 +1422,11 @@ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len));
ZEXTERN
z_size_t
ZEXPORT
gzfread
OF
((
voidp
buf
,
z_size_t
size
,
z_size_t
nitems
,
gzFile
file
));
/*
Read
up to nitems items of size size from file to buf, otherwise operating
as gzread() does. This duplicates the interface of stdio's fread(), with
s
ize_t request and return types. If the library defines size_t, then
z_size_t is identical to size_t. If not, then z_size_t is an unsigned
integer type that can contain a pointer.
Read
and decompress up to nitems items of size size from file into buf,
otherwise operating as gzread() does. This duplicates the interface of
s
tdio's fread(), with size_t request and return types. If the library
defines size_t, then z_size_t is identical to size_t. If not, then z_size_t
i
s an unsigned i
nteger type that can contain a pointer.
gzfread() returns the number of full items read of size size, or zero if
the end of the file was reached and a full item could not be read, or if
...
...
@@ -1445,18 +1445,16 @@ ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems,
file, reseting and retrying on end-of-file, when size is not 1.
*/
ZEXTERN
int
ZEXPORT
gzwrite
OF
((
gzFile
file
,
voidpc
buf
,
unsigned
len
));
ZEXTERN
int
ZEXPORT
gzwrite
OF
((
gzFile
file
,
voidpc
buf
,
unsigned
len
));
/*
Writes the given number of uncompressed bytes into the compressed file.
gzwrite returns the number of uncompressed bytes written or 0 in case of
error.
Compress and write the len uncompressed bytes at buf to file. gzwrite
returns the number of uncompressed bytes written or 0 in case of error.
*/
ZEXTERN
z_size_t
ZEXPORT
gzfwrite
OF
((
voidpc
buf
,
z_size_t
size
,
z_size_t
nitems
,
gzFile
file
));
/*
gzfwrite() writes
nitems items of size size from buf to file, duplicating
Compress and write
nitems items of size size from buf to file, duplicating
the interface of stdio's fwrite(), with size_t request and return types. If
the library defines size_t, then z_size_t is identical to size_t. If not,
then z_size_t is an unsigned integer type that can contain a pointer.
...
...
@@ -1469,22 +1467,22 @@ ZEXTERN z_size_t ZEXPORT gzfwrite OF((voidpc buf, z_size_t size,
ZEXTERN
int
ZEXPORTVA
gzprintf
Z_ARG
((
gzFile
file
,
const
char
*
format
,
...));
/*
Convert
s, formats, and writes the arguments to the compressed
file under
control of the
format string
, as in fprintf. gzprintf returns the number of
Convert
, format, compress, and write the arguments (...) to
file under
control of the
string format
, as in fprintf. gzprintf returns the number of
uncompressed bytes actually written, or a negative zlib error code in case
of error. The number of uncompressed bytes written is limited to 8191, or
one less than the buffer size given to gzbuffer(). The caller should assure
that this limit is not exceeded. If it is exceeded, then gzprintf() will
return an error (0) with nothing written. In this case, there may also be a
buffer overflow with unpredictable consequences, which is possible only if
zlib was compiled with the insecure functions sprintf() or vsprintf()
zlib was compiled with the insecure functions sprintf() or vsprintf()
,
because the secure snprintf() or vsnprintf() functions were not available.
This can be determined using zlibCompileFlags().
*/
ZEXTERN
int
ZEXPORT
gzputs
OF
((
gzFile
file
,
const
char
*
s
));
/*
Writes the given null-terminated string to the compressed
file, excluding
Compress and write the given null-terminated string s to
file, excluding
the terminating null character.
gzputs returns the number of characters written, or -1 in case of error.
...
...
@@ -1492,11 +1490,12 @@ ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s));
ZEXTERN
char
*
ZEXPORT
gzgets
OF
((
gzFile
file
,
char
*
buf
,
int
len
));
/*
Reads bytes from the compressed file until len-1 characters are read, or a
newline character is read and transferred to buf, or an end-of-file
condition is encountered. If any characters are read or if len == 1, the
string is terminated with a null character. If no characters are read due
to an end-of-file or len < 1, then the buffer is left untouched.
Read and decompress bytes from file into buf, until len-1 characters are
read, or until a newline character is read and transferred to buf, or an
end-of-file condition is encountered. If any characters are read or if len
is one, the string is terminated with a null character. If no characters
are read due to an end-of-file or len is less than one, then the buffer is
left untouched.
gzgets returns buf which is a null-terminated string, or it returns NULL
for end-of-file or in case of error. If there was an error, the contents at
...
...
@@ -1505,13 +1504,13 @@ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len));
ZEXTERN
int
ZEXPORT
gzputc
OF
((
gzFile
file
,
int
c
));
/*
Writes c, converted to an unsigned char, into the compressed
file. gzputc
Compress and write c, converted to an unsigned char, into
file. gzputc
returns the value that was written, or -1 in case of error.
*/
ZEXTERN
int
ZEXPORT
gzgetc
OF
((
gzFile
file
));
/*
Read
s one byte from the compressed
file. gzgetc returns this byte or -1
Read
and decompress one byte from
file. gzgetc returns this byte or -1
in case of end of file or error. This is implemented as a macro for speed.
As such, it does not do all of the checking the other functions do. I.e.
it does not check to see if file is NULL, nor whether the structure file
...
...
@@ -1520,8 +1519,8 @@ ZEXTERN int ZEXPORT gzgetc OF((gzFile file));
ZEXTERN
int
ZEXPORT
gzungetc
OF
((
int
c
,
gzFile
file
));
/*
Push
one character back onto the stream to be read as the first character
on the next read. At least one character of push-back i
s allowed.
Push
c back onto the stream for file to be read as the first character on
the next read. At least one character of push-back is alway
s allowed.
gzungetc() returns the character pushed, or -1 on failure. gzungetc() will
fail if c is -1, and may fail if a character has been pushed but not read
yet. If gzungetc is used immediately after gzopen or gzdopen, at least the
...
...
@@ -1532,9 +1531,9 @@ ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file));
ZEXTERN
int
ZEXPORT
gzflush
OF
((
gzFile
file
,
int
flush
));
/*
Flush
es all pending output into the compressed file. The parameter flush
is as in the deflate() function. The return value is the zlib error number
(see function
gzerror below). gzflush is only permitted when writing.
Flush
all pending output to file. The parameter flush is as in the
deflate() function. The return value is the zlib error number (see function
gzerror below). gzflush is only permitted when writing.
If the flush parameter is Z_FINISH, the remaining data is written and the
gzip stream is completed in the output. If gzwrite() is called again, a new
...
...
@@ -1549,8 +1548,8 @@ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush));
ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
z_off_t offset, int whence));
Set
s the starting position for the next gzread or gzwrite on the given
compressed
file. The offset represents a number of bytes in the
Set
the starting position to offset relative to whence for the next gzread
or gzwrite on
file. The offset represents a number of bytes in the
uncompressed data stream. The whence parameter is defined as in lseek(2);
the value SEEK_END is not supported.
...
...
@@ -1567,18 +1566,18 @@ ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file,
ZEXTERN
int
ZEXPORT
gzrewind
OF
((
gzFile
file
));
/*
Rewind
s the given
file. This function is supported only for reading.
Rewind file. This function is supported only for reading.
gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET)
.
*/
/*
ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
Return
s the starting position for the next gzread or gzwrite on the given
compressed file. This position represents a number of bytes in the
uncompressed data stream, and is zero when starting, even if appending or
reading a gzip stream from
the middle of a file using gzdopen().
Return
the starting position for the next gzread or gzwrite on file.
This position represents a number of bytes in the uncompressed data stream,
and is zero when starting, even if appending or reading a gzip stream from
the middle of a file using gzdopen().
gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR)
*/
...
...
@@ -1586,22 +1585,22 @@ ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file));
/*
ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file));
Return
s the current offset in the file being read or written. This offset
includes the count of bytes that precede the gzip stream, for example when
appending or when using gzdopen() for reading. When reading, the offset
does not include as yet unused buffered input. This information can be used
for a progress indicator. On error, gzoffset() returns -1.
Return
the current compressed (actual) read or write offset of file. This
offset includes the count of bytes that precede the gzip stream, for example
when appending or when using gzdopen() for reading. When reading, the
offset does not include as yet unused buffered input. This information can
be used
for a progress indicator. On error, gzoffset() returns -1.
*/
ZEXTERN
int
ZEXPORT
gzeof
OF
((
gzFile
file
));
/*
Return
s true (1) if the end-of-file indicator has been set while reading,
false (0) otherwise. Note that the end-of-file indicator is set only if the
read tried to go past the end of the input, but came up short. Therefore,
just like feof(), gzeof() may return false even if there is no more data t
o
read, in the event that the last read request was for the exact number of
bytes remaining in the input file. This will happen if the input file size
is an exact multiple of the buffer size.
Return
true (1) if the end-of-file indicator for file has been set while
reading, false (0) otherwise. Note that the end-of-file indicator is set
only if the read tried to go past the end of the input, but came up short.
Therefore, just like feof(), gzeof() may return false even if there is n
o
more data to read, in the event that the last read request was for the exact
number of bytes remaining in the input file. This will happen if the input
file size
is an exact multiple of the buffer size.
If gzeof() returns true, then the read functions will return no more data,
unless the end-of-file indicator is reset by gzclearerr() and the input file
...
...
@@ -1610,7 +1609,7 @@ ZEXTERN int ZEXPORT gzeof OF((gzFile file));
ZEXTERN
int
ZEXPORT
gzdirect
OF
((
gzFile
file
));
/*
Return
s
true (1) if file is being copied directly while reading, or false
Return true (1) if file is being copied directly while reading, or false
(0) if file is a gzip stream being decompressed.
If the input file is empty, gzdirect() will return true, since the input
...
...
@@ -1631,8 +1630,8 @@ ZEXTERN int ZEXPORT gzdirect OF((gzFile file));
ZEXTERN
int
ZEXPORT
gzclose
OF
((
gzFile
file
));
/*
Flush
es all pending output if necessary, closes the compressed
file and
deallocate
s
the (de)compression state. Note that once file is closed, you
Flush
all pending output for file, if necessary, close
file and
deallocate the (de)compression state. Note that once file is closed, you
cannot call gzerror with file, since its structures have been deallocated.
gzclose must not be called more than once on the same file, just as free
must not be called more than once on the same allocation.
...
...
@@ -1656,10 +1655,10 @@ ZEXTERN int ZEXPORT gzclose_w OF((gzFile file));
ZEXTERN
const
char
*
ZEXPORT
gzerror
OF
((
gzFile
file
,
int
*
errnum
));
/*
Return
s the error message for the last error which occurred on the given
compressed file. errnum is set to zlib error number. If an error occurred
in the file system and not in the compression library, errnum is set to
Z_ERRNO and the
application may consult errno to get the exact error code.
Return
the error message for the last error which occurred on file.
errnum is set to zlib error number. If an error occurred in the file system
and not in the compression library, errnum is set to Z_ERRNO and the
application may consult errno to get the exact error code.
The application must not modify the returned string. Future calls to
this function may invalidate the previously returned string. If file is
...
...
@@ -1672,7 +1671,7 @@ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum));
ZEXTERN
void
ZEXPORT
gzclearerr
OF
((
gzFile
file
));
/*
Clear
s
the error and end-of-file flags for file. This is analogous to the
Clear the error and end-of-file flags for file. This is analogous to the
clearerr() function in stdio. This is useful for continuing to read a gzip
file that is being written concurrently.
*/
...
...
@@ -1871,7 +1870,7 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */
# define z_gzoffset z_gzoffset64
# define z_adler32_combine z_adler32_combine64
# define z_crc32_combine z_crc32_combine64
# define z_crc32_combine_gen z_crc32_combine
64_gen
# define z_crc32_combine_gen z_crc32_combine
_gen64
# else
# define gzopen gzopen64
# define gzseek gzseek64
...
...
Library/OcCompressionLib/zlib/zutil.c
0 → 100644
浏览文件 @
c2942135
/* zutil.c -- target dependent utility functions for the compression library
* Copyright (C) 1995-2017 Jean-loup Gailly
* For conditions of distribution and use, see copyright notice in zlib.h
*/
/* @(#) $Id$ */
#include "zutil.h"
z_const
char
*
const
z_errmsg
[
10
]
=
{
(
z_const
char
*
)
"need dictionary"
,
/* Z_NEED_DICT 2 */
(
z_const
char
*
)
"stream end"
,
/* Z_STREAM_END 1 */
(
z_const
char
*
)
""
,
/* Z_OK 0 */
(
z_const
char
*
)
"file error"
,
/* Z_ERRNO (-1) */
(
z_const
char
*
)
"stream error"
,
/* Z_STREAM_ERROR (-2) */
(
z_const
char
*
)
"data error"
,
/* Z_DATA_ERROR (-3) */
(
z_const
char
*
)
"insufficient memory"
,
/* Z_MEM_ERROR (-4) */
(
z_const
char
*
)
"buffer error"
,
/* Z_BUF_ERROR (-5) */
(
z_const
char
*
)
"incompatible version"
,
/* Z_VERSION_ERROR (-6) */
(
z_const
char
*
)
""
};
// PMheart: This is a simplified version of zutil.c, with only z_errmsg.
Library/OcCompressionLib/zlib/zutil.h
浏览文件 @
c2942135
/* zutil.h -- internal interface and configuration of the compression library
* Copyright (C) 1995-20
16
Jean-loup Gailly, Mark Adler
* Copyright (C) 1995-20
22
Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
...
...
@@ -13,12 +13,25 @@
#ifndef ZUTIL_H
#define ZUTIL_H
#define ZLIB_INTERNAL
#ifdef HAVE_HIDDEN
# define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
#else
# define ZLIB_INTERNAL
#endif
#include "zlib.h"
#define local static
#if defined(STDC) && !defined(Z_SOLO)
# if !(defined(_WIN32_WCE) && defined(_MSC_VER))
# include <stddef.h>
# endif
# include <string.h>
# include <stdlib.h>
#endif
#ifndef local
# define local static
#endif
/* since "static" is used to mean two completely different things in C, we
define "local" for the non-static meaning of "static", for readability
(compile with -Dlocal if your debugger can't find static symbols) */
...
...
@@ -29,18 +42,38 @@ typedef unsigned short ush;
typedef
ush
FAR
ushf
;
typedef
unsigned
long
ulg
;
#define ERR_MSG(err) NULL
#if !defined(Z_U8) && !defined(Z_SOLO) && defined(STDC)
# include <limits.h>
# if (ULONG_MAX == 0xffffffffffffffff)
# define Z_U8 unsigned long
# elif (ULLONG_MAX == 0xffffffffffffffff)
# define Z_U8 unsigned long long
# elif (UINT_MAX == 0xffffffffffffffff)
# define Z_U8 unsigned
# endif
#endif
extern
z_const
char
*
const
z_errmsg
[
10
];
/* indexed by 2-zlib_error */
/* (size given to avoid silly warnings with Visual C++) */
#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
#define ERR_RETURN(strm,err) \
return (strm->msg =
NULL
, (err))
return (strm->msg =
ERR_MSG(err)
, (err))
/* To be used only when the state is known to be valid */
/* common constants */
/* common constants */
#define DEF_WBITS MAX_WBITS
#ifndef DEF_WBITS
# define DEF_WBITS MAX_WBITS
#endif
/* default windowBits for decompression. MAX_WBITS is for compression only */
#define DEF_MEM_LEVEL 8
#if MAX_MEM_LEVEL >= 8
# define DEF_MEM_LEVEL 8
#else
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
#endif
/* default memLevel */
#define STORED_BLOCK 0
...
...
@@ -54,25 +87,184 @@ typedef unsigned long ulg;
#define PRESET_DICT 0x20
/* preset dictionary flag in zlib header */
/* target dependencies */
/* target dependencies */
#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
# define OS_CODE 0x00
# ifndef Z_SOLO
# if defined(__TURBOC__) || defined(__BORLANDC__)
# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
/* Allow compilation with ANSI keywords only enabled */
void
_Cdecl
farfree
(
void
*
block
);
void
*
_Cdecl
farmalloc
(
unsigned
long
nbytes
);
# else
# include <alloc.h>
# endif
# else
/* MSC or DJGPP */
# include <malloc.h>
# endif
# endif
#endif
#ifdef AMIGA
# define OS_CODE 1
#endif
#if defined(VAXC) || defined(VMS)
# define OS_CODE 2
# define F_OPEN(name, mode) \
fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
#endif
#ifdef __370__
# if __TARGET_LIB__ < 0x20000000
# define OS_CODE 4
# elif __TARGET_LIB__ < 0x40000000
# define OS_CODE 11
# else
# define OS_CODE 8
# endif
#endif
#if defined(ATARI) || defined(atarist)
# define OS_CODE 5
#endif
#ifdef OS2
# define OS_CODE 6
# if defined(M_I86) && !defined(Z_SOLO)
# include <malloc.h>
# endif
#endif
#if defined(MACOS) || defined(TARGET_OS_MAC)
# define OS_CODE 7
# ifndef Z_SOLO
# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
# include <unix.h>
/* for fdopen */
# else
# ifndef fdopen
# define fdopen(fd,mode) NULL
/* No fdopen() */
# endif
# endif
# endif
#endif
#ifdef __acorn
# define OS_CODE 13
#endif
#if defined(WIN32) && !defined(__CYGWIN__)
# define OS_CODE 10
#endif
#ifdef _BEOS_
# define OS_CODE 16
#endif
#define OS_CODE 3
/* assume Unix */
#ifdef __TOS_OS400__
# define OS_CODE 18
#endif
#ifdef __APPLE__
# define OS_CODE 19
#endif
#if defined(_BEOS_) || defined(RISCOS)
# define fdopen(fd,mode) NULL
/* No fdopen() */
#endif
#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX
# if defined(_WIN32_WCE)
# define fdopen(fd,mode) NULL
/* No fdopen() */
# else
# define fdopen(fd,type) _fdopen(fd,type)
# endif
#endif
#if defined(__BORLANDC__) && !defined(MSDOS)
#pragma warn -8004
#pragma warn -8008
#pragma warn -8066
#endif
/* provide prototypes for these when building zlib without LFS */
#if !defined(_WIN32) && \
(!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0)
ZEXTERN
uLong
ZEXPORT
adler32_combine64
OF
((
uLong
,
uLong
,
z_off_t
));
ZEXTERN
uLong
ZEXPORT
crc32_combine64
OF
((
uLong
,
uLong
,
z_off_t
));
#endif
/* common defaults */
#ifndef OS_CODE
# define OS_CODE 3
/* assume Unix */
#endif
#ifndef F_OPEN
# define F_OPEN(name, mode) fopen((name), (mode))
#endif
/* functions */
#if defined(pyr) || defined(Z_SOLO)
# define NO_MEMCPY
#endif
#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
/* Use our own functions for small and medium model with MSC <= 5.0.
* You may have to use the same strategy for Borland C (untested).
* The __SC__ check is for Symantec.
*/
# define NO_MEMCPY
#endif
#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
# define HAVE_MEMCPY
#endif
#ifdef HAVE_MEMCPY
# ifdef SMALL_MEDIUM
/* MSDOS small or medium model */
# define zmemcpy _fmemcpy
# define zmemcmp _fmemcmp
# define zmemzero(dest, len) _fmemset(dest, 0, len)
# else
# define zmemcpy memcpy
# define zmemcmp memcmp
# define zmemzero(dest, len) memset(dest, 0, len)
# endif
#else
void
ZLIB_INTERNAL
zmemcpy
OF
((
Bytef
*
dest
,
const
Bytef
*
source
,
uInt
len
));
int
ZLIB_INTERNAL
zmemcmp
OF
((
const
Bytef
*
s1
,
const
Bytef
*
s2
,
uInt
len
));
void
ZLIB_INTERNAL
zmemzero
OF
((
Bytef
*
dest
,
uInt
len
));
#endif
#define zmemcpy(Dst, Src, Size) CopyMem ((Dst), (Src), (Size))
#define zmemcmp(Ptr1, Ptr2, Size) CompareMem ((Ptr1), (Ptr2), (Size))
#define zmemzero(Dst, Size) ZeroMem ((Dst), (Size))
/* Diagnostic functions */
#define Assert(cond,msg)
#define Trace(x)
#define Tracev(x)
#define Tracevv(x)
#define Tracec(c,x)
#define Tracecv(c,x)
voidpf
ZLIB_INTERNAL
zcalloc
OF
((
voidpf
opaque
,
unsigned
items
,
#ifdef ZLIB_DEBUG
# include <stdio.h>
extern
int
ZLIB_INTERNAL
z_verbose
;
extern
void
ZLIB_INTERNAL
z_error
OF
((
char
*
m
));
# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
# define Trace(x) {if (z_verbose>=0) fprintf x ;}
# define Tracev(x) {if (z_verbose>0) fprintf x ;}
# define Tracevv(x) {if (z_verbose>1) fprintf x ;}
# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
#else
# define Assert(cond,msg)
# define Trace(x)
# define Tracev(x)
# define Tracevv(x)
# define Tracec(c,x)
# define Tracecv(c,x)
#endif
#ifndef Z_SOLO
voidpf
ZLIB_INTERNAL
zcalloc
OF
((
voidpf
opaque
,
unsigned
items
,
unsigned
size
));
void
ZLIB_INTERNAL
zcfree
OF
((
voidpf
opaque
,
voidpf
ptr
));
void
ZLIB_INTERNAL
zcfree
OF
((
voidpf
opaque
,
voidpf
ptr
));
#endif
#define ZALLOC(strm, items, size) \
(*((strm)->zalloc))((strm)->opaque, (items), (size))
...
...
Utilities/TestDiskImage/Makefile
浏览文件 @
c2942135
...
...
@@ -21,7 +21,8 @@ OBJS = $(PROJECT).o \
inftrees.o
\
trees.o
\
uncompr.o
\
zlib_uefi.o
zlib_uefi.o
\
zutil.o
VPATH
=
../../Library/OcAppleChunklistLib:
$
\
../../Library/OcAppleDiskImageLib:
$
\
../../Library/OcAppleRamDiskLib:
$
\
...
...
Utilities/TestKextInject/Makefile
浏览文件 @
c2942135
...
...
@@ -29,7 +29,8 @@ OBJS = $(PROJECT).o \
inftrees.o
\
trees.o
\
uncompr.o
\
zlib_uefi.o
zlib_uefi.o
\
zutil.o
VPATH
=
../../Library/OcAppleKernelLib:
$
\
../../Library/OcCompressionLib/lzss:
$
\
../../Library/OcCompressionLib/lzvn:
$
\
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录