From 53c04549318d82b2453e4415e871659a96df4468 Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Wed, 11 Jun 2014 18:19:13 +0200 Subject: [PATCH] Package: warn for unknown filter term and use Hash::iterator. --- src/Network/HTTPClient.cxx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Network/HTTPClient.cxx b/src/Network/HTTPClient.cxx index 74db1473b..cf35c950d 100644 --- a/src/Network/HTTPClient.cxx +++ b/src/Network/HTTPClient.cxx @@ -168,18 +168,19 @@ static naRef f_package_uninstall(pkg::Package& pkg, const nasal::CallContext& ct static SGPropertyNode_ptr queryPropsFromHash(const nasal::Hash& h) { SGPropertyNode_ptr props(new SGPropertyNode); - string_list keys(h.keys()); - string_list::const_iterator it; int tagCount = 0; - for (it = keys.begin(); it != keys.end(); ++it) { - if ((*it == "name") || (*it == "description")) { - props->setStringValue(*it, h.get(*it)); - } else if (strutils::starts_with(*it, "rating-")) { - props->setIntValue(*it, h.get(*it)); - } else if (strutils::starts_with(*it, "tag-")) { + for (nasal::Hash::const_iterator it = h.begin(); it != h.end(); ++it) { + std::string const key = it->getKey(); + if ((key == "name") || (key == "description")) { + props->setStringValue(key, it->getValue()); + } else if (strutils::starts_with(key, "rating-")) { + props->setIntValue(key, it->getValue()); + } else if (strutils::starts_with(key, "tag-")) { SGPropertyNode_ptr tag = props->getChild("tag", tagCount++, true); - tag->setStringValue(it->substr(4)); + tag->setStringValue(key.substr(4)); + } else { + SG_LOG(SG_GENERAL, SG_WARN, "unknown filter term in hash:" << key); } } -- 2.39.5