Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
9a7126e0
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看板
未验证
提交
9a7126e0
编写于
5月 17, 2022
作者:
wafwerar
提交者:
GitHub
5月 17, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #12580 from taosdata/fix/ZhiqiangWang/fix-15602-fix-win-str-to-int64-error
fix(os): win str to int64 error
上级
6d37249d
b7ca4f77
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
62 addition
and
33 deletion
+62
-33
include/os/os.h
include/os/os.h
+0
-3
include/os/osFile.h
include/os/osFile.h
+1
-1
include/os/osMath.h
include/os/osMath.h
+7
-5
include/util/tjson.h
include/util/tjson.h
+1
-1
source/libs/function/src/builtinsimpl.c
source/libs/function/src/builtinsimpl.c
+1
-1
source/libs/index/src/indexComm.c
source/libs/index/src/indexComm.c
+6
-6
source/libs/tdb/src/db/tdbPCache.c
source/libs/tdb/src/db/tdbPCache.c
+3
-3
source/libs/tdb/src/db/tdbPager.c
source/libs/tdb/src/db/tdbPager.c
+1
-1
source/libs/tdb/src/db/tdbUtil.c
source/libs/tdb/src/db/tdbUtil.c
+2
-2
source/libs/tdb/src/inc/tdbUtil.h
source/libs/tdb/src/inc/tdbUtil.h
+1
-1
source/os/src/osFile.c
source/os/src/osFile.c
+27
-6
source/os/src/osSysinfo.c
source/os/src/osSysinfo.c
+2
-1
source/util/src/tjson.c
source/util/src/tjson.c
+10
-2
未找到文件。
include/os/os.h
浏览文件 @
9a7126e0
...
...
@@ -58,9 +58,6 @@ extern "C" {
#else
#include <winsock.h>
#endif
#define __typeof(a) auto
#endif
#include <errno.h>
...
...
include/os/osFile.h
浏览文件 @
9a7126e0
...
...
@@ -66,7 +66,7 @@ int32_t taosUnLockFile(TdFilePtr pFile);
int32_t
taosUmaskFile
(
int32_t
maskVal
);
int32_t
taosStatFile
(
const
char
*
path
,
int64_t
*
size
,
int32_t
*
mtime
);
int32_t
taosDevInoFile
(
const
char
*
path
,
int64_t
*
stDev
,
int64_t
*
stIno
);
int32_t
taosDevInoFile
(
TdFilePtr
pFile
,
int64_t
*
stDev
,
int64_t
*
stIno
);
int32_t
taosFStatFile
(
TdFilePtr
pFile
,
int64_t
*
size
,
int32_t
*
mtime
);
bool
taosCheckExistFile
(
const
char
*
pathname
);
...
...
include/os/osMath.h
浏览文件 @
9a7126e0
...
...
@@ -23,11 +23,13 @@ extern "C" {
#define TPOW2(x) ((x) * (x))
#define TABS(x) ((x) > 0 ? (x) : -(x))
#define TSWAP(a, b) \
do { \
__typeof(a) __tmp = (a); \
(a) = (b); \
(b) = __tmp; \
#define TSWAP(a, b) \
do { \
char *__tmp = taosMemoryMalloc(sizeof(a)); \
memcpy(__tmp, &(a), sizeof(a)); \
memcpy(&(a), &(b), sizeof(a)); \
memcpy(&(b), __tmp, sizeof(a)); \
taosMemoryFree(__tmp); \
} while (0)
#ifdef WINDOWS
...
...
include/util/tjson.h
浏览文件 @
9a7126e0
...
...
@@ -25,7 +25,7 @@ extern "C" {
#define tjsonGetNumberValue(pJson, pName, val, code) \
do { \
uint64_t _tmp = 0; \
code = tjsonGet
U
BigIntValue(pJson, pName, &_tmp); \
code = tjsonGetBigIntValue(pJson, pName, &_tmp); \
val = _tmp; \
} while (0)
...
...
source/libs/function/src/builtinsimpl.c
浏览文件 @
9a7126e0
...
...
@@ -3388,7 +3388,7 @@ int32_t tailFunction(SqlFunctionCtx* pCtx) {
if
(
pInfo
->
offset
>=
pInput
->
numOfRows
)
{
return
0
;
}
else
{
pInfo
->
numOfPoints
=
MIN
(
pInfo
->
numOfPoints
,
pInput
->
numOfRows
-
pInfo
->
offset
);
pInfo
->
numOfPoints
=
T
MIN
(
pInfo
->
numOfPoints
,
pInput
->
numOfRows
-
pInfo
->
offset
);
}
for
(
int32_t
i
=
pInput
->
startRowIndex
;
i
<
pInput
->
numOfRows
+
pInput
->
startRowIndex
-
pInfo
->
offset
;
i
+=
1
)
{
...
...
source/libs/index/src/indexComm.c
浏览文件 @
9a7126e0
...
...
@@ -266,7 +266,7 @@ int32_t indexConvertData(void* src, int8_t type, void** dst) {
TASSERT
(
0
);
break
;
}
*
dst
=
*
dst
-
tlen
;
*
dst
=
(
char
*
)
*
dst
-
tlen
;
// indexMayFillNumbericData(*dst, tlen);
return
tlen
;
}
...
...
@@ -306,7 +306,7 @@ int32_t indexConvertDataToStr(void* src, int8_t type, void** dst) {
tlen
=
taosEncodeBinary
(
NULL
,
src
,
sizeof
(
float
));
*
dst
=
taosMemoryCalloc
(
1
,
tlen
+
1
);
tlen
=
taosEncodeBinary
(
dst
,
src
,
sizeof
(
float
));
*
dst
=
*
dst
-
tlen
;
*
dst
=
(
char
*
)
*
dst
-
tlen
;
break
;
case
TSDB_DATA_TYPE_UINT
:
*
dst
=
taosMemoryCalloc
(
1
,
sizeof
(
int64_t
)
+
1
);
...
...
@@ -320,7 +320,7 @@ int32_t indexConvertDataToStr(void* src, int8_t type, void** dst) {
tlen
=
taosEncodeBinary
(
NULL
,
src
,
sizeof
(
double
));
*
dst
=
taosMemoryCalloc
(
1
,
tlen
+
1
);
tlen
=
taosEncodeBinary
(
dst
,
src
,
sizeof
(
double
));
*
dst
=
*
dst
-
tlen
;
*
dst
=
(
char
*
)
*
dst
-
tlen
;
break
;
case
TSDB_DATA_TYPE_UBIGINT
:
assert
(
0
);
...
...
@@ -331,7 +331,7 @@ int32_t indexConvertDataToStr(void* src, int8_t type, void** dst) {
tlen
=
taosEncodeBinary
(
NULL
,
varDataVal
(
src
),
varDataLen
(
src
));
*
dst
=
taosMemoryCalloc
(
1
,
tlen
+
1
);
tlen
=
taosEncodeBinary
(
dst
,
varDataVal
(
src
),
varDataLen
(
src
));
*
dst
=
*
dst
-
tlen
;
*
dst
=
(
char
*
)
*
dst
-
tlen
;
break
;
}
...
...
@@ -340,7 +340,7 @@ int32_t indexConvertDataToStr(void* src, int8_t type, void** dst) {
tlen
=
taosEncodeBinary
(
NULL
,
src
,
strlen
(
src
));
*
dst
=
taosMemoryCalloc
(
1
,
tlen
+
1
);
tlen
=
taosEncodeBinary
(
dst
,
src
,
strlen
(
src
));
*
dst
=
*
dst
-
tlen
;
*
dst
=
(
char
*
)
*
dst
-
tlen
;
break
;
#endif
}
...
...
@@ -349,7 +349,7 @@ int32_t indexConvertDataToStr(void* src, int8_t type, void** dst) {
tlen
=
taosEncodeBinary
(
NULL
,
src
,
strlen
(
src
));
*
dst
=
taosMemoryCalloc
(
1
,
tlen
+
1
);
tlen
=
taosEncodeBinary
(
dst
,
src
,
strlen
(
src
));
*
dst
=
*
dst
-
tlen
;
*
dst
=
(
char
*
)
*
dst
-
tlen
;
break
;
#endif
default:
...
...
source/libs/tdb/src/db/tdbPCache.c
浏览文件 @
9a7126e0
...
...
@@ -28,9 +28,9 @@ struct SPCache {
SPage
lru
;
};
static
inline
in
t
tdbPCachePageHash
(
const
SPgid
*
pPgid
)
{
u
32
*
t
=
(
u32
*
)((
pPgid
)
->
fileid
);
return
t
[
0
]
+
t
[
1
]
+
t
[
2
]
+
t
[
3
]
+
t
[
4
]
+
t
[
5
]
+
(
pPgid
)
->
pgno
;
static
inline
uint32_
t
tdbPCachePageHash
(
const
SPgid
*
pPgid
)
{
u
int32_t
*
t
=
(
uint32_t
*
)((
pPgid
)
->
fileid
);
return
(
uint32_t
)(
t
[
0
]
+
t
[
1
]
+
t
[
2
]
+
t
[
3
]
+
t
[
4
]
+
t
[
5
]
+
(
pPgid
)
->
pgno
)
;
}
#define PAGE_IS_PINNED(pPage) ((pPage)->pLruNext == NULL)
...
...
source/libs/tdb/src/db/tdbPager.c
浏览文件 @
9a7126e0
...
...
@@ -72,7 +72,7 @@ int tdbPagerOpen(SPCache *pCache, const char *fileName, SPager **ppPager) {
return
-
1
;
}
ret
=
tdbGnrtFileID
(
pPager
->
dbFileName
,
pPager
->
fid
,
false
);
ret
=
tdbGnrtFileID
(
pPager
->
fd
,
pPager
->
fid
,
false
);
if
(
ret
<
0
)
{
return
-
1
;
}
...
...
source/libs/tdb/src/db/tdbUtil.c
浏览文件 @
9a7126e0
...
...
@@ -35,10 +35,10 @@ void tdbFree(void *p) {
}
}
int
tdbGnrtFileID
(
const
char
*
fname
,
uint8_t
*
fileid
,
bool
unique
)
{
int
tdbGnrtFileID
(
tdb_fd_t
fd
,
uint8_t
*
fileid
,
bool
unique
)
{
int64_t
stDev
=
0
,
stIno
=
0
;
if
(
taosDevInoFile
(
f
name
,
&
stDev
,
&
stIno
)
<
0
)
{
if
(
taosDevInoFile
(
f
d
,
&
stDev
,
&
stIno
)
<
0
)
{
return
-
1
;
}
...
...
source/libs/tdb/src/inc/tdbUtil.h
浏览文件 @
9a7126e0
...
...
@@ -28,7 +28,7 @@ extern "C" {
#define TDB_ROUND8(x) (((x) + 7) & ~7)
int
tdbGnrtFileID
(
const
char
*
fname
,
uint8_t
*
fileid
,
bool
unique
);
int
tdbGnrtFileID
(
tdb_fd_t
fd
,
uint8_t
*
fileid
,
bool
unique
);
int
tdbGetFileSize
(
tdb_fd_t
fd
,
int
szPage
,
SPgno
*
size
);
void
*
tdbRealloc
(
void
*
ptr
,
size_t
size
);
...
...
source/os/src/osFile.c
浏览文件 @
9a7126e0
...
...
@@ -110,7 +110,7 @@ void taosGetTmpfilePath(const char *inputTmpDir, const char *fileNamePrefix, cha
int64_t
taosCopyFile
(
const
char
*
from
,
const
char
*
to
)
{
#ifdef WINDOWS
assert
(
0
);
return
0
;
return
-
1
;
#else
char
buffer
[
4096
];
int64_t
size
=
0
;
...
...
@@ -190,15 +190,35 @@ int32_t taosStatFile(const char *path, int64_t *size, int32_t *mtime) {
return
0
;
}
int32_t
taosDevInoFile
(
const
char
*
path
,
int64_t
*
stDev
,
int64_t
*
stIno
)
{
int32_t
taosDevInoFile
(
TdFilePtr
pFile
,
int64_t
*
stDev
,
int64_t
*
stIno
)
{
if
(
pFile
==
NULL
)
{
return
0
;
}
assert
(
pFile
->
fd
>=
0
);
// Please check if you have closed the file.
struct
stat
fileStat
;
#ifdef WINDOWS
int32_t
code
=
_stat
(
path
,
&
fileStat
);
BY_HANDLE_FILE_INFORMATION
bhfi
;
HANDLE
handle
=
(
HANDLE
)
_get_osfhandle
(
pFile
->
fd
);
if
(
GetFileInformationByHandle
(
handle
,
&
bhfi
)
==
FALSE
)
{
printf
(
"taosFStatFile get file info fail."
);
return
-
1
;
}
if
(
stDev
!=
NULL
)
{
*
stDev
=
(
int64_t
)(
bhfi
.
dwVolumeSerialNumber
);
}
if
(
stIno
!=
NULL
)
{
*
stIno
=
(
int64_t
)((((
uint64_t
)
bhfi
.
nFileIndexHigh
)
<<
32
)
+
bhfi
.
nFileIndexLow
);
}
#else
int32_t
code
=
stat
(
path
,
&
fileStat
);
#endif
struct
stat
fileStat
;
int32_t
code
=
fstat
(
pFile
->
fd
,
&
fileStat
);
if
(
code
<
0
)
{
printf
(
"taosFStatFile run fstat fail."
);
return
code
;
}
...
...
@@ -209,6 +229,7 @@ int32_t taosDevInoFile(const char *path, int64_t *stDev, int64_t *stIno) {
if
(
stIno
!=
NULL
)
{
*
stIno
=
fileStat
.
st_ino
;
}
#endif
return
0
;
}
...
...
source/os/src/osSysinfo.c
浏览文件 @
9a7126e0
...
...
@@ -744,7 +744,8 @@ int32_t taosGetSystemUUID(char *uid, int32_t uidlen) {
#ifdef WINDOWS
GUID
guid
;
CoCreateGuid
(
&
guid
);
memcpy
(
uid
,
&
guid
,
uidlen
);
snprintf
(
uid
,
uidlen
,
"%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X"
,
guid
.
Data1
,
guid
.
Data2
,
guid
.
Data3
,
guid
.
Data4
[
0
],
guid
.
Data4
[
1
],
guid
.
Data4
[
2
],
guid
.
Data4
[
3
],
guid
.
Data4
[
4
],
guid
.
Data4
[
5
],
guid
.
Data4
[
6
],
guid
.
Data4
[
7
]);
return
0
;
#elif defined(_TD_DARWIN_64)
...
...
source/util/src/tjson.c
浏览文件 @
9a7126e0
...
...
@@ -183,8 +183,12 @@ int32_t tjsonGetBigIntValue(const SJson* pJson, const char* pName, int64_t* pVal
if
(
NULL
==
p
)
{
return
TSDB_CODE_FAILED
;
}
#ifdef WINDOWS
sscanf
(
p
,
"%lld"
,
pVal
);
#else
// sscanf(p,"%ld",pVal);
*
pVal
=
strtol
(
p
,
NULL
,
10
);
#endif
return
TSDB_CODE_SUCCESS
;
}
...
...
@@ -214,8 +218,12 @@ int32_t tjsonGetUBigIntValue(const SJson* pJson, const char* pName, uint64_t* pV
if
(
NULL
==
p
)
{
return
TSDB_CODE_FAILED
;
}
#ifdef WINDOWS
sscanf
(
p
,
"%llu"
,
pVal
);
#else
// sscanf(p,"%ld",pVal);
*
pVal
=
strtoul
(
p
,
NULL
,
10
);
#endif
return
TSDB_CODE_SUCCESS
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录