You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a key/value pair under a section with a name (e.g. "Foo")
Add a key/value pair under the empty section (i.e. SectionName == "")
Save the file (I used CSimpleIniA::SaveFile(char *).)
Load the file (I used CSimpleIniA::LoadFile(char *).)
The second key (incorrectly) appears under the named section (e.g. "Foo")
What is the expected output? What do you see instead?
I expect a file like:
RootKey=RootValue
[Foo]
FooKey=FooValue
but I get
[Foo]
FooKey=FooValue
RootKey=RootValue
which causes the RootKey to incorrectly be placed under the Foo section.
What version of the product are you using? On what operating system?
Version 4.13 (2010-04-19). Win XP SP2.
Please provide any additional information below.
Built with VS2008 RTM.
I made a typo in my examples at the end. Corrected version:
<>
but:
CSimpleIniA test;
test.SetValue("Foo", "FooKey", "FooValue");
test.SetValue("", "RootKey", "RootValue");
test.SaveFile("Test.ini");
produces:
[Foo]
FooKey=FooValue
RootKey=RootValue
<>
Jul 28, 2010 Delete comment
Project Member #2 brofield
I haven't tested this but it seems correct that this bug would exist. It is due to the sorting of the data for output according to the order that it was created. This is done so that Save will save the data in the same order as the original file. Obviously this breaks down when data is added directly, and the root section is used.
What is needed is that all items in the root section are sorted before all other sections. I'll get to this bug in time.
Status: Accepted
Owner: brofield
The text was updated successfully, but these errors were encountered:
Reported by MatthewRDutton, Jul 26, 2010
What steps will reproduce the problem?
What is the expected output? What do you see instead?
I expect a file like:
RootKey=RootValue
[Foo]
FooKey=FooValue
but I get
[Foo]
FooKey=FooValue
RootKey=RootValue
which causes the RootKey to incorrectly be placed under the Foo section.
What version of the product are you using? On what operating system?
Version 4.13 (2010-04-19). Win XP SP2.
Please provide any additional information below.
Built with VS2008 RTM.
For example:
WritePrivateProfileString("Foo", "FooKey", "FooValue", "Test.ini");
WritePrivateProfileString("", "RootKey", "RootValue", "Test.ini");
produces:
[Foo]
FooKey=FooValue
[]
RootKey=RootValue
but:
CSimpleIniA test;
test.SetValue("Foo", "FooKey", "FooValue");
test.SetValue("", "RootKey", "RootValue");
test.SaveFile("Test.ini");
produces:
[Foo]
FooKey=FooValue
[]
RootKey=RootValue
Even if you don't intend to match WritePrivateProfileString, the current implementation causes empty section to be merged with the previous section.
Example test case:
CSimpleIniA test;
test.SetValue("Foo", "FooKey", "FooValue");
test.SetValue("", "RootKey", "RootValue");
test.SaveFile("Test.ini");
test.Reset();
test.LoadFile("Test.ini");
assert( strcmp(test.GetValue("Foo", "RootKey"), "RootValue") != 0 );
assert( strcmp(test.GetValue("", "RootKey"), "RootValue") == 0 );
Jul 26, 2010 Delete comment
#1 MatthewRDutton
I made a typo in my examples at the end. Corrected version:
<>
but:
CSimpleIniA test;
test.SetValue("Foo", "FooKey", "FooValue");
test.SetValue("", "RootKey", "RootValue");
test.SaveFile("Test.ini");
produces:
[Foo]
FooKey=FooValue
<>
Jul 28, 2010 Delete comment
Project Member #2 brofield
I haven't tested this but it seems correct that this bug would exist. It is due to the sorting of the data for output according to the order that it was created. This is done so that Save will save the data in the same order as the original file. Obviously this breaks down when data is added directly, and the root section is used.
What is needed is that all items in the root section are sorted before all other sections. I'll get to this bug in time.
Status: Accepted
Owner: brofield
The text was updated successfully, but these errors were encountered: