debug importdata function

This commit is contained in:
Alexandre Bard 2021-05-31 10:52:08 +02:00
parent 73876e3f86
commit cf4bd12eeb
1 changed files with 8 additions and 0 deletions

View File

@ -518,6 +518,7 @@ bd_bool_t BD_ImportData( BD_Context* pCtx, const void* pData )
|| !pCtx->headerOk /* BD_CheckHeader() has not yet been called */ || !pCtx->headerOk /* BD_CheckHeader() has not yet been called */
) )
{ {
printf("BD_ImportData: argument check failed\n");
return BD_FALSE; return BD_FALSE;
} }
@ -539,6 +540,7 @@ bd_bool_t BD_ImportData( BD_Context* pCtx, const void* pData )
if ( (pTemp + 4) > pCtx->pDataEnd ) if ( (pTemp + 4) > pCtx->pDataEnd )
{ {
/* @@@ RS: This would be an error */ /* @@@ RS: This would be an error */
printf("BD_ImportData: reading error\n");
break; break;
} }
@ -551,6 +553,7 @@ bd_bool_t BD_ImportData( BD_Context* pCtx, const void* pData )
if ( len > BD_MAX_ENTRY_LEN ) if ( len > BD_MAX_ENTRY_LEN )
{ {
/* @@@ RS: This would be an error */ /* @@@ RS: This would be an error */
printf("BD_ImportData: len > BD_MAX_ENTRY_LEN\n");
break; break;
} }
@ -558,12 +561,14 @@ bd_bool_t BD_ImportData( BD_Context* pCtx, const void* pData )
if ( (pTemp + len) > pCtx->pDataEnd ) if ( (pTemp + len) > pCtx->pDataEnd )
{ {
/* @@@ RS: This would be an error */ /* @@@ RS: This would be an error */
printf("BD_ImportData: exceeds data buffer\n");
break; break;
} }
/* Stop if end tag found */ /* Stop if end tag found */
if ( tag == 0x0000 ) if ( tag == 0x0000 )
{ {
printf("BD_ImportData: end tag found\n");
rc = BD_TRUE; rc = BD_TRUE;
break; break;
} }
@ -588,6 +593,7 @@ bd_bool_t BD_ImportData( BD_Context* pCtx, const void* pData )
if ( tmpChecksum != pCtx->checksum ) if ( tmpChecksum != pCtx->checksum )
{ {
printf("BD_ImportData: checksum does not match\n");
/* Checksum does not match */ /* Checksum does not match */
rc = BD_FALSE; rc = BD_FALSE;
} }
@ -596,9 +602,11 @@ bd_bool_t BD_ImportData( BD_Context* pCtx, const void* pData )
if ( rc ) if ( rc )
{ {
/* Everything ok */ /* Everything ok */
printf("BD_ImportData: everything ok\n");
pCtx->initialized = BD_TRUE; pCtx->initialized = BD_TRUE;
} }
printf("BD_ImportData: not ok : %d\n", rc);
return rc; return rc;
} }