提交 ecdb23c9 编写于 作者: S Shengliang Guan

Remove warnings and adjust dependencies

上级 aa4a4d05
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _TD_UTIL_COMPARE_H #ifndef _TD_UTIL_COMPARE_H_
#define _TD_UTIL_COMPARE_H #define _TD_UTIL_COMPARE_H_
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
...@@ -35,67 +35,65 @@ extern "C" { ...@@ -35,67 +35,65 @@ extern "C" {
#define FLT_GREATEREQUAL(_x, _y) (FLT_EQUAL((_x), (_y)) || ((_x) > (_y))) #define FLT_GREATEREQUAL(_x, _y) (FLT_EQUAL((_x), (_y)) || ((_x) > (_y)))
#define FLT_LESSEQUAL(_x, _y) (FLT_EQUAL((_x), (_y)) || ((_x) < (_y))) #define FLT_LESSEQUAL(_x, _y) (FLT_EQUAL((_x), (_y)) || ((_x) < (_y)))
#define PATTERN_COMPARE_INFO_INITIALIZER { '%', '_' } #define PATTERN_COMPARE_INFO_INITIALIZER \
{ '%', '_' }
typedef struct SPatternCompareInfo { typedef struct SPatternCompareInfo {
char matchAll; // symbol for match all wildcard, default: '%' char matchAll; // symbol for match all wildcard, default: '%'
char matchOne; // symbol for match one wildcard, default: '_' char matchOne; // symbol for match one wildcard, default: '_'
} SPatternCompareInfo; } SPatternCompareInfo;
int patternMatch(const char *pattern, const char *str, size_t size, const SPatternCompareInfo *pInfo); int32_t patternMatch(const char *pattern, const char *str, size_t size, const SPatternCompareInfo *pInfo);
int WCSPatternMatch(const wchar_t *pattern, const wchar_t *str, size_t size, const SPatternCompareInfo *pInfo); int32_t WCSPatternMatch(const wchar_t *pattern, const wchar_t *str, size_t size, const SPatternCompareInfo *pInfo);
int32_t taosArrayCompareString(const void *a, const void *b);
int32_t taosArrayCompareString(const void* a, const void* b);
int32_t setCompareBytes1(const void *pLeft, const void *pRight); int32_t setCompareBytes1(const void *pLeft, const void *pRight);
int32_t setCompareBytes2(const void *pLeft, const void *pRight); int32_t setCompareBytes2(const void *pLeft, const void *pRight);
int32_t setCompareBytes4(const void *pLeft, const void *pRight); int32_t setCompareBytes4(const void *pLeft, const void *pRight);
int32_t setCompareBytes8(const void *pLeft, const void *pRight); int32_t setCompareBytes8(const void *pLeft, const void *pRight);
int32_t compareInt8Val(const void *pLeft, const void *pRight);
int32_t compareInt16Val(const void *pLeft, const void *pRight);
int32_t compareInt32Val(const void *pLeft, const void *pRight); int32_t compareInt32Val(const void *pLeft, const void *pRight);
int32_t compareInt64Val(const void *pLeft, const void *pRight); int32_t compareInt64Val(const void *pLeft, const void *pRight);
int32_t compareInt16Val(const void *pLeft, const void *pRight); int32_t compareUint8Val(const void *pLeft, const void *pRight);
int32_t compareUint16Val(const void *pLeft, const void *pRight);
int32_t compareInt8Val(const void *pLeft, const void *pRight);
int32_t compareUint32Val(const void *pLeft, const void *pRight); int32_t compareUint32Val(const void *pLeft, const void *pRight);
int32_t compareUint64Val(const void *pLeft, const void *pRight); int32_t compareUint64Val(const void *pLeft, const void *pRight);
int32_t compareUint16Val(const void *pLeft, const void *pRight);
int32_t compareUint8Val(const void* pLeft, const void* pRight);
int32_t compareFloatVal(const void *pLeft, const void *pRight); int32_t compareFloatVal(const void *pLeft, const void *pRight);
int32_t compareDoubleVal(const void *pLeft, const void *pRight); int32_t compareDoubleVal(const void *pLeft, const void *pRight);
int32_t compareLenPrefixedStr(const void *pLeft, const void *pRight); int32_t compareLenPrefixedStr(const void *pLeft, const void *pRight);
int32_t compareLenPrefixedWStr(const void *pLeft, const void *pRight); int32_t compareLenPrefixedWStr(const void *pLeft, const void *pRight);
int32_t compareStrRegexComp(const void* pLeft, const void* pRight);
int32_t compareStrRegexCompMatch(const void* pLeft, const void* pRight); int32_t compareStrRegexComp(const void *pLeft, const void *pRight);
int32_t compareStrRegexCompNMatch(const void* pLeft, const void* pRight); int32_t compareStrRegexCompMatch(const void *pLeft, const void *pRight);
int32_t compareFindItemInSet(const void *pLeft, const void* pRight); int32_t compareStrRegexCompNMatch(const void *pLeft, const void *pRight);
int32_t compareFindItemInSet(const void *pLeft, const void *pRight);
int32_t compareInt8ValDesc(const void *pLeft, const void *pRight); int32_t compareInt8ValDesc(const void *pLeft, const void *pRight);
int32_t compareInt16ValDesc(const void* pLeft, const void* pRight); int32_t compareInt16ValDesc(const void *pLeft, const void *pRight);
int32_t compareInt32ValDesc(const void* pLeft, const void* pRight); int32_t compareInt32ValDesc(const void *pLeft, const void *pRight);
int32_t compareInt64ValDesc(const void* pLeft, const void* pRight); int32_t compareInt64ValDesc(const void *pLeft, const void *pRight);
int32_t compareFloatValDesc(const void* pLeft, const void* pRight);
int32_t compareDoubleValDesc(const void* pLeft, const void* pRight); int32_t compareFloatValDesc(const void *pLeft, const void *pRight);
int32_t compareUint8ValDesc(const void* pLeft, const void* pRight); int32_t compareDoubleValDesc(const void *pLeft, const void *pRight);
int32_t compareUint16ValDesc(const void* pLeft, const void* pRight);
int32_t compareUint32ValDesc(const void* pLeft, const void* pRight); int32_t compareUint8ValDesc(const void *pLeft, const void *pRight);
int32_t compareUint64ValDesc(const void* pLeft, const void* pRight); int32_t compareUint16ValDesc(const void *pLeft, const void *pRight);
int32_t compareLenPrefixedStrDesc(const void* pLeft, const void* pRight); int32_t compareUint32ValDesc(const void *pLeft, const void *pRight);
int32_t compareLenPrefixedWStrDesc(const void* pLeft, const void* pRight); int32_t compareUint64ValDesc(const void *pLeft, const void *pRight);
int32_t compareLenPrefixedStrDesc(const void *pLeft, const void *pRight);
int32_t compareLenPrefixedWStrDesc(const void *pLeft, const void *pRight);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /*_TD_UTIL_COMPARE_H*/ #endif /*_TD_UTIL_COMPARE_H_*/
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
#define _GNU_SOURCE #define _GNU_SOURCE
#define _XOPEN_SOURCE #define _XOPEN_SOURCE
#define _DEFAULT_SOURCE #define _DEFAULT_SOURCE
#include "os.h" #include "os.h"
#include "types.h"
#include "compare.h" #include "compare.h"
#include "ulog.h"
#include "thash.h"
#include "regex.h" #include "regex.h"
#include "thash.h"
#include "types.h"
#include "ulog.h"
int32_t setCompareBytes1(const void *pLeft, const void *pRight) { int32_t setCompareBytes1(const void *pLeft, const void *pRight) {
return NULL != taosHashGet((SHashObj *)pRight, pLeft, 1) ? 1 : 0; return NULL != taosHashGet((SHashObj *)pRight, pLeft, 1) ? 1 : 0;
...@@ -228,7 +228,7 @@ int32_t compareLenPrefixedWStrDesc(const void* pLeft, const void* pRight) { ...@@ -228,7 +228,7 @@ int32_t compareLenPrefixedWStrDesc(const void* pLeft, const void* pRight) {
* '_': Matches one character * '_': Matches one character
* *
*/ */
int patternMatch(const char *patterStr, const char *str, size_t size, const SPatternCompareInfo *pInfo) { int32_t patternMatch(const char *patterStr, const char *str, size_t size, const SPatternCompareInfo *pInfo) {
char c, c1; char c, c1;
int32_t i = 0; int32_t i = 0;
...@@ -289,7 +289,7 @@ int patternMatch(const char *patterStr, const char *str, size_t size, const SPat ...@@ -289,7 +289,7 @@ int patternMatch(const char *patterStr, const char *str, size_t size, const SPat
return (str[j] == 0 || j >= size) ? TSDB_PATTERN_MATCH : TSDB_PATTERN_NOMATCH; return (str[j] == 0 || j >= size) ? TSDB_PATTERN_MATCH : TSDB_PATTERN_NOMATCH;
} }
int WCSPatternMatch(const wchar_t *patterStr, const wchar_t *str, size_t size, const SPatternCompareInfo *pInfo) { int32_t WCSPatternMatch(const wchar_t *patterStr, const wchar_t *str, size_t size, const SPatternCompareInfo *pInfo) {
wchar_t c, c1; wchar_t c, c1;
wchar_t matchOne = L'_'; // "_" wchar_t matchOne = L'_'; // "_"
wchar_t matchAll = L'%'; // "%" wchar_t matchAll = L'%'; // "%"
...@@ -360,11 +360,11 @@ int32_t compareStrRegexComp(const void* pLeft, const void* pRight) { ...@@ -360,11 +360,11 @@ int32_t compareStrRegexComp(const void* pLeft, const void* pRight) {
memcpy(str, varDataVal(pLeft), sz); memcpy(str, varDataVal(pLeft), sz);
str[sz] = 0; str[sz] = 0;
int errCode = 0; int32_t errCode = 0;
regex_t regex; regex_t regex;
char msgbuf[256] = {0}; char msgbuf[256] = {0};
int cflags = REG_EXTENDED; int32_t cflags = REG_EXTENDED;
if ((errCode = regcomp(&regex, pattern, cflags)) != 0) { if ((errCode = regcomp(&regex, pattern, cflags)) != 0) {
regerror(errCode, &regex, msgbuf, sizeof(msgbuf)); regerror(errCode, &regex, msgbuf, sizeof(msgbuf));
uError("Failed to compile regex pattern %s. reason %s", pattern, msgbuf); uError("Failed to compile regex pattern %s. reason %s", pattern, msgbuf);
......
...@@ -13,11 +13,13 @@ ...@@ -13,11 +13,13 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "tskiplist.h"
#include "os.h" #include "os.h"
#include "compare.h" #include "compare.h"
#include "ulog.h" #include "tskiplist.h"
#include "tutil.h" #include "tutil.h"
#include "ulog.h"
static int initForwardBackwardPtr(SSkipList *pSkipList); static int initForwardBackwardPtr(SSkipList *pSkipList);
static SSkipListNode * getPriorNode(SSkipList *pSkipList, const char *val, int32_t order, SSkipListNode **pCur); static SSkipListNode * getPriorNode(SSkipList *pSkipList, const char *val, int32_t order, SSkipListNode **pCur);
...@@ -52,11 +54,17 @@ SSkipList *tSkipListCreate(uint8_t maxLevel, uint8_t keyType, uint16_t keyLen, _ ...@@ -52,11 +54,17 @@ SSkipList *tSkipListCreate(uint8_t maxLevel, uint8_t keyType, uint16_t keyLen, _
pSkipList->flags = flags; pSkipList->flags = flags;
pSkipList->keyFn = fn; pSkipList->keyFn = fn;
pSkipList->seed = rand(); pSkipList->seed = rand();
#if 0
// the function getkeycomparfunc is defined in common
if (comparFn == NULL) { if (comparFn == NULL) {
pSkipList->comparFn = getKeyComparFunc(keyType, TSDB_ORDER_ASC); pSkipList->comparFn = getKeyComparFunc(keyType, TSDB_ORDER_ASC);
} else { } else {
pSkipList->comparFn = comparFn; pSkipList->comparFn = comparFn;
} }
#else
pSkipList->comparFn = comparFn;
#endif
if (initForwardBackwardPtr(pSkipList) < 0) { if (initForwardBackwardPtr(pSkipList) < 0) {
tSkipListDestroy(pSkipList); tSkipListDestroy(pSkipList);
......
...@@ -182,7 +182,7 @@ void *threadFunc(void *param) { ...@@ -182,7 +182,7 @@ void *threadFunc(void *param) {
exit(1); exit(1);
} }
pError("====before thread:%d, table range: %"PRId64 " - %"PRId64 "\n", pPrint("====before thread:%d, table range: %"PRId64 " - %"PRId64 "\n",
pInfo->threadIndex, pInfo->threadIndex,
pInfo->tableBeginIndex, pInfo->tableBeginIndex,
pInfo->tableEndIndex); pInfo->tableEndIndex);
...@@ -190,7 +190,7 @@ void *threadFunc(void *param) { ...@@ -190,7 +190,7 @@ void *threadFunc(void *param) {
pInfo->tableBeginIndex += startOffset; pInfo->tableBeginIndex += startOffset;
pInfo->tableEndIndex += startOffset; pInfo->tableEndIndex += startOffset;
pError("====after thread:%d, table range: %"PRId64 " - %"PRId64 "\n", pPrint("====after thread:%d, table range: %"PRId64 " - %"PRId64 "\n",
pInfo->threadIndex, pInfo->threadIndex,
pInfo->tableBeginIndex, pInfo->tableBeginIndex,
pInfo->tableEndIndex); pInfo->tableEndIndex);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册