Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6e01c527
T
TDengine
项目概览
taosdata
/
TDengine
12 个月 前同步成功
通知
1180
Star
22014
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6e01c527
编写于
10月 11, 2019
作者:
H
hjxilinx
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
supress some warnings from clang-tidy,valgrind etc.
上级
25ff54c9
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
113 addition
and
100 deletion
+113
-100
src/inc/sdb.h
src/inc/sdb.h
+1
-1
src/inc/tglobalcfg.h
src/inc/tglobalcfg.h
+13
-13
src/inc/tlog.h
src/inc/tlog.h
+5
-8
src/inc/trpc.h
src/inc/trpc.h
+0
-1
src/inc/ttimer.h
src/inc/ttimer.h
+1
-1
src/os/linux/inc/os.h
src/os/linux/inc/os.h
+10
-0
src/rpc/src/trpc.c
src/rpc/src/trpc.c
+1
-1
src/sdb/inc/sdbint.h
src/sdb/inc/sdbint.h
+0
-1
src/util/src/tcompression.c
src/util/src/tcompression.c
+19
-29
src/util/src/textbuffer.c
src/util/src/textbuffer.c
+6
-2
src/util/src/tglobalcfg.c
src/util/src/tglobalcfg.c
+10
-10
src/util/src/tlog.c
src/util/src/tlog.c
+1
-1
src/util/src/tskiplist.c
src/util/src/tskiplist.c
+0
-1
src/util/src/ttimer.c
src/util/src/ttimer.c
+3
-3
src/util/src/ttokenizer.c
src/util/src/ttokenizer.c
+5
-4
src/util/src/ttypes.c
src/util/src/ttypes.c
+28
-23
src/util/src/tutil.c
src/util/src/tutil.c
+10
-1
未找到文件。
src/inc/sdb.h
浏览文件 @
6e01c527
...
...
@@ -23,7 +23,7 @@ extern "C" {
#include "taosmsg.h"
#include "tsdb.h"
extern
in
t
sdbDebugFlag
;
extern
uint32_
t
sdbDebugFlag
;
extern
short
sdbPeerPort
;
extern
short
sdbSyncPort
;
extern
int
sdbMaxNodes
;
...
...
src/inc/tglobalcfg.h
浏览文件 @
6e01c527
...
...
@@ -146,19 +146,19 @@ extern char tsInternalPass[];
extern
int
tsMonitorInterval
;
extern
int
tsNumOfLogLines
;
extern
in
t
ddebugFlag
;
extern
in
t
mdebugFlag
;
extern
in
t
cdebugFlag
;
extern
in
t
jnidebugFlag
;
extern
in
t
tmrDebugFlag
;
extern
in
t
sdbDebugFlag
;
extern
in
t
httpDebugFlag
;
extern
in
t
monitorDebugFlag
;
extern
in
t
uDebugFlag
;
extern
in
t
rpcDebugFlag
;
extern
in
t
debugFlag
;
extern
in
t
odbcdebugFlag
;
extern
in
t
qdebugFlag
;
extern
uint32_
t
ddebugFlag
;
extern
uint32_
t
mdebugFlag
;
extern
uint32_
t
cdebugFlag
;
extern
uint32_
t
jnidebugFlag
;
extern
uint32_
t
tmrDebugFlag
;
extern
uint32_
t
sdbDebugFlag
;
extern
uint32_
t
httpDebugFlag
;
extern
uint32_
t
monitorDebugFlag
;
extern
uint32_
t
uDebugFlag
;
extern
uint32_
t
rpcDebugFlag
;
extern
uint32_
t
debugFlag
;
extern
uint32_
t
odbcdebugFlag
;
extern
uint32_
t
qdebugFlag
;
extern
int
tsRpcTimer
;
extern
int
tsRpcMaxTime
;
...
...
src/inc/tlog.h
浏览文件 @
6e01c527
...
...
@@ -25,16 +25,14 @@ extern "C" {
#include <string.h>
#include "tglobalcfg.h"
#define DEBUG_ERROR 1
#define DEBUG_WARN 2
#define DEBUG_TRACE 4
#define DEBUG_DUMP 8
#define DEBUG_ERROR 1
U
#define DEBUG_WARN 2
U
#define DEBUG_TRACE 4
U
#define DEBUG_DUMP 8
U
#define DEBUG_FILE 0x80
#define DEBUG_SCREEN 0x40
extern
int
uDebugFlag
;
extern
void
(
*
taosLogFp
)(
int
level
,
const
char
*
const
format
,
...);
extern
void
(
*
taosLogSqlFp
)(
char
*
sql
);
...
...
@@ -99,7 +97,7 @@ void taosResetLogFile();
{ tprintf("UTL ", tscEmbedded ? 255 : uDebugFlag, __VA_ARGS__); }
// client log function
extern
in
t
cdebugFlag
;
extern
uint32_
t
cdebugFlag
;
#define tscError(...) \
if (cdebugFlag & DEBUG_ERROR) { \
...
...
@@ -132,7 +130,6 @@ extern int cdebugFlag;
{ tprintf("JNI ", 255, __VA_ARGS__); }
// rpc log function
extern
int
rpcDebugFlag
;
#define tError(...) \
if (rpcDebugFlag & DEBUG_ERROR) { \
tprintf("ERROR RPC ", rpcDebugFlag, __VA_ARGS__); \
...
...
src/inc/trpc.h
浏览文件 @
6e01c527
...
...
@@ -73,7 +73,6 @@ typedef struct {
char
*
ckey
;
// ciphering key
}
SRpcConnInit
;
extern
int
rpcDebugFlag
;
extern
int
tsRpcHeadSize
;
void
*
taosOpenRpc
(
SRpcInit
*
pRpc
);
...
...
src/inc/ttimer.h
浏览文件 @
6e01c527
...
...
@@ -22,7 +22,7 @@ extern "C" {
typedef
void
*
tmr_h
;
extern
in
t
tmrDebugFlag
;
extern
uint32_
t
tmrDebugFlag
;
extern
int
taosTmrThreads
;
void
*
taosTmrInit
(
int
maxTmr
,
int
resoultion
,
int
longest
,
char
*
label
);
...
...
src/os/linux/inc/os.h
浏览文件 @
6e01c527
...
...
@@ -39,10 +39,13 @@
#include <sys/time.h>
#include <sys/uio.h>
#include <sys/un.h>
#include <sys/stat.h>
#include <stdint.h>
#include <pthread.h>
#include <stdbool.h>
#include <limits.h>
#include <linux/limits.h>
#include <strings.h>
#include <sys/sendfile.h>
bool
taosCheckPthreadValid
(
pthread_t
thread
);
...
...
@@ -65,4 +68,11 @@ void taosKillSystem();
bool
taosIsRunningWSLv1
();
int64_t
str2int64
(
char
*
str
);
#define BUILDIN_CLZL(val) __builtin_clzl(val)
#define BUILDIN_CLZ(val) __builtin_clz(val)
#define BUILDIN_CTZL(val) __builtin_ctzl(val)
#define BUILDIN_CTZ(val) __builtin_ctz(val)
#endif
\ No newline at end of file
src/rpc/src/trpc.c
浏览文件 @
6e01c527
...
...
@@ -116,7 +116,7 @@ typedef struct rpc_server {
}
STaosRpc
;
// configurable
in
t
rpcDebugFlag
=
131
;
uint32_
t
rpcDebugFlag
=
131
;
int
tsRpcTimer
=
300
;
int
tsRpcMaxTime
=
600
;
// seconds;
int
tsRpcProgressTime
=
10
;
// milliseocnds
...
...
src/sdb/inc/sdbint.h
浏览文件 @
6e01c527
...
...
@@ -136,7 +136,6 @@ typedef struct {
extern
SSdbTable
*
tableList
[];
extern
int
sdbMaxPeers
;
extern
int
sdbDebugFlag
;
extern
int
sdbNumOfTables
;
extern
int64_t
sdbVersion
;
...
...
src/util/src/tcompression.c
浏览文件 @
6e01c527
...
...
@@ -19,42 +19,31 @@
* To compress integers (including char, short, int, int64_t), the difference
* between two integers is calculated at first. Then the difference is
* transformed to positive by zig-zag encoding method
* (https://gist.github.com/mfuerstenau/ba870a29e16536fdbaba). Then the value
* is
* (https://gist.github.com/mfuerstenau/ba870a29e16536fdbaba). Then the value is
* encoded using simple 8B method. For more information about simple 8B,
* refer to https://en.wikipedia.org/wiki/8b/10b_encoding.
*
* NOTE : For bigint, only 59 bits can be used, which means data from -(2**59)
* to (2**59)-1
* NOTE : For bigint, only 59 bits can be used, which means data from -(2**59) to (2**59)-1
* are allowed.
*
* BOOLEAN Compression Algorithm:
* We provide two methods for compress boolean types. Because boolean types in
* C
* code are char bytes with 0 and 1 values only, only one bit can used to
* discrimenate
* We provide two methods for compress boolean types. Because boolean types in C
* code are char bytes with 0 and 1 values only, only one bit can used to discrimenate
* the values.
* 1. The first method is using only 1 bit to represent the boolean value with
* 1 for
* 1. The first method is using only 1 bit to represent the boolean value with 1 for
* true and 0 for false. Then the compression rate is 1/8.
* 2. The second method is using run length encoding (RLE) methods. This
* methos works
* 2. The second method is using run length encoding (RLE) methods. This methos works
* better when there are a lot of consecutive true values or false values.
*
* STRING Compression Algorithm:
* We us LZ4 method to compress the string type.
*
* FLOAT Compression Algorithm:
* We use the same method with Akumuli to compress float and double types. The
* compression
* algorithm assumes the float/double values change slightly. So we take the
* XOR between two
* adjacent values. Then compare the number of leading zeros and trailing
* zeros. If the number
* of leading zeros are larger than the trailing zeros, then record the last
* serveral bytes
* of the XORed value with informations. If not, record the first
* corresponding bytes.
* We use the same method with Akumuli to compress float and double types. The compression
* algorithm assumes the float/double values change slightly. So we take the XOR between two
* adjacent values. Then compare the number of leading zeros and trailing zeros. If the number
* of leading zeros are larger than the trailing zeros, then record the last serveral bytes
* of the XORed value with informations. If not, record the first corresponding bytes.
*
*/
#include <assert.h>
...
...
@@ -64,6 +53,7 @@
#include <stdlib.h>
#include <string.h>
#include "os.h"
#include "lz4.h"
#include "tscompression.h"
#include "tsdb.h"
...
...
@@ -368,7 +358,7 @@ int tsCompressINTImp(const char *const input, const int nelements, char *const o
// Take care here, __builtin_clzl give wrong anser for value 0;
tmp_bit
=
0
;
}
else
{
tmp_bit
=
(
LONG_BYTES
*
BITS_PER_BYTE
)
-
__builtin_clzl
(
zigzag_value
);
tmp_bit
=
(
LONG_BYTES
*
BITS_PER_BYTE
)
-
BUILDIN_CLZL
(
zigzag_value
);
}
if
(
elems
+
1
<=
selector_to_elems
[
selector
]
&&
elems
+
1
<=
selector_to_elems
[
bit_to_selector
[
tmp_bit
]])
{
...
...
@@ -695,14 +685,14 @@ int tsCompressTimestampImp(const char *const input, const int nelements, char *c
if
(
dd1
==
0
)
{
flag1
=
0
;
}
else
{
flag1
=
LONG_BYTES
-
__builtin_clzl
(
dd1
)
/
BITS_PER_BYTE
;
flag1
=
LONG_BYTES
-
BUILDIN_CLZL
(
dd1
)
/
BITS_PER_BYTE
;
}
}
else
{
dd2
=
zigzag_value
;
if
(
dd2
==
0
)
{
flag2
=
0
;
}
else
{
flag2
=
LONG_BYTES
-
__builtin_clzl
(
dd2
)
/
BITS_PER_BYTE
;
flag2
=
LONG_BYTES
-
BUILDIN_CLZL
(
dd2
)
/
BITS_PER_BYTE
;
}
flags
=
flag1
|
(
flag2
<<
4
);
// Encode the flag.
...
...
@@ -869,8 +859,8 @@ int tsCompressDoubleImp(const char *const input, const int nelements, char *cons
int
trailing_zeros
=
leading_zeros
;
if
(
diff
)
{
trailing_zeros
=
__builtin_ctzl
(
diff
);
leading_zeros
=
__builtin_clzl
(
diff
);
trailing_zeros
=
BUILDIN_CTZL
(
diff
);
leading_zeros
=
BUILDIN_CLZL
(
diff
);
}
uint8_t
nbytes
=
0
;
...
...
@@ -1016,8 +1006,8 @@ int tsCompressFloatImp(const char *const input, const int nelements, char *const
int
trailing_zeros
=
leading_zeros
;
if
(
diff
)
{
trailing_zeros
=
__builtin_ctz
(
diff
);
leading_zeros
=
__builtin_clz
(
diff
);
trailing_zeros
=
BUILDIN_CTZ
(
diff
);
leading_zeros
=
BUILDIN_CLZ
(
diff
);
}
uint8_t
nbytes
=
0
;
...
...
src/util/src/textbuffer.c
浏览文件 @
6e01c527
...
...
@@ -1178,7 +1178,9 @@ void tColDataQSort(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t sta
while
(
right
>
end_same
&&
left
<=
end_same
)
{
swap
(
pDescriptor
,
numOfRows
,
left
++
,
data
,
right
--
);
}
rightx
+=
(
end
-
end_same
);
// (pivotal+1) + steps of number that are identical pivotal
// (pivotal+1) + steps of number that are identical pivotal
rightx
+=
(
end
-
end_same
);
#ifdef _DEBUG_VIEW
tRowModelDisplay
(
pDescriptor
,
numOfRows
,
data
,
end
-
start
+
1
);
...
...
@@ -1193,7 +1195,9 @@ void tColDataQSort(tOrderDescriptor *pDescriptor, int32_t numOfRows, int32_t sta
while
(
left
<
start_same
&&
right
>=
start_same
)
{
swap
(
pDescriptor
,
numOfRows
,
left
++
,
data
,
right
--
);
}
leftx
-=
(
start_same
-
start
);
// (pivotal-1) - steps of number that are identical pivotal
// (pivotal-1) - steps of number that are identical pivotal
leftx
-=
(
start_same
-
start
);
#ifdef _DEBUG_VIEW
tRowModelDisplay
(
pDescriptor
,
numOfRows
,
data
,
end
-
start
+
1
);
...
...
src/util/src/tglobalcfg.c
浏览文件 @
6e01c527
...
...
@@ -140,16 +140,16 @@ char tsLocale[TSDB_LOCALE_LEN] = {0};
char
tsCharset
[
TSDB_LOCALE_LEN
]
=
{
0
};
// default encode string
int
tsNumOfLogLines
=
10000000
;
in
t
ddebugFlag
=
131
;
in
t
mdebugFlag
=
135
;
in
t
sdbDebugFlag
=
135
;
in
t
cdebugFlag
=
131
;
in
t
jnidebugFlag
=
131
;
in
t
httpDebugFlag
=
131
;
in
t
monitorDebugFlag
=
131
;
in
t
debugFlag
=
131
;
in
t
odbcdebugFlag
=
131
;
in
t
qdebugFlag
=
131
;
uint32_
t
ddebugFlag
=
131
;
uint32_
t
mdebugFlag
=
135
;
uint32_
t
sdbDebugFlag
=
135
;
uint32_
t
cdebugFlag
=
131
;
uint32_
t
jnidebugFlag
=
131
;
uint32_
t
httpDebugFlag
=
131
;
uint32_
t
monitorDebugFlag
=
131
;
uint32_
t
debugFlag
=
131
;
uint32_
t
odbcdebugFlag
=
131
;
uint32_
t
qdebugFlag
=
131
;
SGlobalConfig
*
tsGlobalConfig
=
NULL
;
int
tsGlobalConfigNum
=
0
;
...
...
src/util/src/tlog.c
浏览文件 @
6e01c527
...
...
@@ -58,7 +58,7 @@ typedef struct {
sem_t
buffNotEmpty
;
}
SLogBuff
;
in
t
uDebugFlag
=
131
;
// all the messages
uint32_
t
uDebugFlag
=
131
;
// all the messages
short
tsAsyncLog
=
1
;
static
SLogBuff
*
logHandle
;
...
...
src/util/src/tskiplist.c
浏览文件 @
6e01c527
...
...
@@ -242,7 +242,6 @@ tSkipList* tSkipListCreate(int16_t nMaxLevel, int16_t keyType, int16_t nMaxKeyLe
srand
(
time
(
NULL
));
pSkipList
->
state
.
nTotalMemSize
+=
sizeof
(
tSkipList
);
return
pSkipList
;
}
...
...
src/util/src/ttimer.c
浏览文件 @
6e01c527
...
...
@@ -95,7 +95,7 @@ typedef struct _tmr_ctrl_t {
int
tmrCtrlId
;
}
tmr_ctrl_t
;
in
t
tmrDebugFlag
=
DEBUG_ERROR
|
DEBUG_WARN
|
DEBUG_FILE
;
uint32_
t
tmrDebugFlag
=
DEBUG_ERROR
|
DEBUG_WARN
|
DEBUG_FILE
;
void
taosTmrProcessList
(
tmr_ctrl_t
*
);
tmr_ctrl_t
tmrCtrl
[
maxNumOfTmrCtrl
];
...
...
@@ -132,8 +132,8 @@ void *taosProcessAlarmSignal(void *tharg) {
sigaddset
(
&
sigset
,
SIGALRM
);
sigprocmask
(
SIG_BLOCK
,
&
sigset
,
NULL
);
timer_t
timerId
;
struct
sigevent
sevent
;
timer_t
timerId
=
{
0
}
;
struct
sigevent
sevent
=
{
0
}
;
sevent
.
sigev_notify
=
SIGEV_THREAD_ID
;
sevent
.
_sigev_un
.
_tid
=
syscall
(
__NR_gettid
);
sevent
.
sigev_signo
=
SIGALRM
;
...
...
src/util/src/ttokenizer.c
浏览文件 @
6e01c527
...
...
@@ -218,6 +218,7 @@ static SKeyword keywordTable[] = {
{
"STABLE"
,
TK_STABLE
}
};
/* This is the hash table */
static
pthread_mutex_t
mutex
=
PTHREAD_MUTEX_INITIALIZER
;
static
const
char
isIdChar
[]
=
{
...
...
@@ -273,11 +274,11 @@ int tSQLKeywordCode(const char* z, int n) {
}
/*
*
* Return the length of the token that begins at z[0].
*
* Store the token type in *type before returning.
*/
* Return the length of the token that begins at z[0].
* Store the token type in *type before returning.
*/
uint32_t
tSQLGetToken
(
char
*
z
,
uint32_t
*
tokenType
)
{
in
t
i
;
uint32_
t
i
;
switch
(
*
z
)
{
case
' '
:
case
'\t'
:
...
...
src/util/src/ttypes.c
浏览文件 @
6e01c527
...
...
@@ -25,6 +25,7 @@
#include "os.h"
#include "taos.h"
#include "tsdb.h"
#include "tsql.h"
#include "tsqldef.h"
#include "ttypes.h"
#include "tutil.h"
...
...
@@ -43,7 +44,7 @@ tDataDescriptor tDataTypeDesc[11] = {
{
TSDB_DATA_TYPE_NCHAR
,
5
,
8
,
"NCHAR"
},
};
char
tTokenTypeSwitcher
[]
=
{
char
tTokenTypeSwitcher
[
13
]
=
{
TSDB_DATA_TYPE_NULL
,
// no type
TSDB_DATA_TYPE_BINARY
,
// TK_ID
TSDB_DATA_TYPE_BOOL
,
// TK_BOOL
...
...
@@ -65,7 +66,7 @@ bool isValidDataType(int32_t type, int32_t length) {
}
if
(
type
==
TSDB_DATA_TYPE_BINARY
||
type
==
TSDB_DATA_TYPE_NCHAR
)
{
return
length
>=
0
&&
length
<=
TSDB_MAX_BINARY_LEN
;
//
return length >= 0 && length <= TSDB_MAX_BINARY_LEN;
}
return
true
;
...
...
@@ -105,8 +106,10 @@ void tVariantCreateN(tVariant *pVar, char *pz, uint32_t len, uint32_t type) {
pVar
->
nLen
=
strdequote
(
pVar
->
pz
);
break
;
}
default:
assert
(
false
);
default:
{
// nType == 0 means the null value
type
=
TSDB_DATA_TYPE_NULL
;
}
}
pVar
->
nType
=
type
;
...
...
@@ -123,56 +126,58 @@ void tVariantCreateB(tVariant *pVar, char *pz, uint32_t len, uint32_t type) {
switch
(
type
)
{
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_TINYINT
:
{
pVar
->
i64Key
=
*
(
int8_t
*
)
pz
;
pVar
->
i64Key
=
GET_INT8_VAL
(
pz
)
;
break
;
}
case
TSDB_DATA_TYPE_SMALLINT
:
{
pVar
->
i64Key
=
*
(
int16_t
*
)
pz
;
pVar
->
i64Key
=
GET_INT16_VAL
(
pz
)
;
break
;
}
case
TSDB_DATA_TYPE_INT
:
{
pVar
->
i64Key
=
*
(
int32_t
*
)
pz
;
pVar
->
i64Key
=
GET_INT32_VAL
(
pz
)
;
break
;
}
case
TSDB_DATA_TYPE_BIGINT
:
case
TSDB_DATA_TYPE_TIMESTAMP
:
{
pVar
->
i64Key
=
*
(
int64_t
*
)
pz
;
pVar
->
i64Key
=
GET_INT64_VAL
(
pz
)
;
break
;
}
case
TSDB_DATA_TYPE_DOUBLE
:
{
pVar
->
dKey
=
*
(
double
*
)
pz
;
pVar
->
dKey
=
GET_DOUBLE_VAL
(
pz
)
;
break
;
}
case
TSDB_DATA_TYPE_FLOAT
:
{
pVar
->
dKey
=
*
(
float
*
)
pz
;
pVar
->
dKey
=
GET_FLOAT_VAL
(
pz
)
;
break
;
}
case
TSDB_DATA_TYPE_NCHAR
:
{
/* here we get the nchar length from raw binary bits length */
int32_t
wl
en
=
len
/
TSDB_NCHAR_SIZE
;
pVar
->
wpz
=
malloc
((
len
+
1
)
*
wlen
);
pVar
->
nL
en
=
len
/
TSDB_NCHAR_SIZE
;
pVar
->
wpz
=
malloc
((
pVar
->
nLen
+
1
)
*
TSDB_NCHAR_SIZE
);
wcsncpy
(
pVar
->
wpz
,
(
wchar_t
*
)
pz
,
wlen
);
pVar
->
nLen
=
wlen
;
pVar
->
wpz
[
wlen
]
=
0
;
wcsncpy
(
pVar
->
wpz
,
(
wchar_t
*
)
pz
,
pVar
->
nLen
);
pVar
->
wpz
[
pVar
->
nLen
]
=
0
;
break
;
}
case
TSDB_DATA_TYPE_BINARY
:
{
pVar
->
pz
=
malloc
(
len
+
1
);
strncpy
(
pVar
->
pz
,
pz
,
len
);
pVar
->
nLen
=
len
;
pVar
->
pz
[
len
]
=
0
;
strdequote
(
pVar
->
pz
);
pVar
->
nLen
=
strlen
(
pVar
->
pz
);
pVar
->
nLen
=
strdequote
(
pVar
->
pz
);
break
;
}
default:
pVar
->
i64Key
=
GET_INT32_VAL
(
pVar
);
}
pVar
->
nType
=
type
;
}
void
tVariantDestroy
(
tVariant
*
pVar
)
{
if
(
pVar
==
NULL
)
return
;
...
...
@@ -780,29 +785,29 @@ void setNullN(char *val, int32_t type, int32_t bytes, int32_t numOfElems) {
void
assignVal
(
char
*
val
,
char
*
src
,
int32_t
len
,
int32_t
type
)
{
switch
(
type
)
{
case
TSDB_DATA_TYPE_INT
:
{
*
((
int32_t
*
)
val
)
=
*
(
int32_t
*
)
src
;
*
((
int32_t
*
)
val
)
=
GET_INT32_VAL
(
src
)
;
break
;
}
case
TSDB_DATA_TYPE_FLOAT
:
{
*
((
float
*
)
val
)
=
*
(
float
*
)
src
;
*
((
float
*
)
val
)
=
GET_FLOAT_VAL
(
src
)
;
break
;
};
case
TSDB_DATA_TYPE_DOUBLE
:
{
*
((
double
*
)
val
)
=
*
(
double
*
)
src
;
*
((
double
*
)
val
)
=
GET_DOUBLE_VAL
(
src
)
;
break
;
};
case
TSDB_DATA_TYPE_TIMESTAMP
:
case
TSDB_DATA_TYPE_BIGINT
:
{
*
((
int64_t
*
)
val
)
=
*
(
int64_t
*
)
src
;
*
((
int64_t
*
)
val
)
=
GET_INT64_VAL
(
src
)
;
break
;
};
case
TSDB_DATA_TYPE_SMALLINT
:
{
*
((
int16_t
*
)
val
)
=
*
(
int16_t
*
)
src
;
*
((
int16_t
*
)
val
)
=
GET_INT16_VAL
(
src
)
;
break
;
};
case
TSDB_DATA_TYPE_BOOL
:
case
TSDB_DATA_TYPE_TINYINT
:
{
*
((
int8_t
*
)
val
)
=
*
(
int8_t
*
)
src
;
*
((
int8_t
*
)
val
)
=
GET_INT8_VAL
(
src
)
;
break
;
};
default:
{
...
...
src/util/src/tutil.c
浏览文件 @
6e01c527
...
...
@@ -498,4 +498,13 @@ bool taosGetVersionNumber(char *versionStr, int *versionNubmer) {
versionStr
[
versionNumberPos
[
3
]
-
1
]
=
'.'
;
return
true
;
}
\ No newline at end of file
}
char
*
taosIpStr
(
int
ipInt
)
{
static
char
ipStrArray
[
3
][
30
];
static
int
ipStrIndex
=
0
;
char
*
ipStr
=
ipStrArray
[(
ipStrIndex
++
)
%
3
];
sprintf
(
ipStr
,
"0x%x:%d.%d.%d.%d"
,
ipInt
,
ipInt
&
0xFF
,
(
ipInt
>>
8
)
&
0xFF
,
(
ipInt
>>
16
)
&
0xFF
,
ipInt
>>
24
);
return
ipStr
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录