Merge pull request #544 from alliedmodders/update-amtl

Update to the latest SourcePawn and AMTL.
This commit is contained in:
David Anderson 2016-09-24 17:45:34 -07:00 committed by GitHub
commit 07ba8df977
7 changed files with 20 additions and 20 deletions

View File

@ -313,13 +313,13 @@ bool ConsoleDetours::AddListener(IPluginFunction *fun, const char *command)
} }
else else
{ {
ke::AutoArray<char> str(UTIL_ToLowerCase(command)); ke::AutoPtr<char[]> str(UTIL_ToLowerCase(command));
IChangeableForward *forward; IChangeableForward *forward;
if (!m_Listeners.retrieve(str, &forward)) if (!m_Listeners.retrieve(str.get(), &forward))
{ {
forward = forwardsys->CreateForwardEx(NULL, ET_Hook, 3, NULL, Param_Cell, forward = forwardsys->CreateForwardEx(NULL, ET_Hook, 3, NULL, Param_Cell,
Param_String, Param_Cell); Param_String, Param_Cell);
m_Listeners.insert(str, forward); m_Listeners.insert(str.get(), forward);
} }
forward->AddFunction(fun); forward->AddFunction(fun);
} }
@ -335,9 +335,9 @@ bool ConsoleDetours::RemoveListener(IPluginFunction *fun, const char *command)
} }
else else
{ {
ke::AutoArray<char> str(UTIL_ToLowerCase(command)); ke::AutoPtr<char[]> str(UTIL_ToLowerCase(command));
IChangeableForward *forward; IChangeableForward *forward;
if (!m_Listeners.retrieve(str, &forward)) if (!m_Listeners.retrieve(str.get(), &forward))
return false; return false;
return forward->RemoveFunction(fun); return forward->RemoveFunction(fun);
} }

View File

@ -520,7 +520,7 @@ void DBManager::KillWorkerThread()
m_QueueEvent.Notify(); m_QueueEvent.Notify();
} }
m_Worker->Join(); m_Worker->Join();
m_Worker = NULL; m_Worker = nullptr;
s_OneTimeThreaderErrorMsg = false; s_OneTimeThreaderErrorMsg = false;
m_Terminate = false; m_Terminate = false;
} }
@ -547,7 +547,7 @@ bool DBManager::AddToThreadQueue(IDBThreadOperation *op, PrioQueueLevel prio)
logger->LogError("[SM] Unable to create db threader (error unknown)"); logger->LogError("[SM] Unable to create db threader (error unknown)");
s_OneTimeThreaderErrorMsg = true; s_OneTimeThreaderErrorMsg = true;
} }
m_Worker = NULL; m_Worker = nullptr;
return false; return false;
} }
} }

View File

@ -251,7 +251,7 @@ void CPlugin::EvictWithError(PluginStatus status, const char *error_fmt, ...)
ke::SafeVsprintf(m_errormsg, sizeof(m_errormsg), error_fmt, ap); ke::SafeVsprintf(m_errormsg, sizeof(m_errormsg), error_fmt, ap);
va_end(ap); va_end(ap);
if (m_pRuntime != NULL) if (m_pRuntime)
{ {
m_pRuntime->SetPauseState(true); m_pRuntime->SetPauseState(true);
} }
@ -499,7 +499,7 @@ bool CPlugin::TryCompile()
IPluginContext *CPlugin::GetBaseContext() IPluginContext *CPlugin::GetBaseContext()
{ {
if (m_pRuntime == NULL) if (!m_pRuntime)
{ {
return NULL; return NULL;
} }
@ -558,7 +558,7 @@ bool CPlugin::IsSilentlyFailed()
bool CPlugin::IsDebugging() bool CPlugin::IsDebugging()
{ {
if (m_pRuntime == NULL) if (!m_pRuntime)
{ {
return false; return false;
} }

View File

@ -181,7 +181,7 @@ struct TrieSnapshot
} }
size_t length; size_t length;
ke::AutoArray<int> keys; ke::AutoPtr<int[]> keys;
BaseStringTable strings; BaseStringTable strings;
}; };
@ -556,7 +556,7 @@ static cell_t CreateTrieSnapshot(IPluginContext *pContext, const cell_t *params)
TrieSnapshot *snapshot = new TrieSnapshot; TrieSnapshot *snapshot = new TrieSnapshot;
snapshot->length = pTrie->map.elements(); snapshot->length = pTrie->map.elements();
snapshot->keys = new int[snapshot->length]; snapshot->keys = ke::MakeUnique<int[]>(snapshot->length);
size_t i = 0; size_t i = 0;
for (StringHashMap<Entry>::iterator iter = pTrie->map.iter(); !iter.empty(); iter.next(), i++) for (StringHashMap<Entry>::iterator iter = pTrie->map.iter(); !iter.empty(); iter.next(), i++)
snapshot->keys[i] = snapshot->strings.AddString(iter->key.chars(), iter->key.length()); snapshot->keys[i] = snapshot->strings.AddString(iter->key.chars(), iter->key.length());

