提交 5cdfc49b 编写于 作者: H Hongze Cheng

more TDB

上级 ec3cb6fd
...@@ -233,10 +233,13 @@ static int tdbBtCursorMoveTo(SBtCursor *pCur, const void *pKey, int kLen, int *p ...@@ -233,10 +233,13 @@ static int tdbBtCursorMoveTo(SBtCursor *pCur, const void *pKey, int kLen, int *p
c = pBt->kcmpr(pKey, kLen, cd.pKey, cd.kLen); c = pBt->kcmpr(pKey, kLen, cd.pKey, cd.kLen);
if (c < 0) { if (c < 0) {
/* TODO */ /* TODO */
ASSERT(0);
} else if (c > 0) { } else if (c > 0) {
/* TODO */ /* TODO */
ASSERT(0);
} else { } else {
/* TODO */ /* TODO */
ASSERT(0);
} }
} }
} }
...@@ -797,9 +800,7 @@ static int tdbBtreeDecodePayload(SPage *pPage, const u8 *pPayload, SCellDecoder ...@@ -797,9 +800,7 @@ static int tdbBtreeDecodePayload(SPage *pPage, const u8 *pPayload, SCellDecoder
if (!pDecoder->pVal) { if (!pDecoder->pVal) {
pDecoder->pVal = (void *)(pPayload + pDecoder->kLen); pDecoder->pVal = (void *)(pPayload + pDecoder->kLen);
} }
} } else {
{
// TODO: handle overflow case // TODO: handle overflow case
ASSERT(0); ASSERT(0);
} }
......
...@@ -62,19 +62,20 @@ static inline int tdbGetVarInt(const u8 *p, int *v) { ...@@ -62,19 +62,20 @@ static inline int tdbGetVarInt(const u8 *p, int *v) {
int tv = 0; int tv = 0;
for (;;) { for (;;) {
if (p[n] & 0x80 == 0) { if (p[n] <= 0x7f) {
tv = (tv << 7) & p[n]; tv = (tv << 7) | p[n];
n++; n++;
break; break;
} }
tv = (tv << 7) & (p[n] & 0x7f); tv = (tv << 7) | (p[n] & 0x7f);
n++; n++;
} }
ASSERT(n < 6); ASSERT(n < 6);
return 0; *v = tv;
return n;
} }
#ifdef __cplusplus #ifdef __cplusplus
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册