Skip to content

Commit

Permalink
Remove HD from HDmem* calls (#3211)
Browse files Browse the repository at this point in the history
  • Loading branch information
derobins authored Jun 29, 2023
1 parent fd933f3 commit 39e6bf4
Show file tree
Hide file tree
Showing 320 changed files with 2,914 additions and 2,934 deletions.
8 changes: 4 additions & 4 deletions c++/test/dsets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -726,8 +726,8 @@ test_nbit_compression(H5File &file)

SUBTEST("N-bit compression (setup)");

HDmemset(orig_data, 0, DIM1 * DIM2 * sizeof(s1_t));
HDmemset(new_data, 0, DIM1 * DIM2 * sizeof(s1_t));
memset(orig_data, 0, DIM1 * DIM2 * sizeof(s1_t));
memset(new_data, 0, DIM1 * DIM2 * sizeof(s1_t));

try {
// Define datatypes of members of compound datatype
Expand Down Expand Up @@ -1093,15 +1093,15 @@ test_getnativeinfo(H5File &file)

// Get dataset header info
H5O_native_info_t ninfo;
HDmemset(&ninfo, 0, sizeof(ninfo));
memset(&ninfo, 0, sizeof(ninfo));
dataset.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR);
verify_val(static_cast<long>(ninfo.hdr.nchunks), 1, "DataSet::getNativeObjinfo", __LINE__, __FILE__);
dataset.close();

// Open the dataset we created above and then close it. This is one
// way to open an existing dataset for accessing.
dataset = file.openDataSet(DSET_DEFAULT_NAME);
HDmemset(&ninfo, 0, sizeof(ninfo));
memset(&ninfo, 0, sizeof(ninfo));
dataset.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_ALL);
verify_val(static_cast<long>(ninfo.hdr.nchunks), 1, "DataSet::getNativeObjinfo", __LINE__, __FILE__);
dataset.close();
Expand Down
2 changes: 1 addition & 1 deletion c++/test/tarray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ test_array_compound_array()
verify_val(ndims, ARRAY1_RANK, "f2_atype_check.getArrayNDims", __LINE__, __FILE__);

// Get the array dimensions
HDmemset(rdims1, 0, sizeof(rdims1));
memset(rdims1, 0, sizeof(rdims1));
f2_atype_check.getArrayDims(rdims1);

