From 2d4cd0fd449c0fb4e50a01e963ae229a05b95af7 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Tue, 4 Aug 2020 12:00:08 +0800 Subject: [PATCH] fix part of compile error on windows --- src/util/inc/tcoding.h | 10 +++++----- src/util/src/tkvstore.c | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/util/inc/tcoding.h b/src/util/inc/tcoding.h index 907c69bf01..9300094e35 100644 --- a/src/util/inc/tcoding.h +++ b/src/util/inc/tcoding.h @@ -196,14 +196,14 @@ static FORCE_INLINE void *taosDecodeFixedI64(void *buf, int64_t *value) { static FORCE_INLINE int taosEncodeVariantU16(void **buf, uint16_t value) { int i = 0; while (value >= ENCODE_LIMIT) { - if (buf != NULL) ((uint8_t *)(*buf))[i] = (value | ENCODE_LIMIT); + if (buf != NULL) ((uint8_t *)(*buf))[i] = (uint8_t)(value | ENCODE_LIMIT); value >>= 7; i++; ASSERT(i < 3); } if (buf != NULL) { - ((uint8_t *)(*buf))[i] = value; + ((uint8_t *)(*buf))[i] = (uint8_t)value; *buf = POINTER_SHIFT(*buf, i + 1); } @@ -292,14 +292,14 @@ static FORCE_INLINE void *taosDecodeVariantI32(void *buf, int32_t *value) { static FORCE_INLINE int taosEncodeVariantU64(void **buf, uint64_t value) { int i = 0; while (value >= ENCODE_LIMIT) { - if (buf != NULL) ((uint8_t *)(*buf))[i] = (value | ENCODE_LIMIT); + if (buf != NULL) ((uint8_t *)(*buf))[i] = (uint8_t)(value | ENCODE_LIMIT); value >>= 7; i++; ASSERT(i < 10); } if (buf != NULL) { - ((uint8_t *)(*buf))[i] = value; + ((uint8_t *)(*buf))[i] = (uint8_t)value; *buf = POINTER_SHIFT(*buf, i + 1); } @@ -346,7 +346,7 @@ static FORCE_INLINE int taosEncodeString(void **buf, char *value) { memcpy(*buf, value, size); *buf = POINTER_SHIFT(*buf, size); } - tlen += size; + tlen += (int)size; return tlen; } diff --git a/src/util/src/tkvstore.c b/src/util/src/tkvstore.c index edcf9d45f2..3090b7e30b 100644 --- a/src/util/src/tkvstore.c +++ b/src/util/src/tkvstore.c @@ -286,7 +286,7 @@ int tdDropKVStoreRecord(SKVStore *pStore, uint64_t uid) { return -1; } - pStore->info.magic = taosCalcChecksum(pStore->info.magic, (uint8_t *)buf, POINTER_DISTANCE(pBuf, buf)); + pStore->info.magic = taosCalcChecksum(pStore->info.magic, (uint8_t *)buf, (uint32_t)POINTER_DISTANCE(pBuf, buf)); pStore->info.size += POINTER_DISTANCE(pBuf, buf); pStore->info.nDels++; pStore->info.nRecords--; @@ -485,7 +485,7 @@ static void *tdDecodeKVRecord(void *buf, SKVRecord *pRecord) { static int tdRestoreKVStore(SKVStore *pStore) { char tbuf[128] = "\0"; void * buf = NULL; - int maxBufSize = 0; + int64_t maxBufSize = 0; SKVRecord rInfo = {0}; SHashMutableIterator *pIter = NULL; @@ -564,7 +564,7 @@ static int tdRestoreKVStore(SKVStore *pStore) { } if (pStore->iFunc) { - if ((*pStore->iFunc)(pStore->appH, buf, pRecord->size) < 0) { + if ((*pStore->iFunc)(pStore->appH, buf, (int)pRecord->size) < 0) { uError("failed to restore record uid %" PRIu64 " in kv store %s at offset %" PRId64 " size %" PRId64 " since %s", pRecord->uid, pStore->fname, pRecord->offset, pRecord->size, tstrerror(terrno)); -- GitLab