From 04242ce829bd55f03e084b85a23055b23e598fb6 Mon Sep 17 00:00:00 2001 From: D G Turner Date: Sun, 15 Sep 2019 16:21:02 +0100 Subject: LUA: Fix Coverity Warnings in File Class --- common/lua/scummvm_file.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'common/lua') diff --git a/common/lua/scummvm_file.cpp b/common/lua/scummvm_file.cpp index 1a5af0fb4d..a65a238940 100644 --- a/common/lua/scummvm_file.cpp +++ b/common/lua/scummvm_file.cpp @@ -26,7 +26,7 @@ namespace Lua { -LuaFileProxy::LuaFileProxy(const Common::String &filename, const Common::String &mode) { +LuaFileProxy::LuaFileProxy(const Common::String &filename, const Common::String &mode) : _readPos(0) { assert(filename.contains("config.lua")); if (mode == "r") setupConfigFile(); @@ -44,11 +44,7 @@ Common::String LuaFileProxy::formatDouble(double value) { double integerPart = floor(value); double fractionalPart = (value - integerPart) * 1000000.0; - Common::String out = Common::String::format("%.0f.%.0f", integerPart, fractionalPart); - if (negative) - out = "-" + out; - - return out; + return Common::String::format("%s%.0f.%.0f", negative ? "-" : "", integerPart, fractionalPart); } void LuaFileProxy::setupConfigFile() { -- cgit v1.2.3