removed obsolete section about gserialize.

2008-11-22  Sven Neumann  <sven@gimp.org>

	* parasites.txt: removed obsolete section about gserialize.


svn path=/trunk/; revision=27708
This commit is contained in:
Sven Neumann 2008-11-22 12:37:57 +00:00 committed by Sven Neumann
parent 8c7ab1c285
commit 4742f2cef1
2 changed files with 4 additions and 39 deletions

View file

@ -1,3 +1,7 @@
2008-11-22 Sven Neumann <sven@gimp.org>
* parasites.txt: removed obsolete section about gserialize.
2008-09-29 Sven Neumann <sven@gimp.org>
* release-howto.txt: there's no need to fiddle with

View file

@ -272,42 +272,3 @@ non-persistant data might be fine as well):
the size of the string representation of your data, you can use
gimp_config_serialize_to_string() and other functions to easily
convert your data to/from a character string.
- Obsolete: Use the libgimp serialize functions
NOTE: libgimp/gserialize.[ch] has been excluded from the build since
gimp-1.2. This decision was made since noone seemed to use it so
far. The files can still be pulled out of SVN, so if you decide
to use them, you will have to include a copy into your plugin
source or resurrect the functionality in libgimp.
Look at the stuff in libgimp/gserialize.h. These functions allow for
relatively easy serializing/deserializing of structs. The advantages
are that the gimp-developers have already taken care of endian-ness
issues and other hazzles. The drawback is that you might encounter
problems when you want to extend your structures later, as you have to
be prepared for images saved with parasites form a very old version of
your plug-in, and the gserialize functions do not handle different data
formats nicely itself.
One way out around this is to prefix your data with a version identifier
(remember to use a guchar, i.e. something without endian-ness problems).
Remember to skip it before deserializing.
Another very easy way is to add a version tag to your parasite name,
i.e. "foo-bar-v1", "foo-bar-v2". Your plug-in could then check for older
versions and act accordingly and/or attach the new parasite or both the
new and the old version of your data.
The gserialize stuff also makes it possible to just append more fields
(i.e. more gserialized structs) to your data. You could check the length
of the parasite data ("anything left?") to decide wether to decode more
fields. Here's some example:
data = parasite_data(p);
size = parasite_data_size(p);
length = gdeserialize(...);
tlength += length;
data += length;
if (tlength != size)
gdeserialize the next one, etc.