summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/H5Plapl.c50
-rw-r--r--test/gen_plist.c16
-rw-r--r--test/testfiles/plist_files/dxpl_bebin229 -> 229 bytes
-rw-r--r--test/testfiles/plist_files/dxpl_lebin229 -> 229 bytes
-rw-r--r--test/testfiles/plist_files/fapl_bebin1462 -> 1462 bytes
-rw-r--r--test/testfiles/plist_files/fapl_lebin1462 -> 1462 bytes
-rw-r--r--test/testfiles/plist_files/lapl_bebin1562 -> 1565 bytes
-rw-r--r--test/testfiles/plist_files/lapl_lebin1562 -> 1565 bytes
8 files changed, 41 insertions, 25 deletions
diff --git a/src/H5Plapl.c b/src/H5Plapl.c
index 87b96b6..e3b3c4f 100644
--- a/src/H5Plapl.c
+++ b/src/H5Plapl.c
@@ -237,7 +237,7 @@ H5P_lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size)
uint8_t **pp = (uint8_t **)_pp;
H5P_genplist_t *fapl_plist; /* Pointer to property list */
hbool_t non_default_fapl = FALSE; /* Whether the FAPL is non-default */
- size_t enc_size = 0; /* FAPL's encoded size */
+ size_t fapl_size = 0; /* FAPL's encoded size */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
@@ -257,13 +257,30 @@ H5P_lacc_elink_fapl_enc(const void *value, void **_pp, size_t *size)
/* Encode the property list, if non-default */
/* (if *pp == NULL, will only compute the size) */
if(non_default_fapl) {
- if(H5P__encode(fapl_plist, TRUE, *pp, &enc_size) < 0)
+ if(H5P__encode(fapl_plist, TRUE, NULL, &fapl_size) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode property list")
- if(*pp)
- *pp += enc_size;
+
+ if(*pp) {
+ uint64_t enc_value;
+ unsigned enc_size;
+
+ /* encode the length of the plist */
+ enc_value = (uint64_t)fapl_size;
+ enc_size = H5VM_limit_enc_size(enc_value);
+ HDassert(enc_size < 256);
+ *(*pp)++ = (uint8_t)enc_size;
+ UINT64ENCODE_VAR(*pp, enc_value, enc_size);
+
+ /* encode the plist */
+ if(H5P__encode(fapl_plist, TRUE, *pp, &fapl_size) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't encode property list")
+
+ *pp += fapl_size;
+ }
+ fapl_size += (1 + H5VM_limit_enc_size((uint64_t)fapl_size));
} /* end if */
- *size += (1 + enc_size); /* Non-default flag, plus encoded property list size */
+ *size += (1 + fapl_size); /* Non-default flag, plus encoded property list size */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -304,22 +321,21 @@ H5P_lacc_elink_fapl_dec(const void **_pp, void *_value)
non_default_fapl = (hbool_t)*(*pp)++;
if(non_default_fapl) {
- H5P_genplist_t *fapl_plist; /* Pointer to property list */
- size_t enc_size = 0; /* Encoded size of property list */
+ size_t fapl_size = 0; /* Encoded size of property list */
+ unsigned enc_size;
+ uint64_t enc_value;
+
+ /* Decode the plist length */
+ enc_size = *(*pp)++;
+ HDassert(enc_size < 256);
+ UINT64DECODE_VAR(*pp, enc_value, enc_size);
+ fapl_size = (size_t)enc_value;
/* Decode the property list */
if((*elink_fapl = H5P__decode(*pp)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTDECODE, FAIL, "can't decode property")
- /* Get the property list object */
- if(NULL == (fapl_plist = (H5P_genplist_t *)H5P_object_verify(*elink_fapl, H5P_FILE_ACCESS)))
- HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get property list")
-
- /* Compute the encoded size of the property list */
- if(H5P__encode(fapl_plist, TRUE, NULL, &enc_size) < 0)
- HGOTO_ERROR(H5E_PLIST, H5E_CANTENCODE, FAIL, "can't compute encoded property list size")
-
- *pp += enc_size;
+ *pp += fapl_size;
} /* end if */
else
*elink_fapl = H5P_DEFAULT;
@@ -578,7 +594,7 @@ H5P_lacc_elink_pref_dec(const void **_pp, void *_value)
/* Decode the value */
UINT64DECODE_VAR(*pp, enc_value, enc_size);
- len = enc_value;
+ len = (size_t)enc_value;
if(0 != len) {
/* Make a copy of the user's prefix string */
diff --git a/test/gen_plist.c b/test/gen_plist.c
index e77af73..cd3748b 100644
--- a/test/gen_plist.c
+++ b/test/gen_plist.c
@@ -63,26 +63,26 @@ main(void)
1 /*TRUE*/,
0 /*FALSE*/,
( 2 * 2048 * 1024),
- 0.3f,
+ 0.3,
(64 * 1024 * 1024),
(4 * 1024 * 1024),
60000,
H5C_incr__threshold,
- 0.8f,
- 3.0f,
+ 0.8,
+ 3.0,
1 /*TRUE*/,
(8 * 1024 * 1024),
H5C_flash_incr__add_space,
- 2.0f,
- 0.25f,
+ 2.0,
+ 0.25,
H5C_decr__age_out_with_threshold,
- 0.997f,
- 0.8f,
+ 0.997,
+ 0.8,
1 /*TRUE*/,
(3 * 1024 * 1024),
3,
0 /*FALSE*/,
- 0.2f,
+ 0.2,
(256 * 2048),
H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY};
diff --git a/test/testfiles/plist_files/dxpl_be b/test/testfiles/plist_files/dxpl_be
index 5ff2ea0..b5194c8 100644
--- a/test/testfiles/plist_files/dxpl_be
+++ b/test/testfiles/plist_files/dxpl_be
Binary files differ
diff --git a/test/testfiles/plist_files/dxpl_le b/test/testfiles/plist_files/dxpl_le
index 5ff2ea0..b5194c8 100644
--- a/test/testfiles/plist_files/dxpl_le
+++ b/test/testfiles/plist_files/dxpl_le
Binary files differ
diff --git a/test/testfiles/plist_files/fapl_be b/test/testfiles/plist_files/fapl_be
index 0b050d0..65e2070 100644
--- a/test/testfiles/plist_files/fapl_be
+++ b/test/testfiles/plist_files/fapl_be
Binary files differ
diff --git a/test/testfiles/plist_files/fapl_le b/test/testfiles/plist_files/fapl_le
index 0b050d0..65e2070 100644
--- a/test/testfiles/plist_files/fapl_le
+++ b/test/testfiles/plist_files/fapl_le
Binary files differ
diff --git a/test/testfiles/plist_files/lapl_be b/test/testfiles/plist_files/lapl_be
index e58bfb4..385cfc5 100644
--- a/test/testfiles/plist_files/lapl_be
+++ b/test/testfiles/plist_files/lapl_be
Binary files differ
diff --git a/test/testfiles/plist_files/lapl_le b/test/testfiles/plist_files/lapl_le
index e58bfb4..385cfc5 100644
--- a/test/testfiles/plist_files/lapl_le
+++ b/test/testfiles/plist_files/lapl_le
Binary files differ