]> git.mxchange.org Git - flightgear.git/commitdiff
Package: warn for unknown filter term and use Hash::iterator.
authorThomas Geymayer <tomgey@gmail.com>
Wed, 11 Jun 2014 16:19:13 +0000 (18:19 +0200)
committerThomas Geymayer <tomgey@gmail.com>
Wed, 11 Jun 2014 16:19:13 +0000 (18:19 +0200)
src/Network/HTTPClient.cxx

index 74db1473bd18ba3b78733999da9e4c10425ab309..cf35c950d1ffb6596c44a66012b4f28c9b354717 100644 (file)
@@ -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<std::string>(*it));
-        } else if (strutils::starts_with(*it, "rating-")) {
-            props->setIntValue(*it, h.get<int>(*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<std::string>());
+        } else if (strutils::starts_with(key, "rating-")) {
+            props->setIntValue(key, it->getValue<int>());
+        } 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);
         }
     }