// Check the array dimensions
Expand Down
14 changes: 7 additions & 7 deletions c++/test/tattr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ test_attr_getname(FileAccPropList &fapl)
// 1. With arbitrary buf_size that is larger than the name size
size_t buf_size = FATTR1_NAME.length() + 10;
char *fattr1_name = new char[buf_size + 1];
HDmemset(fattr1_name, 0, buf_size + 1);
memset(fattr1_name, 0, buf_size + 1);
ssize_t name_size = 0; // actual length of attribute name
name_size = fattr1.getName(fattr1_name, buf_size + 1);
CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__);
Expand All @@ -312,7 +312,7 @@ test_attr_getname(FileAccPropList &fapl)
buf_size = 4;
char short_name[5] = "File"; // to verify the read name
fattr1_name = new char[buf_size + 1];
HDmemset(fattr1_name, 0, buf_size + 1);
memset(fattr1_name, 0, buf_size + 1);
name_size = fattr1.getName(fattr1_name, buf_size + 1);
CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__);
verify_val(static_cast<size_t>(name_size), FATTR1_NAME.size(), "Attribute::getName", __LINE__,
Expand All @@ -324,7 +324,7 @@ test_attr_getname(FileAccPropList &fapl)
// 3. With a buf_size that equals the name's length.
buf_size = FATTR1_NAME.length();
fattr1_name = new char[buf_size + 1];
HDmemset(fattr1_name, 0, buf_size + 1);
memset(fattr1_name, 0, buf_size + 1);
name_size = fattr1.getName(fattr1_name, buf_size + 1);
CHECK(name_size, FAIL, "Attribute::getName", __LINE__, __FILE__);
verify_val(fattr1_name, FATTR1_NAME, "Attribute::getName", __LINE__, __FILE__);
Expand Down Expand Up @@ -531,7 +531,7 @@ test_attr_basic_read(FileAccPropList &fapl)

// Verify the correct number of attributes another way
H5O_info2_t oinfo;
HDmemset(&oinfo, 0, sizeof(oinfo));
memset(&oinfo, 0, sizeof(oinfo));
dataset.getObjinfo(oinfo, H5O_INFO_NUM_ATTRS);
verify_val(static_cast<long>(oinfo.num_attrs), 3, "DataSet::getObjinfo", __LINE__, __FILE__);

Expand Down Expand Up @@ -560,7 +560,7 @@ test_attr_basic_read(FileAccPropList &fapl)
verify_val(num_attrs, 1, "Group::getNumAttrs", __LINE__, __FILE__);

// Verify the correct number of attributes another way
HDmemset(&oinfo, 0, sizeof(oinfo));
memset(&oinfo, 0, sizeof(oinfo));
group.getObjinfo(oinfo, H5O_INFO_NUM_ATTRS);
verify_val(static_cast<long>(oinfo.num_attrs), 1, "Group::getObjinfo", __LINE__, __FILE__);

Expand Down Expand Up @@ -686,7 +686,7 @@ test_attr_compound_read(FileAccPropList &fapl)

// Verify the correct number of attributes another way
H5O_info2_t oinfo;
HDmemset(&oinfo, 0, sizeof(oinfo));
memset(&oinfo, 0, sizeof(oinfo));
dataset.getObjinfo(oinfo, H5O_INFO_NUM_ATTRS);
verify_val(static_cast<long>(oinfo.num_attrs), 1, "DataSet::getObjinfo", __LINE__, __FILE__);

Expand Down Expand Up @@ -789,7 +789,7 @@ test_attr_compound_read(FileAccPropList &fapl)
hsize_t ii, jj;
for (ii = 0; ii < ATTR4_DIM1; ii++)
for (jj = 0; jj < ATTR4_DIM2; jj++)
if (HDmemcmp(&attr_data4[ii][jj], &read_data4[ii][jj], sizeof(struct attr4_struct)) != 0) {
if (memcmp(&attr_data4[ii][jj], &read_data4[ii][jj], sizeof(struct attr4_struct)) != 0) {
TestErrPrintf("%d:attribute data different: attr_data4[%" PRIuHSIZE "][%" PRIuHSIZE
"].i=%d, "
"read_data4[%" PRIuHSIZE "][%" PRIuHSIZE "].i=%d\n",
Expand Down
2 changes: 1 addition & 1 deletion c++/test/tcompound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ test_compound_2()
s_ptr->d = i * 8 + 6;
s_ptr->e = i * 8 + 7;
}
HDmemcpy(buf, orig, nelmts * sizeof(src_typ_t));
memcpy(buf, orig, nelmts * sizeof(src_typ_t));

// Build hdf5 datatypes
array_dt = new ArrayType(PredType::NATIVE_INT, 1, &four);
Expand Down
6 changes: 3 additions & 3 deletions c++/test/tdspl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ test_transfplist()
// for it, then read and verify the expression from the copied plist
size_t tran_len = static_cast<size_t>(dxpl_c_to_f_copy.getDataTransform(NULL));
char *c_to_f_read = static_cast<char *>(malloc(tran_len + 1));
HDmemset(c_to_f_read, 0, tran_len + 1);
memset(c_to_f_read, 0, tran_len + 1);
dxpl_c_to_f_copy.getDataTransform(c_to_f_read, tran_len + 1);
verify_val(const_cast<const char *>(c_to_f_read), const_cast<const char *>(c_to_f),
"DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
Expand All @@ -76,7 +76,7 @@ test_transfplist()
// ssize_t getDataTransform(char* exp, const size_t buf_size [default=0])
tran_len = static_cast<size_t>(dxpl_c_to_f.getDataTransform(NULL));
c_to_f_read = static_cast<char *>(malloc(tran_len + 1));
HDmemset(c_to_f_read, 0, tran_len + 1);
memset(c_to_f_read, 0, tran_len + 1);
dxpl_c_to_f.getDataTransform(c_to_f_read, tran_len + 1);
verify_val(const_cast<const char *>(c_to_f_read), const_cast<const char *>(c_to_f),
"DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
Expand All @@ -92,7 +92,7 @@ test_transfplist()
// ssize_t getDataTransform(char* exp, const size_t buf_size)
tran_len = static_cast<size_t>(dxpl_utrans_inv.getDataTransform(NULL, 0));
char *utrans_inv_read = static_cast<char *>(malloc(tran_len + 1));
HDmemset(utrans_inv_read, 0, tran_len + 1);
memset(utrans_inv_read, 0, tran_len + 1);
dxpl_utrans_inv.getDataTransform(utrans_inv_read, tran_len + 1);
verify_val(const_cast<const char *>(utrans_inv_read), const_cast<const char *>(utrans_inv),
"DSetMemXferPropList::getDataTransform", __LINE__, __FILE__);
Expand Down
6 changes: 3 additions & 3 deletions c++/test/tfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ test_file_attribute()
verify_val(n_attrs, 1, "DataSet::getNumAttrs()", __LINE__, __FILE__);

// Read back attribute's data
HDmemset(rdata, 0, sizeof(rdata));
memset(rdata, 0, sizeof(rdata));
dattr.read(PredType::NATIVE_INT, rdata);
/* Check results */
for (i = 0; i < ATTR1_DIM1; i++) {
Expand Down Expand Up @@ -682,7 +682,7 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, H5F

// Verify object header version another way
H5O_native_info_t ninfo;
HDmemset(&ninfo, 0, sizeof(ninfo));
memset(&ninfo, 0, sizeof(ninfo));
file.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR);
verify_val(ninfo.hdr.version, oh_vers_create, "H5File::getNativeObjinfo", __LINE__, __FILE__);

Expand All @@ -709,7 +709,7 @@ test_libver_bounds_real(H5F_libver_t libver_create, unsigned oh_vers_create, H5F
verify_val(obj_version, oh_vers_mod, "Group::objVersion", __LINE__, __FILE__);

// Verify object header version another way
HDmemset(&ninfo, 0, sizeof(ninfo));
memset(&ninfo, 0, sizeof(ninfo));
group.getNativeObjinfo(ninfo, H5O_NATIVE_INFO_HDR);
verify_val(ninfo.hdr.version, oh_vers_mod, "Group::getNativeObjinfo", __LINE__, __FILE__);

Expand Down
12 changes: 6 additions & 6 deletions c++/test/th5s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ test_h5s_basic()
hsize_t tdims[4]; // Dimension array to test with
ndims = sid1.getSimpleExtentDims(tdims);
verify_val(ndims, SPACE1_RANK, "DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
verify_val(HDmemcmp(tdims, dims1, SPACE1_RANK * sizeof(unsigned)), 0,
"DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
verify_val(memcmp(tdims, dims1, SPACE1_RANK * sizeof(unsigned)), 0, "DataSpace::getSimpleExtentDims",
__LINE__, __FILE__);

// Create simple dataspace sid2
hsize_t max2[] = {SPACE2_MAX1, SPACE2_MAX2, SPACE2_MAX3, SPACE2_MAX4};
Expand All @@ -135,9 +135,9 @@ test_h5s_basic()
// Retrieves dimension size and max size of dataspace sid2 and
// verify them
ndims = sid2.getSimpleExtentDims(tdims, tmax);
verify_val(HDmemcmp(tdims, dims2, SPACE2_RANK * sizeof(unsigned)), 0,
"DataSpace::getSimpleExtentDims", __LINE__, __FILE__);
verify_val(HDmemcmp(tmax, max2, SPACE2_RANK * sizeof(unsigned)), 0, "DataSpace::getSimpleExtentDims",
verify_val(memcmp(tdims, dims2, SPACE2_RANK * sizeof(unsigned)), 0, "DataSpace::getSimpleExtentDims",
__LINE__, __FILE__);
verify_val(memcmp(tmax, max2, SPACE2_RANK * sizeof(unsigned)), 0, "DataSpace::getSimpleExtentDims",
__LINE__, __FILE__);

// Check to be sure we can't create a simple data space that has too
Expand Down Expand Up @@ -444,7 +444,7 @@ test_h5s_compound_scalar_read()
dataset.read(&rdata, type);

// Verify read data
if (HDmemcmp(&space4_data, &rdata, sizeof(struct space4_struct)) != 0) {
if (memcmp(&space4_data, &rdata, sizeof(struct space4_struct)) != 0) {
cerr << "scalar data different: space4_data.c1=" << space4_data.c1
<< ", read_data4.c1=" << rdata.c1 << endl;
cerr << "scalar data different: space4_data.u=" << space4_data.u << ", read_data4.u=" << rdata.u
Expand Down
12 changes: 6 additions & 6 deletions c++/test/tobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,8 @@ test_getobjectinfo_same_file()
Group grp2(file1.createGroup(GROUP2NAME));

// Reset object info
HDmemset(&oinfo1, 0, sizeof(oinfo1));
HDmemset(&oinfo2, 0, sizeof(oinfo2));
memset(&oinfo1, 0, sizeof(oinfo1));
memset(&oinfo2, 0, sizeof(oinfo2));

// Query the info of two groups and verify that they have the same
// file number
Expand All @@ -559,8 +559,8 @@ test_getobjectinfo_same_file()
grp2 = file2.openGroup(GROUP2NAME);

// Reset object info
HDmemset(&oinfo1, 0, sizeof(oinfo1));
HDmemset(&oinfo2, 0, sizeof(oinfo2));
memset(&oinfo1, 0, sizeof(oinfo1));
memset(&oinfo2, 0, sizeof(oinfo2));

// Query the info of two groups and verify that they have the same
// file number
Expand All @@ -569,8 +569,8 @@ test_getobjectinfo_same_file()
verify_val(oinfo1.fileno, oinfo2.fileno, "file number from getObjinfo", __LINE__, __FILE__);

// Reset object info
HDmemset(&oinfo1, 0, sizeof(oinfo1));
HDmemset(&oinfo2, 0, sizeof(oinfo2));
memset(&oinfo1, 0, sizeof(oinfo1));
memset(&oinfo2, 0, sizeof(oinfo2));

file1.getObjinfo(GROUP1NAME, oinfo1);
file1.getObjinfo(GROUP2NAME, oinfo2);
Expand Down
4 changes: 2 additions & 2 deletions c++/test/trefer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -488,14 +488,14 @@ test_reference_group()

// Check object type using Group::getObjinfo()
H5O_info2_t oinfo;
HDmemset(&oinfo, 0, sizeof(oinfo));
memset(&oinfo, 0, sizeof(oinfo));
group.getObjinfo(".", H5_INDEX_NAME, H5_ITER_INC, 0, oinfo);
verify_val(static_cast<long>(oinfo.type), static_cast<long>(H5O_TYPE_DATASET), "Group::getObjinfo",
__LINE__, __FILE__);

// Check for out of bound query by index
try {
HDmemset(&oinfo, 0, sizeof(oinfo));
memset(&oinfo, 0, sizeof(oinfo));
group.getObjinfo(".", H5_INDEX_NAME, H5_ITER_INC, 9, oinfo);

// Should FAIL but didn't, so throw an invalid action exception
Expand Down
6 changes: 3 additions & 3 deletions c++/test/tvlstr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ test_vlstring_dataset()
dset1 = root.createDataSet("test_scalar_small", vlst, ds_space);

dynstring_ds_write = static_cast<char *>(calloc(2, sizeof(char)));
HDmemset(dynstring_ds_write, 'A', 1);
memset(dynstring_ds_write, 'A', 1);

// Write data to the dataset, then read it back.
dset1.write(&dynstring_ds_write, vlst);
Expand Down Expand Up @@ -277,7 +277,7 @@ test_vlstring_array_dataset()
// Create and write another dataset.
DataSet dataset2(file1->createDataSet("Dataset2", vlst, scalar_space));
char *wdata2 = static_cast<char *>(calloc(65534, sizeof(char)));
HDmemset(wdata2, 'A', 65533);
memset(wdata2, 'A', 65533);
dataset2.write(&wdata2, vlst);

char *rdata2;
Expand Down Expand Up @@ -654,7 +654,7 @@ test_vlstring_attribute()
gr_attr = root.createAttribute("test_scalar_large", vlst, att_space);

string_att_write = static_cast<char *>(calloc(8192, sizeof(char)));
HDmemset(string_att_write, 'A', 8191);
memset(string_att_write, 'A', 8191);

// Write data to the attribute, then read it back.
gr_attr.write(vlst, &string_att_write);
Expand Down
2 changes: 1 addition & 1 deletion hl/c++/test/ptableTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ TestHDFFV_9758()
ptable.ResetIndex();
for (size_t i = 0; i < NUM_PACKETS; i++) {
s1_t s2;
HDmemset(&s2, 0, sizeof(s1_t));
memset(&s2, 0, sizeof(s1_t));
err = ptable.GetNextPacket(&s2);
if (err < 0)
goto error;
Expand Down
2 changes: 1 addition & 1 deletion src/H5.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ H5_init_library(void)
/*
* Make sure the package information is updated.
*/
HDmemset(&H5_debug_g, 0, sizeof H5_debug_g);
memset(&H5_debug_g, 0, sizeof H5_debug_g);
H5_debug_g.pkg[H5_PKG_A].name = "a";
H5_debug_g.pkg[H5_PKG_AC].name = "ac";
H5_debug_g.pkg[H5_PKG_B].name = "b";
Expand Down
6 changes: 3 additions & 3 deletions src/H5Adense.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo)

/* Set fractal heap creation parameters */
/* XXX: Give some control of these to applications? */
HDmemset(&fheap_cparam, 0, sizeof(fheap_cparam));
memset(&fheap_cparam, 0, sizeof(fheap_cparam));
fheap_cparam.managed.width = H5O_FHEAP_MAN_WIDTH;
fheap_cparam.managed.start_block_size = H5O_FHEAP_MAN_START_BLOCK_SIZE;
fheap_cparam.managed.max_direct_size = H5O_FHEAP_MAN_MAX_DIRECT_SIZE;
Expand Down Expand Up @@ -206,7 +206,7 @@ H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo)
#endif /* NDEBUG */

/* Create the name index v2 B-tree */
HDmemset(&bt2_cparam, 0, sizeof(bt2_cparam));
memset(&bt2_cparam, 0, sizeof(bt2_cparam));
bt2_cparam.cls = H5A_BT2_NAME;
bt2_cparam.node_size = (size_t)H5A_NAME_BT2_NODE_SIZE;
bt2_cparam.rrec_size = 4 + /* Name's hash value */
Expand All @@ -225,7 +225,7 @@ H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo)
/* Check if we should create a creation order index v2 B-tree */
if (ainfo->index_corder) {
/* Create the creation order index v2 B-tree */
HDmemset(&bt2_cparam, 0, sizeof(bt2_cparam));
memset(&bt2_cparam, 0, sizeof(bt2_cparam));
bt2_cparam.cls = H5A_BT2_CORDER;
bt2_cparam.node_size = (size_t)H5A_CORDER_BT2_NODE_SIZE;
bt2_cparam.rrec_size = 4 + /* Creation order index */
Expand Down
8 changes: 4 additions & 4 deletions src/H5Aint.c
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf)

/* Check if the attribute has any data yet, if not, fill with zeroes */
if (attr->obj_opened && !attr->shared->data)
HDmemset(buf, 0, (dst_type_size * nelmts));
memset(buf, 0, (dst_type_size * nelmts));
else { /* Attribute exists and has a value */
/* Convert memory buffer into disk buffer */
/* Set up type conversion function */
Expand Down Expand Up @@ -869,7 +869,7 @@ H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf)
/* Clear background buffer if it's not supposed to be initialized with file
* contents */
if (need_bkg == H5T_BKG_TEMP)
HDmemset(bkg_buf, 0, dst_type_size * nelmts);
memset(bkg_buf, 0, dst_type_size * nelmts);
}
else if (NULL == (bkg_buf = H5FL_BLK_CALLOC(attr_buf, buf_size)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTALLOC, FAIL, "memory allocation failed")
Expand Down Expand Up @@ -2281,7 +2281,7 @@ H5A__attr_copy_file(const H5A_t *attr_src, H5F_t *file_dst, hbool_t *recompute_s

/* Set background buffer to all zeros */
if (bkg_buf)
HDmemset(bkg_buf, 0, buf_size);
memset(bkg_buf, 0, buf_size);

/* Convert from memory to destination file */
if (H5T_convert(tpath_mem_dst, tid_mem, tid_dst, nelmts, (size_t)0, (size_t)0, buf, bkg_buf) < 0)
Expand Down Expand Up @@ -2424,7 +2424,7 @@ H5A__attr_post_copy_file(const H5O_loc_t *src_oloc, const H5A_t *attr_src, H5O_l
} /* end if */
else
/* Reset value to zero */
HDmemset(attr_dst->shared->data, 0, attr_dst->shared->data_size);
memset(attr_dst->shared->data, 0, attr_dst->shared->data_size);
} /* end if */

done:
Expand Down
Loading

0 comments on commit 39e6bf4

Please sign in to comment.