mirror of
https://github.com/HDFGroup/hdf5.git
synced 2026-09-25 04:09:44 +03:00
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
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
+5
-5
@@ -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);
|
||||
|
||||
+10
-10
@@ -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__);
|
||||
|
||||
@@ -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__);
|
||||
|
||||
|
||||
+17
-17
@@ -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);
|
||||
|
||||
@@ -276,7 +276,7 @@ SUBROUTINE test_iter_group(cleanup, total_error)
|
||||
lnames(ndatasets+2) = "grp0000000"
|
||||
|
||||
!!$
|
||||
!!$ lnames[NDATASETS] = HDstrdup("grp");
|
||||
!!$ lnames[NDATASETS] = strdup("grp");
|
||||
!!$ CHECK(lnames[NDATASETS], NULL, "strdup");
|
||||
!!$
|
||||
|
||||
|
||||
@@ -303,7 +303,7 @@ TestCompress()
|
||||
|
||||
char filter_name[8];
|
||||
dcpl.getFilterById(H5Z_FILTER_DEFLATE, flags, cd_nelemts, NULL, 8, filter_name, config);
|
||||
if (HDstrncmp(filter_name, "deflate", 7) != 0)
|
||||
if (strncmp(filter_name, "deflate", 7) != 0)
|
||||
H5_FAILED();
|
||||
}
|
||||
catch (Exception const &) {
|
||||
@@ -313,7 +313,7 @@ TestCompress()
|
||||
PASSED();
|
||||
#else
|
||||
SKIPPED();
|
||||
HDputs(" deflate filter not enabled");
|
||||
puts(" deflate filter not enabled");
|
||||
#endif /* H5_HAVE_FILTER_DEFLATE */
|
||||
return 0;
|
||||
}
|
||||
@@ -621,7 +621,7 @@ TestHDFFV_9758()
|
||||
s1[i].a = static_cast<int>(i);
|
||||
s1[i].b = 1.0F * static_cast<float>(i * i);
|
||||
s1[i].c = 1.0 / static_cast<double>(i + 1);
|
||||
HDsnprintf(s1[i].d, STRING_LENGTH, "string%" PRIuHSIZE "", i);
|
||||
snprintf(s1[i].d, STRING_LENGTH, "string%" PRIuHSIZE "", i);
|
||||
s1[i].e = static_cast<int>(100 + i);
|
||||
}
|
||||
|
||||
@@ -692,7 +692,7 @@ TestHDFFV_9758()
|
||||
|
||||
if (s2.a != s1[i].a || s2.e != s1[i].e)
|
||||
goto error;
|
||||
else if (HDstrcmp(s2.d, s1[i].d) != 0)
|
||||
else if (strcmp(s2.d, s1[i].d) != 0)
|
||||
goto error;
|
||||
}
|
||||
} // end of ptable block
|
||||
|
||||
+2
-2
@@ -344,7 +344,7 @@ H5LD_get_dset_type_size(hid_t did, const char *fields)
|
||||
goto done;
|
||||
|
||||
/* Get a copy of "fields" */
|
||||
if (NULL == (dup_fields = HDstrdup(fields)))
|
||||
if (NULL == (dup_fields = strdup(fields)))
|
||||
goto done;
|
||||
|
||||
/* Allocate memory for a list of H5LD_memb_t pointers to store "fields" info */
|
||||
@@ -499,7 +499,7 @@ H5LD_get_dset_elmts(hid_t did, const hsize_t *prev_dims, const hsize_t *cur_dims
|
||||
goto done;
|
||||
|
||||
/* Make a copy of "fields" */
|
||||
if (NULL == (dup_fields = HDstrdup(fields)))
|
||||
if (NULL == (dup_fields = strdup(fields)))
|
||||
goto done;
|
||||
|
||||
/* Allocate memory for the vector of H5LD_memb_t pointers */
|
||||
|
||||
+2
-2
@@ -1839,7 +1839,7 @@ H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type)
|
||||
}
|
||||
|
||||
input_len = strlen(text);
|
||||
myinput = HDstrdup(text);
|
||||
myinput = strdup(text);
|
||||
|
||||
if ((type_id = H5LTyyparse()) < 0) {
|
||||
free(myinput);
|
||||
@@ -3267,7 +3267,7 @@ H5LTpath_valid(hid_t loc_id, const char *path, hbool_t check_object_valid)
|
||||
}
|
||||
|
||||
/* Duplicate the path to use */
|
||||
if (NULL == (tmp_path = HDstrdup(path))) {
|
||||
if (NULL == (tmp_path = strdup(path))) {
|
||||
ret_value = FAIL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -403,8 +403,8 @@ main(int argc, char *argv[])
|
||||
} /* end if */
|
||||
|
||||
/* Get the dataset name to be extended */
|
||||
fname = HDstrdup(argv[1]);
|
||||
dname = HDstrdup(argv[2]);
|
||||
fname = strdup(argv[1]);
|
||||
dname = strdup(argv[2]);
|
||||
action1 = atoi(argv[3]);
|
||||
action2 = atoi(argv[4]);
|
||||
|
||||
|
||||
@@ -430,7 +430,7 @@ process_cmpd_fields(hid_t fid, char *dsetname)
|
||||
}
|
||||
|
||||
/* Make a copy of "g_list_of_fields" */
|
||||
if ((g_dup_fields = HDstrdup(g_list_of_fields)) == NULL) {
|
||||
if ((g_dup_fields = strdup(g_list_of_fields)) == NULL) {
|
||||
error_msg("error in duplicating g_list_of_fields\n");
|
||||
ret_value = FAIL;
|
||||
goto done;
|
||||
@@ -703,7 +703,7 @@ parse_command_line(int argc, const char *const *argv)
|
||||
|
||||
case 'f': /* --fields=<list_of_fields> */
|
||||
if (g_list_of_fields == NULL) {
|
||||
if ((g_list_of_fields = HDstrdup(H5_optarg)) == NULL) {
|
||||
if ((g_list_of_fields = strdup(H5_optarg)) == NULL) {
|
||||
error_msg("memory allocation failed (file %s:line %d)\n", __FILE__, __LINE__);
|
||||
leave(EXIT_FAILURE);
|
||||
}
|
||||
@@ -711,7 +711,7 @@ parse_command_line(int argc, const char *const *argv)
|
||||
else {
|
||||
char *str;
|
||||
|
||||
if ((str = HDstrdup(H5_optarg)) == NULL) {
|
||||
if ((str = strdup(H5_optarg)) == NULL) {
|
||||
error_msg("memory allocation failed (file %s:line %d)\n", __FILE__, __LINE__);
|
||||
leave(EXIT_FAILURE);
|
||||
}
|
||||
@@ -823,7 +823,7 @@ main(int argc, char *argv[])
|
||||
* then there must have been something wrong with the file (perhaps it
|
||||
* doesn't exist).
|
||||
*/
|
||||
if ((fname = HDstrdup(argv[H5_optind])) == NULL) {
|
||||
if ((fname = strdup(argv[H5_optind])) == NULL) {
|
||||
error_msg("memory allocation failed (file %s:line %d)\n", __FILE__, __LINE__);
|
||||
h5tools_setstatus(EXIT_FAILURE);
|
||||
goto done;
|
||||
@@ -877,7 +877,7 @@ main(int argc, char *argv[])
|
||||
else {
|
||||
*dname = '/';
|
||||
x = dname;
|
||||
if ((dname = HDstrdup(dname)) == NULL) {
|
||||
if ((dname = strdup(dname)) == NULL) {
|
||||
error_msg("memory allocation failed (file %s:line %d)\n", __FILE__, __LINE__);
|
||||
h5tools_setstatus(EXIT_FAILURE);
|
||||
goto done;
|
||||
|
||||
@@ -945,7 +945,7 @@ h5str_sprintf(JNIEnv *env, h5str_t *out_str, hid_t container, hid_t tid, void *i
|
||||
}
|
||||
else {
|
||||
if (typeSize > 0) {
|
||||
if (NULL == (this_str = HDstrdup(tmp_str)))
|
||||
if (NULL == (this_str = strdup(tmp_str)))
|
||||
H5_OUT_OF_MEMORY_ERROR(ENVONLY, "h5str_sprintf: failed to allocate string buffer");
|
||||
}
|
||||
}
|
||||
@@ -3881,7 +3881,7 @@ obj_info_all(hid_t loc_id, const char *name, const H5L_info2_t *info, void *op_d
|
||||
datainfo->ltype[datainfo->count] = -1;
|
||||
datainfo->obj_token[datainfo->count] = H5O_TOKEN_UNDEF;
|
||||
|
||||
if (NULL == (datainfo->objname[datainfo->count] = HDstrdup(name)))
|
||||
if (NULL == (datainfo->objname[datainfo->count] = strdup(name)))
|
||||
goto done;
|
||||
|
||||
if ((object_exists = H5Oexists_by_name(loc_id, name, H5P_DEFAULT)) < 0)
|
||||
@@ -3916,7 +3916,7 @@ obj_info_max(hid_t loc_id, const char *name, const H5L_info2_t *info, void *op_d
|
||||
datainfo->obj_token[datainfo->count] = H5O_TOKEN_UNDEF;
|
||||
|
||||
/* This will be freed by h5str_array_free(oName, n) */
|
||||
if (NULL == (datainfo->objname[datainfo->count] = HDstrdup(name)))
|
||||
if (NULL == (datainfo->objname[datainfo->count] = strdup(name)))
|
||||
goto done;
|
||||
|
||||
if (H5Oget_info3(loc_id, &object_info, H5O_INFO_ALL) < 0)
|
||||
|
||||
@@ -460,12 +460,12 @@ H5_term_library(void)
|
||||
|
||||
/* log a package when its terminator needs to be retried */
|
||||
pending++;
|
||||
nprinted = HDsnprintf(next, nleft, "%s%s",
|
||||
nprinted = snprintf(next, nleft, "%s%s",
|
||||
(next != loop) ? "," : "", terminator[i].name);
|
||||
if (nprinted < 0)
|
||||
continue;
|
||||
if ((size_t)nprinted >= nleft)
|
||||
nprinted = HDsnprintf(next, nleft, "...");
|
||||
nprinted = snprintf(next, nleft, "...");
|
||||
if (nprinted < 0 || (size_t)nprinted >= nleft)
|
||||
continue;
|
||||
nleft -= (size_t)nprinted;
|
||||
@@ -719,24 +719,24 @@ H5__debug_mask(const char *s)
|
||||
pkg_name[MIN(sizeof(pkg_name) - 1, i)] = '\0';
|
||||
|
||||
/* Trace, all, or one? */
|
||||
if (!HDstrcmp(pkg_name, "trace")) {
|
||||
if (!strcmp(pkg_name, "trace")) {
|
||||
H5_debug_g.trace = clear ? NULL : stream;
|
||||
}
|
||||
else if (!HDstrcmp(pkg_name, "ttop")) {
|
||||
else if (!strcmp(pkg_name, "ttop")) {
|
||||
H5_debug_g.trace = stream;
|
||||
H5_debug_g.ttop = (bool)!clear;
|
||||
}
|
||||
else if (!HDstrcmp(pkg_name, "ttimes")) {
|
||||
else if (!strcmp(pkg_name, "ttimes")) {
|
||||
H5_debug_g.trace = stream;
|
||||
H5_debug_g.ttimes = (bool)!clear;
|
||||
}
|
||||
else if (!HDstrcmp(pkg_name, "all")) {
|
||||
else if (!strcmp(pkg_name, "all")) {
|
||||
for (i = 0; i < (size_t)H5_NPKGS; i++)
|
||||
H5_debug_g.pkg[i].stream = clear ? NULL : stream;
|
||||
}
|
||||
else {
|
||||
for (i = 0; i < (size_t)H5_NPKGS; i++) {
|
||||
if (!HDstrcmp(H5_debug_g.pkg[i].name, pkg_name)) {
|
||||
if (!strcmp(H5_debug_g.pkg[i].name, pkg_name)) {
|
||||
H5_debug_g.pkg[i].stream = clear ? NULL : stream;
|
||||
break;
|
||||
} /* end if */
|
||||
@@ -908,7 +908,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
|
||||
fprintf(stderr, "%s", H5build_settings);
|
||||
|
||||
/* Bail out now. */
|
||||
HDfputs("Bye...\n", stderr);
|
||||
fputs("Bye...\n", stderr);
|
||||
HDabort();
|
||||
case 1:
|
||||
/* continue with a warning */
|
||||
@@ -948,7 +948,7 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
|
||||
(unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR, (unsigned)H5_VERS_RELEASE);
|
||||
|
||||
/* Bail out now. */
|
||||
HDfputs("Bye...\n", stderr);
|
||||
fputs("Bye...\n", stderr);
|
||||
HDabort();
|
||||
case 1:
|
||||
/* continue with a warning */
|
||||
@@ -982,17 +982,17 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
|
||||
* Check only the first sizeof(lib_str) char. Assume the information
|
||||
* will fit within this size or enough significance.
|
||||
*/
|
||||
HDsnprintf(lib_str, sizeof(lib_str), "HDF5 library version: %d.%d.%d%s%s", H5_VERS_MAJOR,
|
||||
H5_VERS_MINOR, H5_VERS_RELEASE, (*substr ? "-" : ""), substr);
|
||||
snprintf(lib_str, sizeof(lib_str), "HDF5 library version: %d.%d.%d%s%s", H5_VERS_MAJOR, H5_VERS_MINOR,
|
||||
H5_VERS_RELEASE, (*substr ? "-" : ""), substr);
|
||||
|
||||
if (HDstrcmp(lib_str, H5_lib_vers_info_g) != 0) {
|
||||
HDfputs("Warning! Library version information error.\n"
|
||||
"The HDF5 library version information are not "
|
||||
"consistent in its source code.\nThis is NOT a fatal error "
|
||||
"but should be corrected. Setting the environment\n"
|
||||
"variable 'HDF5_DISABLE_VERSION_CHECK' to a value of 1 "
|
||||
"will suppress\nthis warning.\n",
|
||||
stderr);
|
||||
if (strcmp(lib_str, H5_lib_vers_info_g) != 0) {
|
||||
fputs("Warning! Library version information error.\n"
|
||||
"The HDF5 library version information are not "
|
||||
"consistent in its source code.\nThis is NOT a fatal error "
|
||||
"but should be corrected. Setting the environment\n"
|
||||
"variable 'HDF5_DISABLE_VERSION_CHECK' to a value of 1 "
|
||||
"will suppress\nthis warning.\n",
|
||||
stderr);
|
||||
fprintf(stderr,
|
||||
"Library version information are:\n"
|
||||
"H5_VERS_MAJOR=%d, H5_VERS_MINOR=%d, H5_VERS_RELEASE=%d, "
|
||||
|
||||
@@ -1580,7 +1580,7 @@ H5A__rename_common(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, const
|
||||
assert(new_name);
|
||||
|
||||
/* Avoid thrashing things if the names are the same */
|
||||
if (HDstrcmp(old_name, new_name) != 0) {
|
||||
if (strcmp(old_name, new_name) != 0) {
|
||||
H5VL_attr_specific_args_t vol_cb_args; /* Arguments to VOL callback */
|
||||
|
||||
/* Set up VOL callback arguments */
|
||||
|
||||
+2
-2
@@ -288,7 +288,7 @@ H5AC_create(const H5F_t *f, H5AC_cache_config_t *config_ptr, H5AC_cache_image_co
|
||||
aux_ptr->sync_point_done = NULL;
|
||||
aux_ptr->p0_image_len = 0;
|
||||
|
||||
HDsnprintf(prefix, sizeof(prefix), "%d:", mpi_rank);
|
||||
snprintf(prefix, sizeof(prefix), "%d:", mpi_rank);
|
||||
|
||||
if (mpi_rank == 0) {
|
||||
if (NULL == (aux_ptr->d_slist_ptr = H5SL_create(H5SL_TYPE_HADDR, NULL)))
|
||||
@@ -1874,7 +1874,7 @@ H5AC_validate_config(const H5AC_cache_config_t *config_ptr)
|
||||
* open the file, so we will content ourselves with a couple of
|
||||
* sanity checks on the length of the file name.
|
||||
*/
|
||||
name_len = HDstrlen(config_ptr->trace_file_name);
|
||||
name_len = strlen(config_ptr->trace_file_name);
|
||||
if (name_len == 0)
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_BADVALUE, FAIL, "config_ptr->trace_file_name is empty");
|
||||
else if (name_len > H5AC__MAX_TRACE_FILE_NAME_LEN)
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@ H5A__dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTDECODE, FAIL, "can't decode attribute");
|
||||
|
||||
/* Compare the string values */
|
||||
udata->cmp = HDstrcmp(udata->name, attr->shared->name);
|
||||
udata->cmp = strcmp(udata->name, attr->shared->name);
|
||||
|
||||
/* Check for correct attribute & callback to make */
|
||||
if (udata->cmp == 0 && udata->found_op) {
|
||||
|
||||
+7
-7
@@ -369,7 +369,7 @@ H5A__dense_open(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name)
|
||||
udata.fheap = fheap;
|
||||
udata.shared_fheap = shared_fheap;
|
||||
udata.name = name;
|
||||
udata.name_hash = H5_checksum_lookup3(name, HDstrlen(name), 0);
|
||||
udata.name_hash = H5_checksum_lookup3(name, strlen(name), 0);
|
||||
udata.flags = 0;
|
||||
udata.corder = 0;
|
||||
udata.found_op = H5A__dense_fnd_cb; /* v2 B-tree comparison callback */
|
||||
@@ -507,7 +507,7 @@ H5A__dense_insert(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr)
|
||||
udata.common.fheap = fheap;
|
||||
udata.common.shared_fheap = shared_fheap;
|
||||
udata.common.name = attr->shared->name;
|
||||
udata.common.name_hash = H5_checksum_lookup3(attr->shared->name, HDstrlen(attr->shared->name), 0);
|
||||
udata.common.name_hash = H5_checksum_lookup3(attr->shared->name, strlen(attr->shared->name), 0);
|
||||
H5_CHECKED_ASSIGN(udata.common.flags, uint8_t, mesg_flags, unsigned);
|
||||
udata.common.corder = attr->shared->crt_idx;
|
||||
udata.common.found_op = NULL;
|
||||
@@ -748,7 +748,7 @@ H5A__dense_write(H5F_t *f, const H5O_ainfo_t *ainfo, H5A_t *attr)
|
||||
udata.fheap = fheap;
|
||||
udata.shared_fheap = shared_fheap;
|
||||
udata.name = attr->shared->name;
|
||||
udata.name_hash = H5_checksum_lookup3(attr->shared->name, HDstrlen(attr->shared->name), 0);
|
||||
udata.name_hash = H5_checksum_lookup3(attr->shared->name, strlen(attr->shared->name), 0);
|
||||
udata.flags = 0;
|
||||
udata.corder = 0;
|
||||
udata.found_op = NULL;
|
||||
@@ -881,7 +881,7 @@ H5A__dense_rename(H5F_t *f, const H5O_ainfo_t *ainfo, const char *old_name, cons
|
||||
udata.fheap = fheap;
|
||||
udata.shared_fheap = shared_fheap;
|
||||
udata.name = old_name;
|
||||
udata.name_hash = H5_checksum_lookup3(old_name, HDstrlen(old_name), 0);
|
||||
udata.name_hash = H5_checksum_lookup3(old_name, strlen(old_name), 0);
|
||||
udata.flags = 0;
|
||||
udata.corder = 0;
|
||||
udata.found_op = H5A__dense_fnd_cb; /* v2 B-tree comparison callback */
|
||||
@@ -1339,7 +1339,7 @@ H5A__dense_remove(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name)
|
||||
udata.common.fheap = fheap;
|
||||
udata.common.shared_fheap = shared_fheap;
|
||||
udata.common.name = name;
|
||||
udata.common.name_hash = H5_checksum_lookup3(name, HDstrlen(name), 0);
|
||||
udata.common.name_hash = H5_checksum_lookup3(name, strlen(name), 0);
|
||||
udata.common.found_op = H5A__dense_fnd_cb; /* v2 B-tree comparison callback */
|
||||
udata.common.found_op_data = &attr_copy;
|
||||
udata.corder_bt2_addr = ainfo->corder_bt2_addr;
|
||||
@@ -1432,7 +1432,7 @@ H5A__dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata)
|
||||
other_bt2_udata.shared_fheap = bt2_udata->shared_fheap;
|
||||
other_bt2_udata.name = fh_udata.attr->shared->name;
|
||||
other_bt2_udata.name_hash =
|
||||
H5_checksum_lookup3(fh_udata.attr->shared->name, HDstrlen(fh_udata.attr->shared->name), 0);
|
||||
H5_checksum_lookup3(fh_udata.attr->shared->name, strlen(fh_udata.attr->shared->name), 0);
|
||||
other_bt2_udata.found_op = NULL;
|
||||
other_bt2_udata.found_op_data = NULL;
|
||||
} /* end else */
|
||||
@@ -1668,7 +1668,7 @@ H5A__dense_exists(H5F_t *f, const H5O_ainfo_t *ainfo, const char *name, bool *at
|
||||
udata.fheap = fheap;
|
||||
udata.shared_fheap = shared_fheap;
|
||||
udata.name = name;
|
||||
udata.name_hash = H5_checksum_lookup3(name, HDstrlen(name), 0);
|
||||
udata.name_hash = H5_checksum_lookup3(name, strlen(name), 0);
|
||||
udata.flags = 0;
|
||||
udata.corder = 0;
|
||||
udata.found_op = NULL; /* v2 B-tree comparison callback */
|
||||
|
||||
+4
-4
@@ -947,7 +947,7 @@ H5A__get_name(H5A_t *attr, size_t buf_size, char *buf, size_t *attr_name_len)
|
||||
assert(attr_name_len);
|
||||
|
||||
/* Get the real attribute length */
|
||||
nbytes = HDstrlen(attr->shared->name);
|
||||
nbytes = strlen(attr->shared->name);
|
||||
|
||||
/* Compute the string length which will fit into the user's buffer */
|
||||
copy_len = MIN(buf_size - 1, nbytes);
|
||||
@@ -1701,7 +1701,7 @@ H5A__attr_cmp_name_inc(const void *attr1, const void *attr2)
|
||||
FUNC_ENTER_PACKAGE_NOERR
|
||||
|
||||
FUNC_LEAVE_NOAPI(
|
||||
HDstrcmp((*(const H5A_t *const *)attr1)->shared->name, (*(const H5A_t *const *)attr2)->shared->name))
|
||||
strcmp((*(const H5A_t *const *)attr1)->shared->name, (*(const H5A_t *const *)attr2)->shared->name))
|
||||
} /* end H5A__attr_cmp_name_inc() */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -1724,7 +1724,7 @@ H5A__attr_cmp_name_dec(const void *attr1, const void *attr2)
|
||||
FUNC_ENTER_PACKAGE_NOERR
|
||||
|
||||
FUNC_LEAVE_NOAPI(
|
||||
HDstrcmp((*(const H5A_t *const *)attr2)->shared->name, (*(const H5A_t *const *)attr1)->shared->name))
|
||||
strcmp((*(const H5A_t *const *)attr2)->shared->name, (*(const H5A_t *const *)attr1)->shared->name))
|
||||
} /* end H5A__attr_cmp_name_dec() */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -2547,7 +2547,7 @@ H5A__rename_by_name(H5G_loc_t loc, const char *obj_name, const char *old_attr_na
|
||||
FUNC_ENTER_PACKAGE
|
||||
|
||||
/* Avoid thrashing things if the names are the same */
|
||||
if (HDstrcmp(old_attr_name, new_attr_name) != 0) {
|
||||
if (strcmp(old_attr_name, new_attr_name) != 0) {
|
||||
/* Set up opened group location to fill in */
|
||||
obj_loc.oloc = &obj_oloc;
|
||||
obj_loc.path = &obj_path;
|
||||
|
||||
+5
-5
@@ -124,7 +124,7 @@ H5B2__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
|
||||
/* Print relevant node info */
|
||||
fprintf(stream, "%*sNode Info: (max_nrec/split_nrec/merge_nrec)\n", indent, "");
|
||||
for (u = 0; u < (unsigned)(hdr->depth + 1); u++) {
|
||||
HDsnprintf(temp_str, sizeof(temp_str), "Depth %u:", u);
|
||||
snprintf(temp_str, sizeof(temp_str), "Depth %u:", u);
|
||||
fprintf(stream, "%*s%-*s (%u/%u/%u)\n", indent + 3, "", MAX(0, fwidth - 3), temp_str,
|
||||
hdr->node_info[u].max_nrec, hdr->node_info[u].split_nrec, hdr->node_info[u].merge_nrec);
|
||||
} /* end for */
|
||||
@@ -206,13 +206,13 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, co
|
||||
/* Print all node pointers and records */
|
||||
for (u = 0; u < internal->nrec; u++) {
|
||||
/* Print node pointer */
|
||||
HDsnprintf(temp_str, sizeof(temp_str), "Node pointer #%u: (all/node/addr)", u);
|
||||
snprintf(temp_str, sizeof(temp_str), "Node pointer #%u: (all/node/addr)", u);
|
||||
fprintf(stream, "%*s%-*s (%" PRIuHSIZE "/%u/%" PRIuHADDR ")\n", indent + 3, "", MAX(0, fwidth - 3),
|
||||
temp_str, internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec,
|
||||
internal->node_ptrs[u].addr);
|
||||
|
||||
/* Print record */
|
||||
HDsnprintf(temp_str, sizeof(temp_str), "Record #%u:", u);
|
||||
snprintf(temp_str, sizeof(temp_str), "Record #%u:", u);
|
||||
fprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str);
|
||||
assert(H5B2_INT_NREC(internal, hdr, u));
|
||||
(void)(type->debug)(stream, indent + 6, MAX(0, fwidth - 6), H5B2_INT_NREC(internal, hdr, u),
|
||||
@@ -220,7 +220,7 @@ H5B2__int_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, co
|
||||
} /* end for */
|
||||
|
||||
/* Print final node pointer */
|
||||
HDsnprintf(temp_str, sizeof(temp_str), "Node pointer #%u: (all/node/addr)", u);
|
||||
snprintf(temp_str, sizeof(temp_str), "Node pointer #%u: (all/node/addr)", u);
|
||||
fprintf(stream, "%*s%-*s (%" PRIuHSIZE "/%u/%" PRIuHADDR ")\n", indent + 3, "", MAX(0, fwidth - 3),
|
||||
temp_str, internal->node_ptrs[u].all_nrec, internal->node_ptrs[u].node_nrec,
|
||||
internal->node_ptrs[u].addr);
|
||||
@@ -303,7 +303,7 @@ H5B2__leaf_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth, c
|
||||
/* Print all node pointers and records */
|
||||
for (u = 0; u < leaf->nrec; u++) {
|
||||
/* Print record */
|
||||
HDsnprintf(temp_str, sizeof(temp_str), "Record #%u:", u);
|
||||
snprintf(temp_str, sizeof(temp_str), "Record #%u:", u);
|
||||
fprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str);
|
||||
assert(H5B2_LEAF_NREC(leaf, hdr, u));
|
||||
(void)(type->debug)(stream, indent + 6, MAX(0, fwidth - 6), H5B2_LEAF_NREC(leaf, hdr, u),
|
||||
|
||||
@@ -138,7 +138,7 @@ H5C_create(size_t max_cache_size, size_t min_clean_size, int max_type_id,
|
||||
|
||||
for (i = 0; i <= max_type_id; i++) {
|
||||
assert((class_table_ptr)[i]);
|
||||
assert(HDstrlen((class_table_ptr)[i]->name) > 0);
|
||||
assert(strlen((class_table_ptr)[i]->name) > 0);
|
||||
} /* end for */
|
||||
|
||||
if (NULL == (cache_ptr = H5FL_CALLOC(H5C_t)))
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@ H5CS_print_stack(const H5CS_t *fstack, FILE *stream)
|
||||
fprintf(stream, "thread %" PRIu64 ".", H5TS_thread_id());
|
||||
if (fstack && fstack->nused > 0)
|
||||
fprintf(stream, " Back trace follows.");
|
||||
HDfputc('\n', stream);
|
||||
fputc('\n', stream);
|
||||
|
||||
for (i = fstack->nused - 1; i >= 0; --i)
|
||||
fprintf(stream, "%*s#%03d: Routine: %s\n", indent, "", i, fstack->rec[i]);
|
||||
|
||||
+2
-2
@@ -317,10 +317,10 @@ H5C_set_prefix(H5C_t *cache_ptr, char *prefix)
|
||||
|
||||
FUNC_ENTER_NOAPI(FAIL)
|
||||
|
||||
if (cache_ptr == NULL || prefix == NULL || HDstrlen(prefix) >= H5C__PREFIX_LEN)
|
||||
if (cache_ptr == NULL || prefix == NULL || strlen(prefix) >= H5C__PREFIX_LEN)
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Bad param(s) on entry");
|
||||
|
||||
HDstrncpy(&(cache_ptr->prefix[0]), prefix, (size_t)(H5C__PREFIX_LEN));
|
||||
strncpy(&(cache_ptr->prefix[0]), prefix, (size_t)(H5C__PREFIX_LEN));
|
||||
|
||||
cache_ptr->prefix[H5C__PREFIX_LEN - 1] = '\0';
|
||||
|
||||
|
||||
+54
-55
@@ -168,7 +168,7 @@ H5C__json_write_log_message(H5C_log_json_udata_t *json_udata)
|
||||
assert(json_udata->message);
|
||||
|
||||
/* Write the log message and flush */
|
||||
n_chars = HDstrlen(json_udata->message);
|
||||
n_chars = strlen(json_udata->message);
|
||||
if ((int)n_chars != fprintf(json_udata->outfile, "%s", json_udata->message))
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message");
|
||||
memset((void *)(json_udata->message), 0, (size_t)(n_chars * sizeof(char)));
|
||||
@@ -231,16 +231,16 @@ H5C__log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mp
|
||||
*
|
||||
* allocation size = "RANK_" + <rank # length> + dot + <path length> + \0
|
||||
*/
|
||||
n_chars = 5 + 39 + 1 + HDstrlen(log_location) + 1;
|
||||
n_chars = 5 + 39 + 1 + strlen(log_location) + 1;
|
||||
if (NULL == (file_name = (char *)H5MM_calloc(n_chars * sizeof(char))))
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL,
|
||||
"can't allocate memory for mdc log file name manipulation");
|
||||
|
||||
/* Add the rank to the log file name when MPI is in use */
|
||||
if (-1 == mpi_rank)
|
||||
HDsnprintf(file_name, n_chars, "%s", log_location);
|
||||
snprintf(file_name, n_chars, "%s", log_location);
|
||||
else
|
||||
HDsnprintf(file_name, n_chars, "RANK_%d.%s", mpi_rank, log_location);
|
||||
snprintf(file_name, n_chars, "RANK_%d.%s", mpi_rank, log_location);
|
||||
|
||||
/* Open log file and set it to be unbuffered */
|
||||
if (NULL == (json_udata->outfile = fopen(file_name, "w")))
|
||||
@@ -331,7 +331,7 @@ H5C__json_write_start_log_msg(void *udata)
|
||||
assert(json_udata->message);
|
||||
|
||||
/* Create the log message string (opens the JSON array) */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\n\
|
||||
\"HDF5 metadata cache log messages\" : [\n\
|
||||
{\
|
||||
@@ -339,7 +339,7 @@ H5C__json_write_start_log_msg(void *udata)
|
||||
\"action\":\"logging start\"\
|
||||
},\n\
|
||||
",
|
||||
(long long)HDtime(NULL));
|
||||
(long long)HDtime(NULL));
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
@@ -371,14 +371,14 @@ H5C__json_write_stop_log_msg(void *udata)
|
||||
assert(json_udata->message);
|
||||
|
||||
/* Create the log message string (closes the JSON array) */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\
|
||||
\"timestamp\":%lld,\
|
||||
\"action\":\"logging stop\"\
|
||||
}\n\
|
||||
]}\n\
|
||||
",
|
||||
(long long)HDtime(NULL));
|
||||
(long long)HDtime(NULL));
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
@@ -410,14 +410,14 @@ H5C__json_write_create_cache_log_msg(void *udata, herr_t fxn_ret_value)
|
||||
assert(json_udata->message);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\
|
||||
\"timestamp\":%lld,\
|
||||
\"action\":\"create\",\
|
||||
\"returned\":%d\
|
||||
},\n\
|
||||
",
|
||||
(long long)HDtime(NULL), (int)fxn_ret_value);
|
||||
(long long)HDtime(NULL), (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
@@ -449,13 +449,13 @@ H5C__json_write_destroy_cache_log_msg(void *udata)
|
||||
assert(json_udata->message);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\
|
||||
\"timestamp\":%lld,\
|
||||
\"action\":\"destroy\"\
|
||||
},\n\
|
||||
",
|
||||
(long long)HDtime(NULL));
|
||||
(long long)HDtime(NULL));
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
@@ -487,14 +487,14 @@ H5C__json_write_evict_cache_log_msg(void *udata, herr_t fxn_ret_value)
|
||||
assert(json_udata->message);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\
|
||||
\"timestamp\":%lld,\
|
||||
\"action\":\"evict\",\
|
||||
\"returned\":%d\
|
||||
},\n\
|
||||
",
|
||||
(long long)HDtime(NULL), (int)fxn_ret_value);
|
||||
(long long)HDtime(NULL), (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
@@ -526,7 +526,7 @@ H5C__json_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id,
|
||||
assert(json_udata->message);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\
|
||||
\"timestamp\":%lld,\
|
||||
\"action\":\"expunge\",\
|
||||
@@ -535,7 +535,7 @@ H5C__json_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id,
|
||||
\"returned\":%d\
|
||||
},\n\
|
||||
",
|
||||
(long long)HDtime(NULL), (unsigned long)address, (int)type_id, (int)fxn_ret_value);
|
||||
(long long)HDtime(NULL), (unsigned long)address, (int)type_id, (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
@@ -567,14 +567,14 @@ H5C__json_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value)
|
||||
assert(json_udata->message);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\
|
||||
\"timestamp\":%lld,\
|
||||
\"action\":\"flush\",\
|
||||
\"returned\":%d\
|
||||
},\n\
|
||||
",
|
||||
(long long)HDtime(NULL), (int)fxn_ret_value);
|
||||
(long long)HDtime(NULL), (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
@@ -607,7 +607,7 @@ H5C__json_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id,
|
||||
assert(json_udata->message);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\
|
||||
\"timestamp\":%lld,\
|
||||
\"action\":\"insert\",\
|
||||
@@ -618,8 +618,7 @@ H5C__json_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id,
|
||||
\"returned\":%d\
|
||||
},\n\
|
||||
",
|
||||
(long long)HDtime(NULL), (unsigned long)address, type_id, flags, (int)size,
|
||||
(int)fxn_ret_value);
|
||||
(long long)HDtime(NULL), (unsigned long)address, type_id, flags, (int)size, (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
@@ -652,7 +651,7 @@ H5C__json_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *e
|
||||
assert(entry);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\
|
||||
\"timestamp\":%lld,\
|
||||
\"action\":\"dirty\",\
|
||||
@@ -660,7 +659,7 @@ H5C__json_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *e
|
||||
\"returned\":%d\
|
||||
},\n\
|
||||
",
|
||||
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
|
||||
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
@@ -693,7 +692,7 @@ H5C__json_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *e
|
||||
assert(entry);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\
|
||||
\"timestamp\":%lld,\
|
||||
\"action\":\"clean\",\
|
||||
@@ -701,7 +700,7 @@ H5C__json_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *e
|
||||
\"returned\":%d\
|
||||
},\n\
|
||||
",
|
||||
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
|
||||
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
@@ -735,7 +734,7 @@ H5C__json_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_ent
|
||||
assert(entry);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\
|
||||
\"timestamp\":%lld,\
|
||||
\"action\":\"unserialized\",\
|
||||
@@ -743,7 +742,7 @@ H5C__json_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_ent
|
||||
\"returned\":%d\
|
||||
},\n\
|
||||
",
|
||||
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
|
||||
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
@@ -777,7 +776,7 @@ H5C__json_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry
|
||||
assert(entry);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\
|
||||
\"timestamp\":%lld,\
|
||||
\"action\":\"serialized\",\
|
||||
@@ -785,7 +784,7 @@ H5C__json_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry
|
||||
\"returned\":%d\
|
||||
},\n\
|
||||
",
|
||||
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
|
||||
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
@@ -818,7 +817,7 @@ H5C__json_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_ad
|
||||
assert(json_udata->message);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\
|
||||
\"timestamp\":%lld,\
|
||||
\"action\":\"move\",\
|
||||
@@ -828,8 +827,8 @@ H5C__json_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_ad
|
||||
\"returned\":%d\
|
||||
},\n\
|
||||
",
|
||||
(long long)HDtime(NULL), (unsigned long)old_addr, (unsigned long)new_addr, type_id,
|
||||
(int)fxn_ret_value);
|
||||
(long long)HDtime(NULL), (unsigned long)old_addr, (unsigned long)new_addr, type_id,
|
||||
(int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
@@ -862,7 +861,7 @@ H5C__json_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, h
|
||||
assert(entry);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\
|
||||
\"timestamp\":%lld,\
|
||||
\"action\":\"pin\",\
|
||||
@@ -870,7 +869,7 @@ H5C__json_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, h
|
||||
\"returned\":%d\
|
||||
},\n\
|
||||
",
|
||||
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
|
||||
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
@@ -906,7 +905,7 @@ H5C__json_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
|
||||
assert(child);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\
|
||||
\"timestamp\":%lld,\
|
||||
\"action\":\"create_fd\",\
|
||||
@@ -915,8 +914,8 @@ H5C__json_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
|
||||
\"returned\":%d\
|
||||
},\n\
|
||||
",
|
||||
(long long)HDtime(NULL), (unsigned long)parent->addr, (unsigned long)child->addr,
|
||||
(int)fxn_ret_value);
|
||||
(long long)HDtime(NULL), (unsigned long)parent->addr, (unsigned long)child->addr,
|
||||
(int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
@@ -951,12 +950,12 @@ H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entr
|
||||
assert(entry);
|
||||
|
||||
if (H5C__READ_ONLY_FLAG == flags)
|
||||
HDstrcpy(rw_s, "READ");
|
||||
strcpy(rw_s, "READ");
|
||||
else
|
||||
HDstrcpy(rw_s, "WRITE");
|
||||
strcpy(rw_s, "WRITE");
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\
|
||||
\"timestamp\":%lld,\
|
||||
\"action\":\"protect\",\
|
||||
@@ -967,8 +966,8 @@ H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entr
|
||||
\"returned\":%d\
|
||||
},\n\
|
||||
",
|
||||
(long long)HDtime(NULL), (unsigned long)entry->addr, type_id, rw_s, (int)entry->size,
|
||||
(int)fxn_ret_value);
|
||||
(long long)HDtime(NULL), (unsigned long)entry->addr, type_id, rw_s, (int)entry->size,
|
||||
(int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
@@ -1002,7 +1001,7 @@ H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry
|
||||
assert(entry);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\
|
||||
\"timestamp\":%lld,\
|
||||
\"action\":\"resize\",\
|
||||
@@ -1011,7 +1010,7 @@ H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry
|
||||
\"returned\":%d\
|
||||
},\n\
|
||||
",
|
||||
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)new_size, (int)fxn_ret_value);
|
||||
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)new_size, (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
@@ -1044,7 +1043,7 @@ H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
|
||||
assert(entry);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\
|
||||
\"timestamp\":%lld,\
|
||||
\"action\":\"unpin\",\
|
||||
@@ -1052,7 +1051,7 @@ H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
|
||||
\"returned\":%d\
|
||||
},\n\
|
||||
",
|
||||
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
|
||||
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
@@ -1088,7 +1087,7 @@ H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
|
||||
assert(child);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\
|
||||
\"timestamp\":%lld,\
|
||||
\"action\":\"destroy_fd\",\
|
||||
@@ -1097,8 +1096,8 @@ H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
|
||||
\"returned\":%d\
|
||||
},\n\
|
||||
",
|
||||
(long long)HDtime(NULL), (unsigned long)parent->addr, (unsigned long)child->addr,
|
||||
(int)fxn_ret_value);
|
||||
(long long)HDtime(NULL), (unsigned long)parent->addr, (unsigned long)child->addr,
|
||||
(int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
@@ -1131,7 +1130,7 @@ H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_i
|
||||
assert(json_udata->message);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\
|
||||
\"timestamp\":%lld,\
|
||||
\"action\":\"unprotect\",\
|
||||
@@ -1141,7 +1140,7 @@ H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_i
|
||||
\"returned\":%d\
|
||||
},\n\
|
||||
",
|
||||
(long long)HDtime(NULL), (unsigned long)address, type_id, flags, (int)fxn_ret_value);
|
||||
(long long)HDtime(NULL), (unsigned long)address, type_id, flags, (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
@@ -1175,14 +1174,14 @@ H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t
|
||||
assert(config);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\
|
||||
\"timestamp\":%lld,\
|
||||
\"action\":\"set_config\",\
|
||||
\"returned\":%d\
|
||||
},\n\
|
||||
",
|
||||
(long long)HDtime(NULL), (int)fxn_ret_value);
|
||||
(long long)HDtime(NULL), (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
@@ -1215,7 +1214,7 @@ H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry
|
||||
assert(entry);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
snprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
|
||||
{\
|
||||
\"timestamp\":%lld,\
|
||||
\"action\":\"remove\",\
|
||||
@@ -1223,7 +1222,7 @@ H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry
|
||||
\"returned\":%d\
|
||||
},\n\
|
||||
",
|
||||
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
|
||||
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__json_write_log_message(json_udata) < 0)
|
||||
|
||||
+50
-51
@@ -163,7 +163,7 @@ H5C__trace_write_log_message(H5C_log_trace_udata_t *trace_udata)
|
||||
assert(trace_udata->message);
|
||||
|
||||
/* Write the log message and flush */
|
||||
n_chars = HDstrlen(trace_udata->message);
|
||||
n_chars = strlen(trace_udata->message);
|
||||
if ((int)n_chars != fprintf(trace_udata->outfile, "%s", trace_udata->message))
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message");
|
||||
memset((void *)(trace_udata->message), 0, (size_t)(n_chars * sizeof(char)));
|
||||
@@ -226,16 +226,16 @@ H5C__log_trace_set_up(H5C_log_info_t *log_info, const char log_location[], int m
|
||||
*
|
||||
* allocation size = <path length> + dot + <rank # length> + \0
|
||||
*/
|
||||
n_chars = HDstrlen(log_location) + 1 + 39 + 1;
|
||||
n_chars = strlen(log_location) + 1 + 39 + 1;
|
||||
if (NULL == (file_name = (char *)H5MM_calloc(n_chars * sizeof(char))))
|
||||
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL,
|
||||
"can't allocate memory for mdc log file name manipulation");
|
||||
|
||||
/* Add the rank to the log file name when MPI is in use */
|
||||
if (-1 == mpi_rank)
|
||||
HDsnprintf(file_name, n_chars, "%s", log_location);
|
||||
snprintf(file_name, n_chars, "%s", log_location);
|
||||
else
|
||||
HDsnprintf(file_name, n_chars, "%s.%d", log_location, mpi_rank);
|
||||
snprintf(file_name, n_chars, "%s.%d", log_location, mpi_rank);
|
||||
|
||||
/* Open log file and set it to be unbuffered */
|
||||
if (NULL == (trace_udata->outfile = fopen(file_name, "w")))
|
||||
@@ -329,8 +329,8 @@ H5C__trace_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id
|
||||
assert(trace_udata->message);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_expunge_entry 0x%lx %d %d\n",
|
||||
(unsigned long)address, type_id, (int)fxn_ret_value);
|
||||
snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_expunge_entry 0x%lx %d %d\n",
|
||||
(unsigned long)address, type_id, (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__trace_write_log_message(trace_udata) < 0)
|
||||
@@ -362,7 +362,7 @@ H5C__trace_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value)
|
||||
assert(trace_udata->message);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_flush %d\n", (int)fxn_ret_value);
|
||||
snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_flush %d\n", (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__trace_write_log_message(trace_udata) < 0)
|
||||
@@ -395,8 +395,8 @@ H5C__trace_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id,
|
||||
assert(trace_udata->message);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_insert_entry 0x%lx %d 0x%x %d %d\n",
|
||||
(unsigned long)address, type_id, flags, (int)size, (int)fxn_ret_value);
|
||||
snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_insert_entry 0x%lx %d 0x%x %d %d\n",
|
||||
(unsigned long)address, type_id, flags, (int)size, (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__trace_write_log_message(trace_udata) < 0)
|
||||
@@ -429,8 +429,8 @@ H5C__trace_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *
|
||||
assert(entry);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_dirty 0x%lx %d\n",
|
||||
(unsigned long)(entry->addr), (int)fxn_ret_value);
|
||||
snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_dirty 0x%lx %d\n",
|
||||
(unsigned long)(entry->addr), (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__trace_write_log_message(trace_udata) < 0)
|
||||
@@ -463,8 +463,8 @@ H5C__trace_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *
|
||||
assert(entry);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_clean 0x%lx %d\n",
|
||||
(unsigned long)(entry->addr), (int)fxn_ret_value);
|
||||
snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_clean 0x%lx %d\n",
|
||||
(unsigned long)(entry->addr), (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__trace_write_log_message(trace_udata) < 0)
|
||||
@@ -498,8 +498,8 @@ H5C__trace_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_en
|
||||
assert(entry);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_unserialized 0x%lx %d\n",
|
||||
(unsigned long)(entry->addr), (int)fxn_ret_value);
|
||||
snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_unserialized 0x%lx %d\n",
|
||||
(unsigned long)(entry->addr), (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__trace_write_log_message(trace_udata) < 0)
|
||||
@@ -533,8 +533,8 @@ H5C__trace_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entr
|
||||
assert(entry);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_serialized 0x%lx %d\n",
|
||||
(unsigned long)(entry->addr), (int)fxn_ret_value);
|
||||
snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_mark_entry_serialized 0x%lx %d\n",
|
||||
(unsigned long)(entry->addr), (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__trace_write_log_message(trace_udata) < 0)
|
||||
@@ -567,8 +567,8 @@ H5C__trace_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_a
|
||||
assert(trace_udata->message);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_move_entry 0x%lx 0x%lx %d %d\n",
|
||||
(unsigned long)old_addr, (unsigned long)new_addr, type_id, (int)fxn_ret_value);
|
||||
snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_move_entry 0x%lx 0x%lx %d %d\n",
|
||||
(unsigned long)old_addr, (unsigned long)new_addr, type_id, (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__trace_write_log_message(trace_udata) < 0)
|
||||
@@ -601,8 +601,8 @@ H5C__trace_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
|
||||
assert(entry);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_pin_protected_entry 0x%lx %d\n",
|
||||
(unsigned long)(entry->addr), (int)fxn_ret_value);
|
||||
snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_pin_protected_entry 0x%lx %d\n",
|
||||
(unsigned long)(entry->addr), (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__trace_write_log_message(trace_udata) < 0)
|
||||
@@ -638,9 +638,9 @@ H5C__trace_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
|
||||
assert(child);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE,
|
||||
"H5AC_create_flush_dependency 0x%lx 0x%lx %d\n", (unsigned long)(parent->addr),
|
||||
(unsigned long)(child->addr), (int)fxn_ret_value);
|
||||
snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE,
|
||||
"H5AC_create_flush_dependency 0x%lx 0x%lx %d\n", (unsigned long)(parent->addr),
|
||||
(unsigned long)(child->addr), (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__trace_write_log_message(trace_udata) < 0)
|
||||
@@ -674,8 +674,8 @@ H5C__trace_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *ent
|
||||
assert(entry);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_protect 0x%lx %d 0x%x %d %d\n",
|
||||
(unsigned long)(entry->addr), type_id, flags, (int)(entry->size), (int)fxn_ret_value);
|
||||
snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_protect 0x%lx %d 0x%x %d %d\n",
|
||||
(unsigned long)(entry->addr), type_id, flags, (int)(entry->size), (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__trace_write_log_message(trace_udata) < 0)
|
||||
@@ -709,8 +709,8 @@ H5C__trace_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entr
|
||||
assert(entry);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_resize_entry 0x%lx %d %d\n",
|
||||
(unsigned long)(entry->addr), (int)new_size, (int)fxn_ret_value);
|
||||
snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_resize_entry 0x%lx %d %d\n",
|
||||
(unsigned long)(entry->addr), (int)new_size, (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__trace_write_log_message(trace_udata) < 0)
|
||||
@@ -743,8 +743,8 @@ H5C__trace_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry
|
||||
assert(entry);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_unpin_entry 0x%lx %d\n",
|
||||
(unsigned long)(entry->addr), (int)fxn_ret_value);
|
||||
snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_unpin_entry 0x%lx %d\n",
|
||||
(unsigned long)(entry->addr), (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__trace_write_log_message(trace_udata) < 0)
|
||||
@@ -780,9 +780,9 @@ H5C__trace_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent
|
||||
assert(child);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE,
|
||||
"H5AC_destroy_flush_dependency 0x%lx 0x%lx %d\n", (unsigned long)(parent->addr),
|
||||
(unsigned long)(child->addr), (int)fxn_ret_value);
|
||||
snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE,
|
||||
"H5AC_destroy_flush_dependency 0x%lx 0x%lx %d\n", (unsigned long)(parent->addr),
|
||||
(unsigned long)(child->addr), (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__trace_write_log_message(trace_udata) < 0)
|
||||
@@ -815,8 +815,8 @@ H5C__trace_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_
|
||||
assert(trace_udata->message);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_unprotect 0x%lx %d 0x%x %d\n",
|
||||
(unsigned long)(address), type_id, flags, (int)fxn_ret_value);
|
||||
snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_unprotect 0x%lx %d 0x%x %d\n",
|
||||
(unsigned long)(address), type_id, flags, (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__trace_write_log_message(trace_udata) < 0)
|
||||
@@ -850,20 +850,19 @@ H5C__trace_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t
|
||||
assert(config);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE,
|
||||
"H5AC_set_cache_auto_resize_config %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %f %f "
|
||||
"%d %d %d %f %f %d %d %d %d %f %zu %d %d\n",
|
||||
config->version, (int)(config->rpt_fcn_enabled), (int)(config->open_trace_file),
|
||||
(int)(config->close_trace_file), config->trace_file_name, (int)(config->evictions_enabled),
|
||||
(int)(config->set_initial_size), (int)(config->initial_size), config->min_clean_fraction,
|
||||
(int)(config->max_size), (int)(config->min_size), config->epoch_length,
|
||||
(int)(config->incr_mode), config->lower_hr_threshold, config->increment,
|
||||
(int)(config->flash_incr_mode), config->flash_multiple, config->flash_threshold,
|
||||
(int)(config->apply_max_increment), (int)(config->max_increment), (int)(config->decr_mode),
|
||||
config->upper_hr_threshold, config->decrement, (int)(config->apply_max_decrement),
|
||||
(int)(config->max_decrement), config->epochs_before_eviction,
|
||||
(int)(config->apply_empty_reserve), config->empty_reserve, config->dirty_bytes_threshold,
|
||||
config->metadata_write_strategy, (int)fxn_ret_value);
|
||||
snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE,
|
||||
"H5AC_set_cache_auto_resize_config %d %d %d %d \"%s\" %d %d %d %f %d %d %ld %d %f %f %d %f %f "
|
||||
"%d %d %d %f %f %d %d %d %d %f %zu %d %d\n",
|
||||
config->version, (int)(config->rpt_fcn_enabled), (int)(config->open_trace_file),
|
||||
(int)(config->close_trace_file), config->trace_file_name, (int)(config->evictions_enabled),
|
||||
(int)(config->set_initial_size), (int)(config->initial_size), config->min_clean_fraction,
|
||||
(int)(config->max_size), (int)(config->min_size), config->epoch_length, (int)(config->incr_mode),
|
||||
config->lower_hr_threshold, config->increment, (int)(config->flash_incr_mode),
|
||||
config->flash_multiple, config->flash_threshold, (int)(config->apply_max_increment),
|
||||
(int)(config->max_increment), (int)(config->decr_mode), config->upper_hr_threshold,
|
||||
config->decrement, (int)(config->apply_max_decrement), (int)(config->max_decrement),
|
||||
config->epochs_before_eviction, (int)(config->apply_empty_reserve), config->empty_reserve,
|
||||
config->dirty_bytes_threshold, config->metadata_write_strategy, (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__trace_write_log_message(trace_udata) < 0)
|
||||
@@ -896,8 +895,8 @@ H5C__trace_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entr
|
||||
assert(entry);
|
||||
|
||||
/* Create the log message string */
|
||||
HDsnprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_remove_entry 0x%lx %d\n",
|
||||
(unsigned long)(entry->addr), (int)fxn_ret_value);
|
||||
snprintf(trace_udata->message, H5C_MAX_TRACE_LOG_MSG_SIZE, "H5AC_remove_entry 0x%lx %d\n",
|
||||
(unsigned long)(entry->addr), (int)fxn_ret_value);
|
||||
|
||||
/* Write the log message to the file */
|
||||
if (H5C__trace_write_log_message(trace_udata) < 0)
|
||||
|
||||
+6
-6
@@ -194,10 +194,10 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha
|
||||
|
||||
memset(tbl_buf, 0, sizeof(tbl_buf));
|
||||
|
||||
HDsnprintf(tbl_buf, sizeof(tbl_buf), "candidate list = ");
|
||||
snprintf(tbl_buf, sizeof(tbl_buf), "candidate list = ");
|
||||
for (u = 0; u < num_candidates; u++)
|
||||
HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " 0x%llx", (long long)(*(candidates_list_ptr + u)));
|
||||
HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n");
|
||||
sprintf(&(tbl_buf[strlen(tbl_buf)]), " 0x%llx", (long long)(*(candidates_list_ptr + u)));
|
||||
sprintf(&(tbl_buf[strlen(tbl_buf)]), "\n");
|
||||
|
||||
fprintf(stdout, "%s", tbl_buf);
|
||||
#endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */
|
||||
@@ -260,10 +260,10 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha
|
||||
#if H5C_APPLY_CANDIDATE_LIST__DEBUG
|
||||
for (u = 0; u < 1024; u++)
|
||||
tbl_buf[u] = '\0';
|
||||
HDsnprintf(tbl_buf, sizeof(tbl_buf), "candidate assignment table = ");
|
||||
snprintf(tbl_buf, sizeof(tbl_buf), "candidate assignment table = ");
|
||||
for (u = 0; u <= (unsigned)mpi_size; u++)
|
||||
HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), " %u", candidate_assignment_table[u]);
|
||||
HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n");
|
||||
sprintf(&(tbl_buf[strlen(tbl_buf)]), " %u", candidate_assignment_table[u]);
|
||||
sprintf(&(tbl_buf[strlen(tbl_buf)]), "\n");
|
||||
fprintf(stdout, "%s", tbl_buf);
|
||||
|
||||
fprintf(stdout, "%s:%d: flush entries [%u, %u].\n", __func__, mpi_rank, first_entry_to_flush,
|
||||
|
||||
+1
-1
@@ -708,7 +708,7 @@ H5D__btree_debug_key(FILE *stream, int indent, int fwidth, const void *_key, con
|
||||
fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:");
|
||||
for (u = 0; u < udata->ndims; u++)
|
||||
fprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", (key->scaled[u] * udata->common.layout->dim[u]));
|
||||
HDfputs("}\n", stream);
|
||||
fputs("}\n", stream);
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5D__btree_debug_key() */
|
||||
|
||||
+2
-2
@@ -431,7 +431,7 @@ H5D__bt2_unfilt_debug(FILE *stream, int indent, int fwidth, const void *_record,
|
||||
fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:");
|
||||
for (u = 0; u < ctx->ndims; u++)
|
||||
fprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", record->scaled[u] * ctx->dim[u]);
|
||||
HDfputs("}\n", stream);
|
||||
fputs("}\n", stream);
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* H5D__bt2_unfilt_debug() */
|
||||
@@ -541,7 +541,7 @@ H5D__bt2_filt_debug(FILE *stream, int indent, int fwidth, const void *_record, c
|
||||
fprintf(stream, "%*s%-*s {", indent, "", fwidth, "Logical offset:");
|
||||
for (u = 0; u < ctx->ndims; u++)
|
||||
fprintf(stream, "%s%" PRIuHSIZE, u ? ", " : "", record->scaled[u] * ctx->dim[u]);
|
||||
HDfputs("}\n", stream);
|
||||
fputs("}\n", stream);
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* H5D__bt2_filt_debug() */
|
||||
|
||||
+3
-3
@@ -7174,7 +7174,7 @@ H5D__chunk_dump_index_cb(const H5D_chunk_rec_t *chunk_rec, void *_udata)
|
||||
for (u = 0; u < udata->ndims; u++)
|
||||
fprintf(udata->stream, "%s%" PRIuHSIZE, (u ? ", " : ""),
|
||||
(chunk_rec->scaled[u] * udata->chunk_dim[u]));
|
||||
HDfputs("]\n", udata->stream);
|
||||
fputs("]\n", udata->stream);
|
||||
} /* end if */
|
||||
|
||||
FUNC_LEAVE_NOAPI(H5_ITER_CONT)
|
||||
@@ -7281,10 +7281,10 @@ H5D__chunk_stats(const H5D_t *dset, bool headers)
|
||||
miss_rate = 0.0;
|
||||
}
|
||||
if (miss_rate > 100) {
|
||||
HDsnprintf(ascii, sizeof(ascii), "%7d%%", (int)(miss_rate + 0.5));
|
||||
snprintf(ascii, sizeof(ascii), "%7d%%", (int)(miss_rate + 0.5));
|
||||
}
|
||||
else {
|
||||
HDsnprintf(ascii, sizeof(ascii), "%7.2f%%", miss_rate);
|
||||
snprintf(ascii, sizeof(ascii), "%7.2f%%", miss_rate);
|
||||
}
|
||||
|
||||
fprintf(H5DEBUG(AC), " %-18s %8u %8u %7s %8d+%-9ld\n", "raw data chunks", rdcc->stats.nhits,
|
||||
|
||||
+2
-2
@@ -395,7 +395,7 @@ H5D__earray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void
|
||||
assert(elmt);
|
||||
|
||||
/* Print element */
|
||||
HDsnprintf(temp_str, sizeof(temp_str), "Element #%" PRIuHSIZE ":", idx);
|
||||
snprintf(temp_str, sizeof(temp_str), "Element #%" PRIuHSIZE ":", idx);
|
||||
fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt);
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
@@ -539,7 +539,7 @@ H5D__earray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const
|
||||
assert(elmt);
|
||||
|
||||
/* Print element */
|
||||
HDsnprintf(temp_str, sizeof(temp_str), "Element #%" PRIuHSIZE ":", idx);
|
||||
snprintf(temp_str, sizeof(temp_str), "Element #%" PRIuHSIZE ":", idx);
|
||||
fprintf(stream, "%*s%-*s {%" PRIuHADDR ", %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr,
|
||||
elmt->nbytes, elmt->filter_mask);
|
||||
|
||||
|
||||
+2
-2
@@ -393,7 +393,7 @@ H5D__farray_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void
|
||||
assert(elmt);
|
||||
|
||||
/* Print element */
|
||||
HDsnprintf(temp_str, sizeof(temp_str), "Element #%" PRIuHSIZE ":", idx);
|
||||
snprintf(temp_str, sizeof(temp_str), "Element #%" PRIuHSIZE ":", idx);
|
||||
fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", indent, "", fwidth, temp_str, *(const haddr_t *)elmt);
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
@@ -635,7 +635,7 @@ H5D__farray_filt_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const
|
||||
assert(elmt);
|
||||
|
||||
/* Print element */
|
||||
HDsnprintf(temp_str, sizeof(temp_str), "Element #%" PRIuHSIZE ":", idx);
|
||||
snprintf(temp_str, sizeof(temp_str), "Element #%" PRIuHSIZE ":", idx);
|
||||
fprintf(stream, "%*s%-*s {%" PRIuHADDR ", %u, %0x}\n", indent, "", fwidth, temp_str, elmt->addr,
|
||||
elmt->nbytes, elmt->filter_mask);
|
||||
|
||||
|
||||
+7
-7
@@ -1087,22 +1087,22 @@ H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char **
|
||||
/* Prefix has to be checked for NULL / empty string again because the
|
||||
* code above might have updated it.
|
||||
*/
|
||||
if (prefix == NULL || *prefix == '\0' || HDstrcmp(prefix, ".") == 0) {
|
||||
if (prefix == NULL || *prefix == '\0' || strcmp(prefix, ".") == 0) {
|
||||
/* filename is interpreted as relative to the current directory,
|
||||
* does not need to be expanded
|
||||
*/
|
||||
*file_prefix = NULL;
|
||||
} /* end if */
|
||||
else {
|
||||
if (HDstrncmp(prefix, "${ORIGIN}", HDstrlen("${ORIGIN}")) == 0) {
|
||||
if (strncmp(prefix, "${ORIGIN}", strlen("${ORIGIN}")) == 0) {
|
||||
/* Replace ${ORIGIN} at beginning of prefix by directory of HDF5 file */
|
||||
filepath_len = HDstrlen(filepath);
|
||||
prefix_len = HDstrlen(prefix);
|
||||
file_prefix_len = filepath_len + prefix_len - HDstrlen("${ORIGIN}") + 1;
|
||||
filepath_len = strlen(filepath);
|
||||
prefix_len = strlen(prefix);
|
||||
file_prefix_len = filepath_len + prefix_len - strlen("${ORIGIN}") + 1;
|
||||
|
||||
if (NULL == (*file_prefix = (char *)H5MM_malloc(file_prefix_len)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate buffer");
|
||||
HDsnprintf(*file_prefix, file_prefix_len, "%s%s", filepath, prefix + HDstrlen("${ORIGIN}"));
|
||||
snprintf(*file_prefix, file_prefix_len, "%s%s", filepath, prefix + strlen("${ORIGIN}"));
|
||||
} /* end if */
|
||||
else {
|
||||
if (NULL == (*file_prefix = (char *)H5MM_strdup(prefix)))
|
||||
@@ -1526,7 +1526,7 @@ H5D_open(const H5G_loc_t *loc, hid_t dapl_id)
|
||||
* matches the new external file prefix
|
||||
*/
|
||||
if (extfile_prefix && dataset->shared->extfile_prefix) {
|
||||
if (HDstrcmp(extfile_prefix, dataset->shared->extfile_prefix) != 0)
|
||||
if (strcmp(extfile_prefix, dataset->shared->extfile_prefix) != 0)
|
||||
HGOTO_ERROR(
|
||||
H5E_DATASET, H5E_CANTOPENOBJ, NULL,
|
||||
"new external file prefix does not match external file prefix of already open dataset");
|
||||
|
||||
+2
-3
@@ -489,7 +489,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
|
||||
|
||||
/* Determine size of heap needed to stored the file names */
|
||||
for (u = 0; u < efl->nused; ++u)
|
||||
heap_size += H5HL_ALIGN(HDstrlen(efl->slot[u].name) + 1);
|
||||
heap_size += H5HL_ALIGN(strlen(efl->slot[u].name) + 1);
|
||||
|
||||
/* Create the heap for the EFL file names */
|
||||
if (H5HL_create(file, heap_size, &efl->heap_addr /*out*/) < 0)
|
||||
@@ -507,8 +507,7 @@ H5D__layout_oh_create(H5F_t *file, H5O_t *oh, H5D_t *dset, hid_t dapl_id)
|
||||
|
||||
for (u = 0; u < efl->nused; ++u) {
|
||||
/* Insert file name into heap */
|
||||
if (H5HL_insert(file, heap, HDstrlen(efl->slot[u].name) + 1, efl->slot[u].name, &name_offset) <
|
||||
0) {
|
||||
if (H5HL_insert(file, heap, strlen(efl->slot[u].name) + 1, efl->slot[u].name, &name_offset) < 0) {
|
||||
H5HL_unprotect(heap);
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "unable to insert file name into heap");
|
||||
}
|
||||
|
||||
+9
-9
@@ -446,7 +446,7 @@ static FILE *debug_stream = NULL;
|
||||
\
|
||||
if (trace_flag) { \
|
||||
H5D_MPIO_DEBUG_VA(rank, "%s%s", trace_in_pre, __func__); \
|
||||
debug_indent += (int)HDstrlen(trace_in_pre); \
|
||||
debug_indent += (int)strlen(trace_in_pre); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
@@ -455,7 +455,7 @@ static FILE *debug_stream = NULL;
|
||||
bool trace_flag = H5D_mpio_debug_flags_s[(int)'t']; \
|
||||
\
|
||||
if (trace_flag) { \
|
||||
debug_indent -= (int)HDstrlen(trace_out_pre); \
|
||||
debug_indent -= (int)strlen(trace_out_pre); \
|
||||
H5D_MPIO_DEBUG_VA(rank, "%s%s", trace_out_pre, __func__); \
|
||||
} \
|
||||
} while (0)
|
||||
@@ -861,14 +861,14 @@ H5D__mpio_get_no_coll_cause_strings(char *local_cause, size_t local_cause_len, c
|
||||
* so, prepend a semicolon to separate the messages.
|
||||
*/
|
||||
if (buf_space_left && local_cause_bytes_written) {
|
||||
HDstrncat(local_cause, "; ", buf_space_left);
|
||||
strncat(local_cause, "; ", buf_space_left);
|
||||
local_cause_bytes_written += MIN(buf_space_left, 2);
|
||||
buf_space_left -= MIN(buf_space_left, 2);
|
||||
}
|
||||
|
||||
if (buf_space_left) {
|
||||
HDstrncat(local_cause, cause_str, buf_space_left);
|
||||
local_cause_bytes_written += MIN(buf_space_left, HDstrlen(cause_str));
|
||||
strncat(local_cause, cause_str, buf_space_left);
|
||||
local_cause_bytes_written += MIN(buf_space_left, strlen(cause_str));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -884,14 +884,14 @@ H5D__mpio_get_no_coll_cause_strings(char *local_cause, size_t local_cause_len, c
|
||||
* so, prepend a semicolon to separate the messages.
|
||||
*/
|
||||
if (buf_space_left && global_cause_bytes_written) {
|
||||
HDstrncat(global_cause, "; ", buf_space_left);
|
||||
strncat(global_cause, "; ", buf_space_left);
|
||||
global_cause_bytes_written += MIN(buf_space_left, 2);
|
||||
buf_space_left -= MIN(buf_space_left, 2);
|
||||
}
|
||||
|
||||
if (buf_space_left) {
|
||||
HDstrncat(global_cause, cause_str, buf_space_left);
|
||||
global_cause_bytes_written += MIN(buf_space_left, HDstrlen(cause_str));
|
||||
strncat(global_cause, cause_str, buf_space_left);
|
||||
global_cause_bytes_written += MIN(buf_space_left, strlen(cause_str));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1111,7 +1111,7 @@ H5D__piece_io(H5D_io_info_t *io_info)
|
||||
char debug_log_filename[1024];
|
||||
time_t time_now;
|
||||
|
||||
HDsnprintf(debug_log_filename, 1024, "H5Dmpio_debug.rank%d", mpi_rank);
|
||||
snprintf(debug_log_filename, 1024, "H5Dmpio_debug.rank%d", mpi_rank);
|
||||
|
||||
if (NULL == (debug_log_file = fopen(debug_log_filename, "a")))
|
||||
HGOTO_ERROR(H5E_IO, H5E_OPENERROR, FAIL, "couldn't open debugging log file");
|
||||
|
||||
+8
-8
@@ -443,11 +443,11 @@ H5D__virtual_store_layout(H5F_t *f, H5O_layout_t *layout)
|
||||
assert(ent->source_dset.virtual_select);
|
||||
|
||||
/* Source file name */
|
||||
str_size[2 * i] = HDstrlen(ent->source_file_name) + (size_t)1;
|
||||
str_size[2 * i] = strlen(ent->source_file_name) + (size_t)1;
|
||||
block_size += str_size[2 * i];
|
||||
|
||||
/* Source dset name */
|
||||
str_size[(2 * i) + 1] = HDstrlen(ent->source_dset_name) + (size_t)1;
|
||||
str_size[(2 * i) + 1] = strlen(ent->source_dset_name) + (size_t)1;
|
||||
block_size += str_size[(2 * i) + 1];
|
||||
|
||||
/* Source selection */
|
||||
@@ -868,7 +868,7 @@ H5D__virtual_open_source_dset(const H5D_t *vdset, H5O_storage_virtual_ent_t *vir
|
||||
assert(source_dset->dset_name);
|
||||
|
||||
/* Check if we need to open the source file */
|
||||
if (HDstrcmp(source_dset->file_name, ".") != 0) {
|
||||
if (strcmp(source_dset->file_name, ".") != 0) {
|
||||
unsigned intent; /* File access permissions */
|
||||
|
||||
/* Get the virtual dataset's file open flags ("intent") */
|
||||
@@ -1115,12 +1115,12 @@ H5D_virtual_parse_source_name(const char *source_name, H5O_storage_virtual_name_
|
||||
|
||||
/* Initialize p and tmp_static_strlen */
|
||||
p = source_name;
|
||||
tmp_static_strlen = tmp_strlen = HDstrlen(source_name);
|
||||
tmp_static_strlen = tmp_strlen = strlen(source_name);
|
||||
|
||||
/* Iterate over name */
|
||||
/* Note this will not work with UTF-8! We should support this eventually
|
||||
* -NAF 5/18/2015 */
|
||||
while ((pct = HDstrchr(p, '%'))) {
|
||||
while ((pct = strchr(p, '%'))) {
|
||||
assert(pct >= p);
|
||||
|
||||
/* Allocate name segment struct if necessary */
|
||||
@@ -1336,10 +1336,10 @@ H5D__virtual_build_source_name(char *source_name, const H5O_storage_virtual_name
|
||||
do {
|
||||
/* Add name segment */
|
||||
if (name_seg->name_segment) {
|
||||
seg_len = HDstrlen(name_seg->name_segment);
|
||||
seg_len = strlen(name_seg->name_segment);
|
||||
assert(seg_len > 0);
|
||||
assert(seg_len < name_len_rem);
|
||||
HDstrncpy(p, name_seg->name_segment, name_len_rem);
|
||||
strncpy(p, name_seg->name_segment, name_len_rem);
|
||||
name_len_rem -= seg_len;
|
||||
p += seg_len;
|
||||
} /* end if */
|
||||
@@ -1347,7 +1347,7 @@ H5D__virtual_build_source_name(char *source_name, const H5O_storage_virtual_name
|
||||
/* Add block number */
|
||||
if (nsubs_rem > 0) {
|
||||
assert(blockno_len < name_len_rem);
|
||||
if (HDsnprintf(p, name_len_rem, "%llu", (long long unsigned)blockno) < 0)
|
||||
if (snprintf(p, name_len_rem, "%llu", (long long unsigned)blockno) < 0)
|
||||
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "unable to write block number to string");
|
||||
name_len_rem -= blockno_len;
|
||||
p += blockno_len;
|
||||
|
||||
@@ -170,8 +170,8 @@ H5E_init(void)
|
||||
|
||||
/* Allocate the HDF5 error class */
|
||||
assert(H5E_ERR_CLS_g == (-1));
|
||||
HDsnprintf(lib_vers, sizeof(lib_vers), "%u.%u.%u%s", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
|
||||
(HDstrlen(H5_VERS_SUBRELEASE) > 0 ? "-" H5_VERS_SUBRELEASE : ""));
|
||||
snprintf(lib_vers, sizeof(lib_vers), "%u.%u.%u%s", H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE,
|
||||
(strlen(H5_VERS_SUBRELEASE) > 0 ? "-" H5_VERS_SUBRELEASE : ""));
|
||||
if (NULL == (cls = H5E__register_class(H5E_CLS_NAME, H5E_CLS_LIB_NAME, lib_vers)))
|
||||
HGOTO_ERROR(H5E_ERROR, H5E_CANTINIT, FAIL, "class initialization failed");
|
||||
if ((H5E_ERR_CLS_g = H5I_register(H5I_ERROR_CLASS, cls, false)) < 0)
|
||||
@@ -569,11 +569,11 @@ H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size)
|
||||
assert(cls);
|
||||
|
||||
/* Get the class's name */
|
||||
len = (ssize_t)HDstrlen(cls->cls_name);
|
||||
len = (ssize_t)strlen(cls->cls_name);
|
||||
|
||||
/* Set the user's buffer, if provided */
|
||||
if (name) {
|
||||
HDstrncpy(name, cls->cls_name, size);
|
||||
strncpy(name, cls->cls_name, size);
|
||||
if ((size_t)len >= size)
|
||||
name[size - 1] = '\0';
|
||||
} /* end if */
|
||||
|
||||
+3
-3
@@ -229,7 +229,7 @@ H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int inde
|
||||
fprintf(stream, "%*sData Block Addresses in Index Block:\n", indent, "");
|
||||
for (u = 0; u < iblock->ndblk_addrs; u++) {
|
||||
/* Print address */
|
||||
HDsnprintf(temp_str, sizeof(temp_str), "Address #%u:", u);
|
||||
snprintf(temp_str, sizeof(temp_str), "Address #%u:", u);
|
||||
fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str,
|
||||
iblock->dblk_addrs[u]);
|
||||
} /* end for */
|
||||
@@ -244,7 +244,7 @@ H5EA__iblock_debug(H5F_t *f, haddr_t H5_ATTR_UNUSED addr, FILE *stream, int inde
|
||||
fprintf(stream, "%*sSuper Block Addresses in Index Block:\n", indent, "");
|
||||
for (u = 0; u < iblock->nsblk_addrs; u++) {
|
||||
/* Print address */
|
||||
HDsnprintf(temp_str, sizeof(temp_str), "Address #%u:", u);
|
||||
snprintf(temp_str, sizeof(temp_str), "Address #%u:", u);
|
||||
fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str,
|
||||
iblock->sblk_addrs[u]);
|
||||
} /* end for */
|
||||
@@ -331,7 +331,7 @@ H5EA__sblock_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
|
||||
fprintf(stream, "%*sData Block Addresses in Super Block:\n", indent, "");
|
||||
for (u = 0; u < sblock->ndblks; u++) {
|
||||
/* Print address */
|
||||
HDsnprintf(temp_str, sizeof(temp_str), "Address #%u:", u);
|
||||
snprintf(temp_str, sizeof(temp_str), "Address #%u:", u);
|
||||
fprintf(stream, "%*s%-*s %" PRIuHADDR "\n", (indent + 3), "", MAX(0, (fwidth - 3)), temp_str,
|
||||
sblock->dblk_addrs[u]);
|
||||
} /* end for */
|
||||
|
||||
+1
-1
@@ -301,7 +301,7 @@ H5EA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *
|
||||
assert(elmt);
|
||||
|
||||
/* Print element */
|
||||
HDsnprintf(temp_str, sizeof(temp_str), "Element #%llu:", (unsigned long long)idx);
|
||||
snprintf(temp_str, sizeof(temp_str), "Element #%llu:", (unsigned long long)idx);
|
||||
fprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str,
|
||||
(unsigned long long)*(const uint64_t *)elmt);
|
||||
|
||||
|
||||
+1
-1
@@ -359,7 +359,7 @@ H5ES_insert(hid_t es_id, H5VL_t *connector, void *token, const char *caller, con
|
||||
|
||||
/* Copy the string for the API routine's arguments */
|
||||
/* (skip the six characters from the app's file, function and line # arguments) */
|
||||
assert(0 == HDstrncmp(caller_args, "*s*sIu", 6));
|
||||
assert(0 == strncmp(caller_args, "*s*sIu", 6));
|
||||
if (H5_trace_args(rs, caller_args + 6, ap) < 0)
|
||||
HGOTO_ERROR(H5E_EVENTSET, H5E_CANTSET, FAIL, "can't create formatted API arguments");
|
||||
if (NULL == (api_args = H5RS_get_str(rs)))
|
||||
|
||||
+6
-6
@@ -119,11 +119,11 @@ H5E__get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size)
|
||||
assert(msg);
|
||||
|
||||
/* Get the length of the message string */
|
||||
len = (ssize_t)HDstrlen(msg->msg);
|
||||
len = (ssize_t)strlen(msg->msg);
|
||||
|
||||
/* Copy the message into the user's buffer, if given */
|
||||
if (msg_str) {
|
||||
HDstrncpy(msg_str, msg->msg, size);
|
||||
strncpy(msg_str, msg->msg, size);
|
||||
if ((size_t)len >= size)
|
||||
msg_str[size - 1] = '\0';
|
||||
} /* end if */
|
||||
@@ -209,7 +209,7 @@ H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
|
||||
cls_ptr = maj_ptr->cls;
|
||||
|
||||
/* Print error class header if new class */
|
||||
if (eprint->cls.lib_name == NULL || HDstrcmp(cls_ptr->lib_name, eprint->cls.lib_name) != 0) {
|
||||
if (eprint->cls.lib_name == NULL || strcmp(cls_ptr->lib_name, eprint->cls.lib_name) != 0) {
|
||||
/* update to the new class information */
|
||||
if (cls_ptr->cls_name)
|
||||
eprint->cls.cls_name = cls_ptr->cls_name;
|
||||
@@ -245,7 +245,7 @@ H5E__walk1_cb(int n, H5E_error1_t *err_desc, void *client_data)
|
||||
} /* end if */
|
||||
|
||||
/* Check for "real" error description - used to format output more nicely */
|
||||
if (err_desc->desc == NULL || HDstrlen(err_desc->desc) == 0)
|
||||
if (err_desc->desc == NULL || strlen(err_desc->desc) == 0)
|
||||
have_desc = 0;
|
||||
|
||||
/* Print error message */
|
||||
@@ -333,7 +333,7 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
|
||||
HGOTO_DONE(FAIL);
|
||||
|
||||
/* Print error class header if new class */
|
||||
if (eprint->cls.lib_name == NULL || HDstrcmp(cls_ptr->lib_name, eprint->cls.lib_name) != 0) {
|
||||
if (eprint->cls.lib_name == NULL || strcmp(cls_ptr->lib_name, eprint->cls.lib_name) != 0) {
|
||||
/* update to the new class information */
|
||||
if (cls_ptr->cls_name)
|
||||
eprint->cls.cls_name = cls_ptr->cls_name;
|
||||
@@ -369,7 +369,7 @@ H5E__walk2_cb(unsigned n, const H5E_error2_t *err_desc, void *client_data)
|
||||
} /* end if */
|
||||
|
||||
/* Check for "real" error description - used to format output more nicely */
|
||||
if (err_desc->desc == NULL || HDstrlen(err_desc->desc) == 0)
|
||||
if (err_desc->desc == NULL || strlen(err_desc->desc) == 0)
|
||||
have_desc = 0;
|
||||
|
||||
/* Print error message */
|
||||
|
||||
+4
-4
@@ -122,7 +122,7 @@ typedef struct H5E_t H5E_t;
|
||||
* considered as an API change \
|
||||
*/ \
|
||||
HDONE_ERROR(majorcode, minorcode, retcode, "%s, errno = %d, error message = '%s'", str, myerrno, \
|
||||
HDstrerror(myerrno)); \
|
||||
strerror(myerrno)); \
|
||||
}
|
||||
#define HSYS_GOTO_ERROR(majorcode, minorcode, retcode, str) \
|
||||
{ \
|
||||
@@ -131,7 +131,7 @@ typedef struct H5E_t H5E_t;
|
||||
* considered as an API change \
|
||||
*/ \
|
||||
HGOTO_ERROR(majorcode, minorcode, retcode, "%s, errno = %d, error message = '%s'", str, myerrno, \
|
||||
HDstrerror(myerrno)); \
|
||||
strerror(myerrno)); \
|
||||
}
|
||||
#else /* H5_HAVE_WIN32_API */
|
||||
/* On Windows we also emit the result of GetLastError(). This call returns a DWORD, which is always a
|
||||
@@ -148,7 +148,7 @@ typedef struct H5E_t H5E_t;
|
||||
*/ \
|
||||
HDONE_ERROR(majorcode, minorcode, retcode, \
|
||||
"%s, errno = %d, error message = '%s', Win32 GetLastError() = %" PRIu32 "", str, \
|
||||
myerrno, HDstrerror(myerrno), win_error); \
|
||||
myerrno, strerror(myerrno), win_error); \
|
||||
}
|
||||
#define HSYS_GOTO_ERROR(majorcode, minorcode, retcode, str) \
|
||||
{ \
|
||||
@@ -159,7 +159,7 @@ typedef struct H5E_t H5E_t;
|
||||
*/ \
|
||||
HGOTO_ERROR(majorcode, minorcode, retcode, \
|
||||
"%s, errno = %d, error message = '%s', Win32 GetLastError() = %" PRIu32 "", str, \
|
||||
myerrno, HDstrerror(myerrno), win_error); \
|
||||
myerrno, strerror(myerrno), win_error); \
|
||||
}
|
||||
#endif /* H5_HAVE_WIN32_API */
|
||||
|
||||
|
||||
+1
-1
@@ -284,7 +284,7 @@ H5FA__test_debug(FILE *stream, int indent, int fwidth, hsize_t idx, const void *
|
||||
assert(elmt);
|
||||
|
||||
/* Print element */
|
||||
HDsnprintf(temp_str, sizeof(temp_str), "Element #%llu:", (unsigned long long)idx);
|
||||
snprintf(temp_str, sizeof(temp_str), "Element #%llu:", (unsigned long long)idx);
|
||||
fprintf(stream, "%*s%-*s %llu\n", indent, "", fwidth, temp_str,
|
||||
(unsigned long long)*(const uint64_t *)elmt);
|
||||
|
||||
|
||||
+2
-2
@@ -543,9 +543,9 @@ H5FD_sb_load(H5FD_t *file, const char *name, const uint8_t *buf)
|
||||
/* Check if driver matches driver information saved. Unfortunately, we can't push this
|
||||
* function to each specific driver because we're checking if the driver is correct.
|
||||
*/
|
||||
if (!HDstrncmp(name, "NCSAfami", (size_t)8) && HDstrcmp(file->cls->name, "family") != 0)
|
||||
if (!strncmp(name, "NCSAfami", (size_t)8) && strcmp(file->cls->name, "family") != 0)
|
||||
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "family driver should be used");
|
||||
if (!HDstrncmp(name, "NCSAmult", (size_t)8) && HDstrcmp(file->cls->name, "multi") != 0)
|
||||
if (!strncmp(name, "NCSAmult", (size_t)8) && strcmp(file->cls->name, "multi") != 0)
|
||||
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "multi driver should be used");
|
||||
|
||||
/* Decode driver information */
|
||||
|
||||
+7
-7
@@ -399,7 +399,7 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size)
|
||||
"write to backing store failed: time = %s, filename = '%s', file descriptor = %d, "
|
||||
"errno = %d, error message = '%s', ptr = %p, total write size = %llu, bytes this "
|
||||
"sub-write = %llu, bytes actually written = %llu, offset = %llu",
|
||||
HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno), (void *)ptr,
|
||||
HDctime(&mytime), file->name, file->fd, myerrno, strerror(myerrno), (void *)ptr,
|
||||
(unsigned long long)size, (unsigned long long)bytes_in,
|
||||
(unsigned long long)bytes_wrote, (unsigned long long)offset);
|
||||
} /* end if */
|
||||
@@ -433,9 +433,9 @@ H5FD__core_get_default_config(void)
|
||||
char *driver = HDgetenv(HDF5_DRIVER);
|
||||
|
||||
if (driver) {
|
||||
if (!HDstrcmp(driver, "core"))
|
||||
if (!strcmp(driver, "core"))
|
||||
return &H5FD_core_default_config_g;
|
||||
else if (!HDstrcmp(driver, "core_paged"))
|
||||
else if (!strcmp(driver, "core_paged"))
|
||||
return &H5FD_core_default_paged_config_g;
|
||||
}
|
||||
|
||||
@@ -463,9 +463,9 @@ H5FD_core_init(void)
|
||||
|
||||
/* Check the use disabled file locks environment variable */
|
||||
lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING);
|
||||
if (lock_env_var && !HDstrcmp(lock_env_var, "BEST_EFFORT"))
|
||||
if (lock_env_var && !strcmp(lock_env_var, "BEST_EFFORT"))
|
||||
ignore_disabled_file_locks_s = true; /* Override: Ignore disabled locks */
|
||||
else if (lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "1")))
|
||||
else if (lock_env_var && (!strcmp(lock_env_var, "TRUE") || !strcmp(lock_env_var, "1")))
|
||||
ignore_disabled_file_locks_s = false; /* Override: Don't ignore disabled locks */
|
||||
else
|
||||
ignore_disabled_file_locks_s = FAIL; /* Environment variable not set, or not set correctly */
|
||||
@@ -905,7 +905,7 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
|
||||
"file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, "
|
||||
"error message = '%s', file->mem = %p, total read size = %llu, bytes this "
|
||||
"sub-read = %llu, bytes actually read = %llu, offset = %llu",
|
||||
HDctime(&mytime), file->name, file->fd, myerrno, HDstrerror(myerrno),
|
||||
HDctime(&mytime), file->name, file->fd, myerrno, strerror(myerrno),
|
||||
(void *)file->mem, (unsigned long long)size, (unsigned long long)bytes_in,
|
||||
(unsigned long long)bytes_read, (unsigned long long)offset);
|
||||
} /* end if */
|
||||
@@ -1086,7 +1086,7 @@ H5FD__core_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
|
||||
if (NULL == f2->name)
|
||||
HGOTO_DONE(1);
|
||||
|
||||
ret_value = HDstrcmp(f1->name, f2->name);
|
||||
ret_value = strcmp(f1->name, f2->name);
|
||||
} /* end else */
|
||||
|
||||
done:
|
||||
|
||||
+2
-2
@@ -204,9 +204,9 @@ H5FD_direct_init(void)
|
||||
|
||||
/* Check the use disabled file locks environment variable */
|
||||
lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING);
|
||||
if (lock_env_var && !HDstrcmp(lock_env_var, "BEST_EFFORT"))
|
||||
if (lock_env_var && !strcmp(lock_env_var, "BEST_EFFORT"))
|
||||
ignore_disabled_file_locks_s = true; /* Override: Ignore disabled locks */
|
||||
else if (lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "1")))
|
||||
else if (lock_env_var && (!strcmp(lock_env_var, "TRUE") || !strcmp(lock_env_var, "1")))
|
||||
ignore_disabled_file_locks_s = false; /* Override: Don't ignore disabled locks */
|
||||
else
|
||||
ignore_disabled_file_locks_s = FAIL; /* Environment variable not set, or not set correctly */
|
||||
|
||||
+21
-21
@@ -225,36 +225,36 @@ H5FD__family_get_default_printf_filename(const char *old_filename)
|
||||
|
||||
assert(old_filename);
|
||||
|
||||
old_filename_len = HDstrlen(old_filename);
|
||||
old_filename_len = strlen(old_filename);
|
||||
if (0 == old_filename_len)
|
||||
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "invalid filename");
|
||||
|
||||
new_filename_len = old_filename_len + HDstrlen(suffix) + 1;
|
||||
new_filename_len = old_filename_len + strlen(suffix) + 1;
|
||||
if (NULL == (tmp_buffer = H5MM_malloc(new_filename_len)))
|
||||
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "can't allocate new filename buffer");
|
||||
|
||||
/* Determine if filename contains a ".h5" extension. */
|
||||
if ((file_extension = HDstrstr(old_filename, ".h5"))) {
|
||||
if ((file_extension = strstr(old_filename, ".h5"))) {
|
||||
/* Insert the printf format between the filename and ".h5" extension. */
|
||||
HDstrcpy(tmp_buffer, old_filename);
|
||||
file_extension = HDstrstr(tmp_buffer, ".h5");
|
||||
HDsprintf(file_extension, "%s%s", suffix, ".h5");
|
||||
strcpy(tmp_buffer, old_filename);
|
||||
file_extension = strstr(tmp_buffer, ".h5");
|
||||
sprintf(file_extension, "%s%s", suffix, ".h5");
|
||||
}
|
||||
else if ((file_extension = HDstrrchr(old_filename, '.'))) {
|
||||
else if ((file_extension = strrchr(old_filename, '.'))) {
|
||||
char *new_extension_loc = NULL;
|
||||
|
||||
/* If the filename doesn't contain a ".h5" extension, but contains
|
||||
* AN extension, just insert the printf format before that extension.
|
||||
*/
|
||||
HDstrcpy(tmp_buffer, old_filename);
|
||||
new_extension_loc = HDstrrchr(tmp_buffer, '.');
|
||||
HDsprintf(new_extension_loc, "%s%s", suffix, file_extension);
|
||||
strcpy(tmp_buffer, old_filename);
|
||||
new_extension_loc = strrchr(tmp_buffer, '.');
|
||||
sprintf(new_extension_loc, "%s%s", suffix, file_extension);
|
||||
}
|
||||
else {
|
||||
/* If the filename doesn't contain an extension at all, just insert
|
||||
* the printf format at the end of the filename.
|
||||
*/
|
||||
HDsnprintf(tmp_buffer, new_filename_len, "%s%s", old_filename, suffix);
|
||||
snprintf(tmp_buffer, new_filename_len, "%s%s", old_filename, suffix);
|
||||
}
|
||||
|
||||
ret_value = tmp_buffer;
|
||||
@@ -564,7 +564,7 @@ H5FD__family_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*o
|
||||
FUNC_ENTER_PACKAGE_NOERR
|
||||
|
||||
/* Name and version number */
|
||||
HDstrncpy(name, "NCSAfami", (size_t)9);
|
||||
strncpy(name, "NCSAfami", (size_t)9);
|
||||
name[8] = '\0';
|
||||
|
||||
/* Store member file size. Use the member file size from the property here.
|
||||
@@ -738,9 +738,9 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, NULL, "unable to allocate temporary member name");
|
||||
|
||||
/* Check that names are unique */
|
||||
HDsnprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, 0);
|
||||
HDsnprintf(temp, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, 1);
|
||||
if (!HDstrcmp(memb_name, temp)) {
|
||||
snprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, 0);
|
||||
snprintf(temp, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, 1);
|
||||
if (!strcmp(memb_name, temp)) {
|
||||
if (default_config) {
|
||||
temp = H5MM_xfree(temp);
|
||||
if (NULL == (temp = H5FD__family_get_default_printf_filename(name)))
|
||||
@@ -753,7 +753,7 @@ H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad
|
||||
|
||||
/* Open all the family members */
|
||||
while (1) {
|
||||
HDsnprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, file->nmembs);
|
||||
snprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, name, file->nmembs);
|
||||
|
||||
/* Enlarge member array */
|
||||
if (file->nmembs >= file->amembs) {
|
||||
@@ -1016,7 +1016,7 @@ H5FD__family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa)
|
||||
/* Create another file if necessary */
|
||||
if (u >= file->nmembs || !file->memb[u]) {
|
||||
file->nmembs = MAX(file->nmembs, u + 1);
|
||||
HDsnprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, file->name, u);
|
||||
snprintf(memb_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, file->name, u);
|
||||
H5E_BEGIN_TRY
|
||||
{
|
||||
H5_CHECK_OVERFLOW(file->memb_size, hsize_t, haddr_t);
|
||||
@@ -1458,11 +1458,11 @@ H5FD__family_delete(const char *filename, hid_t fapl_id)
|
||||
|
||||
/* Sanity check to make sure that generated names are unique */
|
||||
H5_GCC_CLANG_DIAG_OFF("format-nonliteral")
|
||||
HDsnprintf(member_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, 0);
|
||||
HDsnprintf(temp, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, 1);
|
||||
snprintf(member_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, 0);
|
||||
snprintf(temp, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, 1);
|
||||
H5_GCC_CLANG_DIAG_ON("format-nonliteral")
|
||||
|
||||
if (!HDstrcmp(member_name, temp)) {
|
||||
if (!strcmp(member_name, temp)) {
|
||||
if (default_config) {
|
||||
temp = H5MM_xfree(temp);
|
||||
if (NULL == (temp = H5FD__family_get_default_printf_filename(filename)))
|
||||
@@ -1479,7 +1479,7 @@ H5FD__family_delete(const char *filename, hid_t fapl_id)
|
||||
while (1) {
|
||||
/* Fix up the filename with the current member's number */
|
||||
H5_GCC_CLANG_DIAG_OFF("format-nonliteral")
|
||||
HDsnprintf(member_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, current_member);
|
||||
snprintf(member_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, current_member);
|
||||
H5_GCC_CLANG_DIAG_ON("format-nonliteral")
|
||||
|
||||
/* Attempt to delete the member files. If the first file throws an error
|
||||
|
||||
+2
-2
@@ -1220,10 +1220,10 @@ H5FD__hdfs_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
|
||||
if (finfo1->mBlockSize != finfo2->mBlockSize) {
|
||||
HGOTO_DONE(-1);
|
||||
}
|
||||
if (HDstrcmp(finfo1->mOwner, finfo2->mOwner)) {
|
||||
if (strcmp(finfo1->mOwner, finfo2->mOwner)) {
|
||||
HGOTO_DONE(-1);
|
||||
}
|
||||
if (HDstrcmp(finfo1->mGroup, finfo2->mGroup)) {
|
||||
if (strcmp(finfo1->mGroup, finfo2->mGroup)) {
|
||||
HGOTO_DONE(-1);
|
||||
}
|
||||
if (finfo1->mPermissions != finfo2->mPermissions) {
|
||||
|
||||
+2
-2
@@ -2921,7 +2921,7 @@ H5FD_check_plugin_load(const H5FD_class_t *cls, const H5PL_key_t *key, bool *suc
|
||||
/* Which kind of key are we looking for? */
|
||||
if (key->vfd.kind == H5FD_GET_DRIVER_BY_NAME) {
|
||||
/* Check if plugin name matches VFD class name */
|
||||
if (cls->name && !HDstrcmp(cls->name, key->vfd.u.name))
|
||||
if (cls->name && !strcmp(cls->name, key->vfd.u.name))
|
||||
*success = true;
|
||||
}
|
||||
else {
|
||||
@@ -2957,7 +2957,7 @@ H5FD__get_driver_cb(void *obj, hid_t id, void *_op_data)
|
||||
FUNC_ENTER_PACKAGE_NOERR
|
||||
|
||||
if (H5FD_GET_DRIVER_BY_NAME == op_data->key.kind) {
|
||||
if (0 == HDstrcmp(cls->name, op_data->key.u.name)) {
|
||||
if (0 == strcmp(cls->name, op_data->key.u.name)) {
|
||||
op_data->found_id = id;
|
||||
ret_value = H5_ITER_STOP;
|
||||
} /* end if */
|
||||
|
||||
+6
-6
@@ -245,9 +245,9 @@ H5FD_log_init(void)
|
||||
|
||||
/* Check the use disabled file locks environment variable */
|
||||
lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING);
|
||||
if (lock_env_var && !HDstrcmp(lock_env_var, "BEST_EFFORT"))
|
||||
if (lock_env_var && !strcmp(lock_env_var, "BEST_EFFORT"))
|
||||
ignore_disabled_file_locks_s = true; /* Override: Ignore disabled locks */
|
||||
else if (lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "1")))
|
||||
else if (lock_env_var && (!strcmp(lock_env_var, "TRUE") || !strcmp(lock_env_var, "1")))
|
||||
ignore_disabled_file_locks_s = false; /* Override: Don't ignore disabled locks */
|
||||
else
|
||||
ignore_disabled_file_locks_s = FAIL; /* Environment variable not set, or not set correctly */
|
||||
@@ -501,7 +501,7 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
|
||||
HGOTO_ERROR(
|
||||
H5E_FILE, H5E_CANTOPENFILE, NULL,
|
||||
"unable to open file: name = '%s', errno = %d, error message = '%s', flags = %x, o_flags = %x",
|
||||
name, myerrno, HDstrerror(myerrno), flags, (unsigned)o_flags);
|
||||
name, myerrno, strerror(myerrno), flags, (unsigned)o_flags);
|
||||
}
|
||||
|
||||
/* Stop timer for open() call */
|
||||
@@ -545,7 +545,7 @@ H5FD__log_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
|
||||
#endif /* H5_HAVE_WIN32_API */
|
||||
|
||||
/* Retain a copy of the name used to open the file, for possible error reporting */
|
||||
HDstrncpy(file->filename, name, sizeof(file->filename));
|
||||
strncpy(file->filename, name, sizeof(file->filename));
|
||||
file->filename[sizeof(file->filename) - 1] = '\0';
|
||||
|
||||
/* Get the flags for logging */
|
||||
@@ -1239,7 +1239,7 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
|
||||
"file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, "
|
||||
"error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, "
|
||||
"bytes actually read = %llu, offset = %llu",
|
||||
HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf,
|
||||
HDctime(&mytime), file->filename, file->fd, myerrno, strerror(myerrno), buf,
|
||||
(unsigned long long)size, (unsigned long long)bytes_in,
|
||||
(unsigned long long)bytes_read, (unsigned long long)offset);
|
||||
}
|
||||
@@ -1458,7 +1458,7 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
|
||||
"file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, "
|
||||
"error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = "
|
||||
"%llu, bytes actually written = %llu, offset = %llu",
|
||||
HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf,
|
||||
HDctime(&mytime), file->filename, file->fd, myerrno, strerror(myerrno), buf,
|
||||
(unsigned long long)size, (unsigned long long)bytes_in,
|
||||
(unsigned long long)bytes_wrote, (unsigned long long)offset);
|
||||
} /* end if */
|
||||
|
||||
+8
-9
@@ -615,7 +615,7 @@ H5FD_mirror_xmit_decode_open(H5FD_mirror_xmit_open_t *out, const unsigned char *
|
||||
n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->maxaddr), &buf[n_eaten]);
|
||||
n_eaten += H5FD__mirror_xmit_decode_uint64(&(out->size_t_blob), &buf[n_eaten]);
|
||||
assert((H5FD_MIRROR_XMIT_OPEN_SIZE - H5FD_MIRROR_XMIT_FILEPATH_MAX) == n_eaten);
|
||||
HDstrncpy(out->filename, (const char *)&buf[n_eaten], H5FD_MIRROR_XMIT_FILEPATH_MAX - 1);
|
||||
strncpy(out->filename, (const char *)&buf[n_eaten], H5FD_MIRROR_XMIT_FILEPATH_MAX - 1);
|
||||
out->filename[H5FD_MIRROR_XMIT_FILEPATH_MAX - 1] = 0; /* force final NULL */
|
||||
|
||||
return H5FD_MIRROR_XMIT_OPEN_SIZE;
|
||||
@@ -653,7 +653,7 @@ H5FD_mirror_xmit_decode_reply(H5FD_mirror_xmit_reply_t *out, const unsigned char
|
||||
n_eaten += H5FD_mirror_xmit_decode_header(&(out->pub), buf);
|
||||
n_eaten += H5FD__mirror_xmit_decode_uint32(&(out->status), &buf[n_eaten]);
|
||||
assert((H5FD_MIRROR_XMIT_REPLY_SIZE - H5FD_MIRROR_STATUS_MESSAGE_MAX) == n_eaten);
|
||||
HDstrncpy(out->message, (const char *)&buf[n_eaten], H5FD_MIRROR_STATUS_MESSAGE_MAX - 1);
|
||||
strncpy(out->message, (const char *)&buf[n_eaten], H5FD_MIRROR_STATUS_MESSAGE_MAX - 1);
|
||||
out->message[H5FD_MIRROR_STATUS_MESSAGE_MAX - 1] = 0; /* force NULL term */
|
||||
|
||||
return H5FD_MIRROR_XMIT_REPLY_SIZE;
|
||||
@@ -825,7 +825,7 @@ H5FD_mirror_xmit_encode_open(unsigned char *dest, const H5FD_mirror_xmit_open_t
|
||||
n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->maxaddr);
|
||||
n_writ += H5FD__mirror_xmit_encode_uint64(&dest[n_writ], x->size_t_blob);
|
||||
assert((H5FD_MIRROR_XMIT_OPEN_SIZE - H5FD_MIRROR_XMIT_FILEPATH_MAX) == n_writ);
|
||||
HDstrncpy((char *)&dest[n_writ], x->filename, H5FD_MIRROR_XMIT_FILEPATH_MAX);
|
||||
strncpy((char *)&dest[n_writ], x->filename, H5FD_MIRROR_XMIT_FILEPATH_MAX);
|
||||
|
||||
return H5FD_MIRROR_XMIT_OPEN_SIZE;
|
||||
} /* end H5FD_mirror_xmit_encode_open() */
|
||||
@@ -860,7 +860,7 @@ H5FD_mirror_xmit_encode_reply(unsigned char *dest, const H5FD_mirror_xmit_reply_
|
||||
n_writ += H5FD_mirror_xmit_encode_header(dest, (const H5FD_mirror_xmit_t *)&(x->pub));
|
||||
n_writ += H5FD__mirror_xmit_encode_uint32(&dest[n_writ], x->status);
|
||||
assert((H5FD_MIRROR_XMIT_REPLY_SIZE - H5FD_MIRROR_STATUS_MESSAGE_MAX) == n_writ);
|
||||
HDstrncpy((char *)&dest[n_writ], x->message, H5FD_MIRROR_STATUS_MESSAGE_MAX);
|
||||
strncpy((char *)&dest[n_writ], x->message, H5FD_MIRROR_STATUS_MESSAGE_MAX);
|
||||
|
||||
return H5FD_MIRROR_XMIT_REPLY_SIZE;
|
||||
} /* end H5FD_mirror_xmit_encode_reply() */
|
||||
@@ -1360,7 +1360,7 @@ H5FD__mirror_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad
|
||||
|
||||
if (!name || !*name)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid file name");
|
||||
if (HDstrlen(name) >= H5FD_MIRROR_XMIT_FILEPATH_MAX)
|
||||
if (strlen(name) >= H5FD_MIRROR_XMIT_FILEPATH_MAX)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "filename is too long");
|
||||
if (0 == maxaddr || HADDR_UNDEF == maxaddr)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, NULL, "bogus maxaddr");
|
||||
@@ -1417,7 +1417,7 @@ H5FD__mirror_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad
|
||||
open_xmit->flags = (uint32_t)flags;
|
||||
open_xmit->maxaddr = (uint64_t)maxaddr;
|
||||
open_xmit->size_t_blob = (uint64_t)((size_t)(-1));
|
||||
HDsnprintf(open_xmit->filename, H5FD_MIRROR_XMIT_FILEPATH_MAX - 1, "%s", name);
|
||||
snprintf(open_xmit->filename, H5FD_MIRROR_XMIT_FILEPATH_MAX - 1, "%s", name);
|
||||
|
||||
xmit_buf = H5FL_BLK_MALLOC(xmit, H5FD_MIRROR_XMIT_BUFFER_MAX);
|
||||
if (NULL == xmit_buf)
|
||||
@@ -1512,15 +1512,14 @@ done:
|
||||
* We can ignore any response from the writer, if we receive
|
||||
* any reply at all.
|
||||
*/
|
||||
if (HDwrite(file->sock_fd, "GOODBYE", HDstrlen("GOODBYE")) < 0) {
|
||||
if (HDwrite(file->sock_fd, "GOODBYE", strlen("GOODBYE")) < 0) {
|
||||
HDONE_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to transmit close");
|
||||
if (HDclose(file->sock_fd) < 0)
|
||||
HDONE_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "can't close socket");
|
||||
file->sock_fd = -1; /* invalidate for later */
|
||||
} /* end if problem writing goodbye; go down hard */
|
||||
else if (HDshutdown(file->sock_fd, SHUT_WR) < 0)
|
||||
HDONE_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't shutdown socket write: %s",
|
||||
HDstrerror(errno));
|
||||
HDONE_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "can't shutdown socket write: %s", strerror(errno));
|
||||
} /* end if xmit encode failed */
|
||||
|
||||
if (file->sock_fd >= 0)
|
||||
|
||||
+1
-1
@@ -281,7 +281,7 @@ H5FD_mpio_init(void)
|
||||
|
||||
/* Check if MPI driver has been loaded dynamically */
|
||||
env = HDgetenv(HDF5_DRIVER);
|
||||
if (env && !HDstrcmp(env, "mpio")) {
|
||||
if (env && !strcmp(env, "mpio")) {
|
||||
int mpi_initialized = 0;
|
||||
|
||||
/* Initialize MPI if not already initialized */
|
||||
|
||||
+27
-27
@@ -464,7 +464,7 @@ H5FD__onion_commit_new_revision_record(H5FD_onion_t *file)
|
||||
|
||||
HDtime(&rawtime);
|
||||
info = HDgmtime(&rawtime);
|
||||
HDstrftime(rec->time_of_creation, sizeof(rec->time_of_creation), "%Y%m%dT%H%M%SZ", info);
|
||||
strftime(rec->time_of_creation, sizeof(rec->time_of_creation), "%Y%m%dT%H%M%SZ", info);
|
||||
|
||||
rec->logical_eof = file->logical_eof;
|
||||
|
||||
@@ -799,7 +799,7 @@ H5FD__onion_parse_config_str(const char *config_str, H5FD_onion_fapl_info_t *fa)
|
||||
|
||||
FUNC_ENTER_PACKAGE
|
||||
|
||||
if (!HDstrcmp(config_str, ""))
|
||||
if (!strcmp(config_str, ""))
|
||||
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "configure string can't be empty");
|
||||
|
||||
/* Initialize to the default values */
|
||||
@@ -810,7 +810,7 @@ H5FD__onion_parse_config_str(const char *config_str, H5FD_onion_fapl_info_t *fa)
|
||||
fa->revision_num = H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST;
|
||||
fa->force_write_open = 0;
|
||||
fa->creation_flags = 0;
|
||||
HDstrcpy(fa->comment, "initial comment");
|
||||
strcpy(fa->comment, "initial comment");
|
||||
|
||||
/* If a single integer is passed in as a string, it's a shortcut for the tools
|
||||
* (h5repack, h5diff, h5dump). Otherwise, the string should have curly brackets,
|
||||
@@ -829,51 +829,51 @@ H5FD__onion_parse_config_str(const char *config_str, H5FD_onion_fapl_info_t *fa)
|
||||
H5FD__onion_remove_unused_symbols(config_str_copy);
|
||||
|
||||
/* The configure string can't be empty after removing the curly brackets */
|
||||
if (!HDstrcmp(config_str_copy, ""))
|
||||
if (!strcmp(config_str_copy, ""))
|
||||
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "configure string can't be empty");
|
||||
|
||||
token1 = HDstrtok(config_str_copy, ":");
|
||||
token2 = HDstrtok(NULL, ";");
|
||||
token1 = strtok(config_str_copy, ":");
|
||||
token2 = strtok(NULL, ";");
|
||||
|
||||
do {
|
||||
if (token1 && token2) {
|
||||
if (!HDstrcmp(token1, "version")) {
|
||||
if (!HDstrcmp(token2, "H5FD_ONION_FAPL_INFO_VERSION_CURR"))
|
||||
if (!strcmp(token1, "version")) {
|
||||
if (!strcmp(token2, "H5FD_ONION_FAPL_INFO_VERSION_CURR"))
|
||||
fa->version = H5FD_ONION_FAPL_INFO_VERSION_CURR;
|
||||
}
|
||||
else if (!HDstrcmp(token1, "backing_fapl_id")) {
|
||||
if (!HDstrcmp(token2, "H5P_DEFAULT"))
|
||||
else if (!strcmp(token1, "backing_fapl_id")) {
|
||||
if (!strcmp(token2, "H5P_DEFAULT"))
|
||||
fa->backing_fapl_id = H5P_DEFAULT;
|
||||
else if (!strcmp(token2, "H5I_INVALID_HID"))
|
||||
fa->backing_fapl_id = H5I_INVALID_HID;
|
||||
else
|
||||
fa->backing_fapl_id = strtoll(token2, NULL, 10);
|
||||
}
|
||||
else if (!HDstrcmp(token1, "page_size")) {
|
||||
else if (!strcmp(token1, "page_size")) {
|
||||
fa->page_size = (uint32_t)strtoul(token2, NULL, 10);
|
||||
}
|
||||
else if (!HDstrcmp(token1, "revision_num")) {
|
||||
if (!HDstrcmp(token2, "H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST"))
|
||||
else if (!strcmp(token1, "revision_num")) {
|
||||
if (!strcmp(token2, "H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST"))
|
||||
fa->revision_num = H5FD_ONION_FAPL_INFO_REVISION_ID_LATEST;
|
||||
else
|
||||
fa->revision_num = (uint64_t)strtoull(token2, NULL, 10);
|
||||
}
|
||||
else if (!HDstrcmp(token1, "force_write_open")) {
|
||||
else if (!strcmp(token1, "force_write_open")) {
|
||||
fa->force_write_open = (uint8_t)strtoul(token2, NULL, 10);
|
||||
}
|
||||
else if (!HDstrcmp(token1, "creation_flags")) {
|
||||
else if (!strcmp(token1, "creation_flags")) {
|
||||
fa->creation_flags = (uint8_t)strtoul(token2, NULL, 10);
|
||||
}
|
||||
else if (!HDstrcmp(token1, "comment")) {
|
||||
HDstrcpy(fa->comment, token2);
|
||||
else if (!strcmp(token1, "comment")) {
|
||||
strcpy(fa->comment, token2);
|
||||
}
|
||||
else
|
||||
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "unknown token in the configure string: %s",
|
||||
token1);
|
||||
}
|
||||
|
||||
token1 = HDstrtok(NULL, ":");
|
||||
token2 = HDstrtok(NULL, ";");
|
||||
token1 = strtok(NULL, ":");
|
||||
token2 = strtok(NULL, ";");
|
||||
} while (token1);
|
||||
}
|
||||
|
||||
@@ -960,18 +960,18 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma
|
||||
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate file struct");
|
||||
|
||||
/* Allocate space for onion VFD file names */
|
||||
if (NULL == (name_onion = H5MM_malloc(sizeof(char) * (HDstrlen(filename) + 7))))
|
||||
if (NULL == (name_onion = H5MM_malloc(sizeof(char) * (strlen(filename) + 7))))
|
||||
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate onion name string");
|
||||
HDsnprintf(name_onion, HDstrlen(filename) + 7, "%s.onion", filename);
|
||||
snprintf(name_onion, strlen(filename) + 7, "%s.onion", filename);
|
||||
|
||||
if (NULL == (recovery_file_nameery = H5MM_malloc(sizeof(char) * (HDstrlen(name_onion) + 10))))
|
||||
if (NULL == (recovery_file_nameery = H5MM_malloc(sizeof(char) * (strlen(name_onion) + 10))))
|
||||
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate recovery name string");
|
||||
HDsnprintf(recovery_file_nameery, HDstrlen(name_onion) + 10, "%s.recovery", name_onion);
|
||||
snprintf(recovery_file_nameery, strlen(name_onion) + 10, "%s.recovery", name_onion);
|
||||
file->recovery_file_name = recovery_file_nameery;
|
||||
|
||||
if (NULL == (file->recovery_file_name = H5MM_malloc(sizeof(char) * (HDstrlen(name_onion) + 10))))
|
||||
if (NULL == (file->recovery_file_name = H5MM_malloc(sizeof(char) * (strlen(name_onion) + 10))))
|
||||
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate recovery name string");
|
||||
HDsnprintf(file->recovery_file_name, HDstrlen(name_onion) + 10, "%s.recovery", name_onion);
|
||||
snprintf(file->recovery_file_name, strlen(name_onion) + 10, "%s.recovery", name_onion);
|
||||
|
||||
/* Translate H5P_DEFAULT to a real fapl ID, if necessary */
|
||||
backing_fapl_id = H5FD__onion_get_legit_fapl_id(file->fa.backing_fapl_id);
|
||||
@@ -1191,7 +1191,7 @@ H5FD__onion_open(const char *filename, unsigned flags, hid_t fapl_id, haddr_t ma
|
||||
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to duplicate comment string");
|
||||
|
||||
/* TODO: Lengths of strings should be size_t */
|
||||
file->curr_rev_record.comment_size = (uint32_t)HDstrlen(fa->comment) + 1;
|
||||
file->curr_rev_record.comment_size = (uint32_t)strlen(fa->comment) + 1;
|
||||
}
|
||||
file->origin_eof = file->header.origin_eof;
|
||||
file->logical_eof = MAX(file->curr_rev_record.logical_eof, file->logical_eof);
|
||||
@@ -1670,7 +1670,7 @@ H5FDonion_get_revision_count(const char *filename, hid_t fapl_id, uint64_t *revi
|
||||
H5TRACE3("e", "*six", filename, fapl_id, revision_count);
|
||||
|
||||
/* Check args */
|
||||
if (!filename || !HDstrcmp(filename, ""))
|
||||
if (!filename || !strcmp(filename, ""))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a valid file name");
|
||||
if (!revision_count)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "revision count can't be null");
|
||||
|
||||
@@ -134,7 +134,7 @@ H5FD__onion_header_decode(unsigned char *buf, H5FD_onion_header_t *header)
|
||||
assert(header != NULL);
|
||||
assert(H5FD_ONION_HEADER_VERSION_CURR == header->version);
|
||||
|
||||
if (HDstrncmp((const char *)buf, H5FD_ONION_HEADER_SIGNATURE, 4))
|
||||
if (strncmp((const char *)buf, H5FD_ONION_HEADER_SIGNATURE, 4))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid header signature");
|
||||
|
||||
if (buf[4] != H5FD_ONION_HEADER_VERSION_CURR)
|
||||
|
||||
@@ -172,7 +172,7 @@ H5FD__onion_history_decode(unsigned char *buf, H5FD_onion_history_t *history)
|
||||
assert(history != NULL);
|
||||
assert(H5FD_ONION_HISTORY_VERSION_CURR == history->version);
|
||||
|
||||
if (HDstrncmp((const char *)buf, H5FD_ONION_HISTORY_SIGNATURE, 4))
|
||||
if (strncmp((const char *)buf, H5FD_ONION_HISTORY_SIGNATURE, 4))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid signature");
|
||||
|
||||
if (H5FD_ONION_HISTORY_VERSION_CURR != buf[4])
|
||||
|
||||
@@ -604,7 +604,7 @@ H5FD__onion_revision_record_decode(unsigned char *buf, H5FD_onion_revision_recor
|
||||
assert(H5FD_ONION_REVISION_RECORD_VERSION_CURR == record->version);
|
||||
assert(H5FD_ONION_ARCHIVAL_INDEX_VERSION_CURR == record->archival_index.version);
|
||||
|
||||
if (HDstrncmp((const char *)buf, H5FD_ONION_REVISION_RECORD_SIGNATURE, 4))
|
||||
if (strncmp((const char *)buf, H5FD_ONION_REVISION_RECORD_SIGNATURE, 4))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, 0, "invalid signature");
|
||||
|
||||
if (H5FD_ONION_REVISION_RECORD_VERSION_CURR != buf[4])
|
||||
|
||||
+14
-14
@@ -623,7 +623,7 @@ H5Pget_fapl_ros3_token(hid_t fapl_id, size_t size, char *token_dst /*out*/)
|
||||
}
|
||||
|
||||
/* Copy the token data out */
|
||||
tokenlen = HDstrlen(token_src);
|
||||
tokenlen = strlen(token_src);
|
||||
if (size <= tokenlen) {
|
||||
tokenlen = size - 1;
|
||||
}
|
||||
@@ -659,7 +659,7 @@ H5FD__ros3_str_token_copy(const char H5_ATTR_UNUSED *name, size_t H5_ATTR_UNUSED
|
||||
#endif
|
||||
|
||||
if (*value)
|
||||
if (NULL == (*value = HDstrdup(*value)))
|
||||
if (NULL == (*value = strdup(*value)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't copy string property token");
|
||||
|
||||
done:
|
||||
@@ -691,7 +691,7 @@ H5FD__ros3_str_token_cmp(const void *_value1, const void *_value2, size_t H5_ATT
|
||||
|
||||
if (*value1) {
|
||||
if (*value2)
|
||||
ret_value = HDstrcmp(*value1, *value2);
|
||||
ret_value = strcmp(*value1, *value2);
|
||||
else
|
||||
ret_value = 1;
|
||||
}
|
||||
@@ -798,7 +798,7 @@ H5Pset_fapl_ros3_token(hid_t fapl_id, const char *token)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a file access property list");
|
||||
if (H5FD_ROS3 != H5P_peek_driver(plist))
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "incorrect VFL driver");
|
||||
if (HDstrlen(token) > H5FD_ROS3_MAX_SECRET_TOK_LEN)
|
||||
if (strlen(token) > H5FD_ROS3_MAX_SECRET_TOK_LEN)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL,
|
||||
"specified token exceeds the internally specified maximum string length");
|
||||
|
||||
@@ -809,13 +809,13 @@ H5Pset_fapl_ros3_token(hid_t fapl_id, const char *token)
|
||||
if (H5P_get(plist, ROS3_TOKEN_PROP_NAME, &token_src) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get token value");
|
||||
|
||||
H5MM_memcpy(token_src, token, HDstrlen(token) + 1);
|
||||
H5MM_memcpy(token_src, token, strlen(token) + 1);
|
||||
}
|
||||
else {
|
||||
token_src = (char *)malloc(sizeof(char) * (H5FD_ROS3_MAX_SECRET_TOK_LEN + 1));
|
||||
if (token_src == NULL)
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for token_src variable.");
|
||||
H5MM_memcpy(token_src, token, HDstrlen(token) + 1);
|
||||
H5MM_memcpy(token_src, token, strlen(token) + 1);
|
||||
if (H5P_insert(plist, ROS3_TOKEN_PROP_NAME, sizeof(char *), &token_src, NULL, NULL, NULL, NULL,
|
||||
H5FD__ros3_str_token_delete, H5FD__ros3_str_token_copy, H5FD__ros3_str_token_cmp,
|
||||
H5FD__ros3_str_token_close) < 0)
|
||||
@@ -1398,16 +1398,16 @@ H5FD__ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
|
||||
assert(purl2->host != NULL);
|
||||
|
||||
/* URL: SCHEME */
|
||||
if (HDstrcmp(purl1->scheme, purl2->scheme))
|
||||
if (strcmp(purl1->scheme, purl2->scheme))
|
||||
HGOTO_DONE(-1);
|
||||
|
||||
/* URL: HOST */
|
||||
if (HDstrcmp(purl1->host, purl2->host))
|
||||
if (strcmp(purl1->host, purl2->host))
|
||||
HGOTO_DONE(-1);
|
||||
|
||||
/* URL: PORT */
|
||||
if (purl1->port && purl2->port) {
|
||||
if (HDstrcmp(purl1->port, purl2->port))
|
||||
if (strcmp(purl1->port, purl2->port))
|
||||
HGOTO_DONE(-1);
|
||||
}
|
||||
else if (purl1->port)
|
||||
@@ -1417,7 +1417,7 @@ H5FD__ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
|
||||
|
||||
/* URL: PATH */
|
||||
if (purl1->path && purl2->path) {
|
||||
if (HDstrcmp(purl1->path, purl2->path))
|
||||
if (strcmp(purl1->path, purl2->path))
|
||||
HGOTO_DONE(-1);
|
||||
}
|
||||
else if (purl1->path && !purl2->path)
|
||||
@@ -1427,7 +1427,7 @@ H5FD__ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
|
||||
|
||||
/* URL: QUERY */
|
||||
if (purl1->query && purl2->query) {
|
||||
if (HDstrcmp(purl1->query, purl2->query))
|
||||
if (strcmp(purl1->query, purl2->query))
|
||||
HGOTO_DONE(-1);
|
||||
}
|
||||
else if (purl1->query && !purl2->query)
|
||||
@@ -1437,7 +1437,7 @@ H5FD__ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
|
||||
|
||||
/* FAPL: AWS_REGION */
|
||||
if (f1->fa.aws_region[0] != '\0' && f2->fa.aws_region[0] != '\0') {
|
||||
if (HDstrcmp(f1->fa.aws_region, f2->fa.aws_region))
|
||||
if (strcmp(f1->fa.aws_region, f2->fa.aws_region))
|
||||
HGOTO_DONE(-1);
|
||||
}
|
||||
else if (f1->fa.aws_region[0] != '\0')
|
||||
@@ -1447,7 +1447,7 @@ H5FD__ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
|
||||
|
||||
/* FAPL: SECRET_ID */
|
||||
if (f1->fa.secret_id[0] != '\0' && f2->fa.secret_id[0] != '\0') {
|
||||
if (HDstrcmp(f1->fa.secret_id, f2->fa.secret_id))
|
||||
if (strcmp(f1->fa.secret_id, f2->fa.secret_id))
|
||||
HGOTO_DONE(-1);
|
||||
}
|
||||
else if (f1->fa.secret_id[0] != '\0')
|
||||
@@ -1457,7 +1457,7 @@ H5FD__ros3_cmp(const H5FD_t *_f1, const H5FD_t *_f2)
|
||||
|
||||
/* FAPL: SECRET_KEY */
|
||||
if (f1->fa.secret_key[0] != '\0' && f2->fa.secret_key[0] != '\0') {
|
||||
if (HDstrcmp(f1->fa.secret_key, f2->fa.secret_key))
|
||||
if (strcmp(f1->fa.secret_key, f2->fa.secret_key))
|
||||
HGOTO_DONE(-1);
|
||||
}
|
||||
else if (f1->fa.secret_key[0] != '\0')
|
||||
|
||||
+82
-82
@@ -227,7 +227,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
|
||||
|
||||
if (name == NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to operate on null name");
|
||||
namelen = HDstrlen(name);
|
||||
namelen = strlen(name);
|
||||
|
||||
/***********************
|
||||
* PREPARE ALL STRINGS *
|
||||
@@ -248,7 +248,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
|
||||
*/
|
||||
if (value != NULL) {
|
||||
int ret = 0;
|
||||
size_t valuelen = HDstrlen(value);
|
||||
size_t valuelen = strlen(value);
|
||||
size_t catlen = namelen + valuelen + 2; /* +2 from ": " */
|
||||
size_t catwrite = catlen + 3; /* 3 not 1 to quiet compiler warning */
|
||||
|
||||
@@ -265,10 +265,10 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
|
||||
nvcat = (char *)H5MM_malloc(sizeof(char) * catwrite);
|
||||
if (nvcat == NULL)
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "cannot make space for concatenated string.");
|
||||
ret = HDsnprintf(nvcat, catwrite, "%s: %s", name, value);
|
||||
ret = snprintf(nvcat, catwrite, "%s: %s", name, value);
|
||||
if (ret < 0 || (size_t)ret > catlen)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot concatenate `%s: %s", name, value);
|
||||
assert(catlen == HDstrlen(nvcat));
|
||||
assert(catlen == strlen(nvcat));
|
||||
|
||||
/* create new_node, should we need it
|
||||
*/
|
||||
@@ -318,7 +318,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
|
||||
|
||||
/* Check whether to modify/remove first node in list
|
||||
*/
|
||||
if (HDstrcmp(lowername, node_ptr->lowername) == 0) {
|
||||
if (strcmp(lowername, node_ptr->lowername) == 0) {
|
||||
|
||||
is_looking = false;
|
||||
|
||||
@@ -396,7 +396,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
|
||||
new_node = NULL;
|
||||
}
|
||||
}
|
||||
else if (HDstrcmp(lowername, node_ptr->lowername) < 0) {
|
||||
else if (strcmp(lowername, node_ptr->lowername) < 0) {
|
||||
|
||||
is_looking = false;
|
||||
|
||||
@@ -440,7 +440,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
|
||||
* APPEND NEW NODE *
|
||||
*******************/
|
||||
|
||||
assert(HDstrcmp(lowername, node_ptr->lowername) > 0);
|
||||
assert(strcmp(lowername, node_ptr->lowername) > 0);
|
||||
new_node->name = namecpy;
|
||||
new_node->value = valuecpy;
|
||||
new_node->lowername = lowername;
|
||||
@@ -448,7 +448,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
|
||||
node_ptr->next = new_node;
|
||||
}
|
||||
}
|
||||
else if (HDstrcmp(lowername, node_ptr->next->lowername) < 0) {
|
||||
else if (strcmp(lowername, node_ptr->next->lowername) < 0) {
|
||||
|
||||
is_looking = false;
|
||||
|
||||
@@ -463,7 +463,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
|
||||
* INSERT NEW NODE *
|
||||
*******************/
|
||||
|
||||
assert(HDstrcmp(lowername, node_ptr->lowername) > 0);
|
||||
assert(strcmp(lowername, node_ptr->lowername) > 0);
|
||||
new_node->name = namecpy;
|
||||
new_node->value = valuecpy;
|
||||
new_node->lowername = lowername;
|
||||
@@ -472,7 +472,7 @@ H5FD_s3comms_hrb_node_set(hrb_node_t **L, const char *name, const char *value)
|
||||
node_ptr->next = new_node;
|
||||
}
|
||||
}
|
||||
else if (HDstrcmp(lowername, node_ptr->next->lowername) == 0) {
|
||||
else if (strcmp(lowername, node_ptr->next->lowername) == 0) {
|
||||
|
||||
is_looking = false;
|
||||
|
||||
@@ -681,7 +681,7 @@ H5FD_s3comms_hrb_init_request(const char *_verb, const char *_resource, const ch
|
||||
request->first_header = NULL;
|
||||
|
||||
/* malloc and copy strings for the structure */
|
||||
reslen = HDstrlen(_resource);
|
||||
reslen = strlen(_resource);
|
||||
|
||||
if (_resource[0] == '/') {
|
||||
res = (char *)H5MM_malloc(sizeof(char) * (reslen + 1));
|
||||
@@ -695,20 +695,20 @@ H5FD_s3comms_hrb_init_request(const char *_verb, const char *_resource, const ch
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, NULL, "no space for resource string");
|
||||
*res = '/';
|
||||
H5MM_memcpy((&res[1]), _resource, (reslen + 1));
|
||||
assert((reslen + 1) == HDstrlen(res));
|
||||
assert((reslen + 1) == strlen(res));
|
||||
} /* end if (else resource string not starting with '/') */
|
||||
|
||||
verblen = HDstrlen(_verb) + 1;
|
||||
verblen = strlen(_verb) + 1;
|
||||
verb = (char *)H5MM_malloc(sizeof(char) * verblen);
|
||||
if (verb == NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "no space for verb string");
|
||||
HDstrncpy(verb, _verb, verblen);
|
||||
strncpy(verb, _verb, verblen);
|
||||
|
||||
vrsnlen = HDstrlen(_http_version) + 1;
|
||||
vrsnlen = strlen(_http_version) + 1;
|
||||
vrsn = (char *)H5MM_malloc(sizeof(char) * vrsnlen);
|
||||
if (vrsn == NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "no space for http-version string");
|
||||
HDstrncpy(vrsn, _http_version, vrsnlen);
|
||||
strncpy(vrsn, _http_version, vrsnlen);
|
||||
|
||||
/* place new copies into structure */
|
||||
request->resource = res;
|
||||
@@ -925,8 +925,8 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not find \"Content-Length\" in response.");
|
||||
|
||||
/* move "start" to beginning of value in line; find end of line */
|
||||
start = start + HDstrlen("\r\nContent-Length: ");
|
||||
end = HDstrstr(start, "\r\n");
|
||||
start = start + strlen("\r\nContent-Length: ");
|
||||
end = strstr(start, "\r\n");
|
||||
if (end == NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "could not find end of content length line");
|
||||
|
||||
@@ -1059,13 +1059,13 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "token cannot be null.");
|
||||
|
||||
/* copy strings */
|
||||
tmplen = HDstrlen(region) + 1;
|
||||
tmplen = strlen(region) + 1;
|
||||
handle->region = (char *)H5MM_malloc(sizeof(char) * tmplen);
|
||||
if (handle->region == NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle region copy.");
|
||||
H5MM_memcpy(handle->region, region, tmplen);
|
||||
|
||||
tmplen = HDstrlen(id) + 1;
|
||||
tmplen = strlen(id) + 1;
|
||||
handle->secret_id = (char *)H5MM_malloc(sizeof(char) * tmplen);
|
||||
if (handle->secret_id == NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle ID copy.");
|
||||
@@ -1077,7 +1077,7 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle key copy.");
|
||||
H5MM_memcpy(handle->signing_key, signing_key, tmplen);
|
||||
|
||||
tmplen = HDstrlen(token) + 1;
|
||||
tmplen = strlen(token) + 1;
|
||||
handle->token = (char *)H5MM_malloc(sizeof(char) * tmplen);
|
||||
if (handle->token == NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "could not malloc space for handle token copy.");
|
||||
@@ -1203,7 +1203,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
|
||||
char *rangebytesstr = NULL;
|
||||
hrb_t *request = NULL;
|
||||
int ret = 0; /* working variable to check */
|
||||
/* return value of HDsnprintf */
|
||||
/* return value of snprintf */
|
||||
char *authorization = NULL;
|
||||
char *buffer1 = NULL;
|
||||
char *signed_headers = NULL;
|
||||
@@ -1259,8 +1259,8 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
|
||||
rangebytesstr = (char *)H5MM_malloc(sizeof(char) * (S3COMMS_MAX_RANGE_STRING_SIZE + 1));
|
||||
if (rangebytesstr == NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc range format string.");
|
||||
ret = HDsnprintf(rangebytesstr, (S3COMMS_MAX_RANGE_STRING_SIZE), "bytes=%" PRIuHADDR "-%" PRIuHADDR,
|
||||
offset, offset + len - 1);
|
||||
ret = snprintf(rangebytesstr, (S3COMMS_MAX_RANGE_STRING_SIZE), "bytes=%" PRIuHADDR "-%" PRIuHADDR,
|
||||
offset, offset + len - 1);
|
||||
if (ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format HTTP Range value");
|
||||
}
|
||||
@@ -1268,7 +1268,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
|
||||
rangebytesstr = (char *)H5MM_malloc(sizeof(char) * (S3COMMS_MAX_RANGE_STRING_SIZE + 1));
|
||||
if (rangebytesstr == NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "could not malloc range format string.");
|
||||
ret = HDsnprintf(rangebytesstr, (S3COMMS_MAX_RANGE_STRING_SIZE), "bytes=%" PRIuHADDR "-", offset);
|
||||
ret = snprintf(rangebytesstr, (S3COMMS_MAX_RANGE_STRING_SIZE), "bytes=%" PRIuHADDR "-", offset);
|
||||
if (ret <= 0 || ret >= S3COMMS_MAX_RANGE_STRING_SIZE)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format HTTP Range value");
|
||||
}
|
||||
@@ -1288,7 +1288,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
|
||||
/* Pass in range directly */
|
||||
char *bytesrange_ptr = NULL; /* pointer past "bytes=" portion */
|
||||
|
||||
bytesrange_ptr = HDstrchr(rangebytesstr, '=');
|
||||
bytesrange_ptr = strchr(rangebytesstr, '=');
|
||||
assert(bytesrange_ptr != NULL);
|
||||
bytesrange_ptr++; /* move to first char past '=' */
|
||||
assert(*bytesrange_ptr != '\0');
|
||||
@@ -1376,7 +1376,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem building headers list.");
|
||||
assert(headers->magic == S3COMMS_HRB_NODE_MAGIC);
|
||||
|
||||
if (HDstrlen((const char *)handle->token) > 0) {
|
||||
if (strlen((const char *)handle->token) > 0) {
|
||||
if (FAIL ==
|
||||
H5FD_s3comms_hrb_node_set(&headers, "x-amz-security-token", (const char *)handle->token))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to set x-amz-security-token header");
|
||||
@@ -1414,7 +1414,7 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad string-to-sign");
|
||||
/* buffer1 -> signature */
|
||||
if (FAIL == H5FD_s3comms_HMAC_SHA256(handle->signing_key, SHA256_DIGEST_LENGTH, buffer2,
|
||||
HDstrlen(buffer2), buffer1))
|
||||
strlen(buffer2), buffer1))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad signature");
|
||||
|
||||
iso8601now[8] = 0; /* trim to yyyyMMDD */
|
||||
@@ -1422,9 +1422,9 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
|
||||
if (ret == 0 || ret >= S3COMMS_MAX_CREDENTIAL_SIZE)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format aws4 credential string");
|
||||
|
||||
ret = HDsnprintf(authorization, 512 + H5FD_ROS3_MAX_SECRET_TOK_LEN,
|
||||
"AWS4-HMAC-SHA256 Credential=%s,SignedHeaders=%s,Signature=%s", buffer2,
|
||||
signed_headers, buffer1);
|
||||
ret = snprintf(authorization, 512 + H5FD_ROS3_MAX_SECRET_TOK_LEN,
|
||||
"AWS4-HMAC-SHA256 Credential=%s,SignedHeaders=%s,Signature=%s", buffer2,
|
||||
signed_headers, buffer1);
|
||||
if (ret <= 0 || ret >= 512 + H5FD_ROS3_MAX_SECRET_TOK_LEN)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to format aws4 authorization string");
|
||||
|
||||
@@ -1674,14 +1674,14 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "signed headers destination cannot be null.");
|
||||
|
||||
/* HTTP verb, resource path, and query string lines */
|
||||
cr_len = (HDstrlen(http_request->verb) + HDstrlen(http_request->resource) + HDstrlen(query_params) +
|
||||
cr_len = (strlen(http_request->verb) + strlen(http_request->resource) + strlen(query_params) +
|
||||
(size_t)3); /* three newline chars */
|
||||
if (cr_len >= cr_size)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not enough space in canonical request");
|
||||
|
||||
/* TODO: compiler warning */
|
||||
ret = HDsnprintf(canonical_request_dest, (cr_size - 1), "%s\n%s\n%s\n", http_request->verb,
|
||||
http_request->resource, query_params);
|
||||
ret = snprintf(canonical_request_dest, (cr_size - 1), "%s\n%s\n%s\n", http_request->verb,
|
||||
http_request->resource, query_params);
|
||||
if (ret < 0 || (size_t)ret >= cr_size)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to compose canonical request first line");
|
||||
|
||||
@@ -1691,38 +1691,38 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c
|
||||
|
||||
assert(node->magic == S3COMMS_HRB_NODE_MAGIC);
|
||||
|
||||
ret = HDsnprintf(tmpstr, 1024, "%s:%s\n", node->lowername, node->value);
|
||||
ret = snprintf(tmpstr, 1024, "%s:%s\n", node->lowername, node->value);
|
||||
if (ret < 0 || ret >= 1024)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to concatenate HTTP header %s:%s",
|
||||
node->lowername, node->value);
|
||||
cr_len += HDstrlen(tmpstr);
|
||||
cr_len += strlen(tmpstr);
|
||||
if (cr_len + 1 > cr_size)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not enough space in canonical request");
|
||||
HDstrcat(canonical_request_dest, tmpstr);
|
||||
strcat(canonical_request_dest, tmpstr);
|
||||
|
||||
ret = HDsnprintf(tmpstr, 1024, "%s;", node->lowername);
|
||||
ret = snprintf(tmpstr, 1024, "%s;", node->lowername);
|
||||
if (ret < 0 || ret >= 1024)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to append semicolon to lowername %s",
|
||||
node->lowername);
|
||||
sh_len += HDstrlen(tmpstr);
|
||||
sh_len += strlen(tmpstr);
|
||||
if (sh_len + 1 > sh_size)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not enough space in signed headers");
|
||||
HDstrcat(signed_headers_dest, tmpstr);
|
||||
strcat(signed_headers_dest, tmpstr);
|
||||
|
||||
node = node->next;
|
||||
} /* end while node is not NULL */
|
||||
|
||||
/* remove trailing ';' from signed headers sequence */
|
||||
signed_headers_dest[HDstrlen(signed_headers_dest) - 1] = '\0';
|
||||
signed_headers_dest[strlen(signed_headers_dest) - 1] = '\0';
|
||||
|
||||
/* append signed headers and payload hash
|
||||
* NOTE: at present, no HTTP body is handled, per the nature of
|
||||
* requests/range-gets
|
||||
*/
|
||||
HDstrcat(canonical_request_dest, "\n");
|
||||
HDstrcat(canonical_request_dest, signed_headers_dest);
|
||||
HDstrcat(canonical_request_dest, "\n");
|
||||
HDstrcat(canonical_request_dest, EMPTY_SHA256);
|
||||
strcat(canonical_request_dest, "\n");
|
||||
strcat(canonical_request_dest, signed_headers_dest);
|
||||
strcat(canonical_request_dest, "\n");
|
||||
strcat(canonical_request_dest, EMPTY_SHA256);
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@@ -1774,8 +1774,8 @@ H5FD_s3comms_bytes_to_hex(char *dest, const unsigned char *msg, size_t msg_len,
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bytes sequence cannot be null.");
|
||||
|
||||
for (i = 0; i < msg_len; i++) {
|
||||
int chars_written = HDsnprintf(&(dest[i * 2]), 3, /* 'X', 'X', '\n' */
|
||||
(lowercase == true) ? "%02x" : "%02X", msg[i]);
|
||||
int chars_written = snprintf(&(dest[i * 2]), 3, /* 'X', 'X', '\n' */
|
||||
(lowercase == true) ? "%02x" : "%02X", msg[i]);
|
||||
if (chars_written != 2)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem while writing hex chars for %c", msg[i]);
|
||||
}
|
||||
@@ -1957,7 +1957,7 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha
|
||||
#endif
|
||||
|
||||
/* format target line for start of profile */
|
||||
if (32 < HDsnprintf(profile_line, 32, "[%s]", profile_name))
|
||||
if (32 < snprintf(profile_line, 32, "[%s]", profile_name))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format profile label");
|
||||
|
||||
/* look for start of profile */
|
||||
@@ -1966,10 +1966,10 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha
|
||||
for (buffer_i = 0; buffer_i < 128; buffer_i++)
|
||||
buffer[buffer_i] = 0;
|
||||
|
||||
line_buffer = HDfgets(line_buffer, 128, file);
|
||||
line_buffer = fgets(line_buffer, 128, file);
|
||||
if (line_buffer == NULL) /* reached end of file */
|
||||
goto done;
|
||||
} while (HDstrncmp(line_buffer, profile_line, HDstrlen(profile_line)));
|
||||
} while (strncmp(line_buffer, profile_line, strlen(profile_line)));
|
||||
|
||||
/* extract credentials from lines */
|
||||
do {
|
||||
@@ -1978,7 +1978,7 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha
|
||||
buffer[buffer_i] = 0;
|
||||
|
||||
/* collect a line from file */
|
||||
line_buffer = HDfgets(line_buffer, 128, file);
|
||||
line_buffer = fgets(line_buffer, 128, file);
|
||||
if (line_buffer == NULL)
|
||||
goto done; /* end of file */
|
||||
|
||||
@@ -1989,12 +1989,12 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha
|
||||
char line_prefix[128];
|
||||
|
||||
setting_name = setting_names[setting_i];
|
||||
setting_name_len = HDstrlen(setting_name);
|
||||
if (HDsnprintf(line_prefix, 128, "%s=", setting_name) < 0)
|
||||
setting_name_len = strlen(setting_name);
|
||||
if (snprintf(line_prefix, 128, "%s=", setting_name) < 0)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format line prefix");
|
||||
|
||||
/* found a matching name? */
|
||||
if (!HDstrncmp(line_buffer, line_prefix, setting_name_len + 1)) {
|
||||
if (!strncmp(line_buffer, line_prefix, setting_name_len + 1)) {
|
||||
found_setting = 1;
|
||||
|
||||
/* skip NULL destination buffer */
|
||||
@@ -2011,7 +2011,7 @@ H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, cha
|
||||
line_buffer++; /* was pointing at '='; advance */
|
||||
|
||||
/* copy line buffer into out pointer */
|
||||
HDstrncpy(setting_pointers[setting_i], (const char *)line_buffer, HDstrlen(line_buffer));
|
||||
strncpy(setting_pointers[setting_i], (const char *)line_buffer, strlen(line_buffer));
|
||||
|
||||
/* "trim" tailing whitespace by replacing with null terminator*/
|
||||
buffer_i = 0;
|
||||
@@ -2074,13 +2074,13 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char *
|
||||
#endif
|
||||
|
||||
#ifdef H5_HAVE_WIN32_API
|
||||
ret = HDsnprintf(awspath, 117, "%s/.aws/", HDgetenv("USERPROFILE"));
|
||||
ret = snprintf(awspath, 117, "%s/.aws/", HDgetenv("USERPROFILE"));
|
||||
#else
|
||||
ret = HDsnprintf(awspath, 117, "%s/.aws/", HDgetenv("HOME"));
|
||||
ret = snprintf(awspath, 117, "%s/.aws/", HDgetenv("HOME"));
|
||||
#endif
|
||||
if (ret < 0 || (size_t)ret >= 117)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format home-aws path");
|
||||
ret = HDsnprintf(filepath, 128, "%s%s", awspath, "credentials");
|
||||
ret = snprintf(filepath, 128, "%s%s", awspath, "credentials");
|
||||
if (ret < 0 || (size_t)ret >= 128)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format credentials path");
|
||||
|
||||
@@ -2094,7 +2094,7 @@ H5FD_s3comms_load_aws_profile(const char *profile_name, char *key_id_out, char *
|
||||
credfile = NULL;
|
||||
} /* end if credential file opened */
|
||||
|
||||
ret = HDsnprintf(filepath, 128, "%s%s", awspath, "config");
|
||||
ret = snprintf(filepath, 128, "%s%s", awspath, "config");
|
||||
if (ret < 0 || (size_t)ret >= 128)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_CANTCOPY, FAIL, "unable to format config path");
|
||||
credfile = fopen(filepath, "r");
|
||||
@@ -2218,7 +2218,7 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl)
|
||||
if (str == NULL || *str == '\0')
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid url string");
|
||||
|
||||
urllen = (long int)HDstrlen(str);
|
||||
urllen = (long int)strlen(str);
|
||||
|
||||
purl = (parsed_url_t *)H5MM_malloc(sizeof(parsed_url_t));
|
||||
if (purl == NULL)
|
||||
@@ -2234,7 +2234,7 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl)
|
||||
* READ SCHEME *
|
||||
***************/
|
||||
|
||||
tmpstr = HDstrchr(curstr, ':');
|
||||
tmpstr = strchr(curstr, ':');
|
||||
if (tmpstr == NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid SCHEME construction: probably not URL");
|
||||
len = tmpstr - curstr;
|
||||
@@ -2251,7 +2251,7 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl)
|
||||
purl->scheme = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1));
|
||||
if (purl->scheme == NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for SCHEME");
|
||||
HDstrncpy(purl->scheme, curstr, (size_t)len);
|
||||
strncpy(purl->scheme, curstr, (size_t)len);
|
||||
purl->scheme[len] = '\0';
|
||||
for (i = 0; i < len; i++)
|
||||
purl->scheme[i] = (char)HDtolower(purl->scheme[i]);
|
||||
@@ -2291,7 +2291,7 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl)
|
||||
purl->host = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1));
|
||||
if (purl->host == NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for HOST");
|
||||
HDstrncpy(purl->host, curstr, (size_t)len);
|
||||
strncpy(purl->host, curstr, (size_t)len);
|
||||
purl->host[len] = 0;
|
||||
|
||||
/*************
|
||||
@@ -2316,7 +2316,7 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl)
|
||||
purl->port = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1));
|
||||
if (purl->port == NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for PORT");
|
||||
HDstrncpy(purl->port, curstr, (size_t)len);
|
||||
strncpy(purl->port, curstr, (size_t)len);
|
||||
purl->port[len] = 0;
|
||||
} /* end if PORT element */
|
||||
|
||||
@@ -2339,7 +2339,7 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl)
|
||||
purl->path = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1));
|
||||
if (purl->path == NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for PATH");
|
||||
HDstrncpy(purl->path, curstr, (size_t)len);
|
||||
strncpy(purl->path, curstr, (size_t)len);
|
||||
purl->path[len] = 0;
|
||||
}
|
||||
} /* end if PATH element */
|
||||
@@ -2361,7 +2361,7 @@ H5FD_s3comms_parse_url(const char *str, parsed_url_t **_purl)
|
||||
purl->query = (char *)H5MM_malloc(sizeof(char) * (size_t)(len + 1));
|
||||
if (purl->query == NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_CANTALLOC, FAIL, "can't allocate space for QUERY");
|
||||
HDstrncpy(purl->query, curstr, (size_t)len);
|
||||
strncpy(purl->query, curstr, (size_t)len);
|
||||
purl->query[len] = 0;
|
||||
} /* end if QUERY exists */
|
||||
|
||||
@@ -2446,7 +2446,7 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr
|
||||
fprintf(stdout, " SINGLE-BYTE\n");
|
||||
#endif
|
||||
*repr_len = 3;
|
||||
chars_written = HDsnprintf(repr, 4, "%%%02X", c);
|
||||
chars_written = snprintf(repr, 4, "%%%02X", c);
|
||||
if (chars_written < 0)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot write char %c", c);
|
||||
} /* end if single-byte unicode char */
|
||||
@@ -2497,7 +2497,7 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr
|
||||
acc += (stack_size > 2) ? 0x20 : 0; /* 0x00100000 */
|
||||
acc += (stack_size > 3) ? 0x10 : 0; /* 0x00010000 */
|
||||
stack_size--;
|
||||
chars_written = HDsnprintf(repr, 4, "%%%02X", (unsigned char)(acc + stack[stack_size]));
|
||||
chars_written = snprintf(repr, 4, "%%%02X", (unsigned char)(acc + stack[stack_size]));
|
||||
if (chars_written < 0)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot write char %c", c);
|
||||
*repr_len += 3;
|
||||
@@ -2509,7 +2509,7 @@ H5FD_s3comms_percent_encode_char(char *repr, const unsigned char c, size_t *repr
|
||||
/* 10xxxxxx */
|
||||
for (i = 0; i < stack_size; i++) {
|
||||
chars_written =
|
||||
HDsnprintf(&repr[i * 3 + 3], 4, "%%%02X", (unsigned char)(0x80 + stack[stack_size - 1 - i]));
|
||||
snprintf(&repr[i * 3 + 3], 4, "%%%02X", (unsigned char)(0x80 + stack[stack_size - 1 - i]));
|
||||
if (chars_written < 0)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cannot write char %c", c);
|
||||
*repr_len += 3;
|
||||
@@ -2565,7 +2565,7 @@ H5FD_s3comms_signing_key(unsigned char *md, const char *secret, const char *regi
|
||||
unsigned char datekey[SHA256_DIGEST_LENGTH];
|
||||
unsigned char dateregionkey[SHA256_DIGEST_LENGTH];
|
||||
unsigned char dateregionservicekey[SHA256_DIGEST_LENGTH];
|
||||
int ret = 0; /* return value of HDsnprintf */
|
||||
int ret = 0; /* return value of snprintf */
|
||||
herr_t ret_value = SUCCEED;
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT
|
||||
@@ -2583,24 +2583,24 @@ H5FD_s3comms_signing_key(unsigned char *md, const char *secret, const char *regi
|
||||
if (iso8601now == NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`iso8601now` cannot be NULL.");
|
||||
|
||||
AWS4_secret_len = 4 + HDstrlen(secret) + 1;
|
||||
AWS4_secret_len = 4 + strlen(secret) + 1;
|
||||
AWS4_secret = (char *)H5MM_malloc(sizeof(char *) * AWS4_secret_len);
|
||||
if (AWS4_secret == NULL)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Could not allocate space.");
|
||||
|
||||
/* prepend "AWS4" to start of the secret key */
|
||||
ret = HDsnprintf(AWS4_secret, AWS4_secret_len, "%s%s", "AWS4", secret);
|
||||
ret = snprintf(AWS4_secret, AWS4_secret_len, "%s%s", "AWS4", secret);
|
||||
if ((size_t)ret != (AWS4_secret_len - 1))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem writing AWS4+secret `%s`", secret);
|
||||
|
||||
/* hash_func, key, len(key), msg, len(msg), digest_dest, digest_len_dest
|
||||
* we know digest length, so ignore via NULL
|
||||
*/
|
||||
HMAC(EVP_sha256(), (const unsigned char *)AWS4_secret, (int)HDstrlen(AWS4_secret),
|
||||
HMAC(EVP_sha256(), (const unsigned char *)AWS4_secret, (int)strlen(AWS4_secret),
|
||||
(const unsigned char *)iso8601now, 8, /* 8 --> length of 8 --> "yyyyMMDD" */
|
||||
datekey, NULL);
|
||||
HMAC(EVP_sha256(), (const unsigned char *)datekey, SHA256_DIGEST_LENGTH, (const unsigned char *)region,
|
||||
HDstrlen(region), dateregionkey, NULL);
|
||||
strlen(region), dateregionkey, NULL);
|
||||
HMAC(EVP_sha256(), (const unsigned char *)dateregionkey, SHA256_DIGEST_LENGTH,
|
||||
(const unsigned char *)"s3", 2, dateregionservicekey, NULL);
|
||||
HMAC(EVP_sha256(), (const unsigned char *)dateregionservicekey, SHA256_DIGEST_LENGTH,
|
||||
@@ -2653,7 +2653,7 @@ H5FD_s3comms_tostringtosign(char *dest, const char *req, const char *now, const
|
||||
char day[9];
|
||||
char hexsum[SHA256_DIGEST_LENGTH * 2 + 1];
|
||||
size_t i = 0;
|
||||
int ret = 0; /* HDsnprintf return value */
|
||||
int ret = 0; /* snprintf return value */
|
||||
herr_t ret_value = SUCCEED;
|
||||
char tmp[128];
|
||||
|
||||
@@ -2678,24 +2678,24 @@ H5FD_s3comms_tostringtosign(char *dest, const char *req, const char *now, const
|
||||
checksum[i] = '\0';
|
||||
hexsum[i] = '\0';
|
||||
}
|
||||
HDstrncpy(day, now, 8);
|
||||
strncpy(day, now, 8);
|
||||
day[8] = '\0';
|
||||
ret = HDsnprintf(tmp, 127, "%s/%s/s3/aws4_request", day, region);
|
||||
ret = snprintf(tmp, 127, "%s/%s/s3/aws4_request", day, region);
|
||||
if (ret <= 0 || ret >= 127)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "problem adding day and region to string");
|
||||
|
||||
H5MM_memcpy((dest + d), "AWS4-HMAC-SHA256\n", 17);
|
||||
d = 17;
|
||||
|
||||
H5MM_memcpy((dest + d), now, HDstrlen(now));
|
||||
d += HDstrlen(now);
|
||||
H5MM_memcpy((dest + d), now, strlen(now));
|
||||
d += strlen(now);
|
||||
dest[d++] = '\n';
|
||||
|
||||
H5MM_memcpy((dest + d), tmp, HDstrlen(tmp));
|
||||
d += HDstrlen(tmp);
|
||||
H5MM_memcpy((dest + d), tmp, strlen(tmp));
|
||||
d += strlen(tmp);
|
||||
dest[d++] = '\n';
|
||||
|
||||
SHA256((const unsigned char *)req, HDstrlen(req), checksum);
|
||||
SHA256((const unsigned char *)req, strlen(req), checksum);
|
||||
|
||||
if (H5FD_s3comms_bytes_to_hex(hexsum, (const unsigned char *)checksum, SHA256_DIGEST_LENGTH, true) ==
|
||||
FAIL)
|
||||
|
||||
+3
-3
@@ -130,7 +130,7 @@
|
||||
*
|
||||
* Format "S3 Credential" string from inputs, for AWS4.
|
||||
*
|
||||
* Wrapper for HDsnprintf().
|
||||
* Wrapper for snprintf().
|
||||
*
|
||||
* _HAS NO ERROR-CHECKING FACILITIES_
|
||||
* It is left to programmer to ensure that return value confers success.
|
||||
@@ -153,8 +153,8 @@
|
||||
*---------------------------------------------------------------------------
|
||||
*/
|
||||
#define S3COMMS_FORMAT_CREDENTIAL(dest, access, iso8601_date, region, service) \
|
||||
HDsnprintf((dest), S3COMMS_MAX_CREDENTIAL_SIZE, "%s/%s/%s/%s/aws4_request", (access), (iso8601_date), \
|
||||
(region), (service))
|
||||
snprintf((dest), S3COMMS_MAX_CREDENTIAL_SIZE, "%s/%s/%s/%s/aws4_request", (access), (iso8601_date), \
|
||||
(region), (service))
|
||||
|
||||
/*********************
|
||||
* PUBLIC STRUCTURES *
|
||||
|
||||
+6
-6
@@ -205,9 +205,9 @@ H5FD_sec2_init(void)
|
||||
|
||||
/* Check the use disabled file locks environment variable */
|
||||
lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING);
|
||||
if (lock_env_var && !HDstrcmp(lock_env_var, "BEST_EFFORT"))
|
||||
if (lock_env_var && !strcmp(lock_env_var, "BEST_EFFORT"))
|
||||
ignore_disabled_file_locks_s = true; /* Override: Ignore disabled locks */
|
||||
else if (lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "1")))
|
||||
else if (lock_env_var && (!strcmp(lock_env_var, "TRUE") || !strcmp(lock_env_var, "1")))
|
||||
ignore_disabled_file_locks_s = false; /* Override: Don't ignore disabled locks */
|
||||
else
|
||||
ignore_disabled_file_locks_s = FAIL; /* Environment variable not set, or not set correctly */
|
||||
@@ -323,7 +323,7 @@ H5FD__sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
|
||||
HGOTO_ERROR(
|
||||
H5E_FILE, H5E_CANTOPENFILE, NULL,
|
||||
"unable to open file: name = '%s', errno = %d, error message = '%s', flags = %x, o_flags = %x",
|
||||
name, myerrno, HDstrerror(myerrno), flags, (unsigned)o_flags);
|
||||
name, myerrno, strerror(myerrno), flags, (unsigned)o_flags);
|
||||
} /* end if */
|
||||
|
||||
if (HDfstat(fd, &sb) < 0)
|
||||
@@ -368,7 +368,7 @@ H5FD__sec2_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr
|
||||
}
|
||||
|
||||
/* Retain a copy of the name used to open the file, for possible error reporting */
|
||||
HDstrncpy(file->filename, name, sizeof(file->filename));
|
||||
strncpy(file->filename, name, sizeof(file->filename));
|
||||
file->filename[sizeof(file->filename) - 1] = '\0';
|
||||
|
||||
/* Check for non-default FAPL */
|
||||
@@ -703,7 +703,7 @@ H5FD__sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU
|
||||
"file read failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, "
|
||||
"error message = '%s', buf = %p, total read size = %llu, bytes this sub-read = %llu, "
|
||||
"bytes actually read = %llu, offset = %llu",
|
||||
HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf,
|
||||
HDctime(&mytime), file->filename, file->fd, myerrno, strerror(myerrno), buf,
|
||||
(unsigned long long)size, (unsigned long long)bytes_in,
|
||||
(unsigned long long)bytes_read, (unsigned long long)offset);
|
||||
} /* end if */
|
||||
@@ -809,7 +809,7 @@ H5FD__sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN
|
||||
"file write failed: time = %s, filename = '%s', file descriptor = %d, errno = %d, "
|
||||
"error message = '%s', buf = %p, total write size = %llu, bytes this sub-write = "
|
||||
"%llu, bytes actually written = %llu, offset = %llu",
|
||||
HDctime(&mytime), file->filename, file->fd, myerrno, HDstrerror(myerrno), buf,
|
||||
HDctime(&mytime), file->filename, file->fd, myerrno, strerror(myerrno), buf,
|
||||
(unsigned long long)size, (unsigned long long)bytes_in,
|
||||
(unsigned long long)bytes_wrote, (unsigned long long)offset);
|
||||
} /* end if */
|
||||
|
||||
+21
-21
@@ -367,8 +367,8 @@ H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config /*out*/)
|
||||
fapl_ptr = default_fapl;
|
||||
}
|
||||
|
||||
HDstrncpy(config->wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX + 1);
|
||||
HDstrncpy(config->log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX + 1);
|
||||
strncpy(config->wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX + 1);
|
||||
strncpy(config->log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX + 1);
|
||||
config->ignore_wo_errs = fapl_ptr->ignore_wo_errs;
|
||||
|
||||
/* Copy R/W and W/O FAPLs */
|
||||
@@ -448,9 +448,9 @@ H5FD__splitter_populate_config(H5FD_splitter_vfd_config_t *vfd_config, H5FD_spli
|
||||
} /* end if W/O VFD is non-default */
|
||||
|
||||
fapl_out->ignore_wo_errs = vfd_config->ignore_wo_errs;
|
||||
HDstrncpy(fapl_out->wo_path, vfd_config->wo_path, H5FD_SPLITTER_PATH_MAX + 1);
|
||||
strncpy(fapl_out->wo_path, vfd_config->wo_path, H5FD_SPLITTER_PATH_MAX + 1);
|
||||
fapl_out->wo_path[H5FD_SPLITTER_PATH_MAX] = '\0';
|
||||
HDstrncpy(fapl_out->log_file_path, vfd_config->log_file_path, H5FD_SPLITTER_PATH_MAX + 1);
|
||||
strncpy(fapl_out->log_file_path, vfd_config->log_file_path, H5FD_SPLITTER_PATH_MAX + 1);
|
||||
fapl_out->log_file_path[H5FD_SPLITTER_PATH_MAX] = '\0';
|
||||
fapl_out->rw_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */
|
||||
fapl_out->wo_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */
|
||||
@@ -527,32 +527,32 @@ H5FD__splitter_get_default_wo_path(char *new_path, size_t new_path_len, const ch
|
||||
assert(base_filename);
|
||||
|
||||
/* Check that output buffer can hold base filename + `_wo` suffix */
|
||||
old_filename_len = HDstrlen(base_filename);
|
||||
if (old_filename_len > H5FD_SPLITTER_PATH_MAX - HDstrlen(suffix) - 1)
|
||||
old_filename_len = strlen(base_filename);
|
||||
if (old_filename_len > H5FD_SPLITTER_PATH_MAX - strlen(suffix) - 1)
|
||||
HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "filename exceeds max length");
|
||||
|
||||
/* Determine if filename contains a ".h5" extension. */
|
||||
if ((file_extension = HDstrstr(base_filename, ".h5"))) {
|
||||
if ((file_extension = strstr(base_filename, ".h5"))) {
|
||||
/* Insert the suffix between the filename and ".h5" extension. */
|
||||
HDstrcpy(new_path, base_filename);
|
||||
file_extension = HDstrstr(new_path, ".h5");
|
||||
HDsprintf(file_extension, "%s%s", suffix, ".h5");
|
||||
strcpy(new_path, base_filename);
|
||||
file_extension = strstr(new_path, ".h5");
|
||||
sprintf(file_extension, "%s%s", suffix, ".h5");
|
||||
}
|
||||
else if ((file_extension = HDstrrchr(base_filename, '.'))) {
|
||||
else if ((file_extension = strrchr(base_filename, '.'))) {
|
||||
char *new_extension_loc = NULL;
|
||||
|
||||
/* If the filename doesn't contain a ".h5" extension, but contains
|
||||
* AN extension, just insert the suffix before that extension.
|
||||
*/
|
||||
HDstrcpy(new_path, base_filename);
|
||||
new_extension_loc = HDstrrchr(new_path, '.');
|
||||
HDsprintf(new_extension_loc, "%s%s", suffix, file_extension);
|
||||
strcpy(new_path, base_filename);
|
||||
new_extension_loc = strrchr(new_path, '.');
|
||||
sprintf(new_extension_loc, "%s%s", suffix, file_extension);
|
||||
}
|
||||
else {
|
||||
/* If the filename doesn't contain an extension at all, just insert
|
||||
* the suffix at the end of the filename.
|
||||
*/
|
||||
HDsnprintf(new_path, new_path_len, "%s%s", base_filename, suffix);
|
||||
snprintf(new_path, new_path_len, "%s%s", base_filename, suffix);
|
||||
}
|
||||
|
||||
done:
|
||||
@@ -720,8 +720,8 @@ H5FD__splitter_fapl_copy(const void *_old_fa)
|
||||
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate log file FAPL");
|
||||
|
||||
H5MM_memcpy(new_fa_ptr, old_fa_ptr, sizeof(H5FD_splitter_fapl_t));
|
||||
HDstrncpy(new_fa_ptr->wo_path, old_fa_ptr->wo_path, H5FD_SPLITTER_PATH_MAX + 1);
|
||||
HDstrncpy(new_fa_ptr->log_file_path, old_fa_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX + 1);
|
||||
strncpy(new_fa_ptr->wo_path, old_fa_ptr->wo_path, H5FD_SPLITTER_PATH_MAX + 1);
|
||||
strncpy(new_fa_ptr->log_file_path, old_fa_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX + 1);
|
||||
|
||||
/* Copy R/W and W/O FAPLs */
|
||||
if (H5FD__copy_plist(old_fa_ptr->rw_fapl_id, &(new_fa_ptr->rw_fapl_id)) < 0)
|
||||
@@ -833,8 +833,8 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha
|
||||
}
|
||||
|
||||
/* Copy simpler info */
|
||||
HDstrncpy(file_ptr->fa.wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX + 1);
|
||||
HDstrncpy(file_ptr->fa.log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX + 1);
|
||||
strncpy(file_ptr->fa.wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX + 1);
|
||||
strncpy(file_ptr->fa.log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX + 1);
|
||||
file_ptr->fa.ignore_wo_errs = fapl_ptr->ignore_wo_errs;
|
||||
|
||||
/* Copy R/W and W/O channel FAPLs. */
|
||||
@@ -1575,11 +1575,11 @@ H5FD__splitter_log_error(const H5FD_splitter_t *file, const char *atfunc, const
|
||||
size_t size;
|
||||
char *s;
|
||||
|
||||
size = HDstrlen(atfunc) + HDstrlen(msg) + 3; /* ':', ' ', '\n' */
|
||||
size = strlen(atfunc) + strlen(msg) + 3; /* ':', ' ', '\n' */
|
||||
s = (char *)H5MM_malloc(sizeof(char) * (size + 1));
|
||||
if (NULL == s)
|
||||
ret_value = FAIL;
|
||||
else if (size < (size_t)HDsnprintf(s, size + 1, "%s: %s\n", atfunc, msg))
|
||||
else if (size < (size_t)snprintf(s, size + 1, "%s: %s\n", atfunc, msg))
|
||||
ret_value = FAIL;
|
||||
else if (size != fwrite(s, 1, size, file->logfp))
|
||||
ret_value = FAIL;
|
||||
|
||||
@@ -224,7 +224,7 @@ H5FD_ioc_init(void)
|
||||
|
||||
/* Check if IOC VFD has been loaded dynamically */
|
||||
env_var = HDgetenv(HDF5_DRIVER);
|
||||
if (env_var && !HDstrcmp(env_var, H5FD_IOC_NAME)) {
|
||||
if (env_var && !strcmp(env_var, H5FD_IOC_NAME)) {
|
||||
int mpi_initialized = 0;
|
||||
int provided = 0;
|
||||
|
||||
@@ -528,7 +528,7 @@ H5FD__ioc_sb_encode(H5FD_t *_file, char *name, unsigned char *buf)
|
||||
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get subfiling context object");
|
||||
|
||||
/* Encode driver name */
|
||||
HDstrncpy(name, "IOC", 9);
|
||||
strncpy(name, "IOC", 9);
|
||||
name[8] = '\0';
|
||||
|
||||
/* Encode configuration structure magic number */
|
||||
@@ -573,7 +573,7 @@ H5FD__ioc_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
|
||||
if (NULL == (sf_context = H5_get_subfiling_object(file->context_id)))
|
||||
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get subfiling context object");
|
||||
|
||||
if (HDstrncmp(name, "IOC", 9))
|
||||
if (strncmp(name, "IOC", 9))
|
||||
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid driver name in superblock");
|
||||
|
||||
/* Decode configuration structure magic number */
|
||||
@@ -1495,8 +1495,8 @@ H5FD__ioc_del(const char *name, hid_t fapl)
|
||||
|
||||
/* TODO: No support for subfile directory prefix currently */
|
||||
/* TODO: Possibly try loading config file prefix from file before deleting */
|
||||
HDsnprintf(tmp_filename, PATH_MAX, "%s/" H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE,
|
||||
prefix_env ? prefix_env : file_dirname, base_filename, (uint64_t)st.st_ino);
|
||||
snprintf(tmp_filename, PATH_MAX, "%s/" H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE,
|
||||
prefix_env ? prefix_env : file_dirname, base_filename, (uint64_t)st.st_ino);
|
||||
|
||||
if (NULL == (config_file = fopen(tmp_filename, "r"))) {
|
||||
if (ENOENT == errno) {
|
||||
@@ -1535,8 +1535,8 @@ H5FD__ioc_del(const char *name, hid_t fapl)
|
||||
|
||||
for (int i = 0; i < n_subfiles; i++) {
|
||||
/* TODO: No support for subfile directory prefix currently */
|
||||
HDsnprintf(tmp_filename, PATH_MAX, "%s/" H5FD_SUBFILING_FILENAME_TEMPLATE, file_dirname,
|
||||
base_filename, (uint64_t)st.st_ino, num_digits, i + 1, n_subfiles);
|
||||
snprintf(tmp_filename, PATH_MAX, "%s/" H5FD_SUBFILING_FILENAME_TEMPLATE, file_dirname,
|
||||
base_filename, (uint64_t)st.st_ino, num_digits, i + 1, n_subfiles);
|
||||
|
||||
if (HDremove(tmp_filename) < 0) {
|
||||
#ifdef H5FD_IOC_DEBUG
|
||||
|
||||
@@ -724,7 +724,7 @@ H5FD__subfiling_sb_size(H5FD_t *_file)
|
||||
}
|
||||
else {
|
||||
if (sf_context->config_file_prefix) {
|
||||
ret_value += HDstrlen(sf_context->config_file_prefix) + 1;
|
||||
ret_value += strlen(sf_context->config_file_prefix) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -780,7 +780,7 @@ H5FD__subfiling_sb_encode(H5FD_t *_file, char *name, unsigned char *buf)
|
||||
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get subfiling context object");
|
||||
|
||||
/* Encode driver name */
|
||||
HDstrncpy(name, "Subfilin", 9);
|
||||
strncpy(name, "Subfilin", 9);
|
||||
name[8] = '\0';
|
||||
|
||||
/* Encode configuration structure magic number */
|
||||
@@ -802,7 +802,7 @@ H5FD__subfiling_sb_encode(H5FD_t *_file, char *name, unsigned char *buf)
|
||||
|
||||
/* Encode config file prefix string length */
|
||||
if (sf_context->config_file_prefix) {
|
||||
prefix_len = HDstrlen(sf_context->config_file_prefix) + 1;
|
||||
prefix_len = strlen(sf_context->config_file_prefix) + 1;
|
||||
H5_CHECKED_ASSIGN(tmpu64, uint64_t, prefix_len, size_t);
|
||||
}
|
||||
else
|
||||
@@ -862,7 +862,7 @@ H5FD__subfiling_sb_decode(H5FD_t *_file, const char *name, const unsigned char *
|
||||
if (NULL == (sf_context = H5_get_subfiling_object(file->context_id)))
|
||||
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL, "can't get subfiling context object");
|
||||
|
||||
if (HDstrncmp(name, "Subfilin", 9))
|
||||
if (strncmp(name, "Subfilin", 9))
|
||||
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "invalid driver name in superblock");
|
||||
|
||||
/* Decode configuration structure magic number */
|
||||
@@ -2426,7 +2426,7 @@ H5FD__subfiling_lock(H5FD_t *_file, bool rw)
|
||||
|
||||
if (file->fa.require_ioc) {
|
||||
#ifdef VERBOSE
|
||||
HDputs("Subfiling driver doesn't support file locking");
|
||||
puts("Subfiling driver doesn't support file locking");
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -562,7 +562,7 @@ H5_open_subfiling_stub_file(const char *name, unsigned flags, MPI_Comm file_comm
|
||||
stub_file_id = UINT64_MAX;
|
||||
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL,
|
||||
"couldn't stat HDF5 stub file, errno = %d, error message = '%s'", errno,
|
||||
HDstrerror(errno));
|
||||
strerror(errno));
|
||||
}
|
||||
else
|
||||
stub_file_id = (uint64_t)st.st_ino;
|
||||
@@ -668,7 +668,7 @@ H5_open_subfiles(const char *base_filename, uint64_t file_id, H5FD_subfiling_par
|
||||
if (MPI_SUCCESS != (mpi_code = MPI_Comm_rank(file_comm, &mpi_rank)))
|
||||
H5_SUBFILING_MPI_GOTO_ERROR(FAIL, "MPI_Comm_rank failed", mpi_code);
|
||||
|
||||
HDsnprintf(sf_context->sf_logfile_name, PATH_MAX, "%s.log.%d", sf_context->h5_filename, mpi_rank);
|
||||
snprintf(sf_context->sf_logfile_name, PATH_MAX, "%s.log.%d", sf_context->h5_filename, mpi_rank);
|
||||
|
||||
if (NULL == (sf_context->sf_logfile = fopen(sf_context->sf_logfile_name, "a")))
|
||||
H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL,
|
||||
@@ -778,7 +778,7 @@ init_subfiling(const char *base_filename, uint64_t file_id, H5FD_subfiling_param
|
||||
/* Check if a prefix has been set for the configuration file name */
|
||||
prefix_env = HDgetenv(H5FD_SUBFILING_CONFIG_FILE_PREFIX);
|
||||
if (prefix_env) {
|
||||
if (NULL == (new_context->config_file_prefix = HDstrdup(prefix_env)))
|
||||
if (NULL == (new_context->config_file_prefix = strdup(prefix_env)))
|
||||
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTCOPY, FAIL, "couldn't copy config file prefix string");
|
||||
}
|
||||
|
||||
@@ -1202,7 +1202,7 @@ get_ioc_selection_criteria_from_env(H5FD_subfiling_ioc_select_t *ioc_selection_t
|
||||
* '1:64' to specify the "every Nth rank" strategy with a
|
||||
* criteria of '64'.
|
||||
*/
|
||||
opt_value = HDstrchr(env_value, ':');
|
||||
opt_value = strchr(env_value, ':');
|
||||
if (opt_value) {
|
||||
long check_value;
|
||||
|
||||
@@ -1815,13 +1815,13 @@ init_subfiling_context(subfiling_context_t *sf_context, const char *base_filenam
|
||||
sf_context->sf_logfile = NULL;
|
||||
#endif
|
||||
|
||||
if (NULL == (sf_context->h5_filename = HDstrdup(base_filename)))
|
||||
if (NULL == (sf_context->h5_filename = strdup(base_filename)))
|
||||
H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
|
||||
"couldn't allocate space for subfiling filename");
|
||||
|
||||
/* Check for a subfile name prefix setting in the environment */
|
||||
if ((env_value = HDgetenv(H5FD_SUBFILING_SUBFILE_PREFIX))) {
|
||||
if (NULL == (sf_context->subfile_prefix = HDstrdup(env_value)))
|
||||
if (NULL == (sf_context->subfile_prefix = strdup(env_value)))
|
||||
H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "couldn't copy subfile prefix value");
|
||||
}
|
||||
|
||||
@@ -2204,8 +2204,8 @@ ioc_open_files(int64_t file_context_id, int file_acc_flags)
|
||||
* and the configuration file will be named:
|
||||
* ABC.h5.subfile_<file-number>.config
|
||||
*/
|
||||
HDsnprintf(filepath, PATH_MAX, "%s/" H5FD_SUBFILING_FILENAME_TEMPLATE, subfile_dir, base,
|
||||
sf_context->h5_file_id, num_digits, subfile_idx, num_subfiles);
|
||||
snprintf(filepath, PATH_MAX, "%s/" H5FD_SUBFILING_FILENAME_TEMPLATE, subfile_dir, base,
|
||||
sf_context->h5_file_id, num_digits, subfile_idx, num_subfiles);
|
||||
|
||||
if ((sf_context->sf_fids[i] = HDopen(filepath, file_acc_flags, mode)) < 0)
|
||||
H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "failed to open subfile");
|
||||
@@ -2302,8 +2302,8 @@ create_config_file(subfiling_context_t *sf_context, const char *base_filename, c
|
||||
H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
|
||||
"couldn't allocate space for subfiling configuration filename");
|
||||
|
||||
HDsnprintf(config_filename, PATH_MAX, "%s/" H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE, config_dir,
|
||||
base_filename, sf_context->h5_file_id);
|
||||
snprintf(config_filename, PATH_MAX, "%s/" H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE, config_dir,
|
||||
base_filename, sf_context->h5_file_id);
|
||||
|
||||
/* Determine whether a subfiling configuration file exists */
|
||||
errno = 0;
|
||||
@@ -2334,42 +2334,42 @@ create_config_file(subfiling_context_t *sf_context, const char *base_filename, c
|
||||
"couldn't allocate buffer for writing to subfiling configuration file");
|
||||
|
||||
/* Write the subfiling stripe size to the configuration file */
|
||||
HDsnprintf(line_buf, PATH_MAX, "stripe_size=%" PRId64 "\n", sf_context->sf_stripe_size);
|
||||
if (fwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1)
|
||||
snprintf(line_buf, PATH_MAX, "stripe_size=%" PRId64 "\n", sf_context->sf_stripe_size);
|
||||
if (fwrite(line_buf, strlen(line_buf), 1, config_file) != 1)
|
||||
H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL,
|
||||
"failed to write to subfiling configuration file");
|
||||
|
||||
/* Write the number of I/O concentrators to the configuration file */
|
||||
HDsnprintf(line_buf, PATH_MAX, "aggregator_count=%d\n", sf_context->topology->n_io_concentrators);
|
||||
if (fwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1)
|
||||
snprintf(line_buf, PATH_MAX, "aggregator_count=%d\n", sf_context->topology->n_io_concentrators);
|
||||
if (fwrite(line_buf, strlen(line_buf), 1, config_file) != 1)
|
||||
H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL,
|
||||
"failed to write to subfiling configuration file");
|
||||
|
||||
/* Write the number of subfiles to the configuration file */
|
||||
HDsnprintf(line_buf, PATH_MAX, "subfile_count=%d\n", n_subfiles);
|
||||
if (fwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1)
|
||||
snprintf(line_buf, PATH_MAX, "subfile_count=%d\n", n_subfiles);
|
||||
if (fwrite(line_buf, strlen(line_buf), 1, config_file) != 1)
|
||||
H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL,
|
||||
"failed to write to subfiling configuration file");
|
||||
|
||||
/* Write the base HDF5 filename to the configuration file */
|
||||
HDsnprintf(line_buf, PATH_MAX, "hdf5_file=%s\n", sf_context->h5_filename);
|
||||
if (fwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1)
|
||||
snprintf(line_buf, PATH_MAX, "hdf5_file=%s\n", sf_context->h5_filename);
|
||||
if (fwrite(line_buf, strlen(line_buf), 1, config_file) != 1)
|
||||
H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL,
|
||||
"failed to write to subfiling configuration file");
|
||||
|
||||
/* Write the optional subfile directory prefix to the configuration file */
|
||||
HDsnprintf(line_buf, PATH_MAX, "subfile_dir=%s\n", subfile_dir);
|
||||
if (fwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1)
|
||||
snprintf(line_buf, PATH_MAX, "subfile_dir=%s\n", subfile_dir);
|
||||
if (fwrite(line_buf, strlen(line_buf), 1, config_file) != 1)
|
||||
H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL,
|
||||
"failed to write to subfiling configuration file");
|
||||
|
||||
/* Write out each subfile name to the configuration file */
|
||||
num_digits = (int)(log10(n_subfiles) + 1);
|
||||
for (int k = 0; k < n_subfiles; k++) {
|
||||
HDsnprintf(line_buf, PATH_MAX, H5FD_SUBFILING_FILENAME_TEMPLATE "\n", base_filename,
|
||||
sf_context->h5_file_id, num_digits, k + 1, n_subfiles);
|
||||
snprintf(line_buf, PATH_MAX, H5FD_SUBFILING_FILENAME_TEMPLATE "\n", base_filename,
|
||||
sf_context->h5_file_id, num_digits, k + 1, n_subfiles);
|
||||
|
||||
if (fwrite(line_buf, HDstrlen(line_buf), 1, config_file) != 1)
|
||||
if (fwrite(line_buf, strlen(line_buf), 1, config_file) != 1)
|
||||
H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL,
|
||||
"failed to write to subfiling configuration file");
|
||||
}
|
||||
@@ -2430,8 +2430,8 @@ open_config_file(const char *base_filename, const char *config_dir, uint64_t fil
|
||||
H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
|
||||
"couldn't allocate space for subfiling configuration filename");
|
||||
|
||||
HDsnprintf(config_filename, PATH_MAX, "%s/" H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE, config_dir,
|
||||
base_filename, file_id);
|
||||
snprintf(config_filename, PATH_MAX, "%s/" H5FD_SUBFILING_CONFIG_FILENAME_TEMPLATE, config_dir,
|
||||
base_filename, file_id);
|
||||
|
||||
/* Determine whether a subfiling configuration file exists */
|
||||
errno = 0;
|
||||
@@ -2509,11 +2509,11 @@ H5_get_subfiling_config_from_file(FILE *config_file, int64_t *stripe_size, int64
|
||||
config_buf[config_file_len] = '\0';
|
||||
|
||||
if (stripe_size) {
|
||||
if (NULL == (substr = HDstrstr(config_buf, "stripe_size")))
|
||||
if (NULL == (substr = strstr(config_buf, "stripe_size")))
|
||||
H5_SUBFILING_GOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL,
|
||||
"malformed subfiling configuration file - no stripe size entry");
|
||||
|
||||
if (EOF == HDsscanf(substr, "stripe_size=%" PRId64, &read_stripe_size))
|
||||
if (EOF == sscanf(substr, "stripe_size=%" PRId64, &read_stripe_size))
|
||||
H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL,
|
||||
"couldn't get stripe size from subfiling configuration file");
|
||||
|
||||
@@ -2526,11 +2526,11 @@ H5_get_subfiling_config_from_file(FILE *config_file, int64_t *stripe_size, int64
|
||||
}
|
||||
|
||||
if (num_subfiles) {
|
||||
if (NULL == (substr = HDstrstr(config_buf, "subfile_count")))
|
||||
if (NULL == (substr = strstr(config_buf, "subfile_count")))
|
||||
H5_SUBFILING_GOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL,
|
||||
"malformed subfiling configuration file - no subfile count entry");
|
||||
|
||||
if (EOF == HDsscanf(substr, "subfile_count=%" PRId64, &read_num_subfiles))
|
||||
if (EOF == sscanf(substr, "subfile_count=%" PRId64, &read_num_subfiles))
|
||||
H5_SUBFILING_SYS_GOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL,
|
||||
"couldn't get number of subfiles from subfiling configuration file");
|
||||
|
||||
@@ -2594,7 +2594,7 @@ H5_resolve_pathname(const char *filepath, MPI_Comm comm, char **resolved_filepat
|
||||
H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't get file dirname");
|
||||
|
||||
/* If filepath is just the filename, set up path using CWD */
|
||||
if (!HDstrcmp(file_dirname, ".")) {
|
||||
if (!strcmp(file_dirname, ".")) {
|
||||
if (NULL == (resolved_path = malloc(PATH_MAX)))
|
||||
H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL,
|
||||
"can't allocate buffer for filepath");
|
||||
@@ -2608,24 +2608,24 @@ H5_resolve_pathname(const char *filepath, MPI_Comm comm, char **resolved_filepat
|
||||
H5_SUBFILING_GOTO_ERROR(
|
||||
H5E_VFL, H5E_CANTGET, FAIL,
|
||||
"can't get current working directory, errno = %d, error message = '%s'", errno,
|
||||
HDstrerror(errno));
|
||||
strerror(errno));
|
||||
|
||||
HDsnprintf(resolved_path, PATH_MAX, "%s/%s", cwd, file_basename);
|
||||
snprintf(resolved_path, PATH_MAX, "%s/%s", cwd, file_basename);
|
||||
}
|
||||
else {
|
||||
/* Otherwise, just use what was given as the pathname */
|
||||
if (NULL == (resolved_path = HDstrdup(filepath)))
|
||||
if (NULL == (resolved_path = strdup(filepath)))
|
||||
H5_SUBFILING_GOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't copy filename");
|
||||
}
|
||||
}
|
||||
else
|
||||
H5_SUBFILING_GOTO_ERROR(H5E_VFL, H5E_CANTGET, FAIL,
|
||||
"can't resolve subfile path, errno = %d, error message = '%s'", errno,
|
||||
HDstrerror(errno));
|
||||
strerror(errno));
|
||||
}
|
||||
|
||||
if (resolved_path) {
|
||||
H5_CHECKED_ASSIGN(path_len, hsize_t, (HDstrlen(resolved_path) + 1), size_t);
|
||||
H5_CHECKED_ASSIGN(path_len, hsize_t, (strlen(resolved_path) + 1), size_t);
|
||||
}
|
||||
else
|
||||
path_len = HSIZE_UNDEF;
|
||||
@@ -3138,13 +3138,13 @@ H5_subfiling_log(int64_t sf_context_id, const char *fmt, ...)
|
||||
H5FD_ioc_begin_thread_exclusive();
|
||||
|
||||
if (sf_context->sf_logfile) {
|
||||
HDvfprintf(sf_context->sf_logfile, fmt, log_args);
|
||||
HDfputs("\n", sf_context->sf_logfile);
|
||||
vfprintf(sf_context->sf_logfile, fmt, log_args);
|
||||
fputs("\n", sf_context->sf_logfile);
|
||||
fflush(sf_context->sf_logfile);
|
||||
}
|
||||
else {
|
||||
HDvprintf(fmt, log_args);
|
||||
HDputs("");
|
||||
vprintf(fmt, log_args);
|
||||
puts("");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -89,10 +89,10 @@ H5FD__supports_swmr_test(const char *vfd_name)
|
||||
|
||||
FUNC_ENTER_NOAPI_NOINIT_NOERR
|
||||
|
||||
if (!vfd_name || !HDstrcmp(vfd_name, "") || !HDstrcmp(vfd_name, "nomatch"))
|
||||
if (!vfd_name || !strcmp(vfd_name, "") || !strcmp(vfd_name, "nomatch"))
|
||||
ret_value = true;
|
||||
else
|
||||
ret_value = !HDstrcmp(vfd_name, "log") || !HDstrcmp(vfd_name, "sec2");
|
||||
ret_value = !strcmp(vfd_name, "log") || !strcmp(vfd_name, "sec2");
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5FD__supports_swmr_test() */
|
||||
|
||||
+16
-17
@@ -245,10 +245,10 @@ H5F__parse_file_lock_env_var(htri_t *use_locks)
|
||||
|
||||
/* Check the file locking environment variable */
|
||||
lock_env_var = HDgetenv(HDF5_USE_FILE_LOCKING);
|
||||
if (lock_env_var && (!HDstrcmp(lock_env_var, "FALSE") || !HDstrcmp(lock_env_var, "0")))
|
||||
if (lock_env_var && (!strcmp(lock_env_var, "FALSE") || !strcmp(lock_env_var, "0")))
|
||||
*use_locks = false; /* Override: Never use locks */
|
||||
else if (lock_env_var && (!HDstrcmp(lock_env_var, "TRUE") || !HDstrcmp(lock_env_var, "BEST_EFFORT") ||
|
||||
!HDstrcmp(lock_env_var, "1")))
|
||||
else if (lock_env_var && (!strcmp(lock_env_var, "TRUE") || !strcmp(lock_env_var, "BEST_EFFORT") ||
|
||||
!strcmp(lock_env_var, "1")))
|
||||
*use_locks = true; /* Override: Always use locks */
|
||||
else
|
||||
*use_locks = FAIL; /* Environment variable not set, or not set correctly */
|
||||
@@ -742,8 +742,8 @@ H5F__build_name(const char *prefix, const char *file_name, char **full_name /*ou
|
||||
|
||||
FUNC_ENTER_PACKAGE
|
||||
|
||||
prefix_len = HDstrlen(prefix);
|
||||
fname_len = HDstrlen(file_name);
|
||||
prefix_len = strlen(prefix);
|
||||
fname_len = strlen(file_name);
|
||||
|
||||
/* Allocate a buffer to hold the filename + prefix + possibly the delimiter + terminating null byte */
|
||||
if (NULL == (*full_name = (char *)H5MM_malloc(prefix_len + fname_len + 2 +
|
||||
@@ -751,10 +751,9 @@ H5F__build_name(const char *prefix, const char *file_name, char **full_name /*ou
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate filename buffer");
|
||||
|
||||
/* Compose the full file name */
|
||||
HDsnprintf(*full_name, (prefix_len + fname_len + 2 + 2), "%s%s%s",
|
||||
prefix, /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */
|
||||
((prefix_len == 0 || H5_CHECK_DELIMITER(prefix[prefix_len - 1])) ? "" : H5_DIR_SEPS),
|
||||
file_name);
|
||||
snprintf(*full_name, (prefix_len + fname_len + 2 + 2), "%s%s%s",
|
||||
prefix, /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */
|
||||
((prefix_len == 0 || H5_CHECK_DELIMITER(prefix[prefix_len - 1])) ? "" : H5_DIR_SEPS), file_name);
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@@ -782,7 +781,7 @@ H5F__getenv_prefix_name(char **env_prefix /*in,out*/)
|
||||
ret_value = *env_prefix;
|
||||
|
||||
/* Advance to next component, if possible */
|
||||
strret = HDstrchr(*env_prefix, H5_COLON_SEPC);
|
||||
strret = strchr(*env_prefix, H5_COLON_SEPC);
|
||||
if (strret == NULL)
|
||||
*env_prefix = NULL;
|
||||
else {
|
||||
@@ -829,7 +828,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c
|
||||
/* Copy the file name to use */
|
||||
if (NULL == (temp_file_name = H5MM_strdup(file_name)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
|
||||
temp_file_name_len = HDstrlen(temp_file_name);
|
||||
temp_file_name_len = strlen(temp_file_name);
|
||||
|
||||
/* Target file_name is an absolute pathname: see RM for detailed description */
|
||||
if (H5_CHECK_ABSOLUTE(file_name) || H5_CHECK_ABS_PATH(file_name)) {
|
||||
@@ -851,7 +850,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c
|
||||
ptr++;
|
||||
|
||||
/* Copy into the temp. file name */
|
||||
HDstrncpy(temp_file_name, ptr, temp_file_name_len);
|
||||
strncpy(temp_file_name, ptr, temp_file_name_len);
|
||||
temp_file_name[temp_file_name_len - 1] = '\0';
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
@@ -865,7 +864,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c
|
||||
H5E_clear_stack(NULL);
|
||||
|
||||
/* Strip "<drive-letter>:" */
|
||||
HDstrncpy(temp_file_name, &file_name[2], temp_file_name_len);
|
||||
strncpy(temp_file_name, &file_name[2], temp_file_name_len);
|
||||
temp_file_name[temp_file_name_len - 1] = '\0';
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
@@ -1280,11 +1279,11 @@ H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F
|
||||
if (H5P_get(plist, H5F_ACS_MDC_LOG_LOCATION_NAME, &mdc_log_location) < 0)
|
||||
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get mdc log location");
|
||||
if (mdc_log_location != NULL) {
|
||||
size_t len = HDstrlen(mdc_log_location);
|
||||
size_t len = strlen(mdc_log_location);
|
||||
if (NULL == (f->shared->mdc_log_location = (char *)H5MM_calloc((len + 1) * sizeof(char))))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL,
|
||||
"can't allocate memory for mdc log file name");
|
||||
HDstrncpy(f->shared->mdc_log_location, mdc_log_location, len);
|
||||
strncpy(f->shared->mdc_log_location, mdc_log_location, len);
|
||||
}
|
||||
else
|
||||
f->shared->mdc_log_location = NULL;
|
||||
@@ -3166,7 +3165,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len, size_t *image_le
|
||||
*
|
||||
* JRM -- 11/11/22
|
||||
*/
|
||||
if (HDstrcmp(fd_ptr->cls->name, "multi") == 0)
|
||||
if (strcmp(fd_ptr->cls->name, "multi") == 0)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not supported for multi file driver.");
|
||||
|
||||
/* While the family file driver is conceptually fully compatible
|
||||
@@ -3188,7 +3187,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len, size_t *image_le
|
||||
* in the future.
|
||||
* JRM -- 12/21/11
|
||||
*/
|
||||
if (HDstrcmp(fd_ptr->cls->name, "family") == 0)
|
||||
if (strcmp(fd_ptr->cls->name, "family") == 0)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "Not supported for family file driver.");
|
||||
|
||||
/* Go get the actual file size */
|
||||
|
||||
+1
-1
@@ -151,7 +151,7 @@ H5G__dense_fh_name_cmp(const void *obj, size_t obj_len, void *_udata)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link");
|
||||
|
||||
/* Compare the string values */
|
||||
udata->cmp = HDstrcmp(udata->name, lnk->name);
|
||||
udata->cmp = strcmp(udata->name, lnk->name);
|
||||
|
||||
/* Check for correct link & callback to make */
|
||||
if (udata->cmp == 0 && udata->found_op) {
|
||||
|
||||
+4
-4
@@ -214,11 +214,11 @@ H5G__compact_get_name_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound");
|
||||
|
||||
/* Get the length of the name */
|
||||
*name_len = HDstrlen(ltable.lnks[idx].name);
|
||||
*name_len = strlen(ltable.lnks[idx].name);
|
||||
|
||||
/* Copy the name into the user's buffer, if given */
|
||||
if (name) {
|
||||
HDstrncpy(name, ltable.lnks[idx].name, MIN((*name_len + 1), name_size));
|
||||
strncpy(name, ltable.lnks[idx].name, MIN((*name_len + 1), name_size));
|
||||
if (*name_len >= name_size)
|
||||
name[name_size - 1] = '\0';
|
||||
} /* end if */
|
||||
@@ -255,7 +255,7 @@ H5G__compact_remove_common_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, vo
|
||||
assert(udata);
|
||||
|
||||
/* If we've found the right link, get the object type */
|
||||
if (HDstrcmp(lnk->name, udata->name) == 0) {
|
||||
if (strcmp(lnk->name, udata->name) == 0) {
|
||||
/* Replace path names for link being removed */
|
||||
if (H5G__link_name_replace(udata->file, udata->grp_full_path_r, lnk) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5_ITER_ERROR, "unable to get object type");
|
||||
@@ -412,7 +412,7 @@ H5G__compact_lookup_cb(const void *_mesg, unsigned H5_ATTR_UNUSED idx, void *_ud
|
||||
assert(udata);
|
||||
|
||||
/* Check for name to get information */
|
||||
if (HDstrcmp(lnk->name, udata->name) == 0) {
|
||||
if (strcmp(lnk->name, udata->name) == 0) {
|
||||
if (udata->lnk) {
|
||||
/* Copy link information */
|
||||
if (NULL == H5O_msg_copy(H5O_LINK_ID, lnk, udata->lnk))
|
||||
|
||||
+8
-8
@@ -394,7 +394,7 @@ H5G__dense_insert(H5F_t *f, const H5O_linfo_t *linfo, const H5O_link_t *lnk)
|
||||
udata.common.f = f;
|
||||
udata.common.fheap = fheap;
|
||||
udata.common.name = lnk->name;
|
||||
udata.common.name_hash = H5_checksum_lookup3(lnk->name, HDstrlen(lnk->name), 0);
|
||||
udata.common.name_hash = H5_checksum_lookup3(lnk->name, strlen(lnk->name), 0);
|
||||
udata.common.corder = lnk->corder;
|
||||
udata.common.found_op = NULL;
|
||||
udata.common.found_op_data = NULL;
|
||||
@@ -502,7 +502,7 @@ H5G__dense_lookup(H5F_t *f, const H5O_linfo_t *linfo, const char *name, bool *fo
|
||||
udata.f = f;
|
||||
udata.fheap = fheap;
|
||||
udata.name = name;
|
||||
udata.name_hash = H5_checksum_lookup3(name, HDstrlen(name), 0);
|
||||
udata.name_hash = H5_checksum_lookup3(name, strlen(name), 0);
|
||||
udata.found_op = H5G__dense_lookup_cb; /* v2 B-tree comparison callback */
|
||||
udata.found_op_data = lnk;
|
||||
|
||||
@@ -1004,11 +1004,11 @@ H5G__dense_get_name_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link");
|
||||
|
||||
/* Get the length of the name */
|
||||
udata->name_len = HDstrlen(lnk->name);
|
||||
udata->name_len = strlen(lnk->name);
|
||||
|
||||
/* Copy the name into the user's buffer, if given */
|
||||
if (udata->name) {
|
||||
HDstrncpy(udata->name, lnk->name, MIN((udata->name_len + 1), udata->name_size));
|
||||
strncpy(udata->name, lnk->name, MIN((udata->name_len + 1), udata->name_size));
|
||||
if (udata->name_len >= udata->name_size)
|
||||
udata->name[udata->name_size - 1] = '\0';
|
||||
} /* end if */
|
||||
@@ -1146,11 +1146,11 @@ H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type, H5
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound");
|
||||
|
||||
/* Get the length of the name */
|
||||
*name_len = HDstrlen(ltable.lnks[n].name);
|
||||
*name_len = strlen(ltable.lnks[n].name);
|
||||
|
||||
/* Copy the name into the user's buffer, if given */
|
||||
if (name) {
|
||||
HDstrncpy(name, ltable.lnks[n].name, MIN((*name_len + 1), name_size));
|
||||
strncpy(name, ltable.lnks[n].name, MIN((*name_len + 1), name_size));
|
||||
if (*name_len >= name_size)
|
||||
name[name_size - 1] = '\0';
|
||||
} /* end if */
|
||||
@@ -1306,7 +1306,7 @@ H5G__dense_remove(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_
|
||||
udata.common.f = f;
|
||||
udata.common.fheap = fheap;
|
||||
udata.common.name = name;
|
||||
udata.common.name_hash = H5_checksum_lookup3(name, HDstrlen(name), 0);
|
||||
udata.common.name_hash = H5_checksum_lookup3(name, strlen(name), 0);
|
||||
udata.common.found_op = NULL;
|
||||
udata.common.found_op_data = NULL;
|
||||
udata.rem_from_fheap = true;
|
||||
@@ -1418,7 +1418,7 @@ H5G__dense_remove_by_idx_bt2_cb(const void *_record, void *_bt2_udata)
|
||||
other_bt2_udata.fheap = bt2_udata->fheap;
|
||||
other_bt2_udata.name = fh_udata.lnk->name;
|
||||
other_bt2_udata.name_hash =
|
||||
H5_checksum_lookup3(fh_udata.lnk->name, HDstrlen(fh_udata.lnk->name), 0);
|
||||
H5_checksum_lookup3(fh_udata.lnk->name, strlen(fh_udata.lnk->name), 0);
|
||||
other_bt2_udata.found_op = NULL;
|
||||
other_bt2_udata.found_op_data = NULL;
|
||||
} /* end else */
|
||||
|
||||
+2
-2
@@ -371,7 +371,7 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk
|
||||
H5G__ent_reset(ent);
|
||||
|
||||
/* Add the new name to the heap */
|
||||
if (H5HL_insert(f, heap, HDstrlen(name) + 1, name, &name_offset) < 0)
|
||||
if (H5HL_insert(f, heap, strlen(name) + 1, name, &name_offset) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "unable to insert symbol name into heap");
|
||||
ent->name_off = name_offset;
|
||||
|
||||
@@ -459,7 +459,7 @@ H5G__ent_convert(H5F_t *f, H5HL_t *heap, const char *name, const H5O_link_t *lnk
|
||||
size_t lnk_offset; /* Offset to sym-link value */
|
||||
|
||||
/* Insert link value into local heap */
|
||||
if (H5HL_insert(f, heap, HDstrlen(lnk->u.soft.name) + 1, lnk->u.soft.name, &lnk_offset) < 0)
|
||||
if (H5HL_insert(f, heap, strlen(lnk->u.soft.name) + 1, lnk->u.soft.name, &lnk_offset) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to write link value to local heap");
|
||||
|
||||
ent->type = H5G_CACHED_SLINK;
|
||||
|
||||
+3
-3
@@ -931,7 +931,7 @@ H5G__visit_cb(const H5O_link_t *lnk, void *_udata)
|
||||
|
||||
/* Check if we will need more space to store this link's relative path */
|
||||
/* ("+2" is for string terminator and possible '/' for group separator later) */
|
||||
link_name_len = HDstrlen(lnk->name);
|
||||
link_name_len = strlen(lnk->name);
|
||||
len_needed = udata->curr_path_len + link_name_len + 2;
|
||||
if (len_needed > udata->path_buf_size) {
|
||||
void *new_path; /* Pointer to new path buffer */
|
||||
@@ -945,7 +945,7 @@ H5G__visit_cb(const H5O_link_t *lnk, void *_udata)
|
||||
|
||||
/* Build the link's relative path name */
|
||||
assert(udata->path[old_path_len] == '\0');
|
||||
HDstrncpy(&(udata->path[old_path_len]), lnk->name, link_name_len + 1);
|
||||
strncpy(&(udata->path[old_path_len]), lnk->name, link_name_len + 1);
|
||||
udata->curr_path_len += link_name_len;
|
||||
|
||||
/* Construct the link info from the link message */
|
||||
@@ -1008,7 +1008,7 @@ H5G__visit_cb(const H5O_link_t *lnk, void *_udata)
|
||||
|
||||
/* Add the path separator to the current path */
|
||||
assert(udata->path[udata->curr_path_len] == '\0');
|
||||
HDstrncpy(&(udata->path[udata->curr_path_len]), "/", (size_t)2);
|
||||
strncpy(&(udata->path[udata->curr_path_len]), "/", (size_t)2);
|
||||
udata->curr_path_len++;
|
||||
|
||||
/* Attempt to get the link info for this group */
|
||||
|
||||
+3
-3
@@ -91,7 +91,7 @@ H5G__link_cmp_name_inc(const void *lnk1, const void *lnk2)
|
||||
{
|
||||
FUNC_ENTER_PACKAGE_NOERR
|
||||
|
||||
FUNC_LEAVE_NOAPI(HDstrcmp(((const H5O_link_t *)lnk1)->name, ((const H5O_link_t *)lnk2)->name))
|
||||
FUNC_LEAVE_NOAPI(strcmp(((const H5O_link_t *)lnk1)->name, ((const H5O_link_t *)lnk2)->name))
|
||||
} /* end H5G__link_cmp_name_inc() */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -113,7 +113,7 @@ H5G__link_cmp_name_dec(const void *lnk1, const void *lnk2)
|
||||
{
|
||||
FUNC_ENTER_PACKAGE_NOERR
|
||||
|
||||
FUNC_LEAVE_NOAPI(HDstrcmp(((const H5O_link_t *)lnk2)->name, ((const H5O_link_t *)lnk1)->name))
|
||||
FUNC_LEAVE_NOAPI(strcmp(((const H5O_link_t *)lnk2)->name, ((const H5O_link_t *)lnk1)->name))
|
||||
} /* end H5G__link_cmp_name_dec() */
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
@@ -276,7 +276,7 @@ H5G_link_to_info(const H5O_loc_t *link_loc, const H5O_link_t *lnk, H5L_info2_t *
|
||||
break;
|
||||
|
||||
case H5L_TYPE_SOFT:
|
||||
info->u.val_size = HDstrlen(lnk->u.soft.name) + 1; /*count the null terminator*/
|
||||
info->u.val_size = strlen(lnk->u.soft.name) + 1; /*count the null terminator*/
|
||||
break;
|
||||
|
||||
case H5L_TYPE_ERROR:
|
||||
|
||||
+3
-3
@@ -871,7 +871,7 @@ H5G__loc_set_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_
|
||||
|
||||
/* Add the new message */
|
||||
if (udata->comment && *udata->comment) {
|
||||
if (NULL == (comment.s = HDstrdup(udata->comment)))
|
||||
if (NULL == (comment.s = strdup(udata->comment)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't copy group comment");
|
||||
if (H5O_msg_create(obj_loc->oloc, H5O_NAME_ID, 0, H5O_UPDATE_TIME, &comment) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to set comment object header message");
|
||||
@@ -953,8 +953,8 @@ H5G__loc_get_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_
|
||||
}
|
||||
else {
|
||||
if (udata->comment && udata->bufsize)
|
||||
HDstrncpy(udata->comment, comment.s, udata->bufsize);
|
||||
udata->comment_size = HDstrlen(comment.s);
|
||||
strncpy(udata->comment, comment.s, udata->bufsize);
|
||||
udata->comment_size = strlen(comment.s);
|
||||
H5O_msg_reset(H5O_NAME_ID, &comment);
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -116,7 +116,7 @@ H5G__component(const char *name, size_t *size_p)
|
||||
while ('/' == *name)
|
||||
name++;
|
||||
if (size_p)
|
||||
*size_p = HDstrcspn(name, "/");
|
||||
*size_p = strcspn(name, "/");
|
||||
|
||||
FUNC_LEAVE_NOAPI(name)
|
||||
} /* end H5G__component() */
|
||||
@@ -217,7 +217,7 @@ H5G__common_path(const H5RS_str_t *fullpath_r, const H5RS_str_t *prefix_r)
|
||||
/* Check that the components we found are the same length */
|
||||
if (nchars1 == nchars2) {
|
||||
/* Check that the two components are equal */
|
||||
if (HDstrncmp(fullpath, prefix, nchars1) == 0) {
|
||||
if (strncmp(fullpath, prefix, nchars1) == 0) {
|
||||
/* Advance the pointers in the names */
|
||||
fullpath += nchars1;
|
||||
prefix += nchars2;
|
||||
@@ -266,7 +266,7 @@ H5G__build_fullpath(const char *prefix, const char *name)
|
||||
/* Create full path */
|
||||
if (NULL == (ret_value = H5RS_create(prefix)))
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTCREATE, NULL, "can't create ref-counted string");
|
||||
if (prefix[HDstrlen(prefix) - 1] != '/')
|
||||
if (prefix[strlen(prefix) - 1] != '/')
|
||||
H5RS_aputc(ret_value, '/'); /* Add separator, if the prefix doesn't end in one */
|
||||
H5RS_acat(ret_value, name);
|
||||
|
||||
@@ -455,7 +455,7 @@ H5G_get_name(const H5G_loc_t *loc, char *name /*out*/, size_t size, size_t *name
|
||||
len = H5RS_len(loc->path->user_path_r);
|
||||
|
||||
if (name) {
|
||||
HDstrncpy(name, H5RS_get_str(loc->path->user_path_r), MIN((len + 1), size));
|
||||
strncpy(name, H5RS_get_str(loc->path->user_path_r), MIN((len + 1), size));
|
||||
if (len >= size)
|
||||
name[size - 1] = '\0';
|
||||
} /* end if */
|
||||
@@ -570,8 +570,8 @@ H5G__name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char
|
||||
assert(path);
|
||||
|
||||
/* Check if path needs to be updated */
|
||||
full_suffix_len = HDstrlen(full_suffix);
|
||||
path_len = HDstrlen(path);
|
||||
full_suffix_len = strlen(full_suffix);
|
||||
path_len = strlen(path);
|
||||
if (full_suffix_len < path_len) {
|
||||
const char *dst_suffix; /* Destination suffix that changes */
|
||||
const char *src_suffix; /* Source suffix that changes */
|
||||
@@ -603,7 +603,7 @@ H5G__name_move_path(H5RS_str_t **path_r_ptr, const char *full_suffix, const char
|
||||
|
||||
/* Compute path prefix before src suffix */
|
||||
path_prefix2 = path;
|
||||
path_prefix2_len = path_prefix_len - HDstrlen(src_suffix);
|
||||
path_prefix2_len = path_prefix_len - strlen(src_suffix);
|
||||
|
||||
/* Allocate new ref-counted string */
|
||||
if (NULL == (rs = H5RS_create(NULL)))
|
||||
@@ -781,7 +781,7 @@ H5G__name_replace_cb(void *obj_ptr, hid_t obj_id, void *key)
|
||||
src_path = H5RS_get_str(names->src_full_path_r);
|
||||
|
||||
/* Construct full path suffix */
|
||||
full_suffix = full_path + HDstrlen(src_path);
|
||||
full_suffix = full_path + strlen(src_path);
|
||||
|
||||
/* Create new full path suffix */
|
||||
if (NULL == (rs = H5RS_create(full_suffix)))
|
||||
@@ -848,7 +848,7 @@ H5G__name_replace_cb(void *obj_ptr, hid_t obj_id, void *key)
|
||||
assert(*dst_path == '/');
|
||||
|
||||
/* Get pointer to "full suffix" */
|
||||
full_suffix = full_path + HDstrlen(src_path);
|
||||
full_suffix = full_path + strlen(src_path);
|
||||
|
||||
/* Update the user path, if one exists */
|
||||
if (obj_path->user_path_r)
|
||||
@@ -1141,16 +1141,16 @@ H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size, si
|
||||
/* Check for finding the object */
|
||||
if (found_obj) {
|
||||
/* Set the length of the full path */
|
||||
len = HDstrlen(udata.path) + 1; /* Length of path + 1 (for "/") */
|
||||
len = strlen(udata.path) + 1; /* Length of path + 1 (for "/") */
|
||||
|
||||
/* If there's a buffer provided, copy into it, up to the limit of its size */
|
||||
if (name) {
|
||||
/* Copy the initial path separator */
|
||||
HDstrncpy(name, "/", (size_t)2);
|
||||
strncpy(name, "/", (size_t)2);
|
||||
|
||||
/* Append the rest of the path */
|
||||
/* (less one character, for the initial path separator) */
|
||||
HDstrncat(name, udata.path, (size - 2));
|
||||
strncat(name, udata.path, (size - 2));
|
||||
if (len >= size)
|
||||
name[size - 1] = '\0';
|
||||
} /* end if */
|
||||
|
||||
+8
-8
@@ -360,7 +360,7 @@ H5G__node_cmp2(void *_lt_key, void *_udata, void *_rt_key)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get key name");
|
||||
|
||||
/* Set return value */
|
||||
ret_value = HDstrcmp(s1, s2);
|
||||
ret_value = strcmp(s1, s2);
|
||||
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@@ -406,13 +406,13 @@ H5G__node_cmp3(void *_lt_key, void *_udata, void *_rt_key)
|
||||
/* left side */
|
||||
if ((s = (const char *)H5HL_offset_into(udata->heap, lt_key->offset)) == NULL)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get key name");
|
||||
if (HDstrcmp(udata->name, s) <= 0)
|
||||
if (strcmp(udata->name, s) <= 0)
|
||||
ret_value = (-1);
|
||||
else {
|
||||
/* right side */
|
||||
if ((s = (const char *)H5HL_offset_into(udata->heap, rt_key->offset)) == NULL)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get key name");
|
||||
if (HDstrcmp(udata->name, s) > 0)
|
||||
if (strcmp(udata->name, s) > 0)
|
||||
ret_value = 1;
|
||||
} /* end else */
|
||||
|
||||
@@ -476,7 +476,7 @@ H5G__node_found(H5F_t *f, haddr_t addr, const void H5_ATTR_UNUSED *_lt_key, bool
|
||||
|
||||
if ((s = (const char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)) == NULL)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get symbol table name");
|
||||
cmp = HDstrcmp(udata->common.name, s);
|
||||
cmp = strcmp(udata->common.name, s);
|
||||
|
||||
if (cmp < 0)
|
||||
rt = idx;
|
||||
@@ -574,7 +574,7 @@ H5G__node_insert(H5F_t *f, haddr_t addr, void H5_ATTR_UNUSED *_lt_key, bool H5_A
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get symbol table name");
|
||||
|
||||
/* Check if symbol is already present */
|
||||
if (0 == (cmp = HDstrcmp(udata->common.name, s)))
|
||||
if (0 == (cmp = strcmp(udata->common.name, s)))
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, H5B_INS_ERROR, "symbol is already present in symbol table");
|
||||
|
||||
if (cmp < 0)
|
||||
@@ -727,7 +727,7 @@ H5G__node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key /*i
|
||||
idx = (lt + rt) / 2;
|
||||
if ((s = (const char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)) == NULL)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get symbol table name");
|
||||
cmp = HDstrcmp(udata->common.name, s);
|
||||
cmp = strcmp(udata->common.name, s);
|
||||
if (cmp < 0)
|
||||
rt = idx;
|
||||
else
|
||||
@@ -740,7 +740,7 @@ H5G__node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key /*i
|
||||
/* Get a pointer to the name of the link */
|
||||
if (NULL == (lnk.name = (char *)H5HL_offset_into(udata->common.heap, sn->entry[idx].name_off)))
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5B_INS_ERROR, "unable to get link name");
|
||||
link_name_len = HDstrlen(lnk.name) + 1;
|
||||
link_name_len = strlen(lnk.name) + 1;
|
||||
|
||||
/* Set up rest of link structure */
|
||||
lnk.corder_valid = false;
|
||||
@@ -778,7 +778,7 @@ H5G__node_remove(H5F_t *f, haddr_t addr, void H5_ATTR_NDEBUG_UNUSED *_lt_key /*i
|
||||
if (lnk.u.soft.name) {
|
||||
size_t soft_link_len; /* Length of string in local heap */
|
||||
|
||||
soft_link_len = HDstrlen(lnk.u.soft.name) + 1;
|
||||
soft_link_len = strlen(lnk.u.soft.name) + 1;
|
||||
if (H5HL_remove(f, udata->common.heap, sn->entry[idx].cache.slink.lval_offset,
|
||||
soft_link_len) < 0)
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, H5B_INS_ERROR,
|
||||
|
||||
+2
-2
@@ -725,11 +725,11 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound");
|
||||
|
||||
/* Get the length of the name */
|
||||
*name_len = HDstrlen(udata.name);
|
||||
*name_len = strlen(udata.name);
|
||||
|
||||
/* Copy the name into the user's buffer, if given */
|
||||
if (name) {
|
||||
HDstrncpy(name, udata.name, MIN((*name_len + 1), name_size));
|
||||
strncpy(name, udata.name, MIN((*name_len + 1), name_size));
|
||||
if (*name_len >= name_size)
|
||||
name[name_size - 1] = '\0';
|
||||
} /* end if */
|
||||
|
||||
+1
-1
@@ -617,7 +617,7 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign
|
||||
|
||||
/* Set the user path, if given */
|
||||
if (user_path)
|
||||
HDstrncpy(user_path, H5RS_get_str(obj_path->user_path_r), (len + 1));
|
||||
strncpy(user_path, H5RS_get_str(obj_path->user_path_r), (len + 1));
|
||||
|
||||
/* Set the length of the path */
|
||||
*user_path_len = len;
|
||||
|
||||
+2
-2
@@ -511,7 +511,7 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G
|
||||
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "can't wrap buffer");
|
||||
|
||||
/* Get a pointer to a buffer that's large enough */
|
||||
if (NULL == (comp = (char *)H5WB_actual(wb, (HDstrlen(name) + 1))))
|
||||
if (NULL == (comp = (char *)H5WB_actual(wb, (strlen(name) + 1))))
|
||||
HGOTO_ERROR(H5E_SYM, H5E_NOSPACE, FAIL, "can't get actual buffer");
|
||||
|
||||
/* Traverse the path */
|
||||
@@ -555,7 +555,7 @@ H5G__traverse_real(const H5G_loc_t *_loc, const char *name, unsigned target, H5G
|
||||
if (lookup_status) {
|
||||
/* Sanity check link and indicate it's valid */
|
||||
assert(lnk.type >= H5L_TYPE_HARD);
|
||||
assert(!HDstrcmp(comp, lnk.name));
|
||||
assert(!strcmp(comp, lnk.name));
|
||||
link_valid = true;
|
||||
|
||||
/* Build object location from the link */
|
||||
|
||||
+6
-7
@@ -398,7 +398,7 @@ H5HF_dblock_debug_cb(H5FS_section_info_t *_sect, void *_udata)
|
||||
/* Calculate the length */
|
||||
len = end - start;
|
||||
|
||||
HDsnprintf(temp_str, sizeof(temp_str), "Section #%u:", (unsigned)udata->sect_count);
|
||||
snprintf(temp_str, sizeof(temp_str), "Section #%u:", (unsigned)udata->sect_count);
|
||||
fprintf(udata->stream, "%*s%-*s %8zu, %8zu\n", udata->indent + 3, "", MAX(0, udata->fwidth - 9),
|
||||
temp_str, start, len);
|
||||
udata->sect_count++;
|
||||
@@ -591,13 +591,13 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, bool dump_internal, FILE *strea
|
||||
else
|
||||
fprintf(stream, "%*sDirect Block Entries: (address)\n", indent, "");
|
||||
for (u = 0; u < hdr->man_dtable.max_direct_rows && u < iblock->nrows; u++) {
|
||||
HDsnprintf(temp_str, sizeof(temp_str), "Row #%u: (block size: %lu)", (unsigned)u,
|
||||
(unsigned long)hdr->man_dtable.row_block_size[u]);
|
||||
snprintf(temp_str, sizeof(temp_str), "Row #%u: (block size: %lu)", (unsigned)u,
|
||||
(unsigned long)hdr->man_dtable.row_block_size[u]);
|
||||
fprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str);
|
||||
for (v = 0; v < hdr->man_dtable.cparam.width; v++) {
|
||||
size_t off = (u * hdr->man_dtable.cparam.width) + v;
|
||||
|
||||
HDsnprintf(temp_str, sizeof(temp_str), "Col #%u:", (unsigned)v);
|
||||
snprintf(temp_str, sizeof(temp_str), "Col #%u:", (unsigned)v);
|
||||
if (hdr->filter_len > 0)
|
||||
fprintf(stream, "%*s%-*s %9" PRIuHADDR "/%6zu/%x\n", indent + 6, "", MAX(0, fwidth - 6),
|
||||
temp_str, iblock->ents[off].addr, iblock->filt_ents[off].size,
|
||||
@@ -616,13 +616,12 @@ H5HF_iblock_print(const H5HF_indirect_t *iblock, bool dump_internal, FILE *strea
|
||||
H5VM_log2_of2(hdr->man_dtable.cparam.width);
|
||||
for (u = hdr->man_dtable.max_direct_rows; u < iblock->nrows; u++) {
|
||||
num_indirect_rows = (H5VM_log2_gen(hdr->man_dtable.row_block_size[u]) - first_row_bits) + 1;
|
||||
HDsnprintf(temp_str, sizeof(temp_str), "Row #%u: (# of rows: %u)", (unsigned)u,
|
||||
num_indirect_rows);
|
||||
snprintf(temp_str, sizeof(temp_str), "Row #%u: (# of rows: %u)", (unsigned)u, num_indirect_rows);
|
||||
fprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), temp_str);
|
||||
for (v = 0; v < hdr->man_dtable.cparam.width; v++) {
|
||||
size_t off = (u * hdr->man_dtable.cparam.width) + v;
|
||||
|
||||
HDsnprintf(temp_str, sizeof(temp_str), "Col #%u:", (unsigned)v);
|
||||
snprintf(temp_str, sizeof(temp_str), "Col #%u:", (unsigned)v);
|
||||
fprintf(stream, "%*s%-*s %9" PRIuHADDR "\n", indent + 6, "", MAX(0, fwidth - 6), temp_str,
|
||||
iblock->ents[off].addr);
|
||||
} /* end for */
|
||||
|
||||
+1
-1
@@ -178,7 +178,7 @@ H5HF_cmp_cparam_test(const H5HF_create_t *cparam1, const H5HF_create_t *cparam2)
|
||||
else if(cparam1->pline.filter[u].name && !cparam2->pline.filter[u].name)
|
||||
HGOTO_DONE(1);
|
||||
else if(cparam1->pline.filter[u].name && cparam2->pline.filter[u].name) {
|
||||
if((ret_value = HDstrcmp(cparam1->pline.filter[u].name, cparam2->pline.filter[u].name)))
|
||||
if((ret_value = strcmp(cparam1->pline.filter[u].name, cparam2->pline.filter[u].name)))
|
||||
HGOTO_DONE(ret_value);
|
||||
} /* end if */
|
||||
#endif
|
||||
|
||||
+3
-3
@@ -111,7 +111,7 @@ H5HG_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth)
|
||||
if (h->obj[u].begin) {
|
||||
char buf[64];
|
||||
|
||||
HDsnprintf(buf, sizeof(buf), "Object %u", u);
|
||||
snprintf(buf, sizeof(buf), "Object %u", u);
|
||||
fprintf(stream, "%*s%s\n", indent, "", buf);
|
||||
fprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MIN(fwidth - 3, 0),
|
||||
"Obffset in block:", (unsigned long)(h->obj[u].begin - h->chunk));
|
||||
@@ -129,12 +129,12 @@ H5HG_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth)
|
||||
if (j + k < h->obj[u].size)
|
||||
fprintf(stream, "%02x ", p[j + k]);
|
||||
else
|
||||
HDfputs(" ", stream);
|
||||
fputs(" ", stream);
|
||||
}
|
||||
for (k = 0; k < 16 && j + k < h->obj[u].size; k++) {
|
||||
if (8 == k)
|
||||
fprintf(stream, " ");
|
||||
HDfputc(p[j + k] > ' ' && p[j + k] <= '~' ? p[j + k] : '.', stream);
|
||||
fputc(p[j + k] > ' ' && p[j + k] <= '~' ? p[j + k] : '.', stream);
|
||||
}
|
||||
fprintf(stream, "\n");
|
||||
}
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ H5HL_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth)
|
||||
for (free_block = 0, freelist = h->freelist; freelist; freelist = freelist->next, free_block++) {
|
||||
char temp_str[32];
|
||||
|
||||
HDsnprintf(temp_str, sizeof(temp_str), "Block #%d:", free_block);
|
||||
snprintf(temp_str, sizeof(temp_str), "Block #%d:", free_block);
|
||||
fprintf(stream, "%*s%-*s %8zu, %8zu\n", indent + 3, "", MAX(0, fwidth - 9), temp_str,
|
||||
freelist->offset, freelist->size);
|
||||
if ((freelist->offset + freelist->size) > h->dblk_size)
|
||||
|
||||
@@ -665,8 +665,8 @@ H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_i
|
||||
HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, "can't normalize object name");
|
||||
|
||||
/* Combine the filename and link name into a single buffer to give to the UD link */
|
||||
file_name_len = HDstrlen(file_name) + 1;
|
||||
norm_obj_name_len = HDstrlen(norm_obj_name) + 1;
|
||||
file_name_len = strlen(file_name) + 1;
|
||||
norm_obj_name_len = strlen(norm_obj_name) + 1;
|
||||
buf_size = 1 + file_name_len + norm_obj_name_len;
|
||||
if (NULL == (ext_link_buf = H5MM_malloc(buf_size)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate udata buffer");
|
||||
@@ -674,9 +674,9 @@ H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_i
|
||||
/* Encode the external link information */
|
||||
p = (uint8_t *)ext_link_buf;
|
||||
*p++ = (H5L_EXT_VERSION << 4) | H5L_EXT_FLAGS_ALL; /* External link version & flags */
|
||||
HDstrncpy((char *)p, file_name, buf_size - 1); /* Name of file containing external link's object */
|
||||
strncpy((char *)p, file_name, buf_size - 1); /* Name of file containing external link's object */
|
||||
p += file_name_len;
|
||||
HDstrncpy((char *)p, norm_obj_name, buf_size - (file_name_len + 1)); /* External link's object */
|
||||
strncpy((char *)p, norm_obj_name, buf_size - (file_name_len + 1)); /* External link's object */
|
||||
|
||||
loc_params.type = H5VL_OBJECT_BY_NAME;
|
||||
loc_params.loc_data.loc_by_name.name = link_name;
|
||||
@@ -1982,10 +1982,10 @@ H5Lunpack_elink_val(const void *_ext_linkval, size_t link_size, unsigned *flags,
|
||||
if (ext_linkval[link_size - 1] != '\0')
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "linkval buffer is not NULL-terminated");
|
||||
|
||||
/* We're now guaranteed that HDstrlen won't segfault, since the buffer has
|
||||
/* We're now guaranteed that strlen won't segfault, since the buffer has
|
||||
* at least one NULL in it.
|
||||
*/
|
||||
len = HDstrlen((const char *)ext_linkval + 1);
|
||||
len = strlen((const char *)ext_linkval + 1);
|
||||
|
||||
/* If the first NULL we found was at the very end of the buffer, then
|
||||
* this external link value has no object name and is invalid.
|
||||
|
||||
+1
-1
@@ -132,7 +132,7 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, cons
|
||||
|
||||
/* Gather some information from the external link's user data */
|
||||
file_name = (const char *)p;
|
||||
fname_len = HDstrlen(file_name);
|
||||
fname_len = strlen(file_name);
|
||||
obj_name = (const char *)p + fname_len + 1;
|
||||
|
||||
/* Get the plist structure */
|
||||
|
||||
+5
-5
@@ -925,8 +925,8 @@ H5L__get_val_real(const H5O_link_t *lnk, void *buf, size_t size)
|
||||
if (H5L_TYPE_SOFT == lnk->type) {
|
||||
/* Copy to output buffer */
|
||||
if (size > 0 && buf) {
|
||||
HDstrncpy((char *)buf, lnk->u.soft.name, size);
|
||||
if (HDstrlen(lnk->u.soft.name) >= size)
|
||||
strncpy((char *)buf, lnk->u.soft.name, size);
|
||||
if (strlen(lnk->u.soft.name) >= size)
|
||||
((char *)buf)[size - 1] = '\0';
|
||||
} /* end if */
|
||||
} /* end if */
|
||||
@@ -1627,7 +1627,7 @@ H5L__exists_inter_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATT
|
||||
|
||||
/* Look for another separator */
|
||||
next = udata->sep;
|
||||
if (NULL == (udata->sep = HDstrchr(udata->sep, '/')))
|
||||
if (NULL == (udata->sep = strchr(udata->sep, '/')))
|
||||
cb_func = H5L__exists_final_cb;
|
||||
else {
|
||||
/* Chew through adjacent separators, if present */
|
||||
@@ -1693,7 +1693,7 @@ H5L_exists_tolerant(const H5G_loc_t *loc, const char *name, bool *exists)
|
||||
else {
|
||||
/* Set up user data & correct callback */
|
||||
udata.exists = exists;
|
||||
if (NULL == (udata.sep = HDstrchr(name_trav, '/')))
|
||||
if (NULL == (udata.sep = strchr(name_trav, '/')))
|
||||
cb_func = H5L__exists_final_cb;
|
||||
else {
|
||||
/* Chew through adjacent separators, if present */
|
||||
@@ -1742,7 +1742,7 @@ H5L__exists(const H5G_loc_t *loc, const char *name, bool *exists)
|
||||
assert(exists);
|
||||
|
||||
/* A path of "/" will always exist in a file */
|
||||
if (0 == HDstrcmp(name, "/"))
|
||||
if (0 == strcmp(name, "/"))
|
||||
*exists = true;
|
||||
else {
|
||||
/* Traverse the group hierarchy to locate the object to get info about */
|
||||
|
||||
+2
-2
@@ -112,7 +112,7 @@ H5MM_xstrdup(const char *s)
|
||||
FUNC_ENTER_NOAPI(NULL)
|
||||
|
||||
if (s)
|
||||
if (NULL == (ret_value = HDstrdup(s)))
|
||||
if (NULL == (ret_value = strdup(s)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "string duplication failed");
|
||||
done:
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
@@ -140,7 +140,7 @@ H5MM_strdup(const char *s)
|
||||
|
||||
if (!s)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "NULL string not allowed");
|
||||
if (NULL == (ret_value = HDstrdup(s)))
|
||||
if (NULL == (ret_value = strdup(s)))
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "string duplication failed");
|
||||
|
||||
done:
|
||||
|
||||
@@ -837,7 +837,7 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name specified");
|
||||
/* Avoid compiler warning on 32-bit machines */
|
||||
#if H5_SIZEOF_SIZE_T > H5_SIZEOF_INT32_T
|
||||
if (HDstrlen(new_name) > H5L_MAX_LINK_NAME_LEN)
|
||||
if (strlen(new_name) > H5L_MAX_LINK_NAME_LEN)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, FAIL, "name too long");
|
||||
#endif /* H5_SIZEOF_SIZE_T > H5_SIZEOF_INT32_T */
|
||||
if (lcpl_id != H5P_DEFAULT && (true != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
|
||||
|
||||
+5
-5
@@ -193,7 +193,7 @@ H5O__attr_decode(H5F_t *f, H5O_t *open_oh, unsigned H5_ATTR_UNUSED mesg_flags, u
|
||||
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed");
|
||||
|
||||
/* Make an attempt to detect corrupted name or name length - HDFFV-10588 */
|
||||
if (name_len != (HDstrnlen(attr->shared->name, name_len) + 1))
|
||||
if (name_len != (strnlen(attr->shared->name, name_len) + 1))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTDECODE, NULL, "attribute name has different length than stored length");
|
||||
|
||||
/* Determine pointer movement and check if it's valid */
|
||||
@@ -360,7 +360,7 @@ H5O__attr_encode(H5F_t *f, uint8_t *p, const void *mesg)
|
||||
* encoded lengths are exact but we pad each part except the data to be a
|
||||
* multiple of eight bytes (in the first version).
|
||||
*/
|
||||
name_len = HDstrlen(attr->shared->name) + 1;
|
||||
name_len = strlen(attr->shared->name) + 1;
|
||||
UINT16ENCODE(p, name_len);
|
||||
UINT16ENCODE(p, attr->shared->dt_size);
|
||||
UINT16ENCODE(p, attr->shared->ds_size);
|
||||
@@ -479,7 +479,7 @@ H5O__attr_size(const H5F_t H5_ATTR_UNUSED *f, const void *_mesg)
|
||||
2; /*space size */
|
||||
|
||||
/* Length of attribute name */
|
||||
name_len = HDstrlen(attr->shared->name) + 1;
|
||||
name_len = strlen(attr->shared->name) + 1;
|
||||
|
||||
/* Version-specific size information */
|
||||
if (attr->shared->version == H5O_ATTR_VERSION_1)
|
||||
@@ -831,13 +831,13 @@ H5O__attr_debug(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwidt
|
||||
case H5T_CSET_RESERVED_13:
|
||||
case H5T_CSET_RESERVED_14:
|
||||
case H5T_CSET_RESERVED_15:
|
||||
HDsnprintf(buf, sizeof(buf), "H5T_CSET_RESERVED_%d", (int)(mesg->shared->encoding));
|
||||
snprintf(buf, sizeof(buf), "H5T_CSET_RESERVED_%d", (int)(mesg->shared->encoding));
|
||||
s = buf;
|
||||
break;
|
||||
|
||||
case H5T_CSET_ERROR:
|
||||
default:
|
||||
HDsnprintf(buf, sizeof(buf), "Unknown character set: %d", (int)(mesg->shared->encoding));
|
||||
snprintf(buf, sizeof(buf), "Unknown character set: %d", (int)(mesg->shared->encoding));
|
||||
s = buf;
|
||||
break;
|
||||
} /* end switch */
|
||||
|
||||
+8
-8
@@ -401,7 +401,7 @@ H5O__attr_open_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned sequence,
|
||||
assert(!udata->attr);
|
||||
|
||||
/* Check for correct attribute message to modify */
|
||||
if (HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) {
|
||||
if (strcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) {
|
||||
/* Make a copy of the attribute to return */
|
||||
if (NULL == (udata->attr = H5A__copy(NULL, (H5A_t *)mesg->native)))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTCOPY, H5_ITER_ERROR, "unable to copy attribute");
|
||||
@@ -673,7 +673,7 @@ H5O__attr_find_opened_attr(const H5O_loc_t *loc, H5A_t **attr, const char *name_
|
||||
* address to which the attribute is attached, and file serial
|
||||
* number should all match.
|
||||
*/
|
||||
if (!HDstrcmp(name_to_open, (*attr)->shared->name) && loc->addr == (*attr)->oloc.addr &&
|
||||
if (!strcmp(name_to_open, (*attr)->shared->name) && loc->addr == (*attr)->oloc.addr &&
|
||||
loc_fnum == attr_fnum) {
|
||||
ret_value = true;
|
||||
break;
|
||||
@@ -784,7 +784,7 @@ H5O__attr_write_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR_UNUS
|
||||
assert(!udata->found);
|
||||
|
||||
/* Check for correct attribute message to modify */
|
||||
if (0 == HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->attr->shared->name)) {
|
||||
if (0 == strcmp(((H5A_t *)mesg->native)->shared->name, udata->attr->shared->name)) {
|
||||
/* Protect chunk */
|
||||
if (NULL == (chk_proxy = H5O__chunk_protect(udata->f, oh, mesg->chunkno)))
|
||||
HGOTO_ERROR(H5E_ATTR, H5E_CANTPROTECT, H5_ITER_ERROR, "unable to load object header chunk");
|
||||
@@ -935,7 +935,7 @@ H5O__attr_rename_chk_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg /*in,out*/,
|
||||
assert(!udata->found);
|
||||
|
||||
/* Check for existing attribute with new name */
|
||||
if (HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->new_name) == 0) {
|
||||
if (strcmp(((H5A_t *)mesg->native)->shared->name, udata->new_name) == 0) {
|
||||
/* Indicate that we found an existing attribute with the new name*/
|
||||
udata->found = true;
|
||||
|
||||
@@ -978,7 +978,7 @@ H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR
|
||||
assert(!udata->found);
|
||||
|
||||
/* Find correct attribute message to rename */
|
||||
if (HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->old_name) == 0) {
|
||||
if (strcmp(((H5A_t *)mesg->native)->shared->name, udata->old_name) == 0) {
|
||||
unsigned old_version = ((H5A_t *)mesg->native)->shared->version; /* Old version of the attribute */
|
||||
|
||||
/* Protect chunk */
|
||||
@@ -1015,7 +1015,7 @@ H5O__attr_rename_mod_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR
|
||||
assert(H5O_msg_is_shared(H5O_ATTR_ID, (H5A_t *)mesg->native) == false);
|
||||
|
||||
/* Check for attribute message changing size */
|
||||
if (HDstrlen(udata->new_name) != HDstrlen(udata->old_name) ||
|
||||
if (strlen(udata->new_name) != strlen(udata->old_name) ||
|
||||
old_version != ((H5A_t *)mesg->native)->shared->version) {
|
||||
H5A_t *attr; /* Attribute to re-add */
|
||||
|
||||
@@ -1421,7 +1421,7 @@ H5O__attr_remove_cb(H5O_t *oh, H5O_mesg_t *mesg /*in,out*/, unsigned H5_ATTR_UNU
|
||||
assert(!udata->found);
|
||||
|
||||
/* Check for correct attribute message to modify */
|
||||
if (HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) {
|
||||
if (strcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) {
|
||||
/* Convert message into a null message (i.e. delete it) */
|
||||
if (H5O__release_mesg(udata->f, oh, mesg, true) < 0)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_CANTDELETE, H5_ITER_ERROR, "unable to convert into null message");
|
||||
@@ -1679,7 +1679,7 @@ H5O__attr_exists_cb(H5O_t H5_ATTR_UNUSED *oh, H5O_mesg_t *mesg /*in,out*/, unsig
|
||||
assert(udata->exists && !*udata->exists);
|
||||
|
||||
/* Check for correct attribute message */
|
||||
if (HDstrcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) {
|
||||
if (strcmp(((H5A_t *)mesg->native)->shared->name, udata->name) == 0) {
|
||||
/* Indicate that this message is the attribute sought */
|
||||
*udata->exists = true;
|
||||
|
||||
|
||||
+2
-2
@@ -122,8 +122,8 @@ H5O__copy_obj_by_ref(H5O_loc_t *src_oloc, H5O_loc_t *dst_oloc, H5G_loc_t *dst_ro
|
||||
new_oloc.addr = dst_oloc->addr;
|
||||
|
||||
/* Pick a default name for the new object */
|
||||
HDsnprintf(tmp_obj_name, sizeof(tmp_obj_name), "~obj_pointed_by_%llu",
|
||||
(unsigned long long)dst_oloc->addr);
|
||||
snprintf(tmp_obj_name, sizeof(tmp_obj_name), "~obj_pointed_by_%llu",
|
||||
(unsigned long long)dst_oloc->addr);
|
||||
|
||||
/* Create a link to the newly copied object */
|
||||
/* Note: since H5O_copy_header_map actually copied the target object, it
|
||||
|
||||
+4
-4
@@ -309,16 +309,16 @@ H5O__debug_real(H5F_t *f, H5O_t *oh, haddr_t addr, FILE *stream, int indent, int
|
||||
|
||||
/* Time fields */
|
||||
tm = HDlocaltime(&oh->atime);
|
||||
HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
|
||||
strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
|
||||
fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Access Time:", buf);
|
||||
tm = HDlocaltime(&oh->mtime);
|
||||
HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
|
||||
strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
|
||||
fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Modification Time:", buf);
|
||||
tm = HDlocaltime(&oh->ctime);
|
||||
HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
|
||||
strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
|
||||
fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Change Time:", buf);
|
||||
tm = HDlocaltime(&oh->btime);
|
||||
HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
|
||||
strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
|
||||
fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Birth Time:", buf);
|
||||
} /* end if */
|
||||
|
||||
|
||||
+30
-32
@@ -339,7 +339,7 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t
|
||||
|
||||
size_t max = (size_t)(p_end - *pp + 1); /* Max possible name length */
|
||||
|
||||
actual_name_length = HDstrnlen((const char *)*pp, max);
|
||||
actual_name_length = strnlen((const char *)*pp, max);
|
||||
if (actual_name_length == max)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "field name not null terminated");
|
||||
}
|
||||
@@ -348,7 +348,7 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t
|
||||
* passed via H5Tdecode(), so don't bounds check and hope for
|
||||
* the best.
|
||||
*/
|
||||
actual_name_length = HDstrlen((const char *)*pp);
|
||||
actual_name_length = strlen((const char *)*pp);
|
||||
}
|
||||
|
||||
if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, actual_name_length, p_end))
|
||||
@@ -636,7 +636,7 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t
|
||||
|
||||
size_t max = (size_t)(p_end - *pp + 1); /* Max possible name length */
|
||||
|
||||
actual_name_length = HDstrnlen((const char *)*pp, max);
|
||||
actual_name_length = strnlen((const char *)*pp, max);
|
||||
if (actual_name_length == max)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, FAIL, "enum name not null terminated");
|
||||
}
|
||||
@@ -645,7 +645,7 @@ H5O__dtype_decode_helper(unsigned *ioflags /*in,out*/, const uint8_t **pp, H5T_t
|
||||
* passed via H5Tdecode(), so don't bounds check and hope for
|
||||
* the best.
|
||||
*/
|
||||
actual_name_length = HDstrlen((const char *)*pp);
|
||||
actual_name_length = strlen((const char *)*pp);
|
||||
}
|
||||
|
||||
if (H5_IS_KNOWN_BUFFER_OVERFLOW(skip, *pp, actual_name_length, p_end))
|
||||
@@ -1092,7 +1092,7 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt)
|
||||
{
|
||||
size_t aligned;
|
||||
|
||||
z = HDstrlen(dt->shared->u.opaque.tag);
|
||||
z = strlen(dt->shared->u.opaque.tag);
|
||||
aligned = (z + 7) & (H5T_OPAQUE_TAG_MAX - 8);
|
||||
flags = (unsigned)(flags | aligned);
|
||||
H5MM_memcpy(*pp, dt->shared->u.opaque.tag, MIN(z, aligned));
|
||||
@@ -1122,10 +1122,10 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt)
|
||||
assert(dt->shared->version >= dt->shared->u.compnd.memb[i].type->shared->version);
|
||||
|
||||
/* Name */
|
||||
HDstrcpy((char *)(*pp), dt->shared->u.compnd.memb[i].name);
|
||||
strcpy((char *)(*pp), dt->shared->u.compnd.memb[i].name);
|
||||
|
||||
/* Version 3 of the datatype message removed the padding to multiple of 8 bytes */
|
||||
n = HDstrlen(dt->shared->u.compnd.memb[i].name);
|
||||
n = strlen(dt->shared->u.compnd.memb[i].name);
|
||||
if (dt->shared->version >= H5O_DTYPE_VERSION_3)
|
||||
*pp += n + 1;
|
||||
else {
|
||||
@@ -1196,10 +1196,10 @@ H5O__dtype_encode_helper(uint8_t **pp, const H5T_t *dt)
|
||||
/* Names, each a multiple of eight bytes */
|
||||
for (i = 0; i < dt->shared->u.enumer.nmembs; i++) {
|
||||
/* Name */
|
||||
HDstrcpy((char *)(*pp), dt->shared->u.enumer.name[i]);
|
||||
strcpy((char *)(*pp), dt->shared->u.enumer.name[i]);
|
||||
|
||||
/* Version 3 of the datatype message removed the padding to multiple of 8 bytes */
|
||||
n = HDstrlen(dt->shared->u.enumer.name[i]);
|
||||
n = strlen(dt->shared->u.enumer.name[i]);
|
||||
if (dt->shared->version >= H5O_DTYPE_VERSION_3)
|
||||
*pp += n + 1;
|
||||
else {
|
||||
@@ -1485,7 +1485,7 @@ H5O__dtype_size(const H5F_t *f, const void *_mesg)
|
||||
break;
|
||||
|
||||
case H5T_OPAQUE:
|
||||
ret_value += (HDstrlen(dt->shared->u.opaque.tag) + 7) & (H5T_OPAQUE_TAG_MAX - 8);
|
||||
ret_value += (strlen(dt->shared->u.opaque.tag) + 7) & (H5T_OPAQUE_TAG_MAX - 8);
|
||||
break;
|
||||
|
||||
case H5T_COMPOUND: {
|
||||
@@ -1499,7 +1499,7 @@ H5O__dtype_size(const H5F_t *f, const void *_mesg)
|
||||
size_t name_len; /* Length of field's name */
|
||||
|
||||
/* Get length of field's name */
|
||||
name_len = HDstrlen(dt->shared->u.compnd.memb[u].name);
|
||||
name_len = strlen(dt->shared->u.compnd.memb[u].name);
|
||||
|
||||
/* Versions of the format >= 3 don't pad out the name */
|
||||
if (dt->shared->version >= H5O_DTYPE_VERSION_3)
|
||||
@@ -1530,7 +1530,7 @@ H5O__dtype_size(const H5F_t *f, const void *_mesg)
|
||||
size_t name_len; /* Length of field's name */
|
||||
|
||||
/* Get length of field's name */
|
||||
name_len = HDstrlen(dt->shared->u.enumer.name[u]);
|
||||
name_len = strlen(dt->shared->u.enumer.name[u]);
|
||||
|
||||
/* Versions of the format >= 3 don't pad out the name */
|
||||
if (dt->shared->version >= H5O_DTYPE_VERSION_3)
|
||||
@@ -1915,7 +1915,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt
|
||||
case H5T_NO_CLASS:
|
||||
case H5T_NCLASSES:
|
||||
default:
|
||||
HDsnprintf(buf, sizeof(buf), "H5T_CLASS_%d", (int)(dt->shared->type));
|
||||
snprintf(buf, sizeof(buf), "H5T_CLASS_%d", (int)(dt->shared->type));
|
||||
s = buf;
|
||||
break;
|
||||
} /* end switch */
|
||||
@@ -1930,7 +1930,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt
|
||||
fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
|
||||
"Number of members:", dt->shared->u.compnd.nmembs);
|
||||
for (i = 0; i < dt->shared->u.compnd.nmembs; i++) {
|
||||
HDsnprintf(buf, sizeof(buf), "Member %u:", i);
|
||||
snprintf(buf, sizeof(buf), "Member %u:", i);
|
||||
fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, buf, dt->shared->u.compnd.memb[i].name);
|
||||
fprintf(stream, "%*s%-*s %lu\n", indent + 3, "", MAX(0, fwidth - 3),
|
||||
"Byte offset:", (unsigned long)(dt->shared->u.compnd.memb[i].offset));
|
||||
@@ -1943,7 +1943,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt
|
||||
fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
|
||||
"Number of members:", dt->shared->u.enumer.nmembs);
|
||||
for (i = 0; i < dt->shared->u.enumer.nmembs; i++) {
|
||||
HDsnprintf(buf, sizeof(buf), "Member %u:", i);
|
||||
snprintf(buf, sizeof(buf), "Member %u:", i);
|
||||
fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, buf, dt->shared->u.enumer.name[i]);
|
||||
fprintf(stream, "%*s%-*s 0x", indent, "", fwidth, "Raw bytes of value:");
|
||||
for (k = 0; k < dt->shared->parent->shared->size; k++)
|
||||
@@ -1983,14 +1983,13 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt
|
||||
case H5T_CSET_RESERVED_13:
|
||||
case H5T_CSET_RESERVED_14:
|
||||
case H5T_CSET_RESERVED_15:
|
||||
HDsnprintf(buf, sizeof(buf), "H5T_CSET_RESERVED_%d", (int)(dt->shared->u.atomic.u.s.cset));
|
||||
snprintf(buf, sizeof(buf), "H5T_CSET_RESERVED_%d", (int)(dt->shared->u.atomic.u.s.cset));
|
||||
s = buf;
|
||||
break;
|
||||
|
||||
case H5T_CSET_ERROR:
|
||||
default:
|
||||
HDsnprintf(buf, sizeof(buf), "Unknown character set: %d",
|
||||
(int)(dt->shared->u.atomic.u.s.cset));
|
||||
snprintf(buf, sizeof(buf), "Unknown character set: %d", (int)(dt->shared->u.atomic.u.s.cset));
|
||||
s = buf;
|
||||
break;
|
||||
} /* end switch */
|
||||
@@ -2022,14 +2021,13 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt
|
||||
case H5T_STR_RESERVED_13:
|
||||
case H5T_STR_RESERVED_14:
|
||||
case H5T_STR_RESERVED_15:
|
||||
HDsnprintf(buf, sizeof(buf), "H5T_STR_RESERVED_%d", (int)(dt->shared->u.atomic.u.s.pad));
|
||||
snprintf(buf, sizeof(buf), "H5T_STR_RESERVED_%d", (int)(dt->shared->u.atomic.u.s.pad));
|
||||
s = buf;
|
||||
break;
|
||||
|
||||
case H5T_STR_ERROR:
|
||||
default:
|
||||
HDsnprintf(buf, sizeof(buf), "Unknown string padding: %d",
|
||||
(int)(dt->shared->u.atomic.u.s.pad));
|
||||
snprintf(buf, sizeof(buf), "Unknown string padding: %d", (int)(dt->shared->u.atomic.u.s.pad));
|
||||
s = buf;
|
||||
break;
|
||||
} /* end switch */
|
||||
@@ -2048,7 +2046,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt
|
||||
case H5T_VLEN_BADTYPE:
|
||||
case H5T_VLEN_MAXTYPE:
|
||||
default:
|
||||
HDsnprintf(buf, sizeof(buf), "H5T_VLEN_%d", dt->shared->u.vlen.type);
|
||||
snprintf(buf, sizeof(buf), "H5T_VLEN_%d", dt->shared->u.vlen.type);
|
||||
s = buf;
|
||||
break;
|
||||
} /* end switch */
|
||||
@@ -2066,7 +2064,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt
|
||||
case H5T_LOC_BADLOC:
|
||||
case H5T_LOC_MAXLOC:
|
||||
default:
|
||||
HDsnprintf(buf, sizeof(buf), "H5T_LOC_%d", (int)dt->shared->u.vlen.loc);
|
||||
snprintf(buf, sizeof(buf), "H5T_LOC_%d", (int)dt->shared->u.vlen.loc);
|
||||
s = buf;
|
||||
break;
|
||||
} /* end switch */
|
||||
@@ -2097,13 +2095,13 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt
|
||||
case H5T_CSET_RESERVED_13:
|
||||
case H5T_CSET_RESERVED_14:
|
||||
case H5T_CSET_RESERVED_15:
|
||||
HDsnprintf(buf, sizeof(buf), "H5T_CSET_RESERVED_%d", (int)(dt->shared->u.vlen.cset));
|
||||
snprintf(buf, sizeof(buf), "H5T_CSET_RESERVED_%d", (int)(dt->shared->u.vlen.cset));
|
||||
s = buf;
|
||||
break;
|
||||
|
||||
case H5T_CSET_ERROR:
|
||||
default:
|
||||
HDsnprintf(buf, sizeof(buf), "Unknown character set: %d", (int)(dt->shared->u.vlen.cset));
|
||||
snprintf(buf, sizeof(buf), "Unknown character set: %d", (int)(dt->shared->u.vlen.cset));
|
||||
s = buf;
|
||||
break;
|
||||
} /* end switch */
|
||||
@@ -2135,13 +2133,13 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt
|
||||
case H5T_STR_RESERVED_13:
|
||||
case H5T_STR_RESERVED_14:
|
||||
case H5T_STR_RESERVED_15:
|
||||
HDsnprintf(buf, sizeof(buf), "H5T_STR_RESERVED_%d", (int)(dt->shared->u.vlen.pad));
|
||||
snprintf(buf, sizeof(buf), "H5T_STR_RESERVED_%d", (int)(dt->shared->u.vlen.pad));
|
||||
s = buf;
|
||||
break;
|
||||
|
||||
case H5T_STR_ERROR:
|
||||
default:
|
||||
HDsnprintf(buf, sizeof(buf), "Unknown string padding: %d", (int)(dt->shared->u.vlen.pad));
|
||||
snprintf(buf, sizeof(buf), "Unknown string padding: %d", (int)(dt->shared->u.vlen.pad));
|
||||
s = buf;
|
||||
break;
|
||||
} /* end switch */
|
||||
@@ -2181,7 +2179,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt
|
||||
|
||||
case H5T_ORDER_ERROR:
|
||||
default:
|
||||
HDsnprintf(buf, sizeof(buf), "H5T_ORDER_%d", dt->shared->u.atomic.order);
|
||||
snprintf(buf, sizeof(buf), "H5T_ORDER_%d", dt->shared->u.atomic.order);
|
||||
s = buf;
|
||||
break;
|
||||
} /* end switch */
|
||||
@@ -2255,9 +2253,9 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt
|
||||
case H5T_NPAD:
|
||||
default:
|
||||
if (dt->shared->u.atomic.u.f.pad < 0)
|
||||
HDsnprintf(buf, sizeof(buf), "H5T_PAD_%d", -(dt->shared->u.atomic.u.f.pad));
|
||||
snprintf(buf, sizeof(buf), "H5T_PAD_%d", -(dt->shared->u.atomic.u.f.pad));
|
||||
else
|
||||
HDsnprintf(buf, sizeof(buf), "bit-%d", dt->shared->u.atomic.u.f.pad);
|
||||
snprintf(buf, sizeof(buf), "bit-%d", dt->shared->u.atomic.u.f.pad);
|
||||
s = buf;
|
||||
break;
|
||||
} /* end switch */
|
||||
@@ -2278,7 +2276,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt
|
||||
|
||||
case H5T_NORM_ERROR:
|
||||
default:
|
||||
HDsnprintf(buf, sizeof(buf), "H5T_NORM_%d", (int)(dt->shared->u.atomic.u.f.norm));
|
||||
snprintf(buf, sizeof(buf), "H5T_NORM_%d", (int)(dt->shared->u.atomic.u.f.norm));
|
||||
s = buf;
|
||||
} /* end switch */
|
||||
fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Normalization:", s);
|
||||
@@ -2315,7 +2313,7 @@ H5O__dtype_debug(H5F_t *f, const void *mesg, FILE *stream, int indent, int fwidt
|
||||
case H5T_SGN_ERROR:
|
||||
case H5T_NSGN:
|
||||
default:
|
||||
HDsnprintf(buf, sizeof(buf), "H5T_SGN_%d", (int)(dt->shared->u.atomic.u.i.sign));
|
||||
snprintf(buf, sizeof(buf), "H5T_SGN_%d", (int)(dt->shared->u.atomic.u.i.sign));
|
||||
s = buf;
|
||||
break;
|
||||
} /* end switch */
|
||||
|
||||
+3
-3
@@ -450,7 +450,7 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d
|
||||
/* Determine size needed for destination heap */
|
||||
heap_size = H5HL_ALIGN(1); /* "empty" name */
|
||||
for (idx = 0; idx < efl_src->nused; idx++)
|
||||
heap_size += H5HL_ALIGN(HDstrlen(efl_src->slot[idx].name) + 1);
|
||||
heap_size += H5HL_ALIGN(strlen(efl_src->slot[idx].name) + 1);
|
||||
|
||||
/* Create name heap */
|
||||
if (H5HL_create(file_dst, heap_size, &efl_dst->heap_addr /*out*/) < 0)
|
||||
@@ -478,7 +478,7 @@ H5O__efl_copy_file(H5F_t H5_ATTR_UNUSED *file_src, void *mesg_src, H5F_t *file_d
|
||||
/* copy the name from the source */
|
||||
for (idx = 0; idx < efl_src->nused; idx++) {
|
||||
efl_dst->slot[idx].name = H5MM_xstrdup(efl_src->slot[idx].name);
|
||||
if (H5HL_insert(file_dst, heap, HDstrlen(efl_dst->slot[idx].name) + 1, efl_dst->slot[idx].name,
|
||||
if (H5HL_insert(file_dst, heap, strlen(efl_dst->slot[idx].name) + 1, efl_dst->slot[idx].name,
|
||||
&(efl_dst->slot[idx].name_offset)) < 0)
|
||||
HGOTO_ERROR(H5E_EFL, H5E_CANTINSERT, NULL, "can't insert file name into heap");
|
||||
}
|
||||
@@ -529,7 +529,7 @@ H5O__efl_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int ind
|
||||
for (u = 0; u < mesg->nused; u++) {
|
||||
char buf[64];
|
||||
|
||||
HDsnprintf(buf, sizeof(buf), "File %zu", u);
|
||||
snprintf(buf, sizeof(buf), "File %zu", u);
|
||||
fprintf(stream, "%*s%s:\n", indent, "", buf);
|
||||
|
||||
fprintf(stream, "%*s%-*s \"%s\"\n", indent + 3, "", MAX(fwidth - 3, 0), "Name:", mesg->slot[u].name);
|
||||
|
||||
+2
-2
@@ -604,7 +604,7 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU
|
||||
"ran off end of input buffer while decoding");
|
||||
|
||||
/* Source file name */
|
||||
tmp_size = HDstrnlen((const char *)heap_block_p, (size_t)avail_buffer_space);
|
||||
tmp_size = strnlen((const char *)heap_block_p, (size_t)avail_buffer_space);
|
||||
if (tmp_size == (size_t)avail_buffer_space)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL,
|
||||
"ran off end of input buffer while decoding - unterminated source "
|
||||
@@ -625,7 +625,7 @@ H5O__layout_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU
|
||||
"ran off end of input buffer while decoding");
|
||||
|
||||
/* Source dataset name */
|
||||
tmp_size = HDstrnlen((const char *)heap_block_p, (size_t)avail_buffer_space);
|
||||
tmp_size = strnlen((const char *)heap_block_p, (size_t)avail_buffer_space);
|
||||
if (tmp_size == (size_t)avail_buffer_space)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL,
|
||||
"ran off end of input buffer while decoding - unterminated source "
|
||||
|
||||
+6
-6
@@ -303,7 +303,7 @@ H5O__link_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const
|
||||
assert(lnk);
|
||||
|
||||
/* Get length of link's name */
|
||||
len = (uint64_t)HDstrlen(lnk->name);
|
||||
len = (uint64_t)strlen(lnk->name);
|
||||
assert(len > 0);
|
||||
|
||||
/* encode */
|
||||
@@ -370,7 +370,7 @@ H5O__link_encode(H5F_t *f, bool H5_ATTR_UNUSED disable_shared, uint8_t *p, const
|
||||
|
||||
case H5L_TYPE_SOFT:
|
||||
/* Store the link value */
|
||||
len = (uint16_t)HDstrlen(lnk->u.soft.name);
|
||||
len = (uint16_t)strlen(lnk->u.soft.name);
|
||||
assert(len > 0);
|
||||
UINT16ENCODE(p, len);
|
||||
H5MM_memcpy(p, lnk->u.soft.name, (size_t)len);
|
||||
@@ -486,7 +486,7 @@ H5O__link_size(const H5F_t *f, bool H5_ATTR_UNUSED disable_shared, const void *_
|
||||
HDcompile_assert(sizeof(uint64_t) >= sizeof(size_t));
|
||||
|
||||
/* Get name's length */
|
||||
name_len = (uint64_t)HDstrlen(lnk->name);
|
||||
name_len = (uint64_t)strlen(lnk->name);
|
||||
|
||||
/* Determine correct value for name size bits */
|
||||
if (name_len > 4294967295)
|
||||
@@ -514,8 +514,8 @@ H5O__link_size(const H5F_t *f, bool H5_ATTR_UNUSED disable_shared, const void *_
|
||||
break;
|
||||
|
||||
case H5L_TYPE_SOFT:
|
||||
ret_value += 2 + /* Link value length */
|
||||
HDstrlen(lnk->u.soft.name); /* Link value */
|
||||
ret_value += 2 + /* Link value length */
|
||||
strlen(lnk->u.soft.name); /* Link value */
|
||||
break;
|
||||
|
||||
case H5L_TYPE_ERROR:
|
||||
@@ -816,7 +816,7 @@ H5O__link_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int in
|
||||
if (lnk->type >= H5L_TYPE_UD_MIN) {
|
||||
if (lnk->type == H5L_TYPE_EXTERNAL) {
|
||||
const char *objname =
|
||||
(const char *)lnk->u.ud.udata + (HDstrlen((const char *)lnk->u.ud.udata) + 1);
|
||||
(const char *)lnk->u.ud.udata + (strlen((const char *)lnk->u.ud.udata) + 1);
|
||||
|
||||
fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
|
||||
"External File Name:", (const char *)lnk->u.ud.udata);
|
||||
|
||||
+3
-3
@@ -271,8 +271,8 @@ H5O__mtime_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, u
|
||||
|
||||
/* encode */
|
||||
tm = HDgmtime(mesg);
|
||||
HDsprintf((char *)p, "%04d%02d%02d%02d%02d%02d", 1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday,
|
||||
tm->tm_hour, tm->tm_min, tm->tm_sec);
|
||||
sprintf((char *)p, "%04d%02d%02d%02d%02d%02d", 1900 + tm->tm_year, 1 + tm->tm_mon, tm->tm_mday,
|
||||
tm->tm_hour, tm->tm_min, tm->tm_sec);
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5O__mtime_encode() */
|
||||
@@ -416,7 +416,7 @@ H5O__mtime_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE *stream, int i
|
||||
/* debug */
|
||||
tm = HDlocaltime(mesg);
|
||||
|
||||
HDstrftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
|
||||
strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %Z", tm);
|
||||
fprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Time:", buf);
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
|
||||
+2
-2
@@ -122,7 +122,7 @@ H5O__name_encode(H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared, ui
|
||||
assert(mesg && mesg->s);
|
||||
|
||||
/* encode */
|
||||
HDstrcpy((char *)p, mesg->s);
|
||||
strcpy((char *)p, mesg->s);
|
||||
|
||||
FUNC_LEAVE_NOAPI(SUCCEED)
|
||||
} /* end H5O__name_encode() */
|
||||
@@ -196,7 +196,7 @@ H5O__name_size(const H5F_t H5_ATTR_UNUSED *f, bool H5_ATTR_UNUSED disable_shared
|
||||
assert(f);
|
||||
assert(mesg);
|
||||
|
||||
ret_value = mesg->s ? HDstrlen(mesg->s) + 1 : 0;
|
||||
ret_value = mesg->s ? strlen(mesg->s) + 1 : 0;
|
||||
|
||||
FUNC_LEAVE_NOAPI(ret_value)
|
||||
} /* end H5O__name_size() */
|
||||
|
||||
+8
-8
@@ -192,7 +192,7 @@ H5O__pline_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsign
|
||||
size_t max = (size_t)(p_end - p + 1); /* Max possible name length */
|
||||
|
||||
/* Determine actual name length (without padding, but with null terminator) */
|
||||
actual_name_length = HDstrnlen((const char *)p, max);
|
||||
actual_name_length = strnlen((const char *)p, max);
|
||||
if (actual_name_length == max)
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_NOSPACE, NULL, "filter name not null terminated");
|
||||
actual_name_length += 1; /* include \0 byte */
|
||||
@@ -206,7 +206,7 @@ H5O__pline_decode(H5F_t H5_ATTR_UNUSED *f, H5O_t H5_ATTR_UNUSED *open_oh, unsign
|
||||
else
|
||||
filter->name = filter->_name;
|
||||
|
||||
HDstrncpy(filter->name, (const char *)p, actual_name_length);
|
||||
strncpy(filter->name, (const char *)p, actual_name_length);
|
||||
|
||||
if (H5_IS_BUFFER_OVERFLOW(p, name_length, p_end))
|
||||
HGOTO_ERROR(H5E_OHDR, H5E_OVERFLOW, NULL, "ran off end of input buffer while decoding");
|
||||
@@ -311,7 +311,7 @@ H5O__pline_encode(H5F_t H5_ATTR_UNUSED *f, uint8_t *p /*out*/, const void *mesg)
|
||||
*/
|
||||
if (NULL == (name = filter->name) && (cls = H5Z_find(filter->id)))
|
||||
name = cls->name;
|
||||
name_length = name ? HDstrlen(name) + 1 : 0;
|
||||
name_length = name ? strlen(name) + 1 : 0;
|
||||
|
||||
/* Filter name length */
|
||||
UINT16ENCODE(p, pline->version == H5O_PLINE_VERSION_1 ? H5O_ALIGN_OLD(name_length) : name_length);
|
||||
@@ -394,7 +394,7 @@ H5O__pline_copy(const void *_src, void *_dst /*out*/)
|
||||
if (src->filter[i].name) {
|
||||
size_t namelen; /* Length of source filter name, including null terminator */
|
||||
|
||||
namelen = HDstrlen(src->filter[i].name) + 1;
|
||||
namelen = strlen(src->filter[i].name) + 1;
|
||||
|
||||
/* Allocate space for the filter name, or use the internal buffer */
|
||||
if (namelen > H5Z_COMMON_NAME_LEN) {
|
||||
@@ -478,7 +478,7 @@ H5O__pline_size(const H5F_t H5_ATTR_UNUSED *f, const void *mesg)
|
||||
/* Get the name of the filter, same as done with H5O__pline_encode() */
|
||||
if (NULL == (name = pline->filter[i].name) && (cls = H5Z_find(pline->filter[i].id)))
|
||||
name = cls->name;
|
||||
name_len = name ? HDstrlen(name) + 1 : 0;
|
||||
name_len = name ? strlen(name) + 1 : 0;
|
||||
} /* end else */
|
||||
|
||||
ret_value +=
|
||||
@@ -529,7 +529,7 @@ H5O__pline_reset(void *mesg)
|
||||
/* Free information for each filter */
|
||||
for (i = 0; i < pline->nused; i++) {
|
||||
if (pline->filter[i].name && pline->filter[i].name != pline->filter[i]._name)
|
||||
assert((HDstrlen(pline->filter[i].name) + 1) > H5Z_COMMON_NAME_LEN);
|
||||
assert((strlen(pline->filter[i].name) + 1) > H5Z_COMMON_NAME_LEN);
|
||||
if (pline->filter[i].name != pline->filter[i]._name)
|
||||
pline->filter[i].name = (char *)H5MM_xfree(pline->filter[i].name);
|
||||
if (pline->filter[i].cd_values && pline->filter[i].cd_values != pline->filter[i]._cd_values)
|
||||
@@ -652,7 +652,7 @@ H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int in
|
||||
char name[64];
|
||||
|
||||
memset(name, 0, 64);
|
||||
HDsnprintf(name, sizeof(name), "Filter at position %zu", i);
|
||||
snprintf(name, sizeof(name), "Filter at position %zu", i);
|
||||
|
||||
fprintf(stream, "%*s%-*s\n", indent, "", fwidth, name);
|
||||
fprintf(stream, "%*s%-*s 0x%04x\n", indent + 3, "", MAX(0, fwidth - 3),
|
||||
@@ -671,7 +671,7 @@ H5O__pline_debug(H5F_t H5_ATTR_UNUSED *f, const void *mesg, FILE *stream, int in
|
||||
for (size_t j = 0; j < pline->filter[i].cd_nelmts; j++) {
|
||||
char field_name[32];
|
||||
|
||||
HDsnprintf(field_name, sizeof(field_name), "CD value %lu", (unsigned long)j);
|
||||
snprintf(field_name, sizeof(field_name), "CD value %lu", (unsigned long)j);
|
||||
fprintf(stream, "%*s%-*s %u\n", indent + 6, "", MAX(0, fwidth - 6), field_name,
|
||||
pline->filter[i].cd_values[j]);
|
||||
}
|
||||
|
||||
+6
-6
@@ -143,7 +143,7 @@ H5PLappend(const char *search_path)
|
||||
/* Check args */
|
||||
if (NULL == search_path)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot be NULL");
|
||||
if (0 == HDstrlen(search_path))
|
||||
if (0 == strlen(search_path))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot have length zero");
|
||||
|
||||
/* Append the search path to the path table */
|
||||
@@ -175,7 +175,7 @@ H5PLprepend(const char *search_path)
|
||||
/* Check args */
|
||||
if (NULL == search_path)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot be NULL");
|
||||
if (0 == HDstrlen(search_path))
|
||||
if (0 == strlen(search_path))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot have length zero");
|
||||
|
||||
/* Prepend the search path to the path table */
|
||||
@@ -208,7 +208,7 @@ H5PLreplace(const char *search_path, unsigned int idx)
|
||||
/* Check args */
|
||||
if (NULL == search_path)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot be NULL");
|
||||
if (0 == HDstrlen(search_path))
|
||||
if (0 == strlen(search_path))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot have length zero");
|
||||
|
||||
/* Check index */
|
||||
@@ -250,7 +250,7 @@ H5PLinsert(const char *search_path, unsigned int idx)
|
||||
/* Check args */
|
||||
if (NULL == search_path)
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot be NULL");
|
||||
if (0 == HDstrlen(search_path))
|
||||
if (0 == strlen(search_path))
|
||||
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "plugin_path parameter cannot have length zero");
|
||||
|
||||
/* Check index */
|
||||
@@ -355,11 +355,11 @@ H5PLget(unsigned int idx, char *path_buf, size_t buf_size)
|
||||
/* Get the path at the specified index and its length */
|
||||
if (NULL == (path = H5PL__get_path(idx)))
|
||||
HGOTO_ERROR(H5E_PLUGIN, H5E_BADVALUE, (-1), "no path stored at that index");
|
||||
path_len = HDstrlen(path);
|
||||
path_len = strlen(path);
|
||||
|
||||
/* If the path buffer is not NULL, copy the path to the buffer */
|
||||
if (path_buf) {
|
||||
HDstrncpy(path_buf, path, buf_size);
|
||||
strncpy(path_buf, path, buf_size);
|
||||
if ((size_t)path_len >= buf_size)
|
||||
path_buf[buf_size - 1] = '\0';
|
||||
} /* end if */
|
||||
|
||||
+1
-1
@@ -141,7 +141,7 @@ H5PL_init(void)
|
||||
* H5PLpublic.h) means we don't want to load plugins.
|
||||
*/
|
||||
if (NULL != (env_var = HDgetenv(HDF5_PLUGIN_PRELOAD)))
|
||||
if (!HDstrcmp(env_var, H5PL_NO_PLUGIN)) {
|
||||
if (!strcmp(env_var, H5PL_NO_PLUGIN)) {
|
||||
H5PL_plugin_control_mask_g = 0;
|
||||
H5PL_allow_plugins_g = false;
|
||||
}
|
||||
|
||||
+28
-28
@@ -109,7 +109,7 @@ H5PL__insert_at(const char *path, unsigned int idx)
|
||||
|
||||
/* Check args - Just assert on package functions */
|
||||
assert(path);
|
||||
assert(HDstrlen(path));
|
||||
assert(strlen(path));
|
||||
|
||||
/* Expand the table if it is full */
|
||||
if (H5PL_num_paths_g == H5PL_path_capacity_g)
|
||||
@@ -190,7 +190,7 @@ H5PL__replace_at(const char *path, unsigned int idx)
|
||||
|
||||
/* Check args - Just assert on package functions */
|
||||
assert(path);
|
||||
assert(HDstrlen(path));
|
||||
assert(strlen(path));
|
||||
|
||||
/* Check that the table entry is in use */
|
||||
if (!H5PL_paths_g[idx])
|
||||
@@ -387,7 +387,7 @@ H5PL__append_path(const char *path)
|
||||
|
||||
/* Check args - Just assert on package functions */
|
||||
assert(path);
|
||||
assert(HDstrlen(path));
|
||||
assert(strlen(path));
|
||||
|
||||
/* Insert the path at the end of the table */
|
||||
if (H5PL__insert_at(path, H5PL_num_paths_g) < 0)
|
||||
@@ -415,7 +415,7 @@ H5PL__prepend_path(const char *path)
|
||||
|
||||
/* Check args - Just assert on package functions */
|
||||
assert(path);
|
||||
assert(HDstrlen(path));
|
||||
assert(strlen(path));
|
||||
|
||||
/* Insert the path at the beginning of the table */
|
||||
if (H5PL__insert_at(path, 0) < 0)
|
||||
@@ -443,7 +443,7 @@ H5PL__replace_path(const char *path, unsigned int idx)
|
||||
|
||||
/* Check args - Just assert on package functions */
|
||||
assert(path);
|
||||
assert(HDstrlen(path));
|
||||
assert(strlen(path));
|
||||
assert(idx < H5PL_path_capacity_g);
|
||||
|
||||
/* Insert the path at the requested index */
|
||||
@@ -473,7 +473,7 @@ H5PL__insert_path(const char *path, unsigned int idx)
|
||||
|
||||
/* Check args - Just assert on package functions */
|
||||
assert(path);
|
||||
assert(HDstrlen(path));
|
||||
assert(strlen(path));
|
||||
assert(idx < H5PL_path_capacity_g);
|
||||
|
||||
/* Insert the path at the requested index */
|
||||
@@ -625,10 +625,10 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type
|
||||
* or libxxx.xxx.dylib on Mac.
|
||||
*/
|
||||
#ifndef __CYGWIN__
|
||||
if (!HDstrncmp(dp->d_name, "lib", (size_t)3) &&
|
||||
(HDstrstr(dp->d_name, ".so") || HDstrstr(dp->d_name, ".dylib"))) {
|
||||
if (!strncmp(dp->d_name, "lib", (size_t)3) &&
|
||||
(strstr(dp->d_name, ".so") || strstr(dp->d_name, ".dylib"))) {
|
||||
#else
|
||||
if (!HDstrncmp(dp->d_name, "cyg", (size_t)3) && HDstrstr(dp->d_name, ".dll")) {
|
||||
if (!strncmp(dp->d_name, "cyg", (size_t)3) && strstr(dp->d_name, ".dll")) {
|
||||
#endif
|
||||
|
||||
bool plugin_matches;
|
||||
@@ -636,18 +636,18 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type
|
||||
size_t len;
|
||||
|
||||
/* Allocate & initialize the path name */
|
||||
len = HDstrlen(plugin_path) + HDstrlen(H5PL_PATH_SEPARATOR) + HDstrlen(dp->d_name) + 1 /*\0*/ +
|
||||
len = strlen(plugin_path) + strlen(H5PL_PATH_SEPARATOR) + strlen(dp->d_name) + 1 /*\0*/ +
|
||||
4; /* Extra "+4" to quiet GCC warning - 2019/07/05, QAK */
|
||||
|
||||
if (NULL == (path = (char *)H5MM_calloc(len)))
|
||||
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, H5_ITER_ERROR, "can't allocate memory for path");
|
||||
|
||||
HDsnprintf(path, len, "%s/%s", plugin_path, dp->d_name);
|
||||
snprintf(path, len, "%s/%s", plugin_path, dp->d_name);
|
||||
|
||||
/* Get info for directory entry */
|
||||
if (HDstat(path, &my_stat) == -1)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5_ITER_ERROR, "can't stat file %s -- error was: %s", path,
|
||||
HDstrerror(errno));
|
||||
strerror(errno));
|
||||
|
||||
/* If it is a directory, skip it */
|
||||
if (S_ISDIR(my_stat.st_mode))
|
||||
@@ -681,7 +681,7 @@ done:
|
||||
if (dirp)
|
||||
if (HDclosedir(dirp) < 0)
|
||||
HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, H5_ITER_ERROR, "can't close directory: %s",
|
||||
HDstrerror(errno));
|
||||
strerror(errno));
|
||||
|
||||
path = (char *)H5MM_xfree(path);
|
||||
|
||||
@@ -709,24 +709,24 @@ H5PL__path_table_iterate_process_path(const char *plugin_path, H5PL_iterate_type
|
||||
|
||||
/* Specify a file mask. *.* = We want everything! -
|
||||
* skip the path if the directory can't be opened */
|
||||
HDsnprintf(service, sizeof(service), "%s\\*.dll", plugin_path);
|
||||
snprintf(service, sizeof(service), "%s\\*.dll", plugin_path);
|
||||
if ((hFind = FindFirstFileA(service, &fdFile)) == INVALID_HANDLE_VALUE)
|
||||
HGOTO_DONE(H5_ITER_CONT);
|
||||
|
||||
/* Loop over all the files */
|
||||
do {
|
||||
/* Ignore '.' and '..' */
|
||||
if (HDstrcmp(fdFile.cFileName, ".") != 0 && HDstrcmp(fdFile.cFileName, "..") != 0) {
|
||||
if (strcmp(fdFile.cFileName, ".") != 0 && strcmp(fdFile.cFileName, "..") != 0) {
|
||||
bool plugin_matches;
|
||||
size_t len;
|
||||
|
||||
/* Allocate & initialize the path name */
|
||||
len = HDstrlen(plugin_path) + HDstrlen(H5PL_PATH_SEPARATOR) + HDstrlen(fdFile.cFileName) + 1;
|
||||
len = strlen(plugin_path) + strlen(H5PL_PATH_SEPARATOR) + strlen(fdFile.cFileName) + 1;
|
||||
|
||||
if (NULL == (path = (char *)H5MM_calloc(len)))
|
||||
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, H5_ITER_ERROR, "can't allocate memory for path");
|
||||
|
||||
HDsnprintf(path, len, "%s\\%s", plugin_path, fdFile.cFileName);
|
||||
snprintf(path, len, "%s\\%s", plugin_path, fdFile.cFileName);
|
||||
|
||||
/* Ignore directories */
|
||||
if (fdFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
@@ -863,28 +863,28 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, bool *found
|
||||
* or libxxx.xxx.dylib on Mac.
|
||||
*/
|
||||
#ifndef __CYGWIN__
|
||||
if (!HDstrncmp(dp->d_name, "lib", (size_t)3) &&
|
||||
(HDstrstr(dp->d_name, ".so") || HDstrstr(dp->d_name, ".dylib"))) {
|
||||
if (!strncmp(dp->d_name, "lib", (size_t)3) &&
|
||||
(strstr(dp->d_name, ".so") || strstr(dp->d_name, ".dylib"))) {
|
||||
#else
|
||||
if (!HDstrncmp(dp->d_name, "cyg", (size_t)3) && HDstrstr(dp->d_name, ".dll")) {
|
||||
if (!strncmp(dp->d_name, "cyg", (size_t)3) && strstr(dp->d_name, ".dll")) {
|
||||
#endif
|
||||
|
||||
h5_stat_t my_stat;
|
||||
size_t len;
|
||||
|
||||
/* Allocate & initialize the path name */
|
||||
len = HDstrlen(dir) + HDstrlen(H5PL_PATH_SEPARATOR) + HDstrlen(dp->d_name) + 1 /*\0*/ +
|
||||
len = strlen(dir) + strlen(H5PL_PATH_SEPARATOR) + strlen(dp->d_name) + 1 /*\0*/ +
|
||||
4; /* Extra "+4" to quiet GCC warning - 2019/07/05, QAK */
|
||||
|
||||
if (NULL == (path = (char *)H5MM_calloc(len)))
|
||||
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path");
|
||||
|
||||
HDsnprintf(path, len, "%s/%s", dir, dp->d_name);
|
||||
snprintf(path, len, "%s/%s", dir, dp->d_name);
|
||||
|
||||
/* Get info for directory entry */
|
||||
if (HDstat(path, &my_stat) == -1)
|
||||
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't stat file %s -- error was: %s", path,
|
||||
HDstrerror(errno));
|
||||
strerror(errno));
|
||||
|
||||
/* If it is a directory, skip it */
|
||||
if (S_ISDIR(my_stat.st_mode)) {
|
||||
@@ -905,7 +905,7 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, bool *found
|
||||
done:
|
||||
if (dirp)
|
||||
if (HDclosedir(dirp) < 0)
|
||||
HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, FAIL, "can't close directory: %s", HDstrerror(errno));
|
||||
HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, FAIL, "can't close directory: %s", strerror(errno));
|
||||
|
||||
path = (char *)H5MM_xfree(path);
|
||||
|
||||
@@ -934,26 +934,26 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, bool *found
|
||||
*found = false;
|
||||
|
||||
/* Specify a file mask. *.* = We want everything! */
|
||||
HDsnprintf(service, sizeof(service), "%s\\*.dll", dir);
|
||||
snprintf(service, sizeof(service), "%s\\*.dll", dir);
|
||||
if ((hFind = FindFirstFileA(service, &fdFile)) == INVALID_HANDLE_VALUE)
|
||||
HGOTO_ERROR(H5E_PLUGIN, H5E_OPENERROR, FAIL, "can't open directory");
|
||||
|
||||
/* Loop over all the files */
|
||||
do {
|
||||
/* Ignore '.' and '..' */
|
||||
if (HDstrcmp(fdFile.cFileName, ".") != 0 && HDstrcmp(fdFile.cFileName, "..") != 0) {
|
||||
if (strcmp(fdFile.cFileName, ".") != 0 && strcmp(fdFile.cFileName, "..") != 0) {
|
||||
|
||||
/* XXX: Probably just continue here and move the code below over one tab */
|
||||
|
||||
size_t len;
|
||||
|
||||
/* Allocate & initialize the path name */
|
||||
len = HDstrlen(dir) + HDstrlen(H5PL_PATH_SEPARATOR) + HDstrlen(fdFile.cFileName) + 1;
|
||||
len = strlen(dir) + strlen(H5PL_PATH_SEPARATOR) + strlen(fdFile.cFileName) + 1;
|
||||
|
||||
if (NULL == (path = (char *)H5MM_calloc(len)))
|
||||
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path");
|
||||
|
||||
HDsnprintf(path, len, "%s\\%s", dir, fdFile.cFileName);
|
||||
snprintf(path, len, "%s\\%s", dir, fdFile.cFileName);
|
||||
|
||||
/* Ignore directories */
|
||||
if (fdFile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
|
||||
@@ -284,7 +284,7 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, bool *foun
|
||||
continue;
|
||||
|
||||
/* Check if specified VOL connector name matches cache entry's name */
|
||||
if (!HDstrcmp(search_params->key->vol.u.name, H5PL_cache_g[u].key.vol.u.name))
|
||||
if (!strcmp(search_params->key->vol.u.name, H5PL_cache_g[u].key.vol.u.name))
|
||||
matched = true;
|
||||
}
|
||||
else {
|
||||
@@ -308,7 +308,7 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, bool *foun
|
||||
continue;
|
||||
|
||||
/* Check if specified VFD name matches cache entry's name */
|
||||
if (!HDstrcmp(search_params->key->vfd.u.name, H5PL_cache_g[u].key.vfd.u.name))
|
||||
if (!strcmp(search_params->key->vfd.u.name, H5PL_cache_g[u].key.vfd.u.name))
|
||||
matched = true;
|
||||
}
|
||||
else {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user