No need to store output length in VM.
Todas las comprobaciones han sido exitosas
The build was successful.
Todas las comprobaciones han sido exitosas
The build was successful.
Este commit está contenido en:
padre
404f5a2688
commit
11ba0ce738
37
engine/vm.c
37
engine/vm.c
@ -1530,18 +1530,6 @@ PH7_PRIVATE sxi32 PH7_VmConfigure(
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PH7_VM_OUTPUT_LENGTH: {
|
|
||||||
/* VM output length in bytes */
|
|
||||||
sxu32 *pOut = va_arg(ap, sxu32 *);
|
|
||||||
#ifdef UNTRUST
|
|
||||||
if(pOut == 0) {
|
|
||||||
rc = SXERR_CORRUPT;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
*pOut = pVm->nOutputLen;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case PH7_VM_CONFIG_CREATE_SUPER:
|
case PH7_VM_CONFIG_CREATE_SUPER:
|
||||||
case PH7_VM_CONFIG_CREATE_VAR: {
|
case PH7_VM_CONFIG_CREATE_VAR: {
|
||||||
/* Create a new superglobal/global variable */
|
/* Create a new superglobal/global variable */
|
||||||
@ -1858,10 +1846,6 @@ static sxi32 VmCallErrorHandler(ph7_vm *pVm, SyBlob *pMsg) {
|
|||||||
#endif
|
#endif
|
||||||
/* Invoke the output consumer callback */
|
/* Invoke the output consumer callback */
|
||||||
rc = pCons->xConsumer(SyBlobData(pMsg), SyBlobLength(pMsg), pCons->pUserData);
|
rc = pCons->xConsumer(SyBlobData(pMsg), SyBlobLength(pMsg), pCons->pUserData);
|
||||||
if(pCons->xConsumer != VmObConsumer) {
|
|
||||||
/* Increment output length */
|
|
||||||
pVm->nOutputLen += SyBlobLength(pMsg);
|
|
||||||
}
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
@ -2073,10 +2057,6 @@ static sxi32 VmByteCodeExec(
|
|||||||
/* Output the exit message */
|
/* Output the exit message */
|
||||||
pVm->sVmConsumer.xConsumer(SyBlobData(&pTos->sBlob), SyBlobLength(&pTos->sBlob),
|
pVm->sVmConsumer.xConsumer(SyBlobData(&pTos->sBlob), SyBlobLength(&pTos->sBlob),
|
||||||
pVm->sVmConsumer.pUserData);
|
pVm->sVmConsumer.pUserData);
|
||||||
if(pVm->sVmConsumer.xConsumer != VmObConsumer) {
|
|
||||||
/* Increment output length */
|
|
||||||
pVm->nOutputLen += SyBlobLength(&pTos->sBlob);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if(pTos->iFlags & MEMOBJ_INT) {
|
} else if(pTos->iFlags & MEMOBJ_INT) {
|
||||||
/* Record exit status */
|
/* Record exit status */
|
||||||
@ -5299,10 +5279,6 @@ static sxi32 VmByteCodeExec(
|
|||||||
/*SyBlobNullAppend(&pOut->sBlob);*/
|
/*SyBlobNullAppend(&pOut->sBlob);*/
|
||||||
/* Invoke the output consumer callback */
|
/* Invoke the output consumer callback */
|
||||||
rc = pCons->xConsumer(SyBlobData(&pOut->sBlob), SyBlobLength(&pOut->sBlob), pCons->pUserData);
|
rc = pCons->xConsumer(SyBlobData(&pOut->sBlob), SyBlobLength(&pOut->sBlob), pCons->pUserData);
|
||||||
if(pCons->xConsumer != VmObConsumer) {
|
|
||||||
/* Increment output length */
|
|
||||||
pVm->nOutputLen += SyBlobLength(&pOut->sBlob);
|
|
||||||
}
|
|
||||||
SyBlobRelease(&pOut->sBlob);
|
SyBlobRelease(&pOut->sBlob);
|
||||||
if(rc == SXERR_ABORT) {
|
if(rc == SXERR_ABORT) {
|
||||||
/* Output consumer callback request an operation abort. */
|
/* Output consumer callback request an operation abort. */
|
||||||
@ -5468,10 +5444,6 @@ PH7_PRIVATE sxi32 PH7_VmOutputConsume(
|
|||||||
/* Call the output consumer */
|
/* Call the output consumer */
|
||||||
if(pString->nByte > 0) {
|
if(pString->nByte > 0) {
|
||||||
rc = pCons->xConsumer((const void *)pString->zString, pString->nByte, pCons->pUserData);
|
rc = pCons->xConsumer((const void *)pString->zString, pString->nByte, pCons->pUserData);
|
||||||
if(pCons->xConsumer != VmObConsumer) {
|
|
||||||
/* Increment output length */
|
|
||||||
pVm->nOutputLen += pString->nByte;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
@ -5496,10 +5468,6 @@ PH7_PRIVATE sxi32 PH7_VmOutputConsumeAp(
|
|||||||
/* Consume the formatted message */
|
/* Consume the formatted message */
|
||||||
rc = pCons->xConsumer(SyBlobData(&sWorker), SyBlobLength(&sWorker), pCons->pUserData);
|
rc = pCons->xConsumer(SyBlobData(&sWorker), SyBlobLength(&sWorker), pCons->pUserData);
|
||||||
}
|
}
|
||||||
if(pCons->xConsumer != VmObConsumer) {
|
|
||||||
/* Increment output length */
|
|
||||||
pVm->nOutputLen += SyBlobLength(&sWorker);
|
|
||||||
}
|
|
||||||
/* Release the working buffer */
|
/* Release the working buffer */
|
||||||
SyBlobRelease(&sWorker);
|
SyBlobRelease(&sWorker);
|
||||||
return rc;
|
return rc;
|
||||||
@ -7830,7 +7798,6 @@ static sxi32 VmObFlush(ph7_vm *pVm, VmObEntry *pEntry, int bRelease) {
|
|||||||
/* Call the VM output consumer */
|
/* Call the VM output consumer */
|
||||||
rc = pVm->sVmConsumer.xDef(SyBlobData(pBlob), SyBlobLength(pBlob), pVm->sVmConsumer.pDefData);
|
rc = pVm->sVmConsumer.xDef(SyBlobData(pBlob), SyBlobLength(pBlob), pVm->sVmConsumer.pDefData);
|
||||||
/* Increment VM output counter */
|
/* Increment VM output counter */
|
||||||
pVm->nOutputLen += SyBlobLength(pBlob);
|
|
||||||
if(rc != PH7_ABORT) {
|
if(rc != PH7_ABORT) {
|
||||||
rc = PH7_OK;
|
rc = PH7_OK;
|
||||||
}
|
}
|
||||||
@ -8285,10 +8252,6 @@ static int vm_builtin_print(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
|||||||
zData = ph7_value_to_string(apArg[i], &nDataLen);
|
zData = ph7_value_to_string(apArg[i], &nDataLen);
|
||||||
if(nDataLen > 0) {
|
if(nDataLen > 0) {
|
||||||
rc = pVm->sVmConsumer.xConsumer((const void *)zData, (unsigned int)nDataLen, pVm->sVmConsumer.pUserData);
|
rc = pVm->sVmConsumer.xConsumer((const void *)zData, (unsigned int)nDataLen, pVm->sVmConsumer.pUserData);
|
||||||
if(pVm->sVmConsumer.xConsumer != VmObConsumer) {
|
|
||||||
/* Increment output length */
|
|
||||||
pVm->nOutputLen += nDataLen;
|
|
||||||
}
|
|
||||||
if(rc == SXERR_ABORT) {
|
if(rc == SXERR_ABORT) {
|
||||||
/* Output consumer callback request an operation abort */
|
/* Output consumer callback request an operation abort */
|
||||||
return PH7_ABORT;
|
return PH7_ABORT;
|
||||||
|
@ -373,20 +373,19 @@ typedef sxi64 ph7_int64;
|
|||||||
#define PH7_VM_CONFIG_IMPORT_PATH 3 /* ONE ARGUMENT: const char *zIncludePath */
|
#define PH7_VM_CONFIG_IMPORT_PATH 3 /* ONE ARGUMENT: const char *zIncludePath */
|
||||||
#define PH7_VM_CONFIG_ERR_REPORT 4 /* NO ARGUMENTS: Report all run-time errors in the VM output */
|
#define PH7_VM_CONFIG_ERR_REPORT 4 /* NO ARGUMENTS: Report all run-time errors in the VM output */
|
||||||
#define PH7_VM_CONFIG_RECURSION_DEPTH 5 /* ONE ARGUMENT: int nMaxDepth */
|
#define PH7_VM_CONFIG_RECURSION_DEPTH 5 /* ONE ARGUMENT: int nMaxDepth */
|
||||||
#define PH7_VM_OUTPUT_LENGTH 6 /* ONE ARGUMENT: unsigned int *pLength */
|
#define PH7_VM_CONFIG_CREATE_SUPER 6 /* TWO ARGUMENTS: const char *zName,ph7_value *pValue */
|
||||||
#define PH7_VM_CONFIG_CREATE_SUPER 7 /* TWO ARGUMENTS: const char *zName,ph7_value *pValue */
|
#define PH7_VM_CONFIG_CREATE_VAR 7 /* TWO ARGUMENTS: const char *zName,ph7_value *pValue */
|
||||||
#define PH7_VM_CONFIG_CREATE_VAR 8 /* TWO ARGUMENTS: const char *zName,ph7_value *pValue */
|
#define PH7_VM_CONFIG_HTTP_REQUEST 8 /* TWO ARGUMENTS: const char *zRawRequest,int nRequestLength */
|
||||||
#define PH7_VM_CONFIG_HTTP_REQUEST 9 /* TWO ARGUMENTS: const char *zRawRequest,int nRequestLength */
|
#define PH7_VM_CONFIG_SERVER_ATTR 9 /* THREE ARGUMENTS: const char *zKey,const char *zValue,int nLen */
|
||||||
#define PH7_VM_CONFIG_SERVER_ATTR 10 /* THREE ARGUMENTS: const char *zKey,const char *zValue,int nLen */
|
#define PH7_VM_CONFIG_ENV_ATTR 10 /* THREE ARGUMENTS: const char *zKey,const char *zValue,int nLen */
|
||||||
#define PH7_VM_CONFIG_ENV_ATTR 11 /* THREE ARGUMENTS: const char *zKey,const char *zValue,int nLen */
|
#define PH7_VM_CONFIG_SESSION_ATTR 11 /* THREE ARGUMENTS: const char *zKey,const char *zValue,int nLen */
|
||||||
#define PH7_VM_CONFIG_SESSION_ATTR 12 /* THREE ARGUMENTS: const char *zKey,const char *zValue,int nLen */
|
#define PH7_VM_CONFIG_POST_ATTR 12 /* THREE ARGUMENTS: const char *zKey,const char *zValue,int nLen */
|
||||||
#define PH7_VM_CONFIG_POST_ATTR 13 /* THREE ARGUMENTS: const char *zKey,const char *zValue,int nLen */
|
#define PH7_VM_CONFIG_GET_ATTR 13 /* THREE ARGUMENTS: const char *zKey,const char *zValue,int nLen */
|
||||||
#define PH7_VM_CONFIG_GET_ATTR 14 /* THREE ARGUMENTS: const char *zKey,const char *zValue,int nLen */
|
#define PH7_VM_CONFIG_COOKIE_ATTR 14 /* THREE ARGUMENTS: const char *zKey,const char *zValue,int nLen */
|
||||||
#define PH7_VM_CONFIG_COOKIE_ATTR 15 /* THREE ARGUMENTS: const char *zKey,const char *zValue,int nLen */
|
#define PH7_VM_CONFIG_HEADER_ATTR 15 /* THREE ARGUMENTS: const char *zKey,const char *zValue,int nLen */
|
||||||
#define PH7_VM_CONFIG_HEADER_ATTR 16 /* THREE ARGUMENTS: const char *zKey,const char *zValue,int nLen */
|
#define PH7_VM_CONFIG_IO_STREAM 16 /* ONE ARGUMENT: const ph7_io_stream *pStream */
|
||||||
#define PH7_VM_CONFIG_IO_STREAM 18 /* ONE ARGUMENT: const ph7_io_stream *pStream */
|
#define PH7_VM_CONFIG_ARGV_ENTRY 17 /* ONE ARGUMENT: const char *zValue */
|
||||||
#define PH7_VM_CONFIG_ARGV_ENTRY 19 /* ONE ARGUMENT: const char *zValue */
|
#define PH7_VM_CONFIG_EXTRACT_OUTPUT 18 /* TWO ARGUMENTS: const void **ppOut,unsigned int *pOutputLen */
|
||||||
#define PH7_VM_CONFIG_EXTRACT_OUTPUT 20 /* TWO ARGUMENTS: const void **ppOut,unsigned int *pOutputLen */
|
|
||||||
/*
|
/*
|
||||||
* Global Library Configuration Commands.
|
* Global Library Configuration Commands.
|
||||||
*
|
*
|
||||||
|
@ -1233,7 +1233,6 @@ struct ph7_vm {
|
|||||||
int nExceptDepth; /* Exception depth */
|
int nExceptDepth; /* Exception depth */
|
||||||
int closure_cnt; /* Loaded closures counter */
|
int closure_cnt; /* Loaded closures counter */
|
||||||
int json_rc; /* JSON return status [refer to json_encode()/json_decode()]*/
|
int json_rc; /* JSON return status [refer to json_encode()/json_decode()]*/
|
||||||
sxu32 nOutputLen; /* Total number of generated output */
|
|
||||||
ph7_output_consumer sVmConsumer; /* Registered output consumer callback */
|
ph7_output_consumer sVmConsumer; /* Registered output consumer callback */
|
||||||
int iAssertFlags; /* Assertion flags */
|
int iAssertFlags; /* Assertion flags */
|
||||||
ph7_value sAssertCallback; /* Callback to call on failed assertions */
|
ph7_value sAssertCallback; /* Callback to call on failed assertions */
|
||||||
|
Cargando…
x
Referencia en una nueva incidencia
Block a user