Strip sourcehook containers (#2578)

This commit is contained in:
Benoist
2026-09-17 20:56:47 -04:00
committed by GitHub
parent 3723860af3
commit 82cd96aef6
94 changed files with 512 additions and 671 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ private:
sqlite3 *m_sq3;
std::recursive_mutex m_FullLock;
bool m_Persistent;
String m_LastError;
std::string m_LastError;
int m_LastErrorCode;
};
+3 -6
View File
@@ -77,9 +77,8 @@ SqDriver::~SqDriver()
{
std::lock_guard<std::mutex> lock(m_OpenLock);
List<SqDbInfo>::iterator iter;
SqDatabase *sqdb;
for (iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
for (auto iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
{
// Don't let SqDatabase try to remove itself from m_Cache
// now that we're gone.
@@ -258,8 +257,7 @@ IDatabase *SqDriver::Connect(const DatabaseInfo *info, bool persistent, char *er
if (persistent)
{
/* See if anything in the cache matches */
List<SqDbInfo>::iterator iter;
for (iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
for (auto iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
{
if ((*iter).path.compare(fullpath) == 0)
{
@@ -298,8 +296,7 @@ void SqDriver::RemovePersistent(IDatabase *pdb)
{
std::lock_guard<std::mutex> lock(m_OpenLock);
List<SqDbInfo>::iterator iter;
for (iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
for (auto iter = m_Cache.begin(); iter != m_Cache.end(); iter++)
{
if ((*iter).db == pdb)
{
+4 -5
View File
@@ -34,17 +34,16 @@
#define SOURCEMOD_SQL_DRIVER_CODE
#include <IDBDriver.h>
#include <sh_list.h>
#include <sh_string.h>
#include <list>
#include <string>
#include <mutex>
#include "sqlite-source/sqlite3.h"
using namespace SourceMod;
using namespace SourceHook;
struct SqDbInfo
{
String path;
std::string path;
IDatabase *db;
};
@@ -73,7 +72,7 @@ public:
private:
Handle_t m_Handle;
std::mutex m_OpenLock;
List<SqDbInfo> m_Cache;
std::list<SqDbInfo> m_Cache;
bool m_bThreadSafe;
bool m_bShutdown;
};
+2 -1
View File
@@ -35,6 +35,7 @@
#include <am-refcounting.h>
#include "SqDatabase.h"
#include "SqResults.h"
#include <string>
class SqQuery :
public IPreparedQuery
@@ -86,7 +87,7 @@ private:
sqlite3_stmt *m_pStmt;
SqResults *m_pResults;
unsigned int m_ParamCount;
String m_LastError;
std::string m_LastError;
int m_LastErrorCode;
unsigned int m_AffectedRows;
unsigned int m_InsertID;
+1 -1
View File
@@ -42,7 +42,7 @@ SqResults::SqResults(SqQuery *query) :
m_ColCount = sqlite3_column_count(m_pStmt);
if (m_ColCount)
{
m_ColNames = new String[m_ColCount];
m_ColNames = new std::string[m_ColCount];
for (unsigned int i=0; i<m_ColCount; i++)
{
m_ColNames[i].assign(sqlite3_column_name(m_pStmt, i));
+1 -1
View File
@@ -86,7 +86,7 @@ private:
SqField *GetField(unsigned int col);
private:
sqlite3_stmt *m_pStmt; /** DOES NOT CHANGE */
String *m_ColNames; /** DOES NOT CHANGE */
std::string *m_ColNames; /** DOES NOT CHANGE */
unsigned int m_ColCount; /** DOES NOT CHANGE */
BaseStringTable m_Strings; /** DOES NOT CHANGE */
BaseMemTable *m_pMemory; /** DOES NOT CHANGE */