Opened 12 years ago

Closed 8 years ago

#4973 closed Bugs (fixed)

ini_parser.hpp doesn't handle sections correctly

Reported by: bernd@… Owned by: Sebastian Redl
Milestone: To Be Determined Component: property_tree
Version: Boost 1.45.0 Severity: Problem
Keywords: Cc: prabhu.swain@…

Description

    ptree pt;
    pt.put("debug.filename", "tst.log");
    pt.put("other", "tst");

"other" is correctly put in no section

    boost::property_tree::write_ini("tst.ini", pt);
    boost::property_tree::read_ini("tst.ini", pt);

"other" is now suddenly in "debug" section

Change History (5)

comment:1 by Vicente Botet <vicente.botet@…>, 12 years ago

Component: Noneproperty_tree
Owner: set to Sebastian Redl

comment:2 by prabhu.swain@…, 12 years ago

Cc: prabhu.swain@… added

comment:3 by sipan at sipan.org, 11 years ago

--- ini_parser.hpp	2011-12-14 12:15:22.000000000 -0500
+++ inix_parser.hpp	2011-12-14 12:12:45.000000000 -0500
@@ -238,7 +238,14 @@ namespace boost { namespace property_tre
                     << it->second.template get_value<
                         std::basic_string<Ch> >()
                     << Ch('\n');
-            } else {
+            }
+        }
+
+        for (typename Ptree::const_iterator it = pt.begin(), end = pt.end();
+             it != end; ++it)
+        {
+            check_dupes(it->second);
+            if (!it->second.empty()) {
                 if (!it->second.data().empty())
                     BOOST_PROPERTY_TREE_THROW(ini_parser_error(
                         "mixed data and children", "", 0));

comment:4 by Sebastian Redl, 8 years ago

Status: newassigned

Fixed by commit 2463e87 on develop.

comment:5 by Sebastian Redl, 8 years ago

Resolution: fixed
Status: assignedclosed

Merged to master in commit 3befb8cbe4.

Note: See TracTickets for help on using tickets.