diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index e797911adde33b1561e6d6094446dd28f0f1bc88..df69eb8aa1092dbb3730bdc64eaaf130c56aa32e 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -228,7 +228,7 @@ endif() # iconv if(${BUILD_WITH_ICONV}) - add_subdirectory(iconv EXCLUDE_FROM_ALL) + add_library(iconv STATIC iconv/win_iconv.c) endif(${BUILD_WITH_ICONV}) # wingetopt diff --git a/include/common/trow.h b/include/common/trow.h index ace59b2a910ceaad966a647df411ac835540d83d..02f84b372eee03182ba9bfdaf83740ad05332b19 100644 --- a/include/common/trow.h +++ b/include/common/trow.h @@ -1404,7 +1404,7 @@ static void tdSRowPrint(STSRow *row, STSchema *pSchema, const char* tag) { printf("%s >>>", tag); for (int i = 0; i < pSchema->numOfCols; ++i) { STColumn *stCol = pSchema->columns + i; - SCellVal sVal = {.valType = 255, .val = NULL}; + SCellVal sVal = { 255, NULL}; if (!tdSTSRowIterNext(&iter, stCol->colId, stCol->type, &sVal)) { break; } diff --git a/source/dnode/mnode/impl/test/sdb/sdbTest.cpp b/source/dnode/mnode/impl/test/sdb/sdbTest.cpp index 606db251d2f062ab632f3ab8601153abea695b1b..31d4733fe1068edab6a15b78f967d77bcb1f40d3 100644 --- a/source/dnode/mnode/impl/test/sdb/sdbTest.cpp +++ b/source/dnode/mnode/impl/test/sdb/sdbTest.cpp @@ -184,14 +184,14 @@ TEST_F(MndTestSdb, 01_Write) { taosRemoveDir(opt.path); SSdbTable strTable = { - .sdbType = SDB_USER, - .keyType = SDB_KEY_BINARY, - .deployFp = (SdbDeployFp)strDefault, - .encodeFp = (SdbEncodeFp)strEncode, - .decodeFp = (SdbDecodeFp)strDecode, - .insertFp = (SdbInsertFp)strInsert, - .updateFp = (SdbUpdateFp)strUpdate, - .deleteFp = (SdbDeleteFp)strDelete, + SDB_USER, + SDB_KEY_BINARY, + (SdbDeployFp)strDefault, + (SdbEncodeFp)strEncode, + (SdbDecodeFp)strDecode, + (SdbInsertFp)strInsert, + (SdbUpdateFp)strUpdate, + (SdbDeleteFp)strDelete, }; pSdb = sdbInit(&opt); @@ -304,14 +304,14 @@ TEST_F(MndTestSdb, 01_Read) { taosRemoveDir(opt.path); SSdbTable strTable = { - .sdbType = SDB_USER, - .keyType = SDB_KEY_BINARY, - .deployFp = (SdbDeployFp)strDefault, - .encodeFp = (SdbEncodeFp)strEncode, - .decodeFp = (SdbDecodeFp)strDecode, - .insertFp = (SdbInsertFp)strInsert, - .updateFp = (SdbUpdateFp)strDelete, - .deleteFp = (SdbDeleteFp)strUpdate, + SDB_USER, + SDB_KEY_BINARY, + (SdbDeployFp)strDefault, + (SdbEncodeFp)strEncode, + (SdbDecodeFp)strDecode, + (SdbInsertFp)strInsert, + (SdbUpdateFp)strUpdate, + (SdbDeleteFp)strDelete, }; pSdb = sdbInit(&opt); diff --git a/source/libs/scalar/src/sclfunc.c b/source/libs/scalar/src/sclfunc.c index cf7de025cb58dc76bf1cd1d4219ea0328d71a79f..d68dce6d120a338b0e9c995d08edba48d75de9c2 100644 --- a/source/libs/scalar/src/sclfunc.c +++ b/source/libs/scalar/src/sclfunc.c @@ -170,7 +170,7 @@ static int32_t doScalarFunctionUnique2(SScalarParam *pInput, int32_t inputNum, S double *out = (double *)pOutputData->pData; double result; - int32_t numOfRows = MAX(pInput[0].numOfRows, pInput[1].numOfRows); + int32_t numOfRows = TMAX(pInput[0].numOfRows, pInput[1].numOfRows); if (pInput[0].numOfRows == pInput[1].numOfRows) { for (int32_t i = 0; i < numOfRows; ++i) { if (colDataIsNull_s(pInputData[0], i) || diff --git a/source/os/src/osDir.c b/source/os/src/osDir.c index 748128e34e0a55a8ecd886713018359066ace8d4..6d90773d1b0d04b803011adb97896ece705814ed 100644 --- a/source/os/src/osDir.c +++ b/source/os/src/osDir.c @@ -40,11 +40,11 @@ int wordexp(char *words, wordexp_t *pwordexp, int flags) { memset(pwordexp->wordPos, 0, 1025); if (_fullpath(pwordexp->wordPos, words, 1024) == NULL) { pwordexp->we_wordv[0] = words; - printf("failed to parse relative path:%s to abs path", words); + printf("failed to parse relative path:%s to abs path\n", words); return -1; } - printf("parse relative path:%s to abs path:%s", words, pwordexp->wordPos); + printf("parse relative path:%s to abs path:%s\n", words, pwordexp->wordPos); return 0; } diff --git a/source/os/src/osFile.c b/source/os/src/osFile.c index 786e58a6d261fb5eca7f4d0ecedaf9336e5f6bb1..d378b5234aedb6d8e520a7ca6781a17826def3bc 100644 --- a/source/os/src/osFile.c +++ b/source/os/src/osFile.c @@ -22,20 +22,6 @@ #define W_OK 2 #define R_OK 4 -#if defined(_MSDOS) -#define open _open -#endif - -#if defined(_WIN32) -extern int openA(const char *, int, ...); /* MsvcLibX ANSI version of open */ -extern int openU(const char *, int, ...); /* MsvcLibX UTF-8 version of open */ -#if defined(_UTF8_SOURCE) || defined(_BSD_SOURCE) || defined(_GNU_SOURCE) -#define open openU -#else /* _ANSI_SOURCE */ -#define open openA -#endif /* defined(_UTF8_SOURCE) */ -#endif /* defined(_WIN32) */ - #define _SEND_FILE_STEP_ 1000 #else @@ -228,9 +214,6 @@ int32_t taosDevInoFile(const char *path, int64_t *stDev, int64_t *stIno) { void autoDelFileListAdd(const char *path) { return; } TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) { -#ifdef WINDOWS - return NULL; -#else int fd = -1; FILE *fp = NULL; if (tdFileOptions & TD_FILE_STREAM) { @@ -263,7 +246,11 @@ TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) { access |= (tdFileOptions & TD_FILE_APPEND) ? O_APPEND : 0; access |= (tdFileOptions & TD_FILE_TEXT) ? O_TEXT : 0; access |= (tdFileOptions & TD_FILE_EXCL) ? O_EXCL : 0; + #ifdef WINDOWS + fd = _open(path, access, _S_IREAD|_S_IWRITE); + #else fd = open(path, access, S_IRWXU | S_IRWXG | S_IRWXO); + #endif if (fd == -1) { return NULL; } @@ -286,7 +273,6 @@ TdFilePtr taosOpenFile(const char *path, int32_t tdFileOptions) { pFile->fp = fp; pFile->refId = 0; return pFile; -#endif } int64_t taosCloseFile(TdFilePtr *ppFile) { diff --git a/source/os/src/osSysinfo.c b/source/os/src/osSysinfo.c index ccc302e6467770f946e8a9031c63d330d185b73e..3c3612854c8a6bf8f943e55261fd61aeff340394 100644 --- a/source/os/src/osSysinfo.c +++ b/source/os/src/osSysinfo.c @@ -866,6 +866,16 @@ void taosSetCoreDump(bool enable) { SysNameInfo taosGetSysNameInfo() { #ifdef WINDOWS + SysNameInfo info = {0}; + DWORD dwVersion = GetVersion(); + + tstrncpy(info.sysname, getenv("OS"), sizeof(info.sysname)); + tstrncpy(info.nodename, getenv("COMPUTERNAME"), sizeof(info.nodename)); + sprintf_s(info.release, sizeof(info.release), "%d", dwVersion & 0x0F); + sprintf_s(info.version, sizeof(info.release), "%d", (dwVersion >> 8) & 0x0F); + tstrncpy(info.machine, getenv("PROCESSOR_ARCHITECTURE"), sizeof(info.machine)); + + return info; #elif defined(_TD_DARWIN_64) SysNameInfo info = {0}; diff --git a/source/util/src/tconfig.c b/source/util/src/tconfig.c index cb9ef8770125988d5e5e7101be4375576f166fae..8f48e0585e79294dd65649a37a12a2fbcb17beb4 100644 --- a/source/util/src/tconfig.c +++ b/source/util/src/tconfig.c @@ -687,13 +687,13 @@ int32_t cfgLoadFromEnvFile(SConfig *pConfig, const char *envFile) { const char *filepath = ".env"; if (envFile != NULL && strlen(envFile)>0) { if (!taosCheckExistFile(envFile)) { - uError("fial to load env file: %s", envFile); + uError("failed to load env file: %s", envFile); return -1; } filepath = envFile; }else { if (!taosCheckExistFile(filepath)) { - uInfo("fial to load env file: %s", filepath); + uInfo("failed to load env file: %s", filepath); return 0; } } @@ -826,7 +826,7 @@ int32_t cfgLoadFromApollUrl(SConfig *pConfig, const char *url) { if (strncmp(url, "jsonFile", 8) == 0) { char *filepath = p; if (!taosCheckExistFile(filepath)) { - uError("fial to load json file: %s", filepath); + uError("failed to load json file: %s", filepath); return -1; } @@ -957,13 +957,13 @@ int32_t cfgGetApollUrl(const char **envCmd, const char *envFile, char* apolloUrl const char *filepath = ".env"; if (envFile != NULL && strlen(envFile)>0) { if (!taosCheckExistFile(envFile)) { - uError("fial to load env file: %s", envFile); + uError("failed to load env file: %s", envFile); return -1; } filepath = envFile; }else { if (!taosCheckExistFile(filepath)) { - uInfo("fial to load env file: %s", filepath); + uInfo("failed to load env file: %s", filepath); return 0; } }