From 210f36ba54f44ed921700f4f6c061668f59861bf Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Sat, 7 Mar 2015 21:28:33 +0200 Subject: [PATCH] Fix a warning on linux --- GlobalMethods.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/GlobalMethods.h b/GlobalMethods.h index a1f6fb5..bc0c720 100644 --- a/GlobalMethods.h +++ b/GlobalMethods.h @@ -2326,7 +2326,9 @@ namespace LuaGlobalFunctions if (lua_isstring(L, 1)) { std::string str = Eluna::CHECKVAL(L, 1); - if (sscanf(str.c_str(), SI64FMTD, &init) != 1) + std::istringstream iss(str); + iss >> init; + if (iss.bad()) return luaL_argerror(L, 1, "long long (as string) could not be converted"); } else if (!lua_isnoneornil(L, 1)) @@ -2356,7 +2358,9 @@ namespace LuaGlobalFunctions if (lua_isstring(L, 1)) { std::string str = Eluna::CHECKVAL(L, 1); - if (sscanf(str.c_str(), UI64FMTD, &init) != 1) + std::istringstream iss(str); + iss >> init; + if (iss.bad()) return luaL_argerror(L, 1, "unsigned long long (as string) could not be converted"); } else if (!lua_isnoneornil(L, 1))