1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Remove irrelevant argument from the IToF function.

This commit is contained in:
Sandu Liviu Catalin 2016-05-23 05:39:32 +03:00
parent b9b688581b
commit c135d4293e

View File

@ -1115,22 +1115,19 @@ static SQInteger SqDigits0(HSQUIRRELVM vm)
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
SQFloat SqIToF(Int64 sigv, Int64 expv, Int32 padn, Int32 padc, bool negf) SQFloat SqIToF(Int64 sigv, Int64 expv, Int32 padn, bool negf)
{ {
// The number of characters to add before the exponent // The number of characters to add before the exponent
static CharT padb[64]; static CharT padb[64];
// Make sure the pad number is positive
padn = ClampMin(padn, 0);
// Is the number of pad characters out of range? // Is the number of pad characters out of range?
if (padn >= 64) if (static_cast< Uint32 >(padn) >= sizeof(padb))
{ {
STHROWF("Pad characters out of range: %d >= 64", padn); STHROWF("Pad characters out of range: %d >= %d", padn, sizeof(padb));
}
// Is the pad character invalid?
else if (padc > 9 || padc < 0)
{
STHROWF("Invalid padding value: %d", padc);
} }
// Write the padding characters // Write the padding characters
std::memset(padb, 48 + padc, padn); std::memset(padb, '0', padn);
// Add the null terminator // Add the null terminator
padb[padn] = '\0'; padb[padn] = '\0';
// The obtained string containing the floating point // The obtained string containing the floating point