From: David S. <on...@gm...> - 2011-10-26 13:42:07
|
On Wed, 26 Oct 2011 15:33:14 +0200 Cedric BAIL <ced...@fr...> wrote: > Hey, > > On Wed, Oct 26, 2011 at 2:56 PM, David Seikel <on...@gm...> > wrote: > > I'm having an odd problem when trying to add an array of simple > > types in an eet file. The attached file is the simple cut down > > version. The real code is more complex, and needs the fuller > > versions of these structures to be the way they are. > > > > I have a macro that is patterned after the other eet macros - > > EET_DATA_DESCRIPTOR_ADD_BASIC_ARRAY. It's used twice in this > > example, once for the Meter.prizes array, the second one for the > > Barrel.cards array. If the Meter.prizes version is commented out, > > everything works fine. Otherwise I get the attached valgrind > > report (with no eet file existing when it starts). > > > > Likely there is something wrong with my macro. I think there > > should be such a macro already, but apparently the received wisdom > > from raster is that for something so simple, just use the > > eet_data_descriptor_element_add() function directly. Even though > > that functions docs say - > > > > "It is complex to use by hand and should be left to be used by the > > macros, and thus is not documented." > > > > Um, yeah. Well, I tried. lol > > Well we are adding this macro as people need and use it. First be > aware I have no way to compile nor test your code nor what I will say. > I think you need to divide the size of your structure by the size of > the element so that the count do match. So you should have something > like : sizeof(___ett.member) / sizeof(___ett.member[0]). Ah, that did the trick, and makes sense. It's the count of elements, not the count of bytes. Thanks. I'll send a patch with this macro after some more testing. Unless someone beats me to it. -- A big old stinking pile of genius that no one wants coz there are too many silver coated monkeys in the world. |