Skip to content

Commit 3884fb4

Browse files
committed
IO/config: declare some variables as constant
1 parent a443f55 commit 3884fb4

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/IO/configuration_JSON.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ void writeConfiguration(const std::string &filename, const Config *rootConfig, b
263263
void writeNode(const Config *config, rapidjson::Value &rootJSONData, rapidjson::Document::AllocatorType &allocator)
264264
{
265265
// Write the options
266-
for (auto &entry : config->getOptions()) {
266+
for (const auto &entry : config->getOptions()) {
267267
const std::string &configKey = entry.first;
268268
const std::string &configValue = entry.second;
269269

src/IO/configuration_XML.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void readNode(xmlNodePtr root, Config *config)
8484
void writeNode(xmlTextWriterPtr writer, const Config *config, const std::string &encoding)
8585
{
8686
// Write the options
87-
for (auto &entry : config->getOptions()) {
87+
for (const auto &entry : config->getOptions()) {
8888
const std::string &key = entry.first;
8989
const std::string &value = entry.second;
9090

src/IO/configuration_config.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,15 +408,15 @@ void Config::dump(std::ostream &out, int indentLevel) const
408408
out << std::endl;
409409
out << indent << "Options..." << std::endl;
410410
if (getOptionCount() > 0) {
411-
for (auto &entry : getOptions()) {
411+
for (const auto &entry : getOptions()) {
412412
out << indent << padding << entry.first << " = " << entry.second << std::endl;
413413
}
414414
} else {
415415
out << indent << padding << "No options." << std::endl;
416416
}
417417

418418
++indentLevel;
419-
for (auto &entry : getSections()) {
419+
for (const auto &entry : getSections()) {
420420
out << std::endl;
421421
out << indent << padding << "::: Section " << entry.first << " :::" << std::endl;
422422
entry.second->dump(out, indentLevel);

0 commit comments

Comments
 (0)