summaryrefslogtreecommitdiffstats
path: root/c++
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2023-09-15 22:13:18 (GMT)
committerGitHub <noreply@github.com>2023-09-15 22:13:18 (GMT)
commit44a00ef876ad3e1922847e93feac57c479217fbe (patch)
tree5e9fc677913a06a71eba1342633f92e93bd07a6c /c++
parent59a90368cdb696205bdf15040d1a48b4f69af97f (diff)
downloadhdf5-44a00ef876ad3e1922847e93feac57c479217fbe.zip
hdf5-44a00ef876ad3e1922847e93feac57c479217fbe.tar.gz
hdf5-44a00ef876ad3e1922847e93feac57c479217fbe.tar.bz2
Strip HD prefix from string/char C API calls (#3540)
* Strip HD prefix from string/char C API calls * HD(f)(put|get)(s|c) * HDstr* * HDv*printf * HD(s)(print|scan)f * HDperror But NOT: * HDstrcase* * HDvasprintf * HDstrtok_r * HDstrndup As those are not C99 and have portability work-around implementations. They will be handled later. * Fix th5_system.c screwup
Diffstat (limited to 'c++')
-rw-r--r--c++/test/tarray.cpp2
-rw-r--r--c++/test/tattr.cpp10
-rw-r--r--c++/test/titerate.cpp20
-rw-r--r--c++/test/tobject.cpp2
-rw-r--r--c++/test/tvlstr.cpp34
5 files changed, 34 insertions, 34 deletions
diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp
index f616dcd..2d14264 100644
--- a/c++/test/tarray.cpp
+++ b/c++/test/tarray.cpp
@@ -220,7 +220,7 @@ test_array_compound_array()
// Check the 2nd field's name
H5std_string field2_name = ctype_check.getMemberName(1);
- if (HDstrcmp(field2_name.c_str(), "f") != 0)
+ if (strcmp(field2_name.c_str(), "f") != 0)
TestErrPrintf("Compound field name doesn't match!, field2_name=%s\n", field2_name.c_str());
// Get the 2nd field's datatype
diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp
index e018ab1..2f011d0 100644
--- a/c++/test/tattr.cpp
+++ b/c++/test/tattr.cpp
@@ -1604,7 +1604,7 @@ test_string_attr(FileAccPropList &fapl)
// Read and verify the attribute string as a string of chars.
char flstring_att_check[ATTR_LEN];
gr_flattr1.read(fls_type, flstring_att_check);
- if (HDstrcmp(flstring_att_check, ATTRSTR_DATA.c_str()) != 0)
+ if (strcmp(flstring_att_check, ATTRSTR_DATA.c_str()) != 0)
TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",
__LINE__, ATTRSTR_DATA.c_str(), flstring_att_check);
@@ -1614,7 +1614,7 @@ test_string_attr(FileAccPropList &fapl)
char *fl_dyn_string_att_check;
fl_dyn_string_att_check = new char[attr_size + 1];
gr_flattr1.read(fls_type, fl_dyn_string_att_check);
- if (HDstrcmp(fl_dyn_string_att_check, ATTRSTR_DATA.c_str()) != 0)
+ if (strcmp(fl_dyn_string_att_check, ATTRSTR_DATA.c_str()) != 0)
TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",
__LINE__, ATTRSTR_DATA.c_str(), fl_dyn_string_att_check);
delete[] fl_dyn_string_att_check;
@@ -1629,9 +1629,9 @@ test_string_attr(FileAccPropList &fapl)
ATTRSTR_DATA.c_str(), read_flstr1.c_str());
// Read and verify the attribute string as a string of chars.
- HDstrcpy(flstring_att_check, "");
+ strcpy(flstring_att_check, "");
gr_flattr2.read(fls_type, flstring_att_check);
- if (HDstrcmp(flstring_att_check, ATTRSTR_DATA.c_str()) != 0)
+ if (strcmp(flstring_att_check, ATTRSTR_DATA.c_str()) != 0)
TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,flstring_att_check=%s\n",
__LINE__, ATTRSTR_DATA.c_str(), flstring_att_check);
@@ -1660,7 +1660,7 @@ test_string_attr(FileAccPropList &fapl)
// Read and verify the attribute string as a string of chars.
char *string_att_check;
gr_vlattr.read(vls_type, &string_att_check);
- if (HDstrcmp(string_att_check, ATTRSTR_DATA.c_str()) != 0)
+ if (strcmp(string_att_check, ATTRSTR_DATA.c_str()) != 0)
TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,string_att_check=%s\n",
__LINE__, ATTRSTR_DATA.c_str(), string_att_check);
free(string_att_check);
diff --git a/c++/test/titerate.cpp b/c++/test/titerate.cpp
index 4c84d80..b9196d4 100644
--- a/c++/test/titerate.cpp
+++ b/c++/test/titerate.cpp
@@ -78,7 +78,7 @@ static void printelems(const Group &group, const H5std_string &dsname, const H5s
static int
iter_strcmp(const void *s1, const void *s2)
{
- return (HDstrcmp(*reinterpret_cast<const char *const *>(s1), *reinterpret_cast<const char *const *>(s2)));
+ return (strcmp(*reinterpret_cast<const char *const *>(s1), *reinterpret_cast<const char *const *>(s2)));
}
/*-------------------------------------------------------------------------
@@ -95,7 +95,7 @@ liter_cb(hid_t H5_ATTR_UNUSED group, const char *name, const H5L_info2_t H5_ATTR
static int count = 0;
static int count2 = 0;
- HDstrcpy(info->name, name);
+ strcpy(info->name, name);
switch (info->command) {
case RET_ZERO:
@@ -162,18 +162,18 @@ test_iter_group(FileAccPropList &fapl)
DataSet dataset = file.createDataSet(name, datatype, filespace);
/* Keep a copy of the dataset names */
- lnames[i] = HDstrdup(name);
- check_values(lnames[i], "HDstrdup returns NULL", __LINE__, __FILE__);
+ lnames[i] = strdup(name);
+ check_values(lnames[i], "strdup returns NULL", __LINE__, __FILE__);
}
/* Create a group and named datatype under root group for testing */
Group grp(file.createGroup(GROUP1, 0));
- lnames[NDATASETS] = HDstrdup("grp");
- check_values(lnames[NDATASETS], "HDstrdup returns NULL", __LINE__, __FILE__);
+ lnames[NDATASETS] = strdup("grp");
+ check_values(lnames[NDATASETS], "strdup returns NULL", __LINE__, __FILE__);
datatype.commit(file, "dtype");
- lnames[NDATASETS + 1] = HDstrdup("dtype");
- check_values(lnames[NDATASETS], "HDstrdup returns NULL", __LINE__, __FILE__);
+ lnames[NDATASETS + 1] = strdup("dtype");
+ check_values(lnames[NDATASETS], "strdup returns NULL", __LINE__, __FILE__);
/* Sort the dataset names */
qsort(lnames, NDATASETS + 2, sizeof(char *), iter_strcmp);
@@ -301,7 +301,7 @@ test_iter_group(FileAccPropList &fapl)
TestErrPrintf("Group iteration function walked too far!\n");
/* Verify that the correct name is retrieved */
- if(HDstrcmp(info.name, lnames[(size_t)(idx - 1)]) != 0)
+ if(strcmp(info.name, lnames[(size_t)(idx - 1)]) != 0)
TestErrPrintf("Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (unsigned)(idx - 1), lnames[(size_t)(idx - 1)]);
} /* end while */
verify_val(ret, -1, "H5Literate", __LINE__, __FILE__);
@@ -327,7 +327,7 @@ test_iter_group(FileAccPropList &fapl)
TestErrPrintf("Group iteration function walked too far!\n");
/* Verify that the correct name is retrieved */
- if(HDstrcmp(info.name, lnames[(size_t)(idx - 1)]) != 0)
+ if(strcmp(info.name, lnames[(size_t)(idx - 1)]) != 0)
TestErrPrintf("Group iteration function didn't return name correctly for link - lnames[%u] = '%s'!\n", (unsigned)(idx - 1), lnames[(size_t)(idx - 1)]);
} /* end while */
verify_val(ret, -1, "H5Literate", __LINE__, __FILE__);
diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp
index 741c628..0affed1 100644
--- a/c++/test/tobject.cpp
+++ b/c++/test/tobject.cpp
@@ -307,7 +307,7 @@ test_get_objname_ontypes()
// Name this datatype
new_int_type.commit(grp, "IntType NATIVE_INT");
ssize_t name_len = new_int_type.getObjName(type_name); // default len
- verify_val(name_len, static_cast<ssize_t>(HDstrlen("/typetests/IntType NATIVE_INT")),
+ verify_val(name_len, static_cast<ssize_t>(strlen("/typetests/IntType NATIVE_INT")),
"DataType::getObjName", __LINE__, __FILE__);
verify_val(type_name, "/typetests/IntType NATIVE_INT", "DataType::getObjName", __LINE__, __FILE__);
diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp
index 748333f..33710a3 100644
--- a/c++/test/tvlstr.cpp
+++ b/c++/test/tvlstr.cpp
@@ -158,7 +158,7 @@ test_vlstring_dataset()
// Read and verify the dataset string as a string of chars.
dset1.read(&string_ds_check, vlst);
- if (HDstrcmp(string_ds_check, DSET1_DATA.c_str()) != 0)
+ if (strcmp(string_ds_check, DSET1_DATA.c_str()) != 0)
TestErrPrintf("Line %d: Attribute data different: DSET1_DATA=%s,string_ds_check=%s\n", __LINE__,
DSET1_DATA.c_str(), string_ds_check);
@@ -186,7 +186,7 @@ test_vlstring_dataset()
dset1.read(&string_ds_check, vlst);
// Verify data read.
- if (HDstrcmp(string_ds_check, dynstring_ds_write) != 0)
+ if (strcmp(string_ds_check, dynstring_ds_write) != 0)
TestErrPrintf("VL string datasets don't match!, dynstring_ds_write=%s, string_ds_check=%s\n",
dynstring_ds_write, string_ds_check);
free(string_ds_check);
@@ -256,7 +256,7 @@ test_vlstring_array_dataset()
hsize_t ii;
for (ii = 0; ii < SPACE1_DIM1; ii++) {
- if (HDstrcmp(string_ds_check[ii], string_ds_array[ii]) != 0)
+ if (strcmp(string_ds_check[ii], string_ds_array[ii]) != 0)
TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n", __LINE__,
string_ds_array[ii], string_ds_check[ii]);
@@ -282,7 +282,7 @@ test_vlstring_array_dataset()
char *rdata2;
dataset2.read(&rdata2, vlst);
- if (HDstrcmp(wdata2, rdata2) != 0)
+ if (strcmp(wdata2, rdata2) != 0)
TestErrPrintf("Line %d: Dataset data different: written=%s,read=%s\n", __LINE__, wdata2, rdata2);
// Release resources from second dataset operation.
@@ -355,15 +355,15 @@ test_vlstrings_special()
// Compare data read in.
for (ii = 0; ii < SPACE1_DIM1; ii++) {
- size_t wlen = HDstrlen(wdata[ii]);
- size_t rlen = HDstrlen(rdata[ii]);
+ size_t wlen = strlen(wdata[ii]);
+ size_t rlen = strlen(rdata[ii]);
if (wlen != rlen) {
TestErrPrintf("VL data lengths don't match!, strlen(wdata[%d])=%u, strlen(rdata[%d])=%u\n",
static_cast<int>(ii), static_cast<unsigned>(wlen), static_cast<int>(ii),
static_cast<unsigned>(rlen));
continue;
}
- if (HDstrcmp(wdata[ii], rdata[ii]) != 0) {
+ if (strcmp(wdata[ii], rdata[ii]) != 0) {
TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",
static_cast<int>(ii), wdata[ii], static_cast<int>(ii), rdata[ii]);
continue;
@@ -562,13 +562,13 @@ test_compact_vlstring()
// Compare data read in
hsize_t i;
for (i = 0; i < SPACE1_DIM1; i++) {
- if (HDstrlen(wdata[i]) != strlen(rdata[i])) {
+ if (strlen(wdata[i]) != strlen(rdata[i])) {
TestErrPrintf("VL data length don't match!, strlen(wdata[%d])=%d, strlen(rdata[%d])=%d\n",
- static_cast<int>(i), static_cast<int>(HDstrlen(wdata[i])), static_cast<int>(i),
- static_cast<int>(HDstrlen(rdata[i])));
+ static_cast<int>(i), static_cast<int>(strlen(wdata[i])), static_cast<int>(i),
+ static_cast<int>(strlen(rdata[i])));
continue;
} // end if
- if (HDstrcmp(wdata[i], rdata[i]) != 0) {
+ if (strcmp(wdata[i], rdata[i]) != 0) {
TestErrPrintf("VL data values don't match!, wdata[%d]=%s, rdata[%d]=%s\n",
static_cast<int>(i), wdata[i], static_cast<int>(i), rdata[i]);
continue;
@@ -634,7 +634,7 @@ test_vlstring_attribute()
// Read and verify the attribute string as a string of chars.
char *string_att_check;
gr_attr.read(vlst, &string_att_check);
- if (HDstrcmp(string_att_check, ATTRSTR_DATA.c_str()) != 0)
+ if (strcmp(string_att_check, ATTRSTR_DATA.c_str()) != 0)
TestErrPrintf("Line %d: Attribute data different: ATTRSTR_DATA=%s,string_att_check=%s\n",
__LINE__, ATTRSTR_DATA.c_str(), string_att_check);
@@ -661,7 +661,7 @@ test_vlstring_attribute()
gr_attr.read(vlst, &string_att_check);
// Verify data read.
- if (HDstrcmp(string_att_check, string_att_write) != 0)
+ if (strcmp(string_att_check, string_att_write) != 0)
TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",
string_att_write, string_att_check);
@@ -709,7 +709,7 @@ static void test_read_vl_string_attribute()
// Test reading "normal" sized string attribute
char *string_att_check;
att.read(vlst, &string_att_check);
- if(HDstrcmp(string_att_check,ATTRSTR_DATA.c_str())!=0)
+ if(strcmp(string_att_check,ATTRSTR_DATA.c_str())!=0)
TestErrPrintf("VL string attributes don't match!, string_att=%s, string_att_check=%s\n",ATTRSTR_DATA.c_str(),string_att_check);
free(string_att_check);
att.close();
@@ -717,7 +717,7 @@ static void test_read_vl_string_attribute()
// Test reading "large" sized string attribute
att = root.openAttribute("test_scalar_large");
att.read(vlst, &string_att_check);
- if(HDstrcmp(string_att_check,string_att_write)!=0)
+ if(strcmp(string_att_check,string_att_write)!=0)
TestErrPrintf("VL string attributes don't match!, string_att_write=%s, string_att_check=%s\n",string_att_write,string_att_check);
free(string_att_check);
free(string_att_write); // Free string allocated in test_write_vl_string_attribute
@@ -785,7 +785,7 @@ test_vlstring_array_attribute()
hsize_t ii;
for (ii = 0; ii < SPACE1_DIM1; ii++) {
- if (HDstrcmp(string_att_check[ii], string_att_array[ii]) != 0)
+ if (strcmp(string_att_check[ii], string_att_array[ii]) != 0)
TestErrPrintf("Line %d: Attribute data different: written=%s,read=%s\n", __LINE__,
string_att_check[ii], string_att_check[ii]);
@@ -834,7 +834,7 @@ read_scalar_dset(H5File &file, DataType &type, DataSpace &space, char *name, cha
dset.read(&data_read, type, space, space);
dset.close();
- if (HDstrcmp(data, data_read) != 0)
+ if (strcmp(data, data_read) != 0)
TestErrPrintf("Expected %s for dataset %s but read %s\n", data, name, data_read);
free(data_read);