Renamed err_max to maxlength. Yes, I am crazy.
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40761
This commit is contained in:
@@ -25,7 +25,7 @@
|
||||
CExtensionManager g_Extensions;
|
||||
IdentityType_t g_ExtType;
|
||||
|
||||
CExtension::CExtension(const char *filename, char *error, size_t err_max)
|
||||
CExtension::CExtension(const char *filename, char *error, size_t maxlength)
|
||||
{
|
||||
m_File.assign(filename);
|
||||
m_pAPI = NULL;
|
||||
@@ -37,7 +37,7 @@ CExtension::CExtension(const char *filename, char *error, size_t err_max)
|
||||
char path[PLATFORM_MAX_PATH];
|
||||
g_SourceMod.BuildPath(Path_SM, path, PLATFORM_MAX_PATH, "extensions/%s", filename);
|
||||
|
||||
m_pLib = g_LibSys.OpenLibrary(path, error, err_max);
|
||||
m_pLib = g_LibSys.OpenLibrary(path, error, maxlength);
|
||||
|
||||
if (m_pLib == NULL)
|
||||
{
|
||||
@@ -51,7 +51,7 @@ CExtension::CExtension(const char *filename, char *error, size_t err_max)
|
||||
{
|
||||
m_pLib->CloseLibrary();
|
||||
m_pLib = NULL;
|
||||
snprintf(error, err_max, "Unable to find extension entry point");
|
||||
snprintf(error, maxlength, "Unable to find extension entry point");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -60,19 +60,19 @@ CExtension::CExtension(const char *filename, char *error, size_t err_max)
|
||||
{
|
||||
m_pLib->CloseLibrary();
|
||||
m_pLib = NULL;
|
||||
snprintf(error, err_max, "Extension version is too new to load (%d, max is %d)", m_pAPI->GetExtensionVersion(), SMINTERFACE_EXTENSIONAPI_VERSION);
|
||||
snprintf(error, maxlength, "Extension version is too new to load (%d, max is %d)", m_pAPI->GetExtensionVersion(), SMINTERFACE_EXTENSIONAPI_VERSION);
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_pAPI->IsMetamodExtension())
|
||||
{
|
||||
bool already;
|
||||
m_PlId = g_pMMPlugins->Load(path, g_PLID, already, error, err_max);
|
||||
m_PlId = g_pMMPlugins->Load(path, g_PLID, already, error, maxlength);
|
||||
}
|
||||
|
||||
m_pIdentToken = g_ShareSys.CreateIdentity(g_ExtType);
|
||||
|
||||
if (!m_pAPI->OnExtensionLoad(this, &g_ShareSys, error, err_max, !g_SourceMod.IsMapLoading()))
|
||||
if (!m_pAPI->OnExtensionLoad(this, &g_ShareSys, error, maxlength, !g_SourceMod.IsMapLoading()))
|
||||
{
|
||||
if (m_pAPI->IsMetamodExtension())
|
||||
{
|
||||
@@ -403,7 +403,7 @@ IExtension *CExtensionManager::FindExtensionByName(const char *ext)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IExtension *CExtensionManager::LoadExtension(const char *file, ExtensionLifetime lifetime, char *error, size_t err_max)
|
||||
IExtension *CExtensionManager::LoadExtension(const char *file, ExtensionLifetime lifetime, char *error, size_t maxlength)
|
||||
{
|
||||
IExtension *pAlready;
|
||||
if ((pAlready=FindExtensionByFile(file)) != NULL)
|
||||
@@ -411,7 +411,7 @@ IExtension *CExtensionManager::LoadExtension(const char *file, ExtensionLifetime
|
||||
return pAlready;
|
||||
}
|
||||
|
||||
CExtension *pExt = new CExtension(file, error, err_max);
|
||||
CExtension *pExt = new CExtension(file, error, maxlength);
|
||||
|
||||
/* :NOTE: lifetime is currently ignored */
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ public: //IExtensionManager
|
||||
IExtension *LoadExtension(const char *path,
|
||||
ExtensionLifetime lifetime,
|
||||
char *error,
|
||||
size_t err_max);
|
||||
size_t maxlength);
|
||||
bool UnloadExtension(IExtension *pExt);
|
||||
IExtension *FindExtensionByFile(const char *file);
|
||||
IExtension *FindExtensionByName(const char *ext);
|
||||
|
||||
@@ -252,9 +252,9 @@ IDirectory *LibrarySystem::OpenDirectory(const char *path)
|
||||
return dir;
|
||||
}
|
||||
|
||||
void LibrarySystem::GetPlatformError(char *error, size_t err_max)
|
||||
void LibrarySystem::GetPlatformError(char *error, size_t maxlength)
|
||||
{
|
||||
if (error && err_max)
|
||||
if (error && maxlength)
|
||||
{
|
||||
#if defined PLATFORM_WINDOWS
|
||||
DWORD dw = GetLastError();
|
||||
@@ -264,10 +264,10 @@ void LibrarySystem::GetPlatformError(char *error, size_t err_max)
|
||||
dw,
|
||||
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
|
||||
(LPSTR)error,
|
||||
err_max,
|
||||
maxlength,
|
||||
NULL);
|
||||
#elif defined PLATFORM_POSIX
|
||||
snprintf(error, err_max, "%s", strerror(errno));
|
||||
snprintf(error, maxlength, "%s", strerror(errno));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -277,21 +277,21 @@ void LibrarySystem::CloseDirectory(IDirectory *dir)
|
||||
delete dir;
|
||||
}
|
||||
|
||||
ILibrary *LibrarySystem::OpenLibrary(const char *path, char *error, size_t err_max)
|
||||
ILibrary *LibrarySystem::OpenLibrary(const char *path, char *error, size_t maxlength)
|
||||
{
|
||||
LibraryHandle lib;
|
||||
#if defined PLATFORM_WINDOWS
|
||||
lib = LoadLibraryA(path);
|
||||
if (!lib)
|
||||
{
|
||||
GetPlatformError(error, err_max);
|
||||
GetPlatformError(error, maxlength);
|
||||
return false;
|
||||
}
|
||||
#elif defined PLATFORM_POSIX
|
||||
lib = dlopen(path, RTLD_NOW);
|
||||
if (!lib)
|
||||
{
|
||||
GetPlatformError(error, err_max);
|
||||
GetPlatformError(error, maxlength);
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -66,13 +66,13 @@ private:
|
||||
class LibrarySystem : public ILibrarySys
|
||||
{
|
||||
public:
|
||||
ILibrary *OpenLibrary(const char *path, char *error, size_t err_max);
|
||||
ILibrary *OpenLibrary(const char *path, char *error, size_t maxlength);
|
||||
IDirectory *OpenDirectory(const char *path);
|
||||
void CloseDirectory(IDirectory *dir);
|
||||
bool PathExists(const char *path);
|
||||
bool IsPathFile(const char *path);
|
||||
bool IsPathDirectory(const char *path);
|
||||
void GetPlatformError(char *error, size_t err_max);
|
||||
void GetPlatformError(char *error, size_t maxlength);
|
||||
size_t PathFormat(char *buffer, size_t len, const char *fmt, ...);
|
||||
};
|
||||
|
||||
|
||||
@@ -748,7 +748,7 @@ void CPluginManager::LoadPluginsFromDir(const char *basedir, const char *localpa
|
||||
}
|
||||
|
||||
//well i have discovered that gabe newell is very fat, so i wrote this comment now
|
||||
LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool debug, PluginType type, char error[], size_t err_max)
|
||||
LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool debug, PluginType type, char error[], size_t maxlength)
|
||||
{
|
||||
/**
|
||||
* Does this plugin already exist?
|
||||
@@ -771,7 +771,7 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de
|
||||
}
|
||||
}
|
||||
|
||||
pPlugin = CPlugin::CreatePlugin(path, error, err_max);
|
||||
pPlugin = CPlugin::CreatePlugin(path, error, maxlength);
|
||||
|
||||
assert(pPlugin != NULL);
|
||||
|
||||
@@ -807,7 +807,7 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de
|
||||
{
|
||||
if (error)
|
||||
{
|
||||
snprintf(error, err_max, "Unable to set JIT option (key \"%s\") (value \"%s\")", key, val);
|
||||
snprintf(error, maxlength, "Unable to set JIT option (key \"%s\") (value \"%s\")", key, val);
|
||||
}
|
||||
pPlugin->CancelMyCompile();
|
||||
co = NULL;
|
||||
@@ -829,10 +829,10 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de
|
||||
{
|
||||
AddCoreNativesToPlugin(pPlugin);
|
||||
pPlugin->InitIdentity();
|
||||
if (pPlugin->Call_AskPluginLoad(error, err_max))
|
||||
if (pPlugin->Call_AskPluginLoad(error, maxlength))
|
||||
{
|
||||
/* Autoload any modules */
|
||||
LoadOrRequireExtensions(pPlugin, 1, error, err_max);
|
||||
LoadOrRequireExtensions(pPlugin, 1, error, maxlength);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -848,13 +848,13 @@ LoadRes CPluginManager::_LoadPlugin(CPlugin **_plugin, const char *path, bool de
|
||||
return (pPlugin->GetStatus() == Plugin_Loaded) ? LoadRes_Successful : LoadRes_Failure;
|
||||
}
|
||||
|
||||
IPlugin *CPluginManager::LoadPlugin(const char *path, bool debug, PluginType type, char error[], size_t err_max, bool *wasloaded)
|
||||
IPlugin *CPluginManager::LoadPlugin(const char *path, bool debug, PluginType type, char error[], size_t maxlength, bool *wasloaded)
|
||||
{
|
||||
CPlugin *pl;
|
||||
LoadRes res;
|
||||
|
||||
*wasloaded = false;
|
||||
if ((res=_LoadPlugin(&pl, path, debug, type, error, err_max)) == LoadRes_Failure)
|
||||
if ((res=_LoadPlugin(&pl, path, debug, type, error, maxlength)) == LoadRes_Failure)
|
||||
{
|
||||
delete pl;
|
||||
return NULL;
|
||||
@@ -871,7 +871,7 @@ IPlugin *CPluginManager::LoadPlugin(const char *path, bool debug, PluginType typ
|
||||
/* Run second pass if we need to */
|
||||
if (IsLateLoadTime() && pl->GetStatus() == Plugin_Loaded)
|
||||
{
|
||||
if (!RunSecondPass(pl, error, err_max))
|
||||
if (!RunSecondPass(pl, error, maxlength))
|
||||
{
|
||||
UnloadPlugin(pl);
|
||||
return NULL;
|
||||
|
||||
@@ -281,7 +281,7 @@ public: //IPluginManager
|
||||
bool debug,
|
||||
PluginType type,
|
||||
char error[],
|
||||
size_t err_max,
|
||||
size_t maxlength,
|
||||
bool *wasloaded);
|
||||
bool UnloadPlugin(IPlugin *plugin);
|
||||
IPlugin *FindPluginByContext(const sp_context_t *ctx);
|
||||
@@ -363,7 +363,7 @@ public:
|
||||
void AddFunctionsToForward(const char *name, IChangeableForward *pForward);
|
||||
|
||||
private:
|
||||
LoadRes _LoadPlugin(CPlugin **pPlugin, const char *path, bool debug, PluginType type, char error[], size_t err_max);
|
||||
LoadRes _LoadPlugin(CPlugin **pPlugin, const char *path, bool debug, PluginType type, char error[], size_t maxlength);
|
||||
|
||||
void LoadAutoPlugin(const char *plugin);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user