On Fri, Sep 7, 2012 at 4:47 PM, Michael Blumenkrantz
<[email protected]> wrote:
> On Fri, 7 Sep 2012 18:00:48 +0530
> Dinesh Devaraj <[email protected]> wrote:
>
>> /*
>> * File: FirstEet.c
>> * Author: root
>> *
>> * Created on September 7, 2012, 6:39 PM
>> */
>>
>> #include <stdio.h>
>> #include <stdlib.h>
>> #include <Eina.h>
>> #include <Eet.h>
>>
>> /*
>> *
>> */
>>
>> int main(int argc, char** argv) {
>>
>> eina_init();
>> eet_init();
>>
>> //----- Crating a new EET descriptor starts -----//
>>
>> typedef struct {
>> int Id;
>> char *szName;
>> Eina_List *label;
>> Eina_Bool bGender;
>> } PERSON;
>>
>> /* Step 01 : declaration of the description handle */
>> Eet_Data_Descriptor *des;
>> /* Step 02 : declaration of the description class variable */
>> Eet_Data_Descriptor_Class eddc;
>> /* Step 03 : initializing the description class including the
>> * data structure to the description class */
>> EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, PERSON);
>> /* Step 04 : registering the new description class to get the
>> * description handle */
>> des = eet_data_descriptor_stream_new(&eddc);
>> /* Step 05 : binding the members to the data description */
>> EET_DATA_DESCRIPTOR_ADD_BASIC(des, PERSON, "Id", Id, EET_T_INT);
>> EET_DATA_DESCRIPTOR_ADD_BASIC(des, PERSON, "szName", szName, EET_T_STRING);
>> EET_DATA_DESCRIPTOR_ADD_BASIC(des, PERSON, "bGender", bGender, EET_T_INT);
>> EET_DATA_DESCRIPTOR_ADD_BASIC(des, PERSON, "label", label, EET_G_LIST);
That one is really wrong. Actually I think I will patch eet_data to
detect this non sense, not difficult and should be easier for people
to understand what is going on. So you need to use :
EET_DATA_DESCRIPTOR_ADD_LIST or EET_DATA_DESCRIPTOR_ADD_LIST_STRING
(if you want a list of string).
>> /* Step 06 : declaring a variable to the data structure */
>> PERSON *Student;
>>
>> /* Step 07 : opening a EET file */
>> Eet_File *ef = eet_open("DesEet.eet", EET_FILE_MODE_READ_WRITE);
>>
>> int write = 1;
>> /* Step 08 : write/read the data structure to the EET file */
>> if (write) {
>> Student = (PERSON *) malloc(sizeof (PERSON));
>> Student->Id = 5;
>> Student->szName = "SomeOne";
>> Student->bGender = 0;
>> Student->label = NULL;
>> Student->label = eina_list_append(Student->label, (void *) 0x73245);
>> Student->label = eina_list_append(Student->label, (void *) 0x95324);
>> Student->label = eina_list_append(Student->label, (void *) 0x13643);
>> Student->label = eina_list_append(Student->label, (void *) 0x87142);
>> Student->label = eina_list_append(Student->label, (void *) 0x59241);
That is not going to play well with eet. Eet is designed to manipulate
real existing data. It doesn't save raw pointer as they will change
from one context to another, it only save the actual data (the pointed
data). So you need to put something real here.
--
Cedric BAIL
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel