summaryrefslogtreecommitdiffstats
path: root/src/H5S.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2015-09-29 18:56:27 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2015-09-29 18:56:27 (GMT)
commit5c0a8cc86ebe85e1b46e20f253f09c86bdc83169 (patch)
tree1281be3f8a32432ead139af7381426c0a9fe92d5 /src/H5S.c
parent6f1dda474c22ee95b7cc132e703cd6a2ac596704 (diff)
downloadhdf5-5c0a8cc86ebe85e1b46e20f253f09c86bdc83169.zip
hdf5-5c0a8cc86ebe85e1b46e20f253f09c86bdc83169.tar.gz
hdf5-5c0a8cc86ebe85e1b46e20f253f09c86bdc83169.tar.bz2
[svn-r27912] Revert of r27887, which caused failures in the vds test. These
changes will be merged more carefully so we can more easily identify any errors that arise. Tested on: Ubuntu 15.04 (Linux 3.19 x86_64) w/ gcc 4.9.2 serial and parallel (w/ MPICH 3.1.4)
Diffstat (limited to 'src/H5S.c')
-rw-r--r--src/H5S.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/src/H5S.c b/src/H5S.c
index af7d395..1d07f14 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -1576,12 +1576,11 @@ done:
herr_t
H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc)
{
- H5F_t *f = NULL; /* Fake file structure*/
- unsigned char *pp = (*p); /* Local pointer for decoding */
size_t extent_size; /* Size of serialized dataspace extent */
hssize_t sselect_size; /* Signed size of serialized dataspace selection */
size_t select_size; /* Size of serialized dataspace selection */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t *f = NULL; /* Fake file structure*/
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI_NOINIT
@@ -1600,28 +1599,27 @@ H5S_encode(H5S_t *obj, unsigned char **p, size_t *nalloc)
/* Verify the size of buffer. If it's not big enough, simply return the
* right size without filling the buffer. */
- if(!pp || *nalloc < (extent_size + select_size + 1 + 1 + 1 + 4))
+ if(!*p || *nalloc < (extent_size + select_size + 1 + 1 + 1 + 4))
*nalloc = extent_size + select_size + 1 + 1 + 1 + 4;
else {
/* Encode the type of the information */
- *pp++ = H5O_SDSPACE_ID;
+ *(*p)++ = H5O_SDSPACE_ID;
/* Encode the version of the dataspace information */
- *pp++ = H5S_ENCODE_VERSION;
+ *(*p)++ = H5S_ENCODE_VERSION;
/* Encode the "size of size" information */
- *pp++ = (unsigned char)H5F_SIZEOF_SIZE(f);
+ *(*p)++ = (unsigned char)H5F_SIZEOF_SIZE(f);
/* Encode size of extent information. Pointer is actually moved in this macro. */
- UINT32ENCODE(pp, extent_size);
+ UINT32ENCODE(*p, extent_size);
/* Encode the extent part of dataspace */
- if(H5O_msg_encode(f, H5O_SDSPACE_ID, TRUE, pp, obj) < 0)
+ if(H5O_msg_encode(f, H5O_SDSPACE_ID, TRUE, *p, obj) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode extent space")
- pp += extent_size;
+ *p += extent_size;
/* Encode the selection part of dataspace. */
- *p = pp;
if(H5S_SELECT_SERIALIZE(obj, p) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode select space")
} /* end else */
@@ -1694,39 +1692,38 @@ done:
H5S_t*
H5S_decode(const unsigned char **p)
{
- H5F_t *f = NULL; /* Fake file structure*/
- H5S_t *ds; /* Decoded dataspace */
- H5S_extent_t *extent; /* Entent of decoded dataspace */
- const unsigned char *pp = (*p); /* Local pointer for decoding */
+ H5S_t *ds;
+ H5S_extent_t *extent;
size_t extent_size; /* size of the extent message*/
+ H5F_t *f = NULL; /* Fake file structure*/
uint8_t sizeof_size; /* 'Size of sizes' for file */
H5S_t *ret_value = NULL; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Decode the type of the information */
- if(*pp++ != H5O_SDSPACE_ID)
+ if(*(*p)++ != H5O_SDSPACE_ID)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADMESG, NULL, "not an encoded dataspace")
/* Decode the version of the dataspace information */
- if(*pp++ != H5S_ENCODE_VERSION)
+ if(*(*p)++ != H5S_ENCODE_VERSION)
HGOTO_ERROR(H5E_DATASPACE, H5E_VERSION, NULL, "unknown version of encoded dataspace")
/* Decode the "size of size" information */
- sizeof_size = *pp++;
+ sizeof_size = *(*p)++;
/* Allocate "fake" file structure */
if(NULL == (f = H5F_fake_alloc(sizeof_size)))
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, NULL, "can't allocate fake file struct")
/* Decode size of extent information */
- UINT32DECODE(pp, extent_size);
+ UINT32DECODE(*p, extent_size);
/* Decode the extent part of dataspace */
/* (pass mostly bogus file pointer and bogus DXPL) */
- if((extent = (H5S_extent_t *)H5O_msg_decode(f, H5P_DEFAULT, NULL, H5O_SDSPACE_ID, pp))==NULL)
+ if((extent = (H5S_extent_t *)H5O_msg_decode(f, H5P_DEFAULT, NULL, H5O_SDSPACE_ID, *p))==NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode object")
- pp += extent_size;
+ *p += extent_size;
/* Copy the extent into dataspace structure */
if((ds = H5FL_CALLOC(H5S_t))==NULL)
@@ -1742,7 +1739,6 @@ H5S_decode(const unsigned char **p)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, NULL, "unable to set all selection")
/* Decode the select part of dataspace. I believe this part always exists. */
- *p = pp;
if(H5S_SELECT_DESERIALIZE(&ds, p) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode space selection")