Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
392d3df9
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看板
提交
392d3df9
编写于
2月 22, 2022
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
config
上级
18634533
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
62 addition
and
42 deletion
+62
-42
include/libs/config/config.h
include/libs/config/config.h
+4
-2
include/os/osDir.h
include/os/osDir.h
+1
-1
include/os/osSocket.h
include/os/osSocket.h
+1
-1
source/libs/config/inc/cfgInt.h
source/libs/config/inc/cfgInt.h
+1
-0
source/libs/config/src/config.c
source/libs/config/src/config.c
+35
-19
source/libs/config/test/cfgTest.cpp
source/libs/config/test/cfgTest.cpp
+16
-15
source/os/src/osDir.c
source/os/src/osDir.c
+1
-1
source/os/src/osSocket.c
source/os/src/osSocket.c
+2
-2
source/util/src/tlog.c
source/util/src/tlog.c
+1
-1
未找到文件。
include/libs/config/config.h
浏览文件 @
392d3df9
...
...
@@ -23,6 +23,8 @@
extern
"C"
{
#endif
#define CFG_NAME_MAX_LEN 128
typedef
enum
{
CFG_STYPE_DEFAULT
,
CFG_STYPE_CFG_FILE
,
...
...
@@ -48,12 +50,12 @@ typedef enum {
typedef
enum
{
CFG_UTYPE_NONE
,
CFG_UTYPE_PERCENT
,
CFG_UTYPE_GB
,
CFG_UTYPE_MB
,
CFG_UTYPE_BYTE
,
CFG_UTYPE_SECOND
,
CFG_UTYPE_MS
CFG_UTYPE_MS
,
CFG_UTYPE_PERCENT
}
ECfgUnitType
;
typedef
struct
SConfigItem
{
...
...
include/os/osDir.h
浏览文件 @
392d3df9
...
...
@@ -24,7 +24,7 @@ void taosRemoveDir(const char *dirname);
int32_t
taosDirExist
(
char
*
dirname
);
int32_t
taosMkDir
(
const
char
*
dirname
);
void
taosRemoveOldFiles
(
char
*
dirname
,
int32_t
keepDays
);
int32_t
taosExpandDir
(
char
*
dirname
,
char
*
outname
,
int32_t
maxlen
);
int32_t
taosExpandDir
(
c
onst
c
har
*
dirname
,
char
*
outname
,
int32_t
maxlen
);
int32_t
taosRealPath
(
char
*
dirname
,
int32_t
maxlen
);
#ifdef __cplusplus
...
...
include/os/osSocket.h
浏览文件 @
392d3df9
...
...
@@ -55,7 +55,7 @@ void taosSetMaskSIGPIPE();
int32_t
taosSetSockOpt
(
SOCKET
socketfd
,
int32_t
level
,
int32_t
optname
,
void
*
optval
,
int32_t
optlen
);
int32_t
taosGetSockOpt
(
SOCKET
socketfd
,
int32_t
level
,
int32_t
optname
,
void
*
optval
,
int32_t
*
optlen
);
uint32_t
taosInetAddr
(
char
*
ipAddr
);
uint32_t
taosInetAddr
(
c
onst
c
har
*
ipAddr
);
const
char
*
taosInetNtoa
(
struct
in_addr
ipInt
);
#if (defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32))
...
...
source/libs/config/inc/cfgInt.h
浏览文件 @
392d3df9
...
...
@@ -20,6 +20,7 @@
#include "config.h"
#include "taoserror.h"
#include "thash.h"
#include "tutil.h"
#include "ulog.h"
#ifdef __cplusplus
...
...
source/libs/config/src/config.c
浏览文件 @
392d3df9
...
...
@@ -64,8 +64,7 @@ SConfigItem *cfgIterate(SConfig *pConfig, SConfigItem *pIter) { return taosHashI
void
cfgCancelIterate
(
SConfig
*
pConfig
,
SConfigItem
*
pIter
)
{
return
taosHashCancelIterate
(
pConfig
->
hash
,
pIter
);
}
int32_t
cfgSetBool
(
SConfigItem
*
pItem
,
const
char
*
value
,
ECfgSrcType
stype
)
{
static
int32_t
cfgSetBool
(
SConfigItem
*
pItem
,
const
char
*
value
,
ECfgSrcType
stype
)
{
bool
tmp
=
false
;
if
(
strcasecmp
(
value
,
"true"
)
==
0
)
{
tmp
=
true
;
...
...
@@ -73,12 +72,13 @@ int32_t cfgSetBool(SConfigItem *pItem, const char *value, ECfgSrcType stype) {
if
(
atoi
(
value
)
>
0
)
{
tmp
=
true
;
}
pItem
->
boolVal
=
tmp
;
pItem
->
stype
=
stype
;
return
0
;
}
int32_t
cfgSetInt8
(
SConfigItem
*
pItem
,
const
char
*
value
,
ECfgSrcType
stype
)
{
static
int32_t
cfgSetInt8
(
SConfigItem
*
pItem
,
const
char
*
value
,
ECfgSrcType
stype
)
{
int8_t
ival
=
(
int8_t
)
atoi
(
value
);
if
(
ival
<
pItem
->
minIntVal
||
ival
>
pItem
->
maxIntVal
)
{
uError
(
"cfg:%s, type:%s src:%s value:%d out of range[%"
PRId64
", %"
PRId64
"], use last src:%s value:%d"
,
...
...
@@ -87,12 +87,13 @@ int32_t cfgSetInt8(SConfigItem *pItem, const char *value, ECfgSrcType stype) {
terrno
=
TSDB_CODE_OUT_OF_RANGE
;
return
-
1
;
}
pItem
->
int8Val
=
ival
;
pItem
->
stype
=
stype
;
return
0
;
}
int32_t
cfgSetUInt16
(
SConfigItem
*
pItem
,
const
char
*
value
,
ECfgSrcType
stype
)
{
static
int32_t
cfgSetUInt16
(
SConfigItem
*
pItem
,
const
char
*
value
,
ECfgSrcType
stype
)
{
uint16_t
ival
=
(
uint16_t
)
atoi
(
value
);
if
(
ival
<
pItem
->
minIntVal
||
ival
>
pItem
->
maxIntVal
)
{
uError
(
"cfg:%s, type:%s src:%s value:%d out of range[%"
PRId64
", %"
PRId64
"], use last src:%s value:%d"
,
...
...
@@ -101,12 +102,13 @@ int32_t cfgSetUInt16(SConfigItem *pItem, const char *value, ECfgSrcType stype) {
terrno
=
TSDB_CODE_OUT_OF_RANGE
;
return
-
1
;
}
pItem
->
uint16Val
=
ival
;
pItem
->
stype
=
stype
;
return
0
;
}
int32_t
cfgSetInt32
(
SConfigItem
*
pItem
,
const
char
*
value
,
ECfgSrcType
stype
)
{
static
int32_t
cfgSetInt32
(
SConfigItem
*
pItem
,
const
char
*
value
,
ECfgSrcType
stype
)
{
int32_t
ival
=
(
int32_t
)
atoi
(
value
);
if
(
ival
<
pItem
->
minIntVal
||
ival
>
pItem
->
maxIntVal
)
{
uError
(
"cfg:%s, type:%s src:%s value:%d out of range[%"
PRId64
", %"
PRId64
"], use last src:%s value:%d"
,
...
...
@@ -115,26 +117,29 @@ int32_t cfgSetInt32(SConfigItem *pItem, const char *value, ECfgSrcType stype) {
terrno
=
TSDB_CODE_OUT_OF_RANGE
;
return
-
1
;
}
pItem
->
int32Val
=
ival
;
pItem
->
stype
=
stype
;
return
0
;
}
int32_t
cfgSetInt64
(
SConfigItem
*
pItem
,
const
char
*
value
,
ECfgSrcType
stype
)
{
static
int32_t
cfgSetInt64
(
SConfigItem
*
pItem
,
const
char
*
value
,
ECfgSrcType
stype
)
{
int64_t
ival
=
(
int64_t
)
atoi
(
value
);
if
(
ival
<
pItem
->
minIntVal
||
ival
>
pItem
->
maxIntVal
)
{
uError
(
"cfg:%s, type:%s src:%s value:%d out of range[%"
PRId64
", %"
PRId64
"], use last src:%s value:%d"
,
uError
(
"cfg:%s, type:%s src:%s value:%"
PRId64
" out of range[%"
PRId64
", %"
PRId64
"], use last src:%s value:%"
PRId64
,
pItem
->
name
,
cfgDtypeStr
(
pItem
->
dtype
),
cfgStypeStr
(
stype
),
ival
,
pItem
->
minIntVal
,
pItem
->
maxIntVal
,
cfgStypeStr
(
pItem
->
stype
),
pItem
->
int64Val
);
terrno
=
TSDB_CODE_OUT_OF_RANGE
;
return
-
1
;
}
pItem
->
int64Val
=
ival
;
pItem
->
stype
=
stype
;
return
0
;
}
int32_t
cfgSetFloat
(
SConfigItem
*
pItem
,
const
char
*
value
,
ECfgSrcType
stype
)
{
static
int32_t
cfgSetFloat
(
SConfigItem
*
pItem
,
const
char
*
value
,
ECfgSrcType
stype
)
{
float
fval
=
(
float
)
atof
(
value
);
if
(
fval
<
pItem
->
minFloatVal
||
fval
>
pItem
->
maxFloatVal
)
{
uError
(
"cfg:%s, type:%s src:%s value:%f out of range[%f, %f], use last src:%s value:%f"
,
pItem
->
name
,
...
...
@@ -143,47 +148,51 @@ int32_t cfgSetFloat(SConfigItem *pItem, const char *value, ECfgSrcType stype) {
terrno
=
TSDB_CODE_OUT_OF_RANGE
;
return
-
1
;
}
pItem
->
floatVal
=
fval
;
pItem
->
stype
=
stype
;
return
0
;
}
int32_t
cfgSetString
(
SConfigItem
*
pItem
,
const
char
*
value
,
ECfgSrcType
stype
)
{
static
int32_t
cfgSetString
(
SConfigItem
*
pItem
,
const
char
*
value
,
ECfgSrcType
stype
)
{
char
*
tmp
=
strdup
(
value
);
if
(
tmp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
uError
(
"cfg:%s, type:%s src:%s value:%s failed to dup since %s, use last src:%s value:%s"
,
pItem
->
name
,
cfgDtypeStr
(
pItem
->
dtype
),
cfgStypeStr
(
stype
),
terrstr
(),
cfgStypeStr
(
pItem
->
stype
),
pItem
->
float
Val
);
cfgDtypeStr
(
pItem
->
dtype
),
cfgStypeStr
(
stype
),
value
,
terrstr
(),
cfgStypeStr
(
pItem
->
stype
),
pItem
->
str
Val
);
return
-
1
;
}
free
(
pItem
->
strVal
);
pItem
->
strVal
=
tmp
;
pItem
->
stype
=
stype
;
return
0
;
}
int32_t
cfgSetIpStr
(
SConfigItem
*
pItem
,
const
char
*
value
,
ECfgSrcType
stype
)
{
static
int32_t
cfgSetIpStr
(
SConfigItem
*
pItem
,
const
char
*
value
,
ECfgSrcType
stype
)
{
char
*
tmp
=
strdup
(
value
);
if
(
tmp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
uError
(
"cfg:%s, type:%s src:%s value:%s failed to dup since %s, use last src:%s value:%s"
,
pItem
->
name
,
cfgDtypeStr
(
pItem
->
dtype
),
cfgStypeStr
(
stype
),
terrstr
(),
cfgStypeStr
(
pItem
->
stype
),
pItem
->
float
Val
);
cfgDtypeStr
(
pItem
->
dtype
),
cfgStypeStr
(
stype
),
value
,
terrstr
(),
cfgStypeStr
(
pItem
->
stype
),
pItem
->
str
Val
);
return
-
1
;
}
free
(
pItem
->
strVal
);
pItem
->
strVal
=
tmp
;
pItem
->
stype
=
stype
;
return
0
;
}
int32_t
cfgSetDir
(
SConfigItem
*
pItem
,
const
char
*
value
,
ECfgSrcType
stype
)
{
static
int32_t
cfgSetDir
(
SConfigItem
*
pItem
,
const
char
*
value
,
ECfgSrcType
stype
)
{
char
*
tmp
=
strdup
(
value
);
if
(
tmp
==
NULL
)
{
terrno
=
TSDB_CODE_OUT_OF_MEMORY
;
uError
(
"cfg:%s, type:%s src:%s value:%s failed to dup since %s, use last src:%s value:%s"
,
pItem
->
name
,
cfgDtypeStr
(
pItem
->
dtype
),
cfgStypeStr
(
stype
),
terrstr
(),
cfgStypeStr
(
pItem
->
stype
),
pItem
->
float
Val
);
cfgDtypeStr
(
pItem
->
dtype
),
cfgStypeStr
(
stype
),
value
,
terrstr
(),
cfgStypeStr
(
pItem
->
stype
),
pItem
->
str
Val
);
return
-
1
;
}
free
(
pItem
->
strVal
);
pItem
->
strVal
=
tmp
;
pItem
->
stype
=
stype
;
...
...
@@ -214,7 +223,7 @@ int32_t cfgSetItem(SConfig *pConfig, const char *name, const char *value, ECfgSr
case
CFG_DTYPE_IPSTR
:
return
cfgSetIpStr
(
pItem
,
value
,
stype
);
case
CFG_DTYPE_DIR
:
return
cfgSet
Fqdn
(
pItem
,
value
,
stype
);
return
cfgSet
Dir
(
pItem
,
value
,
stype
);
case
CFG_DTYPE_NONE
:
default:
break
;
...
...
@@ -225,8 +234,9 @@ int32_t cfgSetItem(SConfig *pConfig, const char *name, const char *value, ECfgSr
}
SConfigItem
*
cfgGetItem
(
SConfig
*
pConfig
,
const
char
*
name
)
{
char
lowcaseName
[
128
]
=
0
;
memcpy
(
lowcaseName
,
name
,
127
);
char
lowcaseName
[
CFG_NAME_MAX_LEN
+
1
]
=
{
0
};
memcpy
(
lowcaseName
,
name
,
CFG_NAME_MAX_LEN
);
strntolower
(
lowcaseName
,
name
,
CFG_NAME_MAX_LEN
);
SConfigItem
*
pItem
=
taosHashGet
(
pConfig
->
hash
,
lowcaseName
,
strlen
(
lowcaseName
)
+
1
);
if
(
pItem
==
NULL
)
{
...
...
@@ -245,8 +255,10 @@ static int32_t cfgAddItem(SConfig *pConfig, SConfigItem *pItem, const char *name
return
-
1
;
}
char
lowcaseName
[
128
]
=
0
;
memcpy
(
lowcaseName
,
name
,
127
);
char
lowcaseName
[
CFG_NAME_MAX_LEN
+
1
]
=
{
0
};
memcpy
(
lowcaseName
,
name
,
CFG_NAME_MAX_LEN
);
strntolower
(
lowcaseName
,
name
,
CFG_NAME_MAX_LEN
);
if
(
taosHashPut
(
pConfig
->
hash
,
lowcaseName
,
strlen
(
lowcaseName
)
+
1
,
pItem
,
sizeof
(
SConfigItem
))
!=
0
)
{
if
(
pItem
->
dtype
==
CFG_DTYPE_STRING
)
{
free
(
pItem
->
strVal
);
...
...
@@ -412,6 +424,10 @@ const char *cfgStypeStr(ECfgSrcType type) {
return
"env_var"
;
case
CFG_STYPE_APOLLO_URL
:
return
"apollo_url"
;
case
CFG_STYPE_ARG_LIST
:
return
"arg_list"
;
case
CFG_STYPE_API_OPTION
:
return
"api_option"
;
default:
return
"invalid"
;
}
...
...
source/libs/config/test/cfgTest.cpp
浏览文件 @
392d3df9
...
...
@@ -34,12 +34,13 @@ TEST_F(CfgTest, 02_Str) {
EXPECT_STREQ
(
cfgStypeStr
(
CFG_STYPE_ENV_FILE
),
"env_file"
);
EXPECT_STREQ
(
cfgStypeStr
(
CFG_STYPE_ENV_VAR
),
"env_var"
);
EXPECT_STREQ
(
cfgStypeStr
(
CFG_STYPE_APOLLO_URL
),
"apollo_url"
);
EXPECT_STREQ
(
cfgStypeStr
(
CFG_STYPE_ARG_LIST
),
"arg_list"
);
EXPECT_STREQ
(
cfgStypeStr
(
CFG_STYPE_API_OPTION
),
"api_option"
);
EXPECT_STREQ
(
cfgStypeStr
(
ECfgSrcType
(
1024
)),
"invalid"
);
EXPECT_STREQ
(
cfgDtypeStr
(
CFG_DTYPE_NONE
),
"none"
);
EXPECT_STREQ
(
cfgDtypeStr
(
CFG_DTYPE_BOOL
),
"bool"
);
EXPECT_STREQ
(
cfgDtypeStr
(
CFG_DTYPE_INT8
),
"int8"
);
EXPECT_STREQ
(
cfgDtypeStr
(
CFG_DTYPE_UINT16
),
"uint16"
);
EXPECT_STREQ
(
cfgDtypeStr
(
CFG_DTYPE_INT32
),
"int32"
);
EXPECT_STREQ
(
cfgDtypeStr
(
CFG_DTYPE_INT64
),
"int64"
);
...
...
@@ -50,12 +51,12 @@ TEST_F(CfgTest, 02_Str) {
EXPECT_STREQ
(
cfgDtypeStr
(
ECfgDataType
(
1024
)),
"invalid"
);
EXPECT_STREQ
(
cfgUtypeStr
(
CFG_UTYPE_NONE
),
""
);
EXPECT_STREQ
(
cfgUtypeStr
(
CFG_UTYPE_PERCENT
),
"(%)"
);
EXPECT_STREQ
(
cfgUtypeStr
(
CFG_UTYPE_GB
),
"(GB)"
);
EXPECT_STREQ
(
cfgUtypeStr
(
CFG_UTYPE_MB
),
"(Mb)"
);
EXPECT_STREQ
(
cfgUtypeStr
(
CFG_UTYPE_BYTE
),
"(byte)"
);
EXPECT_STREQ
(
cfgUtypeStr
(
CFG_UTYPE_SECOND
),
"(s)"
);
EXPECT_STREQ
(
cfgUtypeStr
(
CFG_UTYPE_MS
),
"(ms)"
);
EXPECT_STREQ
(
cfgUtypeStr
(
CFG_UTYPE_PERCENT
),
"(%)"
);
EXPECT_STREQ
(
cfgUtypeStr
(
ECfgUnitType
(
1024
)),
"invalid"
);
}
...
...
@@ -64,11 +65,11 @@ TEST_F(CfgTest, 02_Basic) {
ASSERT_NE
(
pConfig
,
nullptr
);
EXPECT_EQ
(
cfgAddBool
(
pConfig
,
"test_bool"
,
0
,
CFG_UTYPE_NONE
),
0
);
EXPECT_EQ
(
cfgAddInt8
(
pConfig
,
"test_int8"
,
1
,
CFG_UTYPE_GB
),
0
);
EXPECT_EQ
(
cfgAddUInt16
(
pConfig
,
"test_uint16"
,
2
,
CFG_UTYPE_SECOND
),
0
);
EXPECT_EQ
(
cfgAddInt32
(
pConfig
,
"test_int32"
,
3
,
CFG_UTYPE_MS
),
0
);
EXPECT_EQ
(
cfgAddInt64
(
pConfig
,
"test_int64"
,
4
,
CFG_UTYPE_NONE
),
0
);
EXPECT_EQ
(
cfgAddFloat
(
pConfig
,
"test_float"
,
5
,
CFG_UTYPE_NONE
),
0
);
EXPECT_EQ
(
cfgAddInt8
(
pConfig
,
"test_int8"
,
1
,
0
,
16
,
CFG_UTYPE_GB
),
0
);
EXPECT_EQ
(
cfgAddUInt16
(
pConfig
,
"test_uint16"
,
2
,
0
,
16
,
CFG_UTYPE_MB
),
0
);
EXPECT_EQ
(
cfgAddInt32
(
pConfig
,
"test_int32"
,
3
,
0
,
16
,
CFG_UTYPE_BYTE
),
0
);
EXPECT_EQ
(
cfgAddInt64
(
pConfig
,
"test_int64"
,
4
,
0
,
16
,
CFG_UTYPE_SECOND
),
0
);
EXPECT_EQ
(
cfgAddFloat
(
pConfig
,
"test_float"
,
5
,
0
,
16
,
CFG_UTYPE_MS
),
0
);
EXPECT_EQ
(
cfgAddString
(
pConfig
,
"test_string"
,
"6"
,
CFG_UTYPE_NONE
),
0
);
EXPECT_EQ
(
cfgAddIpStr
(
pConfig
,
"test_ipstr"
,
"192.168.0.1"
,
CFG_UTYPE_NONE
),
0
);
EXPECT_EQ
(
cfgAddDir
(
pConfig
,
"test_dir"
,
"/tmp"
,
CFG_UTYPE_NONE
),
0
);
...
...
@@ -83,16 +84,16 @@ TEST_F(CfgTest, 02_Basic) {
printf
(
"index:%d, cfg:%s value:%d
\n
"
,
size
,
pItem
->
name
,
pItem
->
boolVal
);
break
;
case
CFG_DTYPE_INT8
:
printf
(
"index:%d, cfg:%s value:%d
\n
"
,
size
,
pItem
->
name
,
pItem
->
u
int8Val
);
printf
(
"index:%d, cfg:%s value:%d
\n
"
,
size
,
pItem
->
name
,
pItem
->
int8Val
);
break
;
case
CFG_DTYPE_UINT16
:
printf
(
"index:%d, cfg:%s value:%d
\n
"
,
size
,
pItem
->
name
,
pItem
->
int16Val
);
printf
(
"index:%d, cfg:%s value:%d
\n
"
,
size
,
pItem
->
name
,
pItem
->
u
int16Val
);
break
;
case
CFG_DTYPE_INT32
:
printf
(
"index:%d, cfg:%s value:%d
\n
"
,
size
,
pItem
->
name
,
pItem
->
u
int32Val
);
printf
(
"index:%d, cfg:%s value:%d
\n
"
,
size
,
pItem
->
name
,
pItem
->
int32Val
);
break
;
case
CFG_DTYPE_INT64
:
printf
(
"index:%d, cfg:%s value:%"
PRI
u64
"
\n
"
,
size
,
pItem
->
name
,
pItem
->
u
int64Val
);
printf
(
"index:%d, cfg:%s value:%"
PRI
d64
"
\n
"
,
size
,
pItem
->
name
,
pItem
->
int64Val
);
break
;
case
CFG_DTYPE_FLOAT
:
printf
(
"index:%d, cfg:%s value:%f
\n
"
,
size
,
pItem
->
name
,
pItem
->
floatVal
);
...
...
@@ -133,28 +134,28 @@ TEST_F(CfgTest, 02_Basic) {
pItem
=
cfgGetItem
(
pConfig
,
"test_uint16"
);
EXPECT_EQ
(
pItem
->
stype
,
CFG_STYPE_DEFAULT
);
EXPECT_EQ
(
pItem
->
utype
,
CFG_UTYPE_
SECOND
);
EXPECT_EQ
(
pItem
->
utype
,
CFG_UTYPE_
MB
);
EXPECT_EQ
(
pItem
->
dtype
,
CFG_DTYPE_UINT16
);
EXPECT_STREQ
(
pItem
->
name
,
"test_uint16"
);
EXPECT_EQ
(
pItem
->
uint16Val
,
2
);
pItem
=
cfgGetItem
(
pConfig
,
"test_int32"
);
EXPECT_EQ
(
pItem
->
stype
,
CFG_STYPE_DEFAULT
);
EXPECT_EQ
(
pItem
->
utype
,
CFG_UTYPE_
MS
);
EXPECT_EQ
(
pItem
->
utype
,
CFG_UTYPE_
BYTE
);
EXPECT_EQ
(
pItem
->
dtype
,
CFG_DTYPE_INT32
);
EXPECT_STREQ
(
pItem
->
name
,
"test_int32"
);
EXPECT_EQ
(
pItem
->
int32Val
,
3
);
pItem
=
cfgGetItem
(
pConfig
,
"test_int64"
);
EXPECT_EQ
(
pItem
->
stype
,
CFG_STYPE_DEFAULT
);
EXPECT_EQ
(
pItem
->
utype
,
CFG_UTYPE_
NONE
);
EXPECT_EQ
(
pItem
->
utype
,
CFG_UTYPE_
SECOND
);
EXPECT_EQ
(
pItem
->
dtype
,
CFG_DTYPE_INT64
);
EXPECT_STREQ
(
pItem
->
name
,
"test_int64"
);
EXPECT_EQ
(
pItem
->
int64Val
,
4
);
pItem
=
cfgGetItem
(
pConfig
,
"test_float"
);
EXPECT_EQ
(
pItem
->
stype
,
CFG_STYPE_DEFAULT
);
EXPECT_EQ
(
pItem
->
utype
,
CFG_UTYPE_
NONE
);
EXPECT_EQ
(
pItem
->
utype
,
CFG_UTYPE_
MS
);
EXPECT_EQ
(
pItem
->
dtype
,
CFG_DTYPE_FLOAT
);
EXPECT_STREQ
(
pItem
->
name
,
"test_float"
);
EXPECT_EQ
(
pItem
->
floatVal
,
5
);
...
...
source/os/src/osDir.c
浏览文件 @
392d3df9
...
...
@@ -114,7 +114,7 @@ void taosRemoveOldFiles(char *dirname, int32_t keepDays) {
rmdir
(
dirname
);
}
int32_t
taosExpandDir
(
char
*
dirname
,
char
*
outname
,
int32_t
maxlen
)
{
int32_t
taosExpandDir
(
c
onst
c
har
*
dirname
,
char
*
outname
,
int32_t
maxlen
)
{
wordexp_t
full_path
;
if
(
0
!=
wordexp
(
dirname
,
&
full_path
,
0
))
{
//printf("failed to expand path:%s since %s", dirname, strerror(errno));
...
...
source/os/src/osSocket.c
浏览文件 @
392d3df9
...
...
@@ -150,7 +150,7 @@ int32_t taosGetSockOpt(SOCKET socketfd, int32_t level, int32_t optname, void *op
#if !((defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)) && defined(_MSC_VER))
uint32_t
taosInetAddr
(
char
*
ipAddr
)
{
return
inet_addr
(
ipAddr
);
}
uint32_t
taosInetAddr
(
c
onst
c
har
*
ipAddr
)
{
return
inet_addr
(
ipAddr
);
}
const
char
*
taosInetNtoa
(
struct
in_addr
ipInt
)
{
return
inet_ntoa
(
ipInt
);
}
...
...
@@ -240,7 +240,7 @@ int32_t taosSetSockOpt(SOCKET socketfd, int32_t level, int32_t optname, void *op
#ifdef _MSC_VER
//#if _MSC_VER >= 1900
uint32_t
taosInetAddr
(
char
*
ipAddr
)
{
uint32_t
taosInetAddr
(
c
onst
c
har
*
ipAddr
)
{
uint32_t
value
;
int32_t
ret
=
inet_pton
(
AF_INET
,
ipAddr
,
&
value
);
if
(
ret
<=
0
)
{
...
...
source/util/src/tlog.c
浏览文件 @
392d3df9
...
...
@@ -217,7 +217,7 @@ static void *taosThreadToOpenNewFile(void *param) {
uInfo
(
" new log file:%d is opened"
,
tsLogObj
.
flag
);
uInfo
(
"=================================="
);
taosPrintCfg
();
//
taosPrintCfg();
taosKeepOldLog
(
keepName
);
return
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录