View File

@ -1634,8 +1634,8 @@ private:
assert(results_.length() == txn_->entries.length()); assert(results_.length() == txn_->entries.length());
ke::AutoArray<cell_t> data(new cell_t[results_.length()]); ke::AutoPtr<cell_t[]> data = ke::MakeUnique<cell_t[]>(results_.length());
ke::AutoArray<cell_t> handles(new cell_t[results_.length()]); ke::AutoPtr<cell_t[]> handles = ke::MakeUnique<cell_t[]>(results_.length());
for (size_t i = 0; i < results_.length(); i++) for (size_t i = 0; i < results_.length(); i++)
{ {
CombinedQuery *obj = new CombinedQuery(results_[i], db_); CombinedQuery *obj = new CombinedQuery(results_[i], db_);
@ -1662,8 +1662,8 @@ private:
success_->PushCell(dbh); success_->PushCell(dbh);
success_->PushCell(data_); success_->PushCell(data_);
success_->PushCell(txn_->entries.length()); success_->PushCell(txn_->entries.length());
success_->PushArray(handles, results_.length()); success_->PushArray(handles.get(), results_.length());
success_->PushArray(data, results_.length()); success_->PushArray(data.get(), results_.length());
success_->Execute(NULL); success_->Execute(NULL);
// Cleanup. Note we clear results_, since freeing their handles will // Cleanup. Note we clear results_, since freeing their handles will
@ -1692,7 +1692,7 @@ public:
{ {
HandleSecurity sec(ident_, g_pCoreIdent); HandleSecurity sec(ident_, g_pCoreIdent);
ke::AutoArray<cell_t> data(new cell_t[results_.length()]); ke::AutoPtr<cell_t[]> data = ke::MakeUnique<cell_t[]>(results_.length());
for (size_t i = 0; i < txn_->entries.length(); i++) for (size_t i = 0; i < txn_->entries.length(); i++)
data[i] = txn_->entries[i].data; data[i] = txn_->entries[i].data;
@ -1708,7 +1708,7 @@ public:
failure_->PushCell(txn_->entries.length()); failure_->PushCell(txn_->entries.length());
failure_->PushString(error_.chars()); failure_->PushString(error_.chars());
failure_->PushCell(failIndex_); failure_->PushCell(failIndex_);
failure_->PushArray(data, txn_->entries.length()); failure_->PushArray(data.get(), txn_->entries.length());
failure_->Execute(NULL); failure_->Execute(NULL);
handlesys->FreeHandle(dbh, &sec); handlesys->FreeHandle(dbh, &sec);

@ -1 +1 @@
Subproject commit c0a83b780054b57f145d51f156551e108b93845c Subproject commit e3a888eab7ee73e7fbff9f3e2f0529a87b284d39

@ -1 +1 @@
Subproject commit 8b39fef524a695f7c6fab743cdd531dfeaeff936 Subproject commit 836bb7a6da1f88b3c795f11e88306c724ccef5dc