diff options
author | Robb Matzke <matzke@llnl.gov> | 1998-07-20 17:58:37 (GMT) |
---|---|---|
committer | Robb Matzke <matzke@llnl.gov> | 1998-07-20 17:58:37 (GMT) |
commit | 34595bac3b5f0b2dad3050907c07e023a6972097 (patch) | |
tree | 34ce0884c518396dd75dfc88faf15084ee18aa05 /src/H5Oefl.c | |
parent | 1dbacc8377754e33e8088ad6c7895a5f68bf7dfb (diff) | |
download | hdf5-34595bac3b5f0b2dad3050907c07e023a6972097.zip hdf5-34595bac3b5f0b2dad3050907c07e023a6972097.tar.gz hdf5-34595bac3b5f0b2dad3050907c07e023a6972097.tar.bz2 |
[svn-r518] Changes since 19980720
----------------------
./doc/html/H5.format.html
./src/H5Oattr.c
./src/H5Odtype.c
./src/H5Oefl.c
./src/H5Olayout.c
./src/H5Osdspace.c
./src/H5Oshared.c
Added version numbers to some object header messages so we can
update them easier in the future. The library currently just
gives up if the version numbers don't match, but in the future
the library could handle multiple versions of a message.
./test/testhdf5.c
Removed an argument from the H5version() call that I missed
last time.
Diffstat (limited to 'src/H5Oefl.c')
-rw-r--r-- | src/H5Oefl.c | 56 |
1 files changed, 40 insertions, 16 deletions
diff --git a/src/H5Oefl.c b/src/H5Oefl.c index 94e2650..442b7b4 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -37,6 +37,8 @@ const H5O_class_t H5O_EFL[1] = {{ H5O_efl_debug, /*debug the message */ }}; +#define H5O_EFL_VERSION 1 + /* Interface initialization */ static hbool_t interface_initialize_g = FALSE; #define INTERFACE_INIT NULL @@ -56,14 +58,16 @@ static hbool_t interface_initialize_g = FALSE; * Tuesday, November 25, 1997 * * Modifications: - * + * Robb Matzke, 1998-07-20 + * Rearranged the message to add a version number near the beginning. + * *------------------------------------------------------------------------- */ static void * H5O_efl_decode(H5F_t *f, const uint8 *p, H5O_shared_t __unused__ *sh) { H5O_efl_t *mesg = NULL; - int i; + intn i, version; const char *s = NULL; FUNC_ENTER(H5O_efl_decode, NULL); @@ -73,22 +77,34 @@ H5O_efl_decode(H5F_t *f, const uint8 *p, H5O_shared_t __unused__ *sh) assert(p); assert (!sh); - /* Decode the header */ if (NULL==(mesg = H5MM_calloc(sizeof(H5O_efl_t)))) { HRETURN_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); } + + /* Version */ + version = *p++; + if (version!=H5O_EFL_VERSION) { + HRETURN_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, + "bad version number for external file list message"); + } + + /* Reserved */ + p += 3; + + /* Number of slots */ + UINT16DECODE(p, mesg->nalloc); + assert(mesg->nalloc>0); + UINT16DECODE(p, mesg->nused); + assert(mesg->nused <= mesg->nalloc); + + /* Heap address */ H5F_addr_decode(f, &p, &(mesg->heap_addr)); #ifndef NDEBUG assert (H5F_addr_defined (&(mesg->heap_addr))); s = H5HL_peek (f, &(mesg->heap_addr), 0); assert (s && !*s); #endif - UINT16DECODE(p, mesg->nalloc); - assert(mesg->nalloc>0); - UINT16DECODE(p, mesg->nused); - assert(mesg->nused <= mesg->nalloc); - p += 4; /*reserved*/ /* Decode the file list */ mesg->slot = H5MM_calloc(mesg->nalloc*sizeof(H5O_efl_entry_t)); @@ -128,7 +144,9 @@ H5O_efl_decode(H5F_t *f, const uint8 *p, H5O_shared_t __unused__ *sh) * Tuesday, November 25, 1997 * * Modifications: - * + * Robb Matzke, 1998-07-20 + * Rearranged the message to add a version number near the beginning. + * *------------------------------------------------------------------------- */ static herr_t @@ -146,17 +164,23 @@ H5O_efl_encode(H5F_t *f, uint8 *p, const void *_mesg) assert(mesg); assert(p); - /* Encode header */ - assert (H5F_addr_defined (&(mesg->heap_addr))); - H5F_addr_encode(f, &p, &(mesg->heap_addr)); + /* Version */ + *p++ = H5O_EFL_VERSION; + + /* Reserved */ + *p++ = 0; + *p++ = 0; + *p++ = 0; + + /* Number of slots */ assert (mesg->nalloc>0); UINT16ENCODE(p, mesg->nused); /*yes, twice*/ assert (mesg->nused>0 && mesg->nused<=mesg->nalloc); UINT16ENCODE(p, mesg->nused); - *p++ = 0; - *p++ = 0; - *p++ = 0; - *p++ = 0; + + /* Heap address */ + assert (H5F_addr_defined (&(mesg->heap_addr))); + H5F_addr_encode(f, &p, &(mesg->heap_addr)); /* Encode file list */ for (i=0; i<mesg->nused; i++) { |