remove itoa

This commit is contained in:
Syping 2019-10-23 02:12:36 +02:00
parent 8078722293
commit 1f0737a981

View file

@ -19,7 +19,6 @@
#include "LuaEngine.h"
#include <QTextStream>
#include <QMetaMethod>
#include <QtGlobal>
LuaEngine::LuaEngine(QObject *parent, bool loadBaseLibraries) : QObject(parent)
{
@ -242,7 +241,7 @@ void LuaEngine::pushVariant(const QVariant &variant)
void LuaEngine::pushVariant(lua_State *L_p, const QVariant &variant)
{
if (variant.type() == QVariant::Bool) {
lua_pushboolean(L_p, variant.toBool());
lua_pushboolean(L_p, (int)variant.toBool());
}
else if (variant.type() == QVariant::Int) {
lua_pushinteger(L_p, variant.toInt());
@ -259,7 +258,7 @@ void LuaEngine::pushVariant(lua_State *L_p, const QVariant &variant)
int currentId = 1;
for (const QString &string : stringList) {
char buffer[65];
itoa(currentId, buffer, 10);
snprintf(buffer, 10, "%d", currentId);
lua_pushstring(L_p, string.toUtf8().data());
lua_setfield(L_p, -2, buffer);
currentId++;
@ -271,7 +270,7 @@ void LuaEngine::pushVariant(lua_State *L_p, const QVariant &variant)
int currentId = 1;
for (const QVariant &variant : variantList) {
char buffer[65];
itoa(currentId, buffer, 10);
snprintf(buffer, 10, "%d", currentId);
pushVariant(L_p, variant);
lua_setfield(L_p, -2, buffer);
currentId++;