diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt
index 3794a0a228ce9f5643159f7cd04d818af2b06e9f..b9b99a491075aff90db4d97f0fff3eafd6ddad46 100644
--- a/deps/CMakeLists.txt
+++ b/deps/CMakeLists.txt
@@ -7,4 +7,7 @@ ADD_SUBDIRECTORY(regex)
ADD_SUBDIRECTORY(iconv)
ADD_SUBDIRECTORY(lz4)
ADD_SUBDIRECTORY(cJson)
-ADD_SUBDIRECTORY(MQTT-C)
+
+IF (NOT TD_WINDOWS)
+ ADD_SUBDIRECTORY(MQTT-C)
+ENDIF ()
\ No newline at end of file
diff --git a/deps/iconv/CMakeLists.txt b/deps/iconv/CMakeLists.txt
index 944cb400e0c80a92f27aed159a4886ed25d9af6d..628abb13ef4e5703cf462fe8d69c4fabf8666927 100644
--- a/deps/iconv/CMakeLists.txt
+++ b/deps/iconv/CMakeLists.txt
@@ -5,5 +5,7 @@ IF (TD_WINDOWS_64)
LIST(APPEND SRC iconv.c)
LIST(APPEND SRC localcharset.c)
INCLUDE_DIRECTORIES(.)
+ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /WX-")
+ SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /WX-")
ADD_LIBRARY(iconv ${SRC})
ENDIF ()
\ No newline at end of file
diff --git a/deps/iconv/iconv.h b/deps/iconv/iconv.h
index 83358ce987d582666569fe57a6379de4d3aa5f74..a461cef544317bfcaf0e8056025a0b997c8e63fd 100644
--- a/deps/iconv/iconv.h
+++ b/deps/iconv/iconv.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2003, 2005-2006, 2008-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2003, 2005-2006, 2008-2009 Free Software Foundation, Inc.
This file is part of the GNU LIBICONV Library.
The GNU LIBICONV Library is free software; you can redistribute it
diff --git a/deps/lz4/CMakeLists.txt b/deps/lz4/CMakeLists.txt
index a142d8d468c1674509de0df8d5625d7b8938869d..d3719741218ee04c1724ebf29c63c7f5d7e943fe 100644
--- a/deps/lz4/CMakeLists.txt
+++ b/deps/lz4/CMakeLists.txt
@@ -1,4 +1,6 @@
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCE_LIST)
add_library(lz4 ${SOURCE_LIST})
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /WX-")
+SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /WX-")
target_include_directories(lz4 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc)
\ No newline at end of file
diff --git a/deps/pthread/pthread_mutex_consistent.c b/deps/pthread/pthread_mutex_consistent.c
index 3e05635007e2d42106e65ebff8b6c8cd425e53ac..2d68213ce1bd6e1e119c94dbab99dd1a5af4fc51 100644
--- a/deps/pthread/pthread_mutex_consistent.c
+++ b/deps/pthread/pthread_mutex_consistent.c
@@ -1,4 +1,4 @@
-/*
+/*
* pthread_mutex_consistent.c
*
* Description:
diff --git a/src/os/inc/osDarwin.h b/src/os/inc/osDarwin.h
index 8628a0f3ac266605d40e81cdd64b38458201b3e5..c1a950fbe6375b14e3cf25277eb933b96e518f10 100644
--- a/src/os/inc/osDarwin.h
+++ b/src/os/inc/osDarwin.h
@@ -13,8 +13,8 @@
* along with this program. If not, see .
*/
-#ifndef TDENGINE_PLATFORM_LINUX_H
-#define TDENGINE_PLATFORM_LINUX_H
+#ifndef TDENGINE_OS_DARWIN_H
+#define TDENGINE_OS_DARWIN_H
#ifdef __cplusplus
extern "C" {
diff --git a/src/os/inc/osLinux32.h b/src/os/inc/osLinux32.h
index b62b086d0fbd6b9af7782e1339495a1cf4724809..93e917e797a60c9704726ea44d585d33d4ec102a 100644
--- a/src/os/inc/osLinux32.h
+++ b/src/os/inc/osLinux32.h
@@ -13,8 +13,8 @@
* along with this program. If not, see .
*/
-#ifndef TDENGINE_OS_LINUX64_H
-#define TDENGINE_OS_LINUX64_H
+#ifndef TDENGINE_OS_LINUX32_H
+#define TDENGINE_OS_LINUX32_H
#ifdef __cplusplus
extern "C" {
diff --git a/src/os/inc/osWindows.h b/src/os/inc/osWindows.h
index a8c2243253f7768c4682acedeaabb25b197cad55..8c5c8e9d1af3340ec8a83daac3877813ca0bd93d 100644
--- a/src/os/inc/osWindows.h
+++ b/src/os/inc/osWindows.h
@@ -13,8 +13,8 @@
* along with this program. If not, see .
*/
-#ifndef TDENGINE_PLATFORM_WINDOWS_H
-#define TDENGINE_PLATFORM_WINDOWS_H
+#ifndef TDENGINE_OS_WINDOWS_H
+#define TDENGINE_OS_WINDOWS_H
#include
#include
diff --git a/src/os/src/darwin/darwinSysInfo.c b/src/os/src/darwin/darwinSysInfo.c
index 108cc6239f82105f49ef1ada0a326e14db3233b9..f8aa02dcffd14e2def6339ccb507b9f9ab2489d1 100644
--- a/src/os/src/darwin/darwinSysInfo.c
+++ b/src/os/src/darwin/darwinSysInfo.c
@@ -41,7 +41,7 @@ static void taosGetSystemLocale() {
if (cfg_locale && cfg_locale->cfgStatus < TAOS_CFG_CSTATUS_DEFAULT) {
char *locale = setlocale(LC_CTYPE, "chs");
if (locale != NULL) {
- strncpy(tsLocale, locale, TSDB_LOCALE_LEN - 1);
+ tstrncpy(tsLocale, locale, TSDB_LOCALE_LEN);
cfg_locale->cfgStatus = TAOS_CFG_CSTATUS_DEFAULT;
uInfo("locale not configured, set to default:%s", tsLocale);
}
diff --git a/src/os/src/detail/CMakeLists.txt b/src/os/src/detail/CMakeLists.txt
index 5902a9356b834b8122fa2eee24f2ad126ce999c1..3ea7f97985f52ac96f625ba5f366441f486684a9 100644
--- a/src/os/src/detail/CMakeLists.txt
+++ b/src/os/src/detail/CMakeLists.txt
@@ -1,6 +1,12 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(TDengine)
+IF (TD_WINDOWS)
+ INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/pthread)
+ INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/iconv)
+ INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/deps/regex)
+ENDIF ()
+
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/os/inc)
INCLUDE_DIRECTORIES(${TD_COMMUNITY_DIR}/src/util/inc)
diff --git a/src/os/src/detail/osFile.c b/src/os/src/detail/osFile.c
index 516b7bb19e37452cf1aac27cd1d7e2b9f76413fe..8f055dd8129f340f267e64cdd905505a7b675a2d 100644
--- a/src/os/src/detail/osFile.c
+++ b/src/os/src/detail/osFile.c
@@ -70,7 +70,7 @@ ssize_t taosTReadImp(int fd, void *buf, size_t count) {
char * tbuf = (char *)buf;
while (leftbytes > 0) {
- readbytes = read(fd, (void *)tbuf, leftbytes);
+ readbytes = read(fd, (void *)tbuf, (uint32_t)leftbytes);
if (readbytes < 0) {
if (errno == EINTR) {
continue;
@@ -94,7 +94,7 @@ ssize_t taosTWriteImp(int fd, void *buf, size_t n) {
char * tbuf = (char *)buf;
while (nleft > 0) {
- nwritten = write(fd, (void *)tbuf, nleft);
+ nwritten = write(fd, (void *)tbuf, (uint32_t)nleft);
if (nwritten < 0) {
if (errno == EINTR) {
continue;
@@ -105,7 +105,7 @@ ssize_t taosTWriteImp(int fd, void *buf, size_t n) {
tbuf += nwritten;
}
- return n;
+ return (ssize_t)n;
}
#ifndef TAOS_OS_FUNC_FILE_SENDIFLE
diff --git a/src/os/src/detail/osRand.c b/src/os/src/detail/osRand.c
index edb8642bd65660e69deb59a61ccaf70c95f3ad8b..b322a88684e63776b432d2f4025b3d16fc614861 100644
--- a/src/os/src/detail/osRand.c
+++ b/src/os/src/detail/osRand.c
@@ -26,11 +26,11 @@ uint32_t taosSafeRand(void) {
fd = open("/dev/urandom", 0);
if (fd < 0) {
- seed = time(0);
+ seed = (int)time(0);
} else {
int len = read(fd, &seed, sizeof(seed));
if (len < 0) {
- seed = time(0);
+ seed = (int)time(0);
}
close(fd);
}
diff --git a/src/os/src/detail/osTime.c b/src/os/src/detail/osTime.c
index 6d41692d8072442bafead45d082038e4910ba136..ced1643d2b5eae25f64aa88aa7fe1720508c834b 100644
--- a/src/os/src/detail/osTime.c
+++ b/src/os/src/detail/osTime.c
@@ -165,7 +165,7 @@ int32_t parseTimezone(char* str, int64_t* tzOffset) {
char* sep = strchr(&str[i], ':');
if (sep != NULL) {
- int32_t len = sep - &str[i];
+ int32_t len = (int32_t)(sep - &str[i]);
hour = strnatoi(&str[i], len);
i += len + 1;
@@ -212,7 +212,8 @@ int32_t parseTimeWithTz(char* timestr, int64_t* time, int32_t timePrec) {
/* mktime will be affected by TZ, set by using taos_options */
#ifdef WINDOWS
- int64_t seconds = gmtime(&tm);
+ int64_t seconds = user_mktime64(tm.tm_year+1900, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
+ //int64_t seconds = gmtime(&tm);
#else
int64_t seconds = timegm(&tm);
#endif
diff --git a/src/os/src/windows/w64File.c b/src/os/src/windows/w64File.c
index f2c59c3639ead8e980d0bf1ce9c7a43c8dbb629b..d75549b37753accd6b45df8fa27d41f9b83af18c 100644
--- a/src/os/src/windows/w64File.c
+++ b/src/os/src/windows/w64File.c
@@ -15,6 +15,7 @@
#define _DEFAULT_SOURCE
#include "os.h"
+#include "tulog.h"
void taosGetTmpfilePath(const char *fileNamePrefix, char *dstPath) {
const char* tdengineTmpFileNamePrefix = "tdengine-";
diff --git a/src/os/src/windows/w64Socket.c b/src/os/src/windows/w64Socket.c
index cdf46825e8c481a726b264447664ab881ced8a7d..dbe501b6454000adf8e250e0acfbed980ac55785 100644
--- a/src/os/src/windows/w64Socket.c
+++ b/src/os/src/windows/w64Socket.c
@@ -13,6 +13,7 @@
* along with this program. If not, see .
*/
+#include "os.h"
#include
#include
#include
@@ -33,7 +34,7 @@ void taosWinSocketInit() {
}
}
-int taosSetNonblocking(SOCKET sock, int on) {
+int taosSetNonblocking(int sock, int on) {
u_long mode;
if (on) {
mode = 1;
diff --git a/src/os/src/windows/w64String.c b/src/os/src/windows/w64String.c
index 8057c89a5595d1eefa87b41c760d1fa57acf0ac4..f35b2ca7168d35225d1fd85e785c88cbec246d0e 100644
--- a/src/os/src/windows/w64String.c
+++ b/src/os/src/windows/w64String.c
@@ -67,7 +67,7 @@ char *getpass(const char *prefix) {
}
char *strndup(const char *s, size_t n) {
- int len = strlen(s);
+ size_t len = strlen(s);
if (len >= n) {
len = n;
}
diff --git a/src/os/src/windows/w64Sysinfo.c b/src/os/src/windows/w64Sysinfo.c
index 0a680ac0b7d47f65017d5027569fee4f2f54f508..27869e1eec3b0c026c3a467a9e7c591053129fdf 100644
--- a/src/os/src/windows/w64Sysinfo.c
+++ b/src/os/src/windows/w64Sysinfo.c
@@ -43,7 +43,7 @@ static void taosGetSystemLocale() {
if (cfg_locale && cfg_locale->cfgStatus < TAOS_CFG_CSTATUS_DEFAULT) {
char *locale = setlocale(LC_CTYPE, "chs");
if (locale != NULL) {
- tstrncpy(tsLocale, locale, sizeof(tsLocale));
+ tstrncpy(tsLocale, locale, TSDB_LOCALE_LEN);;
cfg_locale->cfgStatus = TAOS_CFG_CSTATUS_DEFAULT;
uInfo("locale not configured, set to default:%s", tsLocale);
}