Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
ac3d6440
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
ac3d6440
编写于
5月 08, 2021
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
TD-4088
上级
18fdb96a
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
60 addition
and
140 deletion
+60
-140
src/client/src/tscParseInsert.c
src/client/src/tscParseInsert.c
+1
-1
src/os/inc/osDarwin.h
src/os/inc/osDarwin.h
+0
-4
src/os/inc/osDef.h
src/os/inc/osDef.h
+1
-1
src/os/inc/osMemory.h
src/os/inc/osMemory.h
+1
-11
src/os/inc/osRand.h
src/os/inc/osRand.h
+1
-2
src/os/inc/osSocket.h
src/os/inc/osSocket.h
+10
-0
src/os/inc/osString.h
src/os/inc/osString.h
+17
-22
src/os/inc/osWindows.h
src/os/inc/osWindows.h
+0
-14
src/os/src/darwin/darwinString.c
src/os/src/darwin/darwinString.c
+0
-22
src/os/src/detail/osRand.c
src/os/src/detail/osRand.c
+0
-4
src/os/src/detail/osString.c
src/os/src/detail/osString.c
+5
-5
src/os/src/windows/wGetline.c
src/os/src/windows/wGetline.c
+10
-12
src/os/src/windows/wGodll.c
src/os/src/windows/wGodll.c
+0
-33
src/os/src/windows/wSocket.c
src/os/src/windows/wSocket.c
+7
-1
src/os/src/windows/wString.c
src/os/src/windows/wString.c
+7
-8
未找到文件。
src/client/src/tscParseInsert.c
浏览文件 @
ac3d6440
...
...
@@ -68,7 +68,7 @@ int tsParseTime(SStrToken *pToken, int64_t *time, char **next, char *error, int1
}
else
if
(
strncmp
(
pToken
->
z
,
"0"
,
1
)
==
0
&&
pToken
->
n
==
1
)
{
// do nothing
}
else
if
(
pToken
->
type
==
TK_INTEGER
)
{
useconds
=
t
s
osStr2int64
(
pToken
->
z
);
useconds
=
t
a
osStr2int64
(
pToken
->
z
);
}
else
{
// strptime("2001-11-12 18:31:01", "%Y-%m-%d %H:%M:%S", &tm);
if
(
taosParseTime
(
pToken
->
z
,
time
,
pToken
->
n
,
timePrec
,
tsDaylight
)
!=
TSDB_CODE_SUCCESS
)
{
...
...
src/os/inc/osDarwin.h
浏览文件 @
ac3d6440
...
...
@@ -82,13 +82,11 @@ extern "C" {
int
tsem_destroy
(
tsem_t
*
sem
);
#define TAOS_OS_FUNC_SOCKET_SETSOCKETOPT
#define TAOS_OS_FUNC_STRING_STR2INT64
#define TAOS_OS_FUNC_SYSINFO
#define TAOS_OS_FUNC_TIMER
#define TAOS_OS_FUNC_SEMPHONE_PTHREAD
// specific
#define htobe64 htonll
typedef
int
(
*
__compar_fn_t
)(
const
void
*
,
const
void
*
);
// for send function in tsocket.c
...
...
@@ -108,8 +106,6 @@ typedef int(*__compar_fn_t)(const void *, const void *);
#define TAOS_OS_FUNC_PTHREAD_RWLOCK
int64_t
tsosStr2int64
(
char
*
str
);
#include "eok.h"
void
taos_block_sigalrm
(
void
);
...
...
src/os/inc/osDef.h
浏览文件 @
ac3d6440
...
...
@@ -111,7 +111,7 @@ extern "C" {
#define threadlocal __declspec( thread )
#endif
#if
defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32
)
#if
!(defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
)
#define PRIzu "ld"
#endif
...
...
src/os/inc/osMemory.h
浏览文件 @
ac3d6440
...
...
@@ -43,9 +43,6 @@ void taosTMemset(void *ptr, int c);
#define tmalloc(size) malloc(size)
#define tcalloc(num, size) calloc(num, size)
#define trealloc(ptr, size) realloc(ptr, size)
#define tstrdup(str) taosStrdupImp(str)
#define tstrndup(str, size) taosStrndupImp(str, size)
#define tgetline(lineptr, n, stream) taosGetlineImp(lineptr, n, stream)
#define tfree(x) \
do { \
if (x) { \
...
...
@@ -71,15 +68,8 @@ void taosTMemset(void *ptr, int c);
#define tcalloc(num, size) taosCallocMem(num, size, __FILE__, __LINE__)
#define trealloc(ptr, size) taosReallocMem(ptr, size, __FILE__, __LINE__)
#define tfree(ptr) taosFreeMem(ptr, __FILE__, __LINE__)
// #undef tstrdup
// #undef tstrndup
// #undef tgetline
// #define taosStrdup(str) taos_strdup(str, __FILE__, __LINE__)
// #define taosStrndup(str, size) taos_strndup(str, size, __FILE__, __LINE__)
// #define tgetline(lineptr, n, stream) taos_getline(lineptr, n, stream, __FILE__, __LINE__)
#endif
#endif
#endif
#ifdef __cplusplus
}
...
...
src/os/inc/osRand.h
浏览文件 @
ac3d6440
...
...
@@ -20,9 +20,8 @@
extern
"C"
{
#endif
// TAOS_OS_FUNC_RAND
uint32_t
taosRand
(
void
);
void
taosRandStr
(
char
*
str
,
int32_t
size
);
void
taosRandStr
(
char
*
str
,
int32_t
size
);
uint32_t
taosSafeRand
(
void
);
#ifdef __cplusplus
...
...
src/os/inc/osSocket.h
浏览文件 @
ac3d6440
...
...
@@ -74,6 +74,16 @@ int32_t taosGetSockOpt(SOCKET socketfd, int32_t level, int32_t optname, void *op
uint32_t
taosInetAddr
(
char
*
ipAddr
);
const
char
*
taosInetNtoa
(
struct
in_addr
ipInt
);
#if (defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32))
#define htobe64 htonll
#if defined(_TD_GO_DLL_)
uint64_t
htonll
(
uint64_t
val
);
#endif
#elif defined(_TD_DARWIN_64)
#define htobe64 htonll
#endif
#ifdef __cplusplus
}
#endif
...
...
src/os/inc/osString.h
浏览文件 @
ac3d6440
...
...
@@ -20,35 +20,30 @@
extern
"C"
{
#endif
#ifndef TAOS_OS_FUNC_STRING_STRDUP
#define taosStrdupImp(str) strdup(str)
#define taosStrndupImp(str, size) strndup(str, size)
#endif
#ifndef TAOS_OS_FUNC_STRING_GETLINE
#define taosGetlineImp(lineptr, n, stream) getline(lineptr, n , stream)
#else
int
taosGetlineImp
(
char
**
lineptr
,
size_t
*
n
,
FILE
*
stream
);
#endif
#ifndef TAOS_OS_FUNC_STRING_WCHAR
#if defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32)
#define tstrdup(str) _strdup(str)
#define tstrndup(str, size) _strndup(str, size)
int32_t
tgetline
(
char
**
lineptr
,
size_t
*
n
,
FILE
*
stream
);
int32_t
twcslen
(
const
wchar_t
*
wcs
);
#else
#define tstrdup(str) strdup(str)
#define tstrndup(str, size) strndup(str, size)
#define tgetline(lineptr, n, stream) getline(lineptr, n , stream)
#define twcslen wcslen
#endif
#endif
#define tstrncpy(dst, src, size)
\
do { \
strncpy((dst), (src), (size)); \
(dst)[(size)-1] = 0; \
#define tstrncpy(dst, src, size) \
do {
\
strncpy((dst), (src), (size));
\
(dst)[(size)-1] = 0;
\
} while (0)
#ifndef TAOS_OS_FUNC_STRING_STR2INT64
int64_t
tsosStr2int64
(
char
*
str
);
#endif
int64_t
taosStr2int64
(
char
*
str
);
// USE_LIBICONV
int32_t
taosUcs4ToMbs
(
void
*
ucs4
,
int32_t
ucs4_max_len
,
char
*
mbs
);
bool
taosMbsToUcs4
(
char
*
mbs
,
size_t
mbs_len
,
char
*
ucs4
,
int32_t
ucs4_max_len
,
int
*
len
);
int
tasoUcs4Compare
(
void
*
f1_ucs4
,
void
*
f2_ucs4
,
in
t
bytes
);
bool
taosMbsToUcs4
(
char
*
mbs
,
size_t
mbs_len
,
char
*
ucs4
,
int32_t
ucs4_max_len
,
int
32_t
*
len
);
int
32_t
tasoUcs4Compare
(
void
*
f1_ucs4
,
void
*
f2_ucs4
,
int32_
t
bytes
);
bool
taosValidateEncodec
(
const
char
*
encodec
);
char
*
taosCharsetReplace
(
char
*
charsetstr
);
...
...
src/os/inc/osWindows.h
浏览文件 @
ac3d6440
...
...
@@ -88,19 +88,6 @@ typedef SOCKET eventfd_t;
#define EPOLLWAKEUP (1u << 29)
#endif
#define TAOS_OS_FUNC_STRING_WCHAR
int
twcslen
(
const
wchar_t
*
wcs
);
#define TAOS_OS_FUNC_STRING_GETLINE
#define TAOS_OS_FUNC_STRING_STR2INT64
#ifdef _TD_GO_DLL_
int64_t
tsosStr2int64
(
char
*
str
);
uint64_t
htonll
(
uint64_t
val
);
#else
#define tsosStr2int64 _atoi64
#endif
#define TAOS_OS_FUNC_STRING_STRDUP
#define taosStrdupImp(str) _strdup(str)
#define taosStrndupImp(str, size) _strndup(str, size)
char
*
stpcpy
(
char
*
dest
,
const
char
*
src
);
char
*
stpncpy
(
char
*
dest
,
const
char
*
src
,
size_t
n
);
...
...
@@ -127,7 +114,6 @@ typedef int (*__compar_fn_t)(const void *, const void *);
#define snprintf _snprintf
#define in_addr_t unsigned long
#define socklen_t int
#define htobe64 htonll
struct
tm
*
localtime_r
(
const
time_t
*
timep
,
struct
tm
*
result
);
char
*
strptime
(
const
char
*
buf
,
const
char
*
fmt
,
struct
tm
*
tm
);
...
...
src/os/src/darwin/darwinString.c
已删除
100644 → 0
浏览文件 @
18fdb96a
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _DEFAULT_SOURCE
#include "os.h"
int64_t
tsosStr2int64
(
char
*
str
)
{
char
*
endptr
=
NULL
;
return
strtoll
(
str
,
&
endptr
,
10
);
}
src/os/src/detail/osRand.c
浏览文件 @
ac3d6440
...
...
@@ -16,8 +16,6 @@
#define _DEFAULT_SOURCE
#include "os.h"
#ifndef TAOS_OS_FUNC_RAND
uint32_t
taosRand
(
void
)
{
return
rand
();
}
uint32_t
taosSafeRand
(
void
)
{
...
...
@@ -38,8 +36,6 @@ uint32_t taosSafeRand(void) {
return
(
uint32_t
)
seed
;
}
#endif
void
taosRandStr
(
char
*
str
,
int32_t
size
)
{
const
char
*
set
=
"abcdefghijklmnopqrstuvwxyz0123456789-_."
;
int32_t
len
=
39
;
...
...
src/os/src/detail/osString.c
浏览文件 @
ac3d6440
...
...
@@ -17,17 +17,17 @@
#include "os.h"
#include "tglobal.h"
#ifndef TAOS_OS_FUNC_STRING_STR2INT64
int64_t
tsosStr2int64
(
char
*
str
)
{
int64_t
taosStr2int64
(
char
*
str
)
{
char
*
endptr
=
NULL
;
return
strtoll
(
str
,
&
endptr
,
10
);
}
#endif
#ifndef TAOS_OS_FUNC_STRING_WCHAR
int
tasoUcs4Compare
(
void
*
f1_ucs4
,
void
*
f2_ucs4
,
int
bytes
)
{
#if !(defined(_TD_WINDOWS_64) || defined(_TD_WINDOWS_32))
int32_t
tasoUcs4Compare
(
void
*
f1_ucs4
,
void
*
f2_ucs4
,
int32_t
bytes
)
{
return
wcsncmp
((
wchar_t
*
)
f1_ucs4
,
(
wchar_t
*
)
f2_ucs4
,
bytes
/
TSDB_NCHAR_SIZE
);
}
#endif
#ifdef USE_LIBICONV
...
...
src/os/src/windows/wGetline.c
浏览文件 @
ac3d6440
...
...
@@ -40,10 +40,10 @@ null terminator), or -1 on error or EOF. On a -1 return, the caller
should check feof(), if not then errno has been set to indicate
the error. */
int
getstr
(
char
**
lineptr
,
size_t
*
n
,
FILE
*
stream
,
char
terminator
,
in
t
offset
)
{
int
nchars_avail
;
/* Allocated but unused chars in *LINEPTR. */
char
*
read_pos
;
/* Where we're reading into *LINEPTR. */
int
ret
;
int
32_t
getstr
(
char
**
lineptr
,
size_t
*
n
,
FILE
*
stream
,
char
terminator
,
int32_
t
offset
)
{
int
32_t
nchars_avail
;
/* Allocated but unused chars in *LINEPTR. */
char
*
read_pos
;
/* Where we're reading into *LINEPTR. */
int
32_t
ret
;
if
(
!
lineptr
||
!
n
||
!
stream
)
{
errno
=
EINVAL
;
...
...
@@ -59,12 +59,12 @@ int getstr(char **lineptr, size_t *n, FILE *stream, char terminator, int offset)
}
}
nchars_avail
=
(
int
)(
*
n
-
offset
);
nchars_avail
=
(
int
32_t
)(
*
n
-
offset
);
read_pos
=
*
lineptr
+
offset
;
for
(;;)
{
int
save_errno
;
register
int
c
=
getc
(
stream
);
int
32_t
save_errno
;
register
int
32_t
c
=
getc
(
stream
);
save_errno
=
errno
;
...
...
@@ -79,7 +79,7 @@ int getstr(char **lineptr, size_t *n, FILE *stream, char terminator, int offset)
else
*
n
+=
MIN_CHUNK
;
nchars_avail
=
(
int
)(
*
n
+
*
lineptr
-
read_pos
);
nchars_avail
=
(
int
32_t
)(
*
n
+
*
lineptr
-
read_pos
);
*
lineptr
=
realloc
(
*
lineptr
,
*
n
);
if
(
!*
lineptr
)
{
errno
=
ENOMEM
;
...
...
@@ -115,10 +115,8 @@ int getstr(char **lineptr, size_t *n, FILE *stream, char terminator, int offset)
/* Done - NUL terminate and return the number of chars read. */
*
read_pos
=
'\0'
;
ret
=
(
int
)(
read_pos
-
(
*
lineptr
+
offset
));
ret
=
(
int
32_t
)(
read_pos
-
(
*
lineptr
+
offset
));
return
ret
;
}
int
taosGetlineImp
(
char
**
lineptr
,
size_t
*
n
,
FILE
*
stream
)
{
return
getstr
(
lineptr
,
n
,
stream
,
'\n'
,
0
);
}
\ No newline at end of file
int32_t
tgetline
(
char
**
lineptr
,
size_t
*
n
,
FILE
*
stream
)
{
return
getstr
(
lineptr
,
n
,
stream
,
'\n'
,
0
);
}
\ No newline at end of file
src/os/src/windows/wGodll.c
已删除
100644 → 0
浏览文件 @
18fdb96a
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#define _DEFAULT_SOURCE
#include "os.h"
#include "taosdef.h"
#include "tglobal.h"
#include "ttimer.h"
#include "tulog.h"
#include "tutil.h"
#ifdef _TD_GO_DLL_
int64_t
tsosStr2int64
(
char
*
str
)
{
char
*
endptr
=
NULL
;
return
strtoll
(
str
,
&
endptr
,
10
);
}
uint64_t
htonll
(
uint64_t
val
)
{
return
(((
uint64_t
)
htonl
(
val
))
<<
32
)
+
htonl
(
val
>>
32
);
}
#endif
src/os/src/windows/wSocket.c
浏览文件 @
ac3d6440
...
...
@@ -88,4 +88,10 @@ const char *taosInetNtoa(struct in_addr ipInt) {
return
inet_ntop
(
AF_INET
,
&
ipInt
,
tmpDstStr
,
INET6_ADDRSTRLEN
);
}
#endif
\ No newline at end of file
#endif
#if defined(_TD_GO_DLL_)
uint64_t
htonll
(
uint64_t
val
)
{
return
(((
uint64_t
)
htonl
(
val
))
<<
32
)
+
htonl
(
val
>>
32
);
}
#endif
src/os/src/windows/wString.c
浏览文件 @
ac3d6440
...
...
@@ -33,9 +33,9 @@
* If *stringp is NULL, strsep returns NULL.
*/
char
*
strsep
(
char
**
stringp
,
const
char
*
delim
)
{
char
*
s
;
char
*
s
;
const
char
*
spanp
;
int
c
,
sc
;
int
32_t
c
,
sc
;
char
*
tok
;
if
((
s
=
*
stringp
)
==
NULL
)
return
(
NULL
);
...
...
@@ -75,13 +75,13 @@ char *getpass(const char *prefix) {
return
passwd
;
}
int
twcslen
(
const
wchar_t
*
wcs
)
{
int
*
wstr
=
(
in
t
*
)
wcs
;
int
32_t
twcslen
(
const
wchar_t
*
wcs
)
{
int
32_t
*
wstr
=
(
int32_
t
*
)
wcs
;
if
(
NULL
==
wstr
)
{
return
0
;
}
int
n
=
0
;
int
32_t
n
=
0
;
while
(
1
)
{
if
(
0
==
*
wstr
++
)
{
break
;
...
...
@@ -92,8 +92,8 @@ int twcslen(const wchar_t *wcs) {
return
n
;
}
int
tasoUcs4Compare
(
void
*
f1_ucs4
,
void
*
f2_ucs4
,
in
t
bytes
)
{
for
(
int
i
=
0
;
i
<
bytes
;
++
i
)
{
int
32_t
tasoUcs4Compare
(
void
*
f1_ucs4
,
void
*
f2_ucs4
,
int32_
t
bytes
)
{
for
(
int
32_t
i
=
0
;
i
<
bytes
;
++
i
)
{
int32_t
f1
=
*
(
int32_t
*
)((
char
*
)
f1_ucs4
+
i
*
4
);
int32_t
f2
=
*
(
int32_t
*
)((
char
*
)
f2_ucs4
+
i
*
4
);
...
...
@@ -127,7 +127,6 @@ int tasoUcs4Compare(void *f1_ucs4, void *f2_ucs4, int bytes) {
#endif
}
/* Copy memory to memory until the specified number of bytes
has been copied, return pointer to following byte.
Overlap is NOT handled correctly. */
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录