Made this more consistent or something...

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40658
This commit is contained in:
Scott Ehlert
2007-03-22 21:12:17 +00:00
parent 862f25b223
commit 5b3a3cef27
8 changed files with 32 additions and 28 deletions
+5 -5
View File
@@ -33,7 +33,7 @@ CExtension::CExtension(const char *filename, char *error, size_t err_max)
unload_code = 0;
m_FullyLoaded = false;
char path[PLATFORM_MAX_PATH+1];
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);
@@ -317,7 +317,7 @@ IExtension *CExtensionManager::LoadAutoExtension(const char *path)
{
if (!strstr(path, "." PLATFORM_LIB_EXT))
{
char newpath[PLATFORM_MAX_PATH+1];
char newpath[PLATFORM_MAX_PATH];
snprintf(newpath, PLATFORM_MAX_PATH, "%s.%s", path, PLATFORM_LIB_EXT);
return LoadAutoExtension(newpath);
}
@@ -355,7 +355,7 @@ IExtension *CExtensionManager::FindExtensionByFile(const char *file)
}
/* Make sure the file direction is right */
char path[PLATFORM_MAX_PATH+1];
char path[PLATFORM_MAX_PATH];
g_LibSys.PathFormat(path, PLATFORM_MAX_PATH, "%s", file);
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
@@ -768,7 +768,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmd, unsigned int argco
const char *unload = g_RootMenu.GetArgument(4);
if (pExt->unload_code == (unsigned)atoi(unload))
{
char filename[PLATFORM_MAX_PATH+1];
char filename[PLATFORM_MAX_PATH];
snprintf(filename, PLATFORM_MAX_PATH, "%s", pExt->GetFilename());
UnloadExtension(pExt);
g_RootMenu.ConsolePrint("[SM] Extension %s is now unloaded.", filename);
@@ -781,7 +781,7 @@ void CExtensionManager::OnRootConsoleCommand(const char *cmd, unsigned int argco
if (!pExt->IsLoaded()
|| (!pExt->m_Deps.size() && !pExt->m_Plugins.size()))
{
char filename[PLATFORM_MAX_PATH+1];
char filename[PLATFORM_MAX_PATH];
snprintf(filename, PLATFORM_MAX_PATH, "%s", pExt->GetFilename());
UnloadExtension(pExt);
g_RootMenu.ConsolePrint("[SM] Extension %s is now unloaded.", filename);
+6 -2
View File
@@ -301,11 +301,15 @@ ILibrary *LibrarySystem::OpenLibrary(const char *path, char *error, size_t err_m
size_t LibrarySystem::PathFormat(char *buffer, size_t len, const char *fmt, ...)
{
va_list ap;
va_start(ap,fmt);
va_start(ap, fmt);
size_t mylen = vsnprintf(buffer, len, fmt, ap);
va_end(ap);
mylen = (mylen >= len) ? len : mylen;
if (mylen >= len)
{
mylen = len - 1;
buffer[mylen] = '\0';
}
for (size_t i=0; i<mylen; i++)
{
+7 -7
View File
@@ -101,7 +101,7 @@ Handle_t CPlugin::GetMyHandle()
CPlugin *CPlugin::CreatePlugin(const char *file, char *error, size_t maxlength)
{
char fullpath[PLATFORM_MAX_PATH+1];
char fullpath[PLATFORM_MAX_PATH];
g_SourceMod.BuildPath(Path_SM, fullpath, sizeof(fullpath), "plugins/%s", file);
FILE *fp = fopen(fullpath, "rb");
@@ -508,7 +508,7 @@ bool CPlugin::IsRunnable()
time_t CPlugin::GetFileTimeStamp()
{
char path[PLATFORM_MAX_PATH+1];
char path[PLATFORM_MAX_PATH];
g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "plugins/%s", m_filename);
#ifdef PLATFORM_WINDOWS
struct _stat s;
@@ -679,7 +679,7 @@ void CPluginManager::LoadAll_FirstPass(const char *config, const char *basedir)
void CPluginManager::LoadPluginsFromDir(const char *basedir, const char *localpath)
{
char base_path[PLATFORM_MAX_PATH+1];
char base_path[PLATFORM_MAX_PATH];
/* Form the current path to start reading from */
if (localpath == NULL)
@@ -708,7 +708,7 @@ void CPluginManager::LoadPluginsFromDir(const char *basedir, const char *localpa
&& (strcmp(dir->GetEntryName(), "disabled") != 0)
&& (strcmp(dir->GetEntryName(), "optional") != 0))
{
char new_local[PLATFORM_MAX_PATH+1];
char new_local[PLATFORM_MAX_PATH];
if (localpath == NULL)
{
/* If no path yet, don't add a former slash */
@@ -724,7 +724,7 @@ void CPluginManager::LoadPluginsFromDir(const char *basedir, const char *localpa
&& strcmp(&name[len-4], ".smx") == 0)
{
/* If the filename matches, load the plugin */
char plugin[PLATFORM_MAX_PATH+1];
char plugin[PLATFORM_MAX_PATH];
if (localpath == NULL)
{
snprintf(plugin, sizeof(plugin), "%s", name);
@@ -944,7 +944,7 @@ bool CPluginManager::LoadOrRequireExtensions(CPlugin *pPlugin, unsigned int pass
uint32_t num = pBase->GetPubVarsNum();
sp_pubvar_t *pubvar;
IExtension *pExt;
char path[PLATFORM_MAX_PATH+1];
char path[PLATFORM_MAX_PATH];
char *file, *name;
for (uint32_t i=0; i<num; i++)
{
@@ -1689,7 +1689,7 @@ void CPluginManager::OnRootConsoleCommand(const char *command, unsigned int argc
;
IPlugin *pl = iter->GetPlugin();
char name[PLATFORM_MAX_PATH+1];
char name[PLATFORM_MAX_PATH];
const sm_plugininfo_t *info = pl->GetPublicInfo();
strcpy(name, (IS_STR_FILLED(info->name)) ? info->name : pl->GetFilename());
+1 -1
View File
@@ -229,7 +229,7 @@ protected:
private:
ContextPair m_ctx;
PluginType m_type;
char m_filename[PLATFORM_MAX_PATH+1];
char m_filename[PLATFORM_MAX_PATH];
PluginStatus m_status;
unsigned int m_serial;
sm_plugininfo_t m_info;