sourcemm/CPlugin.cpp
changeset 296 ba7337defd34
parent 282 7a237e9ea5a1
child 341 55e0ac43e6f0
     1.1 --- a/sourcemm/CPlugin.cpp	Sat Mar 03 06:57:30 2007 +0000
     1.2 +++ b/sourcemm/CPlugin.cpp	Wed Mar 21 17:45:28 2007 +0000
     1.3 @@ -188,7 +188,7 @@
     1.4  	
     1.5  	if (!pl)
     1.6  	{
     1.7 -		snprintf(error, maxlen, "Plugin id not found");
     1.8 +		UTIL_Format(error, maxlen, "Plugin id not found");
     1.9  		return false;
    1.10  	}
    1.11  
    1.12 @@ -208,7 +208,7 @@
    1.13  	
    1.14  	if (!pl)
    1.15  	{
    1.16 -		snprintf(error, maxlen, "Plugin id not found");
    1.17 +		UTIL_Format(error, maxlen, "Plugin id not found");
    1.18  		return false;
    1.19  	}
    1.20  
    1.21 @@ -228,7 +228,7 @@
    1.22  	
    1.23  	if (!pl)
    1.24  	{
    1.25 -		snprintf(error, maxlen, "Plugin %d not found", id);
    1.26 +		UTIL_Format(error, maxlen, "Plugin %d not found", id);
    1.27  		return false;
    1.28  	}
    1.29  
    1.30 @@ -252,7 +252,7 @@
    1.31  		{
    1.32  			if ( (*i)->m_Status >= Pl_Paused)
    1.33  			{
    1.34 -				snprintf(error, len, "Plugin %d is already running.", id);
    1.35 +				UTIL_Format(error, len, "Plugin %d is already running.", id);
    1.36  				return false;
    1.37  			}
    1.38  			CPlugin *pl = _Load((*i)->m_File.c_str(), Pl_Console, error, len);
    1.39 @@ -281,7 +281,7 @@
    1.40  		}
    1.41  	}
    1.42  
    1.43 -	snprintf(error, len, "Plugin %d not found,", id);
    1.44 +	UTIL_Format(error, len, "Plugin %d not found,", id);
    1.45  	return false;
    1.46  }
    1.47  
    1.48 @@ -321,7 +321,7 @@
    1.49  	if (!fp)
    1.50  	{
    1.51  		if (error)
    1.52 -			snprintf(error, maxlen, "File not found: %s", file);
    1.53 +			UTIL_Format(error, maxlen, "File not found: %s", file);
    1.54  		pl->m_Status = Pl_NotFound;
    1.55  	}
    1.56  
    1.57 @@ -335,32 +335,32 @@
    1.58  		if (!pl->m_Lib)
    1.59  		{
    1.60  			if (error)
    1.61 -				snprintf(error, maxlen, "%s", dlerror());
    1.62 +				UTIL_Format(error, maxlen, "%s", dlerror());
    1.63  			pl->m_Status = Pl_Error;
    1.64  		} else {
    1.65  			CreateInterfaceFn pfn = (CreateInterfaceFn)(dlsym(pl->m_Lib, PL_EXPOSURE_C));
    1.66  			if (!pfn)
    1.67  			{
    1.68  				if (error)
    1.69 -					snprintf(error, maxlen, "Function %s not found", PL_EXPOSURE_C);
    1.70 +					UTIL_Format(error, maxlen, "Function %s not found", PL_EXPOSURE_C);
    1.71  				pl->m_Status = Pl_Error;
    1.72  			} else {
    1.73  				pl->m_API = static_cast<ISmmPlugin *>((pfn)(PLAPI_NAME, NULL));
    1.74  				if (!pl->m_API)
    1.75  				{
    1.76  					if (error)
    1.77 -						snprintf(error, maxlen, "Failed to get API");
    1.78 +						UTIL_Format(error, maxlen, "Failed to get API");
    1.79  					pl->m_Status = Pl_Error;
    1.80  				} else {
    1.81  					int api = pl->m_API->GetApiVersion();
    1.82  					if (api < PLAPI_MIN_VERSION)
    1.83  					{
    1.84  						if (error)
    1.85 -							snprintf(error, maxlen, "Plugin API %d is out of date with required minimum (%d)", api, PLAPI_MIN_VERSION);
    1.86 +							UTIL_Format(error, maxlen, "Plugin API %d is out of date with required minimum (%d)", api, PLAPI_MIN_VERSION);
    1.87  						pl->m_Status = Pl_Error;
    1.88  					} else if (api > PLAPI_VERSION) {
    1.89  						if (error)
    1.90 -							snprintf(error, maxlen, "Plugin API %d is newer than internal version (%d)", api, PLAPI_VERSION);
    1.91 +							UTIL_Format(error, maxlen, "Plugin API %d is newer than internal version (%d)", api, PLAPI_VERSION);
    1.92  						pl->m_Status = Pl_Error;
    1.93  					} else {
    1.94  						if (pl->m_API->Load(pl->m_Id, static_cast<ISmmAPI *>(&g_SmmAPI), error, maxlen, m_AllLoaded))
    1.95 @@ -456,7 +456,7 @@
    1.96  	if (pl->m_Status != Pl_Running || !pl->m_API)
    1.97  	{
    1.98  		if (error)
    1.99 -			snprintf(error, maxlen, "Plugin cannot be paused");
   1.100 +			UTIL_Format(error, maxlen, "Plugin cannot be paused");
   1.101  	} else {
   1.102  		if (pl->m_API->Pause(error, maxlen))
   1.103  		{
   1.104 @@ -478,7 +478,7 @@
   1.105  	if (pl->m_Status != Pl_Paused || !pl->m_API)
   1.106  	{
   1.107  		if (error)
   1.108 -			snprintf(error, maxlen, "Plugin cannot be unpaused");
   1.109 +			UTIL_Format(error, maxlen, "Plugin cannot be unpaused");
   1.110  	} else {
   1.111  		if (pl->m_API->Unpause(error, maxlen))
   1.112  		{
   1.113 @@ -506,7 +506,7 @@
   1.114  
   1.115  	for (i=remqueue.begin(); i!=remqueue.end(); i++)
   1.116  	{
   1.117 -		if ( !_Unload( (*i), true, error, sizeof(error)-1) )
   1.118 +		if ( !_Unload( (*i), true, error, sizeof(error)) )
   1.119  			status = false;
   1.120  	}
   1.121  
   1.122 @@ -537,7 +537,7 @@
   1.123  	if (!pl || !pl->m_API)
   1.124  	{
   1.125  		if (error)
   1.126 -			snprintf(error, maxlength, "Plugin not valid");
   1.127 +			UTIL_Format(error, maxlength, "Plugin not valid");
   1.128  		return false;
   1.129  	}
   1.130