Made this more consistent or something...
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40658
This commit is contained in:
parent
862f25b223
commit
5b3a3cef27
@ -101,7 +101,7 @@ void CPhraseFile::ReparseFile()
|
|||||||
}
|
}
|
||||||
|
|
||||||
SMCParseError err;
|
SMCParseError err;
|
||||||
char path[PLATFORM_MAX_PATH+1];
|
char path[PLATFORM_MAX_PATH];
|
||||||
g_SourceMod.BuildPath(Path_SM, path, PLATFORM_MAX_PATH, "translations/%s", m_File.c_str());
|
g_SourceMod.BuildPath(Path_SM, path, PLATFORM_MAX_PATH, "translations/%s", m_File.c_str());
|
||||||
unsigned int line=0, col=0;
|
unsigned int line=0, col=0;
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ static cell_t sm_OpenDirectory(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char realpath[PLATFORM_MAX_PATH+1];
|
char realpath[PLATFORM_MAX_PATH];
|
||||||
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", path);
|
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", path);
|
||||||
|
|
||||||
IDirectory *pDir = g_LibSys.OpenDirectory(realpath);
|
IDirectory *pDir = g_LibSys.OpenDirectory(realpath);
|
||||||
@ -142,7 +142,7 @@ static cell_t sm_OpenFile(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char realpath[PLATFORM_MAX_PATH+1];
|
char realpath[PLATFORM_MAX_PATH];
|
||||||
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
|
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
|
||||||
|
|
||||||
FILE *pFile = fopen(realpath, mode);
|
FILE *pFile = fopen(realpath, mode);
|
||||||
@ -164,7 +164,7 @@ static cell_t sm_DeleteFile(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char realpath[PLATFORM_MAX_PATH+1];
|
char realpath[PLATFORM_MAX_PATH];
|
||||||
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
|
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
|
||||||
|
|
||||||
return (unlink(realpath)) ? 0 : 1;
|
return (unlink(realpath)) ? 0 : 1;
|
||||||
@ -271,7 +271,7 @@ static cell_t sm_FileExists(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char realpath[PLATFORM_MAX_PATH+1];
|
char realpath[PLATFORM_MAX_PATH];
|
||||||
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
|
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef PLATFORM_WINDOWS
|
||||||
struct _stat s;
|
struct _stat s;
|
||||||
@ -313,9 +313,9 @@ static cell_t sm_RenameFile(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char new_realpath[PLATFORM_MAX_PATH+1];
|
char new_realpath[PLATFORM_MAX_PATH];
|
||||||
g_SourceMod.BuildPath(Path_Game, new_realpath, sizeof(new_realpath), "%s", newpath);
|
g_SourceMod.BuildPath(Path_Game, new_realpath, sizeof(new_realpath), "%s", newpath);
|
||||||
char old_realpath[PLATFORM_MAX_PATH+1];
|
char old_realpath[PLATFORM_MAX_PATH];
|
||||||
g_SourceMod.BuildPath(Path_Game, old_realpath, sizeof(old_realpath), "%s", oldpath);
|
g_SourceMod.BuildPath(Path_Game, old_realpath, sizeof(old_realpath), "%s", oldpath);
|
||||||
|
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef PLATFORM_WINDOWS
|
||||||
@ -335,7 +335,7 @@ static cell_t sm_DirExists(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char realpath[PLATFORM_MAX_PATH+1];
|
char realpath[PLATFORM_MAX_PATH];
|
||||||
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
|
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef PLATFORM_WINDOWS
|
||||||
struct _stat s;
|
struct _stat s;
|
||||||
@ -372,7 +372,7 @@ static cell_t sm_FileSize(IPluginContext *pContext, const cell_t *params)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
char realpath[PLATFORM_MAX_PATH+1];
|
char realpath[PLATFORM_MAX_PATH];
|
||||||
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
|
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef PLATFORM_WINDOWS
|
||||||
struct _stat s;
|
struct _stat s;
|
||||||
@ -409,7 +409,7 @@ static cell_t sm_RemoveDir(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
char realpath[PLATFORM_MAX_PATH+1];
|
char realpath[PLATFORM_MAX_PATH];
|
||||||
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
|
g_SourceMod.BuildPath(Path_Game, realpath, sizeof(realpath), "%s", name);
|
||||||
|
|
||||||
return (rmdir(realpath)) ? 0 : 1;
|
return (rmdir(realpath)) ? 0 : 1;
|
||||||
|
@ -286,7 +286,7 @@ void SourceModBase::DoGlobalPluginLoads()
|
|||||||
|
|
||||||
size_t SourceModBase::BuildPath(PathType type, char *buffer, size_t maxlength, char *format, ...)
|
size_t SourceModBase::BuildPath(PathType type, char *buffer, size_t maxlength, char *format, ...)
|
||||||
{
|
{
|
||||||
char _buffer[PLATFORM_MAX_PATH+1];
|
char _buffer[PLATFORM_MAX_PATH];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start(ap, format);
|
va_start(ap, format);
|
||||||
|
@ -92,8 +92,8 @@ private:
|
|||||||
void GameFrame(bool simulating);
|
void GameFrame(bool simulating);
|
||||||
private:
|
private:
|
||||||
CStack<CDataPack *> m_freepacks;
|
CStack<CDataPack *> m_freepacks;
|
||||||
char m_SMBaseDir[PLATFORM_MAX_PATH+1];
|
char m_SMBaseDir[PLATFORM_MAX_PATH];
|
||||||
char m_SMRelDir[PLATFORM_MAX_PATH+1];
|
char m_SMRelDir[PLATFORM_MAX_PATH];
|
||||||
bool m_IsMapLoading;
|
bool m_IsMapLoading;
|
||||||
bool m_ExecPluginReload;
|
bool m_ExecPluginReload;
|
||||||
unsigned int m_target;
|
unsigned int m_target;
|
||||||
|
@ -33,7 +33,7 @@ CExtension::CExtension(const char *filename, char *error, size_t err_max)
|
|||||||
unload_code = 0;
|
unload_code = 0;
|
||||||
m_FullyLoaded = false;
|
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);
|
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, err_max);
|
||||||
@ -317,7 +317,7 @@ IExtension *CExtensionManager::LoadAutoExtension(const char *path)
|
|||||||
{
|
{
|
||||||
if (!strstr(path, "." PLATFORM_LIB_EXT))
|
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);
|
snprintf(newpath, PLATFORM_MAX_PATH, "%s.%s", path, PLATFORM_LIB_EXT);
|
||||||
return LoadAutoExtension(newpath);
|
return LoadAutoExtension(newpath);
|
||||||
}
|
}
|
||||||
@ -355,7 +355,7 @@ IExtension *CExtensionManager::FindExtensionByFile(const char *file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure the file direction is right */
|
/* 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);
|
g_LibSys.PathFormat(path, PLATFORM_MAX_PATH, "%s", file);
|
||||||
|
|
||||||
for (iter=m_Libs.begin(); iter!=m_Libs.end(); iter++)
|
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);
|
const char *unload = g_RootMenu.GetArgument(4);
|
||||||
if (pExt->unload_code == (unsigned)atoi(unload))
|
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());
|
snprintf(filename, PLATFORM_MAX_PATH, "%s", pExt->GetFilename());
|
||||||
UnloadExtension(pExt);
|
UnloadExtension(pExt);
|
||||||
g_RootMenu.ConsolePrint("[SM] Extension %s is now unloaded.", filename);
|
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()
|
if (!pExt->IsLoaded()
|
||||||
|| (!pExt->m_Deps.size() && !pExt->m_Plugins.size()))
|
|| (!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());
|
snprintf(filename, PLATFORM_MAX_PATH, "%s", pExt->GetFilename());
|
||||||
UnloadExtension(pExt);
|
UnloadExtension(pExt);
|
||||||
g_RootMenu.ConsolePrint("[SM] Extension %s is now unloaded.", filename);
|
g_RootMenu.ConsolePrint("[SM] Extension %s is now unloaded.", filename);
|
||||||
|
@ -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, ...)
|
size_t LibrarySystem::PathFormat(char *buffer, size_t len, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap,fmt);
|
va_start(ap, fmt);
|
||||||
size_t mylen = vsnprintf(buffer, len, fmt, ap);
|
size_t mylen = vsnprintf(buffer, len, fmt, ap);
|
||||||
va_end(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++)
|
for (size_t i=0; i<mylen; i++)
|
||||||
{
|
{
|
||||||
|
@ -101,7 +101,7 @@ Handle_t CPlugin::GetMyHandle()
|
|||||||
|
|
||||||
CPlugin *CPlugin::CreatePlugin(const char *file, char *error, size_t maxlength)
|
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);
|
g_SourceMod.BuildPath(Path_SM, fullpath, sizeof(fullpath), "plugins/%s", file);
|
||||||
FILE *fp = fopen(fullpath, "rb");
|
FILE *fp = fopen(fullpath, "rb");
|
||||||
|
|
||||||
@ -508,7 +508,7 @@ bool CPlugin::IsRunnable()
|
|||||||
|
|
||||||
time_t CPlugin::GetFileTimeStamp()
|
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);
|
g_SourceMod.BuildPath(Path_SM, path, sizeof(path), "plugins/%s", m_filename);
|
||||||
#ifdef PLATFORM_WINDOWS
|
#ifdef PLATFORM_WINDOWS
|
||||||
struct _stat s;
|
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)
|
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 */
|
/* Form the current path to start reading from */
|
||||||
if (localpath == NULL)
|
if (localpath == NULL)
|
||||||
@ -708,7 +708,7 @@ void CPluginManager::LoadPluginsFromDir(const char *basedir, const char *localpa
|
|||||||
&& (strcmp(dir->GetEntryName(), "disabled") != 0)
|
&& (strcmp(dir->GetEntryName(), "disabled") != 0)
|
||||||
&& (strcmp(dir->GetEntryName(), "optional") != 0))
|
&& (strcmp(dir->GetEntryName(), "optional") != 0))
|
||||||
{
|
{
|
||||||
char new_local[PLATFORM_MAX_PATH+1];
|
char new_local[PLATFORM_MAX_PATH];
|
||||||
if (localpath == NULL)
|
if (localpath == NULL)
|
||||||
{
|
{
|
||||||
/* If no path yet, don't add a former slash */
|
/* 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)
|
&& strcmp(&name[len-4], ".smx") == 0)
|
||||||
{
|
{
|
||||||
/* If the filename matches, load the plugin */
|
/* If the filename matches, load the plugin */
|
||||||
char plugin[PLATFORM_MAX_PATH+1];
|
char plugin[PLATFORM_MAX_PATH];
|
||||||
if (localpath == NULL)
|
if (localpath == NULL)
|
||||||
{
|
{
|
||||||
snprintf(plugin, sizeof(plugin), "%s", name);
|
snprintf(plugin, sizeof(plugin), "%s", name);
|
||||||
@ -944,7 +944,7 @@ bool CPluginManager::LoadOrRequireExtensions(CPlugin *pPlugin, unsigned int pass
|
|||||||
uint32_t num = pBase->GetPubVarsNum();
|
uint32_t num = pBase->GetPubVarsNum();
|
||||||
sp_pubvar_t *pubvar;
|
sp_pubvar_t *pubvar;
|
||||||
IExtension *pExt;
|
IExtension *pExt;
|
||||||
char path[PLATFORM_MAX_PATH+1];
|
char path[PLATFORM_MAX_PATH];
|
||||||
char *file, *name;
|
char *file, *name;
|
||||||
for (uint32_t i=0; i<num; i++)
|
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();
|
IPlugin *pl = iter->GetPlugin();
|
||||||
|
|
||||||
char name[PLATFORM_MAX_PATH+1];
|
char name[PLATFORM_MAX_PATH];
|
||||||
const sm_plugininfo_t *info = pl->GetPublicInfo();
|
const sm_plugininfo_t *info = pl->GetPublicInfo();
|
||||||
strcpy(name, (IS_STR_FILLED(info->name)) ? info->name : pl->GetFilename());
|
strcpy(name, (IS_STR_FILLED(info->name)) ? info->name : pl->GetFilename());
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
ContextPair m_ctx;
|
ContextPair m_ctx;
|
||||||
PluginType m_type;
|
PluginType m_type;
|
||||||
char m_filename[PLATFORM_MAX_PATH+1];
|
char m_filename[PLATFORM_MAX_PATH];
|
||||||
PluginStatus m_status;
|
PluginStatus m_status;
|
||||||
unsigned int m_serial;
|
unsigned int m_serial;
|
||||||
sm_plugininfo_t m_info;
|
sm_plugininfo_t m_info;
|
||||||
|
Loading…
Reference in New Issue
Block a user