mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-01-31 09:57:14 +01:00
Make sure that the free variable containing the pointer of the registered native closures is taken into account when registering functions with formatting support that take no extra parameters other than the formatting string and trailing variable arguments.
This commit is contained in:
parent
30fd6b274b
commit
bb7a6881c6
@ -2403,7 +2403,7 @@ public:
|
||||
|
||||
SQTRY()
|
||||
|
||||
const StackStrF fmt(vm, 2, true);
|
||||
const StackStrF fmt(vm, 2, true, sq_gettop(vm) == 2);
|
||||
// Validate the format
|
||||
if (SQ_FAILED(fmt.mRes)) {
|
||||
return fmt.mRes;
|
||||
@ -2822,7 +2822,7 @@ public:
|
||||
|
||||
SQTRY()
|
||||
|
||||
const StackStrF fmt(vm, 2, true);
|
||||
const StackStrF fmt(vm, 2, true, sq_gettop(vm) == 2);
|
||||
// Validate the format
|
||||
if (SQ_FAILED(fmt.mRes)) {
|
||||
return fmt.mRes;
|
||||
@ -3241,7 +3241,7 @@ public:
|
||||
|
||||
SQTRY()
|
||||
|
||||
const StackStrF fmt(vm, 2, true);
|
||||
const StackStrF fmt(vm, 2, true, sq_gettop(vm) == 2);
|
||||
// Validate the format
|
||||
if (SQ_FAILED(fmt.mRes)) {
|
||||
return fmt.mRes;
|
||||
|
@ -5462,7 +5462,7 @@ public:
|
||||
|
||||
SQTRY()
|
||||
|
||||
const StackStrF fmt(vm, 2, true);
|
||||
const StackStrF fmt(vm, 2, true, sq_gettop(vm) == 2);
|
||||
// Validate the format
|
||||
if (SQ_FAILED(fmt.mRes)) {
|
||||
return fmt.mRes;
|
||||
@ -5507,7 +5507,7 @@ public:
|
||||
|
||||
SQTRY()
|
||||
|
||||
const StackStrF fmt(vm, 2, true);
|
||||
const StackStrF fmt(vm, 2, true, sq_gettop(vm) == 2);
|
||||
// Validate the format
|
||||
if (SQ_FAILED(fmt.mRes)) {
|
||||
return fmt.mRes;
|
||||
@ -6514,7 +6514,7 @@ public:
|
||||
|
||||
SQTRY()
|
||||
|
||||
const StackStrF fmt(vm, 2, true);
|
||||
const StackStrF fmt(vm, 2, true, sq_gettop(vm) == 2);
|
||||
// Validate the format
|
||||
if (SQ_FAILED(fmt.mRes)) {
|
||||
return fmt.mRes;
|
||||
@ -6559,7 +6559,7 @@ public:
|
||||
|
||||
SQTRY()
|
||||
|
||||
const StackStrF fmt(vm, 2, true);
|
||||
const StackStrF fmt(vm, 2, true, sq_gettop(vm) == 2);
|
||||
// Validate the format
|
||||
if (SQ_FAILED(fmt.mRes)) {
|
||||
return fmt.mRes;
|
||||
@ -7566,7 +7566,7 @@ public:
|
||||
|
||||
SQTRY()
|
||||
|
||||
const StackStrF fmt(vm, 2, true);
|
||||
const StackStrF fmt(vm, 2, true, sq_gettop(vm) == 2);
|
||||
// Validate the format
|
||||
if (SQ_FAILED(fmt.mRes)) {
|
||||
return fmt.mRes;
|
||||
|
@ -1510,16 +1510,26 @@ struct StackStrF
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// Base constructor.
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
StackStrF(HSQUIRRELVM vm, SQInteger idx, bool fmt = true)
|
||||
StackStrF(HSQUIRRELVM vm, SQInteger idx, bool fmt = true, bool dummy = false)
|
||||
: mPtr(nullptr)
|
||||
, mLen(-1)
|
||||
, mRes(SQ_OK)
|
||||
, mObj()
|
||||
, mVM(vm)
|
||||
{
|
||||
const SQInteger top = sq_gettop(vm);
|
||||
// Reset the converted value object
|
||||
sq_resetobject(&mObj);
|
||||
// is this a dummy request?
|
||||
if (dummy)
|
||||
{
|
||||
// Since this is a dummy then avoid making it look like a failure
|
||||
mPtr = _SC("");
|
||||
mLen = 0;
|
||||
// We're not supposed to proceed with this!
|
||||
return;
|
||||
}
|
||||
// Grab the top of the stack
|
||||
const SQInteger top = sq_gettop(vm);
|
||||
// Was the string or value specified?
|
||||
if (top <= (idx - 1))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user