From 07a39d381316897bb480d917a0868da1ebf2959e Mon Sep 17 00:00:00 2001 From: Shuduo Sang Date: Thu, 5 Nov 2020 14:00:03 +0800 Subject: [PATCH] [TD-1946] : fix compile issues for VS2019 16.7 on Windows --- src/client/src/tscSubquery.c | 2 +- src/os/src/windows/wAtomic.c | 2 +- src/os/src/windows/wFile.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/client/src/tscSubquery.c b/src/client/src/tscSubquery.c index de0d899f8c..5139f7bd80 100644 --- a/src/client/src/tscSubquery.c +++ b/src/client/src/tscSubquery.c @@ -2366,7 +2366,7 @@ void tscBuildResFromSubqueries(SSqlObj *pSql) { SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(&pSql->cmd, pSql->cmd.clauseIndex); size_t numOfExprs = tscSqlExprNumOfExprs(pQueryInfo); - pRes->numOfCols = (int32_t)numOfExprs; + pRes->numOfCols = (int16_t)numOfExprs; pRes->tsrow = calloc(numOfExprs, POINTER_BYTES); pRes->buffer = calloc(numOfExprs, POINTER_BYTES); diff --git a/src/os/src/windows/wAtomic.c b/src/os/src/windows/wAtomic.c index a025cb8f0e..b645893030 100644 --- a/src/os/src/windows/wAtomic.c +++ b/src/os/src/windows/wAtomic.c @@ -44,7 +44,7 @@ long interlocked_add_fetch_32(long volatile* ptr, long val) { __int64 interlocked_add_fetch_64(__int64 volatile* ptr, __int64 val) { //#ifdef _WIN64 - return _InterlockedExchangeAdd64(ptr, val) + val; + return InterlockedExchangeAdd64(ptr, val) + val; //#else // return _InterlockedExchangeAdd(ptr, val) + val; //#endif diff --git a/src/os/src/windows/wFile.c b/src/os/src/windows/wFile.c index 734ed9916d..2204135ae6 100644 --- a/src/os/src/windows/wFile.c +++ b/src/os/src/windows/wFile.c @@ -65,12 +65,12 @@ int64_t taosFSendFile(FILE *out_file, FILE *in_file, int64_t *offset, int64_t co int64_t remain = count - writeLen; if (remain > 0) { - size_t rlen = fread(buffer, 1, remain, in_file); + size_t rlen = fread(buffer, 1, (size_t) remain, in_file); if (rlen <= 0) { return writeLen; } else { - fwrite(buffer, 1, remain, out_file); + fwrite(buffer, 1, (size_t) remain, out_file); writeLen += remain; } } -- GitLab