Browse Source

Fix PH7_CheckVarCompat(). Array can be assigned only to array.

pull/50/head
Rafal Kupiec 3 years ago
parent
commit
891818d601
Signed by: belliash GPG Key ID: 4E829243E0CFE6B4
  1. 20
      engine/memobj.c

20
engine/memobj.c

@ -363,17 +363,19 @@ static ph7_real MemObjCharValue(ph7_value *pObj) {
* Checks a ph7_value variable compatibility with nType data type.
*/
PH7_PRIVATE sxi32 PH7_CheckVarCompat(ph7_value *pObj, int nType) {
if(nType == MEMOBJ_REAL && (pObj->iFlags & MEMOBJ_INT)) {
return SXRET_OK;
} else if(nType == MEMOBJ_CHAR && (pObj->iFlags & MEMOBJ_INT)) {
return SXRET_OK;
} else if(nType == MEMOBJ_CHAR && (pObj->iFlags & MEMOBJ_STRING)) {
int len = SyBlobLength(&pObj->sBlob);
if(len == 0 || len == 1) {
if(((nType & MEMOBJ_HASHMAP) && (pObj->iFlags & MEMOBJ_HASHMAP)) || (((nType & MEMOBJ_HASHMAP) == 0) && ((pObj->iFlags & MEMOBJ_HASHMAP) == 0))) {
if((nType & MEMOBJ_REAL) && (pObj->iFlags & MEMOBJ_INT)) {
return SXRET_OK;
} else if((nType & MEMOBJ_CHAR) && (pObj->iFlags & MEMOBJ_INT)) {
return SXRET_OK;
} else if((nType & MEMOBJ_CHAR) && (pObj->iFlags & MEMOBJ_STRING)) {
int len = SyBlobLength(&pObj->sBlob);
if(len == 0 || len == 1) {
return SXRET_OK;
}
} else if((nType & MEMOBJ_CALL) && (pObj->iFlags & MEMOBJ_STRING)) {
return SXRET_OK;
}
} else if(nType == MEMOBJ_CALL && (pObj->iFlags & MEMOBJ_STRING)) {
return SXRET_OK;
}
return SXERR_NOMATCH;
}

Loading…
Cancel
Save