summaryrefslogtreecommitdiffstats
path: root/src/H5Osdspace.c
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-07-20 17:58:37 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-07-20 17:58:37 (GMT)
commit34595bac3b5f0b2dad3050907c07e023a6972097 (patch)
tree34ce0884c518396dd75dfc88faf15084ee18aa05 /src/H5Osdspace.c
parent1dbacc8377754e33e8088ad6c7895a5f68bf7dfb (diff)
downloadhdf5-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/H5Osdspace.c')
-rw-r--r--src/H5Osdspace.c36
1 files changed, 29 insertions, 7 deletions
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c
index 117dcf3..d7727ef 100644
--- a/src/H5Osdspace.c
+++ b/src/H5Osdspace.c
@@ -48,6 +48,8 @@ const H5O_class_t H5O_SDSPACE[1] = {{
H5O_sdspace_debug, /* debug the message */
}};
+#define H5O_SDSPACE_VERSION 1
+
/* Is the interface initialized? */
static hbool_t interface_initialize_g = FALSE;
#define INTERFACE_INIT NULL
@@ -74,13 +76,16 @@ static hbool_t interface_initialize_g = FALSE;
Robb Matzke, 1998-04-09
The current and maximum dimensions are now H5F_SIZEOF_SIZET bytes
instead of just four bytes.
+
+ Robb Matzke, 1998-07-20
+ Added a version number and reformatted the message for aligment.
--------------------------------------------------------------------------*/
static void *
H5O_sdspace_decode(H5F_t *f, const uint8 *p, H5O_shared_t __unused__ *sh)
{
H5S_simple_t *sdim = NULL;/* New simple dimensionality structure */
intn u; /* local counting variable */
- uintn flags;
+ uintn flags, version;
FUNC_ENTER(H5O_sdspace_decode, NULL);
@@ -91,8 +96,15 @@ H5O_sdspace_decode(H5F_t *f, const uint8 *p, H5O_shared_t __unused__ *sh)
/* decode */
if ((sdim = H5MM_calloc(sizeof(H5S_simple_t))) != NULL) {
- UINT32DECODE(p, sdim->rank);
- UINT32DECODE(p, flags);
+ version = *p++;
+ if (version!=H5O_SDSPACE_VERSION) {
+ HRETURN_ERROR(H5E_OHDR, H5E_CANTINIT, NULL,
+ "wrong version number in data space message");
+ }
+ sdim->rank = *p++;
+ flags = *p++;
+ p += 5; /*reserved*/
+
if (sdim->rank > 0) {
if (NULL==(sdim->size=H5MM_malloc(sizeof(sdim->size[0])*
sdim->rank))) {
@@ -157,6 +169,9 @@ H5O_sdspace_decode(H5F_t *f, const uint8 *p, H5O_shared_t __unused__ *sh)
Robb Matzke, 1998-04-09
The current and maximum dimensions are now H5F_SIZEOF_SIZET bytes
instead of just four bytes.
+
+ Robb Matzke, 1998-07-20
+ Added a version number and reformatted the message for aligment.
--------------------------------------------------------------------------*/
static herr_t
H5O_sdspace_encode(H5F_t *f, uint8 *p, const void *mesg)
@@ -179,8 +194,15 @@ H5O_sdspace_encode(H5F_t *f, uint8 *p, const void *mesg)
#endif
/* encode */
- UINT32ENCODE(p, sdim->rank);
- UINT32ENCODE(p, flags);
+ *p++ = H5O_SDSPACE_VERSION;
+ *p++ = sdim->rank;
+ *p++ = flags;
+ *p++ = 0; /*reserved*/
+ *p++ = 0; /*reserved*/
+ *p++ = 0; /*reserved*/
+ *p++ = 0; /*reserved*/
+ *p++ = 0; /*reserved*/
+
if (sdim->rank > 0) {
for (u = 0; u < sdim->rank; u++) {
H5F_encode_length (f, p, sdim->size[u]);
@@ -317,9 +339,9 @@ static size_t
H5O_sdspace_size(H5F_t *f, const void *mesg)
{
const H5S_simple_t *sdim = (const H5S_simple_t *) mesg;
+
/*
- * all dimensionality messages are at least 8 bytes long (four bytes for
- * rank and four bytes for flags)
+ * All dimensionality messages are at least 8 bytes long.
*/
size_t ret_value = 8;