Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
720c16bf
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看板
提交
720c16bf
编写于
10月 19, 2022
作者:
A
Alex Duan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(shell): coverity problem for some
上级
c58daa70
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
27 addition
and
26 deletion
+27
-26
source/util/src/tconfig.c
source/util/src/tconfig.c
+2
-0
tools/shell/src/shellAuto.c
tools/shell/src/shellAuto.c
+6
-14
tools/shell/src/shellCommand.c
tools/shell/src/shellCommand.c
+8
-0
tools/shell/src/shellTire.c
tools/shell/src/shellTire.c
+11
-12
未找到文件。
source/util/src/tconfig.c
浏览文件 @
720c16bf
...
...
@@ -944,6 +944,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) {
if
(
taosReadFile
(
pFile
,
buf
,
fileSize
)
<=
0
)
{
taosCloseFile
(
&
pFile
);
uError
(
"load json file error: %s"
,
filepath
);
taosMemoryFreeClear
(
buf
);
return
-
1
;
}
taosCloseFile
(
&
pFile
);
...
...
@@ -953,6 +954,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) {
if
(
jsonParseError
!=
NULL
)
{
uError
(
"load json file parse error: %s"
,
jsonParseError
);
}
taosMemoryFreeClear
(
buf
);
return
-
1
;
}
taosMemoryFreeClear
(
buf
);
...
...
tools/shell/src/shellAuto.c
浏览文件 @
720c16bf
...
...
@@ -562,23 +562,15 @@ void parseCommand(SWords* command, bool pattern) {
// free SShellCmd
void
freeCommand
(
SWords
*
command
)
{
SWord
*
word
=
command
->
head
;
if
(
word
==
NULL
)
{
return
;
}
SWord
*
item
=
command
->
head
;
// loop
while
(
word
->
next
)
{
SWord
*
tmp
=
word
;
word
=
word
->
next
;
while
(
item
)
{
SWord
*
tmp
=
item
;
item
=
item
->
next
;
// if malloc need free
if
(
tmp
->
free
&&
tmp
->
word
)
taosMemoryFree
(
tmp
->
word
);
taosMemoryFree
(
tmp
);
}
// if malloc need free
if
(
word
->
free
&&
word
->
word
)
taosMemoryFree
(
word
->
word
);
taosMemoryFree
(
word
);
}
void
GenerateVarType
(
int
type
,
char
**
p
,
int
count
)
{
...
...
@@ -1204,11 +1196,11 @@ bool nextMatchCommand(TAOS* con, SShellCmd* cmd, SWords* firstMatch) {
#endif
// free
freeCommand
(
input
);
if
(
input
->
source
)
{
taosMemoryFree
(
input
->
source
);
input
->
source
=
NULL
;
}
freeCommand
(
input
);
taosMemoryFree
(
input
);
return
true
;
...
...
@@ -1377,7 +1369,7 @@ bool appendAfterSelect(TAOS* con, SShellCmd* cmd, char* sql, int32_t len) {
bool
ret
=
false
;
if
(
from
==
NULL
)
{
bool
fieldEnd
=
fieldsInputEnd
(
p
);
// che
e
ck fields input end then insert from keyword
// check fields input end then insert from keyword
if
(
fieldEnd
&&
p
[
len
-
1
]
==
' '
)
{
shellInsertChar
(
cmd
,
"from"
,
4
);
taosMemoryFree
(
p
);
...
...
tools/shell/src/shellCommand.c
浏览文件 @
720c16bf
...
...
@@ -103,6 +103,8 @@ void shellInsertChar(SShellCmd *cmd, char *c, int32_t size) {
cmd
->
cursorOffset
+=
size
;
cmd
->
screenOffset
+=
taosWcharWidth
(
wc
);
cmd
->
endOffset
+=
taosWcharWidth
(
wc
);
// set string end
cmd
->
command
[
cmd
->
commandSize
]
=
0
;
#ifdef WINDOWS
#else
shellShowOnScreen
(
cmd
);
...
...
@@ -123,6 +125,8 @@ void shellBackspaceChar(SShellCmd *cmd) {
cmd
->
cursorOffset
-=
size
;
cmd
->
screenOffset
-=
width
;
cmd
->
endOffset
-=
width
;
// set string end
cmd
->
command
[
cmd
->
commandSize
]
=
0
;
shellShowOnScreen
(
cmd
);
}
}
...
...
@@ -136,6 +140,8 @@ void shellClearLineBefore(SShellCmd *cmd) {
cmd
->
cursorOffset
=
0
;
cmd
->
screenOffset
=
0
;
cmd
->
endOffset
=
cmd
->
commandSize
;
// set string end
cmd
->
command
[
cmd
->
commandSize
]
=
0
;
shellShowOnScreen
(
cmd
);
}
...
...
@@ -160,6 +166,8 @@ void shellDeleteChar(SShellCmd *cmd) {
cmd
->
commandSize
-
cmd
->
cursorOffset
-
size
);
cmd
->
commandSize
-=
size
;
cmd
->
endOffset
-=
width
;
// set string end
cmd
->
command
[
cmd
->
commandSize
]
=
0
;
shellShowOnScreen
(
cmd
);
}
}
...
...
tools/shell/src/shellTire.c
浏览文件 @
720c16bf
...
...
@@ -309,27 +309,24 @@ void matchPrefixFromTree(STire* tire, char* prefix, SMatch* match) {
}
SMatch
*
matchPrefix
(
STire
*
tire
,
char
*
prefix
,
SMatch
*
match
)
{
if
(
match
==
NULL
)
{
match
=
(
SMatch
*
)
taosMemoryMalloc
(
sizeof
(
SMatch
));
memset
(
match
,
0
,
sizeof
(
SMatch
));
SMatch
*
rMatch
=
match
;
// define return match
if
(
rMatch
==
NULL
)
{
rMatch
=
(
SMatch
*
)
taosMemoryMalloc
(
sizeof
(
SMatch
));
memset
(
rMatch
,
0
,
sizeof
(
SMatch
));
}
switch
(
tire
->
type
)
{
case
TIRE_TREE
:
matchPrefixFromTree
(
tire
,
prefix
,
match
);
matchPrefixFromTree
(
tire
,
prefix
,
rMatch
);
break
;
case
TIRE_LIST
:
matchPrefixFromList
(
tire
,
prefix
,
match
);
matchPrefixFromList
(
tire
,
prefix
,
rMatch
);
break
;
default:
break
;
}
// return if need
if
(
match
->
count
==
0
)
{
freeMatch
(
match
);
match
=
NULL
;
}
return
match
;
return
rMatch
;
}
// get all items from tires tree
...
...
@@ -378,8 +375,10 @@ SMatch* enumAll(STire* tire) {
switch
(
tire
->
type
)
{
case
TIRE_TREE
:
enumFromTree
(
tire
,
match
);
break
;
case
TIRE_LIST
:
enumFromList
(
tire
,
match
);
break
;
default:
break
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录