aboutsummaryrefslogtreecommitdiff
path: root/common/lua
diff options
context:
space:
mode:
authorD G Turner2019-09-15 16:21:02 +0100
committerD G Turner2019-09-15 16:21:02 +0100
commit04242ce829bd55f03e084b85a23055b23e598fb6 (patch)
tree19fb82d2bd1c1fcf06e58ed4b51d94094f854b1d /common/lua
parent91d0b35f4861cd3883733436c88452b820b61230 (diff)
downloadscummvm-rg350-04242ce829bd55f03e084b85a23055b23e598fb6.tar.gz
scummvm-rg350-04242ce829bd55f03e084b85a23055b23e598fb6.tar.bz2
scummvm-rg350-04242ce829bd55f03e084b85a23055b23e598fb6.zip
LUA: Fix Coverity Warnings in File Class
Diffstat (limited to 'common/lua')
-rw-r--r--common/lua/scummvm_file.cpp8
1 files changed, 2 insertions, 6 deletions
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() {