From c30cf6d59664f63573b31efa4e73b41de168e381 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 15 May 2020 08:49:17 -0700 Subject: Moved H5MM_memcpy and H5MM_xfree_const from develop --- src/H5Abtree2.c | 8 +++--- src/H5Aint.c | 20 +++++++------- src/H5B.c | 52 +++++++++++++++++------------------ src/H5B2.c | 8 +++--- src/H5B2cache.c | 6 ++-- src/H5B2int.c | 74 ++++++++++++++++++++++++------------------------- src/H5B2leaf.c | 14 +++++----- src/H5Bcache.c | 2 +- src/H5C.c | 14 +++++----- src/H5CX.c | 4 +-- src/H5Cimage.c | 12 ++++---- src/H5Dbtree.c | 4 +-- src/H5Dbtree2.c | 2 +- src/H5Dchunk.c | 44 ++++++++++++++--------------- src/H5Dcompact.c | 14 +++++----- src/H5Dcontig.c | 22 +++++++-------- src/H5Dearray.c | 6 ++-- src/H5Defl.c | 2 +- src/H5Dfill.c | 6 ++-- src/H5Dint.c | 14 +++++----- src/H5Dmpio.c | 20 +++++++------- src/H5Dscatgath.c | 8 +++--- src/H5Dvirtual.c | 6 ++-- src/H5EA.c | 4 +-- src/H5EAcache.c | 12 ++++---- src/H5EAhdr.c | 2 +- src/H5EAstat.c | 2 +- src/H5Eint.c | 8 +++--- src/H5FA.c | 8 +++--- src/H5FAcache.c | 8 +++--- src/H5FAhdr.c | 2 +- src/H5FAstat.c | 2 +- src/H5FD.c | 25 ++++++++--------- src/H5FDcore.c | 6 ++-- src/H5FDdirect.c | 10 +++---- src/H5FDfamily.c | 2 +- src/H5FDlog.c | 2 +- src/H5FDmpio.c | 2 +- src/H5FL.c | 4 +-- src/H5FS.c | 2 +- src/H5FScache.c | 4 +-- src/H5Faccum.c | 20 +++++++------- src/H5Fint.c | 2 +- src/H5Fprivate.h | 4 +-- src/H5Fsuper.c | 2 +- src/H5Fsuper_cache.c | 4 +-- src/H5Gbtree2.c | 12 ++++---- src/H5Gcache.c | 2 +- src/H5Gent.c | 2 +- src/H5Gname.c | 2 +- src/H5Gnode.c | 4 +-- src/H5Gtraverse.c | 4 +-- src/H5HF.c | 4 +-- src/H5HFcache.c | 20 +++++++------- src/H5HFhdr.c | 2 +- src/H5HFhuge.c | 4 +-- src/H5HFman.c | 2 +- src/H5HFsection.c | 8 +++--- src/H5HFtest.c | 2 +- src/H5HFtiny.c | 2 +- src/H5HG.c | 6 ++-- src/H5HGcache.c | 4 +-- src/H5HL.c | 2 +- src/H5HLcache.c | 10 +++---- src/H5L.c | 4 +-- src/H5Lexternal.c | 2 +- src/H5MM.c | 78 ++++++++++++++++++++++++++++++++++++++++++++++------ src/H5MMprivate.h | 2 ++ src/H5Oalloc.c | 10 +++---- src/H5Oattr.c | 8 +++--- src/H5Oattribute.c | 2 +- src/H5Ocache.c | 6 ++-- src/H5Ocopy.c | 4 +-- src/H5Odrvinfo.c | 10 +++---- src/H5Odtype.c | 8 +++--- src/H5Oefl.c | 4 +-- src/H5Ofill.c | 16 +++++------ src/H5Oint.c | 6 ++-- src/H5Olayout.c | 12 ++++---- src/H5Olink.c | 14 +++++----- src/H5Opline.c | 4 +-- src/H5Oshared.c | 4 +-- src/H5PB.c | 20 +++++++------- src/H5Pdapl.c | 4 +-- src/H5Pdcpl.c | 26 +++++++++--------- src/H5Pdxpl.c | 2 +- src/H5Pfapl.c | 20 +++++++------- src/H5Pint.c | 34 +++++++++++------------ src/H5Plapl.c | 2 +- src/H5Pocpl.c | 2 +- src/H5Pocpypl.c | 2 +- src/H5S.c | 2 +- src/H5SL.c | 4 +-- src/H5SM.c | 4 +-- src/H5SMbtree2.c | 2 +- src/H5SMcache.c | 4 +-- src/H5SMmessage.c | 4 +-- src/H5Shyper.c | 20 +++++++------- src/H5Spoint.c | 18 ++++++------ src/H5Sselect.c | 16 +++++------ src/H5T.c | 4 +-- src/H5Tconv.c | 22 +++++++-------- src/H5Tenum.c | 6 ++-- src/H5Tfields.c | 12 ++++---- src/H5Tnative.c | 2 +- src/H5Tvlen.c | 34 +++++++++++------------ src/H5VM.c | 22 +++++++-------- src/H5VMprivate.h | 3 +- src/H5Z.c | 4 +-- src/H5Zfletcher32.c | 6 ++-- src/H5Zscaleoffset.c | 24 ++++++++-------- src/H5Zshuffle.c | 4 +-- src/H5Ztrans.c | 4 +-- 113 files changed, 591 insertions(+), 527 deletions(-) diff --git a/src/H5Abtree2.c b/src/H5Abtree2.c index 07da8e2..825043b 100644 --- a/src/H5Abtree2.c +++ b/src/H5Abtree2.c @@ -318,7 +318,7 @@ H5A__dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_U FUNC_ENTER_STATIC_NOERR /* Encode the record's fields */ - HDmemcpy(raw, nrecord->id.id, (size_t)H5O_FHEAP_ID_LEN); + H5MM_memcpy(raw, nrecord->id.id, (size_t)H5O_FHEAP_ID_LEN); raw += H5O_FHEAP_ID_LEN; *raw++ = nrecord->flags; UINT32ENCODE(raw, nrecord->corder) @@ -349,7 +349,7 @@ H5A__dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_U FUNC_ENTER_STATIC_NOERR /* Decode the record's fields */ - HDmemcpy(nrecord->id.id, raw, (size_t)H5O_FHEAP_ID_LEN); + H5MM_memcpy(nrecord->id.id, raw, (size_t)H5O_FHEAP_ID_LEN); raw += H5O_FHEAP_ID_LEN; nrecord->flags = *raw++; UINT32DECODE(raw, nrecord->corder) @@ -477,7 +477,7 @@ H5A__dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR FUNC_ENTER_STATIC_NOERR /* Encode the record's fields */ - HDmemcpy(raw, nrecord->id.id, (size_t)H5O_FHEAP_ID_LEN); + H5MM_memcpy(raw, nrecord->id.id, (size_t)H5O_FHEAP_ID_LEN); raw += H5O_FHEAP_ID_LEN; *raw++ = nrecord->flags; UINT32ENCODE(raw, nrecord->corder) @@ -507,7 +507,7 @@ H5A__dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR FUNC_ENTER_STATIC_NOERR /* Decode the record's fields */ - HDmemcpy(nrecord->id.id, raw, (size_t)H5O_FHEAP_ID_LEN); + H5MM_memcpy(nrecord->id.id, raw, (size_t)H5O_FHEAP_ID_LEN); raw += H5O_FHEAP_ID_LEN; nrecord->flags = *raw++; UINT32DECODE(raw, nrecord->corder) diff --git a/src/H5Aint.c b/src/H5Aint.c index dde60fa..f923e24 100644 --- a/src/H5Aint.c +++ b/src/H5Aint.c @@ -646,21 +646,21 @@ H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf) HGOTO_ERROR(H5E_ATTR, H5E_NOSPACE, FAIL, "memory allocation failed") /* Copy the attribute data into the buffer for conversion */ - HDmemcpy(tconv_buf, attr->shared->data, (src_type_size * nelmts)); + H5MM_memcpy(tconv_buf, attr->shared->data, (src_type_size * nelmts)); /* Perform datatype conversion. */ if(H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf) < 0) HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "datatype conversion failed") /* Copy the converted data into the user's buffer */ - HDmemcpy(buf, tconv_buf, (dst_type_size * nelmts)); + H5MM_memcpy(buf, tconv_buf, (dst_type_size * nelmts)); } /* end if */ /* No type conversion necessary */ else { HDassert(dst_type_size == src_type_size); /* Copy the attribute data into the user's buffer */ - HDmemcpy(buf, attr->shared->data, (dst_type_size * nelmts)); + H5MM_memcpy(buf, attr->shared->data, (dst_type_size * nelmts)); } /* end else */ } /* end else */ } /* end if */ @@ -747,7 +747,7 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf) HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed") /* Copy the user's data into the buffer for conversion */ - HDmemcpy(tconv_buf, buf, (src_type_size * nelmts)); + H5MM_memcpy(tconv_buf, buf, (src_type_size * nelmts)); /* Perform datatype conversion */ if(H5T_convert(tpath, src_id, dst_id, nelmts, (size_t)0, (size_t)0, tconv_buf, bkg_buf) < 0) @@ -771,7 +771,7 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Copy the attribute data into the user's buffer */ - HDmemcpy(attr->shared->data, buf, (dst_type_size * nelmts)); + H5MM_memcpy(attr->shared->data, buf, (dst_type_size * nelmts)); } /* end else */ /* Modify the attribute in the object header */ @@ -827,7 +827,7 @@ H5A__get_name(H5A_t *attr, size_t buf_size, char *buf) /* Copy all/some of the name */ if(buf && copy_len > 0) { - HDmemcpy(buf, attr->shared->name, copy_len); + H5MM_memcpy(buf, attr->shared->name, copy_len); /* Terminate the string */ buf[copy_len]='\0'; @@ -2241,7 +2241,7 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s if(NULL == (buf = H5FL_BLK_MALLOC(attr_buf, buf_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation NULLed for raw data chunk") - HDmemcpy(buf, attr_src->shared->data, attr_src->shared->data_size); + H5MM_memcpy(buf, attr_src->shared->data, attr_src->shared->data_size); /* Allocate background memory */ if(H5T_path_bkg(tpath_src_mem) || H5T_path_bkg(tpath_mem_dst)) @@ -2252,7 +2252,7 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s if(H5T_convert(tpath_src_mem, tid_src, tid_mem, nelmts, (size_t)0, (size_t)0, buf, bkg_buf) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "datatype conversion NULLed") - HDmemcpy(reclaim_buf, buf, buf_size); + H5MM_memcpy(reclaim_buf, buf, buf_size); /* Set background buffer to all zeros */ if(bkg_buf) @@ -2262,14 +2262,14 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg_buf) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "datatype conversion NULLed") - HDmemcpy(attr_dst->shared->data, buf, attr_dst->shared->data_size); + H5MM_memcpy(attr_dst->shared->data, buf, attr_dst->shared->data_size); if(H5D_vlen_reclaim(tid_mem, buf_space, reclaim_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_BADITER, NULL, "unable to reclaim variable-length data") } /* end if */ else { HDassert(attr_dst->shared->data_size == attr_src->shared->data_size); - HDmemcpy(attr_dst->shared->data, attr_src->shared->data, attr_src->shared->data_size); + H5MM_memcpy(attr_dst->shared->data, attr_src->shared->data, attr_src->shared->data_size); } /* end else */ } /* end if(attr_src->shared->data) */ diff --git a/src/H5B.c b/src/H5B.c index 301510a..fc11cc8 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -484,10 +484,10 @@ H5B__split(H5F_t *f, H5B_ins_ud_t *bt_ud, unsigned idx, */ split_bt_ud->cache_flags = H5AC__DIRTIED_FLAG; - HDmemcpy(split_bt_ud->bt->native, + H5MM_memcpy(split_bt_ud->bt->native, bt_ud->bt->native + nleft * shared->type->sizeof_nkey, (nright + 1) * shared->type->sizeof_nkey); - HDmemcpy(split_bt_ud->bt->child, + H5MM_memcpy(split_bt_ud->bt->child, &bt_ud->bt->child[nleft], nright * sizeof(haddr_t)); @@ -612,9 +612,9 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) /* update left and right keys */ if(!lt_key_changed) - HDmemcpy(lt_key, H5B_NKEY(bt_ud.bt,shared,0), type->sizeof_nkey); + H5MM_memcpy(lt_key, H5B_NKEY(bt_ud.bt,shared,0), type->sizeof_nkey); if(!rt_key_changed) - HDmemcpy(rt_key, H5B_NKEY(split_bt_ud.bt,shared,split_bt_ud.bt->nchildren), type->sizeof_nkey); + H5MM_memcpy(rt_key, H5B_NKEY(split_bt_ud.bt,shared,split_bt_ud.bt->nchildren), type->sizeof_nkey); /* * Copy the old root node to some other file location and make the new root @@ -657,11 +657,11 @@ H5B_insert(H5F_t *f, const H5B_class_t *type, haddr_t addr, void *udata) new_root_bt->nchildren = 2; new_root_bt->child[0] = bt_ud.addr; - HDmemcpy(H5B_NKEY(new_root_bt, shared, 0), lt_key, shared->type->sizeof_nkey); + H5MM_memcpy(H5B_NKEY(new_root_bt, shared, 0), lt_key, shared->type->sizeof_nkey); new_root_bt->child[1] = split_bt_ud.addr; - HDmemcpy(H5B_NKEY(new_root_bt, shared, 1), md_key, shared->type->sizeof_nkey); - HDmemcpy(H5B_NKEY(new_root_bt, shared, 2), rt_key, shared->type->sizeof_nkey); + H5MM_memcpy(H5B_NKEY(new_root_bt, shared, 1), md_key, shared->type->sizeof_nkey); + H5MM_memcpy(H5B_NKEY(new_root_bt, shared, 2), rt_key, shared->type->sizeof_nkey); /* Insert the modified copy of the old root into the file again */ if(H5AC_insert_entry(f, H5AC_BT, addr, new_root_bt, H5AC__NO_FLAGS_SET) < 0) @@ -726,9 +726,9 @@ H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, base = H5B_NKEY(bt, shared, (idx + 1)); if((idx + 1) == bt->nchildren) { /* Make room for the new key */ - HDmemcpy(base + shared->type->sizeof_nkey, base, + H5MM_memcpy(base + shared->type->sizeof_nkey, base, shared->type->sizeof_nkey); /* No overlap possible - memcpy() OK */ - HDmemcpy(base, md_key, shared->type->sizeof_nkey); + H5MM_memcpy(base, md_key, shared->type->sizeof_nkey); /* The MD_KEY is the left key of the new node */ if(H5B_INS_RIGHT == anchor) @@ -741,7 +741,7 @@ H5B__insert_child(H5B_t *bt, unsigned *bt_flags, unsigned idx, /* Make room for the new key */ HDmemmove(base + shared->type->sizeof_nkey, base, (bt->nchildren - idx) * shared->type->sizeof_nkey); - HDmemcpy(base, md_key, shared->type->sizeof_nkey); + H5MM_memcpy(base, md_key, shared->type->sizeof_nkey); /* The MD_KEY is the left key of the new node */ if(H5B_INS_RIGHT == anchor) @@ -915,7 +915,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, * node. This node is not empty (handled above). */ my_ins = H5B_INS_LEFT; - HDmemcpy(md_key, H5B_NKEY(bt,shared,idx), type->sizeof_nkey); + H5MM_memcpy(md_key, H5B_NKEY(bt,shared,idx), type->sizeof_nkey); if((type->new_node)(f, H5B_INS_LEFT, H5B_NKEY(bt, shared, idx), udata, md_key, &new_child_bt_ud.addr/*out*/) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert minimum leaf node") @@ -963,7 +963,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, */ idx = bt->nchildren - 1; my_ins = H5B_INS_RIGHT; - HDmemcpy(md_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey); + H5MM_memcpy(md_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey); if((type->new_node)(f, H5B_INS_RIGHT, md_key, udata, H5B_NKEY(bt, shared, idx + 1), &new_child_bt_ud.addr/*out*/) < 0) HGOTO_ERROR(H5E_BTREE, H5E_CANTINSERT, H5B_INS_ERROR, "can't insert maximum leaf node") @@ -1021,7 +1021,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, *lt_key_changed = FALSE; } /* end if */ else - HDmemcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey); + H5MM_memcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey); } /* end if */ if(*rt_key_changed) { bt_ud->cache_flags |= H5AC__DIRTIED_FLAG; @@ -1031,7 +1031,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, *rt_key_changed = FALSE; } /* end if */ else - HDmemcpy(rt_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey); + H5MM_memcpy(rt_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey); } /* end if */ /* @@ -1080,7 +1080,7 @@ H5B__insert_helper(H5F_t *f, H5B_ins_ud_t *bt_ud, const H5B_class_t *type, * by the left and right node). */ if(split_bt_ud->bt) { - HDmemcpy(md_key, H5B_NKEY(split_bt_ud->bt, shared, 0), type->sizeof_nkey); + H5MM_memcpy(md_key, H5B_NKEY(split_bt_ud->bt, shared, 0), type->sizeof_nkey); ret_value = H5B_INS_RIGHT; #ifdef H5B_DEBUG /* @@ -1339,7 +1339,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, /* Don't propagate change out of this B-tree node */ *lt_key_changed = FALSE; else - HDmemcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey); + H5MM_memcpy(lt_key, H5B_NKEY(bt, shared, idx), type->sizeof_nkey); } /* end if */ if(*rt_key_changed) { HDassert(type->critical_key == H5B_RIGHT); @@ -1348,7 +1348,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, /* Don't propagate change out of this B-tree node */ *rt_key_changed = FALSE; else - HDmemcpy(rt_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey); + H5MM_memcpy(rt_key, H5B_NKEY(bt, shared, idx + 1), type->sizeof_nkey); } /* end if */ /* @@ -1383,7 +1383,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, * in its left neighbor, but only if it is not the critical * key for the right-most child of the left neighbor */ if(type->critical_key == H5B_LEFT) - HDmemcpy(H5B_NKEY(sibling, shared, sibling->nchildren), + H5MM_memcpy(H5B_NKEY(sibling, shared, sibling->nchildren), H5B_NKEY(bt, shared, 1), type->sizeof_nkey); sibling->right = bt->right; @@ -1400,7 +1400,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, * its right neighbor, but only if it is not the critical * key for the left-most child of the right neighbor */ if(type->critical_key == H5B_RIGHT) - HDmemcpy(H5B_NKEY(sibling, shared, 0), + H5MM_memcpy(H5B_NKEY(sibling, shared, 0), H5B_NKEY(bt, shared, 0), type->sizeof_nkey); sibling->left = bt->left; @@ -1442,7 +1442,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, /* Slide all keys down 1, update lt_key */ HDmemmove(H5B_NKEY(bt, shared, 0), H5B_NKEY(bt, shared, 1), bt->nchildren * type->sizeof_nkey); - HDmemcpy(lt_key, H5B_NKEY(bt, shared, 0), type->sizeof_nkey); + H5MM_memcpy(lt_key, H5B_NKEY(bt, shared, 0), type->sizeof_nkey); *lt_key_changed = TRUE; } else /* Slide all but the leftmost 2 keys down, leaving the leftmost @@ -1471,7 +1471,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, H5B_NKEY(bt, shared, bt->nchildren), type->sizeof_nkey); else { /* Just update rt_key */ - HDmemcpy(rt_key, H5B_NKEY(bt, shared, bt->nchildren - 1), + H5MM_memcpy(rt_key, H5B_NKEY(bt, shared, bt->nchildren - 1), type->sizeof_nkey); *rt_key_changed = TRUE; } /* end else */ @@ -1516,7 +1516,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, if(NULL == (sibling = (H5B_t *)H5AC_protect(f, H5AC_BT, bt->left, &cache_udata, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to protect node") - HDmemcpy(H5B_NKEY(sibling, shared, sibling->nchildren), + H5MM_memcpy(H5B_NKEY(sibling, shared, sibling->nchildren), H5B_NKEY(bt, shared, 0), type->sizeof_nkey); if(H5AC_unprotect(f, H5AC_BT, bt->left, sibling, H5AC__DIRTIED_FLAG) < 0) @@ -1531,7 +1531,7 @@ H5B__remove_helper(H5F_t *f, haddr_t addr, const H5B_class_t *type, int level, if(NULL == (sibling = (H5B_t *)H5AC_protect(f, H5AC_BT, bt->right, &cache_udata, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, H5B_INS_ERROR, "unable to protect node") - HDmemcpy(H5B_NKEY(sibling, shared, 0), + H5MM_memcpy(H5B_NKEY(sibling, shared, 0), H5B_NKEY(bt, shared, bt->nchildren), type->sizeof_nkey); if(H5AC_unprotect(f, H5AC_BT, bt->right, sibling, H5AC__DIRTIED_FLAG) < 0) @@ -1811,7 +1811,7 @@ H5B__copy(const H5B_t *old_bt) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree root node") /* Copy the main structure */ - HDmemcpy(new_node, old_bt, sizeof(H5B_t)); + H5MM_memcpy(new_node, old_bt, sizeof(H5B_t)); /* Reset cache info */ HDmemset(&new_node->cache_info, 0, sizeof(H5AC_info_t)); @@ -1821,8 +1821,8 @@ H5B__copy(const H5B_t *old_bt) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree root node") /* Copy the other structures */ - HDmemcpy(new_node->native, old_bt->native, shared->sizeof_keys); - HDmemcpy(new_node->child, old_bt->child, (sizeof(haddr_t) * shared->two_k)); + H5MM_memcpy(new_node->native, old_bt->native, shared->sizeof_keys); + H5MM_memcpy(new_node->child, old_bt->child, (sizeof(haddr_t) * shared->two_k)); /* Increment the ref-count on the raw page */ H5UC_INC(new_node->rc_shared); diff --git a/src/H5B2.c b/src/H5B2.c index 1f964b8..5355dd4 100644 --- a/src/H5B2.c +++ b/src/H5B2.c @@ -662,7 +662,7 @@ H5B2_find(H5B2_t *bt2, void *udata, H5B2_found_t op, void *op_data) if(hdr->min_native_rec == NULL) if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") - HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); + H5MM_memcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ } /* end if */ if(idx == (unsigned)(leaf->nrec - 1)) { @@ -670,7 +670,7 @@ H5B2_find(H5B2_t *bt2, void *udata, H5B2_found_t op, void *op_data) if(hdr->max_native_rec == NULL) if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") - HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); + H5MM_memcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ } /* end if */ } /* end if */ @@ -1343,7 +1343,7 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data) if(hdr->min_native_rec == NULL) if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") - HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); + H5MM_memcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ } /* end if */ if(idx == (unsigned)(leaf->nrec - 1)) { @@ -1351,7 +1351,7 @@ H5B2_modify(H5B2_t *bt2, void *udata, H5B2_modify_t op, void *op_data) if(hdr->max_native_rec == NULL) if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") - HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); + H5MM_memcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ } /* end if */ } /* end if */ diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 9a13a78..65286e6 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -391,7 +391,7 @@ H5B2__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le HDassert(hdr); /* Magic number */ - HDmemcpy(image, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); + H5MM_memcpy(image, H5B2_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); image += H5_SIZEOF_MAGIC; /* Version # */ @@ -812,7 +812,7 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le HDassert(internal->hdr); /* Magic number */ - HDmemcpy(image, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC); + H5MM_memcpy(image, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC); image += H5_SIZEOF_MAGIC; /* Version # */ @@ -1214,7 +1214,7 @@ H5B2__cache_leaf_serialize(const H5F_t H5_ATTR_UNUSED *f, void *_image, size_t H HDassert(leaf->hdr); /* magic number */ - HDmemcpy(image, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC); + H5MM_memcpy(image, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC); image += H5_SIZEOF_MAGIC; /* version # */ diff --git a/src/H5B2int.c b/src/H5B2int.c index 9a53176..a6faab8 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -241,17 +241,17 @@ H5B2__split1(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, mid_record = (uint16_t)(old_node_nrec / 2); /* Copy "upper half" of records to new child */ - HDmemcpy(H5B2_NAT_NREC(right_native, hdr, 0), + H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(left_native, hdr, mid_record + (unsigned)1), hdr->cls->nrec_size * (old_node_nrec - (mid_record + (unsigned)1))); /* Copy "upper half" of node pointers, if the node is an internal node */ if(depth > 1) - HDmemcpy(&(right_node_ptrs[0]), &(left_node_ptrs[mid_record + (unsigned)1]), + H5MM_memcpy(&(right_node_ptrs[0]), &(left_node_ptrs[mid_record + (unsigned)1]), sizeof(H5B2_node_ptr_t) * (size_t)(old_node_nrec - mid_record)); /* Copy "middle" record to internal node */ - HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(left_native, hdr, mid_record), hdr->cls->nrec_size); + H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(left_native, hdr, mid_record), hdr->cls->nrec_size); /* Mark nodes as dirty */ left_child_flags |= H5AC__DIRTIED_FLAG; @@ -510,14 +510,14 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, uint16_t move_nrec = (uint16_t)(*right_nrec - new_right_nrec); /* Number of records to move from right node to left */ /* Copy record from parent node down into left child */ - HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); + H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); /* See if we need to move records from right node */ if(move_nrec > 1) - HDmemcpy(H5B2_NAT_NREC(left_native, hdr, (*left_nrec + 1)), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (size_t)(move_nrec - 1)); + H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, (*left_nrec + 1)), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (size_t)(move_nrec - 1)); /* Move record from right node into parent node */ - HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), hdr->cls->nrec_size); + H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), hdr->cls->nrec_size); /* Slide records in right node down */ HDmemmove(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(right_native, hdr, move_nrec), hdr->cls->nrec_size * new_right_nrec); @@ -534,7 +534,7 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, right_moved_nrec -= (hssize_t)moved_nrec; /* Copy node pointers from right node to left */ - HDmemcpy(&(left_node_ptrs[*left_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * move_nrec); + H5MM_memcpy(&(left_node_ptrs[*left_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * move_nrec); /* Slide node pointers in right node down */ HDmemmove(&(right_node_ptrs[0]), &(right_node_ptrs[move_nrec]), sizeof(H5B2_node_ptr_t) * (new_right_nrec + (unsigned)1)); @@ -569,14 +569,14 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, hdr->cls->nrec_size * (*right_nrec)); /* Copy record from parent node down into right child */ - HDmemcpy(H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); + H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, (move_nrec - 1)), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); /* See if we need to move records from left node */ if(move_nrec > 1) - HDmemcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(left_native, hdr, ((*left_nrec - move_nrec) + 1)), hdr->cls->nrec_size * (size_t)(move_nrec - 1)); + H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(left_native, hdr, ((*left_nrec - move_nrec) + 1)), hdr->cls->nrec_size * (size_t)(move_nrec - 1)); /* Move record from left node into parent node */ - HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(left_native, hdr, (*left_nrec - move_nrec)), hdr->cls->nrec_size); + H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(left_native, hdr, (*left_nrec - move_nrec)), hdr->cls->nrec_size); /* Handle node pointers, if we have an internal node */ if(depth > 1) { @@ -587,7 +587,7 @@ H5B2__redistribute2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, HDmemmove(&(right_node_ptrs[move_nrec]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1)); /* Copy node pointers from left node to right */ - HDmemcpy(&(right_node_ptrs[0]), &(left_node_ptrs[new_left_nrec + 1]), sizeof(H5B2_node_ptr_t) * move_nrec); + H5MM_memcpy(&(right_node_ptrs[0]), &(left_node_ptrs[new_left_nrec + 1]), sizeof(H5B2_node_ptr_t) * move_nrec); /* Count the number of records being moved */ for(u = 0; u < move_nrec; u++) @@ -775,16 +775,16 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, uint16_t moved_middle_nrec = 0; /* Number of records moved into left node */ /* Move left parent record down to left node */ - HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size); + H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size); /* Move records from middle node into left node */ if((new_left_nrec - 1) > *left_nrec) { moved_middle_nrec = (uint16_t)(new_left_nrec - (*left_nrec + 1)); - HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * moved_middle_nrec); + H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * moved_middle_nrec); } /* end if */ /* Move record from middle node up to parent node */ - HDmemcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(middle_native, hdr, moved_middle_nrec), hdr->cls->nrec_size); + H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(middle_native, hdr, moved_middle_nrec), hdr->cls->nrec_size); moved_middle_nrec++; /* Slide records in middle node down */ @@ -798,7 +798,7 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, /* Move middle node pointers into left node */ move_nptrs = (unsigned)(new_left_nrec - *left_nrec); - HDmemcpy(&(left_node_ptrs[*left_nrec + 1]), &(middle_node_ptrs[0]), sizeof(H5B2_node_ptr_t)*move_nptrs); + H5MM_memcpy(&(left_node_ptrs[*left_nrec + 1]), &(middle_node_ptrs[0]), sizeof(H5B2_node_ptr_t)*move_nptrs); /* Count the number of records being moved into the left node */ for(u = 0, moved_nrec = 0; u < move_nptrs; u++) @@ -832,14 +832,14 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, HDmemmove(H5B2_NAT_NREC(right_native, hdr, right_nrec_move), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec)); /* Move right parent record down to right node */ - HDmemcpy(H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); + H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); /* Move records from middle node into right node */ if(right_nrec_move > 1) - HDmemcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, ((curr_middle_nrec - right_nrec_move) + 1)), hdr->cls->nrec_size * (right_nrec_move - 1)); + H5MM_memcpy(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, ((curr_middle_nrec - right_nrec_move) + 1)), hdr->cls->nrec_size * (right_nrec_move - 1)); /* Move record from middle node up to parent node */ - HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(middle_native, hdr, (curr_middle_nrec - right_nrec_move)), hdr->cls->nrec_size); + H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(middle_native, hdr, (curr_middle_nrec - right_nrec_move)), hdr->cls->nrec_size); /* Move node pointers also if this is an internal node */ if(depth > 1) { @@ -850,7 +850,7 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, HDmemmove(&(right_node_ptrs[right_nrec_move]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1)); /* Move middle node pointers into right node */ - HDmemcpy(&(right_node_ptrs[0]), &(middle_node_ptrs[(curr_middle_nrec - right_nrec_move) + 1]), sizeof(H5B2_node_ptr_t) * right_nrec_move); + H5MM_memcpy(&(right_node_ptrs[0]), &(middle_node_ptrs[(curr_middle_nrec - right_nrec_move) + 1]), sizeof(H5B2_node_ptr_t) * right_nrec_move); /* Count the number of records being moved into the right node */ for(u = 0, moved_nrec = 0; u < right_nrec_move; u++) @@ -881,14 +881,14 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, HDmemmove(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * curr_middle_nrec); /* Move left parent record down to middle node */ - HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move - 1), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size); + H5MM_memcpy(H5B2_NAT_NREC(middle_native, hdr, left_nrec_move - 1), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size); /* Move left records to middle node */ if(left_nrec_move > 1) HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), H5B2_NAT_NREC(left_native, hdr, new_left_nrec + 1), hdr->cls->nrec_size * (left_nrec_move - 1)); /* Move left parent record up from left node */ - HDmemcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(left_native, hdr, new_left_nrec), hdr->cls->nrec_size); + H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(left_native, hdr, new_left_nrec), hdr->cls->nrec_size); /* Move node pointers also if this is an internal node */ if(depth > 1) { @@ -899,7 +899,7 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, HDmemmove(&(middle_node_ptrs[left_nrec_move]), &(middle_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(curr_middle_nrec + 1)); /* Move left node pointers into middle node */ - HDmemcpy(&(middle_node_ptrs[0]), &(left_node_ptrs[new_left_nrec + 1]), sizeof(H5B2_node_ptr_t) * left_nrec_move); + H5MM_memcpy(&(middle_node_ptrs[0]), &(left_node_ptrs[new_left_nrec + 1]), sizeof(H5B2_node_ptr_t) * left_nrec_move); /* Count the number of records being moved into the left node */ for(u = 0, moved_nrec = 0; u < left_nrec_move; u++) @@ -927,13 +927,13 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsigned right_nrec_move = (unsigned)(*right_nrec - new_right_nrec); /* Number of records to move out of right node */ /* Move right parent record down to middle node */ - HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, curr_middle_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); + H5MM_memcpy(H5B2_NAT_NREC(middle_native, hdr, curr_middle_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); /* Move right records to middle node */ HDmemmove(H5B2_NAT_NREC(middle_native, hdr, (curr_middle_nrec + 1)), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (right_nrec_move - 1)); /* Move right parent record up from right node */ - HDmemcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), hdr->cls->nrec_size); + H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx), H5B2_NAT_NREC(right_native, hdr, right_nrec_move - 1), hdr->cls->nrec_size); /* Slide right records down */ HDmemmove(H5B2_NAT_NREC(right_native, hdr, 0), H5B2_NAT_NREC(right_native, hdr, right_nrec_move), hdr->cls->nrec_size * new_right_nrec); @@ -944,7 +944,7 @@ H5B2__redistribute3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, unsigned u; /* Local index variable */ /* Move right node pointers into middle node */ - HDmemcpy(&(middle_node_ptrs[curr_middle_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * right_nrec_move); + H5MM_memcpy(&(middle_node_ptrs[curr_middle_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * right_nrec_move); /* Count the number of records being moved into the right node */ for(u = 0, moved_nrec = 0; u < right_nrec_move; u++) @@ -1113,14 +1113,14 @@ H5B2__merge2(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, /* Redistribute records into left node */ { /* Copy record from parent node to proper location */ - HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); + H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); /* Copy records from right node to left node */ - HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec)); + H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec)); /* Copy node pointers from right node into left node */ if(depth > 1) - HDmemcpy(&(left_node_ptrs[*left_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1)); + H5MM_memcpy(&(left_node_ptrs[*left_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1)); /* Update flush dependencies for grandchildren, if using SWMR */ if(hdr->swmr_write && depth > 1) @@ -1304,13 +1304,13 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, middle_moved_nrec = middle_nrec_move; /* Copy record from parent node to proper location in left node */ - HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size); + H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec), H5B2_INT_NREC(internal, hdr, idx - 1), hdr->cls->nrec_size); /* Copy records from middle node to left node */ - HDmemcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * (middle_nrec_move - 1)); + H5MM_memcpy(H5B2_NAT_NREC(left_native, hdr, *left_nrec + 1), H5B2_NAT_NREC(middle_native, hdr, 0), hdr->cls->nrec_size * (middle_nrec_move - 1)); /* Copy record from middle node to proper location in parent node */ - HDmemcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(middle_native, hdr, (middle_nrec_move - 1)), hdr->cls->nrec_size); + H5MM_memcpy(H5B2_INT_NREC(internal, hdr, idx - 1), H5B2_NAT_NREC(middle_native, hdr, (middle_nrec_move - 1)), hdr->cls->nrec_size); /* Slide records in middle node down */ HDmemmove(H5B2_NAT_NREC(middle_native, hdr, 0), H5B2_NAT_NREC(middle_native, hdr, middle_nrec_move), hdr->cls->nrec_size * (*middle_nrec - middle_nrec_move)); @@ -1320,7 +1320,7 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, unsigned u; /* Local index variable */ /* Copy node pointers from middle node into left node */ - HDmemcpy(&(left_node_ptrs[*left_nrec + 1]), &(middle_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * middle_nrec_move); + H5MM_memcpy(&(left_node_ptrs[*left_nrec + 1]), &(middle_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * middle_nrec_move); /* Count the number of records being moved into the left node */ for(u = 0; u < middle_nrec_move; u++) @@ -1348,15 +1348,15 @@ H5B2__merge3(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node_ptr, /* Redistribute records into middle node */ { /* Copy record from parent node to proper location in middle node */ - HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); + H5MM_memcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec), H5B2_INT_NREC(internal, hdr, idx), hdr->cls->nrec_size); /* Copy records from right node to middle node */ - HDmemcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec)); + H5MM_memcpy(H5B2_NAT_NREC(middle_native, hdr, *middle_nrec + 1), H5B2_NAT_NREC(right_native, hdr, 0), hdr->cls->nrec_size * (*right_nrec)); /* Move node pointers also if this is an internal node */ if(depth > 1) /* Copy node pointers from right node into middle node */ - HDmemcpy(&(middle_node_ptrs[*middle_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1)); + H5MM_memcpy(&(middle_node_ptrs[*middle_nrec + 1]), &(right_node_ptrs[0]), sizeof(H5B2_node_ptr_t) * (size_t)(*right_nrec + 1)); /* Update flush dependencies for grandchildren, if using SWMR */ if(hdr->swmr_write && depth > 1) @@ -1539,7 +1539,7 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal node pointers") /* Copy the node pointers */ - HDmemcpy(node_ptrs, internal->node_ptrs, (sizeof(H5B2_node_ptr_t) * (size_t)(curr_node->node_nrec + 1))); + H5MM_memcpy(node_ptrs, internal->node_ptrs, (sizeof(H5B2_node_ptr_t) * (size_t)(curr_node->node_nrec + 1))); } /* end if */ else { H5B2_leaf_t *leaf; /* Pointer to leaf node */ @@ -1559,7 +1559,7 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal native keys") /* Copy the native keys */ - HDmemcpy(native, node_native, (hdr->cls->nrec_size * curr_node->node_nrec)); + H5MM_memcpy(native, node_native, (hdr->cls->nrec_size * curr_node->node_nrec)); /* Unlock the node */ if(H5AC_unprotect(hdr->f, curr_node_class, curr_node->addr, node, (unsigned)(hdr->swmr_write ? H5AC__PIN_ENTRY_FLAG : H5AC__NO_FLAGS_SET)) < 0) diff --git a/src/H5B2leaf.c b/src/H5B2leaf.c index 54d40ea..beca40c 100644 --- a/src/H5B2leaf.c +++ b/src/H5B2leaf.c @@ -412,7 +412,7 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, if(hdr->min_native_rec == NULL) if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") - HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); + H5MM_memcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ } /* end if */ if(idx == (unsigned)(leaf->nrec - 1)) { @@ -420,7 +420,7 @@ H5B2__insert_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, if(hdr->max_native_rec == NULL) if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") - HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); + H5MM_memcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ } /* end if */ } /* end if */ @@ -561,7 +561,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, if(hdr->min_native_rec == NULL) if(NULL == (hdr->min_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree min record info") - HDmemcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); + H5MM_memcpy(hdr->min_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ } /* end if */ if(idx == (unsigned)(leaf->nrec - 1)) { @@ -569,7 +569,7 @@ H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr, if(hdr->max_native_rec == NULL) if(NULL == (hdr->max_native_rec = H5MM_malloc(hdr->cls->nrec_size))) HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, FAIL, "memory allocation failed for v2 B-tree max record info") - HDmemcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); + H5MM_memcpy(hdr->max_native_rec, H5B2_LEAF_NREC(leaf, hdr, idx), hdr->cls->nrec_size); } /* end if */ } /* end if */ } /* end if */ @@ -664,9 +664,9 @@ H5B2__swap_leaf(H5B2_hdr_t *hdr, uint16_t depth, H5B2_internal_t *internal, } /* end else */ /* Swap records (use disk page as temporary buffer) */ - HDmemcpy(hdr->page, H5B2_NAT_NREC(child_native, hdr, 0), hdr->cls->nrec_size); - HDmemcpy(H5B2_NAT_NREC(child_native, hdr, 0), swap_loc, hdr->cls->nrec_size); - HDmemcpy(swap_loc, hdr->page, hdr->cls->nrec_size); + H5MM_memcpy(hdr->page, H5B2_NAT_NREC(child_native, hdr, 0), hdr->cls->nrec_size); + H5MM_memcpy(H5B2_NAT_NREC(child_native, hdr, 0), swap_loc, hdr->cls->nrec_size); + H5MM_memcpy(swap_loc, hdr->page, hdr->cls->nrec_size); /* Mark parent as dirty */ *internal_flags_ptr |= H5AC__DIRTIED_FLAG; diff --git a/src/H5Bcache.c b/src/H5Bcache.c index a0a75c8..cce10c9 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -304,7 +304,7 @@ H5B__cache_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, HDassert(shared->type->encode); /* magic number */ - HDmemcpy(image, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC); + H5MM_memcpy(image, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC); image += 4; /* node type and level */ diff --git a/src/H5C.c b/src/H5C.c index 288f3db..c5bd220 100644 --- a/src/H5C.c +++ b/src/H5C.c @@ -2285,7 +2285,7 @@ H5C_protect(H5F_t * f, if(NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer") #if H5C_DO_MEMORY_SANITY_CHECKS - HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); + H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ if(0 == mpi_rank) if(H5C__generate_image(f, cache_ptr, entry_ptr) < 0) @@ -6045,7 +6045,7 @@ H5C__flush_single_entry(H5F_t *f, H5C_cache_entry_t *entry_ptr, unsigned flags) if(NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer") #if H5C_DO_MEMORY_SANITY_CHECKS - HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); + H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + entry_ptr->size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ } /* end if */ @@ -6545,7 +6545,7 @@ H5C_load_entry(H5F_t * f, if(NULL == (image = (uint8_t *)H5MM_malloc(len + H5C_IMAGE_EXTRA_SPACE))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer") #if H5C_DO_MEMORY_SANITY_CHECKS - HDmemcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); + H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ #ifdef H5_HAVE_PARALLEL @@ -6583,7 +6583,7 @@ H5C_load_entry(H5F_t * f, HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()") image = (uint8_t *)new_image; #if H5C_DO_MEMORY_SANITY_CHECKS - HDmemcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); + H5MM_memcpy(image + len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ } /* end if */ @@ -6627,7 +6627,7 @@ H5C_load_entry(H5F_t * f, HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "image null after H5MM_realloc()") image = (uint8_t *)new_image; #if H5C_DO_MEMORY_SANITY_CHECKS - HDmemcpy(image + actual_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); + H5MM_memcpy(image + actual_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ if(actual_len > len) { @@ -8459,7 +8459,7 @@ H5C__serialize_single_entry(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry if(NULL == (entry_ptr->image_ptr = H5MM_malloc(entry_ptr->size + H5C_IMAGE_EXTRA_SPACE)) ) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer") #if H5C_DO_MEMORY_SANITY_CHECKS - HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); + H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + image_size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ } /* end if */ @@ -8576,7 +8576,7 @@ H5C__generate_image(H5F_t *f, H5C_t *cache_ptr, H5C_cache_entry_t *entry_ptr) if(NULL == (entry_ptr->image_ptr = H5MM_realloc(entry_ptr->image_ptr, new_len + H5C_IMAGE_EXTRA_SPACE))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer") #if H5C_DO_MEMORY_SANITY_CHECKS - HDmemcpy(((uint8_t *)entry_ptr->image_ptr) + new_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); + H5MM_memcpy(((uint8_t *)entry_ptr->image_ptr) + new_len, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ /* Update statistics for resizing the entry */ diff --git a/src/H5CX.c b/src/H5CX.c index 3101e64..5ba9bd8 100644 --- a/src/H5CX.c +++ b/src/H5CX.c @@ -68,7 +68,7 @@ #define H5CX_RETRIEVE_PROP_COMMON(PL, DEF_PL, PROP_NAME, PROP_FIELD) \ /* Check for default property list */ \ if((*head)->ctx.H5_GLUE(PL,_id) == (DEF_PL)) \ - HDmemcpy(&(*head)->ctx.PROP_FIELD, &H5_GLUE3(H5CX_def_,PL,_cache).PROP_FIELD, sizeof(H5_GLUE3(H5CX_def_,PL,_cache).PROP_FIELD)); \ + H5MM_memcpy(&(*head)->ctx.PROP_FIELD, &H5_GLUE3(H5CX_def_,PL,_cache).PROP_FIELD, sizeof(H5_GLUE3(H5CX_def_,PL,_cache).PROP_FIELD)); \ else { \ /* Check if the property list is already available */ \ if(NULL == (*head)->ctx.PL) \ @@ -1429,7 +1429,7 @@ H5CX_get_btree_split_ratios(double split_ratio[3]) H5CX_RETRIEVE_PROP_VALID(dxpl, H5P_DATASET_XFER_DEFAULT, H5D_XFER_BTREE_SPLIT_RATIO_NAME, btree_split_ratio) /* Get the B-tree split ratio values */ - HDmemcpy(split_ratio, &(*head)->ctx.btree_split_ratio, sizeof((*head)->ctx.btree_split_ratio)); + H5MM_memcpy(split_ratio, &(*head)->ctx.btree_split_ratio, sizeof((*head)->ctx.btree_split_ratio)); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Cimage.c b/src/H5Cimage.c index 298a2dd..de6e660 100644 --- a/src/H5Cimage.c +++ b/src/H5Cimage.c @@ -2020,11 +2020,11 @@ H5C__decode_cache_image_entry(const H5F_t *f, const H5C_t *cache_ptr, HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed for on disk image buffer") #if H5C_DO_MEMORY_SANITY_CHECKS - HDmemcpy(((uint8_t *)image_ptr) + size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); + H5MM_memcpy(((uint8_t *)image_ptr) + size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ /* Copy the entry image from the cache image block */ - HDmemcpy(image_ptr, p, size); + H5MM_memcpy(image_ptr, p, size); p += size; /* Copy data into target */ @@ -2219,7 +2219,7 @@ H5C__encode_cache_image_header(const H5F_t *f, const H5C_t *cache_ptr, p = *buf; /* write signature */ - HDmemcpy(p, H5C__MDCI_BLOCK_SIGNATURE, (size_t)H5C__MDCI_BLOCK_SIGNATURE_LEN); + H5MM_memcpy(p, H5C__MDCI_BLOCK_SIGNATURE, (size_t)H5C__MDCI_BLOCK_SIGNATURE_LEN); p += H5C__MDCI_BLOCK_SIGNATURE_LEN; /* write version */ @@ -2355,7 +2355,7 @@ H5C__encode_cache_image_entry(H5F_t *f, H5C_t *cache_ptr, uint8_t **buf, H5F_addr_encode(f, &p, ie_ptr->fd_parent_addrs[u]); /* Copy entry image */ - HDmemcpy(p, ie_ptr->image_ptr, ie_ptr->size); + H5MM_memcpy(p, ie_ptr->image_ptr, ie_ptr->size); p += ie_ptr->size; /* Update buffer pointer */ @@ -3422,11 +3422,11 @@ H5C__reconstruct_cache_entry(const H5F_t *f, H5C_t *cache_ptr, if(NULL == (pf_entry_ptr->image_ptr = H5MM_malloc(pf_entry_ptr->size + H5C_IMAGE_EXTRA_SPACE))) HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, NULL, "memory allocation failed for on disk image buffer") #if H5C_DO_MEMORY_SANITY_CHECKS - HDmemcpy(((uint8_t *)pf_entry_ptr->image_ptr) + size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); + H5MM_memcpy(((uint8_t *)pf_entry_ptr->image_ptr) + size, H5C_IMAGE_SANITY_VALUE, H5C_IMAGE_EXTRA_SPACE); #endif /* H5C_DO_MEMORY_SANITY_CHECKS */ /* Copy the entry image from the cache image block */ - HDmemcpy(pf_entry_ptr->image_ptr, p, pf_entry_ptr->size); + H5MM_memcpy(pf_entry_ptr->image_ptr, p, pf_entry_ptr->size); p += pf_entry_ptr->size; /* Initialize the rest of the fields in the prefetched entry */ diff --git a/src/H5Dbtree.c b/src/H5Dbtree.c index 8abfe27..b3a9905 100644 --- a/src/H5Dbtree.c +++ b/src/H5Dbtree.c @@ -848,7 +848,7 @@ H5D__btree_shared_create(const H5F_t *f, H5O_storage_chunk_t *store, /* Set up the "local" information for this dataset's chunks */ if(NULL == (my_layout = H5FL_MALLOC(H5O_layout_chunk_t))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "can't allocate chunk layout") - HDmemcpy(my_layout, layout, sizeof(H5O_layout_chunk_t)); + H5MM_memcpy(my_layout, layout, sizeof(H5O_layout_chunk_t)); shared->udata = my_layout; /* Make shared B-tree info reference counted */ @@ -1088,7 +1088,7 @@ H5D__btree_idx_iterate_cb(H5F_t H5_ATTR_UNUSED *f, const void *_lt_key, HDcompile_assert(sizeof(chunk_rec.filter_mask) == sizeof(lt_key->filter_mask)); /* Compose generic chunk record for callback */ - HDmemcpy(&chunk_rec, lt_key, sizeof(*lt_key)); + H5MM_memcpy(&chunk_rec, lt_key, sizeof(*lt_key)); chunk_rec.chunk_addr = addr; /* Make "generic chunk" callback */ diff --git a/src/H5Dbtree2.c b/src/H5Dbtree2.c index d60e79e..e2a5a68 100644 --- a/src/H5Dbtree2.c +++ b/src/H5Dbtree2.c @@ -248,7 +248,7 @@ H5D__bt2_crt_context(void *_udata) /* Set up the "local" information for this dataset's chunk dimension sizes */ if(NULL == (my_dim = (uint32_t *)H5FL_BLK_MALLOC(chunk_dim, H5O_LAYOUT_NDIMS * sizeof(uint32_t)))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, NULL, "can't allocate chunk dims") - HDmemcpy(my_dim, udata->dim, H5O_LAYOUT_NDIMS * sizeof(uint32_t)); + H5MM_memcpy(my_dim, udata->dim, H5O_LAYOUT_NDIMS * sizeof(uint32_t)); ctx->dim = my_dim; /* diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 2d48d10..bf547d6 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -1710,11 +1710,11 @@ H5D__create_chunk_file_map_hyper(H5D_chunk_map_t *fm, const H5D_io_info_t new_chunk_info->mspace_shared = FALSE; /* Copy the chunk's scaled coordinates */ - HDmemcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); + H5MM_memcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); new_chunk_info->scaled[fm->f_ndims] = 0; /* Copy the chunk's scaled coordinates */ - HDmemcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); + H5MM_memcpy(new_chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); /* Insert the new chunk into the skip list */ if(H5SL_insert(fm->sel_chunks, new_chunk_info, &new_chunk_info->index) < 0) { @@ -1971,9 +1971,9 @@ H5D__chunk_file_cb(void H5_ATTR_UNUSED *elem, const H5T_t H5_ATTR_UNUSED *type, chunk_info->chunk_points = 0; /* Set the chunk's scaled coordinates */ - HDmemcpy(chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); + H5MM_memcpy(chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); chunk_info->scaled[fm->f_ndims] = 0; - HDmemcpy(chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); + H5MM_memcpy(chunk_info->scaled, scaled, sizeof(hsize_t) * fm->f_ndims); /* Insert the new chunk into the skip list */ if(H5SL_insert(fm->sel_chunks,chunk_info,&chunk_info->index) < 0) { @@ -2215,11 +2215,11 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, HDassert(fm); /* Set up "nonexistent" I/O info object */ - HDmemcpy(&nonexistent_io_info, io_info, sizeof(nonexistent_io_info)); + H5MM_memcpy(&nonexistent_io_info, io_info, sizeof(nonexistent_io_info)); nonexistent_io_info.layout_ops = *H5D_LOPS_NONEXISTENT; /* Set up contiguous I/O info object */ - HDmemcpy(&ctg_io_info, io_info, sizeof(ctg_io_info)); + H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info)); ctg_io_info.store = &ctg_store; ctg_io_info.layout_ops = *H5D_LOPS_CONTIG; @@ -2227,7 +2227,7 @@ H5D__chunk_read(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, H5_CHECKED_ASSIGN(ctg_store.contig.dset_size, hsize_t, io_info->dset->shared->layout.u.chunk.size, uint32_t); /* Set up compact I/O info object */ - HDmemcpy(&cpt_io_info, io_info, sizeof(cpt_io_info)); + H5MM_memcpy(&cpt_io_info, io_info, sizeof(cpt_io_info)); cpt_io_info.store = &cpt_store; cpt_io_info.layout_ops = *H5D_LOPS_COMPACT; @@ -2365,7 +2365,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, HDassert(fm); /* Set up contiguous I/O info object */ - HDmemcpy(&ctg_io_info, io_info, sizeof(ctg_io_info)); + H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info)); ctg_io_info.store = &ctg_store; ctg_io_info.layout_ops = *H5D_LOPS_CONTIG; @@ -2373,7 +2373,7 @@ H5D__chunk_write(H5D_io_info_t *io_info, const H5D_type_info_t *type_info, H5_CHECKED_ASSIGN(ctg_store.contig.dset_size, hsize_t, io_info->dset->shared->layout.u.chunk.size, uint32_t); /* Set up compact I/O info object */ - HDmemcpy(&cpt_io_info, io_info, sizeof(cpt_io_info)); + H5MM_memcpy(&cpt_io_info, io_info, sizeof(cpt_io_info)); cpt_io_info.store = &cpt_store; cpt_io_info.layout_ops = *H5D_LOPS_COMPACT; @@ -2727,7 +2727,7 @@ H5D__chunk_cinfo_cache_update(H5D_chunk_cached_t *last, const H5D_chunk_ud_t *ud HDassert(udata->common.scaled); /* Stored the information to cache */ - HDmemcpy(last->scaled, udata->common.scaled, sizeof(hsize_t) * udata->common.layout->ndims); + H5MM_memcpy(last->scaled, udata->common.scaled, sizeof(hsize_t) * udata->common.layout->ndims); last->addr = udata->chunk_block.offset; H5_CHECKED_ASSIGN(last->nbytes, uint32_t, udata->chunk_block.length, hsize_t); last->chunk_idx = udata->chunk_idx; @@ -3096,7 +3096,7 @@ H5D__chunk_flush_entry(const H5D_t *dset, H5D_rdcc_ent_t *ent, hbool_t reset) */ if(NULL == (buf = H5MM_malloc(alloc))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline") - HDmemcpy(buf, ent->chunk, alloc); + H5MM_memcpy(buf, ent->chunk, alloc); } /* end if */ else { /* @@ -3510,7 +3510,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, */ if(NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk") - HDmemcpy(chunk, ent->chunk, chunk_size); + H5MM_memcpy(chunk, ent->chunk, chunk_size); ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, old_pline); ent->chunk = (uint8_t *)chunk; chunk = NULL; @@ -3536,7 +3536,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, */ if(NULL == (chunk = H5D__chunk_mem_alloc(chunk_size, pline))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk") - HDmemcpy(chunk, ent->chunk, chunk_size); + H5MM_memcpy(chunk, ent->chunk, chunk_size); ent->chunk = (uint8_t *)H5D__chunk_mem_xfree(ent->chunk, old_pline); ent->chunk = (uint8_t *)chunk; @@ -3665,7 +3665,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, (void)H5D__chunk_mem_xfree(tmp_chunk, old_pline); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for raw data chunk") } /* end if */ - HDmemcpy(chunk, tmp_chunk, chunk_size); + H5MM_memcpy(chunk, tmp_chunk, chunk_size); (void)H5D__chunk_mem_xfree(tmp_chunk, old_pline); } /* end if */ } /* end if */ @@ -3746,7 +3746,7 @@ H5D__chunk_lock(const H5D_io_info_t *io_info, H5D_chunk_ud_t *udata, ent->chunk_block.offset = chunk_addr; ent->chunk_block.length = chunk_alloc; ent->chunk_idx = udata->chunk_idx; - HDmemcpy(ent->scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims); + H5MM_memcpy(ent->scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims); H5_CHECKED_ASSIGN(ent->rd_count, uint32_t, chunk_size, size_t); H5_CHECKED_ASSIGN(ent->wr_count, uint32_t, chunk_size, size_t); ent->chunk = (uint8_t *)chunk; @@ -3874,7 +3874,7 @@ H5D__chunk_unlock(const H5D_io_info_t *io_info, const H5D_chunk_ud_t *udata, fake_ent.edge_chunk_state = H5D_RDCC_DISABLE_FILTERS; if(udata->new_unfilt_chunk) fake_ent.edge_chunk_state |= H5D_RDCC_NEWLY_DISABLED_FILTERS; - HDmemcpy(fake_ent.scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims); + H5MM_memcpy(fake_ent.scaled, udata->common.scaled, sizeof(hsize_t) * layout->u.chunk.ndims); HDassert(layout->u.chunk.size > 0); fake_ent.chunk_idx = udata->chunk_idx; fake_ent.chunk_block.offset = udata->chunk_block.offset; @@ -4161,7 +4161,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ if(has_unfilt_edge_chunks) { if(NULL == (unfilt_fill_buf = H5D__chunk_mem_alloc(orig_chunk_size, &def_pline))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for raw data chunk") - HDmemcpy(unfilt_fill_buf, fb_info.fill_buf, orig_chunk_size); + H5MM_memcpy(unfilt_fill_buf, fb_info.fill_buf, orig_chunk_size); } /* end if */ /* Retrieve filter settings from API context */ @@ -5737,7 +5737,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) if(udata->chunk_in_cache && udata->chunk) { HDassert(!H5F_addr_defined(chunk_rec->chunk_addr)); - HDmemcpy(buf, udata->chunk, nbytes); + H5MM_memcpy(buf, udata->chunk, nbytes); udata->chunk = NULL; } else { @@ -5771,7 +5771,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) HDassert(H5F_addr_defined(ent->chunk_block.offset)); H5_CHECKED_ASSIGN(nbytes, size_t, shared_fo->layout.u.chunk.size, uint32_t); - HDmemcpy(buf, ent->chunk, nbytes); + H5MM_memcpy(buf, ent->chunk, nbytes); } else { /* read chunk data from the source file */ @@ -5805,7 +5805,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, H5_ITER_ERROR, "datatype conversion failed") /* Copy into another buffer, to reclaim memory later */ - HDmemcpy(reclaim_buf, buf, reclaim_buf_size); + H5MM_memcpy(reclaim_buf, buf, reclaim_buf_size); /* Set background buffer to all zeros */ HDmemset(bkg, 0, buf_size); @@ -5836,7 +5836,7 @@ H5D__chunk_copy_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata) } /* end if */ /* After fix ref, copy the new reference elements to the buffer to write out */ - HDmemcpy(buf, bkg, buf_size); + H5MM_memcpy(buf, bkg, buf_size); } /* end if */ /* Set up destination chunk callback information for insertion */ @@ -6136,7 +6136,7 @@ H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, for(ent = shared_fo->cache.chunk.head; ent; ent = next) { if(!H5F_addr_defined(ent->chunk_block.offset)) { - HDmemcpy(chunk_rec.scaled, ent->scaled, sizeof(chunk_rec.scaled)); + H5MM_memcpy(chunk_rec.scaled, ent->scaled, sizeof(chunk_rec.scaled)); udata.chunk = ent->chunk; udata.chunk_in_cache = TRUE; if(H5D__chunk_copy_cb(&chunk_rec, &udata) < 0) diff --git a/src/H5Dcompact.c b/src/H5Dcompact.c index 651aaf4..ef5f808 100644 --- a/src/H5Dcompact.c +++ b/src/H5Dcompact.c @@ -529,7 +529,7 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds if(NULL == (buf = H5FL_BLK_MALLOC(type_conv, buf_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - HDmemcpy(buf, storage_src->buf, storage_src->size); + H5MM_memcpy(buf, storage_src->buf, storage_src->size); /* allocate temporary bkg buff for data conversion */ if(NULL == (bkg = H5FL_BLK_MALLOC(type_conv, buf_size))) @@ -540,7 +540,7 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed") /* Copy into another buffer, to reclaim memory later */ - HDmemcpy(reclaim_buf, buf, buf_size); + H5MM_memcpy(reclaim_buf, buf, buf_size); /* Set background buffer to all zeros */ HDmemset(bkg, 0, buf_size); @@ -549,7 +549,7 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds if(H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed") - HDmemcpy(storage_dst->buf, buf, storage_dst->size); + H5MM_memcpy(storage_dst->buf, buf, storage_dst->size); if(H5D_vlen_reclaim(tid_mem, buf_space, reclaim_buf) < 0) HGOTO_ERROR(H5E_DATASET, H5E_BADITER, FAIL, "unable to reclaim variable-length data") @@ -564,8 +564,8 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds ref_count = storage_src->size / H5T_get_size(dt_src); /* Copy objects referenced in source buffer to destination file and set destination elements */ - if(H5O_copy_expand_ref(f_src, storage_src->buf, f_dst, - storage_dst->buf, ref_count, H5T_get_ref_type(dt_src), cpy_info) < 0) + if (H5O_copy_expand_ref(f_src, storage_src->buf, f_dst, + storage_dst->buf, ref_count, H5T_get_ref_type(dt_src), cpy_info) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy reference attribute") } /* end if */ else @@ -574,11 +574,11 @@ H5D__compact_copy(H5F_t *f_src, H5O_storage_compact_t *_storage_src, H5F_t *f_ds } /* end if */ else /* Type conversion not necessary */ - HDmemcpy(storage_dst->buf, storage_src->buf, storage_src->size); + H5MM_memcpy(storage_dst->buf, storage_src->buf, storage_src->size); } /* end if */ else /* Type conversion not necessary */ - HDmemcpy(storage_dst->buf, storage_src->buf, storage_src->size); + H5MM_memcpy(storage_dst->buf, storage_src->buf, storage_src->size); /* Mark destination buffer as dirty */ storage_dst->dirty = TRUE; diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index c2e9bfc..adf6719 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -776,7 +776,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed") /* Grab the data out of the buffer (must be first piece of data in buffer ) */ - HDmemcpy(buf, dset_contig->sieve_buf, len); + H5MM_memcpy(buf, dset_contig->sieve_buf, len); /* Reset sieve buffer dirty flag */ dset_contig->sieve_dirty = FALSE; @@ -796,7 +796,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, unsigned char *base_sieve_buf = dset_contig->sieve_buf + (addr - sieve_start); /* Grab the data out of the buffer */ - HDmemcpy(buf, base_sieve_buf, len); + H5MM_memcpy(buf, base_sieve_buf, len); } /* end if */ /* Entire request is not within this data sieve buffer */ else { @@ -860,7 +860,7 @@ H5D__contig_readvv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "block read failed") /* Grab the data out of the buffer (must be first piece of data in buffer ) */ - HDmemcpy(buf, dset_contig->sieve_buf, len); + H5MM_memcpy(buf, dset_contig->sieve_buf, len); /* Reset sieve buffer dirty flag */ dset_contig->sieve_dirty = FALSE; @@ -1058,7 +1058,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, } /* end if */ /* Grab the data out of the buffer (must be first piece of data in buffer ) */ - HDmemcpy(dset_contig->sieve_buf, buf, len); + H5MM_memcpy(dset_contig->sieve_buf, buf, len); /* Set sieve buffer dirty flag */ dset_contig->sieve_dirty = TRUE; @@ -1078,7 +1078,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, unsigned char *base_sieve_buf = dset_contig->sieve_buf + (addr - sieve_start); /* Put the data into the sieve buffer */ - HDmemcpy(base_sieve_buf, buf, len); + H5MM_memcpy(base_sieve_buf, buf, len); /* Set sieve buffer dirty flag */ dset_contig->sieve_dirty = TRUE; @@ -1121,7 +1121,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, HDmemmove(dset_contig->sieve_buf + len, dset_contig->sieve_buf, dset_contig->sieve_size); /* Copy in new information (must be first in sieve buffer) */ - HDmemcpy(dset_contig->sieve_buf, buf, len); + H5MM_memcpy(dset_contig->sieve_buf, buf, len); /* Adjust sieve location */ dset_contig->sieve_loc = addr; @@ -1130,7 +1130,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, /* Append to existing sieve buffer */ else { /* Copy in new information */ - HDmemcpy(dset_contig->sieve_buf + sieve_size, buf, len); + H5MM_memcpy(dset_contig->sieve_buf + sieve_size, buf, len); } /* end else */ /* Adjust sieve size */ @@ -1184,7 +1184,7 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, } /* end if */ /* Grab the data out of the buffer (must be first piece of data in buffer ) */ - HDmemcpy(dset_contig->sieve_buf, buf, len); + H5MM_memcpy(dset_contig->sieve_buf, buf, len); /* Set sieve buffer dirty flag */ dset_contig->sieve_dirty = TRUE; @@ -1539,7 +1539,7 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, if(try_sieve && (addr_src >= sieve_start) && ((addr_src + src_nbytes -1) < sieve_end)) { unsigned char *base_sieve_buf = shared_fo->cache.contig.sieve_buf + (addr_src - sieve_start); - HDmemcpy(buf, base_sieve_buf, src_nbytes); + H5MM_memcpy(buf, base_sieve_buf, src_nbytes); } else /* Read raw data from source file */ if(H5F_block_read(f_src, H5FD_MEM_DRAW, addr_src, src_nbytes, buf) < 0) @@ -1552,7 +1552,7 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "datatype conversion failed") /* Copy into another buffer, to reclaim memory later */ - HDmemcpy(reclaim_buf, buf, mem_nbytes); + H5MM_memcpy(reclaim_buf, buf, mem_nbytes); /* Set background buffer to all zeros */ HDmemset(bkg, 0, buf_size); @@ -1578,7 +1578,7 @@ H5D__contig_copy(H5F_t *f_src, const H5O_storage_contig_t *storage_src, HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "unable to copy reference attribute") /* After fix ref, copy the new reference elements to the buffer to write out */ - HDmemcpy(buf, bkg, buf_size); + H5MM_memcpy(buf, bkg, buf_size); } /* end if */ else /* Reset value to zero */ diff --git a/src/H5Dearray.c b/src/H5Dearray.c index e77d968..2e32494 100644 --- a/src/H5Dearray.c +++ b/src/H5Dearray.c @@ -1197,11 +1197,11 @@ H5D__earray_idx_resize(H5O_layout_chunk_t *layout) hsize_t swizzled_max_chunks[H5O_LAYOUT_NDIMS]; /* Swizzled form of max # of chunks in each dimension */ /* Get the swizzled chunk dimensions */ - HDmemcpy(layout->u.earray.swizzled_dim, layout->dim, (layout->ndims - 1) * sizeof(layout->dim[0])); + H5MM_memcpy(layout->u.earray.swizzled_dim, layout->dim, (layout->ndims - 1) * sizeof(layout->dim[0])); H5VM_swizzle_coords(uint32_t, layout->u.earray.swizzled_dim, layout->u.earray.unlim_dim); /* Get the swizzled number of chunks in each dimension */ - HDmemcpy(swizzled_chunks, layout->chunks, (layout->ndims - 1) * sizeof(swizzled_chunks[0])); + H5MM_memcpy(swizzled_chunks, layout->chunks, (layout->ndims - 1) * sizeof(swizzled_chunks[0])); H5VM_swizzle_coords(hsize_t, swizzled_chunks, layout->u.earray.unlim_dim); /* Get the swizzled "down" sizes for each dimension */ @@ -1209,7 +1209,7 @@ H5D__earray_idx_resize(H5O_layout_chunk_t *layout) HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't compute swizzled 'down' chunk size value") /* Get the swizzled max number of chunks in each dimension */ - HDmemcpy(swizzled_max_chunks, layout->max_chunks, (layout->ndims - 1) * sizeof(swizzled_max_chunks[0])); + H5MM_memcpy(swizzled_max_chunks, layout->max_chunks, (layout->ndims - 1) * sizeof(swizzled_max_chunks[0])); H5VM_swizzle_coords(hsize_t, swizzled_max_chunks, layout->u.earray.unlim_dim); /* Get the swizzled max "down" sizes for each dimension */ diff --git a/src/H5Defl.c b/src/H5Defl.c index ce0bb80..91caa61 100644 --- a/src/H5Defl.c +++ b/src/H5Defl.c @@ -227,7 +227,7 @@ H5D__efl_io_init(const H5D_io_info_t *io_info, const H5D_type_info_t H5_ATTR_UNU { FUNC_ENTER_STATIC_NOERR - HDmemcpy(&io_info->store->efl, &(io_info->dset->shared->dcpl_cache.efl), sizeof(H5O_efl_t)); + H5MM_memcpy(&io_info->store->efl, &(io_info->dset->shared->dcpl_cache.efl), sizeof(H5O_efl_t)); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5D__efl_io_init() */ diff --git a/src/H5Dfill.c b/src/H5Dfill.c index e42e551..00c85d4 100644 --- a/src/H5Dfill.c +++ b/src/H5Dfill.c @@ -300,7 +300,7 @@ H5D__fill(const void *fill, const H5T_t *fill_type, void *buf, HGOTO_ERROR(H5E_DATASET, H5E_NOSPACE, FAIL, "can't get actual buffer") /* Copy the user's data into the buffer for conversion */ - HDmemcpy(elem_ptr, fill, src_type_size); + H5MM_memcpy(elem_ptr, fill, src_type_size); /* If there's no VL type of data, do conversion first then fill the data into * the memory buffer. */ @@ -577,7 +577,7 @@ H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts) HDassert(fb_info->fill_buf); /* Make a copy of the (disk-based) fill value into the buffer */ - HDmemcpy(fb_info->fill_buf, fb_info->fill->buf, fb_info->file_elmt_size); + H5MM_memcpy(fb_info->fill_buf, fb_info->fill->buf, fb_info->file_elmt_size); /* Reset first element of background buffer, if necessary */ if(H5T_path_bkg(fb_info->fill_to_mem_tpath)) @@ -603,7 +603,7 @@ H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts) if(!buf) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary fill buffer") - HDmemcpy(buf, fb_info->fill_buf, fb_info->fill_buf_size); + H5MM_memcpy(buf, fb_info->fill_buf, fb_info->fill_buf_size); /* Type convert the dataset buffer, to copy any VL components */ if(H5T_convert(fb_info->mem_to_dset_tpath, fb_info->mem_tid, fb_info->file_tid, nelmts, (size_t)0, (size_t)0, fb_info->fill_buf, fb_info->bkg_buf) < 0) diff --git a/src/H5Dint.c b/src/H5Dint.c index 77837c4..696c7d0 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -441,7 +441,7 @@ H5D__new(hid_t dcpl_id, hid_t dapl_id, hbool_t creating, hbool_t vl_type) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy the default dataset information */ - HDmemcpy(new_dset, &H5D_def_dset, sizeof(H5D_shared_t)); + H5MM_memcpy(new_dset, &H5D_def_dset, sizeof(H5D_shared_t)); /* If we are using the default dataset creation property list, during creation * don't bother to copy it, just increment the reference count @@ -760,7 +760,7 @@ H5D__calculate_minimum_header_size(H5F_t *file, H5D_t *dset, H5O_t *ohdr) /* Shallow copy the fill value property */ /* guards against shared component modification */ - HDmemcpy(&old_fill_prop, fill_prop, sizeof(old_fill_prop)); + H5MM_memcpy(&old_fill_prop, fill_prop, sizeof(old_fill_prop)); if (H5O_msg_reset_share(H5O_FILL_ID, &old_fill_prop) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "can't reset the copied fill property") @@ -986,7 +986,7 @@ H5D__update_oh_info(H5F_t *file, H5D_t *dset, hid_t dapl_id) /* Shallow copy the fill value property */ /* (we only want to make certain that the shared component isn't modified) */ - HDmemcpy(&old_fill_prop, fill_prop, sizeof(old_fill_prop)); + H5MM_memcpy(&old_fill_prop, fill_prop, sizeof(old_fill_prop)); /* Reset shared component info */ H5O_msg_reset_share(H5O_FILL_ID, &old_fill_prop); @@ -1640,7 +1640,7 @@ H5D__append_flush_setup(H5D_t *dset, hid_t dapl_id) dset->shared->append_flush.ndims = info.ndims; dset->shared->append_flush.func = info.func; dset->shared->append_flush.udata = info.udata; - HDmemcpy(dset->shared->append_flush.boundary, info.boundary, sizeof(info.boundary)); + H5MM_memcpy(dset->shared->append_flush.boundary, info.boundary, sizeof(info.boundary)); } /* end if */ } /* end if */ } /* end if */ @@ -2797,7 +2797,7 @@ H5D__set_extent(H5D_t *dset, const hsize_t *size) /* Keep the current dataspace dimensions for later */ HDcompile_assert(sizeof(curr_dims) == sizeof(dset->shared->curr_dims)); - HDmemcpy(curr_dims, dset->shared->curr_dims, H5S_MAX_RANK * sizeof(curr_dims[0])); + H5MM_memcpy(curr_dims, dset->shared->curr_dims, H5S_MAX_RANK * sizeof(curr_dims[0])); /* Modify the size of the dataspace */ if((changed = H5S_set_extent(dset->shared->space, size)) < 0) @@ -3082,7 +3082,7 @@ H5D__format_convert(H5D_t *dataset) idx_info.storage = &dataset->shared->layout.storage.u.chunk; /* Copy the current layout info to the new layout */ - HDmemcpy(newlayout, &dataset->shared->layout, sizeof(H5O_layout_t)); + H5MM_memcpy(newlayout, &dataset->shared->layout, sizeof(H5O_layout_t)); /* Set up info for version 1 B-tree in the new layout */ newlayout->version = H5O_LAYOUT_VERSION_3; @@ -3133,7 +3133,7 @@ H5D__format_convert(H5D_t *dataset) HGOTO_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "unable to release chunk index info") /* Copy the new layout to the dataset's layout */ - HDmemcpy(&dataset->shared->layout, newlayout, sizeof(H5O_layout_t)); + H5MM_memcpy(&dataset->shared->layout, newlayout, sizeof(H5O_layout_t)); break; diff --git a/src/H5Dmpio.c b/src/H5Dmpio.c index 930e9ca..0327c28 100644 --- a/src/H5Dmpio.c +++ b/src/H5Dmpio.c @@ -1427,7 +1427,7 @@ H5D__link_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_in for (i = 0, offset = 0; i < (size_t) mpi_rank; i++) offset += num_chunks_selected_array[i]; - HDmemcpy(chunk_list, &collective_chunk_list[offset], num_chunks_selected_array[mpi_rank] * sizeof(H5D_filtered_collective_io_info_t)); + H5MM_memcpy(chunk_list, &collective_chunk_list[offset], num_chunks_selected_array[mpi_rank] * sizeof(H5D_filtered_collective_io_info_t)); /* Create single MPI type encompassing each selection in the dataspace */ if (H5D__mpio_filtered_collective_write_type(chunk_list, chunk_list_num_entries, @@ -1553,7 +1553,7 @@ if(H5DEBUG(D)) HGOTO_ERROR(H5E_DATASET, H5E_CANTRECV, FAIL, "unable to obtain MPIO mode") /* Set up contiguous I/O info object */ - HDmemcpy(&ctg_io_info, io_info, sizeof(ctg_io_info)); + H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info)); ctg_io_info.store = &ctg_store; ctg_io_info.layout_ops = *H5D_LOPS_CONTIG; @@ -1561,7 +1561,7 @@ if(H5DEBUG(D)) ctg_store.contig.dset_size = (hsize_t)io_info->dset->shared->layout.u.chunk.size; /* Set up compact I/O info object */ - HDmemcpy(&cpt_io_info, io_info, sizeof(cpt_io_info)); + H5MM_memcpy(&cpt_io_info, io_info, sizeof(cpt_io_info)); cpt_io_info.store = &cpt_store; cpt_io_info.layout_ops = *H5D_LOPS_COMPACT; @@ -1788,7 +1788,7 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "couldn't construct filtered I/O info list") /* Set up contiguous I/O info object */ - HDmemcpy(&ctg_io_info, io_info, sizeof(ctg_io_info)); + H5MM_memcpy(&ctg_io_info, io_info, sizeof(ctg_io_info)); ctg_io_info.store = &ctg_store; ctg_io_info.layout_ops = *H5D_LOPS_CONTIG; @@ -1893,7 +1893,7 @@ H5D__multi_chunk_filtered_collective_io(H5D_io_info_t *io_info, const H5D_type_i /* Collect the new chunk info back to the local copy, since only the record in the * collective array gets updated by the chunk re-allocation */ - HDmemcpy(&chunk_list[i].chunk_states.new_chunk, &collective_chunk_list[offset].chunk_states.new_chunk, sizeof(chunk_list[i].chunk_states.new_chunk)); + H5MM_memcpy(&chunk_list[i].chunk_states.new_chunk, &collective_chunk_list[offset].chunk_states.new_chunk, sizeof(chunk_list[i].chunk_states.new_chunk)); H5_CHECKED_ASSIGN(mpi_type_count, int, chunk_list[i].chunk_states.new_chunk.length, hsize_t); @@ -2517,8 +2517,8 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm, /* merge buffer io_mode info and chunk addr into one */ - HDmemcpy(mergebuf, assign_io_mode, total_chunks); - HDmemcpy(tempbuf, chunk_addr, sizeof(haddr_t) * total_chunks); + H5MM_memcpy(mergebuf, assign_io_mode, total_chunks); + H5MM_memcpy(tempbuf, chunk_addr, sizeof(haddr_t) * total_chunks); H5MM_free(nproc_per_chunk); } /* end if */ @@ -2527,8 +2527,8 @@ H5D__obtain_mpio_mode(H5D_io_info_t* io_info, H5D_chunk_map_t *fm, if(MPI_SUCCESS != (mpi_code = MPI_Bcast(mergebuf, ((sizeof(haddr_t) + 1) * total_chunks), MPI_BYTE, root, comm))) HMPI_GOTO_ERROR(FAIL, "MPI_BCast failed", mpi_code) - HDmemcpy(assign_io_mode, mergebuf, total_chunks); - HDmemcpy(chunk_addr, tempbuf, sizeof(haddr_t) * total_chunks); + H5MM_memcpy(assign_io_mode, mergebuf, total_chunks); + H5MM_memcpy(chunk_addr, tempbuf, sizeof(haddr_t) * total_chunks); #ifdef H5_HAVE_INSTRUMENTED_LIBRARY { @@ -2630,7 +2630,7 @@ H5D__construct_filtered_io_info_list(const H5D_io_info_t *io_info, const H5D_typ local_info_array[i].async_info.receive_buffer_array = NULL; local_info_array[i].async_info.receive_requests_array = NULL; - HDmemcpy(local_info_array[i].scaled, chunk_info->scaled, sizeof(chunk_info->scaled)); + H5MM_memcpy(local_info_array[i].scaled, chunk_info->scaled, sizeof(chunk_info->scaled)); if ((select_npoints = H5S_GET_SELECT_NPOINTS(chunk_info->mspace)) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTCOUNT, FAIL, "dataspace is invalid") diff --git a/src/H5Dscatgath.c b/src/H5Dscatgath.c index 5856ede..0d88812 100644 --- a/src/H5Dscatgath.c +++ b/src/H5Dscatgath.c @@ -117,7 +117,7 @@ H5D__scatter_file(const H5D_io_info_t *_io_info, HDassert(_buf); /* Set up temporary I/O info object */ - HDmemcpy(&tmp_io_info, _io_info, sizeof(*_io_info)); + H5MM_memcpy(&tmp_io_info, _io_info, sizeof(*_io_info)); tmp_io_info.op_type = H5D_IO_OP_WRITE; tmp_io_info.u.wbuf = _buf; @@ -220,7 +220,7 @@ H5D__gather_file(const H5D_io_info_t *_io_info, HDassert(_buf); /* Set up temporary I/O info object */ - HDmemcpy(&tmp_io_info, _io_info, sizeof(*_io_info)); + H5MM_memcpy(&tmp_io_info, _io_info, sizeof(*_io_info)); tmp_io_info.op_type = H5D_IO_OP_READ; tmp_io_info.u.rbuf = _buf; @@ -337,7 +337,7 @@ H5D__scatter_mem (const void *_tscat_buf, const H5S_t *space, /* Get the number of bytes in sequence */ curr_len = len[curr_seq]; - HDmemcpy(buf + off[curr_seq], tscat_buf, curr_len); + H5MM_memcpy(buf + off[curr_seq], tscat_buf, curr_len); /* Advance offset in destination buffer */ tscat_buf += curr_len; @@ -425,7 +425,7 @@ H5D__gather_mem(const void *_buf, const H5S_t *space, /* Get the number of bytes in sequence */ curr_len = len[curr_seq]; - HDmemcpy(tgath_buf, buf + off[curr_seq], curr_len); + H5MM_memcpy(tgath_buf, buf + off[curr_seq], curr_len); /* Advance offset in gather buffer */ tgath_buf += curr_len; diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c index e591440..d9396f3 100644 --- a/src/H5Dvirtual.c +++ b/src/H5Dvirtual.c @@ -497,11 +497,11 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout) /* Encode each entry */ for(i = 0; i < layout->storage.u.virt.list_nused; i++) { /* Source file name */ - HDmemcpy((char *)heap_block_p, layout->storage.u.virt.list[i].source_file_name, str_size[2 * i]); + H5MM_memcpy((char *)heap_block_p, layout->storage.u.virt.list[i].source_file_name, str_size[2 * i]); heap_block_p += str_size[2 * i]; /* Source dataset name */ - HDmemcpy((char *)heap_block_p, layout->storage.u.virt.list[i].source_dset_name, str_size[(2 * i) + 1]); + H5MM_memcpy((char *)heap_block_p, layout->storage.u.virt.list[i].source_dset_name, str_size[(2 * i) + 1]); heap_block_p += str_size[(2 * i) + 1]; /* Source selection */ @@ -1114,7 +1114,7 @@ H5D__virtual_str_append(const char *src, size_t src_len, char **p, char **buf, /* Copy string to *p. Note that since src in not NULL terminated, we must * use memcpy */ - (void)HDmemcpy(*p, src, src_len); + H5MM_memcpy(*p, src, src_len); /* Advance *p */ *p += src_len; diff --git a/src/H5EA.c b/src/H5EA.c index 0b340a7..03e881f 100644 --- a/src/H5EA.c +++ b/src/H5EA.c @@ -693,7 +693,7 @@ H5EA_set(const H5EA_t *ea, hsize_t idx, const void *elmt)) HDassert(thing_unprot_func); /* Set element in thing's element buffer */ - HDmemcpy(thing_elmt_buf + (hdr->cparam.cls->nat_elmt_size * thing_elmt_idx), elmt, hdr->cparam.cls->nat_elmt_size); + H5MM_memcpy(thing_elmt_buf + (hdr->cparam.cls->nat_elmt_size * thing_elmt_idx), elmt, hdr->cparam.cls->nat_elmt_size); thing_cache_flags |= H5AC__DIRTIED_FLAG; /* Update max. element set in array, if appropriate */ @@ -765,7 +765,7 @@ H5EA_get(const H5EA_t *ea, hsize_t idx, void *elmt)) } /* end if */ else /* Get element from thing's element buffer */ - HDmemcpy(elmt, thing_elmt_buf + (hdr->cparam.cls->nat_elmt_size * thing_elmt_idx), hdr->cparam.cls->nat_elmt_size); + H5MM_memcpy(elmt, thing_elmt_buf + (hdr->cparam.cls->nat_elmt_size * thing_elmt_idx), hdr->cparam.cls->nat_elmt_size); } /* end else */ CATCH diff --git a/src/H5EAcache.c b/src/H5EAcache.c index 60d8863..baaa99b 100644 --- a/src/H5EAcache.c +++ b/src/H5EAcache.c @@ -479,7 +479,7 @@ H5EA__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le HDassert(hdr); /* Magic number */ - HDmemcpy(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); + H5MM_memcpy(image, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); image += H5_SIZEOF_MAGIC; /* Version # */ @@ -868,7 +868,7 @@ H5EA__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED /* Get temporary pointer to serialized info */ /* Magic number */ - HDmemcpy(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); + H5MM_memcpy(image, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); image += H5_SIZEOF_MAGIC; /* Version # */ @@ -1181,7 +1181,7 @@ H5EA__cache_sblock_deserialize(const void *_image, size_t len, size_t tot_page_init_size = sblock->ndblks * sblock->dblk_page_init_size; /* Compute total size of 'page init' buffer */ /* Retrieve the 'page init' bitmasks */ - HDmemcpy(sblock->page_init, image, tot_page_init_size); + H5MM_memcpy(sblock->page_init, image, tot_page_init_size); image += tot_page_init_size; } /* end if */ @@ -1278,7 +1278,7 @@ H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED HDassert(sblock->hdr); /* Magic number */ - HDmemcpy(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); + H5MM_memcpy(image, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); image += H5_SIZEOF_MAGIC; /* Version # */ @@ -1301,7 +1301,7 @@ H5EA__cache_sblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED size_t tot_page_init_size = sblock->ndblks * sblock->dblk_page_init_size; /* Compute total size of 'page init' buffer */ /* Store the 'page init' bitmasks */ - HDmemcpy(image, sblock->page_init, tot_page_init_size); + H5MM_memcpy(image, sblock->page_init, tot_page_init_size); image += tot_page_init_size; } /* end if */ @@ -1693,7 +1693,7 @@ H5EA__cache_dblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED HDassert(dblock->hdr); /* Magic number */ - HDmemcpy(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); + H5MM_memcpy(image, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); image += H5_SIZEOF_MAGIC; /* Version # */ diff --git a/src/H5EAhdr.c b/src/H5EAhdr.c index 62a23b8..a0bea79 100644 --- a/src/H5EAhdr.c +++ b/src/H5EAhdr.c @@ -407,7 +407,7 @@ H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata)) hdr->idx_blk_addr = HADDR_UNDEF; /* Set the creation parameters for the array */ - HDmemcpy(&hdr->cparam, cparam, sizeof(hdr->cparam)); + H5MM_memcpy(&hdr->cparam, cparam, sizeof(hdr->cparam)); /* Finish initializing extensible array header */ if(H5EA__hdr_init(hdr, ctx_udata) < 0) diff --git a/src/H5EAstat.c b/src/H5EAstat.c index 72c4d14..6c55d7e 100644 --- a/src/H5EAstat.c +++ b/src/H5EAstat.c @@ -108,7 +108,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); HDassert(stats); /* Copy extensible array statistics */ - HDmemcpy(stats, &ea->hdr->stats, sizeof(ea->hdr->stats)); + H5MM_memcpy(stats, &ea->hdr->stats, sizeof(ea->hdr->stats)); END_FUNC(PRIV) /* end H5EA_get_stats() */ diff --git a/src/H5Eint.c b/src/H5Eint.c index 166803b..ddd4eab 100644 --- a/src/H5Eint.c +++ b/src/H5Eint.c @@ -882,12 +882,12 @@ H5E_clear_entries(H5E_t *estack, size_t nentries) /* Release strings */ if(error->func_name) - H5MM_xfree((void *)error->func_name); /* Casting away const OK - QAK */ + error->func_name = (const char *) H5MM_xfree_const(error->func_name); if(error->file_name) - H5MM_xfree((void *)error->file_name); /* Casting away const OK - QAK */ + error->file_name = (const char *) H5MM_xfree_const(error->file_name); if(error->desc) - H5MM_xfree((void *)error->desc); /* Casting away const OK - QAK */ - } /* end for */ + error->desc = (const char *) H5MM_xfree_const(error->desc); + } /* Decrement number of errors on stack */ estack->nused -= u; diff --git a/src/H5FA.c b/src/H5FA.c index e579e4f..1d145d7 100644 --- a/src/H5FA.c +++ b/src/H5FA.c @@ -371,7 +371,7 @@ H5FA_set(const H5FA_t *fa, hsize_t idx, const void *elmt)) /* Check for paging data block */ if(!dblock->npages) { /* Set element in data block */ - HDmemcpy(((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), elmt, hdr->cparam.cls->nat_elmt_size); + H5MM_memcpy(((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), elmt, hdr->cparam.cls->nat_elmt_size); dblock_cache_flags |= H5AC__DIRTIED_FLAG; } /* end if */ else { /* paging */ @@ -410,7 +410,7 @@ H5FA_set(const H5FA_t *fa, hsize_t idx, const void *elmt)) H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", (unsigned long long)dblk_page_addr) /* Set the element in the data block page */ - HDmemcpy(((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), elmt, hdr->cparam.cls->nat_elmt_size); + H5MM_memcpy(((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), elmt, hdr->cparam.cls->nat_elmt_size); dblk_page_cache_flags |= H5AC__DIRTIED_FLAG; } /* end else */ @@ -474,7 +474,7 @@ H5FA_get(const H5FA_t *fa, hsize_t idx, void *elmt)) /* Check for paged data block */ if(!dblock->npages) /* Retrieve element from data block */ - HDmemcpy(elmt, ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), hdr->cparam.cls->nat_elmt_size); + H5MM_memcpy(elmt, ((uint8_t *)dblock->elmts) + (hdr->cparam.cls->nat_elmt_size * idx), hdr->cparam.cls->nat_elmt_size); else { /* paging */ size_t page_idx; /* Index of page within data block */ @@ -512,7 +512,7 @@ H5FA_get(const H5FA_t *fa, hsize_t idx, void *elmt)) H5E_THROW(H5E_CANTPROTECT, "unable to protect fixed array data block page, address = %llu", (unsigned long long)dblk_page_addr) /* Retrieve element from data block */ - HDmemcpy(elmt, ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), hdr->cparam.cls->nat_elmt_size); + H5MM_memcpy(elmt, ((uint8_t *)dblk_page->elmts) + (hdr->cparam.cls->nat_elmt_size * elmt_idx), hdr->cparam.cls->nat_elmt_size); } /* end else */ } /* end else */ } /* end else */ diff --git a/src/H5FAcache.c b/src/H5FAcache.c index 5b4e124..ef2e5e3 100644 --- a/src/H5FAcache.c +++ b/src/H5FAcache.c @@ -409,7 +409,7 @@ 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 # */ @@ -694,7 +694,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 */ @@ -798,7 +798,7 @@ 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 # */ @@ -814,7 +814,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 */ diff --git a/src/H5FAhdr.c b/src/H5FAhdr.c index 2e3db0b..5a6283f 100644 --- a/src/H5FAhdr.c +++ b/src/H5FAhdr.c @@ -207,7 +207,7 @@ H5FA__hdr_create(H5F_t *f, const H5FA_create_t *cparam, void *ctx_udata)) hdr->dblk_addr = HADDR_UNDEF; /* Set the creation parameters for the array */ - HDmemcpy(&hdr->cparam, cparam, sizeof(hdr->cparam)); + H5MM_memcpy(&hdr->cparam, cparam, sizeof(hdr->cparam)); /* Finish initializing fixed array header */ if(H5FA__hdr_init(hdr, ctx_udata) < 0) diff --git a/src/H5FAstat.c b/src/H5FAstat.c index 3c06855..e70fcb8 100644 --- a/src/H5FAstat.c +++ b/src/H5FAstat.c @@ -105,7 +105,7 @@ HDfprintf(stderr, "%s: Called\n", FUNC); HDassert(stats); /* Copy fixed array statistics */ - HDmemcpy(stats, &fa->hdr->stats, sizeof(fa->hdr->stats)); + H5MM_memcpy(stats, &fa->hdr->stats, sizeof(fa->hdr->stats)); END_FUNC(PRIV) /* end H5FA_get_stats() */ diff --git a/src/H5FD.c b/src/H5FD.c index ccdec66..a0e1a44 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -294,7 +294,7 @@ H5FD_register(const void *_cls, size_t size, hbool_t app_ref) /* Copy the class structure so the caller can reuse or free it */ if(NULL == (saved = (H5FD_class_t *)H5MM_malloc(size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for file driver class struct") - HDmemcpy(saved, cls, size); + H5MM_memcpy(saved, cls, size); /* Create the new class ID */ if((ret_value = H5I_register(H5I_VFL, saved, app_ref)) < 0) @@ -574,8 +574,7 @@ H5FD_fapl_close(hid_t driver_id, const void *driver_info) FUNC_ENTER_NOAPI(FAIL) - /* Check args */ - if(driver_id > 0) { + if(driver_id > 0 && driver_info) { H5FD_class_t *driver; /* Retrieve the driver for the ID */ @@ -583,15 +582,15 @@ H5FD_fapl_close(hid_t driver_id, const void *driver_info) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a driver ID") /* Allow driver to free info or do it ourselves */ - if(driver_info) { - if(driver->fapl_free) { - if((driver->fapl_free)((void *)driver_info) < 0) /* Casting away const OK -QAK */ - HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed") - } /* end if */ - else - H5MM_xfree((void *)driver_info); /* Casting away const OK -QAK */ - } /* end if */ - } /* end if */ + if(driver->fapl_free) { + /* Free the const pointer */ + /* Cast through uintptr_t to de-const memory */ + if((driver->fapl_free)((void *)(uintptr_t)driver_info) < 0) + HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed") + } + else + driver_info = H5MM_xfree_const(driver_info); + } done: FUNC_LEAVE_NOAPI(ret_value) @@ -1339,7 +1338,7 @@ H5FD_get_fs_type_map(const H5FD_t *file, H5FD_mem_t *type_map) } /* end if */ else /* Copy class's default free space type mapping */ - HDmemcpy(type_map, file->cls->fl_map, sizeof(file->cls->fl_map)); + H5MM_memcpy(type_map, file->cls->fl_map, sizeof(file->cls->fl_map)); done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 8403287..805d54e 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -742,7 +742,7 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, NULL, "image_memcpy callback failed") } /* end if */ else - HDmemcpy(file->mem, file_image_info.buffer, size); + H5MM_memcpy(file->mem, file_image_info.buffer, size); } /* end if */ /* Read in existing data from the file if there is no image */ else { @@ -1202,7 +1202,7 @@ H5FD__core_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU nbytes = MIN(size,(size_t)(file->eof-addr)); #endif /* NDEBUG */ - HDmemcpy(buf, file->mem + addr, nbytes); + H5MM_memcpy(buf, file->mem + addr, nbytes); size -= nbytes; addr += nbytes; buf = (char *)buf + nbytes; @@ -1288,7 +1288,7 @@ H5FD__core_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN } /* Write from BUF to memory */ - HDmemcpy(file->mem + addr, buf, size); + H5MM_memcpy(file->mem + addr, buf, size); /* Mark memory buffer as modified */ file->dirty = TRUE; diff --git a/src/H5FDdirect.c b/src/H5FDdirect.c index 564b44d..ca1a11d 100644 --- a/src/H5FDdirect.c +++ b/src/H5FDdirect.c @@ -424,7 +424,7 @@ H5FD_direct_fapl_copy(const void *_old_fa) HDassert(new_fa); /* Copy the general information */ - HDmemcpy(new_fa, old_fa, sizeof(H5FD_direct_fapl_t)); + H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_direct_fapl_t)); FUNC_LEAVE_NOAPI(new_fa) } /* end H5FD_direct_fapl_copy() */ @@ -978,12 +978,12 @@ H5FD_direct_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN * next section of data. */ p2 = (unsigned char*)copy_buf + copy_offset; if((copy_size + copy_offset) <= alloc_size) { - HDmemcpy(buf, p2, copy_size); + H5MM_memcpy(buf, p2, copy_size); buf = (unsigned char *)buf + copy_size; copy_size = 0; } /* end if */ else { - HDmemcpy(buf, p2, alloc_size - copy_offset); + H5MM_memcpy(buf, p2, alloc_size - copy_offset); buf = (unsigned char*)buf + alloc_size - copy_offset; copy_size -= alloc_size - copy_offset; copy_offset = 0; @@ -1191,11 +1191,11 @@ H5FD_direct_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_U */ p1 = (unsigned char *)copy_buf + copy_offset; if((copy_size + copy_offset) <= alloc_size) { - HDmemcpy(p1, p3, copy_size); + H5MM_memcpy(p1, p3, copy_size); copy_size = 0; } /* end if */ else { - HDmemcpy(p1, p3, alloc_size - copy_offset); + H5MM_memcpy(p1, p3, alloc_size - copy_offset); p3 = (const unsigned char *)p3 + (alloc_size - copy_offset); copy_size -= alloc_size - copy_offset; copy_offset = 0; diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c index e52a71a..d383cdb 100644 --- a/src/H5FDfamily.c +++ b/src/H5FDfamily.c @@ -414,7 +414,7 @@ H5FD_family_fapl_copy(const void *_old_fa) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy the fields of the structure */ - HDmemcpy(new_fa, old_fa, sizeof(H5FD_family_fapl_t)); + H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_family_fapl_t)); /* Deep copy the property list objects in the structure */ if(old_fa->memb_fapl_id==H5P_FILE_ACCESS_DEFAULT) { diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 75d3d78..fc9d7c8 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -403,7 +403,7 @@ H5FD_log_fapl_copy(const void *_old_fa) HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "unable to allocate log file FAPL") /* Copy the general information */ - HDmemcpy(new_fa, old_fa, sizeof(H5FD_log_fapl_t)); + H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_log_fapl_t)); /* Deep copy the log file name */ if(old_fa->logfile != NULL) diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index b1c0961..87f9e09 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -736,7 +736,7 @@ HDfprintf(stderr, "enter H5FD_mpio_fapl_copy\n"); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy the general information */ - HDmemcpy(new_fa, old_fa, sizeof(H5FD_mpio_fapl_t)); + H5MM_memcpy(new_fa, old_fa, sizeof(H5FD_mpio_fapl_t)); /* Duplicate communicator and Info object. */ if(FAIL == H5FD_mpi_comm_info_dup(old_fa->comm, old_fa->info, &new_fa->comm, &new_fa->info)) diff --git a/src/H5FL.c b/src/H5FL.c index 21bbf02..a662713 100644 --- a/src/H5FL.c +++ b/src/H5FL.c @@ -1142,7 +1142,7 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size H5FL_TRACK_ if((ret_value=H5FL_blk_malloc(head,new_size H5FL_TRACK_INFO_INT))==NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for block") blk_size=MIN(new_size,temp->size); - HDmemcpy(ret_value,block,blk_size); + H5MM_memcpy(ret_value,block,blk_size); H5FL_blk_free(head,block); } /* end if */ else { @@ -1630,7 +1630,7 @@ H5FL_arr_realloc(H5FL_arr_head_t *head, void * obj, size_t new_elem) /* Copy the appropriate amount of elements */ blk_size = head->list_arr[MIN(temp->nelem, new_elem)].size; - HDmemcpy(ret_value, obj, blk_size); + H5MM_memcpy(ret_value, obj, blk_size); /* Free the old block */ H5FL_arr_free(head, obj); diff --git a/src/H5FS.c b/src/H5FS.c index 113c8ae..0d1ba41 100644 --- a/src/H5FS.c +++ b/src/H5FS.c @@ -615,7 +615,7 @@ H5FS__new(const H5F_t *f, uint16_t nclasses, const H5FS_section_class_t *classes HDassert(u == classes[u]->type); /* Copy the class information into the free space manager */ - HDmemcpy(&fspace->sect_cls[u], classes[u], sizeof(H5FS_section_class_t)); + H5MM_memcpy(&fspace->sect_cls[u], classes[u], sizeof(H5FS_section_class_t)); /* Call the class initialization routine, if there is one */ if(fspace->sect_cls[u].init_cls) diff --git a/src/H5FScache.c b/src/H5FScache.c index 551eef1..aa061bc 100644 --- a/src/H5FScache.c +++ b/src/H5FScache.c @@ -707,7 +707,7 @@ H5FS__cache_hdr_serialize(const H5F_t *f, void *_image, size_t len, (fspace->alloc_sect_size == (size_t)fspace->sect_size))); /* Magic number */ - HDmemcpy(image, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); + H5MM_memcpy(image, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); image += H5_SIZEOF_MAGIC; /* Version # */ @@ -1265,7 +1265,7 @@ H5FS__cache_sinfo_serialize(const H5F_t *f, void *_image, size_t len, HDassert(fspace->sect_cls); /* Magic number */ - HDmemcpy(image, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC); + H5MM_memcpy(image, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC); image += H5_SIZEOF_MAGIC; /* Version # */ diff --git a/src/H5Faccum.c b/src/H5Faccum.c index 0b33f8e..053aad2 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -198,7 +198,7 @@ H5F__accum_read(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, } /* end if */ /* Copy the data out of the buffer */ - HDmemcpy(buf, accum->buf + (addr - new_addr), size); + H5MM_memcpy(buf, accum->buf + (addr - new_addr), size); /* Adjust the accumulator address & size */ accum->loc = new_addr; @@ -250,7 +250,7 @@ H5F__accum_read(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, } /* end else */ /* Copy the dirty region to buffer */ - HDmemcpy((unsigned char *)buf + buf_off, (unsigned char *)accum->buf + accum->dirty_off + dirty_off, overlap_size); + H5MM_memcpy((unsigned char *)buf + buf_off, (unsigned char *)accum->buf + accum->dirty_off + dirty_off, overlap_size); } /* end if */ } /* end else */ } /* end if */ @@ -457,7 +457,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, HDmemmove(accum->buf + size, accum->buf, accum->size); /* Copy the new metadata at the front */ - HDmemcpy(accum->buf, buf, size); + H5MM_memcpy(accum->buf, buf, size); /* Set the new size & location of the metadata accumulator */ accum->loc = addr; @@ -479,7 +479,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, HGOTO_ERROR(H5E_IO, H5E_CANTRESIZE, FAIL, "can't adjust metadata accumulator") /* Copy the new metadata to the end */ - HDmemcpy(accum->buf + accum->size, buf, size); + H5MM_memcpy(accum->buf + accum->size, buf, size); /* Adjust the dirty region and mark accumulator dirty */ if(accum->dirty) @@ -502,7 +502,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, size_t dirty_off = (size_t)(addr - accum->loc); /* Copy the new metadata to the proper location within the accumulator */ - HDmemcpy(accum->buf + dirty_off, buf, size); + H5MM_memcpy(accum->buf + dirty_off, buf, size); /* Adjust the dirty region and mark accumulator dirty */ if(accum->dirty) { @@ -545,7 +545,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, HDmemmove(accum->buf + size, accum->buf + old_offset, (accum->size - old_offset)); /* Copy the new metadata at the front */ - HDmemcpy(accum->buf, buf, size); + H5MM_memcpy(accum->buf, buf, size); /* Set the new size & location of the metadata accumulator */ accum->loc = addr; @@ -582,7 +582,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, dirty_off = (size_t)(addr - accum->loc); /* Copy the new metadata to the end */ - HDmemcpy(accum->buf + dirty_off, buf, size); + H5MM_memcpy(accum->buf + dirty_off, buf, size); /* Set the new size of the metadata accumulator */ accum->size += add_size; @@ -625,7 +625,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, } /* end if */ /* Copy the new metadata to the buffer */ - HDmemcpy(accum->buf, buf, size); + H5MM_memcpy(accum->buf, buf, size); /* Set the new size & location of the metadata accumulator */ accum->loc = addr; @@ -688,7 +688,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, accum->size = size; /* Store the piece of metadata in the accumulator */ - HDmemcpy(accum->buf, buf, size); + H5MM_memcpy(accum->buf, buf, size); /* Adjust the dirty region and mark accumulator dirty */ accum->dirty_off = 0; @@ -721,7 +721,7 @@ H5F__accum_write(H5F_t *f, H5FD_mem_t map_type, haddr_t addr, accum->size = size; /* Store the piece of metadata in the accumulator */ - HDmemcpy(accum->buf, buf, size); + H5MM_memcpy(accum->buf, buf, size); /* Adjust the dirty region and mark accumulator dirty */ accum->dirty_off = 0; diff --git a/src/H5Fint.c b/src/H5Fint.c index eebbcf0..f1afffe 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -3214,7 +3214,7 @@ H5F__get_metadata_read_retry_info(H5F_t *file, H5F_retry_info_t *info) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Copy the information */ - HDmemcpy(info->retries[j], file->shared->retries[i], tot_size); + H5MM_memcpy(info->retries[j], file->shared->retries[i], tot_size); } /* Increment location in info->retries[] array */ diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 0819486..9acddfd 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -134,7 +134,7 @@ typedef struct H5F_t H5F_t; \ HDcompile_assert(sizeof(double) == 8); \ HDcompile_assert(sizeof(double) == sizeof(uint64_t)); \ - HDmemcpy(&_n, &n, sizeof(double)); \ + H5MM_memcpy(&_n, &n, sizeof(double)); \ for(_u = 0; _u < sizeof(uint64_t); _u++, _n >>= 8) \ *_p++ = (uint8_t)(_n & 0xff); \ (p) = (uint8_t *)(p) + 8; \ @@ -240,7 +240,7 @@ typedef struct H5F_t H5F_t; (p) += 8; \ for(_u = 0; _u < sizeof(uint64_t); _u++) \ _n = (_n << 8) | *(--p); \ - HDmemcpy(&(n), &_n, sizeof(double)); \ + H5MM_memcpy(&(n), &_n, sizeof(double)); \ (p) += 8; \ } diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index bc7391c..4d94f57 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -565,7 +565,7 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) /* Set the B-tree internal node values, etc */ if(H5P_set(c_plist, H5F_CRT_BTREE_RANK_NAME, udata.btree_k) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set rank for btree internal nodes") - HDmemcpy(sblock->btree_k, udata.btree_k, sizeof(unsigned) * (size_t)H5B_NUM_BTREE_ID); + H5MM_memcpy(sblock->btree_k, udata.btree_k, sizeof(unsigned) * (size_t)H5B_NUM_BTREE_ID); } /* end if */ else { /* Get the (default) B-tree internal node values, etc */ diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 05438fa..db5bb7d 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -270,7 +270,7 @@ H5F__drvrinfo_prefix_decode(H5O_drvinfo_t *drvrinfo, char *drv_name, /* Driver name and/or version */ if(drv_name) { - HDmemcpy(drv_name, (const char *)image, (size_t)8); + H5MM_memcpy(drv_name, (const char *)image, (size_t)8); drv_name[8] = '\0'; image += 8; /* advance past name/version */ } /* end if */ @@ -683,7 +683,7 @@ H5F__cache_superblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNU HDassert(sblock->cache_info.flush_me_last); /* Encode the common portion of the file superblock for all versions */ - HDmemcpy(image, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN); + H5MM_memcpy(image, H5F_SIGNATURE, (size_t)H5F_SIGNATURE_LEN); image += H5F_SIGNATURE_LEN; *image++ = (uint8_t)sblock->super_vers; diff --git a/src/H5Gbtree2.c b/src/H5Gbtree2.c index 721d591..425cc14 100644 --- a/src/H5Gbtree2.c +++ b/src/H5Gbtree2.c @@ -206,7 +206,7 @@ H5G_dense_btree2_name_store(void *_nrecord, const void *_udata) /* Copy user information info native record */ nrecord->hash = udata->common.name_hash; - HDmemcpy(nrecord->id, udata->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); + H5MM_memcpy(nrecord->id, udata->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5G_dense_btree2_name_store() */ @@ -305,7 +305,7 @@ H5G_dense_btree2_name_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_UN /* Encode the record's fields */ UINT32ENCODE(raw, nrecord->hash) - HDmemcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); + H5MM_memcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5G_dense_btree2_name_encode() */ @@ -333,7 +333,7 @@ H5G_dense_btree2_name_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_UN /* Decode the record's fields */ UINT32DECODE(raw, nrecord->hash) - HDmemcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN); + H5MM_memcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5G_dense_btree2_name_decode() */ @@ -393,7 +393,7 @@ H5G_dense_btree2_corder_store(void *_nrecord, const void *_udata) /* Copy user information info native record */ nrecord->corder = udata->common.corder; - HDmemcpy(nrecord->id, udata->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); + H5MM_memcpy(nrecord->id, udata->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5G_dense_btree2_corder_store() */ @@ -469,7 +469,7 @@ H5G_dense_btree2_corder_encode(uint8_t *raw, const void *_nrecord, void H5_ATTR_ /* Encode the record's fields */ INT64ENCODE(raw, nrecord->corder) - HDmemcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); + H5MM_memcpy(raw, nrecord->id, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5G_dense_btree2_corder_encode() */ @@ -497,7 +497,7 @@ H5G_dense_btree2_corder_decode(const uint8_t *raw, void *_nrecord, void H5_ATTR_ /* Decode the record's fields */ INT64DECODE(raw, nrecord->corder) - HDmemcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN); + H5MM_memcpy(nrecord->id, raw, (size_t)H5G_DENSE_FHEAP_ID_LEN); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5G_dense_btree2_corder_decode() */ diff --git a/src/H5Gcache.c b/src/H5Gcache.c index b447cad..7387eae 100644 --- a/src/H5Gcache.c +++ b/src/H5Gcache.c @@ -287,7 +287,7 @@ H5G__cache_node_serialize(const H5F_t *f, void *_image, size_t len, HDassert(len == sym->node_size); /* magic number */ - HDmemcpy(image, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC); + H5MM_memcpy(image, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC); image += H5_SIZEOF_MAGIC; /* version number */ diff --git a/src/H5Gent.c b/src/H5Gent.c index baee35c..276da73 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -331,7 +331,7 @@ H5G__ent_copy(H5G_entry_t *dst, const H5G_entry_t *src, H5_copy_depth_t depth) HDassert(depth == H5_COPY_SHALLOW || depth == H5_COPY_DEEP); /* Copy the top level information */ - HDmemcpy(dst, src, sizeof(H5G_entry_t)); + H5MM_memcpy(dst, src, sizeof(H5G_entry_t)); /* Deep copy the names */ if(depth == H5_COPY_DEEP) { diff --git a/src/H5Gname.c b/src/H5Gname.c index c1156ca..19c198e 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -522,7 +522,7 @@ H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_depth_t depth) HDassert(depth == H5_COPY_SHALLOW || depth == H5_COPY_DEEP); /* Copy the top level information */ - HDmemcpy(dst, src, sizeof(H5G_name_t)); + H5MM_memcpy(dst, src, sizeof(H5G_name_t)); /* Deep copy the names */ if(depth == H5_COPY_DEEP) { diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 72b3633..b79b7d2 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -672,7 +672,7 @@ H5G__node_insert(H5F_t *f, haddr_t addr, void H5_ATTR_UNUSED *_lt_key, if(NULL == (snrt = (H5G_node_t *)H5AC_protect(f, H5AC_SNODE, *new_node_p, f, H5AC__NO_FLAGS_SET))) HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, H5B_INS_ERROR, "unable to split symbol table node") - HDmemcpy(snrt->entry, sn->entry + H5F_SYM_LEAF_K(f), + H5MM_memcpy(snrt->entry, sn->entry + H5F_SYM_LEAF_K(f), H5F_SYM_LEAF_K(f) * sizeof(H5G_entry_t)); snrt->nsyms = H5F_SYM_LEAF_K(f); snrt_flags |= H5AC__DIRTIED_FLAG; @@ -1262,7 +1262,7 @@ H5G__node_copy(H5F_t *f, const void H5_ATTR_UNUSED *_lt_key, haddr_t addr, char *link_name; /* Pointer to value of soft link */ /* Make a temporary copy, so that it will not change the info in the cache */ - HDmemcpy(&tmp_src_ent, src_ent, sizeof(H5G_entry_t)); + H5MM_memcpy(&tmp_src_ent, src_ent, sizeof(H5G_entry_t)); /* Set up group location for soft link to start in */ H5G_name_reset(&grp_path); diff --git a/src/H5Gtraverse.c b/src/H5Gtraverse.c index 6b4ea23..c2bf607 100644 --- a/src/H5Gtraverse.c +++ b/src/H5Gtraverse.c @@ -556,7 +556,7 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, * Copy the component name into a null-terminated buffer so * we can pass it down to the other symbol table functions. */ - HDmemcpy(comp, name, nchars); + H5MM_memcpy(comp, name, nchars); comp[nchars] = '\0'; /* @@ -671,7 +671,7 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, /* Only keep the creation order information from the parent * group's link info */ - HDmemcpy(&tmp_linfo, &def_linfo, sizeof(H5O_linfo_t)); + H5MM_memcpy(&tmp_linfo, &def_linfo, sizeof(H5O_linfo_t)); tmp_linfo.track_corder = par_linfo.track_corder; tmp_linfo.index_corder = par_linfo.index_corder; linfo = &tmp_linfo; diff --git a/src/H5HF.c b/src/H5HF.c index b7a6244..4a28416 100644 --- a/src/H5HF.c +++ b/src/H5HF.c @@ -104,7 +104,7 @@ H5HF_op_read(const void *obj, size_t obj_len, void *op_data) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Perform "read", using memcpy() */ - HDmemcpy(op_data, obj, obj_len); + H5MM_memcpy(op_data, obj, obj_len); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HF_op_read() */ @@ -129,7 +129,7 @@ H5HF_op_write(const void *obj, size_t obj_len, void *op_data) FUNC_ENTER_NOAPI_NOINIT_NOERR /* Perform "write", using memcpy() */ - HDmemcpy((void *)obj, op_data, obj_len); /* Casting away const OK -QAK */ + H5MM_memcpy((void *)obj, op_data, obj_len); /* Casting away const OK -QAK */ FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HF_op_write() */ diff --git a/src/H5HFcache.c b/src/H5HFcache.c index 0c5d3aa..2d1c1f2 100644 --- a/src/H5HFcache.c +++ b/src/H5HFcache.c @@ -772,7 +772,7 @@ H5HF__cache_hdr_serialize(const H5F_t *f, void *_image, size_t len, hdr->f = f; /* Magic number */ - HDmemcpy(image, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); + H5MM_memcpy(image, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); image += H5_SIZEOF_MAGIC; /* Version # */ @@ -1362,7 +1362,7 @@ H5HF__cache_iblock_serialize(const H5F_t *f, void *_image, size_t len, hdr->f = f; /* Magic number */ - HDmemcpy(image, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); + H5MM_memcpy(image, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); image += H5_SIZEOF_MAGIC; /* Version # */ @@ -1677,7 +1677,7 @@ H5HF__cache_dblock_verify_chksum(const void *_image, size_t len, void *_udata) /* Set up parameters for filter pipeline */ nbytes = len; filter_mask = udata->filter_mask; - HDmemcpy(read_buf, image, len); + H5MM_memcpy(read_buf, image, len); /* Push direct block data through I/O filter pipeline */ if(H5Z_pipeline(&(hdr->pline), H5Z_FLAG_REVERSE, &filter_mask, H5Z_ENABLE_EDC, filter_cb, &nbytes, &len, &read_buf) < 0) @@ -1724,7 +1724,7 @@ H5HF__cache_dblock_verify_chksum(const void *_image, size_t len, void *_udata) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") /* Copy un-filtered data into block's buffer */ - HDmemcpy(udata->dblk, read_buf, len); + H5MM_memcpy(udata->dblk, read_buf, len); } /* end if */ done: @@ -1829,7 +1829,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, NULL, "memory allocation failed for pipeline buffer") /* Copy compressed image into buffer */ - HDmemcpy(read_buf, image, len); + H5MM_memcpy(read_buf, image, len); /* Push direct block data through I/O filter pipeline */ nbytes = len; @@ -1841,7 +1841,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, HDassert(nbytes == dblock->size); /* Copy un-filtered data into block's buffer */ - HDmemcpy(dblock->blk, read_buf, dblock->size); + H5MM_memcpy(dblock->blk, read_buf, dblock->size); } /* end if */ } /* end if */ else { @@ -1856,7 +1856,7 @@ H5HF__cache_dblock_deserialize(const void *_image, size_t len, void *_udata, /* Copy image to dblock->blk */ HDassert(dblock->size == len); - HDmemcpy(dblock->blk, image, dblock->size); + H5MM_memcpy(dblock->blk, image, dblock->size); } /* end else */ /* Start decoding direct block */ @@ -2146,7 +2146,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, image = dblock->blk; /* Magic number */ - HDmemcpy(image, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); + H5MM_memcpy(image, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC); image += H5_SIZEOF_MAGIC; /* Version # */ @@ -2201,7 +2201,7 @@ H5HF__cache_dblock_pre_serialize(H5F_t *f, void *_thing, HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline buffer") /* Copy the direct block's image into the buffer to compress */ - HDmemcpy(write_buf, dblock->blk, write_size); + H5MM_memcpy(write_buf, dblock->blk, write_size); /* Push direct block data through I/O filter pipeline */ nbytes = write_size; @@ -2460,7 +2460,7 @@ H5HF__cache_dblock_serialize(const H5F_t *f, void *image, size_t len, HDassert(dblock->write_size == len); /* Copy the image from *(dblock->write_buf) to *image */ - HDmemcpy(image, dblock->write_buf, dblock->write_size); + H5MM_memcpy(image, dblock->write_buf, dblock->write_size); /* Free *(dblock->write_buf) if it was allocated by the * pre-serialize function diff --git a/src/H5HFhdr.c b/src/H5HFhdr.c index 8166d88..57dacab 100644 --- a/src/H5HFhdr.c +++ b/src/H5HFhdr.c @@ -387,7 +387,7 @@ H5HF_hdr_create(H5F_t *f, const H5HF_create_t *cparam) /* Set the creation parameters for the heap */ hdr->max_man_size = cparam->max_man_size; hdr->checksum_dblocks = cparam->checksum_dblocks; - HDmemcpy(&(hdr->man_dtable.cparam), &(cparam->managed), sizeof(H5HF_dtable_cparam_t)); + H5MM_memcpy(&(hdr->man_dtable.cparam), &(cparam->managed), sizeof(H5HF_dtable_cparam_t)); /* Set root table address to indicate that the heap is empty currently */ hdr->man_dtable.table_addr = HADDR_UNDEF; diff --git a/src/H5HFhuge.c b/src/H5HFhuge.c index 6e475ad..d496d62 100644 --- a/src/H5HFhuge.c +++ b/src/H5HFhuge.c @@ -355,7 +355,7 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); write_size = obj_size; if(NULL == (write_buf = H5MM_malloc(write_size))) HGOTO_ERROR(H5E_HEAP, H5E_NOSPACE, FAIL, "memory allocation failed for pipeline buffer") - HDmemcpy(write_buf, obj, write_size); + H5MM_memcpy(write_buf, obj, write_size); /* Push direct block data through I/O filter pipeline */ nbytes = write_size; @@ -794,7 +794,7 @@ H5HF__huge_op_real(H5HF_hdr_t *hdr, const uint8_t *id, hbool_t is_read, /* Copy object to user's buffer if there's filters on heap data */ /* (if there's no filters, the object was read directly into the user's buffer) */ if(hdr->filter_len > 0) - HDmemcpy(op_data, read_buf, (size_t)obj_size); + H5MM_memcpy(op_data, read_buf, (size_t)obj_size); } /* end if */ else { /* Call the user's 'op' callback */ diff --git a/src/H5HFman.c b/src/H5HFman.c index 7f90f49..e5b5cb8 100644 --- a/src/H5HFman.c +++ b/src/H5HFman.c @@ -183,7 +183,7 @@ H5HF__man_insert(H5HF_hdr_t *hdr, size_t obj_size, const void *obj, void *_id) p = dblock->blk + blk_off; /* Copy the object's data into the heap */ - HDmemcpy(p, obj, obj_size); + H5MM_memcpy(p, obj, obj_size); p += obj_size; /* Sanity check */ diff --git a/src/H5HFsection.c b/src/H5HFsection.c index 36e966e..f5ac8e5 100644 --- a/src/H5HFsection.c +++ b/src/H5HFsection.c @@ -3082,7 +3082,7 @@ H5HF__sect_indirect_reduce_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect, HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "allocation failed for row section pointer array") /* Transfer row sections between current & peer sections */ - HDmemcpy(&peer_sect->u.indirect.dir_rows[0], + H5MM_memcpy(&peer_sect->u.indirect.dir_rows[0], §->u.indirect.dir_rows[0], (sizeof(H5HF_free_section_t *) * peer_dir_nrows)); HDmemmove(§->u.indirect.dir_rows[0], @@ -3321,7 +3321,7 @@ H5HF__sect_indirect_reduce(H5HF_hdr_t *hdr, H5HF_free_section_t *sect, HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, FAIL, "allocation failed for indirect section pointer array") /* Transfer child indirect sections between current & peer sections */ - HDmemcpy(&peer_sect->u.indirect.indir_ents[0], + H5MM_memcpy(&peer_sect->u.indirect.indir_ents[0], §->u.indirect.indir_ents[sect->u.indirect.indir_nents - peer_nentries], (sizeof(H5HF_free_section_t *) * peer_nentries)); sect->u.indirect.indir_nents -= (peer_nentries + 1); /* Transferred blocks, plus child entry */ @@ -3636,7 +3636,7 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1, sect1->u.indirect.dir_rows = new_dir_rows; /* Transfer the second section's rows to first section */ - HDmemcpy(§1->u.indirect.dir_rows[sect1->u.indirect.dir_nrows], + H5MM_memcpy(§1->u.indirect.dir_rows[sect1->u.indirect.dir_nrows], §2->u.indirect.dir_rows[src_row2], (sizeof(H5HF_free_section_t *) * nrows_moved2)); @@ -3682,7 +3682,7 @@ H5HF__sect_indirect_merge_row(H5HF_hdr_t *hdr, H5HF_free_section_t *row_sect1, sect1->u.indirect.indir_ents = new_indir_ents; /* Transfer the second section's entries to first section */ - HDmemcpy(§1->u.indirect.indir_ents[sect1->u.indirect.indir_nents], + H5MM_memcpy(§1->u.indirect.indir_ents[sect1->u.indirect.indir_nents], §2->u.indirect.indir_ents[0], (sizeof(H5HF_free_section_t *) * sect2->u.indirect.indir_nents)); } /* end else */ diff --git a/src/H5HFtest.c b/src/H5HFtest.c index c0ae1f3..a257b7f 100644 --- a/src/H5HFtest.c +++ b/src/H5HFtest.c @@ -100,7 +100,7 @@ H5HF_get_cparam_test(const H5HF_t *fh, H5HF_create_t *cparam) else H5_CHECKED_ASSIGN(cparam->id_len, uint16_t, fh->hdr->id_len, unsigned); cparam->max_man_size = fh->hdr->max_man_size; - HDmemcpy(&(cparam->managed), &(fh->hdr->man_dtable.cparam), sizeof(H5HF_dtable_cparam_t)); + H5MM_memcpy(&(cparam->managed), &(fh->hdr->man_dtable.cparam), sizeof(H5HF_dtable_cparam_t)); H5O_msg_copy(H5O_PLINE_ID, &(fh->hdr->pline), &(cparam->pline)); FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c index 5cf1c08..1407861 100644 --- a/src/H5HFtiny.c +++ b/src/H5HFtiny.c @@ -176,7 +176,7 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); *id++ = enc_obj_size & H5HF_TINY_MASK_EXT_2; } /* end else */ - HDmemcpy(id, obj, obj_size); + H5MM_memcpy(id, obj, obj_size); HDmemset(id + obj_size, 0, (hdr->id_len - ((size_t)1 + (size_t)hdr->tiny_len_extended + obj_size))); /* Update statistics about heap */ diff --git a/src/H5HG.c b/src/H5HG.c index 29cd90f..5a8b4e2 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -168,7 +168,7 @@ H5HG__create(H5F_t *f, size_t size) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") /* Initialize the header */ - HDmemcpy(heap->chunk, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC); + H5MM_memcpy(heap->chunk, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC); p = heap->chunk + H5_SIZEOF_MAGIC; *p++ = H5HG_VERSION; *p++ = 0; /*reserved*/ @@ -553,7 +553,7 @@ H5HG_insert(H5F_t *f, size_t size, void *obj, H5HG_t *hobj/*out*/) /* Copy data into the heap */ if(size > 0) { - HDmemcpy(heap->obj[idx].begin + H5HG_SIZEOF_OBJHDR(f), obj, size); + H5MM_memcpy(heap->obj[idx].begin + H5HG_SIZEOF_OBJHDR(f), obj, size); #ifdef OLD_WAY /* Don't bother zeroing out the rest of the info in the heap -QAK */ HDmemset(heap->obj[idx].begin + H5HG_SIZEOF_OBJHDR(f) + size, 0, @@ -618,7 +618,7 @@ H5HG_read(H5F_t *f, H5HG_t *hobj, void *object/*out*/, size_t *buf_size) /* Allocate a buffer for the object read in, if the user didn't give one */ if(!object && NULL == (object = H5MM_malloc(size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - HDmemcpy(object, p, size); + H5MM_memcpy(object, p, size); /* * Advance the heap in the CWFS list. We might have done this already diff --git a/src/H5HGcache.c b/src/H5HGcache.c index 3a770ae..44c7a82 100644 --- a/src/H5HGcache.c +++ b/src/H5HGcache.c @@ -271,7 +271,7 @@ H5HG__cache_heap_deserialize(const void *_image, size_t len, void *_udata, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy the image buffer into the newly allocate chunk */ - HDmemcpy(heap->chunk, _image, len); + H5MM_memcpy(heap->chunk, _image, len); /* Deserialize the heap's header */ if(H5HG__hdr_deserialize(heap, (const uint8_t *)heap->chunk, f) < 0) @@ -448,7 +448,7 @@ H5HG__cache_heap_serialize(const H5F_t *f, void *image, size_t len, HDassert(heap->chunk); /* copy the image into the buffer */ - HDmemcpy(image, heap->chunk, len); + H5MM_memcpy(image, heap->chunk, len); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HG__cache_heap_serialize() */ diff --git a/src/H5HL.c b/src/H5HL.c index 735077c..f290294 100644 --- a/src/H5HL.c +++ b/src/H5HL.c @@ -725,7 +725,7 @@ H5HL_insert(H5F_t *f, H5HL_t *heap, size_t buf_size, const void *buf)) } /* end if */ /* Copy the data into the heap */ - HDmemcpy(heap->dblk_image + offset, buf, buf_size); + H5MM_memcpy(heap->dblk_image + offset, buf, buf_size); /* Set return value */ ret_value = offset; diff --git a/src/H5HLcache.c b/src/H5HLcache.c index 926f787..2841a4c 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -464,7 +464,7 @@ H5HL__cache_prefix_deserialize(const void *_image, size_t len, void *_udata, image = ((const uint8_t *)_image) + heap->prfx_size; /* Copy the heap data from the speculative read buffer */ - HDmemcpy(heap->dblk_image, image, heap->dblk_size); + H5MM_memcpy(heap->dblk_image, image, heap->dblk_size); /* Build free list */ if(H5HL__fl_deserialize(heap) < 0) @@ -587,7 +587,7 @@ H5HL__cache_prefix_serialize(const H5F_t *f, void *_image, size_t len, heap->free_block = heap->freelist ? heap->freelist->offset : H5HL_FREE_NULL; /* Serialize the heap prefix */ - HDmemcpy(image, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC); + H5MM_memcpy(image, H5HL_MAGIC, (size_t)H5_SIZEOF_MAGIC); image += H5_SIZEOF_MAGIC; *image++ = H5HL_VERSION; *image++ = 0; /*reserved*/ @@ -615,7 +615,7 @@ H5HL__cache_prefix_serialize(const H5F_t *f, void *_image, size_t len, H5HL__fl_serialize(heap); /* Copy the heap data block into the cache image */ - HDmemcpy(image, heap->dblk_image, heap->dblk_size); + H5MM_memcpy(image, heap->dblk_image, heap->dblk_size); /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) + heap->dblk_size == len); @@ -756,7 +756,7 @@ H5HL__cache_datablock_deserialize(const void *image, size_t len, void *_udata, HGOTO_ERROR(H5E_HEAP, H5E_CANTALLOC, NULL, "can't allocate data block image buffer"); /* copy the datablock from the read buffer */ - HDmemcpy(heap->dblk_image, image, len); + H5MM_memcpy(heap->dblk_image, image, len); /* Build free list */ if(FAIL == H5HL__fl_deserialize(heap)) @@ -851,7 +851,7 @@ H5HL__cache_datablock_serialize(const H5F_t *f, void *image, size_t len, H5HL__fl_serialize(heap); /* Copy the heap's data block into the cache's image */ - HDmemcpy(image, heap->dblk_image, heap->dblk_size); + H5MM_memcpy(image, heap->dblk_image, heap->dblk_size); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5HL__cache_datablock_serialize() */ diff --git a/src/H5L.c b/src/H5L.c index 7b0bf33..43c1593 100644 --- a/src/H5L.c +++ b/src/H5L.c @@ -1458,7 +1458,7 @@ H5L_register(const H5L_class_t *cls) } /* end if */ /* Copy link class info into table */ - HDmemcpy(H5L_table_g + i, cls, sizeof(H5L_class_t)); + H5MM_memcpy(H5L_table_g + i, cls, sizeof(H5L_class_t)); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2000,7 +2000,7 @@ H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name, /* Fill in UD link-specific information in the link struct*/ if(ud_data_size > 0) { lnk.u.ud.udata = H5MM_malloc((size_t)ud_data_size); - HDmemcpy(lnk.u.ud.udata, ud_data, (size_t) ud_data_size); + H5MM_memcpy(lnk.u.ud.udata, ud_data, (size_t) ud_data_size); } /* end if */ else lnk.u.ud.udata = NULL; diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c index 4f6eeba..7f978e8 100644 --- a/src/H5Lexternal.c +++ b/src/H5Lexternal.c @@ -298,7 +298,7 @@ H5L__extern_query(const char H5_ATTR_UNUSED * link_name, const void *_udata, siz buf_size = udata_size; /* Copy the udata verbatim up to buf_size */ - HDmemcpy(buf, udata, buf_size); + H5MM_memcpy(buf, udata, buf_size); } /* end if */ /* Set return value */ diff --git a/src/H5MM.c b/src/H5MM.c index 0f01b3f..7eb1023 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -108,8 +108,8 @@ static H5MM_block_t H5MM_block_head_s; /* Statistics about block allocations */ static unsigned long long H5MM_total_alloc_bytes_s = 0; -static unsigned long long H5MM_curr_alloc_bytes_s = 0; -static unsigned long long H5MM_peak_alloc_bytes_s = 0; +static size_t H5MM_curr_alloc_bytes_s = 0; +static size_t H5MM_peak_alloc_bytes_s = 0; static size_t H5MM_max_block_size_s = 0; static size_t H5MM_total_alloc_blocks_count_s = 0; static size_t H5MM_curr_alloc_blocks_count_s = 0; @@ -254,7 +254,7 @@ H5MM_final_sanity_check(void) * difficult to check as a return value. This is still * considered an error condition since allocations of zero * bytes usually indicate problems. - * + * * Return: Success: Pointer to new memory * Failure: NULL * @@ -274,7 +274,7 @@ H5MM_malloc(size_t size) #if defined H5_MEMORY_ALLOC_SANITY_CHECK /* Initialize block list head singleton */ if(!H5MM_init_s) { - HDmemcpy(H5MM_block_head_s.sig, H5MM_block_signature_s, H5MM_SIG_SIZE); + H5MM_memcpy(H5MM_block_head_s.sig, H5MM_block_signature_s, H5MM_SIG_SIZE); H5MM_block_head_s.next = &H5MM_block_head_s; H5MM_block_head_s.prev = &H5MM_block_head_s; H5MM_block_head_s.u.info.size = SIZET_MAX; @@ -291,15 +291,15 @@ H5MM_malloc(size_t size) if(NULL != (block = (H5MM_block_t *)HDmalloc(alloc_size))) { /* Set up block */ - HDmemcpy(block->sig, H5MM_block_signature_s, H5MM_SIG_SIZE); + H5MM_memcpy(block->sig, H5MM_block_signature_s, H5MM_SIG_SIZE); block->next = H5MM_block_head_s.next; H5MM_block_head_s.next = block; block->next->prev = block; block->prev = &H5MM_block_head_s; block->u.info.size = size; block->u.info.in_use = TRUE; - HDmemcpy(block->b, H5MM_block_head_guard_s, H5MM_HEAD_GUARD_SIZE); - HDmemcpy(block->b + H5MM_HEAD_GUARD_SIZE + size, H5MM_block_tail_guard_s, H5MM_TAIL_GUARD_SIZE); + H5MM_memcpy(block->b, H5MM_block_head_guard_s, H5MM_HEAD_GUARD_SIZE); + H5MM_memcpy(block->b + H5MM_HEAD_GUARD_SIZE + size, H5MM_block_tail_guard_s, H5MM_TAIL_GUARD_SIZE); /* Update statistics */ H5MM_total_alloc_bytes_s += size; @@ -417,7 +417,7 @@ H5MM_realloc(void *mem, size_t size) H5MM__sanity_check(mem); ret_value = H5MM_malloc(size); - HDmemcpy(ret_value, mem, MIN(size, old_size)); + H5MM_memcpy(ret_value, mem, MIN(size, old_size)); H5MM_xfree(mem); } /* end if */ else @@ -564,3 +564,65 @@ H5MM_xfree(void *mem) FUNC_LEAVE_NOAPI(NULL) } /* end H5MM_xfree() */ + +/*------------------------------------------------------------------------- + * Function: H5MM_xfree_const + * + * Purpose: H5MM_xfree() wrapper that handles const pointers without + * warnings. Used for freeing buffers that should be regarded + * as const in use but need to be freed when no longer needed. + * + * Return: Success: NULL + * Failure: never fails + * + *------------------------------------------------------------------------- + */ +void * +H5MM_xfree_const(const void *mem) +{ + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + /* Cast through uintptr_t to de-const memory */ + H5MM_xfree((void *)(uintptr_t)mem); + + FUNC_LEAVE_NOAPI(NULL) +} /* end H5MM_xfree_const() */ + + +/*------------------------------------------------------------------------- + * Function: H5MM_memcpy + * + * Purpose: Like memcpy(3) but with sanity checks on the parameters, + * particularly buffer overlap. + * + * Return: Success: pointer to dest + * Failure: NULL + * + * Programmer: Dana Robinson + * Spring 2019 + * + *------------------------------------------------------------------------- + */ +void * +H5MM_memcpy(void *dest, const void *src, size_t n) +{ + void *ret = NULL; + + /* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */ + FUNC_ENTER_NOAPI_NOINIT_NOERR + + HDassert(dest); + HDassert(src); + + /* Check for buffer overlap */ + HDassert((char *)dest >= (const char *)src + n || (const char *)src >= (char *)dest + n); + + /* Copy */ + ret = HDmemcpy(dest, src, n); + + FUNC_LEAVE_NOAPI(ret) + +} /* end H5MM_memcpy() */ + + diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h index 0524601..240b931 100644 --- a/src/H5MMprivate.h +++ b/src/H5MMprivate.h @@ -45,6 +45,8 @@ H5_DLL void *H5MM_realloc(void *mem, size_t size); H5_DLL char *H5MM_xstrdup(const char *s); H5_DLL char *H5MM_strdup(const char *s); H5_DLL void *H5MM_xfree(void *mem); +H5_DLL void *H5MM_xfree_const(const void *mem); +H5_DLL void *H5MM_memcpy(void *dest, const void *src, size_t n); #if defined H5_MEMORY_ALLOC_SANITY_CHECK H5_DLL void H5MM_sanity_check_all(void); H5_DLL void H5MM_final_sanity_check(void); diff --git a/src/H5Oalloc.c b/src/H5Oalloc.c index 570e16d..6ab8305 100644 --- a/src/H5Oalloc.c +++ b/src/H5Oalloc.c @@ -949,7 +949,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, * # at the beginning of the chunk image. */ if(oh->version > H5O_VERSION_1) { - HDmemcpy(p, H5O_CHK_MAGIC, (size_t)H5_SIZEOF_MAGIC); + H5MM_memcpy(p, H5O_CHK_MAGIC, (size_t)H5_SIZEOF_MAGIC); p += H5_SIZEOF_MAGIC; } /* end if */ @@ -988,7 +988,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, HDassert(curr_msg->type->id != H5O_CONT_ID); /* Copy the raw data */ - HDmemcpy(p, curr_msg->raw - (size_t)H5O_SIZEOF_MSGHDR_OH(oh), + H5MM_memcpy(p, curr_msg->raw - (size_t)H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh)); /* Update the message info */ @@ -1044,7 +1044,7 @@ H5O__alloc_chunk(H5F_t *f, H5O_t *oh, size_t size, size_t found_null, null_msg->chunkno = oh->mesg[found_msg->msgno].chunkno; /* Copy the message to move (& its prefix) to its new location */ - HDmemcpy(p, oh->mesg[found_msg->msgno].raw - H5O_SIZEOF_MSGHDR_OH(oh), + H5MM_memcpy(p, oh->mesg[found_msg->msgno].raw - H5O_SIZEOF_MSGHDR_OH(oh), oh->mesg[found_msg->msgno].raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh)); /* Switch moved message to point to new location */ @@ -1519,7 +1519,7 @@ H5O_move_cont(H5F_t *f, H5O_t *oh, unsigned cont_u) move_size = curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh); /* Move message out of deleted chunk */ - HDmemcpy(move_start, curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), move_size); + H5MM_memcpy(move_start, curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), move_size); curr_msg->raw = move_start + H5O_SIZEOF_MSGHDR_OH(oh); curr_msg->chunkno = cont_chunkno; chk_dirtied = TRUE; @@ -1791,7 +1791,7 @@ H5O_move_msgs_forward(H5F_t *f, H5O_t *oh) } /* end if */ /* Copy raw data for non-null message to new chunk */ - HDmemcpy(null_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh)); + H5MM_memcpy(null_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw - H5O_SIZEOF_MSGHDR_OH(oh), curr_msg->raw_size + (size_t)H5O_SIZEOF_MSGHDR_OH(oh)); /* Point non-null message at null message's space */ curr_msg->chunkno = null_msg->chunkno; diff --git a/src/H5Oattr.c b/src/H5Oattr.c index 41c467c..5084c37 100644 --- a/src/H5Oattr.c +++ b/src/H5Oattr.c @@ -208,7 +208,7 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "can't decode attribute dataspace") /* Copy the extent information to the dataspace */ - HDmemcpy(&(attr->shared->ds->extent), extent, sizeof(H5S_extent_t)); + H5MM_memcpy(&(attr->shared->ds->extent), extent, sizeof(H5S_extent_t)); /* Release temporary extent information */ extent = H5FL_FREE(H5S_extent_t, extent); @@ -240,7 +240,7 @@ H5O_attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, if(attr->shared->data_size) { if(NULL == (attr->shared->data = H5FL_BLK_MALLOC(attr_buf, attr->shared->data_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - HDmemcpy(attr->shared->data, p, attr->shared->data_size); + H5MM_memcpy(attr->shared->data, p, attr->shared->data_size); } /* end if */ /* Increment the reference count for this object header message in cache(compact @@ -336,7 +336,7 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg) *p++ = (uint8_t)attr->shared->encoding; /* Write the name including null terminator */ - HDmemcpy(p, attr->shared->name, name_len); + H5MM_memcpy(p, attr->shared->name, name_len); if(attr->shared->version < H5O_ATTR_VERSION_2) { /* Pad to the correct number of bytes */ HDmemset(p + name_len, 0, H5O_ALIGN_OLD(name_len) - name_len); @@ -369,7 +369,7 @@ H5O_attr_encode(H5F_t *f, uint8_t *p, const void *mesg) /* Store attribute data. If there's no data, store 0 as fill value. */ if(attr->shared->data) - HDmemcpy(p, attr->shared->data, attr->shared->data_size); + H5MM_memcpy(p, attr->shared->data, attr->shared->data_size); else HDmemset(p, 0, attr->shared->data_size); diff --git a/src/H5Oattribute.c b/src/H5Oattribute.c index 640d1c7..1888e45 100644 --- a/src/H5Oattribute.c +++ b/src/H5Oattribute.c @@ -852,7 +852,7 @@ H5O_attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, /* (Needs to occur before updating the shared message, or the hash * value on the old & new messages will be the same) */ - HDmemcpy(((H5A_t *)mesg->native)->shared->data, udata->attr->shared->data, udata->attr->shared->data_size); + H5MM_memcpy(((H5A_t *)mesg->native)->shared->data, udata->attr->shared->data, udata->attr->shared->data_size); } /* end if */ /* Mark the message as modified */ diff --git a/src/H5Ocache.c b/src/H5Ocache.c index d63ceb1..2c3f4b4 100644 --- a/src/H5Ocache.c +++ b/src/H5Ocache.c @@ -542,7 +542,7 @@ H5O__cache_serialize(const H5F_t *f, void *image, size_t len, void *_thing) * Can we rework things so that the object header and the cache * share a buffer? */ - HDmemcpy(image, oh->chunk[0].image, len); + H5MM_memcpy(image, oh->chunk[0].image, len); done: FUNC_LEAVE_NOAPI(ret_value) @@ -900,7 +900,7 @@ H5O__cache_chk_serialize(const H5F_t *f, void *image, size_t len, void *_thing) /* copy the chunk into the image -- this is potentially expensive. * Can we rework things so that the chunk and the cache share a buffer? */ - HDmemcpy(image, chk_proxy->oh->chunk[chk_proxy->chunkno].image, len); + H5MM_memcpy(image, chk_proxy->oh->chunk[chk_proxy->chunkno].image, len); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1352,7 +1352,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image oh->chunk[chunkno].chunk_proxy = NULL; /* Copy disk image into chunk's image */ - HDmemcpy(oh->chunk[chunkno].image, image, oh->chunk[chunkno].size); + H5MM_memcpy(oh->chunk[chunkno].image, image, oh->chunk[chunkno].size); /* Point into chunk image to decode */ chunk_image = oh->chunk[chunkno].image; diff --git a/src/H5Ocopy.c b/src/H5Ocopy.c index 31f6ebc..f2cf402 100644 --- a/src/H5Ocopy.c +++ b/src/H5Ocopy.c @@ -736,7 +736,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, * header. This will be written when the header is flushed to disk. */ if(oh_dst->version > H5O_VERSION_1) - HDmemcpy(current_pos, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); + H5MM_memcpy(current_pos, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); current_pos += H5O_SIZEOF_HDR(oh_dst) - H5O_SIZEOF_CHKSUM_OH(oh_dst); /* Loop through destination messages, updating their "raw" info */ @@ -759,7 +759,7 @@ H5O__copy_header_real(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out*/, /* Copy each message that wasn't dirtied above */ if(!mesg_dst->dirty) /* Copy the message header plus the message's raw data. */ - HDmemcpy(current_pos, mesg_src->raw - msghdr_size, msghdr_size + mesg_src->raw_size); + H5MM_memcpy(current_pos, mesg_src->raw - msghdr_size, msghdr_size + mesg_src->raw_size); /* Set message's raw pointer to destination chunk's new "image" */ mesg_dst->raw = current_pos + msghdr_size; diff --git a/src/H5Odrvinfo.c b/src/H5Odrvinfo.c index 159c950..eb678e4 100644 --- a/src/H5Odrvinfo.c +++ b/src/H5Odrvinfo.c @@ -101,7 +101,7 @@ H5O_drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for driver info message") /* Retrieve driver name */ - HDmemcpy(mesg->name, p, 8); + H5MM_memcpy(mesg->name, p, 8); mesg->name[8] = '\0'; p += 8; @@ -116,7 +116,7 @@ H5O_drvinfo_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, } /* end if */ /* Copy encoded driver info into buffer */ - HDmemcpy(mesg->buf, p, mesg->len); + H5MM_memcpy(mesg->buf, p, mesg->len); /* Set return value */ ret_value = (void *)mesg; @@ -152,11 +152,11 @@ H5O_drvinfo_encode(H5F_t H5_ATTR_UNUSED *f, hbool_t H5_ATTR_UNUSED disable_share /* Store version, driver name, buffer length, & encoded buffer */ *p++ = H5O_DRVINFO_VERSION; - HDmemcpy(p, mesg->name, 8); + H5MM_memcpy(p, mesg->name, 8); p += 8; HDassert(mesg->len <= 65535); UINT16ENCODE(p, mesg->len); - HDmemcpy(p, mesg->buf, mesg->len); + H5MM_memcpy(p, mesg->buf, mesg->len); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_drvinfo_encode() */ @@ -200,7 +200,7 @@ H5O_drvinfo_copy(const void *_mesg, void *_dest) dest = (H5O_drvinfo_t *)H5MM_xfree(dest); HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") } /* end if */ - HDmemcpy(dest->buf, mesg->buf, mesg->len); + H5MM_memcpy(dest->buf, mesg->buf, mesg->len); /* Set return value */ ret_value = dest; diff --git a/src/H5Odtype.c b/src/H5Odtype.c index 4cf5067..a349cc5 100644 --- a/src/H5Odtype.c +++ b/src/H5Odtype.c @@ -250,7 +250,7 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p HDassert(0 == (z & 0x7)); /*must be aligned*/ if(NULL == (dt->shared->u.opaque.tag = (char *)H5MM_malloc(z + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") - HDmemcpy(dt->shared->u.opaque.tag, *pp, z); + H5MM_memcpy(dt->shared->u.opaque.tag, *pp, z); dt->shared->u.opaque.tag[z] = '\0'; *pp += z; break; @@ -483,7 +483,7 @@ H5O_dtype_decode_helper(H5F_t *f, unsigned *ioflags/*in,out*/, const uint8_t **p } /* end for */ /* Values */ - HDmemcpy(dt->shared->u.enumer.value, *pp, + H5MM_memcpy(dt->shared->u.enumer.value, *pp, dt->shared->u.enumer.nmembs * dt->shared->parent->shared->size); *pp += dt->shared->u.enumer.nmembs * dt->shared->parent->shared->size; break; @@ -882,7 +882,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) z = HDstrlen(dt->shared->u.opaque.tag); aligned = (z + 7) & (H5T_OPAQUE_TAG_MAX - 8); flags = (unsigned)(flags | aligned); - HDmemcpy(*pp, dt->shared->u.opaque.tag, MIN(z,aligned)); + H5MM_memcpy(*pp, dt->shared->u.opaque.tag, MIN(z,aligned)); for(n = MIN(z, aligned); n < aligned; n++) (*pp)[n] = 0; *pp += aligned; @@ -997,7 +997,7 @@ H5O_dtype_encode_helper(const H5F_t *f, uint8_t **pp, const H5T_t *dt) } /* end for */ /* Values */ - HDmemcpy(*pp, dt->shared->u.enumer.value, dt->shared->u.enumer.nmembs * dt->shared->parent->shared->size); + H5MM_memcpy(*pp, dt->shared->u.enumer.value, dt->shared->u.enumer.nmembs * dt->shared->parent->shared->size); *pp += dt->shared->u.enumer.nmembs * dt->shared->parent->shared->size; break; diff --git a/src/H5Oefl.c b/src/H5Oefl.c index 6a81a46..b18d819 100644 --- a/src/H5Oefl.c +++ b/src/H5Oefl.c @@ -461,7 +461,7 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy the "top level" information */ - HDmemcpy(efl_dst, efl_src, sizeof(H5O_efl_t)); + H5MM_memcpy(efl_dst, efl_src, sizeof(H5O_efl_t)); /* Determine size needed for destination heap */ heap_size = H5HL_ALIGN(1); /* "empty" name */ @@ -488,7 +488,7 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* copy content from the source. Need to update later */ - HDmemcpy(efl_dst->slot, efl_src->slot, size); + H5MM_memcpy(efl_dst->slot, efl_src->slot, size); } /* end if */ /* copy the name from the source */ diff --git a/src/H5Ofill.c b/src/H5Ofill.c index 43285c3..c1ea021 100644 --- a/src/H5Ofill.c +++ b/src/H5Ofill.c @@ -232,7 +232,7 @@ H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "destination buffer too small") if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value") - HDmemcpy(fill->buf, p, (size_t)fill->size); + H5MM_memcpy(fill->buf, p, (size_t)fill->size); } /* end if */ } /* end if */ else @@ -270,7 +270,7 @@ H5O_fill_new_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t); if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value") - HDmemcpy(fill->buf, p, (size_t)fill->size); + H5MM_memcpy(fill->buf, p, (size_t)fill->size); /* Set the "defined" flag */ fill->fill_defined = TRUE; @@ -353,7 +353,7 @@ H5O_fill_old_decode(H5F_t *f, H5O_t *open_oh, if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value") - HDmemcpy(fill->buf, p, (size_t)fill->size); + H5MM_memcpy(fill->buf, p, (size_t)fill->size); fill->fill_defined = TRUE; } /* end if */ else @@ -420,7 +420,7 @@ H5O_fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) if(fill->size > 0) if(fill->buf) { H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t); - HDmemcpy(p, fill->buf, (size_t)fill->size); + H5MM_memcpy(p, fill->buf, (size_t)fill->size); } /* end if */ } /* end if */ } /* end if */ @@ -459,7 +459,7 @@ H5O_fill_new_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) /* Encode the fill value */ HDassert(fill->buf); H5_CHECK_OVERFLOW(fill->size, ssize_t, size_t); - HDmemcpy(p, fill->buf, (size_t)fill->size); + H5MM_memcpy(p, fill->buf, (size_t)fill->size); } /* end if */ else { /* Flags */ @@ -499,7 +499,7 @@ H5O_fill_old_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p, const void *_fill) UINT32ENCODE(p, fill->size); if(fill->buf) - HDmemcpy(p, fill->buf, (size_t)fill->size); + H5MM_memcpy(p, fill->buf, (size_t)fill->size); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5O_fill_old_encode() */ @@ -551,7 +551,7 @@ H5O_fill_copy(const void *_src, void *_dst) H5_CHECK_OVERFLOW(src->size, ssize_t, size_t); if(NULL == (dst->buf = H5MM_malloc((size_t)src->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for fill value") - HDmemcpy(dst->buf, src->buf, (size_t)src->size); + H5MM_memcpy(dst->buf, src->buf, (size_t)src->size); /* Check for needing to convert/copy fill value */ if(src->type) { @@ -1025,7 +1025,7 @@ H5O_fill_convert(H5O_fill_t *fill, H5T_t *dset_type, hbool_t *fill_changed) else { if(NULL == (buf = H5MM_malloc(H5T_get_size(dset_type)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion") - HDmemcpy(buf, fill->buf, H5T_get_size(fill->type)); + H5MM_memcpy(buf, fill->buf, H5T_get_size(fill->type)); } /* end else */ /* Use CALLOC here to clear the buffer in case later the library thinks there's diff --git a/src/H5Oint.c b/src/H5Oint.c index b49cc8f..ed4ef19 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -501,7 +501,7 @@ H5O__apply_ohdr(H5F_t *f, H5O_t *oh, hid_t ocpl_id, size_t size_hint, size_t ini /* Put magic # for object header in first chunk */ if(oh->version > H5O_VERSION_1) - HDmemcpy(oh->chunk[0].image, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); + H5MM_memcpy(oh->chunk[0].image, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC); /* Create the message list */ oh->nmesgs = 1; @@ -1952,7 +1952,7 @@ H5O_loc_copy_shallow(H5O_loc_t *dst, H5O_loc_t *src) HDassert(dst); /* Copy the top level information */ - HDmemcpy(dst, src, sizeof(H5O_loc_t)); + H5MM_memcpy(dst, src, sizeof(H5O_loc_t)); /* Reset the source location, as the destination 'owns' it now */ H5O_loc_reset(src); @@ -1986,7 +1986,7 @@ H5O_loc_copy_deep(H5O_loc_t *dst, const H5O_loc_t *src) HDassert(dst); /* Copy the top level information */ - HDmemcpy(dst, src, sizeof(H5O_loc_t)); + H5MM_memcpy(dst, src, sizeof(H5O_loc_t)); /* If the original entry was holding open the file, this one should * hold it open, too. diff --git a/src/H5Olayout.c b/src/H5Olayout.c index 56ebb32..2866267 100644 --- a/src/H5Olayout.c +++ b/src/H5Olayout.c @@ -189,7 +189,7 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, if(mesg->storage.u.compact.size > 0) { if(NULL == (mesg->storage.u.compact.buf = H5MM_malloc(mesg->storage.u.compact.size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for compact data buffer") - HDmemcpy(mesg->storage.u.compact.buf, p, mesg->storage.u.compact.size); + H5MM_memcpy(mesg->storage.u.compact.buf, p, mesg->storage.u.compact.size); p += mesg->storage.u.compact.size; } /* end if */ } /* end if */ @@ -210,7 +210,7 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, NULL, "memory allocation failed for compact data buffer") /* Compact data */ - HDmemcpy(mesg->storage.u.compact.buf, p, mesg->storage.u.compact.size); + H5MM_memcpy(mesg->storage.u.compact.buf, p, mesg->storage.u.compact.size); p += mesg->storage.u.compact.size; } /* end if */ @@ -425,14 +425,14 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, tmp_size = HDstrlen((const char *)heap_block_p) + 1; if(NULL == (mesg->storage.u.virt.list[i].source_file_name = (char *)H5MM_malloc(tmp_size))) HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, NULL, "unable to allocate memory for source file name") - (void)HDmemcpy(mesg->storage.u.virt.list[i].source_file_name, heap_block_p, tmp_size); + H5MM_memcpy(mesg->storage.u.virt.list[i].source_file_name, heap_block_p, tmp_size); heap_block_p += tmp_size; /* Source dataset name */ tmp_size = HDstrlen((const char *)heap_block_p) + 1; if(NULL == (mesg->storage.u.virt.list[i].source_dset_name = (char *)H5MM_malloc(tmp_size))) HGOTO_ERROR(H5E_OHDR, H5E_RESOURCE, NULL, "unable to allocate memory for source dataset name") - (void)HDmemcpy(mesg->storage.u.virt.list[i].source_dset_name, heap_block_p, tmp_size); + H5MM_memcpy(mesg->storage.u.virt.list[i].source_dset_name, heap_block_p, tmp_size); heap_block_p += tmp_size; /* Source selection */ @@ -583,7 +583,7 @@ H5O__layout_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, /* Raw data */ if(mesg->storage.u.compact.size > 0) { if(mesg->storage.u.compact.buf) - HDmemcpy(p, mesg->storage.u.compact.buf, mesg->storage.u.compact.size); + H5MM_memcpy(p, mesg->storage.u.compact.buf, mesg->storage.u.compact.size); else HDmemset(p, 0, mesg->storage.u.compact.size); p += mesg->storage.u.compact.size; @@ -748,7 +748,7 @@ H5O__layout_copy(const void *_mesg, void *_dest) HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "unable to allocate memory for compact dataset") /* Copy over the raw data */ - HDmemcpy(dest->storage.u.compact.buf, mesg->storage.u.compact.buf, dest->storage.u.compact.size); + H5MM_memcpy(dest->storage.u.compact.buf, mesg->storage.u.compact.buf, dest->storage.u.compact.size); } /* end if */ else HDassert(dest->storage.u.compact.buf == NULL); diff --git a/src/H5Olink.c b/src/H5Olink.c index 77ed0c3..10479e6 100644 --- a/src/H5Olink.c +++ b/src/H5Olink.c @@ -202,7 +202,7 @@ H5O__link_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, /* Get the link's name */ if(NULL == (lnk->name = (char *)H5MM_malloc(len + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - HDmemcpy(lnk->name, p, len); + H5MM_memcpy(lnk->name, p, len); lnk->name[len] = '\0'; p += len; @@ -220,7 +220,7 @@ H5O__link_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, NULL, "invalid link length") if(NULL == (lnk->u.soft.name = (char *)H5MM_malloc((size_t)len + 1))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - HDmemcpy(lnk->u.soft.name, p, len); + H5MM_memcpy(lnk->u.soft.name, p, len); lnk->u.soft.name[len] = '\0'; p += len; break; @@ -240,7 +240,7 @@ H5O__link_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, { if(NULL == (lnk->u.ud.udata = H5MM_malloc((size_t)len))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - HDmemcpy(lnk->u.ud.udata, p, len); + H5MM_memcpy(lnk->u.ud.udata, p, len); p += len; } else @@ -349,7 +349,7 @@ H5O_link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con } /* end switch */ /* Store the link's name */ - HDmemcpy(p, lnk->name, (size_t)len); + H5MM_memcpy(p, lnk->name, (size_t)len); p += len; /* Store the appropriate information for each type of link */ @@ -364,7 +364,7 @@ H5O_link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con len = (uint16_t)HDstrlen(lnk->u.soft.name); HDassert(len > 0); UINT16ENCODE(p, len) - HDmemcpy(p, lnk->u.soft.name, (size_t)len); + H5MM_memcpy(p, lnk->u.soft.name, (size_t)len); p += len; break; @@ -380,7 +380,7 @@ H5O_link_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, con UINT16ENCODE(p, len) if(len > 0) { - HDmemcpy(p, lnk->u.ud.udata, (size_t)len); + H5MM_memcpy(p, lnk->u.ud.udata, (size_t)len); p+=len; } break; @@ -437,7 +437,7 @@ H5O_link_copy(const void *_mesg, void *_dest) if(lnk->u.ud.size > 0) { if(NULL == (dest->u.ud.udata = H5MM_malloc(lnk->u.ud.size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - HDmemcpy(dest->u.ud.udata, lnk->u.ud.udata, lnk->u.ud.size); + H5MM_memcpy(dest->u.ud.udata, lnk->u.ud.udata, lnk->u.ud.size); } /* end if */ } /* end if */ diff --git a/src/H5Opline.c b/src/H5Opline.c index 9a0f5da..0afd028 100644 --- a/src/H5Opline.c +++ b/src/H5Opline.c @@ -318,7 +318,7 @@ H5O_pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p/*out*/, const void *mesg) /* Encode name, if there is one to encode */ if(name_length > 0) { /* Store name, with null terminator */ - HDmemcpy(p, name, name_length); + H5MM_memcpy(p, name, name_length); p += name_length; /* Pad out name to alignment, in older versions */ @@ -409,7 +409,7 @@ H5O_pline_copy(const void *_src, void *_dst/*out*/) if(NULL == (dst->filter[i].cd_values = (unsigned *)H5MM_malloc(src->filter[i].cd_nelmts* sizeof(unsigned)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - HDmemcpy(dst->filter[i].cd_values, src->filter[i].cd_values, + H5MM_memcpy(dst->filter[i].cd_values, src->filter[i].cd_values, src->filter[i].cd_nelmts * sizeof(unsigned)); } /* end if */ else diff --git a/src/H5Oshared.c b/src/H5Oshared.c index 328ba4b..d267777 100644 --- a/src/H5Oshared.c +++ b/src/H5Oshared.c @@ -354,7 +354,7 @@ H5O_shared_decode(H5F_t *f, H5O_t *open_oh, unsigned *ioflags, const uint8_t *bu */ if(sh_mesg.type == H5O_SHARE_TYPE_SOHM) { HDassert(version >= H5O_SHARED_VERSION_3); - HDmemcpy(&sh_mesg.u.heap_id, buf, sizeof(sh_mesg.u.heap_id)); + H5MM_memcpy(&sh_mesg.u.heap_id, buf, sizeof(sh_mesg.u.heap_id)); } /* end if */ else { /* The H5O_COMMITTED_FLAG should be set if this message @@ -422,7 +422,7 @@ H5O_shared_encode(const H5F_t *f, uint8_t *buf/*out*/, const H5O_shared_t *sh_me * object header that holds it. */ if(sh_mesg->type == H5O_SHARE_TYPE_SOHM) - HDmemcpy(buf, &(sh_mesg->u.heap_id), sizeof(sh_mesg->u.heap_id)); + H5MM_memcpy(buf, &(sh_mesg->u.heap_id), sizeof(sh_mesg->u.heap_id)); else H5F_addr_encode(f, &buf, sh_mesg->u.loc.oh_addr); diff --git a/src/H5PB.c b/src/H5PB.c index 8d29951..b43c23b 100644 --- a/src/H5PB.c +++ b/src/H5PB.c @@ -609,7 +609,7 @@ H5PB_update_entry(H5PB_t *page_buf, haddr_t addr, size_t size, const void *buf) HDassert(addr + size <= page_addr + page_buf->page_size); offset = addr - page_addr; - HDmemcpy((uint8_t *)page_entry->page_buf_ptr + offset, buf, size); + H5MM_memcpy((uint8_t *)page_entry->page_buf_ptr + offset, buf, size); /* move to top of LRU list */ H5PB__MOVE_TO_TOP_LRU(page_buf, page_entry) @@ -818,7 +818,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/ offset = addr - first_page_addr; HDassert(page_buf->page_size > offset); - HDmemcpy(buf, (uint8_t *)page_entry->page_buf_ptr + offset, + H5MM_memcpy(buf, (uint8_t *)page_entry->page_buf_ptr + offset, page_buf->page_size - (size_t)offset); /* move to top of LRU list */ @@ -829,7 +829,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/ offset = (num_touched_pages-2)*page_buf->page_size + (page_buf->page_size - (addr - first_page_addr)); - HDmemcpy((uint8_t *)buf + offset, page_entry->page_buf_ptr, + H5MM_memcpy((uint8_t *)buf + offset, page_entry->page_buf_ptr, (size_t)((addr + size) - last_page_addr)); /* move to top of LRU list */ @@ -839,7 +839,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/ else { offset = i*page_buf->page_size; - HDmemcpy((uint8_t *)buf+(i*page_buf->page_size) , page_entry->page_buf_ptr, + H5MM_memcpy((uint8_t *)buf+(i*page_buf->page_size) , page_entry->page_buf_ptr, page_buf->page_size); } /* end else */ } /* end if */ @@ -872,7 +872,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/ buf_offset = (0 == i ? 0 : size - access_size); /* copy the requested data from the page into the input buffer */ - HDmemcpy((uint8_t *)buf + buf_offset, (uint8_t *)page_entry->page_buf_ptr + offset, access_size); + H5MM_memcpy((uint8_t *)buf + buf_offset, (uint8_t *)page_entry->page_buf_ptr + offset, access_size); /* Update LRU */ H5PB__MOVE_TO_TOP_LRU(page_buf, page_entry) @@ -937,7 +937,7 @@ H5PB_read(H5F_t *f, H5FD_mem_t type, haddr_t addr, size_t size, void *buf/*out*/ /* Copy the requested data from the page into the input buffer */ offset = (0 == i ? addr - search_addr : 0); buf_offset = (0 == i ? 0 : size - access_size); - HDmemcpy((uint8_t *)buf + buf_offset, (uint8_t *)new_page_buf + offset, access_size); + H5MM_memcpy((uint8_t *)buf + buf_offset, (uint8_t *)new_page_buf + offset, access_size); /* Create the new PB entry */ if(NULL == (page_entry = H5FL_CALLOC(H5PB_entry_t))) @@ -1102,7 +1102,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, HDassert(page_buf->page_size > offset); /* Update page's data */ - HDmemcpy((uint8_t *)page_entry->page_buf_ptr + offset, buf, page_buf->page_size - (size_t)offset); + H5MM_memcpy((uint8_t *)page_entry->page_buf_ptr + offset, buf, page_buf->page_size - (size_t)offset); /* Mark page dirty and push to top of LRU */ page_entry->is_dirty = TRUE; @@ -1121,7 +1121,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, (page_buf->page_size - (addr - first_page_addr)); /* Update page's data */ - HDmemcpy(page_entry->page_buf_ptr, (const uint8_t *)buf + offset, + H5MM_memcpy(page_entry->page_buf_ptr, (const uint8_t *)buf + offset, (size_t)((addr + size) - last_page_addr)); /* Mark page dirty and push to top of LRU */ @@ -1173,7 +1173,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, buf_offset = (0 == i ? 0 : size - access_size); /* Copy the requested data from the input buffer into the page */ - HDmemcpy((uint8_t *)page_entry->page_buf_ptr + offset, (const uint8_t *)buf + buf_offset, access_size); + H5MM_memcpy((uint8_t *)page_entry->page_buf_ptr + offset, (const uint8_t *)buf + buf_offset, access_size); /* Mark page dirty and push to top of LRU */ page_entry->is_dirty = TRUE; @@ -1289,7 +1289,7 @@ H5PB_write(H5F_t *f, H5FD_mem_t type, haddr_t addr, } /* end else */ /* Copy the requested data from the page into the input buffer */ - HDmemcpy((uint8_t *)new_page_buf + offset, (const uint8_t *)buf+buf_offset, access_size); + H5MM_memcpy((uint8_t *)new_page_buf + offset, (const uint8_t *)buf+buf_offset, access_size); /* Page is dirty now */ page_entry->is_dirty = TRUE; diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c index da06297..c8a0f15 100644 --- a/src/H5Pdapl.c +++ b/src/H5Pdapl.c @@ -341,7 +341,7 @@ H5P__dapl_vds_file_pref_enc(const void *value, void **_pp, size_t *size) /* encode the prefix */ if(NULL != vds_file_pref) { - HDmemcpy(*(char **)pp, vds_file_pref, len); + H5MM_memcpy(*(char **)pp, vds_file_pref, len); *pp += len; } /* end if */ } /* end if */ @@ -589,7 +589,7 @@ H5P__dapl_efile_pref_enc(const void *value, void **_pp, size_t *size) /* encode the prefix */ if(NULL != efile_pref) { - HDmemcpy(*(char **)pp, efile_pref, len); + H5MM_memcpy(*(char **)pp, efile_pref, len); *pp += len; } /* end if */ } /* end if */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index b5ae02a..4f4f90b 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -421,13 +421,13 @@ H5P__dcrt_layout_enc(const void *value, void **_pp, size_t *size) for(u = 0; u < layout->storage.u.virt.list_nused; u++) { /* Source file name */ tmp_size = HDstrlen(layout->storage.u.virt.list[u].source_file_name) + (size_t)1; - (void)HDmemcpy(*pp, layout->storage.u.virt.list[u].source_file_name, tmp_size); + H5MM_memcpy(*pp, layout->storage.u.virt.list[u].source_file_name, tmp_size); *pp += tmp_size; *size += tmp_size; /* Source dataset name */ tmp_size = HDstrlen(layout->storage.u.virt.list[u].source_dset_name) + (size_t)1; - (void)HDmemcpy(*pp, layout->storage.u.virt.list[u].source_dset_name, tmp_size); + H5MM_memcpy(*pp, layout->storage.u.virt.list[u].source_dset_name, tmp_size); *pp += tmp_size; *size += tmp_size; @@ -597,14 +597,14 @@ H5P__dcrt_layout_dec(const void **_pp, void *value) tmp_size = HDstrlen((const char *)*pp) + 1; if(NULL == (tmp_layout.storage.u.virt.list[u].source_file_name = (char *)H5MM_malloc(tmp_size))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "unable to allocate memory for source file name") - (void)HDmemcpy(tmp_layout.storage.u.virt.list[u].source_file_name, *pp, tmp_size); + H5MM_memcpy(tmp_layout.storage.u.virt.list[u].source_file_name, *pp, tmp_size); *pp += tmp_size; /* Source dataset name */ tmp_size = HDstrlen((const char *)*pp) + 1; if(NULL == (tmp_layout.storage.u.virt.list[u].source_dset_name = (char *)H5MM_malloc(tmp_size))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "unable to allocate memory for source dataset name") - (void)HDmemcpy(tmp_layout.storage.u.virt.list[u].source_dset_name, *pp, tmp_size); + H5MM_memcpy(tmp_layout.storage.u.virt.list[u].source_dset_name, *pp, tmp_size); *pp += tmp_size; /* Source selection */ @@ -669,7 +669,7 @@ H5P__dcrt_layout_dec(const void **_pp, void *value) } /* end switch */ /* Set the value */ - HDmemcpy(value, layout, sizeof(H5O_layout_t)); + H5MM_memcpy(value, layout, sizeof(H5O_layout_t)); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1018,7 +1018,7 @@ H5P__dcrt_fill_value_enc(const void *value, void **_pp, size_t *size) /* Encode the fill value & datatype */ if(fill->size > 0) { /* Encode the fill value itself */ - HDmemcpy(*pp, (uint8_t *)fill->buf, (size_t)fill->size); + H5MM_memcpy(*pp, (uint8_t *)fill->buf, (size_t)fill->size); *pp += fill->size; /* Encode fill value datatype */ @@ -1115,7 +1115,7 @@ H5P__dcrt_fill_value_dec(const void **_pp, void *_value) /* Allocate fill buffer and copy the contents in it */ if(NULL == (fill->buf = H5MM_malloc((size_t)fill->size))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for fill value buffer") - HDmemcpy((uint8_t *)fill->buf, *pp, (size_t)fill->size); + H5MM_memcpy((uint8_t *)fill->buf, *pp, (size_t)fill->size); *pp += fill->size; enc_size = *(*pp)++; @@ -1430,7 +1430,7 @@ H5P__dcrt_ext_file_list_enc(const void *value, void **_pp, size_t *size) UINT64ENCODE_VAR(*pp, enc_value, enc_size); /* Encode name */ - HDmemcpy(*pp, (uint8_t *)(efl->slot[u].name), len); + H5MM_memcpy(*pp, (uint8_t *)(efl->slot[u].name), len); *pp += len; /* Encode offset */ @@ -2017,7 +2017,7 @@ H5Pset_chunk(hid_t plist_id, int ndims, const hsize_t dim[/*ndims*/]) #endif /* H5_HAVE_C99_DESIGNATED_INITIALIZER */ /* Verify & initialize property's chunk dims */ - HDmemcpy(&chunk_layout, &H5D_def_layout_chunk_g, sizeof(H5D_def_layout_chunk_g)); + H5MM_memcpy(&chunk_layout, &H5D_def_layout_chunk_g, sizeof(H5D_def_layout_chunk_g)); HDmemset(&chunk_layout.u.chunk.dim, 0, sizeof(chunk_layout.u.chunk.dim)); chunk_nelmts = 1; for(u = 0; u < (unsigned)ndims; u++) { @@ -2186,7 +2186,7 @@ H5Pset_virtual(hid_t dcpl_id, hid_t vspace_id, const char *src_file_name, HGOTO_ERROR(H5E_PLIST, H5E_CANTRESET, FAIL, "can't release layout message") /* Copy the default virtual layout */ - HDmemcpy(&virtual_layout, &H5D_def_layout_virtual_g, sizeof(H5D_def_layout_virtual_g)); + H5MM_memcpy(&virtual_layout, &H5D_def_layout_virtual_g, sizeof(H5D_def_layout_virtual_g)); /* Sanity check */ HDassert(virtual_layout.storage.u.virt.list_nalloc == 0); @@ -3225,7 +3225,7 @@ H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value) fill.size = (ssize_t)H5T_get_size(type); if(NULL == (fill.buf = H5MM_malloc((size_t)fill.size))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "memory allocation failed for fill value") - HDmemcpy(fill.buf, value, (size_t)fill.size); + H5MM_memcpy(fill.buf, value, (size_t)fill.size); /* Set up type conversion function */ if(NULL == (tpath = H5T_path_find(type, type))) @@ -3333,7 +3333,7 @@ H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value/*out*/) if(H5T_path_bkg(tpath) && NULL == (bkg = H5MM_malloc(H5T_get_size(fill.type)))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for type conversion") } /* end else */ - HDmemcpy(buf, fill.buf, H5T_get_size(fill.type)); + H5MM_memcpy(buf, fill.buf, H5T_get_size(fill.type)); /* Do the conversion */ if((dst_id = H5I_register(H5I_DATATYPE, H5T_copy(type, H5T_COPY_TRANSIENT), FALSE)) < 0) @@ -3341,7 +3341,7 @@ H5P_get_fill_value(H5P_genplist_t *plist, const H5T_t *type, void *value/*out*/) if(H5T_convert(tpath, src_id, dst_id, (size_t)1, (size_t)0, (size_t)0, buf, bkg) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "datatype conversion failed") if(buf != value) - HDmemcpy(value, buf, H5T_get_size(type)); + H5MM_memcpy(value, buf, H5T_get_size(type)); done: if(buf != value) diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index e33bc05..9e34635 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -695,7 +695,7 @@ H5P__dxfr_xform_enc(const void *value, void **_pp, size_t *size) HDassert(pexp); /* Copy the expression into the buffer */ - HDmemcpy(*pp, (const uint8_t *)pexp, len); + H5MM_memcpy(*pp, (const uint8_t *)pexp, len); *pp += len; *pp[0] = '\0'; } /* end if */ diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c index b5fe527..73e75d5 100644 --- a/src/H5Pfapl.c +++ b/src/H5Pfapl.c @@ -1057,7 +1057,7 @@ H5P__file_driver_copy(void *value) else if(driver->fapl_size > 0) { if(NULL == (new_pl = H5MM_malloc(driver->fapl_size))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "driver info allocation failed") - HDmemcpy(new_pl, info->driver_info, driver->fapl_size); + H5MM_memcpy(new_pl, info->driver_info, driver->fapl_size); } /* end else-if */ else HGOTO_ERROR(H5E_PLIST, H5E_UNSUPPORTED, FAIL, "no way to copy driver info") @@ -2590,7 +2590,7 @@ H5Pset_file_image(hid_t fapl_id, void *buf_ptr, size_t buf_len) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") } /* end if */ else - HDmemcpy(image_info.buffer, buf_ptr, buf_len); + H5MM_memcpy(image_info.buffer, buf_ptr, buf_len); } /* end if */ else image_info.buffer = NULL; @@ -2684,7 +2684,7 @@ H5Pget_file_image(hid_t fapl_id, void **buf_ptr_ptr, size_t *buf_len_ptr) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") } /* end if */ else - HDmemcpy(copy_ptr, image_info.buffer, image_info.size); + H5MM_memcpy(copy_ptr, image_info.buffer, image_info.size); } /* end if */ *buf_ptr_ptr = copy_ptr; @@ -2887,7 +2887,7 @@ H5P__file_image_info_copy(void *value) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "image_memcpy callback failed") } /* end if */ else - HDmemcpy(info->buffer, old_buffer, info->size); + H5MM_memcpy(info->buffer, old_buffer, info->size); } /* end if */ /* Copy udata if it exists */ @@ -3082,7 +3082,7 @@ H5P__facc_cache_image_config_dec(const void **_pp, void *_value) HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); /* Set property to default value */ - HDmemcpy(config, &H5F_def_mdc_initCacheImageCfg_g, sizeof(H5AC_cache_image_config_t)); + H5MM_memcpy(config, &H5F_def_mdc_initCacheImageCfg_g, sizeof(H5AC_cache_image_config_t)); /* Decode type sizes */ enc_size = *(*pp)++; @@ -3473,7 +3473,7 @@ H5P__facc_cache_config_enc(const void *value, void **_pp, size_t *size) H5_ENCODE_UNSIGNED(*pp, config->close_trace_file); - HDmemcpy(*pp, (const uint8_t *)(config->trace_file_name), (size_t)(H5AC__MAX_TRACE_FILE_NAME_LEN + 1)); + H5MM_memcpy(*pp, (const uint8_t *)(config->trace_file_name), (size_t)(H5AC__MAX_TRACE_FILE_NAME_LEN + 1)); *pp += H5AC__MAX_TRACE_FILE_NAME_LEN + 1; H5_ENCODE_UNSIGNED(*pp, config->evictions_enabled); @@ -3608,7 +3608,7 @@ H5P__facc_cache_config_dec(const void **_pp, void *_value) HDcompile_assert(sizeof(size_t) <= sizeof(uint64_t)); /* Set property to default value */ - HDmemcpy(config, &H5F_def_mdc_initCacheCfg_g, sizeof(H5AC_cache_config_t)); + H5MM_memcpy(config, &H5F_def_mdc_initCacheCfg_g, sizeof(H5AC_cache_config_t)); /* Decode type sizes */ enc_size = *(*pp)++; @@ -4271,7 +4271,7 @@ H5Pget_mdc_log_options(hid_t plist_id, hbool_t *is_enabled, char *location, /* Copy log location to output buffer */ if(location_ptr && location) - HDmemcpy(location, location_ptr, *location_size); + H5MM_memcpy(location, location_ptr, *location_size); /* Get location size, including terminating NULL */ if(location_size) { @@ -4326,7 +4326,7 @@ H5P_facc_mdc_log_location_enc(const void *value, void **_pp, size_t *size) /* encode the prefix */ if(NULL != log_location) { - HDmemcpy(*(char **)pp, log_location, len); + H5MM_memcpy(*(char **)pp, log_location, len); *pp += len; } /* end if */ } /* end if */ @@ -4612,7 +4612,7 @@ H5P__encode_coll_md_read_flag_t(const void *value, void **_pp, size_t *size) if(NULL != *pp) { /* Encode the value */ - HDmemcpy(*pp, coll_md_read_flag, sizeof(H5P_coll_md_read_flag_t)); + H5MM_memcpy(*pp, coll_md_read_flag, sizeof(H5P_coll_md_read_flag_t)); *pp += sizeof(H5P_coll_md_read_flag_t); } /* end if */ diff --git a/src/H5Pint.c b/src/H5Pint.c index 6a0cc14..53030fa 100644 --- a/src/H5Pint.c +++ b/src/H5Pint.c @@ -619,7 +619,7 @@ H5P__do_prop_cb1(H5SL_t *slist, H5P_genprop_t *prop, H5P_prp_cb1_t cb) /* Allocate space for a temporary copy of the property value */ if(NULL == (tmp_value = H5MM_malloc(prop->size))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary property value") - HDmemcpy(tmp_value, prop->value, prop->size); + H5MM_memcpy(tmp_value, prop->value, prop->size); /* Call "type 1" callback ('create', 'copy' or 'close') */ if(cb(prop->name, prop->size, tmp_value) < 0) @@ -630,7 +630,7 @@ H5P__do_prop_cb1(H5SL_t *slist, H5P_genprop_t *prop, H5P_prp_cb1_t cb) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") /* Copy the changed value into the new property */ - HDmemcpy(pcopy->value, tmp_value, prop->size); + H5MM_memcpy(pcopy->value, tmp_value, prop->size); /* Insert the changed property into the property list */ if(H5P_add_prop(slist, pcopy) < 0) @@ -978,7 +978,7 @@ H5P_dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Copy basic property information */ - HDmemcpy(prop, oprop, sizeof(H5P_genprop_t)); + H5MM_memcpy(prop, oprop, sizeof(H5P_genprop_t)); /* Check if we should duplicate the name or share it */ @@ -1018,7 +1018,7 @@ H5P_dup_prop(H5P_genprop_t *oprop, H5P_prop_within_t type) HDassert(prop->size > 0); if(NULL == (prop->value = H5MM_malloc(prop->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - HDmemcpy(prop->value, oprop->value, prop->size); + H5MM_memcpy(prop->value, oprop->value, prop->size); } /* end if */ /* Set return value */ @@ -1105,7 +1105,7 @@ H5P_create_prop(const char *name, size_t size, H5P_prop_within_t type, if(value != NULL) { if(NULL == (prop->value = H5MM_malloc (prop->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - HDmemcpy(prop->value, value, prop->size); + H5MM_memcpy(prop->value, value, prop->size); } /* end if */ else prop->value = NULL; @@ -2715,7 +2715,7 @@ H5P__poke_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") /* Overwrite value in property */ - HDmemcpy(prop->value, udata->value, prop->size); + H5MM_memcpy(prop->value, udata->value, prop->size); done: FUNC_LEAVE_NOAPI(ret_value) @@ -2767,7 +2767,7 @@ H5P__poke_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop if(NULL == (pcopy = H5P_dup_prop(prop, H5P_PROP_WITHIN_LIST))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") - HDmemcpy(pcopy->value, udata->value, pcopy->size); + H5MM_memcpy(pcopy->value, udata->value, pcopy->size); /* Insert the changed property into the property list */ if(H5P_add_prop(plist->props, pcopy) < 0) @@ -2876,7 +2876,7 @@ H5P__set_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, /* Make a copy of the current value, in case the callback fails */ if(NULL == (tmp_value = H5MM_malloc(prop->size))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed temporary property value") - HDmemcpy(tmp_value, udata->value, prop->size); + H5MM_memcpy(tmp_value, udata->value, prop->size); /* Call user's callback */ if((*(prop->set))(plist->plist_id, name, prop->size, tmp_value) < 0) @@ -2897,7 +2897,7 @@ H5P__set_plist_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, } /* end if */ /* Copy new [possibly unchanged] value into property value */ - HDmemcpy(prop->value, prp_value, prop->size); + H5MM_memcpy(prop->value, prp_value, prop->size); done: /* Free the temporary value buffer */ @@ -2956,7 +2956,7 @@ H5P__set_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, /* Make a copy of the current value, in case the callback fails */ if(NULL == (tmp_value = H5MM_malloc(prop->size))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed temporary property value") - HDmemcpy(tmp_value, udata->value, prop->size); + H5MM_memcpy(tmp_value, udata->value, prop->size); /* Call user's callback */ if((*(prop->set))(plist->plist_id, name, prop->size, tmp_value) < 0) @@ -2973,7 +2973,7 @@ H5P__set_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, if(NULL == (pcopy = H5P_dup_prop(prop, H5P_PROP_WITHIN_LIST))) HGOTO_ERROR(H5E_PLIST, H5E_CANTCOPY, FAIL, "Can't copy property") - HDmemcpy(pcopy->value, prp_value, pcopy->size); + H5MM_memcpy(pcopy->value, prp_value, pcopy->size); /* Insert the changed property into the property list */ if(H5P_add_prop(plist->props, pcopy) < 0) @@ -4222,7 +4222,7 @@ H5P__peek_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "property has zero size") /* Make a (shallow) copy of the value */ - HDmemcpy(udata->value, prop->value, prop->size); + H5MM_memcpy(udata->value, prop->value, prop->size); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4322,18 +4322,18 @@ H5P__get_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, /* Make a copy of the current value, in case the callback fails */ if(NULL == (tmp_value = H5MM_malloc(prop->size))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed temporary property value") - HDmemcpy(tmp_value, prop->value, prop->size); + H5MM_memcpy(tmp_value, prop->value, prop->size); /* Call user's callback */ if((*(prop->get))(plist->plist_id, name, prop->size, tmp_value) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value") /* Copy new [possibly unchanged] value into return value */ - HDmemcpy(udata->value, tmp_value, prop->size); + H5MM_memcpy(udata->value, tmp_value, prop->size); } /* end if */ /* No 'get' callback, just copy value */ else - HDmemcpy(udata->value, prop->value, prop->size); + H5MM_memcpy(udata->value, prop->value, prop->size); done: /* Free the temporary value buffer */ @@ -4506,7 +4506,7 @@ H5P__del_pclass_cb(H5P_genplist_t *plist, const char *name, H5P_genprop_t *prop, /* Allocate space for a temporary copy of the property value */ if(NULL == (tmp_value = H5MM_malloc(prop->size))) HGOTO_ERROR(H5E_PLIST, H5E_CANTALLOC, FAIL, "memory allocation failed for temporary property value") - HDmemcpy(tmp_value, prop->value, prop->size); + H5MM_memcpy(tmp_value, prop->value, prop->size); /* Call user's callback */ if((*(prop->del))(plist->plist_id, name, prop->size, tmp_value) < 0) @@ -4955,7 +4955,7 @@ H5P_close(void *_plist) /* Allocate space for a temporary copy of the property value */ if(NULL==(tmp_value=H5MM_malloc(tmp->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for temporary property value") - HDmemcpy(tmp_value,tmp->value,tmp->size); + H5MM_memcpy(tmp_value,tmp->value,tmp->size); /* Call the 'close' callback */ (tmp->close)(tmp->name,tmp->size,tmp_value); diff --git a/src/H5Plapl.c b/src/H5Plapl.c index 99d98f8..1e69f44 100644 --- a/src/H5Plapl.c +++ b/src/H5Plapl.c @@ -715,7 +715,7 @@ H5P__lacc_elink_pref_enc(const void *value, void **_pp, size_t *size) /* encode the prefix */ if(NULL != elink_pref) { - HDmemcpy(*(char **)pp, elink_pref, len); + H5MM_memcpy(*(char **)pp, elink_pref, len); *pp += len; } /* end if */ } /* end if */ diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c index be41e32..1f94081 100644 --- a/src/H5Pocpl.c +++ b/src/H5Pocpl.c @@ -1501,7 +1501,7 @@ H5P__ocrt_pipeline_enc(const void *value, void **_pp, size_t *size) *(*pp)++ = (uint8_t)TRUE; /* encode filter name */ - HDmemcpy(*pp, (uint8_t *)(pline->filter[u].name), H5Z_COMMON_NAME_LEN); + H5MM_memcpy(*pp, (uint8_t *)(pline->filter[u].name), H5Z_COMMON_NAME_LEN); *pp += H5Z_COMMON_NAME_LEN; } /* end if */ else diff --git a/src/H5Pocpypl.c b/src/H5Pocpypl.c index 47bba05..670fba6 100644 --- a/src/H5Pocpypl.c +++ b/src/H5Pocpypl.c @@ -384,7 +384,7 @@ H5P__ocpy_merge_comm_dt_list_enc(const void *value, void **_pp, size_t *size) /* Encode merge committed dtype list */ if(*pp) { - HDmemcpy(*(char **)pp, dt_list->path, len); + H5MM_memcpy(*(char **)pp, dt_list->path, len); *pp += len; } /* end if */ diff --git a/src/H5S.c b/src/H5S.c index e582db7..f36446c 100644 --- a/src/H5S.c +++ b/src/H5S.c @@ -1435,7 +1435,7 @@ H5S_set_extent_simple(H5S_t *space, unsigned rank, const hsize_t *dims, * same as the dimension */ space->extent.max = (hsize_t *)H5FL_ARR_MALLOC(hsize_t, (size_t)rank); if(max != NULL) { - HDmemcpy(space->extent.max, max, sizeof(hsize_t) * rank); + H5MM_memcpy(space->extent.max, max, sizeof(hsize_t) * rank); } else { for(u = 0; u < space->extent.rank; u++) space->extent.max[u] = dims[u]; diff --git a/src/H5SL.c b/src/H5SL.c index c0934ca..5f00fb8 100644 --- a/src/H5SL.c +++ b/src/H5SL.c @@ -240,7 +240,7 @@ /* Allocate space for new forward pointers */ \ if(NULL == (_tmp = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[X->log_nalloc]))) \ HGOTO_ERROR(H5E_SLIST, H5E_CANTALLOC, ERR, "memory allocation failed") \ - HDmemcpy((void *)_tmp, (const void *)X->forward, (LVL + 1) * sizeof(H5SL_node_t *)); \ + H5MM_memcpy((void *)_tmp, (const void *)X->forward, (LVL + 1) * sizeof(H5SL_node_t *)); \ X->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[X->log_nalloc-1], (void *)X->forward); \ X->forward = _tmp; \ } /* end if */ \ @@ -262,7 +262,7 @@ /* Allocate space for new forward pointers */ \ if(NULL == (_tmp = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[X->log_nalloc]))) \ HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "memory allocation failed") \ - HDmemcpy((void *)_tmp, (const void *)X->forward, (LVL) * sizeof(H5SL_node_t *)); \ + H5MM_memcpy((void *)_tmp, (const void *)X->forward, (LVL) * sizeof(H5SL_node_t *)); \ X->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[X->log_nalloc+1], (void *)X->forward); \ X->forward = _tmp; \ } /* end if */ \ diff --git a/src/H5SM.c b/src/H5SM.c index 1bf6301..885ddc1 100644 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -2318,7 +2318,7 @@ H5SM__read_iter_op(H5O_t *oh, H5O_mesg_t *mesg/*in,out*/, unsigned sequence, HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, H5_ITER_ERROR, "memory allocation failed") /* Copy the encoded message into the buffer to return */ - HDmemcpy(udata->encoding_buf, mesg->raw, udata->buf_size); + H5MM_memcpy(udata->encoding_buf, mesg->raw, udata->buf_size); /* Found the message we were looking for */ ret_value = H5_ITER_STOP; @@ -2356,7 +2356,7 @@ H5SM__read_mesg_fh_cb(const void *obj, size_t obj_len, void *_udata) HGOTO_ERROR(H5E_SOHM, H5E_NOSPACE, FAIL, "memory allocation failed") /* Copy the message from the heap */ - HDmemcpy(udata->encoding_buf, obj, obj_len); + H5MM_memcpy(udata->encoding_buf, obj, obj_len); udata->buf_size = obj_len; done: diff --git a/src/H5SMbtree2.c b/src/H5SMbtree2.c index f0c4963..0c4224b 100644 --- a/src/H5SMbtree2.c +++ b/src/H5SMbtree2.c @@ -248,7 +248,7 @@ H5SM_bt2_convert_to_list_op(const void * record, void *op_data) /* Insert this message at the end of the list */ HDassert(list->messages[mesg_idx].location == H5SM_NO_LOC); HDassert(message->location != H5SM_NO_LOC); - HDmemcpy(&(list->messages[mesg_idx]), message, sizeof(H5SM_sohm_t)); + H5MM_memcpy(&(list->messages[mesg_idx]), message, sizeof(H5SM_sohm_t)); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5SM_bt2_convert_to_list_op() */ diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 440d4c4..ee28fa4 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -388,7 +388,7 @@ H5SM__cache_table_serialize(const H5F_t *f, void *_image, size_t len, HDassert(H5F_SOHM_VERS(f) == HDF5_SHAREDHEADER_VERSION); /* Encode magic number */ - HDmemcpy(image, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC); + H5MM_memcpy(image, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC); image += H5_SIZEOF_MAGIC; /* Encode each index header */ @@ -710,7 +710,7 @@ H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t len, HDassert(list->header->list_size == len); /* Encode magic number */ - HDmemcpy(image, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC); + H5MM_memcpy(image, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC); image += H5_SIZEOF_MAGIC; /* serialize messages from the messages array */ diff --git a/src/H5SMmessage.c b/src/H5SMmessage.c index af00bc5..cc843bc 100644 --- a/src/H5SMmessage.c +++ b/src/H5SMmessage.c @@ -302,7 +302,7 @@ H5SM__message_encode(uint8_t *raw, const void *_nrecord, void *_ctx) if(message->location == H5SM_IN_HEAP) { UINT32ENCODE(raw, message->u.heap_loc.ref_count); - HDmemcpy(raw, message->u.heap_loc.fheap_id.id, (size_t)H5O_FHEAP_ID_LEN); + H5MM_memcpy(raw, message->u.heap_loc.fheap_id.id, (size_t)H5O_FHEAP_ID_LEN); } /* end if */ else { HDassert(message->location == H5SM_IN_OH); @@ -343,7 +343,7 @@ H5SM__message_decode(const uint8_t *raw, void *_nrecord, void *_ctx) if(message->location == H5SM_IN_HEAP) { UINT32DECODE(raw, message->u.heap_loc.ref_count); - HDmemcpy(message->u.heap_loc.fheap_id.id, raw, (size_t)H5O_FHEAP_ID_LEN); + H5MM_memcpy(message->u.heap_loc.fheap_id.id, raw, (size_t)H5O_FHEAP_ID_LEN); } /* end if */ else { HDassert(message->location == H5SM_IN_OH); diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 4f96197..72fc503 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -532,10 +532,10 @@ H5S__hyper_iter_coords(const H5S_sel_iter_t *iter, hsize_t *coords) HDassert(v < 0); } /* end if */ else - HDmemcpy(coords, iter->u.hyp.off, sizeof(hsize_t) * iter->rank); + H5MM_memcpy(coords, iter->u.hyp.off, sizeof(hsize_t) * iter->rank); } /* end if */ else - HDmemcpy(coords, iter->u.hyp.off, sizeof(hsize_t) * iter->rank); + H5MM_memcpy(coords, iter->u.hyp.off, sizeof(hsize_t) * iter->rank); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5S__hyper_iter_coords() */ @@ -2660,18 +2660,18 @@ H5S__hyper_span_blocklist(const H5S_hyper_span_info_t *spans, hsize_t start[], /* Copy previous starting points */ for(u = 0; u < rank; u++, (*buf)++) - HDmemcpy(*buf, &start[u], sizeof(hsize_t)); + H5MM_memcpy(*buf, &start[u], sizeof(hsize_t)); /* Copy starting point for this span */ - HDmemcpy(*buf, &curr->low, sizeof(hsize_t)); + H5MM_memcpy(*buf, &curr->low, sizeof(hsize_t)); (*buf)++; /* Copy previous ending points */ for(u = 0; u < rank; u++, (*buf)++) - HDmemcpy(*buf, &end[u], sizeof(hsize_t)); + H5MM_memcpy(*buf, &end[u], sizeof(hsize_t)); /* Copy starting point for this span */ - HDmemcpy(*buf, &curr->high, sizeof(hsize_t)); + H5MM_memcpy(*buf, &curr->high, sizeof(hsize_t)); (*buf)++; /* Decrement the number of blocks processed */ @@ -2784,11 +2784,11 @@ H5S__get_select_hyper_blocklist(H5S_t *space, hbool_t internal, hsize_t startblo /* Check if we should copy this block information */ if(startblock == 0) { /* Copy the starting location */ - HDmemcpy(buf, offset, sizeof(hsize_t) * ndims); + H5MM_memcpy(buf, offset, sizeof(hsize_t) * ndims); buf += ndims; /* Compute the ending location */ - HDmemcpy(buf, offset, sizeof(hsize_t) * ndims); + H5MM_memcpy(buf, offset, sizeof(hsize_t) * ndims); for(u = 0; u < ndims; u++) buf[u] += (diminfo[u].block - 1); buf += ndims; @@ -4988,7 +4988,7 @@ H5S_hyper_denormalize_offset(H5S_t *space, const hssize_t *old_offset) HGOTO_ERROR(H5E_DATASPACE, H5E_CANTSET, FAIL, "can't adjust selection") /* Copy the selection offset over */ - HDmemcpy(space->select.offset, old_offset, sizeof(hssize_t) * space->extent.rank); + H5MM_memcpy(space->select.offset, old_offset, sizeof(hssize_t) * space->extent.rank); done: FUNC_LEAVE_NOAPI(ret_value) @@ -6211,7 +6211,7 @@ H5S__hyper_rebuild_helper(const H5S_hyper_span_t *span, H5S_hyper_dim_t span_sla if(!H5S__hyper_rebuild_helper(span->down->head, span_slab_info, rank - 1)) HGOTO_DONE(FALSE) - HDmemcpy(canon_down_span_slab_info, span_slab_info, sizeof(H5S_hyper_dim_t) * rank); + H5MM_memcpy(canon_down_span_slab_info, span_slab_info, sizeof(H5S_hyper_dim_t) * rank); } /* end if */ /* Assign the initial starting point & block size */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index e7e5725..f1de0d4 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -170,7 +170,7 @@ H5S_point_iter_coords (const H5S_sel_iter_t *iter, hsize_t *coords) HDassert(coords); /* Copy the offset of the current point */ - HDmemcpy(coords,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank); + H5MM_memcpy(coords,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_iter_coords() */ @@ -202,8 +202,8 @@ H5S_point_iter_block (const H5S_sel_iter_t *iter, hsize_t *start, hsize_t *end) HDassert(end); /* Copy the current point as a block */ - HDmemcpy(start,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank); - HDmemcpy(end,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank); + H5MM_memcpy(start,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank); + H5MM_memcpy(end,iter->u.pnt.curr->pnt,sizeof(hsize_t)*iter->rank); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5S_point_iter_block() */ @@ -413,7 +413,7 @@ H5S_point_add(H5S_t *space, H5S_seloper_t op, hsize_t num_elem, const hsize_t *c HGOTO_ERROR(H5E_DATASPACE, H5E_CANTALLOC, FAIL, "can't allocate coordinate information") /* Copy over the coordinates */ - HDmemcpy(new_node->pnt, coord + (u * space->extent.rank), (space->extent.rank * sizeof(hsize_t))); + H5MM_memcpy(new_node->pnt, coord + (u * space->extent.rank), (space->extent.rank * sizeof(hsize_t))); /* Link into list */ if(top == NULL) @@ -632,7 +632,7 @@ H5S_point_copy(H5S_t *dst, const H5S_t *src, hbool_t H5_ATTR_UNUSED share_select } /* end if */ /* Copy over the point's coordinates */ - HDmemcpy(new_node->pnt, curr->pnt, (src->extent.rank * sizeof(hsize_t))); + H5MM_memcpy(new_node->pnt, curr->pnt, (src->extent.rank * sizeof(hsize_t))); /* Keep the order the same when copying */ if(NULL == new_tail) @@ -1128,7 +1128,7 @@ H5S_get_select_elem_pointlist(H5S_t *space, hsize_t startpoint, hsize_t numpoint /* Iterate through the node, copying each point's information */ while(node != NULL && numpoints > 0) { - HDmemcpy(buf, node->pnt, sizeof(hsize_t) * rank); + H5MM_memcpy(buf, node->pnt, sizeof(hsize_t) * rank); buf += rank; numpoints--; node = node->next; @@ -1612,7 +1612,7 @@ H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off /* Calculate offset of selection in projected buffer */ HDmemset(block, 0, sizeof(block)); - HDmemcpy(block, base_space->select.sel_info.pnt_lst->head->pnt, sizeof(hsize_t) * rank_diff); + H5MM_memcpy(block, base_space->select.sel_info.pnt_lst->head->pnt, sizeof(hsize_t) * rank_diff); *offset = H5VM_array_offset(base_space->extent.rank, base_space->extent.size, block); /* Iterate through base space's point nodes, copying the point information */ @@ -1629,7 +1629,7 @@ H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off } /* end if */ /* Copy over the point's coordinates */ - HDmemcpy(new_node->pnt, &base_node->pnt[rank_diff], (new_space->extent.rank * sizeof(hsize_t))); + H5MM_memcpy(new_node->pnt, &base_node->pnt[rank_diff], (new_space->extent.rank * sizeof(hsize_t))); /* Keep the order the same when copying */ if(NULL == prev_node) @@ -1667,7 +1667,7 @@ H5S_point_project_simple(const H5S_t *base_space, H5S_t *new_space, hsize_t *off /* Copy over the point's coordinates */ HDmemset(new_node->pnt, 0, sizeof(hsize_t) * rank_diff); - HDmemcpy(&new_node->pnt[rank_diff], base_node->pnt, (new_space->extent.rank * sizeof(hsize_t))); + H5MM_memcpy(&new_node->pnt[rank_diff], base_node->pnt, (new_space->extent.rank * sizeof(hsize_t))); /* Keep the order the same when copying */ if(NULL == prev_node) diff --git a/src/H5Sselect.c b/src/H5Sselect.c index 995ae72..40f2258 100644 --- a/src/H5Sselect.c +++ b/src/H5Sselect.c @@ -78,7 +78,7 @@ H5S_select_offset(H5S_t *space, const hssize_t *offset) HDassert(offset); /* Copy the offset over */ - HDmemcpy(space->select.offset, offset, sizeof(hssize_t)*space->extent.rank); + H5MM_memcpy(space->select.offset, offset, sizeof(hssize_t)*space->extent.rank); /* Indicate that the offset was changed */ space->select.offset_changed = TRUE; @@ -1354,7 +1354,7 @@ H5S_select_iterate(void *buf, const H5T_t *type, const H5S_t *space, if(ndims > 0) { /* Copy the size of the space */ HDassert(space->extent.size); - HDmemcpy(space_size, space->extent.size, ndims * sizeof(hsize_t)); + H5MM_memcpy(space_size, space->extent.size, ndims * sizeof(hsize_t)); } /* end if */ space_size[ndims] = elmt_size; @@ -2009,16 +2009,16 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr, rank_diff = new_space_rank - base_space_rank; H5VM_array_fill(new_space_dims, &tmp_dim_size, sizeof(tmp_dim_size), rank_diff); H5VM_array_fill(new_space_maxdims, &tmp_dim_size, sizeof(tmp_dim_size), rank_diff); - HDmemcpy(&new_space_dims[rank_diff], base_space_dims, sizeof(new_space_dims[0]) * base_space_rank); - HDmemcpy(&new_space_maxdims[rank_diff], base_space_maxdims, sizeof(new_space_maxdims[0]) * base_space_rank); + H5MM_memcpy(&new_space_dims[rank_diff], base_space_dims, sizeof(new_space_dims[0]) * base_space_rank); + H5MM_memcpy(&new_space_maxdims[rank_diff], base_space_maxdims, sizeof(new_space_maxdims[0]) * base_space_rank); } /* end if */ else { /* new_space_rank < base_space_rank */ /* we must copy the fastest changing dimension of the * base space into the dimensions of the new space. */ rank_diff = base_space_rank - new_space_rank; - HDmemcpy(new_space_dims, &base_space_dims[rank_diff], sizeof(new_space_dims[0]) * new_space_rank); - HDmemcpy(new_space_maxdims, &base_space_maxdims[rank_diff], sizeof(new_space_maxdims[0]) * new_space_rank); + H5MM_memcpy(new_space_dims, &base_space_dims[rank_diff], sizeof(new_space_dims[0]) * new_space_rank); + H5MM_memcpy(new_space_maxdims, &base_space_maxdims[rank_diff], sizeof(new_space_maxdims[0]) * new_space_rank); } /* end else */ /* now have the new space rank and dimensions set up -- @@ -2049,10 +2049,10 @@ H5S_select_construct_projection(const H5S_t *base_space, H5S_t **new_space_ptr, if(H5S_GET_EXTENT_TYPE(base_space) == H5S_SIMPLE && base_space->select.offset_changed) { if(new_space_rank > base_space_rank) { HDmemset(new_space->select.offset, 0, sizeof(new_space->select.offset[0]) * rank_diff); - HDmemcpy(&new_space->select.offset[rank_diff], base_space->select.offset, sizeof(new_space->select.offset[0]) * base_space_rank); + H5MM_memcpy(&new_space->select.offset[rank_diff], base_space->select.offset, sizeof(new_space->select.offset[0]) * base_space_rank); } /* end if */ else - HDmemcpy(new_space->select.offset, &base_space->select.offset[rank_diff], sizeof(new_space->select.offset[0]) * new_space_rank); + H5MM_memcpy(new_space->select.offset, &base_space->select.offset[rank_diff], sizeof(new_space->select.offset[0]) * new_space_rank); /* Propagate the offset changed flag into the new dataspace. */ new_space->select.offset_changed = TRUE; diff --git a/src/H5T.c b/src/H5T.c index 85c99f3..b4015ff 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -3337,7 +3337,7 @@ H5T__complete_copy(H5T_t *new_dt, const H5T_t *old_dt, H5T_shared_t *reopened_fo if(NULL == (new_dt->shared->u.compnd.memb = H5MM_malloc(new_dt->shared->u.compnd.nalloc * sizeof(H5T_cmemb_t)))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "memory allocation failed") - HDmemcpy(new_dt->shared->u.compnd.memb, old_dt->shared->u.compnd.memb, + H5MM_memcpy(new_dt->shared->u.compnd.memb, old_dt->shared->u.compnd.memb, new_dt->shared->u.compnd.nmembs * sizeof(H5T_cmemb_t)); } /* end if */ @@ -3403,7 +3403,7 @@ H5T__complete_copy(H5T_t *new_dt, const H5T_t *old_dt, H5T_shared_t *reopened_fo HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "enam name array memory allocation failed") if(NULL == (new_dt->shared->u.enumer.value = H5MM_malloc(new_dt->shared->u.enumer.nalloc * new_dt->shared->size))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTALLOC, FAIL, "enam value array memory allocation failed") - HDmemcpy(new_dt->shared->u.enumer.value, old_dt->shared->u.enumer.value, + H5MM_memcpy(new_dt->shared->u.enumer.value, old_dt->shared->u.enumer.value, new_dt->shared->u.enumer.nmembs * new_dt->shared->size); for(i = 0; i < new_dt->shared->u.enumer.nmembs; i++) { if(NULL == (s = H5MM_xstrdup(old_dt->shared->u.enumer.name[i]))) diff --git a/src/H5Tconv.c b/src/H5Tconv.c index c76ca3c..f495829 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -828,7 +828,7 @@ done: \ /* Macro defining action on source data which needs to be aligned (before main action) */ #define H5T_CONV_LOOP_PRE_SALIGN(ST) { \ - HDmemcpy(&src_aligned, src, sizeof(ST)); \ + H5MM_memcpy(&src_aligned, src, sizeof(ST)); \ } /* Macro defining action on source data which doesn't need to be aligned (before main action) */ @@ -854,7 +854,7 @@ done: \ /* Macro defining action on destination data which needs to be aligned (after main action) */ #define H5T_CONV_LOOP_POST_DALIGN(DT) { \ - HDmemcpy(dst, &dst_aligned, sizeof(DT)); \ + H5MM_memcpy(dst, &dst_aligned, sizeof(DT)); \ } /* Macro defining action on destination data which doesn't need to be aligned (after main action) */ @@ -1797,7 +1797,7 @@ H5T__conv_b_b(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * should copy the value to the true destination buffer. */ if(d == dbuf) - HDmemcpy(dp, d, dst->shared->size); + H5MM_memcpy(dp, d, dst->shared->size); if(buf_stride) { sp += direction * (ssize_t)buf_stride; /* Note that cast is checked with H5_CHECK_OVERFLOW, above */ dp += direction * (ssize_t)buf_stride; /* Note that cast is checked with H5_CHECK_OVERFLOW, above */ @@ -2852,7 +2852,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, else if(except_ret == H5T_CONV_ABORT) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCONVERT, FAIL, "can't handle conversion exception") } else - HDmemcpy(d, + H5MM_memcpy(d, dst->shared->u.enumer.value + (unsigned)priv->src2dst[n] * dst->shared->size, dst->shared->size); } /* end if */ @@ -2888,7 +2888,7 @@ H5T__conv_enum(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, } /* end if */ else { HDassert(priv->src2dst[md] >= 0); - HDmemcpy(d, + H5MM_memcpy(d, dst->shared->u.enumer.value + (unsigned)priv->src2dst[md] * dst->shared->size, dst->shared->size); } /* end else */ @@ -3846,7 +3846,7 @@ H5T__conv_i_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * should copy the value to the true destination buffer. */ if(d==dbuf) - HDmemcpy(dp, d, dst->shared->size); + H5MM_memcpy(dp, d, dst->shared->size); /* Advance source & destination pointers by delta amounts */ sp += src_delta; @@ -4432,7 +4432,7 @@ H5T__conv_f_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, */ next: if(d == dbuf) - HDmemcpy(dp, d, dst_p->shared->size); + H5MM_memcpy(dp, d, dst_p->shared->size); /* Advance source & destination pointers by delta amounts */ sp += src_delta; @@ -4604,7 +4604,7 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, --nchars; nchars = MIN(dst->shared->size, nchars); if(d != s) - HDmemcpy(d, s, nchars); + H5MM_memcpy(d, s, nchars); break; case H5T_STR_RESERVED_3: @@ -4666,7 +4666,7 @@ H5T__conv_s_s(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * should copy the value to the true destination buffer. */ if(d == dbuf) - HDmemcpy(dp, d, dst->shared->size); + H5MM_memcpy(dp, d, dst->shared->size); /* Advance source & destination pointers by delta amounts */ sp += src_delta; @@ -8833,7 +8833,7 @@ H5T__conv_f_i(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * should copy the value to the true destination buffer. */ if (d==dbuf) - HDmemcpy (dp, d, dst_p->shared->size); + H5MM_memcpy (dp, d, dst_p->shared->size); if (buf_stride) { sp += direction * (ssize_t) buf_stride; dp += direction * (ssize_t) buf_stride; @@ -9246,7 +9246,7 @@ H5T__conv_i_f(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * should copy the value to the true destination buffer. */ if (d==dbuf) - HDmemcpy (dp, d, dst_p->shared->size); + H5MM_memcpy (dp, d, dst_p->shared->size); if (buf_stride) { sp += direction * (ssize_t) buf_stride; dp += direction * (ssize_t) buf_stride; diff --git a/src/H5Tenum.c b/src/H5Tenum.c index ade7d08..969317b 100644 --- a/src/H5Tenum.c +++ b/src/H5Tenum.c @@ -225,7 +225,7 @@ H5T__enum_insert(const H5T_t *dt, const char *name, const void *value) dt->shared->u.enumer.sorted = H5T_SORT_NONE; i = dt->shared->u.enumer.nmembs++; dt->shared->u.enumer.name[i] = H5MM_xstrdup(name); - HDmemcpy(dt->shared->u.enumer.value+i*dt->shared->size, value, dt->shared->size); + H5MM_memcpy(dt->shared->u.enumer.value+i*dt->shared->size, value, dt->shared->size); done: FUNC_LEAVE_NOAPI(ret_value) @@ -300,7 +300,7 @@ H5T__get_member_value(const H5T_t *dt, unsigned membno, void *value/*out*/) HDassert(dt); HDassert(value); - HDmemcpy(value, dt->shared->u.enumer.value + membno*dt->shared->size, dt->shared->size); + H5MM_memcpy(value, dt->shared->u.enumer.value + membno*dt->shared->size, dt->shared->size); FUNC_LEAVE_NOAPI(SUCCEED) } @@ -571,7 +571,7 @@ H5T_enum_valueof(const H5T_t *dt, const char *name, void *value/*out*/) if (cmp!=0) HGOTO_ERROR(H5E_DATATYPE, H5E_NOTFOUND, FAIL, "string doesn't exist in the enumeration type") - HDmemcpy(value, copied_dt->shared->u.enumer.value+md*copied_dt->shared->size, copied_dt->shared->size); + H5MM_memcpy(value, copied_dt->shared->u.enumer.value+md*copied_dt->shared->size, copied_dt->shared->size); done: if(copied_dt) diff --git a/src/H5Tfields.c b/src/H5Tfields.c index be62d85..8202c2c 100644 --- a/src/H5Tfields.c +++ b/src/H5Tfields.c @@ -351,10 +351,10 @@ H5T__sort_value(const H5T_t *dt, int *map) dt->shared->u.enumer.name[j + 1] = tmp; /* Swap values */ - HDmemcpy(tbuf, dt->shared->u.enumer.value + (j * size), size); - HDmemcpy(dt->shared->u.enumer.value + (j * size), + H5MM_memcpy(tbuf, dt->shared->u.enumer.value + (j * size), size); + H5MM_memcpy(dt->shared->u.enumer.value + (j * size), dt->shared->u.enumer.value + ((j + 1) * size), size); - HDmemcpy(dt->shared->u.enumer.value + ((j + 1) * size), tbuf, size); + H5MM_memcpy(dt->shared->u.enumer.value + ((j + 1) * size), tbuf, size); /* Swap map */ if(map) { @@ -457,10 +457,10 @@ H5T__sort_name(const H5T_t *dt, int *map) dt->shared->u.enumer.name[j+1] = tmp; /* Swap values */ - HDmemcpy(tbuf, dt->shared->u.enumer.value+j*size, size); - HDmemcpy(dt->shared->u.enumer.value+j*size, + H5MM_memcpy(tbuf, dt->shared->u.enumer.value+j*size, size); + H5MM_memcpy(dt->shared->u.enumer.value+j*size, dt->shared->u.enumer.value+(j+1)*size, size); - HDmemcpy(dt->shared->u.enumer.value+(j+1)*size, tbuf, size); + H5MM_memcpy(dt->shared->u.enumer.value+(j+1)*size, tbuf, size); /* Swap map */ if (map) { diff --git a/src/H5Tnative.c b/src/H5Tnative.c index c7bbce4..1476b2f 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -369,7 +369,7 @@ H5T__get_native_type(H5T_t *dtype, H5T_direction_t direction, size_t *struct_ali HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member name") if(H5T__get_member_value(dtype, u, tmp_memb_value) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value") - HDmemcpy(memb_value, tmp_memb_value, H5T_get_size(super_type)); + H5MM_memcpy(memb_value, tmp_memb_value, H5T_get_size(super_type)); if(H5T_convert(tpath, super_type_id, nat_super_type_id, (size_t)1, (size_t)0, (size_t)0, memb_value, NULL) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "cannot get member value") diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index ba31cd1..6dcb1f9 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -301,7 +301,7 @@ H5T_vlen_seq_mem_getlen(const void *_vl) FUNC_LEAVE_NOAPI((ssize_t)vl->len) #else HDassert(_vl); - HDmemcpy(&vl, _vl, sizeof(hvl_t)); + H5MM_memcpy(&vl, _vl, sizeof(hvl_t)); FUNC_LEAVE_NOAPI((ssize_t)vl.len) #endif @@ -338,7 +338,7 @@ H5T_vlen_seq_mem_getptr(void *_vl) FUNC_LEAVE_NOAPI(vl->p) #else HDassert(_vl); - HDmemcpy(&vl, _vl, sizeof(hvl_t)); + H5MM_memcpy(&vl, _vl, sizeof(hvl_t)); FUNC_LEAVE_NOAPI(vl.p) #endif @@ -375,7 +375,7 @@ H5T_vlen_seq_mem_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl) FUNC_LEAVE_NOAPI((vl->len==0 || vl->p==NULL) ? TRUE : FALSE) #else HDassert(_vl); - HDmemcpy(&vl, _vl, sizeof(hvl_t)); + H5MM_memcpy(&vl, _vl, sizeof(hvl_t)); FUNC_LEAVE_NOAPI((vl.len==0 || vl.p==NULL) ? TRUE : FALSE) #endif @@ -410,13 +410,13 @@ H5T_vlen_seq_mem_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len) #ifdef H5_NO_ALIGNMENT_RESTRICTIONS HDassert(vl && vl->p); - HDmemcpy(buf,vl->p,len); + H5MM_memcpy(buf,vl->p,len); #else HDassert(_vl); - HDmemcpy(&vl, _vl, sizeof(hvl_t)); + H5MM_memcpy(&vl, _vl, sizeof(hvl_t)); HDassert(vl.p); - HDmemcpy(buf,vl.p,len); + H5MM_memcpy(buf,vl.p,len); #endif FUNC_LEAVE_NOAPI(SUCCEED) @@ -462,7 +462,7 @@ H5T_vlen_seq_mem_write(H5F_t H5_ATTR_UNUSED *f, const H5T_vlen_alloc_info_t *vl_ } /* end else */ /* Copy the data into the newly allocated buffer */ - HDmemcpy(vl.p,buf,len); + H5MM_memcpy(vl.p,buf,len); } /* end if */ else @@ -472,7 +472,7 @@ H5T_vlen_seq_mem_write(H5F_t H5_ATTR_UNUSED *f, const H5T_vlen_alloc_info_t *vl_ vl.len=seq_len; /* Set pointer in user's buffer with memcpy, to avoid alignment issues */ - HDmemcpy(_vl,&vl,sizeof(hvl_t)); + H5MM_memcpy(_vl,&vl,sizeof(hvl_t)); done: FUNC_LEAVE_NOAPI(ret_value) @@ -506,7 +506,7 @@ H5T_vlen_seq_mem_setnull(H5F_t H5_ATTR_UNUSED *f, void *_vl, void H5_ATTR_UNUSED vl.p=NULL; /* Set pointer in user's buffer with memcpy, to avoid alignment issues */ - HDmemcpy(_vl,&vl,sizeof(hvl_t)); + H5MM_memcpy(_vl,&vl,sizeof(hvl_t)); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5T_vlen_seq_mem_setnull() */ @@ -540,7 +540,7 @@ H5T_vlen_str_mem_getlen(const void *_vl) HDassert(s); #else HDassert(_vl); - HDmemcpy(&s, _vl, sizeof(char *)); + H5MM_memcpy(&s, _vl, sizeof(char *)); #endif FUNC_LEAVE_NOAPI((ssize_t)HDstrlen(s)) @@ -575,7 +575,7 @@ H5T_vlen_str_mem_getptr(void *_vl) HDassert(s); #else HDassert(_vl); - HDmemcpy(&s, _vl, sizeof(char *)); + H5MM_memcpy(&s, _vl, sizeof(char *)); #endif FUNC_LEAVE_NOAPI(s) @@ -606,7 +606,7 @@ H5T_vlen_str_mem_isnull(const H5F_t H5_ATTR_UNUSED *f, void *_vl) FUNC_ENTER_NOAPI_NOINIT_NOERR #ifndef H5_NO_ALIGNMENT_RESTRICTIONS - HDmemcpy(&s, _vl, sizeof(char *)); + H5MM_memcpy(&s, _vl, sizeof(char *)); #endif FUNC_LEAVE_NOAPI(s==NULL ? TRUE : FALSE) @@ -643,10 +643,10 @@ H5T_vlen_str_mem_read(H5F_t H5_ATTR_UNUSED *f, void *_vl, void *buf, size_t len) HDassert(s); #else HDassert(_vl); - HDmemcpy(&s, _vl, sizeof(char *)); + H5MM_memcpy(&s, _vl, sizeof(char *)); #endif - HDmemcpy(buf,s,len); + H5MM_memcpy(buf,s,len); } /* end if */ FUNC_LEAVE_NOAPI(SUCCEED) @@ -690,11 +690,11 @@ H5T_vlen_str_mem_write(H5F_t H5_ATTR_UNUSED *f, const H5T_vlen_alloc_info_t *vl_ } /* end else */ len=(seq_len*base_size); - HDmemcpy(t,buf,len); + H5MM_memcpy(t,buf,len); t[len]='\0'; /* Set pointer in user's buffer with memcpy, to avoid alignment issues */ - HDmemcpy(_vl,&t,sizeof(char *)); + H5MM_memcpy(_vl,&t,sizeof(char *)); done: FUNC_LEAVE_NOAPI(ret_value) /*lint !e429 The pointer in 't' has been copied */ @@ -721,7 +721,7 @@ H5T_vlen_str_mem_setnull(H5F_t H5_ATTR_UNUSED *f, void *_vl, void H5_ATTR_UNUSED FUNC_ENTER_NOAPI_NOINIT_NOERR /* Set pointer in user's buffer with memcpy, to avoid alignment issues */ - HDmemcpy(_vl,&t,sizeof(char *)); + H5MM_memcpy(_vl,&t,sizeof(char *)); FUNC_LEAVE_NOAPI(SUCCEED) /*lint !e429 The pointer in 't' has been copied */ } /* end H5T_vlen_str_mem_setnull() */ diff --git a/src/H5VM.c b/src/H5VM.c index 452d378..3e57ce8 100644 --- a/src/H5VM.c +++ b/src/H5VM.c @@ -732,7 +732,7 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size, /* Copy an element */ H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t); - HDmemcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */ + H5MM_memcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */ /* Decrement indices and advance pointers */ for (j=(int)(n-1), carry=TRUE; j>=0 && carry; --j) { @@ -749,7 +749,7 @@ H5VM_stride_copy(unsigned n, hsize_t elmt_size, const hsize_t *size, } } else { H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t); - HDmemcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */ + H5MM_memcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */ } FUNC_LEAVE_NOAPI(SUCCEED) @@ -801,7 +801,7 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size, /* Copy an element */ H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t); - HDmemcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */ + H5MM_memcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */ /* Decrement indices and advance pointers */ for (j=(int)(n-1), carry=TRUE; j>=0 && carry; --j) { @@ -818,7 +818,7 @@ H5VM_stride_copy_s(unsigned n, hsize_t elmt_size, const hsize_t *size, } } else { H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t); - HDmemcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */ + H5MM_memcpy (dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */ } FUNC_LEAVE_NOAPI(SUCCEED) @@ -877,7 +877,7 @@ H5VM_stride_copy2(hsize_t nelmts, hsize_t elmt_size, /* Copy an element */ H5_CHECK_OVERFLOW(elmt_size,hsize_t,size_t); - HDmemcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */ + H5MM_memcpy(dst, src, (size_t)elmt_size); /*lint !e671 The elmt_size will be OK */ /* Decrement indices and advance pointers */ for (j=(int)(dst_n-1), carry=TRUE; j>=0 && carry; --j) { @@ -936,7 +936,7 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count) HDassert(size < SIZET_MAX && size > 0); HDassert(count < SIZET_MAX && count > 0); - HDmemcpy(dst, src, size); /* copy first item */ + H5MM_memcpy(dst, src, size); /* copy first item */ /* Initialize counters, etc. while compensating for first element copied */ copy_size = size; @@ -947,7 +947,7 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count) /* copy until we've copied at least half of the items */ while (items_left >= copy_items) { - HDmemcpy(dst, _dst, copy_size); /* copy the current chunk */ + H5MM_memcpy(dst, _dst, copy_size); /* copy the current chunk */ dst += copy_size; /* move the offset for the next chunk */ items_left -= copy_items; /* decrement the number of items left */ @@ -955,7 +955,7 @@ H5VM_array_fill(void *_dst, const void *src, size_t size, size_t count) copy_items *= 2; /* increase the count of items we are copying */ } /* end while */ if (items_left > 0) /* if there are any items left to copy */ - HDmemcpy(dst, _dst, items_left * size); + H5MM_memcpy(dst, _dst, items_left * size); FUNC_LEAVE_NOAPI(SUCCEED) } /* H5VM_array_fill() */ @@ -1623,7 +1623,7 @@ src_smaller: acc_len = 0; do { /* Copy data */ - HDmemcpy(dst, src, tmp_src_len); + H5MM_memcpy(dst, src, tmp_src_len); /* Accumulate number of bytes copied */ acc_len += tmp_src_len; @@ -1666,7 +1666,7 @@ dst_smaller: acc_len = 0; do { /* Copy data */ - HDmemcpy(dst, src, tmp_dst_len); + H5MM_memcpy(dst, src, tmp_dst_len); /* Accumulate number of bytes copied */ acc_len += tmp_dst_len; @@ -1709,7 +1709,7 @@ equal: acc_len = 0; do { /* Copy data */ - HDmemcpy(dst, src, tmp_dst_len); + H5MM_memcpy(dst, src, tmp_dst_len); /* Accumulate number of bytes copied */ acc_len += tmp_dst_len; diff --git a/src/H5VMprivate.h b/src/H5VMprivate.h index decac7e..26f59e2 100644 --- a/src/H5VMprivate.h +++ b/src/H5VMprivate.h @@ -21,6 +21,7 @@ /* Private headers needed by this file */ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ +#include "H5MMprivate.h" /* Memory management */ /* Vector-Vector sequence operation callback */ typedef herr_t (*H5VM_opvv_func_t)(hsize_t dst_off, hsize_t src_off, @@ -41,7 +42,7 @@ typedef herr_t (*H5VM_opvv_func_t)(hsize_t dst_off, hsize_t src_off, /* Other functions */ #define H5VM_vector_cpy(N,DST,SRC) { \ HDassert(sizeof(*(DST))==sizeof(*(SRC))); \ - if (SRC) HDmemcpy (DST, SRC, (N)*sizeof(*(DST))); \ + if (SRC) H5MM_memcpy (DST, SRC, (N)*sizeof(*(DST))); \ else HDmemset (DST, 0, (N)*sizeof(*(DST))); \ } diff --git a/src/H5Z.c b/src/H5Z.c index baea0d1..e418f7e 100644 --- a/src/H5Z.c +++ b/src/H5Z.c @@ -322,7 +322,7 @@ H5Z_register (const H5Z_class2_t *cls) /* Initialize */ i = H5Z_table_used_g++; - HDmemcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t)); + H5MM_memcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t)); #ifdef H5Z_DEBUG HDmemset(H5Z_stat_table_g+i, 0, sizeof(H5Z_stats_t)); #endif /* H5Z_DEBUG */ @@ -330,7 +330,7 @@ H5Z_register (const H5Z_class2_t *cls) /* Filter already registered */ else { /* Replace old contents */ - HDmemcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t)); + H5MM_memcpy(H5Z_table_g+i, cls, sizeof(H5Z_class2_t)); } /* end else */ done: diff --git a/src/H5Zfletcher32.c b/src/H5Zfletcher32.c index 4cd77ef..4d75d14 100644 --- a/src/H5Zfletcher32.c +++ b/src/H5Zfletcher32.c @@ -108,7 +108,7 @@ H5Z_filter_fletcher32 (unsigned flags, size_t H5_ATTR_UNUSED cd_nelmts, const un * system. We'll check both the correct checksum and the wrong * checksum to be consistent with Release 1.6.2 and before. */ - HDmemcpy(c, &fletcher, (size_t)4); + H5MM_memcpy(c, &fletcher, (size_t)4); tmp = c[1]; c[1] = c[0]; @@ -118,7 +118,7 @@ H5Z_filter_fletcher32 (unsigned flags, size_t H5_ATTR_UNUSED cd_nelmts, const un c[3] = c[2]; c[2] = tmp; - HDmemcpy(&reversed_fletcher, c, (size_t)4); + H5MM_memcpy(&reversed_fletcher, c, (size_t)4); /* Verify computed checksum matches stored checksum */ if(stored_fletcher != fletcher && stored_fletcher != reversed_fletcher) @@ -140,7 +140,7 @@ H5Z_filter_fletcher32 (unsigned flags, size_t H5_ATTR_UNUSED cd_nelmts, const un dst = (unsigned char *) outbuf; /* Copy raw data */ - HDmemcpy((void*)dst, (void*)(*buf), nbytes); + H5MM_memcpy((void*)dst, (void*)(*buf), nbytes); /* Append checksum to raw data for storage */ dst += nbytes; diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 0026749..d3e8fc0 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -141,7 +141,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ } /* end if */ \ \ /* Copy the value */ \ - HDmemcpy(&_cd_value, _fv_p, _copy_size); \ + H5MM_memcpy(&_cd_value, _fv_p, _copy_size); \ (cd_values)[_i] = (unsigned)_cd_value; \ \ /* Next field */ \ @@ -158,7 +158,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ _fv_p = ((char *)&(fill_val)) + sizeof(type) - MIN(4, _size_rem); \ while(_size_rem >= 4) { \ /* Copy the value */ \ - HDmemcpy(&_cd_value, _fv_p, _copy_size); \ + H5MM_memcpy(&_cd_value, _fv_p, _copy_size); \ (cd_values)[_i] = (unsigned)_cd_value; \ \ /* Next field */ \ @@ -176,7 +176,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ * _cd_value as it will not be fully overwritten and copy to the end \ * of _cd value as it is BE. */ \ _cd_value = (uint32_t)0; \ - HDmemcpy((char *)&_cd_value + 4 - _size_rem, _fv_p, _size_rem); \ + H5MM_memcpy((char *)&_cd_value + 4 - _size_rem, _fv_p, _size_rem); \ (cd_values)[_i] = (unsigned)_cd_value; \ } /* end if */ \ } /* end else */ \ @@ -269,7 +269,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ \ /* Copy the value */ \ _cd_value = (uint32_t)(cd_values)[_i]; \ - HDmemcpy(_fv_p, &_cd_value, _copy_size); \ + H5MM_memcpy(_fv_p, &_cd_value, _copy_size); \ \ /* Next field */ \ _i++; \ @@ -286,7 +286,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ while(_size_rem >= 4) { \ /* Copy the value */ \ _cd_value = (uint32_t)(cd_values)[_i]; \ - HDmemcpy(_fv_p, &_cd_value, _copy_size); \ + H5MM_memcpy(_fv_p, &_cd_value, _copy_size); \ \ /* Next field */ \ _i++; \ @@ -303,7 +303,7 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ * _cd_value as it will not be fully overwritten and copy to the end \ * of _cd value as it is BE. */ \ _cd_value = (uint32_t)(cd_values)[_i]; \ - HDmemcpy(_fv_p, (char *)&_cd_value + 4 - _size_rem, _size_rem); \ + H5MM_memcpy(_fv_p, (char *)&_cd_value + 4 - _size_rem, _size_rem); \ } /* end if */ \ } /* end else */ \ } @@ -529,10 +529,10 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ * account for offset in BE if sizes differ \ */ \ if(H5T_native_order_g == H5T_ORDER_LE) \ - HDmemcpy(minval, &min, sizeof(type)); \ + H5MM_memcpy(minval, &min, sizeof(type)); \ else { \ HDassert(H5T_native_order_g == H5T_ORDER_BE); \ - HDmemcpy(((char *)minval) + (sizeof(long long) - sizeof(type)), \ + H5MM_memcpy(((char *)minval) + (sizeof(long long) - sizeof(type)), \ &min, sizeof(type)); \ } /* end else */ \ else \ @@ -604,10 +604,10 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{ * account for offset in BE if sizes differ \ */ \ if(H5T_native_order_g == H5T_ORDER_LE) \ - HDmemcpy(&min, &minval, sizeof(type)); \ + H5MM_memcpy(&min, &minval, sizeof(type)); \ else { \ HDassert(H5T_native_order_g == H5T_ORDER_BE); \ - HDmemcpy(&min, ((char *)&minval) + (sizeof(long long) \ + H5MM_memcpy(&min, ((char *)&minval) + (sizeof(long long) \ - sizeof(type)), sizeof(type)); \ } /* end else */ \ else \ @@ -1173,7 +1173,7 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value /* special case: minbits equal to full precision */ if(minbits == p.size * 8) { - HDmemcpy(outbuf, (unsigned char*)(*buf)+buf_offset, size_out); + H5MM_memcpy(outbuf, (unsigned char*)(*buf)+buf_offset, size_out); /* free the original buffer */ H5MM_xfree(*buf); @@ -1273,7 +1273,7 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value /* special case: minbits equal to full precision */ if(minbits == p.size * 8) { - HDmemcpy(outbuf + buf_offset, *buf, nbytes); + H5MM_memcpy(outbuf + buf_offset, *buf, nbytes); /* free the original buffer */ H5MM_xfree(*buf); diff --git a/src/H5Zshuffle.c b/src/H5Zshuffle.c index 1fef1c1..e70ef33 100644 --- a/src/H5Zshuffle.c +++ b/src/H5Zshuffle.c @@ -210,7 +210,7 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], if(leftover>0) { /* Adjust back to end of shuffled bytes */ _dest -= (bytesoftype - 1); /*lint !e794 _dest is initialized */ - HDmemcpy((void*)_dest, (void*)_src, leftover); + H5MM_memcpy((void*)_dest, (void*)_src, leftover); } } /* end if */ else { @@ -268,7 +268,7 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], if(leftover>0) { /* Adjust back to end of shuffled bytes */ _src -= (bytesoftype - 1); /*lint !e794 _src is initialized */ - HDmemcpy((void*)_dest, (void*)_src, leftover); + H5MM_memcpy((void*)_dest, (void*)_src, leftover); } } /* end else */ diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index a7c3faf..2245bd3 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -1078,7 +1078,7 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size if(NULL == (data_xform_prop->dat_val_pointers->ptr_dat_val[i] = (void*)H5MM_malloc(array_size * H5T_get_size((H5T_t *)H5I_object(array_type))))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "Ran out of memory trying to allocate space for data in data transform") - HDmemcpy(data_xform_prop->dat_val_pointers->ptr_dat_val[i], array, array_size * H5T_get_size((H5T_t *)H5I_object(array_type))); + H5MM_memcpy(data_xform_prop->dat_val_pointers->ptr_dat_val[i], array, array_size * H5T_get_size((H5T_t *)H5I_object(array_type))); } /* end for */ } /* end else */ @@ -1086,7 +1086,7 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void* array, size_t array_size HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "error while performing data transform") if(data_xform_prop->dat_val_pointers->num_ptrs > 1) - HDmemcpy(array, res.value.dat_val, array_size * H5T_get_size((H5T_t *)H5I_object(array_type))); + H5MM_memcpy(array, res.value.dat_val, array_size * H5T_get_size((H5T_t *)H5I_object(array_type))); /* Free the temporary arrays we used */ if(data_xform_prop->dat_val_pointers->num_ptrs > 1) -- cgit v0.12