1
0
Fork 0

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
This commit is contained in:
Florent Rougon 2017-06-11 18:52:45 +02:00
parent 42821d6a63
commit ed9f985f92

View file

@ -32,6 +32,7 @@
#include <type_traits> // std::underlying_type
#include <stdexcept>
#include <cstdlib>
#include <cstddef> // std::size_t
#include <clocale>
#include <cstring>
#include <cerrno>
@ -136,14 +137,17 @@ bool ResourceDeclaration::isCompressed() const
// Initialization of static members
const std::array<string, 2> ResourceBuilderXMLVisitor::_tagTypeStr = {
"start", "end" };
{"start",
"end"}
};
const std::array<string, 5> 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));