Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
89aa04de
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
89aa04de
编写于
6月 18, 2020
作者:
H
Hui Li
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[modify for coverity scan]
上级
ea0c4dee
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
60 addition
and
17 deletion
+60
-17
src/util/inc/tutil.h
src/util/inc/tutil.h
+2
-0
src/util/src/tcache.c
src/util/src/tcache.c
+1
-1
src/util/src/tconfig.c
src/util/src/tconfig.c
+7
-2
src/util/src/tdes.c
src/util/src/tdes.c
+1
-1
src/util/src/tlog.c
src/util/src/tlog.c
+12
-5
src/util/src/tnote.c
src/util/src/tnote.c
+9
-3
src/util/src/tskiplist.c
src/util/src/tskiplist.c
+1
-1
src/util/src/tutil.c
src/util/src/tutil.c
+27
-4
未找到文件。
src/util/inc/tutil.h
浏览文件 @
89aa04de
...
...
@@ -116,6 +116,8 @@ extern "C" {
#define POW2(x) ((x) * (x))
int
taosRand
(
void
);
int32_t
strdequote
(
char
*
src
);
size_t
strtrim
(
char
*
src
);
...
...
src/util/src/tcache.c
浏览文件 @
89aa04de
...
...
@@ -506,7 +506,7 @@ void taosAddToTrash(SCacheObj *pCacheObj, SCacheDataNode *pNode) {
void
taosRemoveFromTrashCan
(
SCacheObj
*
pCacheObj
,
STrashElem
*
pElem
)
{
if
(
pElem
->
pData
->
signature
!=
(
uint64_t
)
pElem
->
pData
)
{
uError
(
"key:sig:0x%
x
%p data has been released, ignore"
,
pElem
->
pData
->
signature
,
pElem
->
pData
);
uError
(
"key:sig:0x%
"
PRIx64
"
%p data has been released, ignore"
,
pElem
->
pData
->
signature
,
pElem
->
pData
);
return
;
}
...
...
src/util/src/tconfig.c
浏览文件 @
89aa04de
...
...
@@ -119,8 +119,13 @@ static void taosReadDirectoryConfig(SGlobalCfg *cfg, char *input_value) {
struct
stat
dirstat
;
if
(
stat
(
option
,
&
dirstat
)
<
0
)
{
int
code
=
mkdir
(
option
,
0755
);
uPrint
(
"config option:%s, input value:%s, directory not exist, create with return code:%d"
,
cfg
->
option
,
input_value
,
code
);
if
(
code
<
0
)
{
uError
(
"config option:%s, input value:%s, directory not exist, create fail with return code:%d"
,
cfg
->
option
,
input_value
,
code
);
}
else
{
uPrint
(
"config option:%s, input value:%s, directory not exist, create with return code:%d"
,
cfg
->
option
,
input_value
,
code
);
}
}
cfg
->
cfgStatus
=
TAOS_CFG_CSTATUS_FILE
;
}
else
{
...
...
src/util/src/tdes.c
浏览文件 @
89aa04de
...
...
@@ -140,7 +140,7 @@ void print_char_as_binary(char input) {
void
generate_key
(
unsigned
char
*
key
)
{
int
i
;
for
(
i
=
0
;
i
<
8
;
i
++
)
{
key
[
i
]
=
r
and
()
%
255
;
key
[
i
]
=
taosR
and
()
%
255
;
}
}
...
...
src/util/src/tlog.c
浏览文件 @
89aa04de
...
...
@@ -233,7 +233,9 @@ static void taosGetLogFileName(char *fn) {
}
}
strcpy
(
tsLogObj
.
logName
,
fn
);
if
(
strlen
(
fn
)
<
LOG_FILE_NAME_LEN
)
{
strcpy
(
tsLogObj
.
logName
,
fn
);
}
}
static
int32_t
taosOpenLogFile
(
char
*
fn
,
int32_t
maxLines
,
int32_t
maxFileNum
)
{
...
...
@@ -253,15 +255,20 @@ static int32_t taosOpenLogFile(char *fn, int32_t maxLines, int32_t maxFileNum) {
tsLogObj
.
fileNum
=
maxFileNum
;
taosGetLogFileName
(
fn
);
strcpy
(
name
,
fn
);
strcat
(
name
,
".0"
);
if
(
strlen
(
fn
)
<
LOG_FILE_NAME_LEN
+
50
-
2
)
{
strcpy
(
name
,
fn
);
strcat
(
name
,
".0"
);
}
// if none of the log files exist, open 0, if both exists, open the old one
if
(
stat
(
name
,
&
logstat0
)
<
0
)
{
tsLogObj
.
flag
=
0
;
}
else
{
strcpy
(
name
,
fn
);
strcat
(
name
,
".1"
);
if
(
strlen
(
fn
)
<
LOG_FILE_NAME_LEN
+
50
-
2
)
{
strcpy
(
name
,
fn
);
strcat
(
name
,
".1"
);
}
if
(
stat
(
name
,
&
logstat1
)
<
0
)
{
tsLogObj
.
flag
=
1
;
}
else
{
...
...
src/util/src/tnote.c
浏览文件 @
89aa04de
...
...
@@ -169,7 +169,9 @@ void taosGetNoteName(char *fn, taosNoteInfo * pNote)
}
}
strcpy
(
pNote
->
taosNoteName
,
fn
);
if
(
strlen
(
fn
)
<
NOTE_FILE_NAME_LEN
)
{
strcpy
(
pNote
->
taosNoteName
,
fn
);
}
}
int
taosOpenNoteWithMaxLines
(
char
*
fn
,
int
maxLines
,
int
maxNoteNum
,
taosNoteInfo
*
pNote
)
...
...
@@ -182,14 +184,18 @@ int taosOpenNoteWithMaxLines(char *fn, int maxLines, int maxNoteNum, taosNoteInf
pNote
->
taosNoteFileNum
=
maxNoteNum
;
taosGetNoteName
(
fn
,
pNote
);
if
(
strlen
(
fn
)
>
NOTE_FILE_NAME_LEN
*
2
-
2
)
{
fprintf
(
stderr
,
"the len of file name overflow:%s
\n
"
,
fn
);
return
-
1
;
}
strcpy
(
name
,
fn
);
strcat
(
name
,
".0"
);
// if none of the note files exist, open 0, if both exists, open the old one
if
(
stat
(
name
,
&
notestat0
)
<
0
)
{
pNote
->
taosNoteFlag
=
0
;
}
else
{
}
else
{
strcpy
(
name
,
fn
);
strcat
(
name
,
".1"
);
if
(
stat
(
name
,
&
notestat1
)
<
0
)
{
...
...
src/util/src/tskiplist.c
浏览文件 @
89aa04de
...
...
@@ -38,7 +38,7 @@ static FORCE_INLINE int32_t getSkipListNodeRandomHeight(SSkipList *pSkipList) {
const
uint32_t
factor
=
4
;
int32_t
n
=
1
;
while
((
r
and
()
%
factor
)
==
0
&&
n
<=
pSkipList
->
maxLevel
)
{
while
((
taosR
and
()
%
factor
)
==
0
&&
n
<=
pSkipList
->
maxLevel
)
{
n
++
;
}
...
...
src/util/src/tutil.c
浏览文件 @
89aa04de
...
...
@@ -27,6 +27,27 @@
#include "tulog.h"
#include "taoserror.h"
#ifdef WINDOWS
int
taosRand
(
void
)
{
return
rand
();
}
#else
int
taosRand
(
void
)
{
int
fd
;
unsigned
long
seed
;
fd
=
open
(
"/dev/urandom"
,
0
);
if
((
fd
<
0
)
||
(
read
(
fd
,
&
seed
,
sizeof
(
seed
))
<
0
))
seed
=
time
(
0
);
if
(
fd
>=
0
)
close
(
fd
);
srand
(
seed
);
return
rand
();
}
#endif
int32_t
strdequote
(
char
*
z
)
{
if
(
z
==
NULL
)
{
return
0
;
...
...
@@ -434,8 +455,10 @@ void getTmpfilePath(const char *fileNamePrefix, char *dstPath) {
strcpy
(
tmpPath
,
tmpDir
);
strcat
(
tmpPath
,
tdengineTmpFileNamePrefix
);
strcat
(
tmpPath
,
fileNamePrefix
);
strcat
(
tmpPath
,
"-%d-%s"
);
if
(
strlen
(
tmpPath
)
+
strlen
(
fileNamePrefix
)
+
strlen
(
"-%d-%s"
)
<
PATH_MAX
)
{
strcat
(
tmpPath
,
fileNamePrefix
);
strcat
(
tmpPath
,
"-%d-%s"
);
}
char
rand
[
8
]
=
{
0
};
taosRandStr
(
rand
,
tListLen
(
rand
)
-
1
);
...
...
@@ -447,7 +470,7 @@ void taosRandStr(char* str, int32_t size) {
int32_t
len
=
39
;
for
(
int32_t
i
=
0
;
i
<
size
;
++
i
)
{
str
[
i
]
=
set
[
r
and
()
%
len
];
str
[
i
]
=
set
[
taosR
and
()
%
len
];
}
}
...
...
@@ -718,4 +741,4 @@ void taosRemoveDir(char *rootDir) {
rmdir
(
rootDir
);
uPrint
(
"dir:%s is removed"
,
rootDir
);
}
\ No newline at end of file
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录