Replace AString with std::string.
This commit is contained in:
		
							parent
							
								
									301bafa3f5
								
							
						
					
					
						commit
						b725196a26
					
				@ -277,10 +277,10 @@ bool ChatTriggers::OnSayCommand_Pre(int client, const ICommandArgs *command)
 | 
			
		||||
	bool is_silent = false;
 | 
			
		||||
 | 
			
		||||
	// Prefer the silent trigger in case of clashes.
 | 
			
		||||
	if (strchr(m_PrivTrigger.chars(), m_ArgSBackup[0])) {
 | 
			
		||||
	if (strchr(m_PrivTrigger.c_str(), m_ArgSBackup[0])) {
 | 
			
		||||
		is_trigger = true;
 | 
			
		||||
		is_silent = true;
 | 
			
		||||
	} else if (strchr(m_PubTrigger.chars(), m_ArgSBackup[0])) {
 | 
			
		||||
	} else if (strchr(m_PubTrigger.c_str(), m_ArgSBackup[0])) {
 | 
			
		||||
		is_trigger = true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -74,8 +74,8 @@ private:
 | 
			
		||||
	cell_t CallOnClientSayCommand(int client);
 | 
			
		||||
private:
 | 
			
		||||
	ke::Vector<ke::RefPtr<CommandHook>> hooks_;
 | 
			
		||||
	ke::AString m_PubTrigger;
 | 
			
		||||
	ke::AString m_PrivTrigger;
 | 
			
		||||
	std::string m_PubTrigger;
 | 
			
		||||
	std::string m_PrivTrigger;
 | 
			
		||||
	bool m_bWillProcessInPost;
 | 
			
		||||
	bool m_bIsChatTrigger;
 | 
			
		||||
	bool m_bWasFloodedMessage;
 | 
			
		||||
 | 
			
		||||
@ -649,7 +649,7 @@ void ConCmdManager::OnRootConsoleCommand(const char *cmdname, const ICommandArgs
 | 
			
		||||
 | 
			
		||||
			name = hook->info->pCmd->GetName();
 | 
			
		||||
			if (hook->helptext.length())
 | 
			
		||||
				help = hook->helptext.chars();
 | 
			
		||||
				help = hook->helptext.c_str();
 | 
			
		||||
			else
 | 
			
		||||
				help = hook->info->pCmd->GetHelpText();
 | 
			
		||||
			UTIL_ConsolePrint("  %-17.16s %-12.11s %s", name, type, help);		
 | 
			
		||||
 | 
			
		||||
@ -90,7 +90,7 @@ struct CmdHook : public ke::InlineListNode<CmdHook>
 | 
			
		||||
	Type type;
 | 
			
		||||
	ConCmdInfo *info;
 | 
			
		||||
	IPluginFunction *pf;				/* function hook */
 | 
			
		||||
	ke::AString helptext;				/* help text */
 | 
			
		||||
	std::string helptext;				/* help text */
 | 
			
		||||
	std::unique_ptr<AdminCmdInfo> admin;	/* admin requirements, if any */
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -70,18 +70,16 @@ struct ConVarInfo
 | 
			
		||||
		{
 | 
			
		||||
			const char *conVarChars = info->pVar->GetName();
 | 
			
		||||
 | 
			
		||||
			ke::AString convarName = ke::AString(conVarChars).lowercase();
 | 
			
		||||
			ke::AString input = ke::AString(name).lowercase();
 | 
			
		||||
			std::string convarName = ke::Lowercase(conVarChars);
 | 
			
		||||
			std::string input = ke::Lowercase(name);
 | 
			
		||||
 | 
			
		||||
			return convarName == input;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		static inline uint32_t hash(const detail::CharsAndLength &key)
 | 
			
		||||
		{
 | 
			
		||||
			ke::AString original(key.chars());
 | 
			
		||||
			ke::AString lower = original.lowercase();
 | 
			
		||||
 | 
			
		||||
			return detail::CharsAndLength(lower.chars()).hash();
 | 
			
		||||
			std::string lower = ke::Lowercase(key.c_str());
 | 
			
		||||
			return detail::CharsAndLength(lower.c_str()).hash();
 | 
			
		||||
		}
 | 
			
		||||
	};
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -290,7 +290,7 @@ ConfigResult CoreConfig::SetConfigOption(const char *option, const char *value,
 | 
			
		||||
		pBase = pBase->m_pGlobalClassNext;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ke::AString vstr(value);
 | 
			
		||||
	std::string vstr(value);
 | 
			
		||||
	m_KeyValues.replace(option, std::move(vstr));
 | 
			
		||||
 | 
			
		||||
	return result;
 | 
			
		||||
@ -298,10 +298,10 @@ ConfigResult CoreConfig::SetConfigOption(const char *option, const char *value,
 | 
			
		||||
 | 
			
		||||
const char *CoreConfig::GetCoreConfigValue(const char *key)
 | 
			
		||||
{
 | 
			
		||||
	StringHashMap<ke::AString>::Result r = m_KeyValues.find(key);
 | 
			
		||||
	StringHashMap<std::string>::Result r = m_KeyValues.find(key);
 | 
			
		||||
	if (!r.found())
 | 
			
		||||
		return NULL;
 | 
			
		||||
	return r->value.chars();
 | 
			
		||||
	return r->value.c_str();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool SM_AreConfigsExecuted()
 | 
			
		||||
 | 
			
		||||
@ -68,7 +68,7 @@ private:
 | 
			
		||||
	 */
 | 
			
		||||
	ConfigResult SetConfigOption(const char *option, const char *value, ConfigSource, char *Error, size_t maxlength);
 | 
			
		||||
private:
 | 
			
		||||
	StringHashMap<ke::AString> m_KeyValues;
 | 
			
		||||
	StringHashMap<std::string> m_KeyValues;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
extern bool SM_AreConfigsExecuted();
 | 
			
		||||
 | 
			
		||||
@ -484,7 +484,7 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
 | 
			
		||||
				pForward->PushCell(BAD_HANDLE);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			pForward->PushString(pHook->name.chars());
 | 
			
		||||
			pForward->PushString(pHook->name.c_str());
 | 
			
		||||
			pForward->PushCell(bDontBroadcast);
 | 
			
		||||
			pForward->Execute(NULL);
 | 
			
		||||
 | 
			
		||||
@ -505,7 +505,7 @@ bool EventManager::OnFireEvent_Post(IGameEvent *pEvent, bool bDontBroadcast)
 | 
			
		||||
		{
 | 
			
		||||
			assert(pHook->pPostHook == NULL);
 | 
			
		||||
			assert(pHook->pPreHook == NULL);
 | 
			
		||||
			m_EventHooks.remove(pHook->name.chars());
 | 
			
		||||
			m_EventHooks.remove(pHook->name.c_str());
 | 
			
		||||
			delete pHook;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -71,11 +71,11 @@ struct EventHook
 | 
			
		||||
	IChangeableForward *pPostHook;
 | 
			
		||||
	bool postCopy;
 | 
			
		||||
	unsigned int refCount;
 | 
			
		||||
	ke::AString name;
 | 
			
		||||
	std::string name;
 | 
			
		||||
 | 
			
		||||
	static inline bool matches(const char *name, const EventHook *hook)
 | 
			
		||||
	{
 | 
			
		||||
		return strcmp(name, hook->name.chars()) == 0;
 | 
			
		||||
		return strcmp(name, hook->name.c_str()) == 0;
 | 
			
		||||
	}
 | 
			
		||||
	static inline uint32_t hash(const detail::CharsAndLength &key)
 | 
			
		||||
	{
 | 
			
		||||
 | 
			
		||||
@ -280,7 +280,7 @@ public:
 | 
			
		||||
		return !m_bFollowCSGOServerGuidelines || !m_CSGOBadList.has(pszPropName);
 | 
			
		||||
	}
 | 
			
		||||
private:
 | 
			
		||||
	ke::HashSet<ke::AString, detail::StringHashMapPolicy> m_CSGOBadList;
 | 
			
		||||
	ke::HashSet<std::string, detail::StringHashMapPolicy> m_CSGOBadList;
 | 
			
		||||
	bool m_bFollowCSGOServerGuidelines = true;
 | 
			
		||||
#endif
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -637,7 +637,7 @@ bool CBaseMenu::AppendItem(const char *info, const ItemDrawInfo &draw)
 | 
			
		||||
 | 
			
		||||
	item.info = info;
 | 
			
		||||
	if (draw.display)
 | 
			
		||||
		item.display = std::make_unique<ke::AString>(draw.display);
 | 
			
		||||
		item.display = std::make_unique<std::string>(draw.display);
 | 
			
		||||
	item.style = draw.style;
 | 
			
		||||
 | 
			
		||||
	m_items.append(std::move(item));
 | 
			
		||||
@ -658,7 +658,7 @@ bool CBaseMenu::InsertItem(unsigned int position, const char *info, const ItemDr
 | 
			
		||||
	CItem item;
 | 
			
		||||
	item.info = info;
 | 
			
		||||
	if (draw.display)
 | 
			
		||||
		item.display = std::make_unique<ke::AString>(draw.display);
 | 
			
		||||
		item.display = std::make_unique<std::string>(draw.display);
 | 
			
		||||
	item.style = draw.style;
 | 
			
		||||
 | 
			
		||||
	m_items.insert(position, std::move(item));
 | 
			
		||||
@ -686,11 +686,11 @@ const char *CBaseMenu::GetItemInfo(unsigned int position, ItemDrawInfo *draw/* =
 | 
			
		||||
 | 
			
		||||
	if (draw)
 | 
			
		||||
	{
 | 
			
		||||
		draw->display = m_items[position].display->chars();
 | 
			
		||||
		draw->display = m_items[position].display->c_str();
 | 
			
		||||
		draw->style = m_items[position].style;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return m_items[position].info.chars();
 | 
			
		||||
	return m_items[position].info.c_str();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
unsigned int CBaseMenu::GetItemCount()
 | 
			
		||||
@ -733,7 +733,7 @@ void CBaseMenu::SetDefaultTitle(const char *message)
 | 
			
		||||
 | 
			
		||||
const char *CBaseMenu::GetDefaultTitle()
 | 
			
		||||
{
 | 
			
		||||
	return m_Title.chars();
 | 
			
		||||
	return m_Title.c_str();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void CBaseMenu::Cancel()
 | 
			
		||||
 | 
			
		||||
@ -68,8 +68,8 @@ public:
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
	ke::AString info;
 | 
			
		||||
	std::unique_ptr<ke::AString> display;
 | 
			
		||||
	std::string info;
 | 
			
		||||
	std::unique_ptr<std::string> display;
 | 
			
		||||
	unsigned int style;
 | 
			
		||||
	unsigned int access;
 | 
			
		||||
 | 
			
		||||
@ -158,7 +158,7 @@ public:
 | 
			
		||||
private:
 | 
			
		||||
	void InternalDelete();
 | 
			
		||||
protected:
 | 
			
		||||
	ke::AString m_Title;
 | 
			
		||||
	std::string m_Title;
 | 
			
		||||
	IMenuStyle *m_pStyle;
 | 
			
		||||
	unsigned int m_Pagination;
 | 
			
		||||
	ke::Vector<CItem> m_items;
 | 
			
		||||
 | 
			
		||||
@ -405,7 +405,7 @@ void PlayerManager::RunAuthChecks()
 | 
			
		||||
		pPlayer = &m_Players[m_AuthQueue[i]];
 | 
			
		||||
		pPlayer->UpdateAuthIds();
 | 
			
		||||
		
 | 
			
		||||
		authstr = pPlayer->m_AuthID.chars();
 | 
			
		||||
		authstr = pPlayer->m_AuthID.c_str();
 | 
			
		||||
 | 
			
		||||
		if (!pPlayer->IsAuthStringValidated())
 | 
			
		||||
		{
 | 
			
		||||
@ -709,14 +709,14 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername
 | 
			
		||||
		for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++)
 | 
			
		||||
		{
 | 
			
		||||
			pListener = (*iter);
 | 
			
		||||
			pListener->OnClientAuthorized(client, steamId ? steamId : pPlayer->m_AuthID.chars());
 | 
			
		||||
			pListener->OnClientAuthorized(client, steamId ? steamId : pPlayer->m_AuthID.c_str());
 | 
			
		||||
		}
 | 
			
		||||
		/* Finally, tell plugins */
 | 
			
		||||
		if (m_clauth->GetFunctionCount())
 | 
			
		||||
		{
 | 
			
		||||
			m_clauth->PushCell(client);
 | 
			
		||||
			/* For legacy reasons, people are expecting the Steam2 id here if using Steam auth */
 | 
			
		||||
			m_clauth->PushString(steamId ? steamId : pPlayer->m_AuthID.chars());
 | 
			
		||||
			m_clauth->PushString(steamId ? steamId : pPlayer->m_AuthID.c_str());
 | 
			
		||||
			m_clauth->Execute(NULL);
 | 
			
		||||
		}
 | 
			
		||||
		pPlayer->Authorize_Post();
 | 
			
		||||
@ -919,13 +919,13 @@ void PlayerManager::OnPrintfFrameAction(unsigned int serial)
 | 
			
		||||
		int nNumBitsWritten = pNetChan->GetNumBitsWritten(false); // SVC_Print uses unreliable netchan
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		ke::AString &string = player.m_PrintfBuffer.front();
 | 
			
		||||
		std::string &string = player.m_PrintfBuffer.front();
 | 
			
		||||
 | 
			
		||||
		// stop if we'd overflow the SVC_Print buffer  (+7 as ceil)
 | 
			
		||||
		if ((nNumBitsWritten + NETMSG_TYPE_BITS + 7) / 8 + string.length() >= SVC_Print_BufferSize)
 | 
			
		||||
			break;
 | 
			
		||||
 | 
			
		||||
		SH_CALL(engine, &IVEngineServer::ClientPrintf)(player.m_pEdict, string.chars());
 | 
			
		||||
		SH_CALL(engine, &IVEngineServer::ClientPrintf)(player.m_pEdict, string.c_str());
 | 
			
		||||
 | 
			
		||||
		player.m_PrintfBuffer.popFront();
 | 
			
		||||
	}
 | 
			
		||||
@ -2298,7 +2298,7 @@ const char *CPlayer::GetAuthString(bool validated)
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return m_AuthID.chars();
 | 
			
		||||
	return m_AuthID.c_str();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const CSteamID &CPlayer::GetSteamId(bool validated)
 | 
			
		||||
@ -2319,7 +2319,7 @@ const char *CPlayer::GetSteam2Id(bool validated)
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return m_Steam2Id.chars();
 | 
			
		||||
	return m_Steam2Id.c_str();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char *CPlayer::GetSteam3Id(bool validated)
 | 
			
		||||
@ -2329,7 +2329,7 @@ const char *CPlayer::GetSteam3Id(bool validated)
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return m_Steam3Id.chars();
 | 
			
		||||
	return m_Steam3Id.c_str();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
unsigned int CPlayer::GetSteamAccountID(bool validated)
 | 
			
		||||
@ -2596,7 +2596,7 @@ void CPlayer::DoBasicAdminChecks()
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Check steam id */
 | 
			
		||||
	if ((id = adminsys->FindAdminByIdentity("steam", m_AuthID.chars())) != INVALID_ADMIN_ID)
 | 
			
		||||
	if ((id = adminsys->FindAdminByIdentity("steam", m_AuthID.c_str())) != INVALID_ADMIN_ID)
 | 
			
		||||
	{
 | 
			
		||||
		if (g_Players.CheckSetAdmin(client, this, id))
 | 
			
		||||
		{
 | 
			
		||||
 | 
			
		||||
@ -133,9 +133,9 @@ private:
 | 
			
		||||
	String m_Name;
 | 
			
		||||
	String m_Ip;
 | 
			
		||||
	String m_IpNoPort;
 | 
			
		||||
	ke::AString m_AuthID;
 | 
			
		||||
	ke::AString m_Steam2Id;
 | 
			
		||||
	ke::AString m_Steam3Id;
 | 
			
		||||
	std::string m_AuthID;
 | 
			
		||||
	std::string m_Steam2Id;
 | 
			
		||||
	std::string m_Steam3Id;
 | 
			
		||||
	AdminId m_Admin = INVALID_ADMIN_ID;
 | 
			
		||||
	bool m_TempAdmin = false;
 | 
			
		||||
	edict_t *m_pEdict = nullptr;
 | 
			
		||||
@ -154,7 +154,7 @@ private:
 | 
			
		||||
#if SOURCE_ENGINE == SE_CSGO
 | 
			
		||||
	QueryCvarCookie_t m_LanguageCookie = InvalidQueryCvarCookie;
 | 
			
		||||
#endif
 | 
			
		||||
	ke::Deque<ke::AString> m_PrintfBuffer;
 | 
			
		||||
	ke::Deque<std::string> m_PrintfBuffer;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class PlayerManager : 
 | 
			
		||||
 | 
			
		||||
@ -1844,12 +1844,12 @@ bool AdminCache::DumpCache(const char *filename)
 | 
			
		||||
		if (pGroup->pCmdGrpTable != NULL)
 | 
			
		||||
		{
 | 
			
		||||
			for (OverrideMap::iterator iter = pGroup->pCmdTable->iter(); !iter.empty(); iter.next())
 | 
			
		||||
				iterator_group_grp_override(fp, iter->key.chars(), iter->value);
 | 
			
		||||
				iterator_group_grp_override(fp, iter->key.c_str(), iter->value);
 | 
			
		||||
		}
 | 
			
		||||
		if (pGroup->pCmdTable != NULL)
 | 
			
		||||
		{
 | 
			
		||||
			for (OverrideMap::iterator iter = pGroup->pCmdTable->iter(); !iter.empty(); iter.next())
 | 
			
		||||
				iterator_group_basic_override(fp, iter->key.chars(), iter->value);
 | 
			
		||||
				iterator_group_basic_override(fp, iter->key.c_str(), iter->value);
 | 
			
		||||
		}
 | 
			
		||||
		fprintf(fp, "\t\t}\n");
 | 
			
		||||
 | 
			
		||||
@ -1924,9 +1924,9 @@ bool AdminCache::DumpCache(const char *filename)
 | 
			
		||||
 | 
			
		||||
	fprintf(fp, "\"Overrides\"\n{\n");
 | 
			
		||||
	for (FlagMap::iterator iter = m_CmdGrpOverrides.iter(); !iter.empty(); iter.next())
 | 
			
		||||
		iterator_glob_grp_override(fp, iter->key.chars(), iter->value);
 | 
			
		||||
		iterator_glob_grp_override(fp, iter->key.c_str(), iter->value);
 | 
			
		||||
	for (FlagMap::iterator iter = m_CmdOverrides.iter(); !iter.empty(); iter.next())
 | 
			
		||||
		iterator_glob_basic_override(fp, iter->key.chars(), iter->value);
 | 
			
		||||
		iterator_glob_basic_override(fp, iter->key.c_str(), iter->value);
 | 
			
		||||
	fprintf(fp, "}\n");
 | 
			
		||||
	
 | 
			
		||||
	fclose(fp);
 | 
			
		||||
 | 
			
		||||
@ -120,7 +120,7 @@ void CDataPack::PackString(const char *string)
 | 
			
		||||
{
 | 
			
		||||
	InternalPack val;
 | 
			
		||||
	val.type = CDataPackType::String;
 | 
			
		||||
	ke::AString *sval = new ke::AString(string);
 | 
			
		||||
	std::string *sval = new std::string(string);
 | 
			
		||||
	val.pData.sval = sval;
 | 
			
		||||
	elements.insert(position++, val);
 | 
			
		||||
}
 | 
			
		||||
@ -205,11 +205,11 @@ const char *CDataPack::ReadString(size_t *len) const
 | 
			
		||||
		return nullptr;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	const ke::AString &val = *elements[position++].pData.sval;
 | 
			
		||||
	const std::string &val = *elements[position++].pData.sval;
 | 
			
		||||
	if (len)
 | 
			
		||||
		*len = val.length();
 | 
			
		||||
 | 
			
		||||
	return val.chars();
 | 
			
		||||
	return val.c_str();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
cell_t *CDataPack::ReadCellArray(cell_t *size) const
 | 
			
		||||
 | 
			
		||||
@ -213,7 +213,7 @@ private:
 | 
			
		||||
		cell_t cval;
 | 
			
		||||
		float fval;
 | 
			
		||||
		uint8_t *vval;
 | 
			
		||||
		ke::AString *sval;
 | 
			
		||||
		std::string *sval;
 | 
			
		||||
		cell_t *aval;
 | 
			
		||||
	} InternalPackValue;
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
@ -148,12 +148,12 @@ bool DBManager::Connect(const char *name, IDBDriver **pdr, IDatabase **pdb, bool
 | 
			
		||||
		/* Try to assign a real driver pointer */
 | 
			
		||||
		if (pInfo->info.driver[0] == '\0')
 | 
			
		||||
		{
 | 
			
		||||
			ke::AString defaultDriver = list->GetDefaultDriver();
 | 
			
		||||
			std::string defaultDriver = list->GetDefaultDriver();
 | 
			
		||||
			if (!m_pDefault && defaultDriver.length() > 0)
 | 
			
		||||
			{
 | 
			
		||||
				m_pDefault = FindOrLoadDriver(defaultDriver.chars());
 | 
			
		||||
				m_pDefault = FindOrLoadDriver(defaultDriver.c_str());
 | 
			
		||||
			}
 | 
			
		||||
			dname = defaultDriver.length() ? defaultDriver.chars() : "default";
 | 
			
		||||
			dname = defaultDriver.length() ? defaultDriver.c_str() : "default";
 | 
			
		||||
			pInfo->realDriver = m_pDefault;
 | 
			
		||||
		} else {
 | 
			
		||||
			pInfo->realDriver = FindOrLoadDriver(pInfo->info.driver);
 | 
			
		||||
@ -256,10 +256,10 @@ void DBManager::RemoveDriver(IDBDriver *pDriver)
 | 
			
		||||
IDBDriver *DBManager::GetDefaultDriver()
 | 
			
		||||
{
 | 
			
		||||
	ConfDbInfoList *list = m_Builder.GetConfigList();
 | 
			
		||||
	ke::AString defaultDriver = list->GetDefaultDriver();
 | 
			
		||||
	std::string defaultDriver = list->GetDefaultDriver();
 | 
			
		||||
	if (!m_pDefault && defaultDriver.length() > 0)
 | 
			
		||||
	{
 | 
			
		||||
		m_pDefault = FindOrLoadDriver(defaultDriver.chars());
 | 
			
		||||
		m_pDefault = FindOrLoadDriver(defaultDriver.c_str());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return m_pDefault;
 | 
			
		||||
@ -580,7 +580,7 @@ void DBManager::OnPluginWillUnload(IPlugin *plugin)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ke::AString DBManager::GetDefaultDriverName()
 | 
			
		||||
std::string DBManager::GetDefaultDriverName()
 | 
			
		||||
{
 | 
			
		||||
	ConfDbInfoList *list = m_Builder.GetConfigList();
 | 
			
		||||
	return list->GetDefaultDriver();
 | 
			
		||||
 | 
			
		||||
@ -87,7 +87,7 @@ public: //IPluginsListener
 | 
			
		||||
public:
 | 
			
		||||
	IDBDriver *FindOrLoadDriver(const char *name);
 | 
			
		||||
	IDBDriver *GetDefaultDriver();
 | 
			
		||||
	ke::AString GetDefaultDriverName();
 | 
			
		||||
	std::string GetDefaultDriverName();
 | 
			
		||||
	bool AddToThreadQueue(IDBThreadOperation *op, PrioQueueLevel prio);
 | 
			
		||||
	void RunFrame();
 | 
			
		||||
	inline HandleType_t GetDatabaseType()
 | 
			
		||||
 | 
			
		||||
@ -59,9 +59,9 @@ void DatabaseConfBuilder::StartParse()
 | 
			
		||||
{
 | 
			
		||||
	SMCError err;
 | 
			
		||||
	SMCStates states = {0, 0};
 | 
			
		||||
	if ((err = textparsers->ParseFile_SMC(m_Filename.chars(), this, &states)) != SMCError_Okay)
 | 
			
		||||
	if ((err = textparsers->ParseFile_SMC(m_Filename.c_str(), this, &states)) != SMCError_Okay)
 | 
			
		||||
	{
 | 
			
		||||
		logger->LogError("[SM] Detected parse error(s) in file \"%s\"", m_Filename.chars());
 | 
			
		||||
		logger->LogError("[SM] Detected parse error(s) in file \"%s\"", m_Filename.c_str());
 | 
			
		||||
		if (err != SMCError_Custom)
 | 
			
		||||
		{
 | 
			
		||||
			const char *txt = textparsers->GetSMCErrorString(err);
 | 
			
		||||
@ -153,11 +153,11 @@ SMCResult DatabaseConfBuilder::ReadSMC_LeavingSection(const SMCStates *states)
 | 
			
		||||
 | 
			
		||||
	if (m_ParseState == DBPARSE_LEVEL_DATABASE)
 | 
			
		||||
	{
 | 
			
		||||
		m_ParseCurrent->info.driver = m_ParseCurrent->driver.chars();
 | 
			
		||||
		m_ParseCurrent->info.database = m_ParseCurrent->database.chars();
 | 
			
		||||
		m_ParseCurrent->info.host = m_ParseCurrent->host.chars();
 | 
			
		||||
		m_ParseCurrent->info.user = m_ParseCurrent->user.chars();
 | 
			
		||||
		m_ParseCurrent->info.pass = m_ParseCurrent->pass.chars();
 | 
			
		||||
		m_ParseCurrent->info.driver = m_ParseCurrent->driver.c_str();
 | 
			
		||||
		m_ParseCurrent->info.database = m_ParseCurrent->database.c_str();
 | 
			
		||||
		m_ParseCurrent->info.host = m_ParseCurrent->host.c_str();
 | 
			
		||||
		m_ParseCurrent->info.user = m_ParseCurrent->user.c_str();
 | 
			
		||||
		m_ParseCurrent->info.pass = m_ParseCurrent->pass.c_str();
 | 
			
		||||
		
 | 
			
		||||
		/* Save it.. */
 | 
			
		||||
		m_ParseCurrent->AddRef();
 | 
			
		||||
 | 
			
		||||
@ -46,12 +46,12 @@ public:
 | 
			
		||||
	ConfDbInfo() : realDriver(NULL)
 | 
			
		||||
	{
 | 
			
		||||
	}
 | 
			
		||||
	ke::AString name;
 | 
			
		||||
	ke::AString driver;
 | 
			
		||||
	ke::AString host;
 | 
			
		||||
	ke::AString user;
 | 
			
		||||
	ke::AString pass;
 | 
			
		||||
	ke::AString database;
 | 
			
		||||
	std::string name;
 | 
			
		||||
	std::string driver;
 | 
			
		||||
	std::string host;
 | 
			
		||||
	std::string user;
 | 
			
		||||
	std::string pass;
 | 
			
		||||
	std::string database;
 | 
			
		||||
	IDBDriver *realDriver;
 | 
			
		||||
	DatabaseInfo info;
 | 
			
		||||
};
 | 
			
		||||
@ -62,7 +62,7 @@ class ConfDbInfoList : public ke::Vector<ConfDbInfo *>
 | 
			
		||||
	friend class DBManager;
 | 
			
		||||
	friend class DatabaseConfBuilder;
 | 
			
		||||
private:
 | 
			
		||||
	ke::AString& GetDefaultDriver() {
 | 
			
		||||
	std::string& GetDefaultDriver() {
 | 
			
		||||
		return m_DefDriver;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
@ -72,11 +72,11 @@ private:
 | 
			
		||||
			ConfDbInfo *current = this->at(i);
 | 
			
		||||
			/* If we run into the default configuration, then we'll save it
 | 
			
		||||
			 * for the next call to GetDefaultConfiguration */ 
 | 
			
		||||
			if (strcmp(current->name.chars(), "default") == 0)
 | 
			
		||||
			if (strcmp(current->name.c_str(), "default") == 0)
 | 
			
		||||
			{
 | 
			
		||||
				m_DefaultConfig = current;
 | 
			
		||||
			}
 | 
			
		||||
			if (strcmp(current->name.chars(), name) == 0)
 | 
			
		||||
			if (strcmp(current->name.c_str(), name) == 0)
 | 
			
		||||
			{
 | 
			
		||||
				return current;
 | 
			
		||||
			}
 | 
			
		||||
@ -87,7 +87,7 @@ private:
 | 
			
		||||
		return m_DefaultConfig;
 | 
			
		||||
	}
 | 
			
		||||
	void SetDefaultDriver(const char *input) {
 | 
			
		||||
		m_DefDriver = ke::AString(input);
 | 
			
		||||
		m_DefDriver = std::string(input);
 | 
			
		||||
	}
 | 
			
		||||
	void ReleaseMembers() {
 | 
			
		||||
		for (size_t i = 0; i < this->length(); i++) {
 | 
			
		||||
@ -97,7 +97,7 @@ private:
 | 
			
		||||
	}
 | 
			
		||||
private:
 | 
			
		||||
	ConfDbInfo *m_DefaultConfig;
 | 
			
		||||
	ke::AString m_DefDriver;
 | 
			
		||||
	std::string m_DefDriver;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -122,7 +122,7 @@ private:
 | 
			
		||||
	ConfDbInfo *m_ParseCurrent;
 | 
			
		||||
	ConfDbInfoList *m_ParseList;
 | 
			
		||||
private:
 | 
			
		||||
	ke::AString m_Filename;
 | 
			
		||||
	std::string m_Filename;
 | 
			
		||||
	ConfDbInfoList *m_InfoList;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -194,17 +194,17 @@ void DebugReport::ReportError(const IErrorReport &report, IFrameIterator &iter)
 | 
			
		||||
		g_Logger.LogError("[SM] Blaming: %s", blame);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ke::Vector<ke::AString> arr = GetStackTrace(&iter);
 | 
			
		||||
	ke::Vector<std::string> arr = GetStackTrace(&iter);
 | 
			
		||||
	for (size_t i = 0; i < arr.length(); i++)
 | 
			
		||||
	{
 | 
			
		||||
		g_Logger.LogError("%s", arr[i].chars());
 | 
			
		||||
		g_Logger.LogError("%s", arr[i].c_str());
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ke::Vector<ke::AString> DebugReport::GetStackTrace(IFrameIterator *iter)
 | 
			
		||||
ke::Vector<std::string> DebugReport::GetStackTrace(IFrameIterator *iter)
 | 
			
		||||
{
 | 
			
		||||
	char temp[3072];
 | 
			
		||||
	ke::Vector<ke::AString> trace;
 | 
			
		||||
	ke::Vector<std::string> trace;
 | 
			
		||||
	iter->Reset();
 | 
			
		||||
	
 | 
			
		||||
	if (!iter->Done())
 | 
			
		||||
 | 
			
		||||
@ -50,7 +50,7 @@ public:
 | 
			
		||||
	void GenerateError(IPluginContext *ctx, cell_t func_idx, int err, const char *message, ...);
 | 
			
		||||
	void GenerateErrorVA(IPluginContext *ctx, cell_t func_idx, int err, const char *message, va_list ap); 
 | 
			
		||||
	void GenerateCodeError(IPluginContext *ctx, uint32_t code_addr, int err, const char *message, ...);
 | 
			
		||||
	ke::Vector<ke::AString> GetStackTrace(IFrameIterator *iter);
 | 
			
		||||
	ke::Vector<std::string> GetStackTrace(IFrameIterator *iter);
 | 
			
		||||
private:
 | 
			
		||||
	int _GetPluginIndex(IPluginContext *ctx);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -77,7 +77,7 @@ const char *SafeFrameIterator::FunctionName() const
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return frames[current].FunctionName.chars();
 | 
			
		||||
	return frames[current].FunctionName.c_str();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char *SafeFrameIterator::FilePath() const
 | 
			
		||||
@ -87,5 +87,5 @@ const char *SafeFrameIterator::FilePath() const
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return frames[current].FilePath.chars();
 | 
			
		||||
	return frames[current].FilePath.c_str();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -48,8 +48,8 @@ public:
 | 
			
		||||
	 */
 | 
			
		||||
	struct FrameInfo
 | 
			
		||||
	{	
 | 
			
		||||
		ke::AString FunctionName;
 | 
			
		||||
		ke::AString FilePath;
 | 
			
		||||
		std::string FunctionName;
 | 
			
		||||
		std::string FilePath;
 | 
			
		||||
		unsigned LineNumber;
 | 
			
		||||
 | 
			
		||||
		FrameInfo(IFrameIterator *it)
 | 
			
		||||
 | 
			
		||||
@ -399,13 +399,13 @@ SMCResult CGameConfig::ReadSMC_KeyValue(const SMCStates *states, const char *key
 | 
			
		||||
			m_Offsets.replace(m_offset, atoi(value));
 | 
			
		||||
		}
 | 
			
		||||
	} else if (m_ParseState == PSTATE_GAMEDEFS_KEYS) {
 | 
			
		||||
		ke::AString vstr(value);
 | 
			
		||||
		std::string vstr(value);
 | 
			
		||||
		m_Keys.replace(key, std::move(vstr));
 | 
			
		||||
	}
 | 
			
		||||
	else if (m_ParseState == PSTATE_GAMEDEFS_KEYS_PLATFORM) {
 | 
			
		||||
		if (IsPlatformCompatible(key, &matched_platform))
 | 
			
		||||
		{
 | 
			
		||||
			ke::AString vstr(value);
 | 
			
		||||
			std::string vstr(value);
 | 
			
		||||
			m_Keys.replace(m_Key, std::move(vstr));
 | 
			
		||||
		}
 | 
			
		||||
	} else if (m_ParseState == PSTATE_GAMEDEFS_SUPPORTED) {
 | 
			
		||||
@ -1001,10 +1001,10 @@ bool CGameConfig::GetOffset(const char *key, int *value)
 | 
			
		||||
 | 
			
		||||
const char *CGameConfig::GetKeyValue(const char *key)
 | 
			
		||||
{
 | 
			
		||||
	StringHashMap<ke::AString>::Result r = m_Keys.find(key);
 | 
			
		||||
	StringHashMap<std::string>::Result r = m_Keys.find(key);
 | 
			
		||||
	if (!r.found())
 | 
			
		||||
		return NULL;
 | 
			
		||||
	return r->value.chars();
 | 
			
		||||
	return r->value.c_str();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//memory addresses below 0x10000 are automatically considered invalid for dereferencing
 | 
			
		||||
 | 
			
		||||
@ -81,7 +81,7 @@ private:
 | 
			
		||||
	char m_CurFile[PLATFORM_MAX_PATH];
 | 
			
		||||
	StringHashMap<int> m_Offsets;
 | 
			
		||||
	StringHashMap<SendProp *> m_Props;
 | 
			
		||||
	StringHashMap<ke::AString> m_Keys;
 | 
			
		||||
	StringHashMap<std::string> m_Keys;
 | 
			
		||||
	StringHashMap<void *> m_Sigs;
 | 
			
		||||
	/* Parse states */
 | 
			
		||||
	int m_ParseState;
 | 
			
		||||
 | 
			
		||||
@ -206,7 +206,7 @@ HandleType_t HandleSystem::CreateType(const char *name,
 | 
			
		||||
	pType->dispatch = dispatch;
 | 
			
		||||
	if (name && name[0] != '\0')
 | 
			
		||||
	{
 | 
			
		||||
		pType->name = std::make_unique<ke::AString>(name);
 | 
			
		||||
		pType->name = std::make_unique<std::string>(name);
 | 
			
		||||
		m_TypeLookup.insert(name, pType);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -925,7 +925,7 @@ bool HandleSystem::RemoveType(HandleType_t type, IdentityToken_t *ident)
 | 
			
		||||
 | 
			
		||||
	/* Remove it from the type cache. */
 | 
			
		||||
	if (pType->name)
 | 
			
		||||
		m_TypeLookup.remove(pType->name->chars());
 | 
			
		||||
		m_TypeLookup.remove(pType->name->c_str());
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
@ -1051,7 +1051,7 @@ bool HandleSystem::TryAndFreeSomeHandles()
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (m_Types[i].name)
 | 
			
		||||
			pTypeName = m_Types[i].name->chars();
 | 
			
		||||
			pTypeName = m_Types[i].name->c_str();
 | 
			
		||||
		else
 | 
			
		||||
			pTypeName = "ANON";
 | 
			
		||||
 | 
			
		||||
@ -1131,7 +1131,7 @@ void HandleSystem::Dump(const HandleReporter &fn)
 | 
			
		||||
		unsigned int parentIdx;
 | 
			
		||||
		bool bresult;
 | 
			
		||||
		if (pType->name)
 | 
			
		||||
			type = pType->name->chars();
 | 
			
		||||
			type = pType->name->c_str();
 | 
			
		||||
 | 
			
		||||
		if ((parentIdx = m_Handles[i].clone) != 0)
 | 
			
		||||
		{
 | 
			
		||||
 | 
			
		||||
@ -107,7 +107,7 @@ struct QHandleType
 | 
			
		||||
	TypeAccess typeSec;
 | 
			
		||||
	HandleAccess hndlSec;
 | 
			
		||||
	unsigned int opened;
 | 
			
		||||
	std::unique_ptr<ke::AString> name;
 | 
			
		||||
	std::unique_ptr<std::string> name;
 | 
			
		||||
 | 
			
		||||
	static inline bool matches(const char *key, const QHandleType *type)
 | 
			
		||||
	{
 | 
			
		||||
 | 
			
		||||
@ -319,7 +319,7 @@ void Logger::_UpdateFiles(bool bLevelChange)
 | 
			
		||||
	char buff[PLATFORM_MAX_PATH];
 | 
			
		||||
	ke::SafeSprintf(buff, sizeof(buff), "%04d%02d%02d", curtime->tm_year + 1900, curtime->tm_mon + 1, curtime->tm_mday);
 | 
			
		||||
 | 
			
		||||
	ke::AString currentDate(buff);
 | 
			
		||||
	std::string currentDate(buff);
 | 
			
		||||
 | 
			
		||||
	if (m_Mode == LoggingMode_PerMap)
 | 
			
		||||
	{
 | 
			
		||||
@ -327,7 +327,7 @@ void Logger::_UpdateFiles(bool bLevelChange)
 | 
			
		||||
		{
 | 
			
		||||
			for (size_t iter = 0; iter < static_cast<size_t>(-1); ++iter)
 | 
			
		||||
			{
 | 
			
		||||
				g_pSM->BuildPath(Path_SM, buff, sizeof(buff), "logs/L%s%u.log", currentDate.chars(), iter);
 | 
			
		||||
				g_pSM->BuildPath(Path_SM, buff, sizeof(buff), "logs/L%s%u.log", currentDate.c_str(), iter);
 | 
			
		||||
				if (!libsys->IsPathFile(buff))
 | 
			
		||||
				{
 | 
			
		||||
					break;
 | 
			
		||||
@ -336,12 +336,12 @@ void Logger::_UpdateFiles(bool bLevelChange)
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
		{
 | 
			
		||||
			ke::SafeStrcpy(buff, sizeof(buff), m_NormalFileName.chars());
 | 
			
		||||
			ke::SafeStrcpy(buff, sizeof(buff), m_NormalFileName.c_str());
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		g_pSM->BuildPath(Path_SM, buff, sizeof(buff), "logs/L%s.log", currentDate.chars());
 | 
			
		||||
		g_pSM->BuildPath(Path_SM, buff, sizeof(buff), "logs/L%s.log", currentDate.c_str());
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (m_NormalFileName.compare(buff))
 | 
			
		||||
@ -353,11 +353,11 @@ void Logger::_UpdateFiles(bool bLevelChange)
 | 
			
		||||
	{
 | 
			
		||||
		if (bLevelChange)
 | 
			
		||||
		{
 | 
			
		||||
			LogMessage("-------- Mapchange to %s --------", m_CurrentMapName.chars());
 | 
			
		||||
			LogMessage("-------- Mapchange to %s --------", m_CurrentMapName.c_str());
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	g_pSM->BuildPath(Path_SM, buff, sizeof(buff), "logs/errors_%s.log", currentDate.chars());
 | 
			
		||||
	g_pSM->BuildPath(Path_SM, buff, sizeof(buff), "logs/errors_%s.log", currentDate.c_str());
 | 
			
		||||
	if (bLevelChange || m_ErrorFileName.compare(buff))
 | 
			
		||||
	{
 | 
			
		||||
		_CloseError();
 | 
			
		||||
@ -369,7 +369,7 @@ FILE *Logger::_OpenNormal()
 | 
			
		||||
{
 | 
			
		||||
	_UpdateFiles();
 | 
			
		||||
 | 
			
		||||
	FILE *pFile = fopen(m_NormalFileName.chars(), "a+");
 | 
			
		||||
	FILE *pFile = fopen(m_NormalFileName.c_str(), "a+");
 | 
			
		||||
	if (pFile == NULL)
 | 
			
		||||
	{
 | 
			
		||||
		_LogFatalOpen(m_NormalFileName);
 | 
			
		||||
@ -383,7 +383,7 @@ FILE *Logger::_OpenNormal()
 | 
			
		||||
		char date[32];
 | 
			
		||||
 | 
			
		||||
		strftime(date, sizeof(date), "%m/%d/%Y - %H:%M:%S", curtime);
 | 
			
		||||
		fprintf(pFile, "L %s: SourceMod log file session started (file \"%s\") (Version \"%s\")\n", date, m_NormalFileName.chars(), SOURCEMOD_VERSION);
 | 
			
		||||
		fprintf(pFile, "L %s: SourceMod log file session started (file \"%s\") (Version \"%s\")\n", date, m_NormalFileName.c_str(), SOURCEMOD_VERSION);
 | 
			
		||||
		m_DamagedNormalFile = true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -394,7 +394,7 @@ FILE *Logger::_OpenError()
 | 
			
		||||
{
 | 
			
		||||
	_UpdateFiles();
 | 
			
		||||
 | 
			
		||||
	FILE *pFile = fopen(m_ErrorFileName.chars(), "a+");
 | 
			
		||||
	FILE *pFile = fopen(m_ErrorFileName.c_str(), "a+");
 | 
			
		||||
	if (pFile == NULL)
 | 
			
		||||
	{
 | 
			
		||||
		_LogFatalOpen(m_ErrorFileName);
 | 
			
		||||
@ -409,7 +409,7 @@ FILE *Logger::_OpenError()
 | 
			
		||||
		char date[32];
 | 
			
		||||
		strftime(date, sizeof(date), "%m/%d/%Y - %H:%M:%S", curtime);
 | 
			
		||||
		fprintf(pFile, "L %s: SourceMod error session started\n", date);
 | 
			
		||||
		fprintf(pFile, "L %s: Info (map \"%s\") (file \"%s\")\n", date, m_CurrentMapName.chars(), m_ErrorFileName.chars());
 | 
			
		||||
		fprintf(pFile, "L %s: Info (map \"%s\") (file \"%s\")\n", date, m_CurrentMapName.c_str(), m_ErrorFileName.c_str());
 | 
			
		||||
		m_DamagedErrorFile = true;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -423,11 +423,11 @@ FILE *Logger::_OpenFatal()
 | 
			
		||||
	return fopen(path, "at");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Logger::_LogFatalOpen(ke::AString &str)
 | 
			
		||||
void Logger::_LogFatalOpen(std::string &str)
 | 
			
		||||
{
 | 
			
		||||
	char error[255];
 | 
			
		||||
	libsys->GetPlatformError(error, sizeof(error));
 | 
			
		||||
	LogFatal("[SM] Unexpected fatal logging error (file \"%s\")", str.chars());
 | 
			
		||||
	LogFatal("[SM] Unexpected fatal logging error (file \"%s\")", str.c_str());
 | 
			
		||||
	LogFatal("[SM] Platform returned error: \"%s\"", error);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -92,13 +92,13 @@ private:
 | 
			
		||||
	FILE *_OpenError();
 | 
			
		||||
	FILE *_OpenFatal();
 | 
			
		||||
 | 
			
		||||
	void _LogFatalOpen(ke::AString &str);
 | 
			
		||||
	void _LogFatalOpen(std::string &str);
 | 
			
		||||
	void _PrintToGameLog(const char *fmt, va_list ap);
 | 
			
		||||
	void _UpdateFiles(bool bLevelChange = false);
 | 
			
		||||
private:
 | 
			
		||||
	ke::AString m_NormalFileName;
 | 
			
		||||
	ke::AString m_ErrorFileName;
 | 
			
		||||
	ke::AString m_CurrentMapName;
 | 
			
		||||
	std::string m_NormalFileName;
 | 
			
		||||
	std::string m_ErrorFileName;
 | 
			
		||||
	std::string m_CurrentMapName;
 | 
			
		||||
 | 
			
		||||
	int m_Day;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -52,7 +52,7 @@ struct FakeNative
 | 
			
		||||
	}
 | 
			
		||||
	~FakeNative();
 | 
			
		||||
 | 
			
		||||
	ke::AString name;
 | 
			
		||||
	std::string name;
 | 
			
		||||
	IPluginContext *ctx;
 | 
			
		||||
	IPluginFunction *call;
 | 
			
		||||
	SPVM_NATIVE_FUNC gate;
 | 
			
		||||
@ -87,7 +87,7 @@ struct Native : public ke::Refcounted<Native>
 | 
			
		||||
	{
 | 
			
		||||
		if (native)
 | 
			
		||||
			return native->name;
 | 
			
		||||
		return fake->name.chars();
 | 
			
		||||
		return fake->name.c_str();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	static inline bool matches(const char *name, const ke::RefPtr<Native> &entry)
 | 
			
		||||
 | 
			
		||||
@ -276,7 +276,7 @@ bool CPlugin::ReadInfo()
 | 
			
		||||
		sm_plugininfo_c_t *cinfo;
 | 
			
		||||
		cell_t local_addr;
 | 
			
		||||
 | 
			
		||||
		auto update_field = [base](cell_t addr, ke::AString *dest) {
 | 
			
		||||
		auto update_field = [base](cell_t addr, std::string *dest) {
 | 
			
		||||
			const char* ptr;
 | 
			
		||||
			if (base->LocalToString(addr, (char **)&ptr) == SP_ERROR_NONE)
 | 
			
		||||
				*dest = ptr;
 | 
			
		||||
@ -524,11 +524,11 @@ PluginType CPlugin::GetType()
 | 
			
		||||
 | 
			
		||||
const sm_plugininfo_t *CPlugin::GetPublicInfo()
 | 
			
		||||
{
 | 
			
		||||
	m_info.author = info_author_.chars();
 | 
			
		||||
	m_info.description = info_description_.chars();
 | 
			
		||||
	m_info.name = info_name_.chars();
 | 
			
		||||
	m_info.url = info_url_.chars();
 | 
			
		||||
	m_info.version = info_version_.chars();
 | 
			
		||||
	m_info.author = info_author_.c_str();
 | 
			
		||||
	m_info.description = info_description_.c_str();
 | 
			
		||||
	m_info.name = info_name_.c_str();
 | 
			
		||||
	m_info.url = info_url_.c_str();
 | 
			
		||||
	m_info.version = info_version_.c_str();
 | 
			
		||||
	return &m_info;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -2063,7 +2063,7 @@ bool CPluginManager::ReloadPlugin(CPlugin *pl, bool print)
 | 
			
		||||
	if (state == PluginState::WaitingToUnloadAndReload)
 | 
			
		||||
		return false;
 | 
			
		||||
 | 
			
		||||
	ke::AString filename(pl->GetFilename());
 | 
			
		||||
	std::string filename(pl->GetFilename());
 | 
			
		||||
	PluginType ptype = pl->GetType();
 | 
			
		||||
 | 
			
		||||
	int id = 1;
 | 
			
		||||
@ -2078,13 +2078,13 @@ bool CPluginManager::ReloadPlugin(CPlugin *pl, bool print)
 | 
			
		||||
		{
 | 
			
		||||
			pl->SetWaitingToUnload(true);
 | 
			
		||||
			ScheduleTaskForNextFrame([this, id, filename, ptype, print]() -> void {
 | 
			
		||||
				ReloadPluginImpl(id, filename.chars(), ptype, print);
 | 
			
		||||
				ReloadPluginImpl(id, filename.c_str(), ptype, print);
 | 
			
		||||
			});
 | 
			
		||||
		}
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ReloadPluginImpl(id, filename.chars(), ptype, false);
 | 
			
		||||
	ReloadPluginImpl(id, filename.c_str(), ptype, false);
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -289,11 +289,11 @@ private:
 | 
			
		||||
 | 
			
		||||
	// Cached.
 | 
			
		||||
	sm_plugininfo_t m_info;
 | 
			
		||||
	ke::AString info_name_;
 | 
			
		||||
	ke::AString info_author_;
 | 
			
		||||
	ke::AString info_description_;
 | 
			
		||||
	ke::AString info_version_;
 | 
			
		||||
	ke::AString info_url_;
 | 
			
		||||
	std::string info_name_;
 | 
			
		||||
	std::string info_author_;
 | 
			
		||||
	std::string info_description_;
 | 
			
		||||
	std::string info_version_;
 | 
			
		||||
	std::string info_url_;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
class CPluginManager : 
 | 
			
		||||
@ -487,10 +487,8 @@ private:
 | 
			
		||||
		{
 | 
			
		||||
/* For windows & mac, we convert the path to lower-case in order to avoid duplicate plugin loading */
 | 
			
		||||
#if defined PLATFORM_WINDOWS || defined PLATFORM_APPLE
 | 
			
		||||
			ke::AString original(key.chars());
 | 
			
		||||
			ke::AString lower = original.lowercase();
 | 
			
		||||
			
 | 
			
		||||
			return detail::CharsAndLength(lower.chars()).hash();
 | 
			
		||||
			std::string lower = ke::Lowercase(key.c_str());
 | 
			
		||||
			return detail::CharsAndLength(lower.c_str()).hash();
 | 
			
		||||
#else
 | 
			
		||||
			return key.hash();
 | 
			
		||||
#endif
 | 
			
		||||
@ -500,8 +498,8 @@ private:
 | 
			
		||||
		{
 | 
			
		||||
			const char *pluginFileChars = const_cast<CPlugin*>(plugin)->GetFilename();
 | 
			
		||||
#if defined PLATFORM_WINDOWS || defined PLATFORM_APPLE
 | 
			
		||||
			ke::AString pluginFile = ke::AString(pluginFileChars).lowercase();
 | 
			
		||||
			ke::AString input = ke::AString(file).lowercase();
 | 
			
		||||
			std::string pluginFile = ke::Lowercase(pluginFileChars);
 | 
			
		||||
			std::string input = ke::Lowercase(file);
 | 
			
		||||
			
 | 
			
		||||
			return pluginFile == input;
 | 
			
		||||
#else
 | 
			
		||||
 | 
			
		||||
@ -104,7 +104,7 @@ public:
 | 
			
		||||
		assert(isArray());
 | 
			
		||||
		return reinterpret_cast<cell_t *>(raw()->base());
 | 
			
		||||
	}
 | 
			
		||||
	char *chars() const {
 | 
			
		||||
	char *c_str() const {
 | 
			
		||||
		assert(isString());
 | 
			
		||||
		return reinterpret_cast<char *>(raw()->base());
 | 
			
		||||
	}
 | 
			
		||||
@ -518,7 +518,7 @@ static cell_t GetTrieString(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	size_t written;
 | 
			
		||||
	pContext->StringToLocalUTF8(params[3], params[4], r->value.chars(), &written);
 | 
			
		||||
	pContext->StringToLocalUTF8(params[3], params[4], r->value.c_str(), &written);
 | 
			
		||||
 | 
			
		||||
	*pSize = (cell_t)written;
 | 
			
		||||
	return 1;
 | 
			
		||||
@ -561,7 +561,7 @@ static cell_t CreateTrieSnapshot(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
	snapshot->keys = std::make_unique<int[]>(snapshot->length);
 | 
			
		||||
	size_t i = 0;
 | 
			
		||||
	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.c_str(), iter->key.length());
 | 
			
		||||
	assert(i == snapshot->length);
 | 
			
		||||
 | 
			
		||||
	if ((hndl = handlesys->CreateHandle(htSnapshot, snapshot, pContext->GetIdentity(), g_pCoreIdent, NULL))
 | 
			
		||||
 | 
			
		||||
@ -943,7 +943,7 @@ static cell_t LogStackTrace(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
	g_pSM->FormatString(buffer, sizeof(buffer), pContext, params, 1);
 | 
			
		||||
 | 
			
		||||
	IFrameIterator *it = pContext->CreateFrameIterator();
 | 
			
		||||
	ke::Vector<ke::AString> arr = g_DbgReporter.GetStackTrace(it);
 | 
			
		||||
	ke::Vector<std::string> arr = g_DbgReporter.GetStackTrace(it);
 | 
			
		||||
	pContext->DestroyFrameIterator(it);
 | 
			
		||||
 | 
			
		||||
	IPlugin *pPlugin = scripts->FindPluginByContext(pContext->GetContext());
 | 
			
		||||
@ -952,7 +952,7 @@ static cell_t LogStackTrace(IPluginContext *pContext, const cell_t *params)
 | 
			
		||||
	g_Logger.LogError("[SM] Called from: %s", pPlugin->GetFilename());
 | 
			
		||||
	for (size_t i = 0; i < arr.length(); ++i)
 | 
			
		||||
	{
 | 
			
		||||
		g_Logger.LogError("%s", arr[i].chars());
 | 
			
		||||
		g_Logger.LogError("%s", arr[i].c_str());
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -64,7 +64,7 @@ struct Transaction
 | 
			
		||||
{
 | 
			
		||||
	struct Entry
 | 
			
		||||
	{
 | 
			
		||||
		ke::AString query;
 | 
			
		||||
		std::string query;
 | 
			
		||||
		cell_t data;
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
@ -457,7 +457,7 @@ static cell_t ConnectToDbAsync(IPluginContext *pContext, const cell_t *params, A
 | 
			
		||||
			g_pSM->Format(error, 
 | 
			
		||||
				sizeof(error), 
 | 
			
		||||
				"Could not find driver \"%s\"", 
 | 
			
		||||
				pInfo->driver[0] == '\0' ? g_DBMan.GetDefaultDriverName().chars() : pInfo->driver);
 | 
			
		||||
				pInfo->driver[0] == '\0' ? g_DBMan.GetDefaultDriverName().c_str() : pInfo->driver);
 | 
			
		||||
		} else if (!driver->IsThreadSafe()) {
 | 
			
		||||
			g_pSM->Format(error,
 | 
			
		||||
				sizeof(error),
 | 
			
		||||
@ -1620,7 +1620,7 @@ private:
 | 
			
		||||
		for (size_t i = 0; i < txn_->entries.length(); i++)
 | 
			
		||||
		{
 | 
			
		||||
			Transaction::Entry &entry = txn_->entries[i];
 | 
			
		||||
			IQuery *result = Exec(entry.query.chars());
 | 
			
		||||
			IQuery *result = Exec(entry.query.c_str());
 | 
			
		||||
			if (!result)
 | 
			
		||||
			{
 | 
			
		||||
				failIndex_ = (cell_t)i;
 | 
			
		||||
@ -1746,7 +1746,7 @@ public:
 | 
			
		||||
				failure_->PushCell(dbh);
 | 
			
		||||
				failure_->PushCell(data_);
 | 
			
		||||
				failure_->PushCell(txn_->entries.length());
 | 
			
		||||
				failure_->PushString(error_.chars());
 | 
			
		||||
				failure_->PushString(error_.c_str());
 | 
			
		||||
				failure_->PushCell(failIndex_);
 | 
			
		||||
				failure_->PushArray(data.get(), txn_->entries.length());
 | 
			
		||||
				failure_->Execute(NULL);
 | 
			
		||||
@ -1764,7 +1764,7 @@ private:
 | 
			
		||||
	IPluginFunction *failure_;
 | 
			
		||||
	cell_t data_;
 | 
			
		||||
	AutoHandleRooter autoHandle_;
 | 
			
		||||
	ke::AString error_;
 | 
			
		||||
	std::string error_;
 | 
			
		||||
	ke::Vector<IQuery *> results_;
 | 
			
		||||
	cell_t failIndex_;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -184,17 +184,15 @@ private:
 | 
			
		||||
		{
 | 
			
		||||
			const char *conCommandChars = base->GetName();
 | 
			
		||||
			
 | 
			
		||||
			ke::AString conCommandName = ke::AString(conCommandChars).lowercase();
 | 
			
		||||
			ke::AString input = ke::AString(name).lowercase();
 | 
			
		||||
			std::string conCommandName = ke::Lowercase(conCommandChars);
 | 
			
		||||
			std::string input = ke::Lowercase(name);
 | 
			
		||||
			
 | 
			
		||||
			return conCommandName == input;
 | 
			
		||||
		}
 | 
			
		||||
		static inline uint32_t hash(const detail::CharsAndLength &key)
 | 
			
		||||
		{
 | 
			
		||||
			ke::AString original(key.chars());
 | 
			
		||||
			ke::AString lower = original.lowercase();
 | 
			
		||||
			
 | 
			
		||||
			return detail::CharsAndLength(lower.chars()).hash();
 | 
			
		||||
			std::string lower = ke::Lowercase(key.c_str());
 | 
			
		||||
			return detail::CharsAndLength(lower.c_str()).hash();
 | 
			
		||||
		}
 | 
			
		||||
	};
 | 
			
		||||
	NameHashSet<ConCommandBase *, ConCommandPolicy> m_CmdFlags;
 | 
			
		||||
 | 
			
		||||
@ -59,7 +59,7 @@ struct StringPolicy
 | 
			
		||||
	{
 | 
			
		||||
		return ke::FastHashCharSequence(key, strlen(key));
 | 
			
		||||
	}
 | 
			
		||||
	static inline bool matches(const char *find, const ke::AString &key)
 | 
			
		||||
	static inline bool matches(const char *find, const std::string &key)
 | 
			
		||||
	{
 | 
			
		||||
		return key.compare(find) == 0;
 | 
			
		||||
	}
 | 
			
		||||
@ -89,7 +89,7 @@ struct WeaponIDPolicy
 | 
			
		||||
	}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef ke::HashMap<ke::AString, ItemDefHashValue, StringPolicy> ClassnameMap;
 | 
			
		||||
typedef ke::HashMap<std::string, ItemDefHashValue, StringPolicy> ClassnameMap;
 | 
			
		||||
typedef ke::HashMap<int, ItemDefHashValue, IntegerPolicy> ItemIndexMap;
 | 
			
		||||
typedef ke::HashMap<SMCSWeapon, ItemDefHashValue, WeaponIDPolicy> WeaponIDMap;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -291,7 +291,7 @@ void CreateHashMaps()
 | 
			
		||||
				int iLoadoutslot = node.pDef->GetDefaultLoadoutSlot();
 | 
			
		||||
 | 
			
		||||
				ClassnameMap::Insert i = g_mapClassToDefIdx.findForAdd(classname);
 | 
			
		||||
				g_mapClassToDefIdx.add(i, ke::AString(classname), ItemDefHashValue(iLoadoutslot, price, iWeaponID, iItemDefIdx, classname));
 | 
			
		||||
				g_mapClassToDefIdx.add(i, std::string(classname), ItemDefHashValue(iLoadoutslot, price, iWeaponID, iItemDefIdx, classname));
 | 
			
		||||
 | 
			
		||||
				ItemIndexMap::Insert x = g_mapDefIdxToClass.findForAdd(iItemDefIdx);
 | 
			
		||||
				g_mapDefIdxToClass.add(x, iItemDefIdx, ItemDefHashValue(iLoadoutslot, price, iWeaponID, iItemDefIdx, classname));
 | 
			
		||||
 | 
			
		||||
@ -121,7 +121,7 @@ public:
 | 
			
		||||
	bool ShouldFollowCSGOServerGuidelines() const { return m_bFollowCSGOServerGuidelines; }
 | 
			
		||||
	bool CanSetCSGOEntProp(const char *pszPropName) { return !ShouldFollowCSGOServerGuidelines() || !m_CSGOBadList.has(pszPropName); }
 | 
			
		||||
private:
 | 
			
		||||
	ke::HashSet<ke::AString, detail::StringHashMapPolicy> m_CSGOBadList;
 | 
			
		||||
	ke::HashSet<std::string, detail::StringHashMapPolicy> m_CSGOBadList;
 | 
			
		||||
	bool m_bFollowCSGOServerGuidelines = false;
 | 
			
		||||
#endif
 | 
			
		||||
private:
 | 
			
		||||
 | 
			
		||||
@ -1 +1 @@
 | 
			
		||||
Subproject commit 5376e7763f31b8b284b536aaca3a4463e5f87e26
 | 
			
		||||
Subproject commit 98cbbdd11ab760fe65dfd7176c39f63f8e6ca1e4
 | 
			
		||||
@ -74,7 +74,7 @@ class NameHashSet : public ke::SystemAllocatorPolicy
 | 
			
		||||
 | 
			
		||||
		static bool matches(const CharsAndLength &key, const KeyType &value)
 | 
			
		||||
		{
 | 
			
		||||
			return KeyPolicyType::matches(key.chars(), value);
 | 
			
		||||
			return KeyPolicyType::matches(key.c_str(), value);
 | 
			
		||||
		}
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
@ -92,7 +92,7 @@ class NameHashSet : public ke::SystemAllocatorPolicy
 | 
			
		||||
 | 
			
		||||
		static bool matches(const CharsAndLength &key, const KeyType *value)
 | 
			
		||||
		{
 | 
			
		||||
			return KeyType::matches(key.chars(), value);
 | 
			
		||||
			return KeyType::matches(key.c_str(), value);
 | 
			
		||||
		}
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -75,7 +75,7 @@ namespace detail
 | 
			
		||||
	  uint32_t hash() const {
 | 
			
		||||
		  return hash_;
 | 
			
		||||
	  }
 | 
			
		||||
	  const char *chars() const {
 | 
			
		||||
	  const char *c_str() const {
 | 
			
		||||
		  return str_;
 | 
			
		||||
	  }
 | 
			
		||||
	  size_t length() const {
 | 
			
		||||
@ -90,9 +90,9 @@ namespace detail
 | 
			
		||||
 | 
			
		||||
	struct StringHashMapPolicy
 | 
			
		||||
	{
 | 
			
		||||
		static inline bool matches(const CharsAndLength &lookup, const ke::AString &key) {
 | 
			
		||||
		static inline bool matches(const CharsAndLength &lookup, const std::string &key) {
 | 
			
		||||
			return lookup.length() == key.length() &&
 | 
			
		||||
				   memcmp(lookup.chars(), key.chars(), key.length()) == 0;
 | 
			
		||||
				   memcmp(lookup.c_str(), key.c_str(), key.length()) == 0;
 | 
			
		||||
		}
 | 
			
		||||
		static inline uint32_t hash(const CharsAndLength &key) {
 | 
			
		||||
			return key.hash();
 | 
			
		||||
@ -104,7 +104,7 @@ template <typename T>
 | 
			
		||||
class StringHashMap
 | 
			
		||||
{
 | 
			
		||||
	typedef detail::CharsAndLength CharsAndLength;
 | 
			
		||||
	typedef ke::HashMap<ke::AString, T, detail::StringHashMapPolicy> Internal;
 | 
			
		||||
	typedef ke::HashMap<std::string, T, detail::StringHashMapPolicy> Internal;
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
	StringHashMap()
 | 
			
		||||
 | 
			
		||||
@ -1 +1 @@
 | 
			
		||||
Subproject commit 2075605089d674d70a437469800eb47a916e3c91
 | 
			
		||||
Subproject commit 6e5e5f6abbc350a131f6b9d23adb68fdb9ba8b86
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user