fix more
This commit is contained in:
parent
7e1306a976
commit
325b2e5327
|
@ -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);
|
int64_t nWrite = TMIN(PAGE_CONTENT_SIZE(pFD->szPage) - bOffset, size - n);
|
||||||
memcpy(pFD->pBuf + bOffset, pBuf + n, nRead);
|
memcpy(pFD->pBuf + bOffset, pBuf + n, nWrite);
|
||||||
|
|
||||||
pgno++;
|
pgno++;
|
||||||
bOffset = 0;
|
bOffset = 0;
|
||||||
n += nRead;
|
n += nWrite;
|
||||||
} while (n < size);
|
} while (n < size);
|
||||||
|
|
||||||
_exit:
|
_exit:
|
||||||
|
@ -169,12 +169,12 @@ _exit:
|
||||||
|
|
||||||
static int32_t tsdbReadFile(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64_t size) {
|
static int32_t tsdbReadFile(STsdbFD *pFD, int64_t offset, uint8_t *pBuf, int64_t size) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
int64_t n;
|
int64_t n = 0;
|
||||||
int64_t fOffset = LOGIC_TO_FILE_OFFSET(offset, pFD->szPage);
|
int64_t fOffset = LOGIC_TO_FILE_OFFSET(offset, pFD->szPage);
|
||||||
int64_t pgno = OFFSET_PGNO(fOffset, pFD->szPage);
|
int64_t pgno = OFFSET_PGNO(fOffset, pFD->szPage);
|
||||||
int32_t szPgCont = PAGE_CONTENT_SIZE(pFD->szPage);
|
int32_t szPgCont = PAGE_CONTENT_SIZE(pFD->szPage);
|
||||||
|
|
||||||
ASSERT(pgno);
|
ASSERT(pgno && pgno <= pFD->szFile);
|
||||||
if (pFD->pgno == pgno) {
|
if (pFD->pgno == pgno) {
|
||||||
int64_t bOff = fOffset % pFD->szPage;
|
int64_t bOff = fOffset % pFD->szPage;
|
||||||
int64_t nRead = TMIN(szPgCont - bOff, size);
|
int64_t nRead = TMIN(szPgCont - bOff, size);
|
||||||
|
|
Loading…
Reference in New Issue