summaryrefslogtreecommitdiffstats
path: root/src/H5FAcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/H5FAcache.c')
-rw-r--r--src/H5FAcache.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/H5FAcache.c b/src/H5FAcache.c
index 19fdb74..8f5e696 100644
--- a/src/H5FAcache.c
+++ b/src/H5FAcache.c
@@ -41,6 +41,7 @@
#include "H5Eprivate.h" /* Error handling */
#include "H5FApkg.h" /* Fixed Arrays */
#include "H5MFprivate.h" /* File memory management */
+#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vectors and arrays */
#include "H5WBprivate.h" /* Wrapped Buffers */
@@ -88,7 +89,7 @@ static herr_t H5FA__cache_dblock_serialize(const H5F_t *f, void *image, size_t l
void *thing);
static herr_t H5FA__cache_dblock_notify(H5AC_notify_action_t action, void *thing);
static herr_t H5FA__cache_dblock_free_icr(void *thing);
-static herr_t H5FA__cache_dblock_fsf_size(const void *thing, size_t *fsf_size);
+static herr_t H5FA__cache_dblock_fsf_size(const void *thing, hsize_t *fsf_size);
static herr_t H5FA__cache_dblk_page_get_initial_load_size(void *udata, size_t *image_len);
static htri_t H5FA__cache_dblk_page_verify_chksum(const void *image_ptr, size_t len, void *udata_ptr);
@@ -252,7 +253,7 @@ END_FUNC(STATIC) /* end H5FA__cache_hdr_verify_chksum() */
*/
BEGIN_FUNC(STATIC, ERR,
void *, NULL, NULL,
-H5FA__cache_hdr_deserialize(const void *_image, size_t len,
+H5FA__cache_hdr_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len,
void *_udata, hbool_t H5_ATTR_UNUSED *dirty))
/* Local variables */
@@ -409,14 +410,15 @@ H5FA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le
HDassert(hdr);
/* Magic number */
- HDmemcpy(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
*image++ = H5FA_HDR_VERSION;
/* Fixed array type */
- *image++ = hdr->cparam.cls->id;
+ HDassert(hdr->cparam.cls->id <= 255);
+ *image++ = (uint8_t)hdr->cparam.cls->id;
/* General array creation/configuration information */
*image++ = hdr->cparam.raw_elmt_size; /* Element size in file (in bytes) */
@@ -649,7 +651,7 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_verify_chksum() */
*/
BEGIN_FUNC(STATIC, ERR,
void *, NULL, NULL,
-H5FA__cache_dblock_deserialize(const void *_image, size_t len,
+H5FA__cache_dblock_deserialize(const void *_image, size_t H5_ATTR_NDEBUG_UNUSED len,
void *_udata, hbool_t H5_ATTR_UNUSED *dirty))
/* Local variables */
@@ -667,7 +669,7 @@ H5FA__cache_dblock_deserialize(const void *_image, size_t len,
if(NULL == (dblock = H5FA__dblock_alloc(udata->hdr)))
H5E_THROW(H5E_CANTALLOC, "memory allocation failed for fixed array data block")
- HDassert(((!dblock->npages) && (len == (size_t)H5FA_DBLOCK_SIZE(dblock)))
+ HDassert(((!dblock->npages) && (len == (size_t)H5FA_DBLOCK_SIZE(dblock)))
|| (len == (size_t)H5FA_DBLOCK_PREFIX_SIZE(dblock)));
/* Set the fixed array data block's information */
@@ -693,7 +695,7 @@ H5FA__cache_dblock_deserialize(const void *_image, size_t len,
/* Page initialization flags */
if(dblock->npages > 0) {
- HDmemcpy(dblock->dblk_page_init, image, dblock->dblk_page_init_size);
+ H5MM_memcpy(dblock->dblk_page_init, image, dblock->dblk_page_init_size);
image += dblock->dblk_page_init_size;
} /* end if */
@@ -797,14 +799,15 @@ H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
HDassert(dblock->hdr);
/* Magic number */
- HDmemcpy(image, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ H5MM_memcpy(image, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
image += H5_SIZEOF_MAGIC;
/* Version # */
*image++ = H5FA_DBLOCK_VERSION;
/* Fixed array type */
- *image++ = dblock->hdr->cparam.cls->id;
+ HDassert(dblock->hdr->cparam.cls->id <= 255);
+ *image++ = (uint8_t)dblock->hdr->cparam.cls->id;
/* Address of array header for array which owns this block */
H5F_addr_encode(f, &image, dblock->hdr->addr);
@@ -812,7 +815,7 @@ H5FA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED
/* Page init flags */
if(dblock->npages > 0) {
/* Store the 'page init' bitmasks */
- HDmemcpy(image, dblock->dblk_page_init, dblock->dblk_page_init_size);
+ H5MM_memcpy(image, dblock->dblk_page_init, dblock->dblk_page_init_size);
image += dblock->dblk_page_init_size;
} /* end if */
@@ -951,21 +954,21 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_free_icr() */
* to free when a dblock entry is destroyed with the free
* file space block set.
*
- * This function is needed when the data block is paged, as
+ * This function is needed when the data block is paged, as
* the datablock header and all its pages are allocted as a
- * single contiguous chunk of file space, and must be
+ * single contiguous chunk of file space, and must be
* deallocated the same way.
*
* The size of the chunk of memory in which the dblock
* header and all its pages is stored in the size field,
* so we simply pass that value back to the cache.
*
- * If the datablock is not paged, then the size field of
+ * If the datablock is not paged, then the size field of
* the cache_info contains the correct size. However this
* value will be the same as the size field, so we return
* the contents of the size field to the cache in this case
* as well.
- *
+ *
* Return: Non-negative on success/Negative on failure
*
* Programmer: John Mainzer
@@ -975,7 +978,7 @@ END_FUNC(STATIC) /* end H5FA__cache_dblock_free_icr() */
*/
BEGIN_FUNC(STATIC, NOERR,
herr_t, SUCCEED, -,
-H5FA__cache_dblock_fsf_size(const void *_thing, size_t *fsf_size))
+H5FA__cache_dblock_fsf_size(const void *_thing, hsize_t *fsf_size))
const H5FA_dblock_t *dblock = (const H5FA_dblock_t *)_thing; /* Pointer to the object */
@@ -1155,7 +1158,7 @@ H5FA__cache_dblk_page_image_len(const void *_thing, size_t *image_len))
HDassert(image_len);
/* Set the image length size */
- *image_len = dblk_page->size;
+ *image_len = dblk_page->size;
END_FUNC(STATIC) /* end H5FA__cache_dblk_page_image_len() */
@@ -1175,7 +1178,7 @@ END_FUNC(STATIC) /* end H5FA__cache_dblk_page_image_len() */
*/
BEGIN_FUNC(STATIC, ERR,
herr_t, SUCCEED, FAIL,
-H5FA__cache_dblk_page_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len,
+H5FA__cache_dblk_page_serialize(const H5F_t H5_ATTR_NDEBUG_UNUSED *f, void *_image, size_t H5_ATTR_UNUSED len,
void *_thing))
/* Local variables */