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 && i