From 1f0737a981dfb7c1277d7664c41fba6461ae9f06 Mon Sep 17 00:00:00 2001 From: Syping Date: Wed, 23 Oct 2019 02:12:36 +0200 Subject: [PATCH] remove itoa --- src/luaenginecore/luaengine/LuaEngine.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/luaenginecore/luaengine/LuaEngine.cpp b/src/luaenginecore/luaengine/LuaEngine.cpp index ad85bb7..31207d9 100644 --- a/src/luaenginecore/luaengine/LuaEngine.cpp +++ b/src/luaenginecore/luaengine/LuaEngine.cpp @@ -19,7 +19,6 @@ #include "LuaEngine.h" #include #include -#include 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++;