Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
2ba8fef0
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
2ba8fef0
编写于
10月 25, 2022
作者:
S
Shengliang Guan
提交者:
GitHub
10月 25, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #17571 from taosdata/fix/TD-19655-V30
fix(all): fixed coverity scan problems for second submiting
上级
ca5ecdcc
d54ed458
变更
12
隐藏空白更改
内联
并排
Showing
12 changed file
with
29 addition
and
21 deletion
+29
-21
source/os/src/osFile.c
source/os/src/osFile.c
+1
-1
source/util/src/tcompression.c
source/util/src/tcompression.c
+3
-0
source/util/src/tdigest.c
source/util/src/tdigest.c
+1
-1
source/util/src/tencode.c
source/util/src/tencode.c
+1
-1
source/util/src/tenv.c
source/util/src/tenv.c
+1
-1
source/util/src/thash.c
source/util/src/thash.c
+1
-1
source/util/src/tlog.c
source/util/src/tlog.c
+2
-1
source/util/src/tlrucache.c
source/util/src/tlrucache.c
+2
-0
source/util/src/tpagedbuf.c
source/util/src/tpagedbuf.c
+3
-1
tools/shell/inc/shellTire.h
tools/shell/inc/shellTire.h
+1
-1
tools/shell/src/shellAuto.c
tools/shell/src/shellAuto.c
+5
-2
tools/shell/src/shellTire.c
tools/shell/src/shellTire.c
+8
-11
未找到文件。
source/os/src/osFile.c
浏览文件 @
2ba8fef0
...
@@ -191,7 +191,7 @@ int32_t taosRenameFile(const char *oldName, const char *newName) {
...
@@ -191,7 +191,7 @@ int32_t taosRenameFile(const char *oldName, const char *newName) {
printf
(
"failed to rename file %s to %s, reason:%s
\n
"
,
oldName
,
newName
,
strerror
(
errno
));
printf
(
"failed to rename file %s to %s, reason:%s
\n
"
,
oldName
,
newName
,
strerror
(
errno
));
}
}
return
!
code
;
return
code
?
0
:
-
1
;
#else
#else
int32_t
code
=
rename
(
oldName
,
newName
);
int32_t
code
=
rename
(
oldName
,
newName
);
if
(
code
<
0
)
{
if
(
code
<
0
)
{
...
...
source/util/src/tcompression.c
浏览文件 @
2ba8fef0
...
@@ -2274,6 +2274,9 @@ int32_t tsCompressBool(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int32_t
...
@@ -2274,6 +2274,9 @@ int32_t tsCompressBool(void *pIn, int32_t nIn, int32_t nEle, void *pOut, int32_t
return
tsCompressBoolImp
(
pIn
,
nEle
,
pOut
);
return
tsCompressBoolImp
(
pIn
,
nEle
,
pOut
);
}
else
if
(
cmprAlg
==
TWO_STAGE_COMP
)
{
}
else
if
(
cmprAlg
==
TWO_STAGE_COMP
)
{
int32_t
len
=
tsCompressBoolImp
(
pIn
,
nEle
,
pBuf
);
int32_t
len
=
tsCompressBoolImp
(
pIn
,
nEle
,
pBuf
);
if
(
len
<
0
)
{
return
-
1
;
}
return
tsCompressStringImp
(
pBuf
,
len
,
pOut
,
nOut
);
return
tsCompressStringImp
(
pBuf
,
len
,
pOut
,
nOut
);
}
else
{
}
else
{
assert
(
0
);
assert
(
0
);
...
...
source/util/src/tdigest.c
浏览文件 @
2ba8fef0
...
@@ -263,7 +263,7 @@ double tdigestQuantile(TDigest *t, double q) {
...
@@ -263,7 +263,7 @@ double tdigestQuantile(TDigest *t, double q) {
b
=
c
;
b
=
c
;
right
=
(
b
->
weight
*
a
->
mean
+
a
->
weight
*
b
->
mean
)
/
(
a
->
weight
+
b
->
weight
);
right
=
(
b
->
weight
*
a
->
mean
+
a
->
weight
*
b
->
mean
)
/
(
a
->
weight
+
b
->
weight
);
if
(
idx
<
weight_so_far
+
a
->
weight
)
{
if
(
idx
<
weight_so_far
+
a
->
weight
)
{
double
p
=
(
idx
-
weight_so_far
)
/
a
->
weight
;
double
p
=
(
idx
-
weight_so_far
)
/
((
a
->
weight
==
0
)
?
1
:
a
->
weight
)
;
return
left
*
(
1
-
p
)
+
right
*
p
;
return
left
*
(
1
-
p
)
+
right
*
p
;
}
}
weight_so_far
+=
a
->
weight
;
weight_so_far
+=
a
->
weight
;
...
...
source/util/src/tencode.c
浏览文件 @
2ba8fef0
...
@@ -109,7 +109,7 @@ void tEndEncode(SEncoder* pCoder) {
...
@@ -109,7 +109,7 @@ void tEndEncode(SEncoder* pCoder) {
pCoder
->
size
=
pNode
->
size
;
pCoder
->
size
=
pNode
->
size
;
pCoder
->
pos
=
pNode
->
pos
;
pCoder
->
pos
=
pNode
->
pos
;
tEncodeI32
(
pCoder
,
len
);
(
void
)
tEncodeI32
(
pCoder
,
len
);
TD_CODER_MOVE_POS
(
pCoder
,
len
);
TD_CODER_MOVE_POS
(
pCoder
,
len
);
}
}
...
...
source/util/src/tenv.c
浏览文件 @
2ba8fef0
...
@@ -54,7 +54,7 @@ int32_t taosEnvNameToCfgName(const char *envNameStr, char *cfgNameStr, int32_t c
...
@@ -54,7 +54,7 @@ int32_t taosEnvNameToCfgName(const char *envNameStr, char *cfgNameStr, int32_t c
}
}
int32_t
taosEnvToCfg
(
const
char
*
envStr
,
char
*
cfgStr
)
{
int32_t
taosEnvToCfg
(
const
char
*
envStr
,
char
*
cfgStr
)
{
if
(
envStr
==
NULL
&&
cfgStr
==
NULL
)
{
if
(
envStr
==
NULL
||
cfgStr
==
NULL
)
{
return
-
1
;
return
-
1
;
}
}
if
(
cfgStr
!=
envStr
)
strcpy
(
cfgStr
,
envStr
);
if
(
cfgStr
!=
envStr
)
strcpy
(
cfgStr
,
envStr
);
...
...
source/util/src/thash.c
浏览文件 @
2ba8fef0
...
@@ -639,7 +639,7 @@ void taosHashTableResize(SHashObj *pHashObj) {
...
@@ -639,7 +639,7 @@ void taosHashTableResize(SHashObj *pHashObj) {
}
}
int64_t
st
=
taosGetTimestampUs
();
int64_t
st
=
taosGetTimestampUs
();
void
*
pNewEntryList
=
taosMemoryRealloc
(
pHashObj
->
hashList
,
sizeof
(
void
*
)
*
newCapacity
);
SHashEntry
**
pNewEntryList
=
taosMemoryRealloc
(
pHashObj
->
hashList
,
sizeof
(
SHashEntry
*
)
*
newCapacity
);
if
(
pNewEntryList
==
NULL
)
{
if
(
pNewEntryList
==
NULL
)
{
// uDebug("cache resize failed due to out of memory, capacity remain:%zu", pHashObj->capacity);
// uDebug("cache resize failed due to out of memory, capacity remain:%zu", pHashObj->capacity);
return
;
return
;
...
...
source/util/src/tlog.c
浏览文件 @
2ba8fef0
...
@@ -207,7 +207,8 @@ static void taosKeepOldLog(char *oldName) {
...
@@ -207,7 +207,8 @@ static void taosKeepOldLog(char *oldName) {
char
fileName
[
LOG_FILE_NAME_LEN
+
20
];
char
fileName
[
LOG_FILE_NAME_LEN
+
20
];
snprintf
(
fileName
,
LOG_FILE_NAME_LEN
+
20
,
"%s.%"
PRId64
,
tsLogObj
.
logName
,
fileSec
);
snprintf
(
fileName
,
LOG_FILE_NAME_LEN
+
20
,
"%s.%"
PRId64
,
tsLogObj
.
logName
,
fileSec
);
taosRenameFile
(
oldName
,
fileName
);
(
void
)
taosRenameFile
(
oldName
,
fileName
);
if
(
tsLogKeepDays
<
0
)
{
if
(
tsLogKeepDays
<
0
)
{
char
compressFileName
[
LOG_FILE_NAME_LEN
+
20
];
char
compressFileName
[
LOG_FILE_NAME_LEN
+
20
];
snprintf
(
compressFileName
,
LOG_FILE_NAME_LEN
+
20
,
"%s.%"
PRId64
".gz"
,
tsLogObj
.
logName
,
fileSec
);
snprintf
(
compressFileName
,
LOG_FILE_NAME_LEN
+
20
,
"%s.%"
PRId64
".gz"
,
tsLogObj
.
logName
,
fileSec
);
...
...
source/util/src/tlrucache.c
浏览文件 @
2ba8fef0
...
@@ -337,6 +337,7 @@ static int taosLRUCacheShardInit(SLRUCacheShard *shard, size_t capacity, bool st
...
@@ -337,6 +337,7 @@ static int taosLRUCacheShardInit(SLRUCacheShard *shard, size_t capacity, bool st
taosThreadMutexInit
(
&
shard
->
mutex
,
NULL
);
taosThreadMutexInit
(
&
shard
->
mutex
,
NULL
);
taosThreadMutexLock
(
&
shard
->
mutex
);
shard
->
capacity
=
0
;
shard
->
capacity
=
0
;
shard
->
highPriPoolUsage
=
0
;
shard
->
highPriPoolUsage
=
0
;
shard
->
strictCapacity
=
strict
;
shard
->
strictCapacity
=
strict
;
...
@@ -349,6 +350,7 @@ static int taosLRUCacheShardInit(SLRUCacheShard *shard, size_t capacity, bool st
...
@@ -349,6 +350,7 @@ static int taosLRUCacheShardInit(SLRUCacheShard *shard, size_t capacity, bool st
shard
->
lru
.
next
=
&
shard
->
lru
;
shard
->
lru
.
next
=
&
shard
->
lru
;
shard
->
lru
.
prev
=
&
shard
->
lru
;
shard
->
lru
.
prev
=
&
shard
->
lru
;
shard
->
lruLowPri
=
&
shard
->
lru
;
shard
->
lruLowPri
=
&
shard
->
lru
;
taosThreadMutexUnlock
(
&
shard
->
mutex
);
taosLRUCacheShardSetCapacity
(
shard
,
capacity
);
taosLRUCacheShardSetCapacity
(
shard
,
capacity
);
...
...
source/util/src/tpagedbuf.c
浏览文件 @
2ba8fef0
...
@@ -534,7 +534,9 @@ void destroyDiskbasedBuf(SDiskbasedBuf* pBuf) {
...
@@ -534,7 +534,9 @@ void destroyDiskbasedBuf(SDiskbasedBuf* pBuf) {
}
}
}
}
taosRemoveFile
(
pBuf
->
path
);
if
(
taosRemoveFile
(
pBuf
->
path
)
<
0
)
{
uDebug
(
"WARNING tPage remove file failed. path=%s"
,
pBuf
->
path
);
}
taosMemoryFreeClear
(
pBuf
->
path
);
taosMemoryFreeClear
(
pBuf
->
path
);
size_t
n
=
taosArrayGetSize
(
pBuf
->
pIdList
);
size_t
n
=
taosArrayGetSize
(
pBuf
->
pIdList
);
...
...
tools/shell/inc/shellTire.h
浏览文件 @
2ba8fef0
...
@@ -78,7 +78,7 @@ bool insertWord(STire* tire, char* word);
...
@@ -78,7 +78,7 @@ bool insertWord(STire* tire, char* word);
bool
deleteWord
(
STire
*
tire
,
char
*
word
);
bool
deleteWord
(
STire
*
tire
,
char
*
word
);
// match prefix words, if match is not NULL , put all item to match and return match
// match prefix words, if match is not NULL , put all item to match and return match
SMatch
*
matchPrefix
(
STire
*
tire
,
char
*
prefix
,
SMatch
*
match
);
void
matchPrefix
(
STire
*
tire
,
char
*
prefix
,
SMatch
*
match
);
// get all items from tires tree
// get all items from tires tree
SMatch
*
enumAll
(
STire
*
tire
);
SMatch
*
enumAll
(
STire
*
tire
);
...
...
tools/shell/src/shellAuto.c
浏览文件 @
2ba8fef0
...
@@ -564,6 +564,7 @@ void parseCommand(SWords* command, bool pattern) {
...
@@ -564,6 +564,7 @@ void parseCommand(SWords* command, bool pattern) {
// free SShellCmd
// free SShellCmd
void
freeCommand
(
SWords
*
command
)
{
void
freeCommand
(
SWords
*
command
)
{
SWord
*
item
=
command
->
head
;
SWord
*
item
=
command
->
head
;
command
->
head
=
NULL
;
// loop
// loop
while
(
item
)
{
while
(
item
)
{
SWord
*
tmp
=
item
;
SWord
*
tmp
=
item
;
...
@@ -815,7 +816,9 @@ char* matchNextPrefix(STire* tire, char* pre) {
...
@@ -815,7 +816,9 @@ char* matchNextPrefix(STire* tire, char* pre) {
match
=
enumAll
(
tire
);
match
=
enumAll
(
tire
);
}
else
{
}
else
{
// NOT EMPTY
// NOT EMPTY
match
=
matchPrefix
(
tire
,
pre
,
NULL
);
match
=
(
SMatch
*
)
taosMemoryMalloc
(
sizeof
(
SMatch
));
memset
(
match
,
0
,
sizeof
(
SMatch
));
matchPrefix
(
tire
,
pre
,
match
);
}
}
// save to lastMatch
// save to lastMatch
...
@@ -828,7 +831,7 @@ char* matchNextPrefix(STire* tire, char* pre) {
...
@@ -828,7 +831,7 @@ char* matchNextPrefix(STire* tire, char* pre) {
// check valid
// check valid
if
(
match
==
NULL
||
match
->
head
==
NULL
)
{
if
(
match
==
NULL
||
match
->
head
==
NULL
)
{
// no one matched
// no one matched
return
false
;
return
NULL
;
}
}
if
(
cursorVar
==
-
1
)
{
if
(
cursorVar
==
-
1
)
{
...
...
tools/shell/src/shellTire.c
浏览文件 @
2ba8fef0
...
@@ -308,25 +308,21 @@ void matchPrefixFromTree(STire* tire, char* prefix, SMatch* match) {
...
@@ -308,25 +308,21 @@ void matchPrefixFromTree(STire* tire, char* prefix, SMatch* match) {
}
}
}
}
SMatch
*
matchPrefix
(
STire
*
tire
,
char
*
prefix
,
SMatch
*
match
)
{
void
matchPrefix
(
STire
*
tire
,
char
*
prefix
,
SMatch
*
match
)
{
SMatch
*
rMatch
=
match
;
// define return match
if
(
match
==
NULL
)
{
if
(
rMatch
==
NULL
)
{
return
;
rMatch
=
(
SMatch
*
)
taosMemoryMalloc
(
sizeof
(
SMatch
));
memset
(
rMatch
,
0
,
sizeof
(
SMatch
));
}
}
switch
(
tire
->
type
)
{
switch
(
tire
->
type
)
{
case
TIRE_TREE
:
case
TIRE_TREE
:
matchPrefixFromTree
(
tire
,
prefix
,
rM
atch
);
matchPrefixFromTree
(
tire
,
prefix
,
m
atch
);
break
;
break
;
case
TIRE_LIST
:
case
TIRE_LIST
:
matchPrefixFromList
(
tire
,
prefix
,
rM
atch
);
matchPrefixFromList
(
tire
,
prefix
,
m
atch
);
break
;
break
;
default:
default:
break
;
break
;
}
}
return
rMatch
;
}
}
// get all items from tires tree
// get all items from tires tree
...
@@ -360,10 +356,11 @@ void enumFromTree(STire* tire, SMatch* match) {
...
@@ -360,10 +356,11 @@ void enumFromTree(STire* tire, SMatch* match) {
}
}
// this branch have data
// this branch have data
if
(
c
->
end
)
if
(
c
->
end
)
{
addWordToMatch
(
match
,
pre
);
addWordToMatch
(
match
,
pre
);
else
}
else
{
matchPrefix
(
tire
,
pre
,
match
);
matchPrefix
(
tire
,
pre
,
match
);
}
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录