From 66feed1d2b627b77e7c6576ebd1b190aa737412d Mon Sep 17 00:00:00 2001 From: Steve Dudenhoeffer Date: Fri, 18 May 2007 15:20:34 +0000 Subject: [PATCH] Added charsmax() define, as a less typo-prone utility for sizeof(array)-1. Added any: syntax to all variable args that need it, added proper {Float,_}: tags to some that didn't have it but should have. --- plugins/include/amxmisc.inc | 2 +- plugins/include/amxmodx.inc | 8 ++++---- plugins/include/dbi.inc | 4 ++-- plugins/include/fakemeta.inc | 2 +- plugins/include/nvault.inc | 2 +- plugins/include/sqlx.inc | 6 +++--- plugins/include/string.inc | 2 ++ 7 files changed, 14 insertions(+), 12 deletions(-) diff --git a/plugins/include/amxmisc.inc b/plugins/include/amxmisc.inc index bbcaf340..4db2d4a3 100755 --- a/plugins/include/amxmisc.inc +++ b/plugins/include/amxmisc.inc @@ -172,7 +172,7 @@ stock cmd_target(id,const arg[],flags = 1) return player; } -stock show_activity( id, const name[], {Float,_}: ... ) +stock show_activity( id, const name[], any:... ) { new buffer[128]; format_args( buffer , 127 , 2 ); diff --git a/plugins/include/amxmodx.inc b/plugins/include/amxmodx.inc index 2e2061f9..72b032e1 100755 --- a/plugins/include/amxmodx.inc +++ b/plugins/include/amxmodx.inc @@ -746,7 +746,7 @@ native register_library(const library[]); /* Logs an error in your native, and breaks into the debugger. * Acts as if the calling plugin had the error. */ -native log_error(error, const fmt[], ...); +native log_error(error, const fmt[], any:...); // More Dynamic Native System Stuff // Each of these natives affects one of the parameters sent to your native. @@ -949,7 +949,7 @@ native set_module_filter(const handler[]); * Note that the plugin's filename is prepending to your message: * [myplugin.amxx] MESSAGE */ -native abort(error, const fmt[]="", {Float,_}:...); +native abort(error, const fmt[]="", any:...); /** * Checks if a specific module is loaded. This is the exact same method AMX Mod X @@ -1016,7 +1016,7 @@ native set_fail_state(const err_msg[]); //Returns the reference address of the variable passed in. //This address is local to the plugin, and not a full CPU address //pass the variable as the first parameter -native get_var_addr(...); +native get_var_addr(any:...); //Returns the value of an address. This dereferences something returned by // get_var_addr(). Attempting to pass in a value beyond stack or heap limits @@ -1060,7 +1060,7 @@ native PrepareArray(const array[], size, copyback=0); * executes a forward. returns result in ret. * returns 1 for success, 0 for failure. */ -native ExecuteForward(forward_handle, &ret, {Float,_}:...); +native ExecuteForward(forward_handle, &ret, any:...); /** * Destroys/deallocates any type of forward diff --git a/plugins/include/dbi.inc b/plugins/include/dbi.inc index 7c1c954e..ae039598 100755 --- a/plugins/include/dbi.inc +++ b/plugins/include/dbi.inc @@ -53,13 +53,13 @@ native Sql:dbi_connect(_host[], _user[], _pass[], _dbname[], _error[]="", _maxle * If greater than zero, make sure to call dbi_free_result() on it! * The return is a handle to the result set */ -native Result:dbi_query(Sql:_sql, _query[], {Float,_}:...); +native Result:dbi_query(Sql:_sql, _query[], any:...); /* Has the same usage as dbi_query, but this native returns by * reference the number of rows affected in the query. If the * query fails rows will be equal to -1. */ -native Result:dbi_query2(Sql:_sql, &rows, _query[], {Float,_}:...); +native Result:dbi_query2(Sql:_sql, &rows, _query[], any:...); /* Returns 0 on failure or End of Results. * Advances result pointer by one row. diff --git a/plugins/include/fakemeta.inc b/plugins/include/fakemeta.inc index ea900e4b..bf71a4ef 100755 --- a/plugins/include/fakemeta.inc +++ b/plugins/include/fakemeta.inc @@ -88,7 +88,7 @@ native forward_return(type,any:...); */ native get_orig_retval({Float,_}:...); -native engfunc(type,{Float,Sql,Result,AlertType,_}:...); +native engfunc(type,any:...); native dllfunc(type,any:...); //only use this with functions that pass a Trace diff --git a/plugins/include/nvault.inc b/plugins/include/nvault.inc index 9deb2af3..33736f7e 100755 --- a/plugins/include/nvault.inc +++ b/plugins/include/nvault.inc @@ -29,7 +29,7 @@ native nvault_open(const name[]); /* Gets a vault value by returning an int * setting a byref float or setting a string + maxlength */ -native nvault_get(vault, const key[], ...); +native nvault_get(vault, const key[], {Float,_}:...); /* Looks up a vault value for full information * Returns 0 if the entry is not found diff --git a/plugins/include/sqlx.inc b/plugins/include/sqlx.inc index 033e2a69..e725014f 100644 --- a/plugins/include/sqlx.inc +++ b/plugins/include/sqlx.inc @@ -59,7 +59,7 @@ native Handle:SQL_Connect(Handle:cn_tuple, &errcode, error[], maxlength); * The query must always be freed. * This does not actually do the query! */ -native Handle:SQL_PrepareQuery(Handle:db, const fmt[], {Float,_}:...); +native Handle:SQL_PrepareQuery(Handle:db, const fmt[], any:...); /** @@ -295,7 +295,7 @@ stock SQL_SimpleQuery(Handle:db, const query[], error[]="", maxlength=0, &rows=0 * Use this for executing a query where you don't care about the result. * Returns 0 on failure, 1 on success */ -stock SQL_SimpleQueryFmt(Handle:db, error[]="", maxlength=0, &rows=0, const fmt[], ...) +stock SQL_SimpleQueryFmt(Handle:db, error[]="", maxlength=0, &rows=0, const fmt[], any:...) { static query_buf[2048]; vformat(query_buf, 2047, fmt, 6); @@ -320,7 +320,7 @@ stock SQL_SimpleQueryFmt(Handle:db, error[]="", maxlength=0, &rows=0, const fmt[ * Use this for executing a query and not caring about the error. * Returns -1 on error, >=0 on success (with number of affected rows) */ -stock SQL_QueryAndIgnore(Handle:db, const queryfmt[], {Float,_}:...) +stock SQL_QueryAndIgnore(Handle:db, const queryfmt[], any:...) { static query[4096]; new Handle:hQuery; diff --git a/plugins/include/string.inc b/plugins/include/string.inc index 043c613b..48063c2c 100755 --- a/plugins/include/string.inc +++ b/plugins/include/string.inc @@ -11,6 +11,8 @@ #endif #define _string_included +#define charsmax(%1) (sizeof(%1)-1) + /* Checks if source contains string. On success function * returns position in source, on failure returns -1. */ native contain(const source[],const string[]);