Update plugins for transitional methods.

This commit is contained in:
David Anderson
2014-12-13 13:29:15 -08:00
parent 722a23c818
commit 1328984e0b
48 changed files with 620 additions and 620 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ public Plugin:myinfo =
#define STRING_RPLC_LOOPS 2000
new Float:g_dict_time
new Handle:g_Prof = INVALID_HANDLE
new Handle:g_Prof = null
public OnPluginStart()
{
+6 -6
View File
@@ -63,7 +63,7 @@ public OnReentrantCallReceived(num, String:str[])
PrintToServer("num = %d (expected: %d)", num, 7);
PrintToServer("str[] = \"%s\" (expected: \"%s\")", str, "nana");
new Function:func = GetFunctionByName(INVALID_HANDLE, "OnReentrantCallReceivedTwo");
new Function:func = GetFunctionByName(null, "OnReentrantCallReceivedTwo");
if (func == INVALID_FUNCTION)
{
@@ -73,7 +73,7 @@ public OnReentrantCallReceived(num, String:str[])
PrintToServer("Calling OnReentrantCallReceivedTwo...");
Call_StartFunction(INVALID_HANDLE, func);
Call_StartFunction(null, func);
Call_PushFloat(8.0);
err = Call_Finish(ret);
@@ -105,7 +105,7 @@ public Action:Command_CallFunc(args)
new err;
new ret;
new Function:func = GetFunctionByName(INVALID_HANDLE, "OnCallFuncReceived");
new Function:func = GetFunctionByName(null, "OnCallFuncReceived");
if (func == INVALID_FUNCTION)
{
@@ -115,7 +115,7 @@ public Action:Command_CallFunc(args)
PrintToServer("Calling OnCallFuncReceived...");
Call_StartFunction(INVALID_HANDLE, func);
Call_StartFunction(null, func);
Call_PushCell(5);
Call_PushFloat(7.17);
Call_PushString(what);
@@ -146,7 +146,7 @@ public Action:Command_CallFunc(args)
public Action:Command_ReentrantCallFunc(args)
{
new err, ret;
new Function:func = GetFunctionByName(INVALID_HANDLE, "OnReentrantCallReceived");
new Function:func = GetFunctionByName(null, "OnReentrantCallReceived");
if (func == INVALID_FUNCTION)
{
@@ -156,7 +156,7 @@ public Action:Command_ReentrantCallFunc(args)
PrintToServer("Calling OnReentrantCallReceived...");
Call_StartFunction(INVALID_HANDLE, func);
Call_StartFunction(null, func);
Call_PushCell(7);
Call_PushString("nana");
err = Call_Finish(ret);
+12 -12
View File
@@ -9,8 +9,8 @@ public Plugin:myinfo =
url = "http://www.sourcemod.net/"
};
new Handle:g_GlobalFwd = INVALID_HANDLE;
new Handle:g_PrivateFwd = INVALID_HANDLE;
new Handle:g_GlobalFwd = null;
new Handle:g_PrivateFwd = null;
public OnPluginStart()
{
@@ -22,20 +22,20 @@ public OnPluginStart()
public OnPluginEnd()
{
CloseHandle(g_GlobalFwd);
CloseHandle(g_PrivateFwd);
delete g_GlobalFwd;
delete g_PrivateFwd;
}
public Action:Command_CreateGlobalForward(args)
{
if (g_GlobalFwd != INVALID_HANDLE)
if (g_GlobalFwd != null)
{
CloseHandle(g_GlobalFwd);
delete g_GlobalFwd;
}
g_GlobalFwd = CreateGlobalForward("OnGlobalForward", ET_Ignore, Param_Any, Param_Cell, Param_Float, Param_String, Param_Array, Param_CellByRef, Param_FloatByRef);
if (g_GlobalFwd == INVALID_HANDLE)
if (g_GlobalFwd == null)
{
PrintToServer("Failed to create global forward!");
}
@@ -48,14 +48,14 @@ public Action:Command_CreatePrivateForward(args)
new Handle:pl;
new Function:func;
if (g_PrivateFwd != INVALID_HANDLE)
if (g_PrivateFwd != null)
{
CloseHandle(g_PrivateFwd);
delete g_PrivateFwd;
}
g_PrivateFwd = CreateForward(ET_Hook, Param_Cell, Param_String, Param_VarArgs);
if (g_PrivateFwd == INVALID_HANDLE)
if (g_PrivateFwd == null)
{
PrintToServer("Failed to create private forward!")
}
@@ -92,7 +92,7 @@ public Action:Command_ExecGlobalForward(args)
new Float:b = 4.215;
new err, ret;
if (g_GlobalFwd == INVALID_HANDLE)
if (g_GlobalFwd == null)
{
PrintToServer("Failed to execute global forward. Create it first.");
return Plugin_Handled;
@@ -124,7 +124,7 @@ public Action:Command_ExecPrivateForward(args)
{
new err, ret;
if (g_PrivateFwd == INVALID_HANDLE)
if (g_PrivateFwd == null)
{
PrintToServer("Failed to execute private forward. Create it first.");
return Plugin_Handled;
+20 -20
View File
@@ -20,7 +20,7 @@ public OnPluginStart()
RegServerCmd("sql_test_txn", Command_TestTxn)
new Handle:hibernate = FindConVar("sv_hibernate_when_empty");
if (hibernate != INVALID_HANDLE) {
if (hibernate != null) {
ServerCommand("sv_hibernate_when_empty 0");
}
}
@@ -63,23 +63,23 @@ public Action:Command_TestSql1(args)
{
new String:error[255]
new Handle:db = SQL_DefConnect(error, sizeof(error))
if (db == INVALID_HANDLE)
if (db == null)
{
PrintToServer("Failed to connect: %s", error)
return Plugin_Handled
}
new Handle:query = SQL_Query(db, "SELECT * FROM gab")
if (query == INVALID_HANDLE)
if (query == null)
{
SQL_GetError(db, error, sizeof(error))
PrintToServer("Failed to query: %s", error)
} else {
PrintQueryData(query)
CloseHandle(query)
delete query
}
CloseHandle(db)
delete db
return Plugin_Handled;
}
@@ -88,14 +88,14 @@ public Action:Command_TestSql2(args)
{
new String:error[255]
new Handle:db = SQL_DefConnect(error, sizeof(error))
if (db == INVALID_HANDLE)
if (db == null)
{
PrintToServer("Failed to connect: %s", error)
return Plugin_Handled
}
new Handle:stmt = SQL_PrepareQuery(db, "SELECT * FROM gab WHERE gaben > ?", error, sizeof(error))
if (stmt == INVALID_HANDLE)
if (stmt == null)
{
PrintToServer("Failed to prepare query: %s", error)
} else {
@@ -107,22 +107,22 @@ public Action:Command_TestSql2(args)
} else {
PrintQueryData(stmt)
}
CloseHandle(stmt)
delete stmt
}
CloseHandle(db)
delete db
return Plugin_Handled;
}
new Handle:g_ThreadedHandle = INVALID_HANDLE;
new Handle:g_ThreadedHandle = null;
public CallbackTest3(Handle:owner, Handle:hndl, const String:error[], any:data)
{
PrintToServer("CallbackTest1() (owner %x) (hndl %x) (error \"%s\") (data %d)", owner, hndl, error, data);
if (g_ThreadedHandle != INVALID_HANDLE && hndl != INVALID_HANDLE)
if (g_ThreadedHandle != null && hndl != null)
{
CloseHandle(hndl);
delete hndl;
} else {
g_ThreadedHandle = hndl;
}
@@ -130,7 +130,7 @@ public CallbackTest3(Handle:owner, Handle:hndl, const String:error[], any:data)
public Action:Command_TestSql3(args)
{
if (g_ThreadedHandle != INVALID_HANDLE)
if (g_ThreadedHandle != null)
{
PrintToServer("A threaded connection already exists, run the next test");
return Plugin_Handled;
@@ -149,14 +149,14 @@ public Action:Command_TestSql4(args)
{
SQL_LockDatabase(g_ThreadedHandle);
new Handle:query = SQL_Query(g_ThreadedHandle, "SELECT * FROM gab")
if (query == INVALID_HANDLE)
if (query == null)
{
new String:error[255];
SQL_GetError(g_ThreadedHandle, error, sizeof(error))
PrintToServer("Failed to query: %s", error)
} else {
PrintQueryData(query)
CloseHandle(query)
delete query
}
SQL_UnlockDatabase(g_ThreadedHandle);
@@ -165,7 +165,7 @@ public Action:Command_TestSql4(args)
public CallbackTest5(Handle:owner, Handle:hndl, const String:error[], any:data)
{
if (hndl == INVALID_HANDLE)
if (hndl == null)
{
PrintToServer("Failed to query: %s", error)
} else {
@@ -176,7 +176,7 @@ public CallbackTest5(Handle:owner, Handle:hndl, const String:error[], any:data)
public CallbackTest6(Handle:owner, Handle:hndl, const String:error[], any:data)
{
if (hndl == INVALID_HANDLE)
if (hndl == null)
{
PrintToServer("Failed to query: %s", error)
} else {
@@ -187,7 +187,7 @@ public CallbackTest6(Handle:owner, Handle:hndl, const String:error[], any:data)
public CallbackTest7(Handle:owner, Handle:hndl, const String:error[], any:data)
{
if (hndl == INVALID_HANDLE)
if (hndl == null)
{
PrintToServer("Failed to query: %s", error)
} else {
@@ -266,7 +266,7 @@ public Action:Command_TestTxn(args)
{
new String:error[256];
new Handle:db = SQL_Connect("storage-local", false, error, sizeof(error));
if (db == INVALID_HANDLE) {
if (db == null) {
ThrowError("ERROR: %s", error);
return Plugin_Handled;
}
@@ -305,7 +305,7 @@ public Action:Command_TestTxn(args)
// Make sure the transaction was rolled back - COUNT should be 5.
txn = SQL_CreateTransaction();
AssertEq("CloneHandle", _:CloneHandle(txn), _:INVALID_HANDLE);
AssertEq("CloneHandle", _:CloneHandle(txn), _:null);
txn.AddQuery("SELECT COUNT(id) FROM egg");
SQL_ExecuteTransaction(
db,
+6 -6
View File
@@ -40,7 +40,7 @@ public Action:Command_GetString(args)
LogMessage("Value of %s: %s", arg2, value);
CloseHandle(strct);
delete strct;
return Plugin_Handled;
}
@@ -61,7 +61,7 @@ public Action:Command_SetString(args)
new Handle:strct = GetWeaponStruct(arg1);
SetStructString(strct, arg2, value);
CloseHandle(strct);
delete strct;
return Plugin_Handled;
@@ -84,7 +84,7 @@ public Action:Command_GetInt(args)
LogMessage("Value of %s: %i", arg2, value);
CloseHandle(strct);
delete strct;
return Plugin_Handled;
}
@@ -106,7 +106,7 @@ public Action:Command_SetInt(args)
SetStructInt(strct, arg2, StringToInt(value));
CloseHandle(strct);
delete strct;
return Plugin_Handled;
}
@@ -128,7 +128,7 @@ public Action:Command_GetFloat(args)
LogMessage("Value of %s: %f", arg2, value);
CloseHandle(strct);
delete strct;
return Plugin_Handled;
}
@@ -150,7 +150,7 @@ public Action:Command_SetFloat(args)
SetStructFloat(strct, arg2, StringToFloat(value));
CloseHandle(strct);
delete strct;
return Plugin_Handled;
}