On Sun, 16 Aug 2009 01:48:26 -0300 Raphael Kubo da Costa <k...@profusion.mobi>
said:

argh! cornercase. if the parent struct would have anything else it it other
than a single empty list pointer - this would work (an int, - anything). here's
the problem.

eet looks at the data struct and goes "ooh list! let me encode this" when eet
stores data it looks a bit like this
DATA<name1>data1...
DATA<name2>data2...
etc.

so what u have is normally
data struct { name x
  list { for list x
    item {
      xxx;
    }
  }
  list { for list x
    item {
      yyy;
    }
  }
  list { for list x
    item {
      zzz;
    }
  }
};

that's 3 list items. every time it finds an item node it sees its for member of
list "x" and appends it. you have an empty list - thus
data struct { name x
}

which is an empty struct.. no data in it.., which encodes to 0 bytes - nothing.
thus the write is returning 0...

the problem only appears because your example is so simple/trivial. anything
m,ore complex "works just fine". :) now.. how do i fix this.

> Hi there,
> 
> I've been struggling to properly serialize a struct which only has an
> Eina_List of another struct as a member when this member is NULL (ie
> the list is empty).
> 
> When the list is empty, if the Eet file is already present and valid,
> it simply isn't updated, while if it still doesn't exist it isn't
> created at all.
> 
> I've attached a simple test case which prints the return value of
> eet_data_write - if the program is run with any number as its first
> parameter, it adds an entry to the Eina_List before writing it to
> disk; if no parameter is passed, it attempts to write the struct with
> the empty Eina_List, but fails.
> 
> (As a sidenote, the documentation for eet_data_write,
> eet_data_write_cipher and eet_write_cipher mention that their return
> value is either 0 or 1, but it's actually the number of bytes
> serialized for a given section).
> 
> -- 
> Raphael Kubo da Costa
> ProFUSION embedded systems
> http://profusion.mobi
> 


-- 
------------- Codito, ergo sum - "I code, therefore I am" --------------
The Rasterman (Carsten Haitzler)    ras...@rasterman.com


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to