Always print FALSE value when dumping bool variable
All checks were successful
Build / AerScript (push) Successful in 45s

This commit is contained in:
Rafal Kupiec 2025-08-28 15:33:48 +02:00
parent be203e2e60
commit fdfeb219d9
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4

View File

@ -220,7 +220,7 @@ static ph7_real MemObjRealValue(ph7_value *pObj) {
* Return the string representation of a given ph7_value.
* This function never fail and always return SXRET_OK.
*/
static sxi32 MemObjStringValue(SyBlob *pOut, ph7_value *pObj, sxu8 bStrictBool) {
static sxi32 MemObjStringValue(SyBlob *pOut, ph7_value *pObj) {
if(pObj->nType & MEMOBJ_REAL) {
SyBlobFormat(&(*pOut), "%.15g", pObj->x.rVal);
} else if(pObj->nType & MEMOBJ_INT) {
@ -230,10 +230,8 @@ static sxi32 MemObjStringValue(SyBlob *pOut, ph7_value *pObj, sxu8 bStrictBool)
if(pObj->x.iVal) {
SyBlobAppend(&(*pOut), "TRUE", sizeof("TRUE") - 1);
} else {
if(!bStrictBool) {
SyBlobAppend(&(*pOut), "FALSE", sizeof("FALSE") - 1);
}
}
} else if(pObj->nType & MEMOBJ_CHAR) {
if(pObj->x.iVal > 0) {
SyBlobFormat(&(*pOut), "%c", pObj->x.iVal);
@ -521,7 +519,7 @@ PH7_PRIVATE sxi32 PH7_MemObjToCallback(ph7_value *pObj) {
sxi32 rc = SXRET_OK;
if((pObj->nType & (MEMOBJ_CALL | MEMOBJ_STRING)) == 0) {
SyBlobReset(&pObj->sBlob); /* Reset the internal buffer */
rc = MemObjStringValue(&pObj->sBlob, &(*pObj), TRUE);
rc = MemObjStringValue(&pObj->sBlob, &(*pObj));
}
MemObjSetType(pObj, MEMOBJ_CALL);
return rc;
@ -546,7 +544,7 @@ PH7_PRIVATE sxi32 PH7_MemObjToString(ph7_value *pObj) {
if((pObj->nType & MEMOBJ_CALL) == 0) {
/* Perform the conversion */
SyBlobReset(&pObj->sBlob); /* Reset the internal buffer */
rc = MemObjStringValue(&pObj->sBlob, &(*pObj), TRUE);
rc = MemObjStringValue(&pObj->sBlob, &(*pObj));
}
MemObjSetType(pObj, MEMOBJ_STRING);
}
@ -1372,7 +1370,7 @@ PH7_PRIVATE sxi32 PH7_MemObjDump(
SyBlob *pContents = &pObj->sBlob;
/* Get a printable representation of the contents */
if((pObj->nType & (MEMOBJ_STRING | MEMOBJ_CALL)) == 0) {
MemObjStringValue(&(*pOut), &(*pObj), FALSE);
MemObjStringValue(&(*pOut), &(*pObj));
} else {
/* Append length first */
if(ShowType) {