Created attachment 62545 [details] Screenshot showing that all array-elements get the same size, while their size-elements would be different. Version: 0.7.0 (using KDE 4.7.0) OS: Linux I tried to use the structures tool to inspect an array of elements of dynamic size. This means, each array-element has its own size member, that specifies its size. However, only the size member of the first array-element is used. All other array-elements get the same size as the first one. Reproducible: Always Steps to Reproduce: Create a structure template that contains an array, where each array element contains a size-member, and a member with dynamic size. I used the following template to inspect CDC files ("Concise Device Configuration", a binary configuration file format used by Ethernet Powerlink): <?xml version="1.0" encoding="UTF-8"?> <data> <struct name="CdcFile"> <primitive name="NumberOfEntries" type="UInt32" /> <array name="CdcEntries" length="10" > <struct name="nested"> <primitive name="Index" type="UInt16" /> <primitive name="SubIndex" type="UInt8" /> <primitive name="DataSize" type="UInt32" /> <array name="DataArray" length="DataSize"> <primitive name="Data" type="UInt8" /> </array> </struct> </array> </struct> </data> Actual Results: The size of all array elements is determined by the size-member of the first array element. Expected Results: Each array element should have its own size, depending on its size element.
Created attachment 62546 [details] Example for a CDC file matching the XML description. This is one of the CDC files I tried to inspect using Okteta's structure tool. The example file is taken from the open source powerlink implementation (openPOWERLINK), which means the file is BSD licensed and adding it to bug reports should be ok.
Created attachment 62547 [details] Screenshot of the CDC file structure. The CDC file structure I used to develop my structure XML template. The picture is a screenshot from the official powerlink specification.
Created attachment 62548 [details] *.desktop file I used for my testcase The *.desktop file I created for my tests. I is based on the information one can find for the Okteta structure tool: http://docs.kde.org/development/de/kdesdk/okteta/tools-structures.html http://frinring.wordpress.com/2010/01/16/tutorial-create-your-own-okteta-structure-definitions/
Created attachment 62549 [details] *.osd file I used for my testcase The *.osd file I created for my tests. I is based on the information one can find for the Okteta structure tool: http://docs.kde.org/development/de/kdesdk/okteta/tools-structures.html http://frinring.wordpress.com/2010/01/16/tutorial-create-your-own-okteta-structure-definitions/
Looking at the code again, it seems it always searches for the first item with matching name starting from the root. It would probably be better to query the direct parent element first. Therefore the length is always the same. I'll try to fix it ASAP
Created attachment 62694 [details] A correspongin JavaScript structure definition This structure definition works as a workaround until I have fixed this bug. It uses JS to define the structure, which is not documented properly yet. However I discovered today that parsing of JS structures got broken when adding QT_NO_CAST_FROM_ASCII, so it does not work in 4.7.0. A fix is in SVN, so this will work with the 4.7.1 and 4.8 versions.
Created attachment 62695 [details] The desktop file used
SVN commit 1246953 by arichardson: Fixed Dynamic arrays always having the length of the first matching element Now the parent is searched first instead of starting at the highest level BUG: 279398 M +30 -0 datainformation.cpp M +1 -0 datainformation.h M +0 -25 datainformationwithchildren.cpp M +0 -2 datainformationwithchildren.h M +11 -19 dynamiclengtharraydatainformation.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1246953
SVN commit 1246955 by arichardson: Backport r1246953 Fixed Dynamic arrays always having the length of the first matching element Now the parent is searched first instead of starting at the highest level BUG: 279398 M +30 -0 datainformation.cpp M +1 -0 datainformation.h M +0 -25 datainformationwithchildren.cpp M +0 -2 datainformationwithchildren.h M +11 -19 dynamiclengtharraydatainformation.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1246955