summaryrefslogtreecommitdiffstats
path: root/src/H5S.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2015-09-27 01:39:06 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2015-09-27 01:39:06 (GMT)
commit6f1dda474c22ee95b7cc132e703cd6a2ac596704 (patch)
tree84af5241f80a9c0a1e321a80508dc14a2b6ee711 /src/H5S.c
parent574ff3980afe62f83660cb2c617154e85ab128fd (diff)
parent8186a5cee10c41e97ba24b6fe1de9f6ce0c3902d (diff)
downloadhdf5-6f1dda474c22ee95b7cc132e703cd6a2ac596704.zip
hdf5-6f1dda474c22ee95b7cc132e703cd6a2ac596704.tar.gz
hdf5-6f1dda474c22ee95b7cc132e703cd6a2ac596704.tar.bz2
[svn-r27887] Description:
Merge changes from trunk to the branch. Tested on: MacOSX/64 10.10.5 (amazon) w/serial & parallel (h5committest not required on this branch)
Diffstat (limited to 'src/H5S.c')
-rw-r--r--src/H5S.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/src/H5S.c b/src/H5S.c
index 1d07f14..af7d395 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -1576,11 +1576,12 @@ 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 */
- H5F_t *f = NULL; /* Fake file structure*/
- herr_t ret_value = SUCCEED;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -1599,27 +1600,28 @@ 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(!*p || *nalloc < (extent_size + select_size + 1 + 1 + 1 + 4))
+ if(!pp || *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 */
- *(*p)++ = H5O_SDSPACE_ID;
+ *pp++ = H5O_SDSPACE_ID;
/* Encode the version of the dataspace information */
- *(*p)++ = H5S_ENCODE_VERSION;
+ *pp++ = H5S_ENCODE_VERSION;
/* Encode the "size of size" information */
- *(*p)++ = (unsigned char)H5F_SIZEOF_SIZE(f);
+ *pp++ = (unsigned char)H5F_SIZEOF_SIZE(f);
/* Encode size of extent information. Pointer is actually moved in this macro. */
- UINT32ENCODE(*p, extent_size);
+ UINT32ENCODE(pp, extent_size);
/* Encode the extent part of dataspace */
- if(H5O_msg_encode(f, H5O_SDSPACE_ID, TRUE, *p, obj) < 0)
+ if(H5O_msg_encode(f, H5O_SDSPACE_ID, TRUE, pp, obj) < 0)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTENCODE, FAIL, "can't encode extent space")
- *p += extent_size;
+ pp += 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 */
@@ -1692,38 +1694,39 @@ done:
H5S_t*
H5S_decode(const unsigned char **p)
{
- H5S_t *ds;
- H5S_extent_t *extent;
- size_t extent_size; /* size of the extent message*/
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 */
+ size_t extent_size; /* size of the extent message*/
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(*(*p)++ != H5O_SDSPACE_ID)
+ if(*pp++ != H5O_SDSPACE_ID)
HGOTO_ERROR(H5E_DATASPACE, H5E_BADMESG, NULL, "not an encoded dataspace")
/* Decode the version of the dataspace information */
- if(*(*p)++ != H5S_ENCODE_VERSION)
+ if(*pp++ != H5S_ENCODE_VERSION)
HGOTO_ERROR(H5E_DATASPACE, H5E_VERSION, NULL, "unknown version of encoded dataspace")
/* Decode the "size of size" information */
- sizeof_size = *(*p)++;
+ sizeof_size = *pp++;
/* 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(*p, extent_size);
+ UINT32DECODE(pp, 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, *p))==NULL)
+ if((extent = (H5S_extent_t *)H5O_msg_decode(f, H5P_DEFAULT, NULL, H5O_SDSPACE_ID, pp))==NULL)
HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDECODE, NULL, "can't decode object")
- *p += extent_size;
+ pp += extent_size;
/* Copy the extent into dataspace structure */
if((ds = H5FL_CALLOC(H5S_t))==NULL)
@@ -1739,6 +1742,7 @@ 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")