Update AMTL; replace AutoPtr/UniquePtr with STL.
This commit is contained in:
parent
c2df49ee33
commit
7d7253c9cc
@ -29,6 +29,8 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <ITextParsers.h>
|
#include <ITextParsers.h>
|
||||||
#include "ChatTriggers.h"
|
#include "ChatTriggers.h"
|
||||||
#include "sm_stringutil.h"
|
#include "sm_stringutil.h"
|
||||||
@ -64,7 +66,7 @@ ChatTriggers::~ChatTriggers()
|
|||||||
|
|
||||||
void ChatTriggers::SetChatTrigger(ChatTriggerType type, const char *value)
|
void ChatTriggers::SetChatTrigger(ChatTriggerType type, const char *value)
|
||||||
{
|
{
|
||||||
ke::AutoPtr<char[]> filtered(new char[strlen(value) + 1]);
|
std::unique_ptr<char[]> filtered(new char[strlen(value) + 1]);
|
||||||
|
|
||||||
const char *src = value;
|
const char *src = value;
|
||||||
char *dest = filtered.get();
|
char *dest = filtered.get();
|
||||||
|
@ -30,15 +30,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ConCmdManager.h"
|
#include "ConCmdManager.h"
|
||||||
#include "sm_stringutil.h"
|
|
||||||
#include "PlayerManager.h"
|
|
||||||
#include "HalfLife2.h"
|
|
||||||
#include "ChatTriggers.h"
|
|
||||||
#include "logic_bridge.h"
|
|
||||||
#include "sourcemod.h"
|
|
||||||
#include "provider.h"
|
|
||||||
#include "command_args.h"
|
|
||||||
#include <bridge/include/IScriptManager.h>
|
#include <bridge/include/IScriptManager.h>
|
||||||
|
#include "ChatTriggers.h"
|
||||||
|
#include "HalfLife2.h"
|
||||||
|
#include "PlayerManager.h"
|
||||||
|
#include "command_args.h"
|
||||||
|
#include "logic_bridge.h"
|
||||||
|
#include "provider.h"
|
||||||
|
#include "sm_stringutil.h"
|
||||||
|
#include "sourcemod.h"
|
||||||
|
|
||||||
using namespace ke;
|
using namespace ke;
|
||||||
|
|
||||||
@ -181,7 +182,7 @@ ResultType ConCmdManager::DispatchClientCommand(int client, const char *cmd, int
|
|||||||
if (hook->type == CmdHook::Server || !hook->pf->IsRunnable())
|
if (hook->type == CmdHook::Server || !hook->pf->IsRunnable())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (hook->admin && !CheckAccess(client, cmd, hook->admin))
|
if (hook->admin && !CheckAccess(client, cmd, hook->admin.get()))
|
||||||
{
|
{
|
||||||
if (result < Pl_Handled)
|
if (result < Pl_Handled)
|
||||||
result = Pl_Handled;
|
result = Pl_Handled;
|
||||||
@ -271,7 +272,7 @@ bool ConCmdManager::InternalDispatch(int client, const ICommandArgs *args)
|
|||||||
} else {
|
} else {
|
||||||
// Check admin rights if needed. realClient isn't needed since we
|
// Check admin rights if needed. realClient isn't needed since we
|
||||||
// should bypass admin checks if client == 0 anyway.
|
// should bypass admin checks if client == 0 anyway.
|
||||||
if (client && hook->admin && !CheckAccess(client, cmd, hook->admin))
|
if (client && hook->admin && !CheckAccess(client, cmd, hook->admin.get()))
|
||||||
{
|
{
|
||||||
if (result < Pl_Handled)
|
if (result < Pl_Handled)
|
||||||
result = Pl_Handled;
|
result = Pl_Handled;
|
||||||
@ -360,7 +361,7 @@ bool ConCmdManager::AddAdminCommand(IPluginFunction *pFunction,
|
|||||||
RefPtr<CommandGroup> cmdgroup = i->value;
|
RefPtr<CommandGroup> cmdgroup = i->value;
|
||||||
|
|
||||||
CmdHook *pHook = new CmdHook(CmdHook::Client, pInfo, pFunction, description);
|
CmdHook *pHook = new CmdHook(CmdHook::Client, pInfo, pFunction, description);
|
||||||
pHook->admin = new AdminCmdInfo(cmdgroup, adminflags);
|
pHook->admin = std::make_unique<AdminCmdInfo>(cmdgroup, adminflags);
|
||||||
|
|
||||||
/* First get the command group override, if any */
|
/* First get the command group override, if any */
|
||||||
bool override = adminsys->GetCommandOverride(group,
|
bool override = adminsys->GetCommandOverride(group,
|
||||||
|
@ -32,6 +32,8 @@
|
|||||||
#ifndef _INCLUDE_SOURCEMOD_CONCMDMANAGER_H_
|
#ifndef _INCLUDE_SOURCEMOD_CONCMDMANAGER_H_
|
||||||
#define _INCLUDE_SOURCEMOD_CONCMDMANAGER_H_
|
#define _INCLUDE_SOURCEMOD_CONCMDMANAGER_H_
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "sm_globals.h"
|
#include "sm_globals.h"
|
||||||
#include "sourcemm_api.h"
|
#include "sourcemm_api.h"
|
||||||
#include <IForwardSys.h>
|
#include <IForwardSys.h>
|
||||||
@ -41,7 +43,6 @@
|
|||||||
#include <IAdminSystem.h>
|
#include <IAdminSystem.h>
|
||||||
#include "concmd_cleaner.h"
|
#include "concmd_cleaner.h"
|
||||||
#include "GameHooks.h"
|
#include "GameHooks.h"
|
||||||
#include <am-autoptr.h>
|
|
||||||
#include <sm_stringhashmap.h>
|
#include <sm_stringhashmap.h>
|
||||||
#include <am-utility.h>
|
#include <am-utility.h>
|
||||||
#include <am-inlinelist.h>
|
#include <am-inlinelist.h>
|
||||||
@ -90,7 +91,7 @@ struct CmdHook : public ke::InlineListNode<CmdHook>
|
|||||||
ConCmdInfo *info;
|
ConCmdInfo *info;
|
||||||
IPluginFunction *pf; /* function hook */
|
IPluginFunction *pf; /* function hook */
|
||||||
ke::AString helptext; /* help text */
|
ke::AString helptext; /* help text */
|
||||||
ke::AutoPtr<AdminCmdInfo> admin; /* admin requirements, if any */
|
std::unique_ptr<AdminCmdInfo> admin; /* admin requirements, if any */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef ke::InlineList<CmdHook> CmdHookList;
|
typedef ke::InlineList<CmdHook> CmdHookList;
|
||||||
|
@ -307,7 +307,7 @@ bool ConsoleDetours::AddListener(IPluginFunction *fun, const char *command)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ke::AutoPtr<char[]> str(UTIL_ToLowerCase(command));
|
std::unique_ptr<char[]> str(UTIL_ToLowerCase(command));
|
||||||
IChangeableForward *forward;
|
IChangeableForward *forward;
|
||||||
if (!m_Listeners.retrieve(str.get(), &forward))
|
if (!m_Listeners.retrieve(str.get(), &forward))
|
||||||
{
|
{
|
||||||
@ -329,7 +329,7 @@ bool ConsoleDetours::RemoveListener(IPluginFunction *fun, const char *command)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ke::AutoPtr<char[]> str(UTIL_ToLowerCase(command));
|
std::unique_ptr<char[]> str(UTIL_ToLowerCase(command));
|
||||||
IChangeableForward *forward;
|
IChangeableForward *forward;
|
||||||
if (!m_Listeners.retrieve(str.get(), &forward))
|
if (!m_Listeners.retrieve(str.get(), &forward))
|
||||||
return false;
|
return false;
|
||||||
|
@ -637,7 +637,7 @@ bool CBaseMenu::AppendItem(const char *info, const ItemDrawInfo &draw)
|
|||||||
|
|
||||||
item.info = info;
|
item.info = info;
|
||||||
if (draw.display)
|
if (draw.display)
|
||||||
item.display = new ke::AString(draw.display);
|
item.display = std::make_unique<ke::AString>(draw.display);
|
||||||
item.style = draw.style;
|
item.style = draw.style;
|
||||||
|
|
||||||
m_items.append(ke::Move(item));
|
m_items.append(ke::Move(item));
|
||||||
@ -658,7 +658,7 @@ bool CBaseMenu::InsertItem(unsigned int position, const char *info, const ItemDr
|
|||||||
CItem item;
|
CItem item;
|
||||||
item.info = info;
|
item.info = info;
|
||||||
if (draw.display)
|
if (draw.display)
|
||||||
item.display = new ke::AString(draw.display);
|
item.display = std::make_unique<ke::AString>(draw.display);
|
||||||
item.style = draw.style;
|
item.style = draw.style;
|
||||||
|
|
||||||
m_items.insert(position, ke::Move(item));
|
m_items.insert(position, ke::Move(item));
|
||||||
|
@ -32,9 +32,10 @@
|
|||||||
#ifndef _INCLUDE_MENUSTYLE_BASE_H
|
#ifndef _INCLUDE_MENUSTYLE_BASE_H
|
||||||
#define _INCLUDE_MENUSTYLE_BASE_H
|
#define _INCLUDE_MENUSTYLE_BASE_H
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <IMenuManager.h>
|
#include <IMenuManager.h>
|
||||||
#include <IPlayerHelpers.h>
|
#include <IPlayerHelpers.h>
|
||||||
#include <am-autoptr.h>
|
|
||||||
#include <am-string.h>
|
#include <am-string.h>
|
||||||
#include <am-vector.h>
|
#include <am-vector.h>
|
||||||
#include "sm_fastlink.h"
|
#include "sm_fastlink.h"
|
||||||
@ -67,7 +68,7 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ke::AString info;
|
ke::AString info;
|
||||||
ke::AutoPtr<ke::AString> display;
|
std::unique_ptr<ke::AString> display;
|
||||||
unsigned int style;
|
unsigned int style;
|
||||||
unsigned int access;
|
unsigned int access;
|
||||||
|
|
||||||
|
@ -31,8 +31,10 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "CDataPack.h"
|
#include "CDataPack.h"
|
||||||
#include <amtl/am-autoptr.h>
|
|
||||||
|
|
||||||
CDataPack::CDataPack()
|
CDataPack::CDataPack()
|
||||||
{
|
{
|
||||||
@ -44,14 +46,14 @@ CDataPack::~CDataPack()
|
|||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
static ke::Vector<ke::AutoPtr<CDataPack>> sDataPackCache;
|
static ke::Vector<std::unique_ptr<CDataPack>> sDataPackCache;
|
||||||
|
|
||||||
CDataPack *CDataPack::New()
|
CDataPack *CDataPack::New()
|
||||||
{
|
{
|
||||||
if (sDataPackCache.empty())
|
if (sDataPackCache.empty())
|
||||||
return new CDataPack();
|
return new CDataPack();
|
||||||
|
|
||||||
CDataPack *pack = sDataPackCache.back().take();
|
CDataPack *pack = sDataPackCache.back().release();
|
||||||
sDataPackCache.pop();
|
sDataPackCache.pop();
|
||||||
pack->Initialize();
|
pack->Initialize();
|
||||||
return pack;
|
return pack;
|
||||||
|
@ -30,6 +30,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "ExtensionSys.h"
|
#include "ExtensionSys.h"
|
||||||
#include <ILibrarySys.h>
|
#include <ILibrarySys.h>
|
||||||
#include <ISourceMod.h>
|
#include <ISourceMod.h>
|
||||||
@ -496,7 +499,7 @@ void CExtensionManager::TryAutoload()
|
|||||||
|
|
||||||
g_pSM->BuildPath(Path_SM, path, sizeof(path), "extensions");
|
g_pSM->BuildPath(Path_SM, path, sizeof(path), "extensions");
|
||||||
|
|
||||||
ke::AutoPtr<IDirectory> pDir(libsys->OpenDirectory(path));
|
std::unique_ptr<IDirectory> pDir(libsys->OpenDirectory(path));
|
||||||
if (!pDir)
|
if (!pDir)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ HandleType_t HandleSystem::CreateType(const char *name,
|
|||||||
pType->dispatch = dispatch;
|
pType->dispatch = dispatch;
|
||||||
if (name && name[0] != '\0')
|
if (name && name[0] != '\0')
|
||||||
{
|
{
|
||||||
pType->name = new ke::AString(name);
|
pType->name = std::make_unique<ke::AString>(name);
|
||||||
m_TypeLookup.insert(name, pType);
|
m_TypeLookup.insert(name, pType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,12 +32,14 @@
|
|||||||
#ifndef _INCLUDE_SOURCEMOD_HANDLESYSTEM_H_
|
#ifndef _INCLUDE_SOURCEMOD_HANDLESYSTEM_H_
|
||||||
#define _INCLUDE_SOURCEMOD_HANDLESYSTEM_H_
|
#define _INCLUDE_SOURCEMOD_HANDLESYSTEM_H_
|
||||||
|
|
||||||
#include <IHandleSys.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sm_namehashset.h>
|
|
||||||
#include <amtl/am-autoptr.h>
|
#include <memory>
|
||||||
|
|
||||||
#include <amtl/am-string.h>
|
#include <amtl/am-string.h>
|
||||||
#include <amtl/am-function.h>
|
#include <amtl/am-function.h>
|
||||||
|
#include <IHandleSys.h>
|
||||||
|
#include <sm_namehashset.h>
|
||||||
#include "common_logic.h"
|
#include "common_logic.h"
|
||||||
|
|
||||||
#define HANDLESYS_MAX_HANDLES (1<<15)
|
#define HANDLESYS_MAX_HANDLES (1<<15)
|
||||||
@ -105,7 +107,7 @@ struct QHandleType
|
|||||||
TypeAccess typeSec;
|
TypeAccess typeSec;
|
||||||
HandleAccess hndlSec;
|
HandleAccess hndlSec;
|
||||||
unsigned int opened;
|
unsigned int opened;
|
||||||
ke::AutoPtr<ke::AString> name;
|
std::unique_ptr<ke::AString> name;
|
||||||
|
|
||||||
static inline bool matches(const char *key, const QHandleType *type)
|
static inline bool matches(const char *key, const QHandleType *type)
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
|
|
||||||
#include <IShareSys.h>
|
#include <IShareSys.h>
|
||||||
#include <IHandleSys.h>
|
#include <IHandleSys.h>
|
||||||
#include <am-autoptr.h>
|
|
||||||
#include <am-string.h>
|
#include <am-string.h>
|
||||||
#include <am-utility.h>
|
#include <am-utility.h>
|
||||||
#include <am-refcounting.h>
|
#include <am-refcounting.h>
|
||||||
@ -64,19 +63,19 @@ struct Native : public ke::Refcounted<Native>
|
|||||||
Native(CNativeOwner *owner, const sp_nativeinfo_t *native)
|
Native(CNativeOwner *owner, const sp_nativeinfo_t *native)
|
||||||
: owner(owner),
|
: owner(owner),
|
||||||
native(native),
|
native(native),
|
||||||
fake(NULL)
|
fake(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
Native(CNativeOwner *owner, FakeNative *fake)
|
Native(CNativeOwner *owner, FakeNative *fake)
|
||||||
: owner(owner),
|
: owner(owner),
|
||||||
native(NULL),
|
native(nullptr),
|
||||||
fake(fake)
|
fake(fake)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
CNativeOwner *owner;
|
CNativeOwner *owner;
|
||||||
const sp_nativeinfo_t *native;
|
const sp_nativeinfo_t *native;
|
||||||
ke::AutoPtr<FakeNative> fake;
|
std::unique_ptr<FakeNative> fake;
|
||||||
|
|
||||||
SPVM_NATIVE_FUNC func() const
|
SPVM_NATIVE_FUNC func() const
|
||||||
{
|
{
|
||||||
|
@ -79,7 +79,7 @@ CPlugin::CPlugin(const char *file)
|
|||||||
|
|
||||||
memset(&m_info, 0, sizeof(m_info));
|
memset(&m_info, 0, sizeof(m_info));
|
||||||
|
|
||||||
m_pPhrases = g_Translator.CreatePhraseCollection();
|
m_pPhrases.reset(g_Translator.CreatePhraseCollection());
|
||||||
}
|
}
|
||||||
|
|
||||||
CPlugin::~CPlugin()
|
CPlugin::~CPlugin()
|
||||||
@ -227,7 +227,7 @@ bool CPlugin::SetProperty(const char *prop, void *ptr)
|
|||||||
|
|
||||||
IPluginRuntime *CPlugin::GetRuntime()
|
IPluginRuntime *CPlugin::GetRuntime()
|
||||||
{
|
{
|
||||||
return m_pRuntime;
|
return m_pRuntime.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlugin::EvictWithError(PluginStatus status, const char *error_fmt, ...)
|
void CPlugin::EvictWithError(PluginStatus status, const char *error_fmt, ...)
|
||||||
@ -483,7 +483,7 @@ bool CPlugin::TryCompile()
|
|||||||
g_pSM->BuildPath(Path_SM, fullpath, sizeof(fullpath), "plugins/%s", m_filename);
|
g_pSM->BuildPath(Path_SM, fullpath, sizeof(fullpath), "plugins/%s", m_filename);
|
||||||
|
|
||||||
char loadmsg[255];
|
char loadmsg[255];
|
||||||
m_pRuntime = g_pSourcePawn2->LoadBinaryFromFile(fullpath, loadmsg, sizeof(loadmsg));
|
m_pRuntime.reset(g_pSourcePawn2->LoadBinaryFromFile(fullpath, loadmsg, sizeof(loadmsg)));
|
||||||
if (!m_pRuntime) {
|
if (!m_pRuntime) {
|
||||||
EvictWithError(Plugin_BadLoad, "Unable to load plugin (%s)", loadmsg);
|
EvictWithError(Plugin_BadLoad, "Unable to load plugin (%s)", loadmsg);
|
||||||
return false;
|
return false;
|
||||||
@ -658,7 +658,7 @@ time_t CPlugin::GetFileTimeStamp()
|
|||||||
|
|
||||||
IPhraseCollection *CPlugin::GetPhrases()
|
IPhraseCollection *CPlugin::GetPhrases()
|
||||||
{
|
{
|
||||||
return m_pPhrases;
|
return m_pPhrases.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlugin::DependencyDropped(CPlugin *pOwner)
|
void CPlugin::DependencyDropped(CPlugin *pOwner)
|
||||||
|
@ -32,9 +32,12 @@
|
|||||||
#ifndef _INCLUDE_SOURCEMOD_PLUGINSYSTEM_H_
|
#ifndef _INCLUDE_SOURCEMOD_PLUGINSYSTEM_H_
|
||||||
#define _INCLUDE_SOURCEMOD_PLUGINSYSTEM_H_
|
#define _INCLUDE_SOURCEMOD_PLUGINSYSTEM_H_
|
||||||
|
|
||||||
#include <time.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <IPluginSys.h>
|
#include <IPluginSys.h>
|
||||||
#include <IHandleSys.h>
|
#include <IHandleSys.h>
|
||||||
#include <IForwardSys.h>
|
#include <IForwardSys.h>
|
||||||
@ -267,8 +270,8 @@ private:
|
|||||||
char m_errormsg[256];
|
char m_errormsg[256];
|
||||||
|
|
||||||
// Internal properties that must by reset if the runtime is evicted.
|
// Internal properties that must by reset if the runtime is evicted.
|
||||||
ke::AutoPtr<IPluginRuntime> m_pRuntime;
|
std::unique_ptr<IPluginRuntime> m_pRuntime;
|
||||||
ke::AutoPtr<CPhraseCollection> m_pPhrases;
|
std::unique_ptr<CPhraseCollection> m_pPhrases;
|
||||||
IPluginContext *m_pContext;
|
IPluginContext *m_pContext;
|
||||||
sp_pubvar_t *m_MaxClientsVar;
|
sp_pubvar_t *m_MaxClientsVar;
|
||||||
StringHashMap<void *> m_Props;
|
StringHashMap<void *> m_Props;
|
||||||
|
@ -29,13 +29,16 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "ShareSys.h"
|
#include "ShareSys.h"
|
||||||
#include "ExtensionSys.h"
|
#include "ExtensionSys.h"
|
||||||
#include <ILibrarySys.h>
|
#include <ILibrarySys.h>
|
||||||
#include "common_logic.h"
|
#include "common_logic.h"
|
||||||
#include "PluginSys.h"
|
#include "PluginSys.h"
|
||||||
#include "HandleSys.h"
|
#include "HandleSys.h"
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
using namespace ke;
|
using namespace ke;
|
||||||
|
|
||||||
@ -406,15 +409,15 @@ AlreadyRefed<Native> ShareSystem::AddFakeNative(IPluginFunction *pFunc, const ch
|
|||||||
if (entry)
|
if (entry)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
AutoPtr<FakeNative> fake(new FakeNative(name, pFunc));
|
std::unique_ptr<FakeNative> fake(new FakeNative(name, pFunc));
|
||||||
|
|
||||||
fake->gate = g_pSourcePawn2->CreateFakeNative(func, fake);
|
fake->gate = g_pSourcePawn2->CreateFakeNative(func, fake.get());
|
||||||
if (!fake->gate)
|
if (!fake->gate)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
CNativeOwner *owner = g_PluginSys.GetPluginByCtx(fake->ctx->GetContext());
|
CNativeOwner *owner = g_PluginSys.GetPluginByCtx(fake->ctx->GetContext());
|
||||||
|
|
||||||
entry = new Native(owner, fake.take());
|
entry = new Native(owner, fake.release());
|
||||||
m_NtvCache.insert(name, entry);
|
m_NtvCache.insert(name, entry);
|
||||||
|
|
||||||
return entry.forget();
|
return entry.forget();
|
||||||
|
@ -30,8 +30,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "common_logic.h"
|
#include "common_logic.h"
|
||||||
#include <am-autoptr.h>
|
|
||||||
#include <am-moveable.h>
|
#include <am-moveable.h>
|
||||||
#include <am-refcounting.h>
|
#include <am-refcounting.h>
|
||||||
#include <sm_stringhashmap.h>
|
#include <sm_stringhashmap.h>
|
||||||
@ -182,7 +184,7 @@ struct TrieSnapshot
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t length;
|
size_t length;
|
||||||
ke::AutoPtr<int[]> keys;
|
std::unique_ptr<int[]> keys;
|
||||||
BaseStringTable strings;
|
BaseStringTable strings;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -557,7 +559,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 = ke::MakeUnique<int[]>(snapshot->length);
|
snapshot->keys = std::make_unique<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());
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "common_logic.h"
|
#include "common_logic.h"
|
||||||
#include "Database.h"
|
#include "Database.h"
|
||||||
#include "ExtensionSys.h"
|
#include "ExtensionSys.h"
|
||||||
@ -1667,8 +1669,8 @@ private:
|
|||||||
|
|
||||||
assert(results_.length() == txn_->entries.length());
|
assert(results_.length() == txn_->entries.length());
|
||||||
|
|
||||||
ke::AutoPtr<cell_t[]> data = ke::MakeUnique<cell_t[]>(results_.length());
|
std::unique_ptr<cell_t[]> data = std::make_unique<cell_t[]>(results_.length());
|
||||||
ke::AutoPtr<cell_t[]> handles = ke::MakeUnique<cell_t[]>(results_.length());
|
std::unique_ptr<cell_t[]> handles = std::make_unique<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_);
|
||||||
@ -1728,7 +1730,7 @@ public:
|
|||||||
{
|
{
|
||||||
HandleSecurity sec(ident_, g_pCoreIdent);
|
HandleSecurity sec(ident_, g_pCoreIdent);
|
||||||
|
|
||||||
ke::AutoPtr<cell_t[]> data = ke::MakeUnique<cell_t[]>(txn_->entries.length());
|
std::unique_ptr<cell_t[]> data = std::make_unique<cell_t[]>(txn_->entries.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;
|
||||||
|
|
||||||
|
@ -29,12 +29,13 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "common_logic.h"
|
#include "common_logic.h"
|
||||||
#include <IPluginSys.h>
|
#include <IPluginSys.h>
|
||||||
#include <IHandleSys.h>
|
#include <IHandleSys.h>
|
||||||
#include <IForwardSys.h>
|
#include <IForwardSys.h>
|
||||||
#include <ISourceMod.h>
|
#include <ISourceMod.h>
|
||||||
#include <amtl/am-autoptr.h>
|
|
||||||
|
|
||||||
HandleType_t g_GlobalFwdType = 0;
|
HandleType_t g_GlobalFwdType = 0;
|
||||||
HandleType_t g_PrivateFwdType = 0;
|
HandleType_t g_PrivateFwdType = 0;
|
||||||
@ -686,7 +687,7 @@ struct SMFrameActionData
|
|||||||
|
|
||||||
static void PawnFrameAction(void *pData)
|
static void PawnFrameAction(void *pData)
|
||||||
{
|
{
|
||||||
ke::AutoPtr<SMFrameActionData> frame(reinterpret_cast<SMFrameActionData *>(pData));
|
std::unique_ptr<SMFrameActionData> frame(reinterpret_cast<SMFrameActionData *>(pData));
|
||||||
IPlugin *pPlugin = pluginsys->PluginFromHandle(frame->ownerhandle, NULL);
|
IPlugin *pPlugin = pluginsys->PluginFromHandle(frame->ownerhandle, NULL);
|
||||||
if (!pPlugin)
|
if (!pPlugin)
|
||||||
{
|
{
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit 8a59372d1f8333ad455e03866b2aec7769cfb51a
|
Subproject commit bf8516fd43dd1f498e89e579ebd3b70a9041df09
|
@ -29,8 +29,6 @@
|
|||||||
* Version: $Id$
|
* Version: $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <am-moveable.h>
|
|
||||||
|
|
||||||
#ifndef _include_sourcemod_namehashset_h_
|
#ifndef _include_sourcemod_namehashset_h_
|
||||||
#define _include_sourcemod_namehashset_h_
|
#define _include_sourcemod_namehashset_h_
|
||||||
|
|
||||||
@ -124,7 +122,7 @@ public:
|
|||||||
template <typename U>
|
template <typename U>
|
||||||
bool add(Insert &i, U &&value)
|
bool add(Insert &i, U &&value)
|
||||||
{
|
{
|
||||||
return table_.add(i, ke::Forward<U>(value));
|
return table_.add(i, std::forward<U>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool retrieve(const char *aKey, T *value)
|
bool retrieve(const char *aKey, T *value)
|
||||||
@ -144,7 +142,7 @@ public:
|
|||||||
Insert i = table_.findForAdd(key);
|
Insert i = table_.findForAdd(key);
|
||||||
if (i.found())
|
if (i.found())
|
||||||
return false;
|
return false;
|
||||||
return table_.add(i, ke::Forward<U>(value));
|
return table_.add(i, std::forward<U>(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool contains(const char *aKey)
|
bool contains(const char *aKey)
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit ee2b9baac39f1e3d1e4c81600beb6b4e1f81323e
|
Subproject commit 2075605089d674d70a437469800eb47a916e3c91
|
Loading…
Reference in New Issue
Block a user