Skip to content

Commit 1b7e7fb

Browse files
committed
Updated buffer length after every call to H5C__reconstruct_cache_entry
1 parent 440fcab commit 1b7e7fb

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/H5Cimage.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ static void H5C__prep_for_file_close__compute_fd_heights_real(H5C_cache_entry_
130130
static herr_t H5C__prep_for_file_close__setup_image_entries_array(H5C_t *cache_ptr);
131131
static herr_t H5C__prep_for_file_close__scan_entries(const H5F_t *f, H5C_t *cache_ptr);
132132
static herr_t H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr);
133-
static H5C_cache_entry_t *H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, hsize_t buf_size,
133+
static H5C_cache_entry_t *H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, hsize_t *buf_size,
134134
const uint8_t **buf);
135135
static herr_t H5C__write_cache_image_superblock_msg(H5F_t *f, bool create);
136136
static herr_t H5C__read_cache_image(H5F_t *f, H5C_t *cache_ptr);
@@ -2408,7 +2408,7 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr)
24082408
/* Create the prefetched entry described by the ith
24092409
* entry in cache_ptr->image_entrise.
24102410
*/
2411-
if (NULL == (pf_entry_ptr = H5C__reconstruct_cache_entry(f, cache_ptr, image_len, &p)))
2411+
if (NULL == (pf_entry_ptr = H5C__reconstruct_cache_entry(f, cache_ptr, &image_len, &p)))
24122412
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "reconstruction of cache entry failed");
24132413

24142414
/* Note that we make no checks on available cache space before
@@ -2564,7 +2564,7 @@ H5C__reconstruct_cache_contents(H5F_t *f, H5C_t *cache_ptr)
25642564
*-------------------------------------------------------------------------
25652565
*/
25662566
static H5C_cache_entry_t *
2567-
H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, hsize_t buf_size, const uint8_t **buf)
2567+
H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, hsize_t *buf_size, const uint8_t **buf)
25682568
{
25692569
H5C_cache_entry_t *pf_entry_ptr = NULL; /* Reconstructed cache entry */
25702570
uint8_t flags = 0;
@@ -2577,7 +2577,7 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, hsize_t buf_size,
25772577
#endif
25782578
bool file_is_rw;
25792579
const uint8_t *p;
2580-
const uint8_t *p_end = *buf + buf_size - 1; /* Pointer to last valid byte in buffer */
2580+
const uint8_t *p_end = *buf + *buf_size - 1; /* Pointer to last valid byte in buffer */
25812581
H5C_cache_entry_t *ret_value = NULL; /* Return value */
25822582

25832583
FUNC_ENTER_PACKAGE
@@ -2746,7 +2746,8 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, hsize_t buf_size,
27462746
/* Sanity checks */
27472747
assert(pf_entry_ptr->size > 0 && pf_entry_ptr->size < H5C_MAX_ENTRY_SIZE);
27482748

2749-
/* Update buffer pointer */
2749+
/* Update buffer pointer and buffer len */
2750+
*buf_size = *buf_size - (p - *buf);
27502751
*buf = p;
27512752

27522753
ret_value = pf_entry_ptr;

0 commit comments

Comments
 (0)