diff --git a/src/inc/ihash.h b/src/inc/ihash.h index 8d9ad76e6f..9623f95bbd 100644 --- a/src/inc/ihash.h +++ b/src/inc/ihash.h @@ -22,17 +22,17 @@ extern "C" { #include -void *taosInitIntHash(int32_t maxSessions, int32_t dataSize, int32_t (*fp)(void *, int32_t)); +void *taosInitIntHash(int32_t maxSessions, int32_t dataSize, int32_t (*fp)(void *, uint64_t)); void taosCleanUpIntHash(void *handle); -char *taosGetIntHashData(void *handle, int32_t key); +char *taosGetIntHashData(void *handle, uint64_t key); -void taosDeleteIntHash(void *handle, int32_t key); +void taosDeleteIntHash(void *handle, uint64_t key); -char *taosAddIntHash(void *handle, int32_t key, char *pData); +char *taosAddIntHash(void *handle, uint64_t key, char *pData); -int32_t taosHashInt(void *handle, int32_t key); +int32_t taosHashInt(void *handle, uint64_t key); #ifdef __cplusplus } diff --git a/src/util/src/ihash.c b/src/util/src/ihash.c index a10a2d5bf7..200afaa002 100644 --- a/src/util/src/ihash.c +++ b/src/util/src/ihash.c @@ -23,7 +23,7 @@ #include "os.h" typedef struct _str_node_t { - int32_t key; + uint64_t key; struct _str_node_t *prev; struct _str_node_t *next; char data[]; @@ -33,18 +33,18 @@ typedef struct { IHashNode **hashList; int32_t maxSessions; int32_t dataSize; - int32_t (*hashFp)(void *, int32_t key); + int32_t (*hashFp)(void *, uint64_t key); pthread_mutex_t mutex; } IHashObj; -int32_t taosHashInt(void *handle, int32_t key) { +int32_t taosHashInt(void *handle, uint64_t key) { IHashObj *pObj = (IHashObj *)handle; int32_t hash = 0; hash = key % pObj->maxSessions; return hash; } -char *taosAddIntHash(void *handle, int32_t key, char *pData) { +char *taosAddIntHash(void *handle, uint64_t key, char *pData) { int32_t hash; IHashNode *pNode; IHashObj * pObj; @@ -75,7 +75,7 @@ char *taosAddIntHash(void *handle, int32_t key, char *pData) { return (char *)pNode->data; } -void taosDeleteIntHash(void *handle, int32_t key) { +void taosDeleteIntHash(void *handle, uint64_t key) { int32_t hash; IHashNode *pNode; IHashObj * pObj; @@ -111,7 +111,7 @@ void taosDeleteIntHash(void *handle, int32_t key) { pthread_mutex_unlock(&pObj->mutex); } -char *taosGetIntHashData(void *handle, int32_t key) { +char *taosGetIntHashData(void *handle, uint64_t key) { int32_t hash; IHashNode *pNode; IHashObj * pObj; @@ -140,7 +140,7 @@ char *taosGetIntHashData(void *handle, int32_t key) { return NULL; } -void *taosInitIntHash(int32_t maxSessions, int32_t dataSize, int32_t (*fp)(void *, int32_t)) { +void *taosInitIntHash(int32_t maxSessions, int32_t dataSize, int32_t (*fp)(void *, uint64_t)) { IHashObj *pObj; pObj = (IHashObj *)malloc(sizeof(IHashObj));