Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Zlib
提交
3d9df6ec
T
Third Party Zlib
项目概览
OpenHarmony
/
Third Party Zlib
大约 1 年 前同步成功
通知
15
Star
112
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Zlib
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3d9df6ec
编写于
8月 14, 2012
作者:
M
Mark Adler
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Clean up examples/gzlog.[ch] comparisons of different types.
上级
a2981775
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
9 addition
and
7 deletion
+9
-7
examples/gzlog.c
examples/gzlog.c
+7
-6
examples/gzlog.h
examples/gzlog.h
+2
-1
未找到文件。
examples/gzlog.c
浏览文件 @
3d9df6ec
...
...
@@ -2,7 +2,7 @@
* gzlog.c
* Copyright (C) 2004, 2008, 2012 Mark Adler, all rights reserved
* For conditions of distribution and use, see copyright notice in gzlog.h
* version 2.
1, 8 Jul
2012
* version 2.
2, 14 Aug
2012
*/
/*
...
...
@@ -750,7 +750,8 @@ local int log_recover(struct log *log, int op)
strcpy
(
log
->
end
,
".add"
);
if
(
stat
(
log
->
path
,
&
st
)
==
0
&&
st
.
st_size
)
{
len
=
(
size_t
)(
st
.
st_size
);
if
(
len
!=
st
.
st_size
||
(
data
=
malloc
(
st
.
st_size
))
==
NULL
)
{
if
((
off_t
)
len
!=
st
.
st_size
||
(
data
=
malloc
(
st
.
st_size
))
==
NULL
)
{
log_log
(
log
,
op
,
"allocation failure"
);
return
-
2
;
}
...
...
@@ -758,7 +759,7 @@ local int log_recover(struct log *log, int op)
log_log
(
log
,
op
,
".add file read failure"
);
return
-
1
;
}
ret
=
read
(
fd
,
data
,
len
)
!=
len
;
ret
=
(
size_t
)
read
(
fd
,
data
,
len
)
!=
len
;
close
(
fd
);
if
(
ret
)
{
log_log
(
log
,
op
,
".add file read failure"
);
...
...
@@ -952,7 +953,7 @@ int gzlog_compress(gzlog *logd)
fd
=
open
(
log
->
path
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
0644
);
if
(
fd
<
0
)
break
;
ret
=
write
(
fd
,
data
,
len
)
!=
len
;
ret
=
(
size_t
)
write
(
fd
,
data
,
len
)
!=
len
;
if
(
ret
|
close
(
fd
))
break
;
log_touch
(
log
);
...
...
@@ -963,7 +964,7 @@ int gzlog_compress(gzlog *logd)
if
(
fd
<
0
)
break
;
next
=
DICT
>
len
?
len
:
DICT
;
ret
=
write
(
fd
,
(
char
*
)
data
+
len
-
next
,
next
)
!=
next
;
ret
=
(
size_t
)
write
(
fd
,
(
char
*
)
data
+
len
-
next
,
next
)
!=
next
;
if
(
ret
|
close
(
fd
))
break
;
log_touch
(
log
);
...
...
@@ -1013,7 +1014,7 @@ int gzlog_write(gzlog *logd, void *data, size_t len)
fd
=
open
(
log
->
path
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
0644
);
if
(
fd
<
0
)
return
-
1
;
ret
=
write
(
fd
,
data
,
len
)
!=
len
;
ret
=
(
size_t
)
write
(
fd
,
data
,
len
)
!=
len
;
if
(
ret
|
close
(
fd
))
return
-
1
;
log_touch
(
log
);
...
...
examples/gzlog.h
浏览文件 @
3d9df6ec
/* gzlog.h
Copyright (C) 2004, 2008, 2012 Mark Adler, all rights reserved
version 2.
1, 8 Jul
2012
version 2.
2, 14 Aug
2012
This software is provided 'as-is', without any express or implied
warranty. In no event will the author be held liable for any damages
...
...
@@ -28,6 +28,7 @@
Compression now occurs as needed during gzlog_write()
gzlog_write() now always leaves the log file as valid gzip
2.1 8 Jul 2012 Fix argument checks in gzlog_compress() and gzlog_write()
2.2 14 Aug 2012 Clean up signed comparisons
*/
/*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录