Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
d2f03cfe
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d2f03cfe
编写于
10月 08, 2010
作者:
A
alanb
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
1c777e8b
e9b87269
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
24 addition
and
10 deletion
+24
-10
src/share/native/java/util/zip/Inflater.c
src/share/native/java/util/zip/Inflater.c
+24
-10
未找到文件。
src/share/native/java/util/zip/Inflater.c
浏览文件 @
d2f03cfe
...
@@ -116,13 +116,27 @@ Java_java_util_zip_Inflater_inflateBytes(JNIEnv *env, jobject this, jlong addr,
...
@@ -116,13 +116,27 @@ Java_java_util_zip_Inflater_inflateBytes(JNIEnv *env, jobject this, jlong addr,
jbyte
*
in_buf
;
jbyte
*
in_buf
;
jbyte
*
out_buf
;
jbyte
*
out_buf
;
int
ret
;
int
ret
;
/*
* Avoid excess copying.
* zlib stream usually has a few bytes of overhead for header info
* (depends on the underlying data)
*
* (a) 5 bytes per 16KB
* (b) 6 bytes for entire stream
* (c) 4 bytes for gzip header
* (d) 2 bytes for crc
*
* Use 20 bytes as the "safe cutoff" number.
*/
jint
in_len
=
MIN
(
this_len
,
len
+
20
);
jint
consumed
;
in_buf
=
(
jbyte
*
)
malloc
(
this
_len
);
in_buf
=
(
jbyte
*
)
malloc
(
in
_len
);
if
(
in_buf
==
0
)
{
if
(
in_buf
==
0
)
{
JNU_ThrowOutOfMemoryError
(
env
,
0
);
JNU_ThrowOutOfMemoryError
(
env
,
0
);
return
0
;
return
0
;
}
}
(
*
env
)
->
GetByteArrayRegion
(
env
,
this_buf
,
this_off
,
this
_len
,
in_buf
);
(
*
env
)
->
GetByteArrayRegion
(
env
,
this_buf
,
this_off
,
in
_len
,
in_buf
);
out_buf
=
(
jbyte
*
)
malloc
(
len
);
out_buf
=
(
jbyte
*
)
malloc
(
len
);
if
(
out_buf
==
0
)
{
if
(
out_buf
==
0
)
{
...
@@ -133,7 +147,7 @@ Java_java_util_zip_Inflater_inflateBytes(JNIEnv *env, jobject this, jlong addr,
...
@@ -133,7 +147,7 @@ Java_java_util_zip_Inflater_inflateBytes(JNIEnv *env, jobject this, jlong addr,
strm
->
next_in
=
(
Bytef
*
)
in_buf
;
strm
->
next_in
=
(
Bytef
*
)
in_buf
;
strm
->
next_out
=
(
Bytef
*
)
out_buf
;
strm
->
next_out
=
(
Bytef
*
)
out_buf
;
strm
->
avail_in
=
this
_len
;
strm
->
avail_in
=
in
_len
;
strm
->
avail_out
=
len
;
strm
->
avail_out
=
len
;
ret
=
inflate
(
strm
,
Z_PARTIAL_FLUSH
);
ret
=
inflate
(
strm
,
Z_PARTIAL_FLUSH
);
...
@@ -148,16 +162,16 @@ Java_java_util_zip_Inflater_inflateBytes(JNIEnv *env, jobject this, jlong addr,
...
@@ -148,16 +162,16 @@ Java_java_util_zip_Inflater_inflateBytes(JNIEnv *env, jobject this, jlong addr,
(
*
env
)
->
SetBooleanField
(
env
,
this
,
finishedID
,
JNI_TRUE
);
(
*
env
)
->
SetBooleanField
(
env
,
this
,
finishedID
,
JNI_TRUE
);
/* fall through */
/* fall through */
case
Z_OK
:
case
Z_OK
:
this_off
+=
this
_len
-
strm
->
avail_in
;
consumed
=
in
_len
-
strm
->
avail_in
;
(
*
env
)
->
SetIntField
(
env
,
this
,
offID
,
this_off
);
(
*
env
)
->
SetIntField
(
env
,
this
,
offID
,
this_off
+
consumed
);
(
*
env
)
->
SetIntField
(
env
,
this
,
lenID
,
strm
->
avail_in
);
(
*
env
)
->
SetIntField
(
env
,
this
,
lenID
,
this_len
-
consumed
);
return
len
-
strm
->
avail_out
;
return
len
-
strm
->
avail_out
;
case
Z_NEED_DICT
:
case
Z_NEED_DICT
:
(
*
env
)
->
SetBooleanField
(
env
,
this
,
needDictID
,
JNI_TRUE
);
(
*
env
)
->
SetBooleanField
(
env
,
this
,
needDictID
,
JNI_TRUE
);
/* Might have consumed some input here! */
/* Might have consumed some input here! */
this_off
+=
this
_len
-
strm
->
avail_in
;
consumed
=
in
_len
-
strm
->
avail_in
;
(
*
env
)
->
SetIntField
(
env
,
this
,
offID
,
this_off
);
(
*
env
)
->
SetIntField
(
env
,
this
,
offID
,
this_off
+
consumed
);
(
*
env
)
->
SetIntField
(
env
,
this
,
lenID
,
strm
->
avail_in
);
(
*
env
)
->
SetIntField
(
env
,
this
,
lenID
,
this_len
-
consumed
);
return
0
;
return
0
;
case
Z_BUF_ERROR
:
case
Z_BUF_ERROR
:
return
0
;
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录