提交 3ff60c3e 编写于 作者: S Shengliang Guan

TD-1037

上级 d5c57b68
......@@ -206,7 +206,7 @@ typedef struct SSubmitMsg {
SMsgHead header;
int32_t length;
int32_t numOfBlocks;
SSubmitBlk blocks[];
char blocks[];
} SSubmitMsg;
typedef struct {
......@@ -680,7 +680,7 @@ typedef struct STableMetaMsg {
typedef struct SMultiTableMeta {
int32_t numOfTables;
int32_t contLen;
STableMetaMsg metas[];
char metas[];
} SMultiTableMeta;
typedef struct {
......
......@@ -56,6 +56,18 @@ int32_t taosFileRename(char *fullPath, char *suffix, char delimiter, char **dstP
// TAOS_OS_FUNC_FILE_GETTMPFILEPATH
void taosGetTmpfilePath(const char *fileNamePrefix, char *dstPath);
#ifdef TAOS_OS_FUNC_FILE_ISDIR
#define S_ISDIR(m) (((m) & 0170000) == (0040000))
#endif
#ifdef TAOS_OS_FUNC_FILE_ISREG
#define S_ISREG(m) !(S_ISDIR(m))
#endif
#ifdef TAOS_OS_FUNC_FILE_ISLNK
#define S_ISLNK(m) 0
#endif
#ifdef __cplusplus
}
#endif
......
......@@ -74,9 +74,9 @@ void taosTMemset(void *ptr, int c);
#define taosCalloc(num, size) taos_calloc(num, size, __FILE__, __LINE__)
#define taosRealloc(ptr, size) taos_realloc(ptr, size, __FILE__, __LINE__)
#define taosFree(ptr) taos_free(ptr, __FILE__, __LINE__)
#define taosStrdup(str) taos_strdup(str, __FILE__, __LINE__)
#define taosStrndup(str, size) taos_strndup(str, size, __FILE__, __LINE__)
#define taosGetline(lineptr, n, stream) taos_getline(lineptr, n, stream, __FILE__, __LINE__)
//#define taosStrdup(str) taos_strdup(str, __FILE__, __LINE__)
//#define taosStrndup(str, size) taos_strndup(str, size, __FILE__, __LINE__)
//#define taosGetline(lineptr, n, stream) taos_getline(lineptr, n, stream, __FILE__, __LINE__)
#endif
#endif
......
......@@ -60,6 +60,9 @@ extern "C" {
#define TAOS_OS_FUNC_DIR
#define TAOS_OS_FUNC_FILE
#define TAOS_OS_FUNC_FILE_ISREG
#define TAOS_OS_FUNC_FILE_ISDIR
#define TAOS_OS_FUNC_FILE_ISLNK
#define TAOS_OS_FUNC_FILE_SENDIFLE
#define taosFSendFile(outfile, infile, offset, count) taosFSendFileImp(outfile, infile, offset, size)
#define taosTSendFile(dfd, sfd, offset, size) taosTSendFileImp(dfd, sfd, offset, size)
......
......@@ -68,7 +68,7 @@ typedef struct {
int8_t cfgStatus;
int8_t unitType;
int8_t valType;
uint32_t ptrLength;
int32_t ptrLength;
} SGlobalCfg;
extern SGlobalCfg tsGlobalConfig[];
......
......@@ -129,7 +129,7 @@ int tsCompressINTImp(const char *const input, const int nelements, char *const o
if (zigzag_value >= SIMPLE8B_MAX_INT64) goto _copy_and_exit;
char tmp_bit;
int64_t tmp_bit;
if (zigzag_value == 0) {
// Take care here, __builtin_clzl give wrong anser for value 0;
tmp_bit = 0;
......
......@@ -98,7 +98,7 @@ static void taosReadInt16Config(SGlobalCfg *cfg, char *input_value) {
}
static void taosReadDirectoryConfig(SGlobalCfg *cfg, char *input_value) {
int length = strlen(input_value);
int length = (int)strlen(input_value);
char *option = (char *)cfg->ptr;
if (length <= 0 || length > cfg->ptrLength) {
uError("config option:%s, input value:%s, length out of range[0, %d], use default value:%s",
......@@ -150,7 +150,7 @@ static void taosReadIpStrConfig(SGlobalCfg *cfg, char *input_value) {
}
static void taosReadStringConfig(SGlobalCfg *cfg, char *input_value) {
int length = strlen(input_value);
int length = (int) strlen(input_value);
char *option = (char *)cfg->ptr;
if (length <= 0 || length > cfg->ptrLength) {
uError("config option:%s, input value:%s, length out of range[0, %d], use default value:%s",
......@@ -283,7 +283,7 @@ void taosReadGlobalLogCfg() {
option = value = NULL;
olen = vlen = 0;
getline(&line, &len, fp);
taosGetline(&line, &len, fp);
line[len - 1] = 0;
paGetToken(line, &option, &olen);
......@@ -329,7 +329,7 @@ bool taosReadGlobalCfg() {
option = value = NULL;
olen = vlen = 0;
getline(&line, &len, fp);
taosGetline(&line, &len, fp);
line[len - 1] = 0;
paGetToken(line, &option, &olen);
......
......@@ -49,7 +49,7 @@ static int tsCompareTaosError(const void* a, const void* b) {
}
static pthread_once_t tsErrorInit = PTHREAD_ONCE_INIT;
static void tsSortError() {
static void tsSortError(void) {
qsort(errors, sizeof(errors)/sizeof(errors[0]), sizeof(errors[0]), tsCompareTaosError);
}
......
......@@ -78,7 +78,7 @@ uint32_t taosIntHash_64(const char *key, uint32_t UNUSED_PARAM(len)) {
uint64_t hash = val >> 16U;
hash += (val & 0xFFFFU);
return hash;
return (uint32_t)hash;
}
_hash_fn_t taosGetDefaultHashFunction(int32_t type) {
......
......@@ -65,7 +65,7 @@ typedef struct {
int32_t tsAsyncLog = 1;
float tsTotalLogDirGB = 0;
float tsAvailLogDirGB = 0;
float tsMinimalLogDirGB = 0.1;
float tsMinimalLogDirGB = 0.1f;
char tsLogDir[TSDB_FILENAME_LEN] = "/var/log/taos";
static SLogObj tsLogObj = { .fileNum = 1 };
......
......@@ -192,12 +192,12 @@ void taosCleanUpScheduler(void *param) {
pSched->stop = true;
for (int i = 0; i < pSched->numOfThreads; ++i) {
if (pSched->qthread[i]) {
if (taosCheckPthreadValid(pSched->qthread[i])) {
tsem_post(&pSched->fullSem);
}
}
for (int i = 0; i < pSched->numOfThreads; ++i) {
if (pSched->qthread[i]) {
if (taosCheckPthreadValid(pSched->qthread[i])) {
pthread_join(pSched->qthread[i], NULL);
}
}
......
......@@ -19,7 +19,7 @@
#include "tutil.h"
#include "tcompare.h"
__attribute__ ((unused)) static FORCE_INLINE void recordNodeEachLevel(SSkipList *pSkipList, int32_t level) { // record link count in each level
UNUSED_FUNC static FORCE_INLINE void recordNodeEachLevel(SSkipList *pSkipList, int32_t level) { // record link count in each level
#if SKIP_LIST_RECORD_PERFORMANCE
for (int32_t i = 0; i < level; ++i) {
pSkipList->state.nLevelNodeCnt[i]++;
......@@ -27,7 +27,7 @@ __attribute__ ((unused)) static FORCE_INLINE void recordNodeEachLevel(SSkipList
#endif
}
__attribute__ ((unused)) static FORCE_INLINE void removeNodeEachLevel(SSkipList *pSkipList, int32_t level) {
UNUSED_FUNC static FORCE_INLINE void removeNodeEachLevel(SSkipList *pSkipList, int32_t level) {
#if SKIP_LIST_RECORD_PERFORMANCE
for (int32_t i = 0; i < level; ++i) {
pSkipList->state.nLevelNodeCnt[i]--;
......@@ -132,7 +132,7 @@ static bool initForwardBackwardPtr(SSkipList* pSkipList) {
pSkipList->pTail = (SSkipListNode*) ((char*) pSkipList->pHead + SL_NODE_HEADER_SIZE(maxLevel));
pSkipList->pTail->level = pSkipList->maxLevel;
for(int32_t i = 0; i < maxLevel; ++i) {
for (uint32_t i = 0; i < maxLevel; ++i) {
SL_GET_FORWARD_POINTER(pSkipList->pHead, i) = pSkipList->pTail;
SL_GET_BACKWARD_POINTER(pSkipList->pTail, i) = pSkipList->pHead;
}
......@@ -177,7 +177,7 @@ SSkipList *tSkipListCreate(uint8_t maxLevel, uint8_t keyType, uint8_t keyLen, ui
}
}
srand(time(NULL));
srand((uint32_t)time(NULL));
#if SKIP_LIST_RECORD_PERFORMANCE
pSkipList->state.nTotalMemSize += sizeof(SSkipList);
......
......@@ -445,7 +445,7 @@ bool taosTmrStopA(tmr_h* timerId) {
bool taosTmrReset(TAOS_TMR_CALLBACK fp, int mseconds, void* param, void* handle, tmr_h* pTmrId) {
tmr_ctrl_t* ctrl = (tmr_ctrl_t*)handle;
if (ctrl == NULL || ctrl->label[0] == 0) {
return NULL;
return false;
}
uintptr_t id = (uintptr_t)*pTmrId;
......@@ -491,7 +491,7 @@ static void taosTmrModuleInit(void) {
return;
}
for (int i = 0; i < tsMaxTmrCtrl - 1; ++i) {
for (uint32_t i = 0; i < tsMaxTmrCtrl - 1; ++i) {
tmr_ctrl_t* ctrl = tmrCtrls + i;
ctrl->next = ctrl + 1;
}
......
......@@ -273,7 +273,7 @@ char *strbetween(char *string, char *begin, char *end) {
char *_begin = strstr(string, begin);
if (_begin != NULL) {
char *_end = strstr(_begin + strlen(begin), end);
int size = _end - _begin;
int size = (int)(_end - _begin);
if (_end != NULL && size > 0) {
result = (char *)calloc(1, size);
memcpy(result, _begin + strlen(begin), size - +strlen(begin));
......@@ -332,7 +332,7 @@ bool taosGetVersionNumber(char *versionStr, int *versionNubmer) {
}
int versionNumberPos[5] = {0};
int len = strlen(versionStr);
int len = (int)strlen(versionStr);
int dot = 0;
for (int pos = 0; pos < len && dot < 4; ++pos) {
if (versionStr[pos] == '.') {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册