diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt
index 3794a0a228..b9b99a4910 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 944cb400e0..628abb13ef 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 83358ce987..a461cef544 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 a142d8d468..d371974121 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 3e05635007..2d68213ce1 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 8628a0f3ac..c1a950fbe6 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 b62b086d0f..93e917e797 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 a8c2243253..8c5c8e9d1a 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 108cc6239f..f8aa02dcff 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 5902a9356b..3ea7f97985 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 516b7bb19e..8f055dd812 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 edb8642bd6..b322a88684 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 6d41692d80..ced1643d2b 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 f2c59c3639..d75549b377 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 cdf46825e8..dbe501b645 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 8057c89a55..f35b2ca716 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 0a680ac0b7..27869e1eec 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);
}