diff options
author | Dana Robinson <derobins@hdfgroup.org> | 2015-09-29 18:56:27 (GMT) |
---|---|---|
committer | Dana Robinson <derobins@hdfgroup.org> | 2015-09-29 18:56:27 (GMT) |
commit | 5c0a8cc86ebe85e1b46e20f253f09c86bdc83169 (patch) | |
tree | 1281be3f8a32432ead139af7381426c0a9fe92d5 /src | |
parent | 6f1dda474c22ee95b7cc132e703cd6a2ac596704 (diff) | |
download | hdf5-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')
-rw-r--r-- | src/CMakeLists.txt | 12 | ||||
-rw-r--r-- | src/H5S.c | 40 | ||||
-rw-r--r-- | src/H5Sall.c | 18 | ||||
-rw-r--r-- | src/H5Shyper.c | 94 | ||||
-rw-r--r-- | src/H5Snone.c | 16 | ||||
-rw-r--r-- | src/H5Spoint.c | 51 |
6 files changed, 91 insertions, 140 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6253f51..ff69d5e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -820,11 +820,6 @@ if (HDF5_GENERATE_HEADERS) endif (PERL_FOUND) endif (HDF5_GENERATE_HEADERS) -set (H5_PUBLIC_GENERATED_HEADERS - ${HDF5_SRC_DIR}/H5version.h - ${HDF5_SRC_DIR}/H5overflow.h -) - #----------------------------------------------------------------------------- # Setup the H5Detect utility which generates H5Tinit with platform # specific type checks inside @@ -837,7 +832,7 @@ endif (MSVC OR MINGW) if (HDF5_GENERATE_HEADERS) add_dependencies(H5detect generate_precompiled) else (HDF5_GENERATE_HEADERS) - add_dependencies(H5detect "${H5_PUBLIC_GENERATED_HEADERS}") + add_dependencies(H5detect "${HDF5_SRC_DIR}/H5version.h;${HDF5_SRC_DIR}/H5overflow.h") endif (HDF5_GENERATE_HEADERS) set (CMD $<TARGET_FILE:H5detect>) @@ -856,7 +851,7 @@ endif (MSVC OR MINGW) if (HDF5_GENERATE_HEADERS) add_dependencies(H5detect generate_precompiled) else (HDF5_GENERATE_HEADERS) - add_dependencies(H5make_libsettings "${H5_PUBLIC_GENERATED_HEADERS}") + add_dependencies(H5make_libsettings "${HDF5_SRC_DIR}/H5version.h;${HDF5_SRC_DIR}/H5overflow.h") endif (HDF5_GENERATE_HEADERS) set (CMD $<TARGET_FILE:H5make_libsettings>) @@ -905,7 +900,7 @@ endif (HDF5_ENABLE_DEBUG_APIS) set (install_targets ${HDF5_LIB_TARGET}) if (BUILD_SHARED_LIBS) - add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) + add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS}) TARGET_C_PROPERTIES (${HDF5_LIBSH_TARGET} SHARED " " " ") target_link_libraries (${HDF5_LIBSH_TARGET} ${LINK_SHARED_LIBS}) if (NOT WIN32) @@ -950,7 +945,6 @@ if (NOT HDF5_INSTALL_NO_DEVELOPMENT) install ( FILES ${H5_PUBLIC_HEADERS} - ${H5_PUBLIC_GENERATED_HEADERS} DESTINATION ${HDF5_INSTALL_INCLUDE_DIR} COMPONENT @@ -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") diff --git a/src/H5Sall.c b/src/H5Sall.c index fb6b45f..79796c3 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -516,25 +516,19 @@ H5S_all_serial_size (const H5S_t H5_ATTR_UNUSED *space) REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_all_serialize(const H5S_t *space, uint8_t **p) +H5S_all_serialize (const H5S_t *space, uint8_t **p) { - uint8_t *pp = (*p); /* Local pointer for decoding */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - /* Check args */ HDassert(space); HDassert(p); - HDassert(pp); + HDassert(*p); /* Store the preamble information */ - UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ - UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */ - UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */ - UINT32ENCODE(pp, (uint32_t)0); /* Store the additional information length */ - - /* Update encoding pointer */ - *p = pp; + UINT32ENCODE(*p, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ + UINT32ENCODE(*p, (uint32_t)1); /* Store the version number */ + UINT32ENCODE(*p, (uint32_t)0); /* Store the un-used padding */ + UINT32ENCODE(*p, (uint32_t)0); /* Store the additional information length */ FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_all_serialize() */ diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 11e5369..1a4e4f5 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -2014,14 +2014,14 @@ H5S_hyper_serial_size(const H5S_t *space) PURPOSE Serialize the current selection into a user-provided buffer. USAGE - void H5S_hyper_serialize_helper(spans, start, end, rank, buf) + herr_t H5S_hyper_serialize_helper(spans, start, end, rank, buf) H5S_hyper_span_info_t *spans; IN: Hyperslab span tree to serialize hssize_t start[]; IN/OUT: Accumulated start points hssize_t end[]; IN/OUT: Accumulated end points hsize_t rank; IN: Current rank looking at uint8 *buf; OUT: Buffer to put serialized selection into RETURNS - <none> + Non-negative on success/Negative on failure DESCRIPTION Serializes the current element selection into a buffer. (Primarily for storing on disk). @@ -2030,13 +2030,13 @@ H5S_hyper_serial_size(const H5S_t *space) EXAMPLES REVISION LOG --------------------------------------------------------------------------*/ -static void -H5S_hyper_serialize_helper(const H5S_hyper_span_info_t *spans, +static herr_t +H5S_hyper_serialize_helper (const H5S_hyper_span_info_t *spans, hsize_t *start, hsize_t *end, hsize_t rank, uint8_t **p) { H5S_hyper_span_t *curr; /* Pointer to current hyperslab span */ - uint8_t *pp = (*p); /* Local pointer for decoding */ hsize_t u; /* Index variable */ + herr_t ret_value=SUCCEED; /* return value */ FUNC_ENTER_NOAPI_NOINIT @@ -2045,7 +2045,7 @@ H5S_hyper_serialize_helper(const H5S_hyper_span_info_t *spans, HDassert(start); HDassert(end); HDassert(rank < H5O_LAYOUT_NDIMS); - HDassert(p && pp); + HDassert(p && *p); /* Walk through the list of spans, recursing or outputing them */ curr=spans->head; @@ -2057,35 +2057,33 @@ H5S_hyper_serialize_helper(const H5S_hyper_span_info_t *spans, end[rank]=curr->high; /* Recurse down to the next dimension */ - *p = pp; - H5S_hyper_serialize_helper(curr->down, start, end, rank = 1, p); + if(H5S_hyper_serialize_helper(curr->down,start,end,rank+1,p)<0) + HGOTO_ERROR(H5E_INTERNAL, H5E_CANTFREE, FAIL, "failed to release hyperslab spans") } /* end if */ else { /* Encode all the previous dimensions starting & ending points */ /* Encode previous starting points */ for(u=0; u<rank; u++) - UINT32ENCODE(pp, (uint32_t)start[u]); + UINT32ENCODE(*p, (uint32_t)start[u]); /* Encode starting point for this span */ - UINT32ENCODE(pp, (uint32_t)curr->low); + UINT32ENCODE(*p, (uint32_t)curr->low); /* Encode previous ending points */ for(u=0; u<rank; u++) - UINT32ENCODE(pp, (uint32_t)end[u]); + UINT32ENCODE(*p, (uint32_t)end[u]); /* Encode starting point for this span */ - UINT32ENCODE(pp, (uint32_t)curr->high); + UINT32ENCODE(*p, (uint32_t)curr->high); } /* end else */ /* Advance to next node */ curr=curr->next; } /* end while */ - /* Update encoding pointer */ - *p = pp; - - FUNC_LEAVE_NOAPI_VOID +done: + FUNC_LEAVE_NOAPI(ret_value) } /* H5S_hyper_serialize_helper() */ @@ -2111,15 +2109,14 @@ H5S_hyper_serialize_helper(const H5S_hyper_span_info_t *spans, REVISION LOG --------------------------------------------------------------------------*/ static herr_t -H5S_hyper_serialize(const H5S_t *space, uint8_t **p) +H5S_hyper_serialize (const H5S_t *space, uint8_t **p) { const H5S_hyper_dim_t *diminfo; /* Alias for dataspace's diminfo information */ - uint8_t *pp = (*p); /* Local pointer for decoding */ hsize_t tmp_count[H5O_LAYOUT_NDIMS]; /* Temporary hyperslab counts */ - hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */ + hsize_t offset[H5O_LAYOUT_NDIMS]; /* Offset of element in dataspace */ hsize_t start[H5O_LAYOUT_NDIMS]; /* Location of start of hyperslab */ hsize_t end[H5O_LAYOUT_NDIMS]; /* Location of end of hyperslab */ - hsize_t temp_off; /* Offset in a given dimension */ + hsize_t temp_off; /* Offset in a given dimension */ uint8_t *lenp; /* pointer to length location for later storage */ uint32_t len = 0; /* number of bytes used */ uint32_t version; /* Version number */ @@ -2131,10 +2128,7 @@ H5S_hyper_serialize(const H5S_t *space, uint8_t **p) FUNC_ENTER_NOAPI_NOINIT_NOERR - /* Check args */ HDassert(space); - HDassert(p); - HDassert(pp); /* Calculate version */ if(space->select.sel_info.hslab->unlim_dim >= 0) { @@ -2145,17 +2139,17 @@ H5S_hyper_serialize(const H5S_t *space, uint8_t **p) version = 1; /* Store the preamble information */ - UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ - UINT32ENCODE(pp, version); /* Store the version number */ + UINT32ENCODE(*p, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ + UINT32ENCODE(*p, version); /* Store the version number */ if(version >= 2) - *pp++ = flags; /* Store the flags */ + *(*p)++ = flags; /* Store the flags */ else - UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */ - lenp = pp; /* Keep the pointer to the length location for later */ - pp += 4; /* Skip over space for length */ + UINT32ENCODE(*p, (uint32_t)0); /* Store the un-used padding */ + lenp = *p; /* keep the pointer to the length location for later */ + *p += 4; /* skip over space for length */ /* Encode number of dimensions */ - UINT32ENCODE(pp, (uint32_t)space->extent.rank); + UINT32ENCODE(*p, (uint32_t)space->extent.rank); len += 4; /* If there is an unlimited dimension, only encode opt_unlim_diminfo */ @@ -2167,10 +2161,10 @@ H5S_hyper_serialize(const H5S_t *space, uint8_t **p) /* Iterate over dimensions */ for(i = 0; i < space->extent.rank; i++) { /* Encode start/stride/block/count */ - UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].start); - UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].stride); - UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].count); - UINT64ENCODE(pp, space->select.sel_info.hslab->opt_diminfo[i].block); + UINT64ENCODE(*p, space->select.sel_info.hslab->opt_diminfo[i].start); + UINT64ENCODE(*p, space->select.sel_info.hslab->opt_diminfo[i].stride); + UINT64ENCODE(*p, space->select.sel_info.hslab->opt_diminfo[i].count); + UINT64ENCODE(*p, space->select.sel_info.hslab->opt_diminfo[i].block); } /* end for */ } /* end if */ /* Check for a "regular" hyperslab selection */ @@ -2188,7 +2182,7 @@ H5S_hyper_serialize(const H5S_t *space, uint8_t **p) /* Encode number of hyperslabs */ H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t); - UINT32ENCODE(pp, (uint32_t)block_count); + UINT32ENCODE(*p, (uint32_t)block_count); len+=4; /* Now serialize the information for the regular hyperslab */ @@ -2211,11 +2205,11 @@ H5S_hyper_serialize(const H5S_t *space, uint8_t **p) /* Encode hyperslab starting location */ for(u = 0; u < ndims; u++) - UINT32ENCODE(pp, (uint32_t)offset[u]); + UINT32ENCODE(*p, (uint32_t)offset[u]); /* Encode hyperslab ending location */ for(u = 0; u < ndims; u++) - UINT32ENCODE(pp, (uint32_t)(offset[u] + (diminfo[u].block - 1))); + UINT32ENCODE(*p, (uint32_t)(offset[u] + (diminfo[u].block - 1))); /* Move the offset to the next sequence to start */ offset[fast_dim]+=diminfo[fast_dim].stride; @@ -2266,7 +2260,7 @@ H5S_hyper_serialize(const H5S_t *space, uint8_t **p) /* Encode number of hyperslabs */ block_count = H5S_hyper_span_nblocks(space->select.sel_info.hslab->span_lst); H5_CHECK_OVERFLOW(block_count, hsize_t, uint32_t); - UINT32ENCODE(pp, (uint32_t)block_count); + UINT32ENCODE(*p, (uint32_t)block_count); len+=4; /* Add 8 bytes times the rank for each hyperslab selected */ @@ -2274,16 +2268,12 @@ H5S_hyper_serialize(const H5S_t *space, uint8_t **p) len += (uint32_t)(8 * space->extent.rank * block_count); /* Encode each hyperslab in selection */ - *p = pp; H5S_hyper_serialize_helper(space->select.sel_info.hslab->span_lst, start, end, (hsize_t)0, p); } /* end else */ /* Encode length */ UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */ - /* Update encoding pointer */ - *p = pp; - FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_hyper_serialize() */ @@ -2316,7 +2306,6 @@ static herr_t H5S_hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t flags, const uint8_t **p) { - const uint8_t *pp = (*p); /* Local pointer for decoding */ unsigned rank; /* rank of points */ size_t num_elem=0; /* number of elements in selection */ hsize_t start[H5O_LAYOUT_NDIMS]; /* hyperslab start information */ @@ -2337,7 +2326,7 @@ H5S_hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fla /* Check args */ HDassert(space); HDassert(p); - HDassert(pp); + HDassert(*p); /* Deserialize slabs to select */ /* (The header and rank have already beed decoded) */ @@ -2351,10 +2340,10 @@ H5S_hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fla /* Iterate over dimensions */ for(i = 0; i < space->extent.rank; i++) { /* Decode start/stride/block/count */ - UINT64DECODE(pp, start[i]); - UINT64DECODE(pp, stride[i]); - UINT64DECODE(pp, count[i]); - UINT64DECODE(pp, block[i]); + UINT64DECODE(*p, start[i]); + UINT64DECODE(*p, stride[i]); + UINT64DECODE(*p, count[i]); + UINT64DECODE(*p, block[i]); } /* end for */ /* Select the hyperslab to the current selection */ @@ -2363,7 +2352,7 @@ H5S_hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fla } /* end if */ else { /* decode the number of points */ - UINT32DECODE(pp,num_elem); + UINT32DECODE(*p,num_elem); /* Set the count & stride for all blocks */ for(tcount=count,tstride=stride,j=0; j<rank; j++,tstride++,tcount++) { @@ -2375,11 +2364,11 @@ H5S_hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fla for(i=0; i<num_elem; i++) { /* Decode the starting points */ for(tstart=start,j=0; j<rank; j++,tstart++) - UINT32DECODE(pp, *tstart); + UINT32DECODE(*p, *tstart); /* Decode the ending points */ for(tend=end,j=0; j<rank; j++,tend++) - UINT32DECODE(pp, *tend); + UINT32DECODE(*p, *tend); /* Change the ending points into blocks */ for(tblock=block,tstart=start,tend=end,j=0; j<rank; j++,tstart++,tend++,tblock++) @@ -2391,9 +2380,6 @@ H5S_hyper_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t fla } /* end for */ } /* end else */ - /* Update decoding pointer */ - *p = pp; - done: FUNC_LEAVE_NOAPI(ret_value) } /* H5S_hyper_deserialize() */ diff --git a/src/H5Snone.c b/src/H5Snone.c index 3492325..2fbd44b 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -486,23 +486,15 @@ H5S_none_serial_size(const H5S_t H5_ATTR_UNUSED *space) static herr_t H5S_none_serialize(const H5S_t *space, uint8_t **p) { - uint8_t *pp = (*p); /* Local pointer for decoding */ - FUNC_ENTER_NOAPI_NOINIT_NOERR - /* Check args */ HDassert(space); - HDassert(p); - HDassert(pp); /* Store the preamble information */ - UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ - UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */ - UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */ - UINT32ENCODE(pp, (uint32_t)0); /* Store the additional information length */ - - /* Update encoding pointer */ - *p = pp; + UINT32ENCODE(*p, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ + UINT32ENCODE(*p, (uint32_t)1); /* Store the version number */ + UINT32ENCODE(*p, (uint32_t)0); /* Store the un-used padding */ + UINT32ENCODE(*p, (uint32_t)0); /* Store the additional information length */ FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_none_serialize() */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 0f85110..1a14254 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -826,32 +826,28 @@ H5S_point_serial_size (const H5S_t *space) static herr_t H5S_point_serialize (const H5S_t *space, uint8_t **p) { - H5S_pnt_node_t *curr; /* Point information nodes */ - uint8_t *pp = (*p); /* Local pointer for decoding */ - uint8_t *lenp; /* pointer to length location for later storage */ - uint32_t len=0; /* number of bytes used */ - unsigned u; /* local counting variable */ + H5S_pnt_node_t *curr; /* Point information nodes */ + uint8_t *lenp; /* pointer to length location for later storage */ + uint32_t len=0; /* number of bytes used */ + unsigned u; /* local counting variable */ FUNC_ENTER_NOAPI_NOINIT_NOERR - /* Check args */ HDassert(space); - HDassert(p); - HDassert(pp); /* Store the preamble information */ - UINT32ENCODE(pp, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ - UINT32ENCODE(pp, (uint32_t)1); /* Store the version number */ - UINT32ENCODE(pp, (uint32_t)0); /* Store the un-used padding */ - lenp = pp; /* Keep the pointer to the length location for later */ - pp += 4; /* Skip over space for length */ + UINT32ENCODE(*p, (uint32_t)H5S_GET_SELECT_TYPE(space)); /* Store the type of selection */ + UINT32ENCODE(*p, (uint32_t)1); /* Store the version number */ + UINT32ENCODE(*p, (uint32_t)0); /* Store the un-used padding */ + lenp=*p; /* keep the pointer to the length location for later */ + *p+=4; /* skip over space for length */ /* Encode number of dimensions */ - UINT32ENCODE(pp, (uint32_t)space->extent.rank); + UINT32ENCODE(*p, (uint32_t)space->extent.rank); len+=4; /* Encode number of elements */ - UINT32ENCODE(pp, (uint32_t)space->select.num_elem); + UINT32ENCODE(*p, (uint32_t)space->select.num_elem); len+=4; /* Encode each point in selection */ @@ -862,7 +858,7 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p) /* Encode each point */ for(u=0; u<space->extent.rank; u++) - UINT32ENCODE(pp, (uint32_t)curr->pnt[u]); + UINT32ENCODE(*p, (uint32_t)curr->pnt[u]); curr=curr->next; } /* end while */ @@ -870,9 +866,6 @@ H5S_point_serialize (const H5S_t *space, uint8_t **p) /* Encode length */ UINT32ENCODE(lenp, (uint32_t)len); /* Store the length of the extra information */ - /* Update encoding pointer */ - *p = pp; - FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_serialize() */ @@ -905,25 +898,24 @@ static herr_t H5S_point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ATTR_UNUSED flags, const uint8_t **p) { - H5S_seloper_t op = H5S_SELECT_SET; /* Selection operation */ - hsize_t *coord = NULL, *tcoord; /* Pointer to array of elements */ - const uint8_t *pp = (*p); /* Local pointer for decoding */ - size_t num_elem = 0; /* Number of elements in selection */ - unsigned rank; /* Rank of points */ + H5S_seloper_t op=H5S_SELECT_SET; /* Selection operation */ + unsigned rank; /* Rank of points */ + size_t num_elem=0; /* Number of elements in selection */ + hsize_t *coord=NULL, *tcoord; /* Pointer to array of elements */ unsigned i, j; /* local counting variables */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* return value */ FUNC_ENTER_NOAPI_NOINIT /* Check args */ HDassert(space); HDassert(p); - HDassert(pp); + HDassert(*p); /* Deserialize points to select */ /* (The header and rank have already beed decoded) */ rank = space->extent.rank; /* Retrieve rank from space */ - UINT32DECODE(pp, num_elem); /* decode the number of points */ + UINT32DECODE(*p, num_elem); /* decode the number of points */ /* Allocate space for the coordinates */ if(NULL == (coord = (hsize_t *)H5MM_malloc(num_elem * rank * sizeof(hsize_t)))) @@ -932,15 +924,12 @@ H5S_point_deserialize(H5S_t *space, uint32_t H5_ATTR_UNUSED version, uint8_t H5_ /* Retrieve the coordinates from the buffer */ for(tcoord = coord, i = 0; i < num_elem; i++) for(j = 0; j < (unsigned)rank; j++, tcoord++) - UINT32DECODE(pp, *tcoord); + UINT32DECODE(*p, *tcoord); /* Select points */ if(H5S_select_elements(space, op, num_elem, (const hsize_t *)coord) < 0) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTDELETE, FAIL, "can't change selection") - /* Update decoding pointer */ - *p = pp; - done: /* Free the coordinate array if necessary */ if(coord != NULL) |