提交 325b2e53 编写于 作者: H Hongze Cheng

fix more

上级 7e1306a9
......@@ -155,12 +155,12 @@ static int32_t tsdbWriteFile(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64_
}
}
int64_t nRead = TMIN(PAGE_CONTENT_SIZE(pFD->szPage) - bOffset, size - n);
memcpy(pFD->pBuf + bOffset, pBuf + n, nRead);
int64_t nWrite = TMIN(PAGE_CONTENT_SIZE(pFD->szPage) - bOffset, size - n);
memcpy(pFD->pBuf + bOffset, pBuf + n, nWrite);
pgno++;
bOffset = 0;
n += nRead;
n += nWrite;
} while (n < size);
_exit:
......@@ -169,12 +169,12 @@ _exit:
static int32_t tsdbReadFile(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64_t size) {
int32_t code = 0;
int64_t n;
int64_t n = 0;
int64_t fOffset = LOGIC_TO_FILE_OFFSET(offset, pFD->szPage);
int64_t pgno = OFFSET_PGNO(fOffset, pFD->szPage);
int32_t szPgCont = PAGE_CONTENT_SIZE(pFD->szPage);
ASSERT(pgno);
ASSERT(pgno && pgno <= pFD->szFile);
if (pFD->pgno == pgno) {
int64_t bOff = fOffset % pFD->szPage;
int64_t nRead = TMIN(szPgCont - bOff, size);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册