Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
Z
zstd
管理
动态
成员
标记
计划
议题
议题看板
里程碑
Wiki
代码
合并请求
仓库
分支
提交
标签
仓库图
比较修订版本
代码片段
构建
流水线
作业
流水线计划
产物
部署
发布
Package registry
Container registry
模型注册表
运维
环境
Terraform 模块
监控
事件
服务台
分析
价值流分析
贡献者分析
CI/CD 分析
仓库分析
模型实验
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
显示更多面包屑
Xayah
zstd
提交
dd96efa9
提交
dd96efa9
编辑于
7 years ago
作者:
Paul Cruz
浏览文件
操作
下载
补丁
差异文件
added print statements for debugging, fixed long memset by changing to calloc
上级
0887e98d
No related branches found
No related tags found
无相关合并请求
变更
3
隐藏空白变更内容
行内
左右并排
显示
3 个更改的文件
contrib/adaptive-compression/run.sh
+2
-0
2 个添加, 0 个删除
contrib/adaptive-compression/run.sh
contrib/adaptive-compression/v2
+0
-0
0 个添加, 0 个删除
contrib/adaptive-compression/v2
contrib/adaptive-compression/v2.c
+13
-2
13 个添加, 2 个删除
contrib/adaptive-compression/v2.c
有
15 个添加
和
2 个删除
contrib/adaptive-compression/run.sh
0 → 100755
+
2
−
0
浏览文件 @
dd96efa9
make clean v2
./v2 tests/test2048.pdf tmp.zst
此差异已折叠。
点击以展开。
contrib/adaptive-compression/v2
0 → 100755
+
0
−
0
浏览文件 @
dd96efa9
文件已添加
此差异已折叠。
点击以展开。
contrib/adaptive-compression/v2.c
+
13
−
2
浏览文件 @
dd96efa9
...
...
@@ -45,6 +45,7 @@ typedef struct {
static
adaptCCtx
*
createCCtx
(
unsigned
numJobs
,
const
char
*
const
outFilename
)
{
adaptCCtx
*
ctx
=
malloc
(
sizeof
(
adaptCCtx
));
memset
(
ctx
,
0
,
sizeof
(
adaptCCtx
));
ctx
->
compressionLevel
=
6
;
/* default */
...
...
@@ -53,7 +54,7 @@ static adaptCCtx* createCCtx(unsigned numJobs, const char* const outFilename)
pthread_mutex_init
(
&
ctx
->
jobReady_mutex
,
NULL
);
pthread_cond_init
(
&
ctx
->
jobReady_cond
,
NULL
);
ctx
->
numJobs
=
numJobs
;
ctx
->
jobs
=
m
alloc
(
numJobs
*
sizeof
(
jobDescription
));
ctx
->
jobs
=
c
alloc
(
1
,
numJobs
*
sizeof
(
jobDescription
));
ctx
->
nextJobID
=
0
;
ctx
->
threadError
=
0
;
if
(
!
ctx
->
jobs
)
{
...
...
@@ -95,6 +96,7 @@ static int freeCCtx(adaptCCtx* ctx)
static
void
*
compressionThread
(
void
*
arg
)
{
DISPLAY
(
"started compression thread
\n
"
);
adaptCCtx
*
ctx
=
(
adaptCCtx
*
)
arg
;
unsigned
currJob
=
0
;
for
(
;
;
)
{
...
...
@@ -126,6 +128,7 @@ static void* compressionThread(void* arg)
static
void
*
outputThread
(
void
*
arg
)
{
DISPLAY
(
"started output thread
\n
"
);
adaptCCtx
*
ctx
=
(
adaptCCtx
*
)
arg
;
unsigned
currJob
=
0
;
for
(
;
;
)
{
...
...
@@ -202,6 +205,10 @@ static int createCompressionJob(adaptCCtx* ctx, BYTE* data, size_t srcSize)
return
1
;
}
memcpy
(
job
.
src
.
start
,
data
,
srcSize
);
pthread_mutex_lock
(
job
.
jobReady_mutex
);
job
.
jobReady
=
1
;
pthread_cond_signal
(
job
.
jobReady_cond
);
pthread_mutex_unlock
(
job
.
jobReady_mutex
);
ctx
->
nextJobID
++
;
return
0
;
}
...
...
@@ -209,6 +216,10 @@ static int createCompressionJob(adaptCCtx* ctx, BYTE* data, size_t srcSize)
/* return 0 if successful, else return error */
int
main
(
int
argCount
,
const
char
*
argv
[])
{
if
(
argCount
<
2
)
{
DISPLAY
(
"Error: not enough arguments
\n
"
);
return
1
;
}
const
char
*
const
srcFilename
=
argv
[
1
];
const
char
*
const
dstFilename
=
argv
[
2
];
BYTE
*
const
src
=
malloc
(
FILE_CHUNK_SIZE
);
...
...
@@ -228,7 +239,7 @@ int main(int argCount, const char* argv[])
if
(
!
srcFilename
||
!
dstFilename
||
!
src
)
{
DISPLAY
(
"Error: initial variables could not be allocated
\n
"
);
ret
=
1
;
goto
cleanup
;
goto
cleanup
;
}
/* creating context */
...
...
此差异已折叠。
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录