Get rid of unused variables/labels/etc.
The build was successful.
Details
The build was successful.
Details
This commit is contained in:
parent
1a91fedb1f
commit
c7b6e76d0d
|
@ -218,7 +218,7 @@ static sxu32 PH7_GenStateFixJumps(GenBlock *pBlock, sxi32 nJumpType, sxu32 nJump
|
||||||
static sxi32 GenStateFixGoto(ph7_gen_state *pGen, sxu32 nOfft)
|
static sxi32 GenStateFixGoto(ph7_gen_state *pGen, sxu32 nOfft)
|
||||||
{
|
{
|
||||||
JumpFixup *pJump,*aJumps;
|
JumpFixup *pJump,*aJumps;
|
||||||
Label *pLabel,*aLabel;
|
Label *pLabel;
|
||||||
VmInstr *pInstr;
|
VmInstr *pInstr;
|
||||||
sxi32 rc;
|
sxi32 rc;
|
||||||
sxu32 n;
|
sxu32 n;
|
||||||
|
@ -340,6 +340,7 @@ PH7_PRIVATE sxi32 PH7_CompileSimpleString(ph7_gen_state *pGen, sxi32 iCompileFla
|
||||||
/* Delimit the string */
|
/* Delimit the string */
|
||||||
zIn = pStr->zString;
|
zIn = pStr->zString;
|
||||||
zEnd = &zIn[pStr->nByte];
|
zEnd = &zIn[pStr->nByte];
|
||||||
|
SXUNUSED(iCompileFlag);
|
||||||
if(SXRET_OK == PH7_GenStateFindLiteral(&(*pGen), pStr, &nIdx)) {
|
if(SXRET_OK == PH7_GenStateFindLiteral(&(*pGen), pStr, &nIdx)) {
|
||||||
/* Already processed,emit the load constant instruction
|
/* Already processed,emit the load constant instruction
|
||||||
* and return.
|
* and return.
|
||||||
|
@ -902,6 +903,7 @@ PH7_PRIVATE sxi32 PH7_CompileClosure(ph7_gen_state *pGen, sxi32 iCompileFlag) {
|
||||||
sxu32 nLen;
|
sxu32 nLen;
|
||||||
sxi32 rc;
|
sxi32 rc;
|
||||||
sxu32 nType;
|
sxu32 nType;
|
||||||
|
SXUNUSED(iCompileFlag);
|
||||||
sxu32 nKey = (sxu32)(SX_PTR_TO_INT(pGen->pIn->pUserData));
|
sxu32 nKey = (sxu32)(SX_PTR_TO_INT(pGen->pIn->pUserData));
|
||||||
if(nKey & PH7_KEYWORD_BOOL) {
|
if(nKey & PH7_KEYWORD_BOOL) {
|
||||||
nType = MEMOBJ_BOOL;
|
nType = MEMOBJ_BOOL;
|
||||||
|
@ -984,6 +986,7 @@ PH7_PRIVATE sxi32 PH7_CompileDefine(ph7_gen_state *pGen, sxi32 iFlags) {
|
||||||
SySet *pConsCode, *pInstrContainer;
|
SySet *pConsCode, *pInstrContainer;
|
||||||
SyString *pName;
|
SyString *pName;
|
||||||
sxi32 rc;
|
sxi32 rc;
|
||||||
|
SXUNUSED(iFlags);
|
||||||
/* Jump the 'define' keyword */
|
/* Jump the 'define' keyword */
|
||||||
pGen->pIn++;
|
pGen->pIn++;
|
||||||
if(pGen->pIn >= pGen->pEnd || (pGen->pIn->nType & (PH7_TK_ID | PH7_TK_KEYWORD)) == 0) {
|
if(pGen->pIn >= pGen->pEnd || (pGen->pIn->nType & (PH7_TK_ID | PH7_TK_KEYWORD)) == 0) {
|
||||||
|
@ -1048,7 +1051,7 @@ PH7_PRIVATE sxi32 PH7_CompileDefine(ph7_gen_state *pGen, sxi32 iFlags) {
|
||||||
PH7_PRIVATE sxi32 PH7_CompileVariable(ph7_gen_state *pGen, sxi32 iCompileFlag) {
|
PH7_PRIVATE sxi32 PH7_CompileVariable(ph7_gen_state *pGen, sxi32 iCompileFlag) {
|
||||||
sxu32 nLine = pGen->pIn->nLine;
|
sxu32 nLine = pGen->pIn->nLine;
|
||||||
void *p3;
|
void *p3;
|
||||||
sxi32 rc;
|
SXUNUSED(iCompileFlag);
|
||||||
/* Jump the dollar sign */
|
/* Jump the dollar sign */
|
||||||
pGen->pIn++;
|
pGen->pIn++;
|
||||||
if(pGen->pIn >= pGen->pEnd || (pGen->pIn->nType & (PH7_TK_ID | PH7_TK_KEYWORD)) == 0) {
|
if(pGen->pIn >= pGen->pEnd || (pGen->pIn->nType & (PH7_TK_ID | PH7_TK_KEYWORD)) == 0) {
|
||||||
|
@ -1369,7 +1372,6 @@ static sxi32 PH7_CompileConstant(ph7_gen_state *pGen) {
|
||||||
static sxi32 PH7_CompileContinue(ph7_gen_state *pGen) {
|
static sxi32 PH7_CompileContinue(ph7_gen_state *pGen) {
|
||||||
GenBlock *pLoop; /* Target loop */
|
GenBlock *pLoop; /* Target loop */
|
||||||
sxu32 nLine;
|
sxu32 nLine;
|
||||||
sxi32 rc;
|
|
||||||
nLine = pGen->pIn->nLine;
|
nLine = pGen->pIn->nLine;
|
||||||
/* Jump the 'continue' keyword */
|
/* Jump the 'continue' keyword */
|
||||||
pGen->pIn++;
|
pGen->pIn++;
|
||||||
|
@ -1511,7 +1513,6 @@ static sxi32 PH7_CompileLabel(ph7_gen_state *pGen)
|
||||||
static sxi32 PH7_CompileGoto(ph7_gen_state *pGen)
|
static sxi32 PH7_CompileGoto(ph7_gen_state *pGen)
|
||||||
{
|
{
|
||||||
JumpFixup sJump;
|
JumpFixup sJump;
|
||||||
sxi32 rc;
|
|
||||||
pGen->pIn++; /* Jump the 'goto' keyword */
|
pGen->pIn++; /* Jump the 'goto' keyword */
|
||||||
if(pGen->pIn >= pGen->pEnd) {
|
if(pGen->pIn >= pGen->pEnd) {
|
||||||
/* Missing label */
|
/* Missing label */
|
||||||
|
@ -1718,7 +1719,6 @@ static sxi32 PH7_CompileWhile(ph7_gen_state *pGen) {
|
||||||
PH7_GenStateLeaveBlock(pGen, 0);
|
PH7_GenStateLeaveBlock(pGen, 0);
|
||||||
/* Statement successfully compiled */
|
/* Statement successfully compiled */
|
||||||
return SXRET_OK;
|
return SXRET_OK;
|
||||||
Synchronize:
|
|
||||||
/* Synchronize with the first semi-colon ';' so we can avoid
|
/* Synchronize with the first semi-colon ';' so we can avoid
|
||||||
* compiling this erroneous block.
|
* compiling this erroneous block.
|
||||||
*/
|
*/
|
||||||
|
@ -1826,7 +1826,6 @@ static sxi32 PH7_CompileDoWhile(ph7_gen_state *pGen) {
|
||||||
PH7_GenStateLeaveBlock(pGen, 0);
|
PH7_GenStateLeaveBlock(pGen, 0);
|
||||||
/* Statement successfully compiled */
|
/* Statement successfully compiled */
|
||||||
return SXRET_OK;
|
return SXRET_OK;
|
||||||
Synchronize:
|
|
||||||
/* Synchronize with the first semi-colon ';' so we can avoid
|
/* Synchronize with the first semi-colon ';' so we can avoid
|
||||||
* compiling this erroneous block.
|
* compiling this erroneous block.
|
||||||
*/
|
*/
|
||||||
|
@ -2301,7 +2300,6 @@ static sxi32 PH7_CompileIf(ph7_gen_state *pGen) {
|
||||||
PH7_GenStateLeaveBlock(pGen, 0);
|
PH7_GenStateLeaveBlock(pGen, 0);
|
||||||
/* Statement successfully compiled */
|
/* Statement successfully compiled */
|
||||||
return SXRET_OK;
|
return SXRET_OK;
|
||||||
Synchronize:
|
|
||||||
/* Synchronize with the first semi-colon ';' so we can avoid compiling this erroneous block.
|
/* Synchronize with the first semi-colon ';' so we can avoid compiling this erroneous block.
|
||||||
*/
|
*/
|
||||||
while(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & (PH7_TK_SEMI | PH7_TK_OCB)) == 0) {
|
while(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & (PH7_TK_SEMI | PH7_TK_OCB)) == 0) {
|
||||||
|
@ -2608,7 +2606,6 @@ static sxi32 PH7_CompileNamespace(ph7_gen_state *pGen) {
|
||||||
*/
|
*/
|
||||||
static sxi32 PH7_CompileUsing(ph7_gen_state *pGen) {
|
static sxi32 PH7_CompileUsing(ph7_gen_state *pGen) {
|
||||||
sxu32 nLine = pGen->pIn->nLine;
|
sxu32 nLine = pGen->pIn->nLine;
|
||||||
sxi32 rc;
|
|
||||||
/* Jump the 'using' keyword */
|
/* Jump the 'using' keyword */
|
||||||
pGen->pIn++;
|
pGen->pIn++;
|
||||||
if(pGen->pIn >= pGen->pEnd || (pGen->pIn->nType & (PH7_TK_NSSEP | PH7_TK_ID)) == 0) {
|
if(pGen->pIn >= pGen->pEnd || (pGen->pIn->nType & (PH7_TK_NSSEP | PH7_TK_ID)) == 0) {
|
||||||
|
@ -2751,12 +2748,11 @@ static sxi32 PH7_GenStateProcessArgValue(ph7_gen_state *pGen, ph7_vm_func_arg *p
|
||||||
*/
|
*/
|
||||||
static sxi32 PH7_GenStateCollectFuncArgs(ph7_vm_func *pFunc, ph7_gen_state *pGen, SyToken *pEnd) {
|
static sxi32 PH7_GenStateCollectFuncArgs(ph7_vm_func *pFunc, ph7_gen_state *pGen, SyToken *pEnd) {
|
||||||
ph7_vm_func_arg sArg; /* Current processed argument */
|
ph7_vm_func_arg sArg; /* Current processed argument */
|
||||||
SyToken *pCur, *pIn; /* Token stream */
|
SyToken *pIn; /* Token stream */
|
||||||
SyBlob sSig; /* Function signature */
|
SyBlob sSig; /* Function signature */
|
||||||
char *zDup; /* Copy of argument name */
|
char *zDup; /* Copy of argument name */
|
||||||
sxi32 rc;
|
sxi32 rc;
|
||||||
pIn = pGen->pIn;
|
pIn = pGen->pIn;
|
||||||
pCur = 0;
|
|
||||||
SyBlobInit(&sSig, &pGen->pVm->sAllocator);
|
SyBlobInit(&sSig, &pGen->pVm->sAllocator);
|
||||||
/* Process arguments one after one */
|
/* Process arguments one after one */
|
||||||
for(;;) {
|
for(;;) {
|
||||||
|
@ -3248,7 +3244,6 @@ loop:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return SXRET_OK;
|
return SXRET_OK;
|
||||||
Synchronize:
|
|
||||||
/* Synchronize with the first semi-colon */
|
/* Synchronize with the first semi-colon */
|
||||||
while(pGen->pIn < pGen->pEnd && ((pGen->pIn->nType & PH7_TK_SEMI/*';'*/) == 0)) {
|
while(pGen->pIn < pGen->pEnd && ((pGen->pIn->nType & PH7_TK_SEMI/*';'*/) == 0)) {
|
||||||
pGen->pIn++;
|
pGen->pIn++;
|
||||||
|
@ -3341,7 +3336,6 @@ loop:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return SXRET_OK;
|
return SXRET_OK;
|
||||||
Synchronize:
|
|
||||||
/* Synchronize with the first semi-colon */
|
/* Synchronize with the first semi-colon */
|
||||||
while(pGen->pIn < pGen->pEnd && ((pGen->pIn->nType & PH7_TK_SEMI/*';'*/) == 0)) {
|
while(pGen->pIn < pGen->pEnd && ((pGen->pIn->nType & PH7_TK_SEMI/*';'*/) == 0)) {
|
||||||
pGen->pIn++;
|
pGen->pIn++;
|
||||||
|
@ -3459,7 +3453,6 @@ static sxi32 PH7_GenStateCompileClassMethod(
|
||||||
PH7_GenCompileError(pGen, E_ERROR, nLine, "Fatal, PH7 is running out-of-memory");
|
PH7_GenCompileError(pGen, E_ERROR, nLine, "Fatal, PH7 is running out-of-memory");
|
||||||
}
|
}
|
||||||
return SXRET_OK;
|
return SXRET_OK;
|
||||||
Synchronize:
|
|
||||||
/* Synchronize with the first semi-colon */
|
/* Synchronize with the first semi-colon */
|
||||||
while(pGen->pIn < pGen->pEnd && ((pGen->pIn->nType & PH7_TK_SEMI/*';'*/) == 0)) {
|
while(pGen->pIn < pGen->pEnd && ((pGen->pIn->nType & PH7_TK_SEMI/*';'*/) == 0)) {
|
||||||
pGen->pIn++;
|
pGen->pIn++;
|
||||||
|
@ -3477,7 +3470,7 @@ Synchronize:
|
||||||
*/
|
*/
|
||||||
static sxi32 PH7_CompileClassInterface(ph7_gen_state *pGen) {
|
static sxi32 PH7_CompileClassInterface(ph7_gen_state *pGen) {
|
||||||
sxu32 nLine = pGen->pIn->nLine;
|
sxu32 nLine = pGen->pIn->nLine;
|
||||||
ph7_class *pClass, *pBase;
|
ph7_class *pClass;
|
||||||
ph7_class_info *pClassInfo;
|
ph7_class_info *pClassInfo;
|
||||||
SyToken *pEnd, *pTmp;
|
SyToken *pEnd, *pTmp;
|
||||||
SyString *pName;
|
SyString *pName;
|
||||||
|
@ -3506,8 +3499,6 @@ static sxi32 PH7_CompileClassInterface(ph7_gen_state *pGen) {
|
||||||
}
|
}
|
||||||
/* Mark as an interface */
|
/* Mark as an interface */
|
||||||
pClass->iFlags = PH7_CLASS_INTERFACE;
|
pClass->iFlags = PH7_CLASS_INTERFACE;
|
||||||
/* Assume no base class is given */
|
|
||||||
pBase = 0;
|
|
||||||
if(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & PH7_TK_KEYWORD)) {
|
if(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & PH7_TK_KEYWORD)) {
|
||||||
SyString pBaseName;
|
SyString pBaseName;
|
||||||
nKwrd = SX_PTR_TO_INT(pGen->pIn->pUserData);
|
nKwrd = SX_PTR_TO_INT(pGen->pIn->pUserData);
|
||||||
|
@ -3682,7 +3673,7 @@ done:
|
||||||
*/
|
*/
|
||||||
static sxi32 PH7_GenStateCompileClass(ph7_gen_state *pGen, sxi32 iFlags) {
|
static sxi32 PH7_GenStateCompileClass(ph7_gen_state *pGen, sxi32 iFlags) {
|
||||||
sxu32 nLine = pGen->pIn->nLine;
|
sxu32 nLine = pGen->pIn->nLine;
|
||||||
ph7_class *pClass, *pBase;
|
ph7_class *pClass;
|
||||||
ph7_class_info *pClassInfo;
|
ph7_class_info *pClassInfo;
|
||||||
SyToken *pEnd, *pTmp;
|
SyToken *pEnd, *pTmp;
|
||||||
sxi32 iProtection;
|
sxi32 iProtection;
|
||||||
|
@ -3713,7 +3704,6 @@ static sxi32 PH7_GenStateCompileClass(ph7_gen_state *pGen, sxi32 iFlags) {
|
||||||
PH7_GenCompileError(pGen, E_ERROR, nLine, "PH7 is running out-of-memory");
|
PH7_GenCompileError(pGen, E_ERROR, nLine, "PH7 is running out-of-memory");
|
||||||
}
|
}
|
||||||
/* Assume a standalone class */
|
/* Assume a standalone class */
|
||||||
pBase = 0;
|
|
||||||
if(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & PH7_TK_KEYWORD)) {
|
if(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & PH7_TK_KEYWORD)) {
|
||||||
SyString pBaseName;
|
SyString pBaseName;
|
||||||
nKwrd = SX_PTR_TO_INT(pGen->pIn->pUserData);
|
nKwrd = SX_PTR_TO_INT(pGen->pIn->pUserData);
|
||||||
|
@ -4523,7 +4513,6 @@ static sxi32 PH7_CompileSwitch(ph7_gen_state *pGen) {
|
||||||
}
|
}
|
||||||
/* Statement successfully compiled */
|
/* Statement successfully compiled */
|
||||||
return SXRET_OK;
|
return SXRET_OK;
|
||||||
Synchronize:
|
|
||||||
/* Synchronize with the first semi-colon */
|
/* Synchronize with the first semi-colon */
|
||||||
while(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & PH7_TK_SEMI) == 0) {
|
while(pGen->pIn < pGen->pEnd && (pGen->pIn->nType & PH7_TK_SEMI) == 0) {
|
||||||
pGen->pIn++;
|
pGen->pIn++;
|
||||||
|
@ -5145,9 +5134,6 @@ PH7_PRIVATE sxi32 PH7_CompileAerScript(
|
||||||
) {
|
) {
|
||||||
SySet aAerToken, aRawToken;
|
SySet aAerToken, aRawToken;
|
||||||
ph7_gen_state *pCodeGen;
|
ph7_gen_state *pCodeGen;
|
||||||
ph7_value *pRawObj;
|
|
||||||
sxu32 nObjIdx;
|
|
||||||
sxi32 nRawObj;
|
|
||||||
sxi32 rc;
|
sxi32 rc;
|
||||||
if(pScript->nByte < 1) {
|
if(pScript->nByte < 1) {
|
||||||
/* Nothing to compile */
|
/* Nothing to compile */
|
||||||
|
@ -5171,7 +5157,6 @@ PH7_PRIVATE sxi32 PH7_CompileAerScript(
|
||||||
/* Compile the expression */
|
/* Compile the expression */
|
||||||
rc = PH7_CompileScript(pCodeGen, &aAerToken, iFlags);
|
rc = PH7_CompileScript(pCodeGen, &aAerToken, iFlags);
|
||||||
} else {
|
} else {
|
||||||
nObjIdx = 0;
|
|
||||||
/* Start the compilation process */
|
/* Start the compilation process */
|
||||||
for(;;) {
|
for(;;) {
|
||||||
/* Compile Aer block of code */
|
/* Compile Aer block of code */
|
||||||
|
|
|
@ -265,6 +265,7 @@ static sxi32 HashmapInsertIntKey(ph7_hashmap *pMap, sxi64 iKey, ph7_value *pValu
|
||||||
sxu32 nHash;
|
sxu32 nHash;
|
||||||
sxi32 rc;
|
sxi32 rc;
|
||||||
ph7_value *pObj;
|
ph7_value *pObj;
|
||||||
|
SXUNUSED(nRefIdx);
|
||||||
/* Reserve a ph7_value for the value */
|
/* Reserve a ph7_value for the value */
|
||||||
pObj = PH7_ReserveMemObj(pMap->pVm);
|
pObj = PH7_ReserveMemObj(pMap->pVm);
|
||||||
if(pObj == 0) {
|
if(pObj == 0) {
|
||||||
|
@ -305,6 +306,7 @@ static sxi32 HashmapInsertBlobKey(ph7_hashmap *pMap, const void *pKey, sxu32 nKe
|
||||||
sxu32 nIdx;
|
sxu32 nIdx;
|
||||||
sxi32 rc;
|
sxi32 rc;
|
||||||
ph7_value *pObj;
|
ph7_value *pObj;
|
||||||
|
SXUNUSED(nRefIdx);
|
||||||
/* Reserve a ph7_value for the value */
|
/* Reserve a ph7_value for the value */
|
||||||
pObj = PH7_ReserveMemObj(pMap->pVm);
|
pObj = PH7_ReserveMemObj(pMap->pVm);
|
||||||
if(pObj == 0) {
|
if(pObj == 0) {
|
||||||
|
@ -1252,7 +1254,6 @@ PH7_PRIVATE sxi32 PH7_HashmapRelease(ph7_hashmap *pMap, int FreeDS) {
|
||||||
* are pointing to this hashmap,then release the whole instance.
|
* are pointing to this hashmap,then release the whole instance.
|
||||||
*/
|
*/
|
||||||
PH7_PRIVATE void PH7_HashmapUnref(ph7_hashmap *pMap) {
|
PH7_PRIVATE void PH7_HashmapUnref(ph7_hashmap *pMap) {
|
||||||
ph7_vm *pVm = pMap->pVm;
|
|
||||||
/* TICKET 1432-49: $GLOBALS is not subject to garbage collection */
|
/* TICKET 1432-49: $GLOBALS is not subject to garbage collection */
|
||||||
pMap->iRef--;
|
pMap->iRef--;
|
||||||
if(pMap->iRef < 1) {
|
if(pMap->iRef < 1) {
|
||||||
|
|
|
@ -16,7 +16,6 @@ static sxu32 KeywordCode(const char *z, int n);
|
||||||
*/
|
*/
|
||||||
static sxi32 TokenizeAerScript(SyStream *pStream, SyToken *pToken, void *pUserData, void *pCtxData) {
|
static sxi32 TokenizeAerScript(SyStream *pStream, SyToken *pToken, void *pUserData, void *pCtxData) {
|
||||||
SyString *pStr;
|
SyString *pStr;
|
||||||
sxi32 rc;
|
|
||||||
/* Ignore leading white spaces */
|
/* Ignore leading white spaces */
|
||||||
while(pStream->zText < pStream->zEnd && pStream->zText[0] < 0xc0 && SyisSpace(pStream->zText[0])) {
|
while(pStream->zText < pStream->zEnd && pStream->zText[0] < 0xc0 && SyisSpace(pStream->zText[0])) {
|
||||||
/* Advance the stream cursor */
|
/* Advance the stream cursor */
|
||||||
|
|
|
@ -126,7 +126,6 @@ static sxi32 InternFormat(ProcConsumer xConsumer, void *pUserData, const char *z
|
||||||
char prefix; /* Prefix character."+" or "-" or " " or '\0'.*/
|
char prefix; /* Prefix character."+" or "-" or " " or '\0'.*/
|
||||||
sxu8 errorflag = 0; /* True if an error is encountered */
|
sxu8 errorflag = 0; /* True if an error is encountered */
|
||||||
sxu8 xtype; /* Conversion paradigm */
|
sxu8 xtype; /* Conversion paradigm */
|
||||||
char *zExtra;
|
|
||||||
static char spaces[] = " ";
|
static char spaces[] = " ";
|
||||||
#define etSPACESIZE ((int)sizeof(spaces)-1)
|
#define etSPACESIZE ((int)sizeof(spaces)-1)
|
||||||
#ifndef SX_OMIT_FLOATINGPOINT
|
#ifndef SX_OMIT_FLOATINGPOINT
|
||||||
|
@ -250,7 +249,6 @@ static sxi32 InternFormat(ProcConsumer xConsumer, void *pUserData, const char *z
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
zExtra = 0;
|
|
||||||
/*
|
/*
|
||||||
** At this point, variables are initialized as follows:
|
** At this point, variables are initialized as follows:
|
||||||
**
|
**
|
||||||
|
|
|
@ -207,25 +207,24 @@ static sxi32 ArchiveHashInstallEntry(SyArchive *pArch, SyArchiveEntry *pEntry) {
|
||||||
*/
|
*/
|
||||||
static sxi32 ParseEndOfCentralDirectory(SyArchive *pArch, const unsigned char *zBuf) {
|
static sxi32 ParseEndOfCentralDirectory(SyArchive *pArch, const unsigned char *zBuf) {
|
||||||
sxu32 nMagic = 0; /* cc -O6 warning */
|
sxu32 nMagic = 0; /* cc -O6 warning */
|
||||||
sxi32 rc;
|
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
rc = SyLittleEndianUnpack32(&nMagic, zBuf, sizeof(sxu32));
|
SyLittleEndianUnpack32(&nMagic, zBuf, sizeof(sxu32));
|
||||||
if(/* rc != SXRET_OK || */nMagic != SXZIP_END_CENTRAL_MAGIC) {
|
if(nMagic != SXZIP_END_CENTRAL_MAGIC) {
|
||||||
return SXERR_CORRUPT;
|
return SXERR_CORRUPT;
|
||||||
}
|
}
|
||||||
/* # of entries */
|
/* # of entries */
|
||||||
rc = SyLittleEndianUnpack16((sxu16 *)&pArch->nEntry, &zBuf[8], sizeof(sxu16));
|
SyLittleEndianUnpack16((sxu16 *)&pArch->nEntry, &zBuf[8], sizeof(sxu16));
|
||||||
if(/* rc != SXRET_OK || */ pArch->nEntry > SXI16_HIGH /* SXU16_HIGH */) {
|
if(pArch->nEntry > SXI16_HIGH /* SXU16_HIGH */) {
|
||||||
return SXERR_CORRUPT;
|
return SXERR_CORRUPT;
|
||||||
}
|
}
|
||||||
/* Size of central directory */
|
/* Size of central directory */
|
||||||
rc = SyLittleEndianUnpack32(&pArch->nCentralSize, &zBuf[12], sizeof(sxu32));
|
SyLittleEndianUnpack32(&pArch->nCentralSize, &zBuf[12], sizeof(sxu32));
|
||||||
if(/*rc != SXRET_OK ||*/ pArch->nCentralSize > SXI32_HIGH) {
|
if(pArch->nCentralSize > SXI32_HIGH) {
|
||||||
return SXERR_CORRUPT;
|
return SXERR_CORRUPT;
|
||||||
}
|
}
|
||||||
/* Starting offset of central directory */
|
/* Starting offset of central directory */
|
||||||
rc = SyLittleEndianUnpack32(&pArch->nCentralOfft, &zBuf[16], sizeof(sxu32));
|
SyLittleEndianUnpack32(&pArch->nCentralOfft, &zBuf[16], sizeof(sxu32));
|
||||||
if(/*rc != SXRET_OK ||*/ pArch->nCentralSize > SXI32_HIGH) {
|
if(pArch->nCentralSize > SXI32_HIGH) {
|
||||||
return SXERR_CORRUPT;
|
return SXERR_CORRUPT;
|
||||||
}
|
}
|
||||||
return SXRET_OK;
|
return SXRET_OK;
|
||||||
|
@ -241,6 +240,7 @@ static sxi32 GetCentralDirectoryEntry(SyArchive *pArch, SyArchiveEntry *pEntry,
|
||||||
sxi32 rc;
|
sxi32 rc;
|
||||||
nDosDate = nDosTime = 0; /* cc -O6 warning */
|
nDosDate = nDosTime = 0; /* cc -O6 warning */
|
||||||
SXUNUSED(pArch);
|
SXUNUSED(pArch);
|
||||||
|
// (void)pArch;
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
rc = SyLittleEndianUnpack32(&nMagic, zCentral, sizeof(sxu32));
|
rc = SyLittleEndianUnpack32(&nMagic, zCentral, sizeof(sxu32));
|
||||||
if(/* rc != SXRET_OK || */ nMagic != SXZIP_CENTRAL_MAGIC) {
|
if(/* rc != SXRET_OK || */ nMagic != SXZIP_CENTRAL_MAGIC) {
|
||||||
|
|
|
@ -613,7 +613,6 @@ static sxi32 MemBackendRelease(SyMemBackend *pBackend) {
|
||||||
return SXRET_OK;
|
return SXRET_OK;
|
||||||
}
|
}
|
||||||
PH7_PRIVATE sxi32 SyMemBackendRelease(SyMemBackend *pBackend) {
|
PH7_PRIVATE sxi32 SyMemBackendRelease(SyMemBackend *pBackend) {
|
||||||
sxi32 rc;
|
|
||||||
#if defined(UNTRUST)
|
#if defined(UNTRUST)
|
||||||
if(SXMEM_BACKEND_CORRUPT(pBackend)) {
|
if(SXMEM_BACKEND_CORRUPT(pBackend)) {
|
||||||
return SXERR_INVALID;
|
return SXERR_INVALID;
|
||||||
|
@ -622,7 +621,7 @@ PH7_PRIVATE sxi32 SyMemBackendRelease(SyMemBackend *pBackend) {
|
||||||
if(pBackend->pMutexMethods) {
|
if(pBackend->pMutexMethods) {
|
||||||
SyMutexEnter(pBackend->pMutexMethods, pBackend->pMutex);
|
SyMutexEnter(pBackend->pMutexMethods, pBackend->pMutex);
|
||||||
}
|
}
|
||||||
rc = MemBackendRelease(&(*pBackend));
|
MemBackendRelease(&(*pBackend));
|
||||||
if(pBackend->pMutexMethods) {
|
if(pBackend->pMutexMethods) {
|
||||||
SyMutexLeave(pBackend->pMutexMethods, pBackend->pMutex);
|
SyMutexLeave(pBackend->pMutexMethods, pBackend->pMutex);
|
||||||
SyMutexRelease(pBackend->pMutexMethods, pBackend->pMutex);
|
SyMutexRelease(pBackend->pMutexMethods, pBackend->pMutex);
|
||||||
|
|
|
@ -150,17 +150,17 @@ sxu32 Systrcpy(char *zDest, sxu32 nDestLen, const char *zSrc, sxu32 nLen) {
|
||||||
PH7_PRIVATE char *SyStrtok(char *str, const char *sep) {
|
PH7_PRIVATE char *SyStrtok(char *str, const char *sep) {
|
||||||
static int pos;
|
static int pos;
|
||||||
static char *s;
|
static char *s;
|
||||||
int i = 0, j = 0;
|
int i = 0;
|
||||||
int start = pos;
|
int start = pos;
|
||||||
/* Copy the string for further SyStrtok() calls */
|
/* Copy the string for further SyStrtok() calls */
|
||||||
if(str != NULL) {
|
if(str != NULL) {
|
||||||
s = str;
|
s = str;
|
||||||
}
|
}
|
||||||
while(s[pos] != '\0') {
|
while(s[pos] != '\0') {
|
||||||
j = 0;
|
i = 0;
|
||||||
/* Compare of one of the delimiter matches the character in the string */
|
/* Compare of one of the delimiter matches the character in the string */
|
||||||
while(sep[j] != '\0') {
|
while(sep[i] != '\0') {
|
||||||
if(s[pos] == sep[j]) {
|
if(s[pos] == sep[i]) {
|
||||||
/* Replace the delimter by \0 to break the string */
|
/* Replace the delimter by \0 to break the string */
|
||||||
s[pos] = '\0';
|
s[pos] = '\0';
|
||||||
pos++;
|
pos++;
|
||||||
|
@ -173,7 +173,7 @@ PH7_PRIVATE char *SyStrtok(char *str, const char *sep) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
j++;
|
i++;
|
||||||
}
|
}
|
||||||
pos++;
|
pos++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,7 @@ PH7_PRIVATE ph7_class *PH7_NewRawClass(ph7_vm *pVm, const SyString *pName) {
|
||||||
PH7_PRIVATE ph7_class_attr *PH7_NewClassAttr(ph7_vm *pVm, ph7_class *pClass, const SyString *pName, sxu32 nLine, sxi32 iProtection, sxi32 iFlags, sxu32 nType) {
|
PH7_PRIVATE ph7_class_attr *PH7_NewClassAttr(ph7_vm *pVm, ph7_class *pClass, const SyString *pName, sxu32 nLine, sxi32 iProtection, sxi32 iFlags, sxu32 nType) {
|
||||||
ph7_class_attr *pAttr;
|
ph7_class_attr *pAttr;
|
||||||
char *zName;
|
char *zName;
|
||||||
|
SXUNUSED(pClass);
|
||||||
pAttr = (ph7_class_attr *)SyMemBackendPoolAlloc(&pVm->sAllocator, sizeof(ph7_class_attr));
|
pAttr = (ph7_class_attr *)SyMemBackendPoolAlloc(&pVm->sAllocator, sizeof(ph7_class_attr));
|
||||||
if(pAttr == 0) {
|
if(pAttr == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
52
engine/vfs.c
52
engine/vfs.c
|
@ -5652,54 +5652,6 @@ static int PH7_builtin_zip_entry_compressionmethod(ph7_context *pCtx, int nArg,
|
||||||
}
|
}
|
||||||
return PH7_OK;
|
return PH7_OK;
|
||||||
}
|
}
|
||||||
/* NULL VFS [i.e: a no-op VFS]*/
|
|
||||||
static const ph7_vfs null_vfs = {
|
|
||||||
"NullVFS",
|
|
||||||
PH7_VFS_VERSION,
|
|
||||||
0, /* int (*xChdir)(const char *) */
|
|
||||||
0, /* int (*xChroot)(const char *); */
|
|
||||||
0, /* int (*xGetcwd)(ph7_context *) */
|
|
||||||
0, /* int (*xMkdir)(const char *,int,int) */
|
|
||||||
0, /* int (*xRmdir)(const char *) */
|
|
||||||
0, /* int (*xIsdir)(const char *) */
|
|
||||||
0, /* int (*xRename)(const char *,const char *) */
|
|
||||||
0, /*int (*xRealpath)(const char *,ph7_context *)*/
|
|
||||||
0, /* int (*xSleep)(unsigned int) */
|
|
||||||
0, /* int (*xUnlink)(const char *) */
|
|
||||||
0, /* int (*xFileExists)(const char *) */
|
|
||||||
0, /*int (*xChmod)(const char *,int)*/
|
|
||||||
0, /*int (*xChown)(const char *,const char *)*/
|
|
||||||
0, /*int (*xChgrp)(const char *,const char *)*/
|
|
||||||
0, /* ph7_int64 (*xFreeSpace)(const char *) */
|
|
||||||
0, /* ph7_int64 (*xTotalSpace)(const char *) */
|
|
||||||
0, /* ph7_int64 (*xFileSize)(const char *) */
|
|
||||||
0, /* ph7_int64 (*xFileAtime)(const char *) */
|
|
||||||
0, /* ph7_int64 (*xFileMtime)(const char *) */
|
|
||||||
0, /* ph7_int64 (*xFileCtime)(const char *) */
|
|
||||||
0, /* ph7_int64 (*xFileGroup)(const char *) */
|
|
||||||
0, /* ph7_int64 (*xFileInode)(const char *) */
|
|
||||||
0, /* ph7_int64 (*xFileOwner)(const char *) */
|
|
||||||
0, /* int (*xStat)(const char *,ph7_value *,ph7_value *) */
|
|
||||||
0, /* int (*xlStat)(const char *,ph7_value *,ph7_value *) */
|
|
||||||
0, /* int (*xIsFile)(const char *) */
|
|
||||||
0, /* int (*xIsLink)(const char *) */
|
|
||||||
0, /* int (*xReadable)(const char *) */
|
|
||||||
0, /* int (*xWritable)(const char *) */
|
|
||||||
0, /* int (*xExecutable)(const char *) */
|
|
||||||
0, /* int (*xFiletype)(const char *,ph7_context *) */
|
|
||||||
0, /* int (*xGetenv)(const char *,ph7_context *) */
|
|
||||||
0, /* int (*xSetenv)(const char *,const char *) */
|
|
||||||
0, /* int (*xTouch)(const char *,ph7_int64,ph7_int64) */
|
|
||||||
0, /* int (*xMmap)(const char *,void **,ph7_int64 *) */
|
|
||||||
0, /* void (*xUnmap)(void *,ph7_int64); */
|
|
||||||
0, /* int (*xLink)(const char *,const char *,int) */
|
|
||||||
0, /* int (*xUmask)(int) */
|
|
||||||
0, /* void (*xTempDir)(ph7_context *) */
|
|
||||||
0, /* unsigned int (*xProcessId)(void) */
|
|
||||||
0, /* int (*xUid)(void) */
|
|
||||||
0, /* int (*xGid)(void) */
|
|
||||||
0 /* void (*xUsername)(ph7_context *) */
|
|
||||||
};
|
|
||||||
#ifndef PH7_DISABLE_DISK_IO
|
#ifndef PH7_DISABLE_DISK_IO
|
||||||
#ifdef __WINNT__
|
#ifdef __WINNT__
|
||||||
/*
|
/*
|
||||||
|
@ -6933,8 +6885,8 @@ static int UnixVfs_getcwd(ph7_context *pCtx) {
|
||||||
/* int (*xMkdir)(const char *,int,int) */
|
/* int (*xMkdir)(const char *,int,int) */
|
||||||
static int UnixVfs_mkdir(const char *zPath, int mode, int recursive) {
|
static int UnixVfs_mkdir(const char *zPath, int mode, int recursive) {
|
||||||
int rc;
|
int rc;
|
||||||
|
SXUNUSED(recursive);
|
||||||
rc = mkdir(zPath, mode);
|
rc = mkdir(zPath, mode);
|
||||||
recursive = 0; /* cc warning */
|
|
||||||
return rc == 0 ? PH7_OK : -1;
|
return rc == 0 ? PH7_OK : -1;
|
||||||
}
|
}
|
||||||
/* int (*xRmdir)(const char *) */
|
/* int (*xRmdir)(const char *) */
|
||||||
|
@ -7521,10 +7473,10 @@ static int UnixFile_Open(const char *zPath, int iOpenMode, ph7_value *pResource,
|
||||||
/* int (*xOpenDir)(const char *,ph7_value *,void **) */
|
/* int (*xOpenDir)(const char *,ph7_value *,void **) */
|
||||||
static int UnixDir_Open(const char *zPath, ph7_value *pResource, void **ppHandle) {
|
static int UnixDir_Open(const char *zPath, ph7_value *pResource, void **ppHandle) {
|
||||||
DIR *pDir;
|
DIR *pDir;
|
||||||
|
SXUNUSED(pResource);
|
||||||
/* Open the target directory */
|
/* Open the target directory */
|
||||||
pDir = opendir(zPath);
|
pDir = opendir(zPath);
|
||||||
if(pDir == 0) {
|
if(pDir == 0) {
|
||||||
pResource = 0; /* Compiler warning */
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
/* Save our structure */
|
/* Save our structure */
|
||||||
|
|
11
engine/vm.c
11
engine/vm.c
|
@ -1364,7 +1364,7 @@ static ph7_value *VmExtractMemObj(
|
||||||
VmFrame *pFrame;
|
VmFrame *pFrame;
|
||||||
ph7_value *pObj;
|
ph7_value *pObj;
|
||||||
sxu32 nIdx;
|
sxu32 nIdx;
|
||||||
sxi32 rc;
|
SXUNUSED(bDup);
|
||||||
/* Point to the top active frame */
|
/* Point to the top active frame */
|
||||||
pFrame = pVm->pFrame;
|
pFrame = pVm->pFrame;
|
||||||
while(pFrame->pParent && (pFrame->iFlags & VM_FRAME_EXCEPTION)) {
|
while(pFrame->pParent && (pFrame->iFlags & VM_FRAME_EXCEPTION)) {
|
||||||
|
@ -1377,7 +1377,6 @@ static ph7_value *VmExtractMemObj(
|
||||||
pName = &sAnon;
|
pName = &sAnon;
|
||||||
/* Always nullify the object */
|
/* Always nullify the object */
|
||||||
bNullify = TRUE;
|
bNullify = TRUE;
|
||||||
bDup = FALSE;
|
|
||||||
}
|
}
|
||||||
/* Check the superglobals table first */
|
/* Check the superglobals table first */
|
||||||
pEntry = SyHashGet(&pVm->hSuper, (const void *)pName->zString, pName->nByte);
|
pEntry = SyHashGet(&pVm->hSuper, (const void *)pName->zString, pName->nByte);
|
||||||
|
@ -7764,6 +7763,7 @@ static int vm_builtin_var_export(ph7_context *pCtx, int nArg, ph7_value **apArg)
|
||||||
* The upper memory limit set for script processing.
|
* The upper memory limit set for script processing.
|
||||||
*/
|
*/
|
||||||
static int vm_builtin_get_memory_limit(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
static int vm_builtin_get_memory_limit(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||||
|
SXUNUSED(apArg);
|
||||||
if(nArg != 0) {
|
if(nArg != 0) {
|
||||||
ph7_result_bool(pCtx, 0);
|
ph7_result_bool(pCtx, 0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -7780,6 +7780,7 @@ static int vm_builtin_get_memory_limit(ph7_context *pCtx, int nArg, ph7_value **
|
||||||
* The maximum amount of memory that can be allocated from system.
|
* The maximum amount of memory that can be allocated from system.
|
||||||
*/
|
*/
|
||||||
static int vm_builtin_get_memory_peak_usage(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
static int vm_builtin_get_memory_peak_usage(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||||
|
SXUNUSED(apArg);
|
||||||
if(nArg != 0) {
|
if(nArg != 0) {
|
||||||
ph7_result_bool(pCtx, 0);
|
ph7_result_bool(pCtx, 0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -7796,6 +7797,7 @@ static int vm_builtin_get_memory_peak_usage(ph7_context *pCtx, int nArg, ph7_val
|
||||||
* Total memory allocated from system, including unused pages.
|
* Total memory allocated from system, including unused pages.
|
||||||
*/
|
*/
|
||||||
static int vm_builtin_get_memory_usage(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
static int vm_builtin_get_memory_usage(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||||
|
SXUNUSED(apArg);
|
||||||
if(nArg != 0) {
|
if(nArg != 0) {
|
||||||
ph7_result_bool(pCtx, 0);
|
ph7_result_bool(pCtx, 0);
|
||||||
} else {
|
} else {
|
||||||
|
@ -8049,6 +8051,8 @@ static int vm_builtin_debug_backtrace(ph7_context *pCtx, int nArg, ph7_value **a
|
||||||
SySet pDebug;
|
SySet pDebug;
|
||||||
VmDebugTrace *pTrace;
|
VmDebugTrace *pTrace;
|
||||||
ph7_value *pArray;
|
ph7_value *pArray;
|
||||||
|
SXUNUSED(nArg);
|
||||||
|
SXUNUSED(apArg);
|
||||||
/* Extract debug information */
|
/* Extract debug information */
|
||||||
if(VmExtractDebugTrace(&(*pVm), &pDebug) != SXRET_OK) {
|
if(VmExtractDebugTrace(&(*pVm), &pDebug) != SXRET_OK) {
|
||||||
ph7_result_null(pCtx);
|
ph7_result_null(pCtx);
|
||||||
|
@ -8135,7 +8139,6 @@ static sxi32 VmUncaughtException(
|
||||||
ph7_class_instance *pThis /* Exception class instance [i.e: Exception $e] */
|
ph7_class_instance *pThis /* Exception class instance [i.e: Exception $e] */
|
||||||
) {
|
) {
|
||||||
ph7_value *apArg[2], sArg;
|
ph7_value *apArg[2], sArg;
|
||||||
int nArg = 1;
|
|
||||||
sxi32 rc;
|
sxi32 rc;
|
||||||
if(pVm->nExceptDepth > 15) {
|
if(pVm->nExceptDepth > 15) {
|
||||||
/* Nesting limit reached */
|
/* Nesting limit reached */
|
||||||
|
@ -8148,8 +8151,6 @@ static sxi32 VmUncaughtException(
|
||||||
sArg.x.pOther = pThis;
|
sArg.x.pOther = pThis;
|
||||||
pThis->iRef++;
|
pThis->iRef++;
|
||||||
MemObjSetType(&sArg, MEMOBJ_OBJ);
|
MemObjSetType(&sArg, MEMOBJ_OBJ);
|
||||||
} else {
|
|
||||||
nArg = 0;
|
|
||||||
}
|
}
|
||||||
apArg[0] = &sArg;
|
apArg[0] = &sArg;
|
||||||
/* Call the exception handler if available */
|
/* Call the exception handler if available */
|
||||||
|
|
|
@ -14,6 +14,8 @@ static void AER_DUMMY_CONSTANT_Const(ph7_value *pVal, void *pUserData) {
|
||||||
|
|
||||||
int aer_dummy_function(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
int aer_dummy_function(ph7_context *pCtx, int nArg, ph7_value **apArg) {
|
||||||
SyString dummy;
|
SyString dummy;
|
||||||
|
SXUNUSED(nArg);
|
||||||
|
SXUNUSED(apArg);
|
||||||
const char *text = "Hello world from dummy module!";
|
const char *text = "Hello world from dummy module!";
|
||||||
SyStringInitFromBuf(&dummy, text, SyStrlen(text));
|
SyStringInitFromBuf(&dummy, text, SyStrlen(text));
|
||||||
ph7_result_string(pCtx, dummy.zString, dummy.nByte);
|
ph7_result_string(pCtx, dummy.zString, dummy.nByte);
|
||||||
|
|
|
@ -65,6 +65,7 @@ static void Help(void) {
|
||||||
* with a configuration verb set to: PH7_VM_CONFIG_OUTPUT.
|
* with a configuration verb set to: PH7_VM_CONFIG_OUTPUT.
|
||||||
*/
|
*/
|
||||||
static int Output_Consumer(const void *pOutput, unsigned int nOutputLen, void *pUserData /* Unused */) {
|
static int Output_Consumer(const void *pOutput, unsigned int nOutputLen, void *pUserData /* Unused */) {
|
||||||
|
(void)pUserData;
|
||||||
#ifdef __WINNT__
|
#ifdef __WINNT__
|
||||||
BOOL rc;
|
BOOL rc;
|
||||||
rc = WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), pOutput, (DWORD)nOutputLen, 0, 0);
|
rc = WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), pOutput, (DWORD)nOutputLen, 0, 0);
|
||||||
|
|
Loading…
Reference in New Issue