cmData.c : Minor bug fixes to complete initial testing of cmDataParser.
This commit is contained in:
parent
ead258c822
commit
fd56025468
28
cmData.c
28
cmData.c
@ -1373,8 +1373,7 @@ bool _cmDataPairIsValid( const cmData_t* p )
|
|||||||
{
|
{
|
||||||
assert( p->tid == kPairDtId );
|
assert( p->tid == kPairDtId );
|
||||||
|
|
||||||
const cmData_t* cp = p->u.child;
|
bool fl = p->u.child == NULL || p->u.child->sibling == NULL || p->u.child->sibling->sibling!=NULL;
|
||||||
bool fl = cp->u.child == NULL || cp->u.child->sibling == NULL || cp->u.child->sibling->sibling!=NULL;
|
|
||||||
return !fl;
|
return !fl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2194,7 +2193,7 @@ char* _cmDataSerializeWrite( cmData_t* np, char* dp, const char* ep )
|
|||||||
|
|
||||||
char* _cmDataSerialize( const cmData_t* p, char* buf, const char* ep )
|
char* _cmDataSerialize( const cmData_t* p, char* buf, const char* ep )
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
buf = _cmDataSerializeWrite(p,buf,ep);
|
buf = _cmDataSerializeWrite(p,buf,ep);
|
||||||
|
|
||||||
// if this data type has a child then write the child
|
// if this data type has a child then write the child
|
||||||
@ -2207,13 +2206,17 @@ char* _cmDataSerialize( const cmData_t* p, char* buf, const char* ep )
|
|||||||
buf = cmDataSerialize(dp->sibling,buf,ep);
|
buf = cmDataSerialize(dp->sibling,buf,ep);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
|
*/
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmDtRC_t cmDataSerialize( const cmData_t* p, void* buf, unsigned bufByteCnt )
|
cmDtRC_t cmDataSerialize( const cmData_t* p, void* buf, unsigned bufByteCnt )
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
const char* ep = (char*)p + bufByteCnt;
|
const char* ep = (char*)p + bufByteCnt;
|
||||||
buf = _cmDataSerialize(p,buf,bufByteCnt);
|
buf = _cmDataSerialize(p,buf,bufByteCnt);
|
||||||
assert( buf <= ep );
|
assert( buf <= ep );
|
||||||
|
*/
|
||||||
return kOkDtRC;
|
return kOkDtRC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2283,6 +2286,8 @@ cmDtRC_t _cmDataParserDestroy( cmDataParser_t* p )
|
|||||||
if( cmStackFree(&p->stH) != kOkStRC )
|
if( cmStackFree(&p->stH) != kOkStRC )
|
||||||
cmErrMsg(&p->err,kParseStackFailDtRC,"The data object parser stack release failed.");
|
cmErrMsg(&p->err,kParseStackFailDtRC,"The data object parser stack release failed.");
|
||||||
|
|
||||||
|
cmMemFree(p);
|
||||||
|
|
||||||
return kOkDtRC;
|
return kOkDtRC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2717,11 +2722,10 @@ cmDtRC_t _cmDataParserOnComma( cmDataParserCtx_t* c )
|
|||||||
|
|
||||||
cmDtRC_t cmDataParserExec( cmDataParserH_t h, const cmChar_t* text, cmData_t** pp )
|
cmDtRC_t cmDataParserExec( cmDataParserH_t h, const cmChar_t* text, cmData_t** pp )
|
||||||
{
|
{
|
||||||
cmDtRC_t rc = kOkDtRC;
|
cmDtRC_t rc = kOkDtRC;
|
||||||
unsigned tokenId;
|
cmDataParser_t* p = _cmDataParserHandleToPtr(h);
|
||||||
|
unsigned tokenId;
|
||||||
cmDataParserCtx_t ctx;
|
cmDataParserCtx_t ctx;
|
||||||
cmDataParser_t* p = _cmDataParserHandleToPtr(h);
|
|
||||||
|
|
||||||
ctx.cnp = NULL; // current node ptr
|
ctx.cnp = NULL; // current node ptr
|
||||||
ctx.p = p;
|
ctx.p = p;
|
||||||
@ -2799,6 +2803,10 @@ cmDtRC_t cmDataParserExec( cmDataParserH_t h, const cmChar_t* text, cmData_t** p
|
|||||||
}
|
}
|
||||||
|
|
||||||
errLabel:
|
errLabel:
|
||||||
|
|
||||||
|
if( rc == kOkDtRC )
|
||||||
|
*pp = ctx.cnp;
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2919,9 +2927,9 @@ cmDtRC_t cmDataParserTest( cmCtx_t* ctx )
|
|||||||
if( cmDataParserExec(h,text,&dp) != kOkDtRC )
|
if( cmDataParserExec(h,text,&dp) != kOkDtRC )
|
||||||
rc = cmErrMsg(&err,rc,"Data parser exec failed.");
|
rc = cmErrMsg(&err,rc,"Data parser exec failed.");
|
||||||
else
|
else
|
||||||
{
|
if( dp != NULL )
|
||||||
cmDataPrint(dp,&ctx->rpt);
|
cmDataPrint(dp,&ctx->rpt);
|
||||||
}
|
|
||||||
|
|
||||||
errLabel:
|
errLabel:
|
||||||
if( cmDataParserDestroy( &h ) != kOkDtRC )
|
if( cmDataParserDestroy( &h ) != kOkDtRC )
|
||||||
|
Loading…
Reference in New Issue
Block a user