summaryrefslogtreecommitdiffstats
path: root/src/H5Oidxinfo.c
diff options
context:
space:
mode:
authorJerome Soumagne <jsoumagne@hdfgroup.org>2014-08-04 22:45:43 (GMT)
committerJerome Soumagne <jsoumagne@hdfgroup.org>2016-11-29 23:42:28 (GMT)
commit7b7b55710b18d38508e62bda9d42f0f9fccf831a (patch)
tree1235922001bacfce88bce315721d258480dbd983 /src/H5Oidxinfo.c
parente7e422f3a8eb4de894189d79a032b663d83162b3 (diff)
downloadhdf5-7b7b55710b18d38508e62bda9d42f0f9fccf831a.zip
hdf5-7b7b55710b18d38508e62bda9d42f0f9fccf831a.tar.gz
hdf5-7b7b55710b18d38508e62bda9d42f0f9fccf831a.tar.bz2
Fix encoding / decoding of index metadata size
Diffstat (limited to 'src/H5Oidxinfo.c')
-rw-r--r--src/H5Oidxinfo.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/H5Oidxinfo.c b/src/H5Oidxinfo.c
index f550cd8..fce8406 100644
--- a/src/H5Oidxinfo.c
+++ b/src/H5Oidxinfo.c
@@ -99,8 +99,9 @@ H5O_idxinfo_decode(H5F_t UNUSED *f, hid_t UNUSED dxpl_id, H5O_t UNUSED *open_oh,
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
if (0 == (mesg->plugin_id = *p++))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADVALUE, NULL, "NULL plugin ID");
- if (0 == (mesg->metadata_size = (uint64_t) *p++))
+ if (0 == (mesg->metadata_size = *((const hsize_t *) p)))
HGOTO_ERROR(H5E_RESOURCE, H5E_BADVALUE, NULL, "NULL metadata size");
+ p += sizeof(hsize_t);
if (NULL == (mesg->metadata = H5MM_malloc(mesg->metadata_size)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
HDmemcpy(mesg->metadata, (const char *) p, mesg->metadata_size);
@@ -142,9 +143,9 @@ H5O_idxinfo_encode(H5F_t *f, hbool_t UNUSED disable_shared, uint8_t *p,
HDassert(mesg && mesg->s);
/* encode */
- *p++ = mesg->plugin_id;
- *p = mesg->metadata_size;
- p += sizeof(uint64_t);
+ *p++ = (uint8_t) mesg->plugin_id;
+ HDmemcpy(p, &mesg->metadata_size, sizeof(hsize_t));
+ p += sizeof(hsize_t);
HDmemcpy((char *) p, mesg->metadata, mesg->metadata_size);
FUNC_LEAVE_NOAPI(SUCCEED)