From a75dca957439825a2d800d80fa6d11b1ccd46e58 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Mon, 1 Jun 2020 12:48:42 +0800 Subject: [PATCH] [td-225] fix compare function data overflow --- src/tsdb/src/tsdbFile.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tsdb/src/tsdbFile.c b/src/tsdb/src/tsdbFile.c index bd5c20bd7a..b07f6eed7f 100644 --- a/src/tsdb/src/tsdbFile.c +++ b/src/tsdb/src/tsdbFile.c @@ -288,7 +288,11 @@ int tsdbCopyBlockDataInFile(SFile *pOutFile, SFile *pInFile, SCompInfo *pCompInf static int compFGroupKey(const void *key, const void *fgroup) { int fid = *(int *)key; SFileGroup *pFGroup = (SFileGroup *)fgroup; - return (fid - pFGroup->fileId); + if (fid == pFGroup->fileId) { + return 0; + } else { + return fid > pFGroup->fileId? 1:-1; + } } static int compFGroup(const void *arg1, const void *arg2) { -- GitLab