mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-01-31 09:57:14 +01:00
Update the standard printf function to use the dynamic string retrieval method.
Remove leftover includes from the string and crypt libraries.
This commit is contained in:
parent
c9c0486e9f
commit
ad9e02e5fb
@ -6,9 +6,6 @@
|
|||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
#include <sqstdstring.h>
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
#include <crc32.h>
|
#include <crc32.h>
|
||||||
#include <keccak.h>
|
#include <keccak.h>
|
||||||
|
@ -3,9 +3,6 @@
|
|||||||
#include "Base/Shared.hpp"
|
#include "Base/Shared.hpp"
|
||||||
#include "Base/Buffer.hpp"
|
#include "Base/Buffer.hpp"
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
|
||||||
#include <sqstdstring.h>
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
@ -1206,17 +1203,15 @@ static CSStr FromArray(Array & arr)
|
|||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
static SQInteger StdPrintF(HSQUIRRELVM vm)
|
static SQInteger StdPrintF(HSQUIRRELVM vm)
|
||||||
{
|
{
|
||||||
CStr msg = nullptr;
|
// Attempt to retrieve the value from the stack as a string
|
||||||
SQInteger length = 0;
|
StackStrF val(vm, 2);
|
||||||
// Attempt to run the specified format and save the result
|
// Have we failed to retrieve the string?
|
||||||
const SQRESULT res = sqstd_format(vm, 2, &length, &msg);
|
if (SQ_FAILED(val.mRes))
|
||||||
// Validate the result for errors and propagate them to the VM
|
|
||||||
if(SQ_FAILED(res))
|
|
||||||
{
|
{
|
||||||
return res; // Return the error!
|
return val.mRes; // Propagate the error!
|
||||||
}
|
}
|
||||||
// Send the resulted string to console as a user message
|
// Send the resulted string to console as a user message
|
||||||
LogUsr("%s", msg);
|
LogUsr("%s", val.mPtr);
|
||||||
// This function doesn't return anything
|
// This function doesn't return anything
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user