diff --git a/src/util/inc/tcoding.h b/src/util/inc/tcoding.h index 907c69bf016f863e0e1a785209b30ce32c9c89b6..9300094e353b2010ff047eff2c55bdac5597d293 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 edcf9d45f2045bfe7fe8a745b405463cfd4416dc..3090b7e30bcc145c7f004f05db4be61059590edc 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));