diff --git a/core/EventManager.cpp b/core/EventManager.cpp index 04888f3b..a95e78c9 100644 --- a/core/EventManager.cpp +++ b/core/EventManager.cpp @@ -194,7 +194,7 @@ EventHookError EventManager::HookEvent(const char *name, IPluginFunction *pFunct } /* Cache the name for post hooks */ - pHook->name = strdup(name); + pHook->name = sm_strdup(name); /* Increase reference count */ pHook->refCount++; @@ -300,7 +300,7 @@ EventHookError EventManager::UnhookEvent(const char *name, IPluginFunction *pFun sm_trie_delete(m_EventHooks, name); /* Free the cached name */ - free(pHook->name); + delete pHook->name; /* And finally free structure memory */ delete pHook; @@ -472,7 +472,7 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast) assert(pHook->pPostHook == NULL); assert(pHook->pPreHook == NULL); sm_trie_delete(m_EventHooks, pHook->name); - free(pHook->name); + delete pHook->name; delete pHook; } } diff --git a/core/TextParsers.cpp b/core/TextParsers.cpp index 9cc6c231..87b68311 100644 --- a/core/TextParsers.cpp +++ b/core/TextParsers.cpp @@ -48,7 +48,7 @@ static int g_ws_chartable[255] = {0}; bool TextParsers::IsWhitespace(const char *stream) { - return g_ws_chartable[(unsigned)*stream] == 1; + return g_ws_chartable[(unsigned char)*stream] == 1; } TextParsers::TextParsers() @@ -508,7 +508,7 @@ SMCError TextParsers::ParseStream_SMC(void *stream, else { /* Check if we're whitespace or not */ - if (!g_ws_chartable[(unsigned)c]) + if (!g_ws_chartable[(unsigned char)c]) { bool restage = false; /* Check various special tokens: @@ -823,7 +823,7 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene ***************************************************/ /* First strip beginning whitespace */ - while (*ptr != '\0' && g_ws_chartable[(unsigned)*ptr] != 0) + while (*ptr != '\0' && g_ws_chartable[(unsigned char)*ptr] != 0) { ptr++; } @@ -876,7 +876,7 @@ bool TextParsers::ParseFile_INI(const char *file, ITextListener_INI *ini_listene /* Lastly, strip ending whitespace off */ for (size_t i=len-1; i>=0 && iThrowNativeError("\"RemovePlayerItem\" not supported by this mod"); } else if (!pCall) { - return pContext->ThrowNativeError("\"RemovePlayerItem\" wrapper failed to initialized"); + return pContext->ThrowNativeError("\"RemovePlayerItem\" wrapper failed to initialize"); } } @@ -153,7 +153,7 @@ static cell_t GiveNamedItem(IPluginContext *pContext, const cell_t *params) { return pContext->ThrowNativeError("\"GiveNamedItem\" not supported by this mod"); } else if (!pCall) { - return pContext->ThrowNativeError("\"GiveNamedItem\" wrapper failed to initialized"); + return pContext->ThrowNativeError("\"GiveNamedItem\" wrapper failed to initialize"); } } @@ -190,7 +190,7 @@ static cell_t GetPlayerWeaponSlot(IPluginContext *pContext, const cell_t *params { return pContext->ThrowNativeError("\"Weapon_GetSlot\" not supported by this mod"); } else if (!pCall) { - return pContext->ThrowNativeError("\"Weapon_GetSlot\" wrapper failed to initialized"); + return pContext->ThrowNativeError("\"Weapon_GetSlot\" wrapper failed to initialize"); } } @@ -229,7 +229,7 @@ static cell_t IgniteEntity(IPluginContext *pContext, const cell_t *params) { return pContext->ThrowNativeError("\"Ignite\" not supported by this mod"); } else if (!pCall) { - return pContext->ThrowNativeError("\"Ignite\" wrapper failed to initialized"); + return pContext->ThrowNativeError("\"Ignite\" wrapper failed to initialize"); } } @@ -261,7 +261,7 @@ static cell_t IgniteEntity(IPluginContext *pContext, const cell_t *params) { return pContext->ThrowNativeError("\"Ignite\" not supported by this mod"); } else if (!pCall) { - return pContext->ThrowNativeError("\"Ignite\" wrapper failed to initialized"); + return pContext->ThrowNativeError("\"Ignite\" wrapper failed to initialize"); } } @@ -289,7 +289,7 @@ static cell_t ExtinguishEntity(IPluginContext *pContext, const cell_t *params) { return pContext->ThrowNativeError("\"Extinguish\" not supported by this mod"); } else if (!pCall) { - return pContext->ThrowNativeError("\"Extinguish\" wrapper failed to initialized"); + return pContext->ThrowNativeError("\"Extinguish\" wrapper failed to initialize"); } } @@ -313,7 +313,7 @@ static cell_t TeleportEntity(IPluginContext *pContext, const cell_t *params) { return pContext->ThrowNativeError("\"Teleport\" not supported by this mod"); } else if (!pCall) { - return pContext->ThrowNativeError("\"Teleport\" wrapper failed to initialized"); + return pContext->ThrowNativeError("\"Teleport\" wrapper failed to initialize"); } } @@ -343,7 +343,7 @@ static cell_t ForcePlayerSuicide(IPluginContext *pContext, const cell_t *params) } else if (!pCall) { - return pContext->ThrowNativeError("\"CommitSuicide\" wrapper failed to initialized"); + return pContext->ThrowNativeError("\"CommitSuicide\" wrapper failed to initialize"); } } @@ -365,7 +365,7 @@ static cell_t ForcePlayerSuicide(IPluginContext *pContext, const cell_t *params) { return pContext->ThrowNativeError("\"CommitSuicide\" not supported by this mod"); } else if (!pCall) { - return pContext->ThrowNativeError("\"CommitSuicide\" wrapper failed to initialized"); + return pContext->ThrowNativeError("\"CommitSuicide\" wrapper failed to initialize"); } } @@ -667,7 +667,7 @@ static cell_t FindEntityByClassname(IPluginContext *pContext, const cell_t *para { return pContext->ThrowNativeError("\"FindEntityByClassname\" not supported by this mod"); } else if (!pCall) { - return pContext->ThrowNativeError("\"FindEntityByClassname\" wrapper failed to initialized"); + return pContext->ThrowNativeError("\"FindEntityByClassname\" wrapper failed to initialize"); } } @@ -707,7 +707,7 @@ static cell_t CreateEntityByName(IPluginContext *pContext, const cell_t *params) { return pContext->ThrowNativeError("\"CreateEntityByName\" not supported by this mod"); } else if (!pCall) { - return pContext->ThrowNativeError("\"CreateEntityByName\" wrapper failed to initialized"); + return pContext->ThrowNativeError("\"CreateEntityByName\" wrapper failed to initialize"); } } @@ -745,7 +745,7 @@ static cell_t CreateEntityByName(IPluginContext *pContext, const cell_t *params) { return pContext->ThrowNativeError("\"CreateEntityByName\" not supported by this mod"); } else if (!pCall) { - return pContext->ThrowNativeError("\"CreateEntityByName\" wrapper failed to initialized"); + return pContext->ThrowNativeError("\"CreateEntityByName\" wrapper failed to initialize"); } } @@ -782,7 +782,7 @@ static cell_t DispatchSpawn(IPluginContext *pContext, const cell_t *params) { return pContext->ThrowNativeError("\"DispatchSpawn\" not supported by this mod"); } else if (!pCall) { - return pContext->ThrowNativeError("\"DispatchSpawn\" wrapper failed to initialized"); + return pContext->ThrowNativeError("\"DispatchSpawn\" wrapper failed to initialize"); } } @@ -807,7 +807,7 @@ static cell_t DispatchKeyValue(IPluginContext *pContext, const cell_t *params) { return pContext->ThrowNativeError("\"DispatchKeyValue\" not supported by this mod"); } else if (!pCall) { - return pContext->ThrowNativeError("\"DispatchKeyValue\" wrapper failed to initialized"); + return pContext->ThrowNativeError("\"DispatchKeyValue\" wrapper failed to initialize"); } } @@ -818,7 +818,7 @@ static cell_t DispatchKeyValue(IPluginContext *pContext, const cell_t *params) DECODE_VALVE_PARAM(3, vparams, 1); FINISH_CALL_SIMPLE(&ret); - return (ret) ? 1 : 0; + return ret ? 1 : 0; } static cell_t DispatchKeyValueFloat(IPluginContext *pContext, const cell_t *params) @@ -834,7 +834,7 @@ static cell_t DispatchKeyValueFloat(IPluginContext *pContext, const cell_t *para { return pContext->ThrowNativeError("\"DispatchKeyValueFloat\" not supported by this mod"); } else if (!pCall) { - return pContext->ThrowNativeError("\"DispatchKeyValueFloat\" wrapper failed to initialized"); + return pContext->ThrowNativeError("\"DispatchKeyValueFloat\" wrapper failed to initialize"); } } @@ -845,7 +845,7 @@ static cell_t DispatchKeyValueFloat(IPluginContext *pContext, const cell_t *para DECODE_VALVE_PARAM(3, vparams, 1); FINISH_CALL_SIMPLE(&ret); - return (ret) ? 1 : 0; + return ret ? 1 : 0; } static cell_t DispatchKeyValueVector(IPluginContext *pContext, const cell_t *params) @@ -865,7 +865,7 @@ static cell_t DispatchKeyValueVector(IPluginContext *pContext, const cell_t *par { return pContext->ThrowNativeError("\"DispatchKeyValueVector\" not supported by this mod"); } else if (!pCall) { - return pContext->ThrowNativeError("\"DispatchKeyValueVector\" wrapper failed to initialized"); + return pContext->ThrowNativeError("\"DispatchKeyValueVector\" wrapper failed to initialize"); } } @@ -876,7 +876,7 @@ static cell_t DispatchKeyValueVector(IPluginContext *pContext, const cell_t *par DECODE_VALVE_PARAM(3, vparams, 1); FINISH_CALL_SIMPLE(&ret); - return (ret) ? 1 : 0; + return ret ? 1 : 0; } static cell_t sm_GetClientAimTarget(IPluginContext *pContext, const cell_t *params) @@ -907,7 +907,7 @@ static cell_t sm_SetEntityModel(IPluginContext *pContext, const cell_t *params) { return pContext->ThrowNativeError("\"SetEntityModel\" not supported by this mod"); } else if (!pCall) { - return pContext->ThrowNativeError("\"SetEntityModel\" wrapper failed to initialized"); + return pContext->ThrowNativeError("\"SetEntityModel\" wrapper failed to initialize"); } } @@ -976,7 +976,7 @@ static cell_t WeaponEquip(IPluginContext *pContext, const cell_t *params) { return pContext->ThrowNativeError("\"WeaponEquip\" not supported by this mod"); } else if (!pCall) { - return pContext->ThrowNativeError("\"WeaponEquip\" wrapper failed to initialized"); + return pContext->ThrowNativeError("\"WeaponEquip\" wrapper failed to initialize"); } } @@ -999,7 +999,7 @@ static cell_t ActivateEntity(IPluginContext *pContext, const cell_t *params) } else if (!pCall) { - return pContext->ThrowNativeError("\"Activate\" wrapper failed to initialized"); + return pContext->ThrowNativeError("\"Activate\" wrapper failed to initialize"); } } @@ -1042,7 +1042,7 @@ static cell_t SetClientInfo(IPluginContext *pContext, const cell_t *params) } else if (!pCall) { - return pContext->ThrowNativeError("\"SetUserCvar\" wrapper failed to initialized"); + return pContext->ThrowNativeError("\"SetUserCvar\" wrapper failed to initialize"); } } @@ -1057,7 +1057,7 @@ static cell_t SetClientInfo(IPluginContext *pContext, const cell_t *params) } else if (!pUpdateSettings) { - return pContext->ThrowNativeError("\"SetUserCvar\" wrapper failed to initialized"); + return pContext->ThrowNativeError("\"SetUserCvar\" wrapper failed to initialize"); } } #else diff --git a/sourcepawn/compiler/sc1.c b/sourcepawn/compiler/sc1.c index f0e5dbe6..897d06f7 100644 --- a/sourcepawn/compiler/sc1.c +++ b/sourcepawn/compiler/sc1.c @@ -2312,12 +2312,13 @@ static int declloc(int fstatic) if (matchtoken(']')) { idxtag[numdim] = 0; dim[numdim] = 0; - numdim++; + numdim++; continue; } dim_ident = doexpr2(TRUE,FALSE,FALSE,FALSE,&idxtag[numdim],&dim_sym,0,&dim_val); if (dim_ident == iVARIABLE || dim_ident == iEXPRESSION || dim_ident == iARRAYCELL) { all_constant = 0; + dim[numdim] = 0; } else if (dim_ident == iCONSTEXPR) { dim[numdim] = dim_val.constval; /* :TODO: :URGENT: Make sure this still works */ @@ -2332,7 +2333,7 @@ static int declloc(int fstatic) error(29); /* invalid expression, assumed 0 */ } numdim++; - needtoken(']'); + needtoken(']'); } while (matchtoken('[')); if (all_constant) { /* Change the last dimension to be based on chars instead if we have a string */ @@ -2344,7 +2345,7 @@ static int declloc(int fstatic) ident = iARRAY; stgdel(_index, _code); } else { - if (tag == pc_tag_string && numdim && dim[numdim-1]) { + if (tag == pc_tag_string && numdim) { stradjust(sPRI); } pushreg(sPRI); diff --git a/sourcepawn/compiler/sc3.c b/sourcepawn/compiler/sc3.c index 6018082f..1b365730 100644 --- a/sourcepawn/compiler/sc3.c +++ b/sourcepawn/compiler/sc3.c @@ -2422,8 +2422,6 @@ static int nesting=0; if (!checktags_string(arg[argidx].tags, arg[argidx].numtags, &lval) && !checktag(arg[argidx].tags,arg[argidx].numtags,lval.tag)) error(213); - if (lval.tag!=0) - append_constval(&taglst,arg[argidx].name,lval.tag,0); break; case iVARIABLE: if (lval.ident==iLABEL || lval.ident==iFUNCTN || lval.ident==iREFFUNC