GetCmdArg() and GetCmdArgString() now return a string length
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401427
This commit is contained in:
parent
f8816ab556
commit
be731888e7
@ -630,24 +630,26 @@ static cell_t sm_GetCmdArgs(IPluginContext *pContext, const cell_t *params)
|
|||||||
static cell_t sm_GetCmdArg(IPluginContext *pContext, const cell_t *params)
|
static cell_t sm_GetCmdArg(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
const char *arg = engine->Cmd_Argv(params[1]);
|
const char *arg = engine->Cmd_Argv(params[1]);
|
||||||
|
size_t length;
|
||||||
|
|
||||||
pContext->StringToLocalUTF8(params[2], params[3], arg, NULL);
|
pContext->StringToLocalUTF8(params[2], params[3], arg, &length);
|
||||||
|
|
||||||
return 1;
|
return (cell_t)length;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t sm_GetCmdArgString(IPluginContext *pContext, const cell_t *params)
|
static cell_t sm_GetCmdArgString(IPluginContext *pContext, const cell_t *params)
|
||||||
{
|
{
|
||||||
const char *args = engine->Cmd_Args();
|
const char *args = engine->Cmd_Args();
|
||||||
|
size_t length;
|
||||||
|
|
||||||
if (!args)
|
if (!args)
|
||||||
{
|
{
|
||||||
args = "";
|
args = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
pContext->StringToLocalUTF8(params[1], params[2], args, NULL);
|
pContext->StringToLocalUTF8(params[1], params[2], args, &length);
|
||||||
|
|
||||||
return 1;
|
return (cell_t)length;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cell_t sm_PrintToServer(IPluginContext *pCtx, const cell_t *params)
|
static cell_t sm_PrintToServer(IPluginContext *pCtx, const cell_t *params)
|
||||||
|
@ -338,7 +338,7 @@ native GetCmdArgs();
|
|||||||
* @param argnum Argument number to retrieve.
|
* @param argnum Argument number to retrieve.
|
||||||
* @param buffer Buffer to use for storing the string.
|
* @param buffer Buffer to use for storing the string.
|
||||||
* @param maxlength Maximum length of the buffer.
|
* @param maxlength Maximum length of the buffer.
|
||||||
* @noreturn
|
* @return Length of string written to buffer.
|
||||||
*/
|
*/
|
||||||
native GetCmdArg(argnum, String:buffer[], maxlength);
|
native GetCmdArg(argnum, String:buffer[], maxlength);
|
||||||
|
|
||||||
@ -348,7 +348,7 @@ native GetCmdArg(argnum, String:buffer[], maxlength);
|
|||||||
*
|
*
|
||||||
* @param buffer Buffer to use for storing the string.
|
* @param buffer Buffer to use for storing the string.
|
||||||
* @param maxlength Maximum length of the buffer.
|
* @param maxlength Maximum length of the buffer.
|
||||||
* @noreturn
|
* @return Length of string written to buffer.
|
||||||
*/
|
*/
|
||||||
native GetCmdArgString(String:buffer[], maxlength);
|
native GetCmdArgString(String:buffer[], maxlength);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user