From ed9f985f929a9b35316325f7eaa6de2b643bb077 Mon Sep 17 00:00:00 2001 From: Florent Rougon Date: Sun, 11 Jun 2017 18:52:45 +0200 Subject: [PATCH] Fix warnings in fgrcc.cxx The braces fix is apparently needed to avoid warnings due to a compiler bug, or at least missing feature (cf. [1] and [2]). The other one in std::accumulate() seems legitimate. [1] http://en.cppreference.com/w/cpp/container/array [2] https://stackoverflow.com/questions/14178264/c11-correct-stdarray-initialization --- src/EmbeddedResources/fgrcc.cxx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/EmbeddedResources/fgrcc.cxx b/src/EmbeddedResources/fgrcc.cxx index 2b6adbfc2..e50fbbdac 100644 --- a/src/EmbeddedResources/fgrcc.cxx +++ b/src/EmbeddedResources/fgrcc.cxx @@ -32,6 +32,7 @@ #include // std::underlying_type #include #include +#include // std::size_t #include #include #include @@ -136,14 +137,17 @@ bool ResourceDeclaration::isCompressed() const // Initialization of static members const std::array ResourceBuilderXMLVisitor::_tagTypeStr = { - "start", "end" }; + {"start", + "end"} +}; const std::array ResourceBuilderXMLVisitor::_parserStateStr = { - "before 'FGRCC' element", - "inside 'FGRCC' element", - "inside 'qresource' element", - "inside 'file' element", - "after 'FGRCC' element" - }; + {"before 'FGRCC' element", + "inside 'FGRCC' element", + "inside 'qresource' element", + "inside 'file' element", + "after 'FGRCC' element" + } +}; ResourceBuilderXMLVisitor::ResourceBuilderXMLVisitor(const SGPath& rootDir) : _rootDir(rootDir) @@ -707,7 +711,7 @@ using simgear::EmbeddedResourceManager;\n"; // Print the total size of resources std::size_t staticMemoryUsedByResources = std::accumulate( - resSizeInBytes.begin(), resSizeInBytes.end(), 0); + resSizeInBytes.begin(), resSizeInBytes.end(), std::size_t(0)); LOG("static memory used by resources (total): " << prettyPrintNbOfBytes(staticMemoryUsedByResources));