core/PluginSys.cpp
changeset 2814 6016b23d2b4c
parent 2798 6dd90eaa0593
child 2869 300588d3ff32
     1.1 --- a/core/PluginSys.cpp	Fri Oct 02 03:30:54 2009 -0700
     1.2 +++ b/core/PluginSys.cpp	Fri Oct 02 03:33:59 2009 -0700
     1.3 @@ -60,7 +60,7 @@
     1.4  	m_serial = ++MySerial;
     1.5  	m_pRuntime = NULL;
     1.6  	m_errormsg[sizeof(m_errormsg) - 1] = '\0';
     1.7 -	snprintf(m_filename, sizeof(m_filename), "%s", file);
     1.8 +	UTIL_Format(m_filename, sizeof(m_filename), "%s", file);
     1.9  	m_handle = 0;
    1.10  	m_ident = NULL;
    1.11  	m_pProps = sm_trie_create();
    1.12 @@ -164,7 +164,7 @@
    1.13  	{
    1.14  		if (error)
    1.15  		{
    1.16 -			snprintf(error, maxlength, "Unable to open file");
    1.17 +			UTIL_Format(error, maxlength, "Unable to open file");
    1.18  		}
    1.19  		pPlugin->m_status = Plugin_BadLoad;
    1.20  		return pPlugin;
    1.21 @@ -210,7 +210,7 @@
    1.22  
    1.23  	va_list ap;
    1.24  	va_start(ap, error_fmt);
    1.25 -	vsnprintf(m_errormsg, sizeof(m_errormsg), error_fmt, ap);
    1.26 +	UTIL_FormatArgs(m_errormsg, sizeof(m_errormsg), error_fmt, ap);
    1.27  	va_end(ap);
    1.28  
    1.29  	if (m_pRuntime != NULL)
    1.30 @@ -872,7 +872,7 @@
    1.31  			if (localpath == NULL)
    1.32  			{
    1.33  				/* If no path yet, don't add a former slash */
    1.34 -				snprintf(new_local, sizeof(new_local), "%s", dir->GetEntryName());
    1.35 +				UTIL_Format(new_local, sizeof(new_local), "%s", dir->GetEntryName());
    1.36  			} else {
    1.37  				g_LibSys.PathFormat(new_local, sizeof(new_local), "%s/%s", localpath, dir->GetEntryName());
    1.38  			}
    1.39 @@ -887,7 +887,7 @@
    1.40  				char plugin[PLATFORM_MAX_PATH];
    1.41  				if (localpath == NULL)
    1.42  				{
    1.43 -					snprintf(plugin, sizeof(plugin), "%s", name);
    1.44 +					UTIL_Format(plugin, sizeof(plugin), "%s", name);
    1.45  				} else {
    1.46  					g_LibSys.PathFormat(plugin, sizeof(plugin), "%s/%s", localpath, name);
    1.47  				}
    1.48 @@ -986,7 +986,7 @@
    1.49  				{
    1.50  					if (error)
    1.51  					{
    1.52 -						snprintf(error, maxlength, "Unable to set JIT option (key \"%s\") (value \"%s\")", key, val);
    1.53 +						UTIL_Format(error, maxlength, "Unable to set JIT option (key \"%s\") (value \"%s\")", key, val);
    1.54  					}
    1.55  					co->Abort();
    1.56  					co = NULL;
    1.57 @@ -1005,7 +1005,7 @@
    1.58  		pPlugin->m_pRuntime = g_pSourcePawn2->LoadPlugin(co, fullpath, &err);
    1.59  		if (pPlugin->m_pRuntime == NULL)
    1.60  		{
    1.61 -			snprintf(error, 
    1.62 +			UTIL_Format(error, 
    1.63  				maxlength, 
    1.64  				"Unable to load plugin (error %d: %s)", 
    1.65  				err, 
    1.66 @@ -1085,13 +1085,16 @@
    1.67  
    1.68  	if (res == LoadRes_NeverLoad)
    1.69  	{
    1.70 -		if (m_LoadingLocked)
    1.71 +		if (error)
    1.72  		{
    1.73 -			UTIL_Format(error, maxlength, "There is a global plugin loading lock in effect");
    1.74 -		}
    1.75 -		else
    1.76 -		{
    1.77 -			UTIL_Format(error, maxlength, "This plugin is blocked from loading (see plugin_settings.cfg)");
    1.78 +			if (m_LoadingLocked)
    1.79 +			{
    1.80 +				UTIL_Format(error, maxlength, "There is a global plugin loading lock in effect");
    1.81 +			}
    1.82 +			else
    1.83 +			{
    1.84 +				UTIL_Format(error, maxlength, "This plugin is blocked from loading (see plugin_settings.cfg)");
    1.85 +			}
    1.86  		}
    1.87  		return NULL;
    1.88  	}
    1.89 @@ -1221,7 +1224,7 @@
    1.90  					{
    1.91  						if (error)
    1.92  						{
    1.93 -							snprintf(error, maxlength, "Fatal error during initializing plugin load");
    1.94 +							UTIL_Format(error, maxlength, "Fatal error during initializing plugin load");
    1.95  						}
    1.96  						return false;
    1.97  					}
    1.98 @@ -1254,7 +1257,7 @@
    1.99  				{
   1.100  					if (error)
   1.101  					{
   1.102 -						snprintf(error, maxlength, "Could not find required plugin \"%s\"", name);
   1.103 +						UTIL_Format(error, maxlength, "Could not find required plugin \"%s\"", name);
   1.104  					}
   1.105  					return false;
   1.106  				}
   1.107 @@ -1325,7 +1328,7 @@
   1.108  					{
   1.109  						if (error)
   1.110  						{
   1.111 -							snprintf(error, maxlength, "Required extension \"%s\" file(\"%s\") not running", name, file);
   1.112 +							UTIL_Format(error, maxlength, "Required extension \"%s\" file(\"%s\") not running", name, file);
   1.113  						}
   1.114  						return false;
   1.115  					}
   1.116 @@ -1393,7 +1396,7 @@
   1.117  		{
   1.118  			if (error)
   1.119  			{
   1.120 -				snprintf(error, maxlength, "Native \"%s\" was not found", native->name);
   1.121 +				UTIL_Format(error, maxlength, "Native \"%s\" was not found", native->name);
   1.122  			}
   1.123  			return false;
   1.124  		}