HD prefix and whitespace

This commit is contained in:
Allen Byrne 2018-08-28 10:54:42 -05:00
parent 553b1a01f8
commit 27af9a7922
24 changed files with 2323 additions and 2826 deletions

View File

@ -241,7 +241,7 @@ herr_t H5DSattach_scale(hid_t did,
if (has_dimlist == 0)
{
dims[0] = (hsize_t)rank;
dims[0] = (hsize_t)rank;
/* space for the attribute */
if((sid = H5Screate_simple(1, dims, NULL)) < 0)
@ -556,9 +556,9 @@ out:
*
* Date: December 20, 2004
*
* Comments:
* Comments:
*
* Modifications: Function didn't delete DIMENSION_LIST attribute, when
* Modifications: Function didn't delete DIMENSION_LIST attribute, when
* all dimension scales were detached from a dataset; added.
* 2010/05/13 EIP
*
@ -706,24 +706,24 @@ herr_t H5DSdetach_scale(hid_t did,
/* same object, reset */
if(dsid_oi.fileno == tmp_oi.fileno && dsid_oi.addr == tmp_oi.addr)
{
/* If there are more than one reference in the VL element
/* If there are more than one reference in the VL element
and the reference we found is not the last one,
copy the last one to replace the found one since the order
of the references doesn't matter according to the spec;
reduce the size of the VL element by 1;
if the length of the element becomes 0, free the pointer
of the references doesn't matter according to the spec;
reduce the size of the VL element by 1;
if the length of the element becomes 0, free the pointer
and reset to NULL */
size_t len = buf[idx].len;
if(j < len - 1)
((hobj_ref_t *)buf[idx].p)[j] = ((hobj_ref_t *)buf[idx].p)[len-1];
if(j < len - 1)
((hobj_ref_t *)buf[idx].p)[j] = ((hobj_ref_t *)buf[idx].p)[len-1];
len = --buf[idx].len;
if(len == 0) {
HDfree(buf[idx].p);
HDfree(buf[idx].p);
buf[idx].p = NULL;
}
/* Since a reference to a dim. scale can be inserted only once,
/* Since a reference to a dim. scale can be inserted only once,
we do not need to continue the search if it is found */
found_ds = 1;
break;
@ -736,16 +736,16 @@ herr_t H5DSdetach_scale(hid_t did,
goto out;
/* Write the attribute, but check first, if we have any scales left,
because if not, we should delete the attribute according to the spec */
because if not, we should delete the attribute according to the spec */
for(i = 0; i < rank; i++) {
if(buf[i].len > 0) {
have_ds = 1;
break;
break;
}
}
if(have_ds) {
if(have_ds) {
if(H5Awrite(aid, tid, buf) < 0)
goto out;
goto out;
}
else {
if(H5Adelete(did, DIMENSION_LIST) < 0)
@ -1123,7 +1123,7 @@ htri_t H5DSis_attached(hid_t did,
if (dsbuf == NULL)
goto out;
if (H5Aread(aid,ntid,dsbuf) < 0)
if (H5Aread(aid,ntid,dsbuf) < 0)
goto out;
/*-------------------------------------------------------------------------
@ -1445,7 +1445,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
if (H5I_DATASET != it)
return FAIL;
if (label == NULL)
if (label == NULL)
return FAIL;
/* get dataset space */
@ -1502,7 +1502,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
goto out;
for (i = 0; i < (unsigned int) rank; i++)
u.const_buf[i] = NULL;
u.const_buf[i] = NULL;
/* store the label information in the required index */
u.const_buf[idx] = label;
@ -1532,7 +1532,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
else
{
if ((aid = H5Aopen(did, DIMENSION_LABELS, H5P_DEFAULT)) < 0)
goto out;
@ -1541,7 +1541,7 @@ herr_t H5DSset_label(hid_t did, unsigned int idx, const char *label)
/* allocate and initialize */
u.buf = (char **) HDmalloc((size_t) rank * sizeof(char *));
if (u.buf == NULL)
goto out;
@ -1626,7 +1626,7 @@ out:
* Comments:
*
* Modifications:
* JIRA HDFFV-7673: Added a check to see if the label name exists,
* JIRA HDFFV-7673: Added a check to see if the label name exists,
* if not then returns zero. July 30, 2011. MSB
*
*-------------------------------------------------------------------------
@ -1714,26 +1714,26 @@ ssize_t H5DSget_label(hid_t did, unsigned int idx, char *label, size_t size)
if (buf[idx] != NULL)
{
/* get the real string length */
nbytes = strlen(buf[idx]);
nbytes = HDstrlen(buf[idx]);
/* compute the string length which will fit into the user's buffer */
copy_len = MIN(size-1, nbytes);
/* compute the string length which will fit into the user's buffer */
copy_len = MIN(size-1, nbytes);
/* copy all/some of the name */
if (label)
{
memcpy(label, buf[idx], copy_len);
/* terminate the string */
label[copy_len] = '\0';
}
/* copy all/some of the name */
if (label)
{
HDmemcpy(label, buf[idx], copy_len);
/* terminate the string */
label[copy_len] = '\0';
}
}
/* free all the ptr's from the H5Aread() */
for (i = 0; i < rank; i++)
{
if (buf[i])
HDfree(buf[i]);
HDfree(buf[i]);
}
/* close */
@ -1867,7 +1867,7 @@ ssize_t H5DSget_scale_name(hid_t did,
/* copy all/some of the name */
if (name) {
memcpy(name, buf, copy_len);
HDmemcpy(name, buf, copy_len);
/* terminate the string */
name[copy_len]='\0';
@ -1951,33 +1951,33 @@ htri_t H5DSis_scale(hid_t did)
if((tid = H5Aget_type(aid)) < 0)
goto out;
/* check to make sure attribute is a string */
if(H5T_STRING != H5Tget_class(tid))
goto out;
/* check to make sure attribute is a string */
if(H5T_STRING != H5Tget_class(tid))
goto out;
/* check to make sure string is null-terminated */
if(H5T_STR_NULLTERM != H5Tget_strpad(tid))
goto out;
/* check to make sure string is null-terminated */
if(H5T_STR_NULLTERM != H5Tget_strpad(tid))
goto out;
/* allocate buffer large enough to hold string */
if((storage_size = H5Aget_storage_size(aid)) == 0)
goto out;
/* allocate buffer large enough to hold string */
if((storage_size = H5Aget_storage_size(aid)) == 0)
goto out;
buf = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1);
if(buf == NULL)
goto out;
buf = (char*)HDmalloc( (size_t)storage_size * sizeof(char) + 1);
if(buf == NULL)
goto out;
/* Read the attribute */
/* Read the attribute */
if(H5Aread(aid, tid, buf) < 0)
goto out;
goto out;
/* compare strings */
/* compare strings */
if(HDstrncmp(buf, DIMENSION_SCALE_CLASS, MIN(HDstrlen(DIMENSION_SCALE_CLASS),HDstrlen(buf)))==0)
is_ds = 1;
else
is_ds = 0;
HDfree(buf);
HDfree(buf);
if(H5Tclose(tid) < 0)
goto out;
@ -2236,8 +2236,8 @@ out:
static
hid_t H5DS_get_REFLIST_type(void)
{
hid_t ntid_t = -1;
hid_t ntid_t = -1;
/* Build native type that corresponds to compound datatype
used to store ds_list_t structure in the REFERENCE_LIST
attribute */
@ -2257,5 +2257,5 @@ out:
H5Tclose(ntid_t);
} H5E_END_TRY;
return FAIL;
}
}

View File

@ -186,11 +186,11 @@ int main(void)
if(nerrors) goto error;
printf("All dimension scales tests passed.\n");
HDprintf("All dimension scales tests passed.\n");
return 0;
error:
printf("***** %d DIMENSION SCALES TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S");
HDprintf("***** %d DIMENSION SCALES TEST%s FAILED! *****\n",nerrors, 1 == nerrors ? "" : "S");
return 1;
}
@ -1110,7 +1110,7 @@ herr_t test_cmp_scalename(hid_t fid, hid_t did, const char *name, const char *sc
if((dsid = H5Dopen2(fid, name, H5P_DEFAULT)) >= 0) {
if(H5DSis_attached(did, dsid, idx) == 1) {
if((name_len=H5DSget_scale_name(dsid,NULL,(size_t)0)) > 0) {
name_out = (char*)HDmalloc(((size_t)name_len+1) * sizeof (char));
name_out = (char*)HDmalloc(((size_t)name_len+1) * sizeof (char));
if(name_out != NULL) {
if(H5DSget_scale_name(dsid, name_out, (size_t)name_len+1) >= 0) {
if(HDstrncmp(scalename, name_out, (size_t)name_len)==0) {
@ -1156,7 +1156,7 @@ static int test_detachscales(void)
sprintf(dname,"D%d", i);
if(H5LTmake_dataset_int(fid, dname, rank3, dims, buf) < 0)
goto out;
}
}
/* create datasets and make them dim. scales */
for (i=0; i < 4; i++) {
@ -1164,11 +1164,11 @@ static int test_detachscales(void)
if(H5LTmake_dataset_int(fid, dname, rank1, dims, buf) < 0)
goto out;
}
/* attach scales to the first dataset; first dimension will have
/* attach scales to the first dataset; first dimension will have
two scales attached */
if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) >= 0) {
for (i=0; i<4; i++) {
sprintf(dname, "DS%d", i);
HDsprintf(dname, "DS%d", i);
if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
goto out;
if(H5DSattach_scale(did, dsid, (unsigned int) i%3) < 0)
@ -1185,7 +1185,7 @@ static int test_detachscales(void)
/* attach scales to the second dataset */
if((did = H5Dopen2(fid, "D1", H5P_DEFAULT)) >= 0) {
for (i=0; i<3; i++) {
sprintf(dname, "DS%d", i);
HDsprintf(dname, "DS%d", i);
if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
goto out;
if(H5DSattach_scale(did, dsid, (unsigned int) i) < 0)
@ -1206,20 +1206,20 @@ static int test_detachscales(void)
goto out;
for (i=0; i<2; i++) {
sprintf(dname, "D%d", i);
HDsprintf(dname, "D%d", i);
if((did = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
goto out;
if(H5DSdetach_scale(did, dsid, (unsigned int)0) < 0)
goto out;
if(H5Dclose(did) < 0)
goto out;
}
}
/* Check that attribute "REFERENCE_LIST" doesn't exist anymore */
if(H5Aexists(dsid, REFERENCE_LIST)!= 0)
goto out;
if(H5Dclose(dsid) < 0)
goto out;
/* Check that DS3 is the only dim. scale attached to the first
/* Check that DS3 is the only dim. scale attached to the first
dimension of D0 */
if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) < 0)
goto out;
@ -1232,11 +1232,11 @@ static int test_detachscales(void)
if(H5Dclose(dsid) < 0)
goto out;
/* Detach the rest of the scales DS3, DS1, DS2 from D0 and make
/* Detach the rest of the scales DS3, DS1, DS2 from D0 and make
sure that attribute "DIMENSION_LIST" doesn't exist anymore */
if((did = H5Dopen2(fid, "D0", H5P_DEFAULT)) >= 0) {
for (i=1; i<4; i++) {
sprintf(dname, "DS%d", i);
HDsprintf(dname, "DS%d", i);
if((dsid = H5Dopen2(fid, dname, H5P_DEFAULT)) < 0)
goto out;
if(H5DSdetach_scale(did, dsid, (unsigned int) i%3) < 0)
@ -1253,7 +1253,7 @@ static int test_detachscales(void)
else
goto out;
PASSED();
H5Fclose(fid);
@ -2873,10 +2873,10 @@ static int test_simple(void)
if((sid = H5Screate_simple(rank,dims,NULL)) < 0)
goto out;
for(i = 0; i < 5; i++) {
sprintf(dname,"dset_%d",i);
HDsprintf(dname,"dset_%d",i);
if((did = H5Dcreate2(gid, dname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
sprintf(sname,"ds_%d",i);
HDsprintf(sname,"ds_%d",i);
if((dsid = H5Dcreate2(gid, sname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5DSset_scale(dsid,"scale") < 0)
@ -2893,11 +2893,11 @@ static int test_simple(void)
*/
for(i = 0; i < 5; i++) {
sprintf(dname, "dset_%d", i);
HDsprintf(dname, "dset_%d", i);
if((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0)
goto out;
for(j = 0; j < 5; j++) {
sprintf(sname, "ds_%d", j);
HDsprintf(sname, "ds_%d", j);
if((dsid = H5Dopen2(gid, sname, H5P_DEFAULT)) < 0)
goto out;
if(H5DSattach_scale(did, dsid, DIM0) < 0)
@ -2915,7 +2915,7 @@ static int test_simple(void)
*/
for(i = 0; i < 5; i++) {
sprintf(dname, "dset_%d", i);
HDsprintf(dname, "dset_%d", i);
if((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0)
goto out;
for(j = 0; j < 5; j++) {
@ -2938,7 +2938,7 @@ static int test_simple(void)
*/
for(i=0; i<5; i++) {
sprintf(dname,"dset_%d",i);
HDsprintf(dname,"dset_%d",i);
if((did = H5Dopen2(gid,dname, H5P_DEFAULT)) < 0)
goto out;
for(j=0; j<5; j++) {
@ -3541,7 +3541,7 @@ static herr_t read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor
for(i=0; i<nelmts; i++) {
if(buf[i] != data[i]) {
printf("read and write buffers differ\n");
HDprintf("read and write buffers differ\n");
goto out;
}
}
@ -5014,7 +5014,7 @@ static int test_errors2(void)
goto out;
if ((label_len=H5DSget_label(did,0,NULL,0)) < 0)
goto out;
if ( label_len != strlen("label") )
if ( label_len != HDstrlen("label") )
goto out;
if (H5DSget_label(did,0,lbuf,sizeof(lbuf)) < 0)
goto out;
@ -5134,83 +5134,83 @@ static int test_attach_detach(void)
if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
if((sid = H5Screate_simple(1, dims, dims)) < 0)
if((sid = H5Screate_simple(1, dims, dims)) < 0)
goto out;
if((dsid = H5Dcreate2(gid, DS_3_NAME, H5T_IEEE_F32BE, sid,
H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0)
goto out;
if(H5Sclose(sid) < 0)
if(H5Sclose(sid) < 0)
goto out;
if(H5Pclose(dcpl_id) < 0)
if(H5Pclose(dcpl_id) < 0)
goto out;
if(H5DSset_scale(dsid, DS_3_NAME) < 0)
if(H5DSset_scale(dsid, DS_3_NAME) < 0)
goto out;
/* Create a variable that uses this dimension scale. */
if((sid = H5Screate_simple(DIM1, dims, dims)) < 0)
if((sid = H5Screate_simple(DIM1, dims, dims)) < 0)
goto out;
if((var1_id = H5Dcreate2(gid, DS_31_NAME, H5T_NATIVE_FLOAT, sid,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if(H5Sclose(sid) < 0)
if(H5Sclose(sid) < 0)
goto out;
if(H5DSattach_scale(var1_id, dsid, 0) < 0)
if(H5DSattach_scale(var1_id, dsid, 0) < 0)
goto out;
/* Create another variable that uses this dimension scale. */
if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0)
if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0)
goto out;
if((sid = H5Screate_simple(DIM1, dims, dims)) < 0)
if((sid = H5Screate_simple(DIM1, dims, dims)) < 0)
goto out;
if((var2_id = H5Dcreate2(gid, DS_32_NAME, H5T_NATIVE_FLOAT, sid,
H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0)
H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0)
goto out;
if(H5Pclose(dcpl_id) < 0)
if(H5Pclose(dcpl_id) < 0)
goto out;
if(H5Sclose(sid) < 0)
if(H5Sclose(sid) < 0)
goto out;
/* Create 3rd variable that uses this dimension scale. */
if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
if((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0)
goto out;
if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0)
if(H5Pset_attr_creation_order(dcpl_id, H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED) < 0)
goto out;
if((sid = H5Screate_simple(DIM1, dims, dims)) < 0)
if((sid = H5Screate_simple(DIM1, dims, dims)) < 0)
goto out;
if((var3_id = H5Dcreate2(gid, DS_33_NAME, H5T_NATIVE_FLOAT, sid,
H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0)
H5P_DEFAULT, H5P_DEFAULT,H5P_DEFAULT)) < 0)
goto out;
if(H5Pclose(dcpl_id) < 0)
if(H5Pclose(dcpl_id) < 0)
goto out;
if(H5Sclose(sid) < 0)
if(H5Sclose(sid) < 0)
goto out;
/* Attached var2 scale */
if(H5DSattach_scale(var2_id, dsid, 0) < 0)
if(H5DSattach_scale(var2_id, dsid, 0) < 0)
goto out;
/* Detach the var2 scale */
if(H5DSdetach_scale(var2_id, dsid, 0) < 0)
if(H5DSdetach_scale(var2_id, dsid, 0) < 0)
goto out;
/* Check if in correct state of detached and attached */
@ -5220,7 +5220,7 @@ static int test_attach_detach(void)
goto out;
/* Detach the var1 scale */
if(H5DSdetach_scale(var1_id, dsid, 0) < 0)
if(H5DSdetach_scale(var1_id, dsid, 0) < 0)
goto out;
/* Check if in correct state of detached and attached */
@ -5231,10 +5231,10 @@ static int test_attach_detach(void)
/* Attach the DS again and remove them in the opposite order */
if(H5DSattach_scale(var1_id, dsid, 0) < 0)
if(H5DSattach_scale(var1_id, dsid, 0) < 0)
goto out;
if(H5DSattach_scale(var2_id, dsid, 0) < 0)
if(H5DSattach_scale(var2_id, dsid, 0) < 0)
goto out;
/* Detach the var1 scale */
@ -5262,13 +5262,13 @@ static int test_attach_detach(void)
* Attach Three DS and remove the middle one first
*****************************************************/
if(H5DSattach_scale(var1_id, dsid, 0) < 0)
if(H5DSattach_scale(var1_id, dsid, 0) < 0)
goto out;
if(H5DSattach_scale(var2_id, dsid, 0) < 0)
if(H5DSattach_scale(var2_id, dsid, 0) < 0)
goto out;
if(H5DSattach_scale(var3_id, dsid, 0) < 0)
if(H5DSattach_scale(var3_id, dsid, 0) < 0)
goto out;
@ -5314,15 +5314,15 @@ static int test_attach_detach(void)
*-------------------------------------------------------------------------
*/
if(H5Dclose(var1_id) < 0)
if(H5Dclose(var1_id) < 0)
goto out;
if(H5Dclose(var2_id) < 0)
if(H5Dclose(var2_id) < 0)
goto out;
if(H5Dclose(var3_id) < 0)
if(H5Dclose(var3_id) < 0)
goto out;
if(H5Dclose(dsid) < 0)
if(H5Dclose(dsid) < 0)
goto out;
if(H5Gclose(gid) < 0)
if(H5Gclose(gid) < 0)
goto out;
if(H5Fclose(fid) < 0)
goto out;

View File

@ -1050,7 +1050,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name )
HDfree( dims_out );
return -1;
}
for (i = 0; i < rank_out; i++) {
if ( dims_out[i] != 5 ) {
HDfree( dims_out );
@ -1152,7 +1152,7 @@ static int test_fps(void)
if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0)
goto out;
if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char))))
goto out;
if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) {
@ -1228,7 +1228,7 @@ static int test_strings(void)
goto out;
}
if(HDstrcmp(dt_str, "H5T_STRING {\n STRSIZE 13;\n STRPAD H5T_STR_NULLTERM;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) {
printf("dt=\n%s\n", dt_str);
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
@ -1260,7 +1260,7 @@ static int test_strings(void)
goto out;
}
if(HDstrcmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) {
printf("dt=\n%s\n", dt_str);
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
@ -1270,13 +1270,13 @@ static int test_strings(void)
str_len = str_len + 10;
if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char))))
goto out;
if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) {
HDfree(dt_str);
goto out;
}
if(HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", str_len-1)) {
printf("dt=\n%s\n", dt_str);
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
@ -1292,10 +1292,10 @@ static int test_strings(void)
goto out;
}
/* check the truncated string */
if(strlen(dt_str) != str_len-1) goto out;
str_len = strlen(dt_str);
if(HDstrlen(dt_str) != str_len-1) goto out;
str_len = HDstrlen(dt_str);
if(HDstrncmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }", str_len)) {
printf("dt=\n%s\n", dt_str);
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
@ -1352,7 +1352,7 @@ static int test_opaques(void)
goto out;
}
if(HDstrcmp(dt_str, "H5T_OPAQUE {\n OPQ_SIZE 19;\n OPQ_TAG \"This is a tag for opaque type\";\n }")) {
printf("dt=\n%s\n", dt_str);
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
@ -1428,7 +1428,7 @@ static int test_enums(void)
}
if(HDstrcmp(dt_str, "H5T_ENUM {\n H5T_STD_I32LE;\n \"RED\" 5;\n \"GREEN\" 6;\n \"BLUE\" 7;\n \"WHITE\" 8;\n }")) {
printf("dt=\n%s\n", dt_str);
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
@ -1469,16 +1469,16 @@ static int test_variables(void)
if(H5Tis_variable_str(dtype))
goto out;
if(H5Tclose(dtype)<0)
goto out;
if((dtype = H5LTtext_to_dtype("H5T_VLEN { H5T_VLEN { H5T_STD_I32BE } }", H5LT_DDL))<0)
goto out;
if(H5Tis_variable_str(dtype))
goto out;
if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0)
goto out;
if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char))))
@ -1488,15 +1488,15 @@ static int test_variables(void)
goto out;
}
if(HDstrcmp(dt_str, "H5T_VLEN {\n H5T_VLEN {\n H5T_STD_I32BE\n }\n }")) {
printf("dt=\n%s\n", dt_str);
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
HDfree(dt_str);
if(H5Tclose(dtype)<0)
goto out;
PASSED();
return 0;
@ -1547,7 +1547,7 @@ static int test_arrays(void)
goto out;
}
if(HDstrcmp(dt_str, "H5T_ARRAY {\n [5][7][13] H5T_ARRAY {\n [17][19] H5T_COMPOUND {\n H5T_STD_I8BE \"arr_compound_1\" : 0;\n H5T_STD_I32BE \"arr_compound_2\" : 1;\n }\n }\n }")) {
printf("dt=\n%s\n", dt_str);
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
@ -1603,7 +1603,7 @@ static int test_compounds(void)
goto out;
}
if(HDstrcmp(dt_str, "H5T_COMPOUND {\n H5T_STD_I16BE \"one_field\" : 2;\n H5T_STD_U8LE \"two_field\" : 6;\n }")) {
printf("dt=\n%s\n", dt_str);
HDprintf("dt=\n%s\n", dt_str);
HDfree(dt_str);
goto out;
}
@ -1637,7 +1637,7 @@ out:
}
/*-------------------------------------------------------------------------
* subroutine for test_text_dtype(): test_compound_bug(). Test case for
* subroutine for test_text_dtype(): test_compound_bug(). Test case for
* issue 7701.
*-------------------------------------------------------------------------
*/
@ -1770,7 +1770,7 @@ static int test_complicated_compound(void)
/* Open input file */
fp = HDfopen(filename, "r");
if(fp == NULL) {
printf( "Could not find file %s. Try set $srcdir \n", filename);
HDprintf( "Could not find file %s. Try set $srcdir \n", filename);
goto out;
}
@ -1881,9 +1881,9 @@ static int test_valid_path(void)
hid_t file_id, group;
htri_t path_valid;
const char *data_string_in = "test";
TESTING("H5LTpath_valid");
/* Create a new file using default properties. */
/**************************************************************
@ -1908,11 +1908,11 @@ static int test_valid_path(void)
* |
* |
* | --- Gcyc (soft link to /G1)
* / \
* / \
* G5 \
* / \
* / \
* G5 \
* (soft link G6 (external link /G1 in FILENAME4)
* to /G2)
* to /G2)
*
****************************************************************/
@ -1941,7 +1941,7 @@ static int test_valid_path(void)
*/
if(H5LTmake_dataset_string(group, "/G2/DS4", data_string_in)<0)
goto out;
/*
* Create a soft link
*/
@ -2023,9 +2023,9 @@ static int test_valid_path(void)
* |
* |
* |
* G1
* G1
* / \
* / \
* / \
* DS1 G2
* (dangled soft link to /G1/G20)
*
@ -2056,13 +2056,13 @@ static int test_valid_path(void)
goto out;
H5Fclose(file_id);
/* Open input file */
if((file_id = H5Fopen(FILE_NAME3,H5F_ACC_RDONLY, H5P_DEFAULT))<0)
goto out;
/**************************************
* CHECK ABSOLUTE PATHS
* CHECK ABSOLUTE PATHS
**************************************/
if( (path_valid = H5LTpath_valid(file_id, "/", TRUE)) != TRUE) {
@ -2076,7 +2076,7 @@ static int test_valid_path(void)
if( (path_valid = H5LTpath_valid(file_id, "/G1", TRUE)) != TRUE) {
goto out;
}
if((path_valid = H5LTpath_valid(file_id, "/G1/DS1", TRUE)) != TRUE)
goto out;
@ -2094,7 +2094,7 @@ static int test_valid_path(void)
if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/Gcyc/DS1", TRUE)) != TRUE)
goto out;
if( (path_valid = H5LTpath_valid(file_id, "/G2", TRUE)) != TRUE)
goto out;
@ -2114,14 +2114,14 @@ static int test_valid_path(void)
/* check soft links */
if( (path_valid = H5LTpath_valid(file_id, "/G1/G2/G5/DS4", TRUE)) != TRUE)
goto out;
/**************************************
* CHECK RELATIVE PATHS
* CHECK RELATIVE PATHS
***************************************/
if( (group = H5Gopen2(file_id, "/", H5P_DEFAULT)) < 0)
goto out;
if( (path_valid = H5LTpath_valid(group, "/", TRUE)) != TRUE) {
goto out;
}
@ -2156,22 +2156,22 @@ static int test_valid_path(void)
goto out;
if( (path_valid = H5LTpath_valid(group, "G2/G5", TRUE)) != TRUE)
goto out;
goto out;
/* Check the "./" case */
if( (path_valid = H5LTpath_valid(group, "./DS3", TRUE)) != TRUE)
goto out;
if( (path_valid = H5LTpath_valid(group, "./G2/G5", TRUE)) != TRUE)
goto out;
goto out;
/* Should fail, does not exist */
if( (path_valid = H5LTpath_valid(group, "./G2/G20", FALSE)) == TRUE)
goto out;
goto out;
/* Should fail, does not exist */
if( (path_valid = H5LTpath_valid(group, "./G2/G20", TRUE)) == TRUE)
goto out;
goto out;
if(H5Gclose(group)<0)
goto out;
@ -2220,7 +2220,7 @@ static int test_valid_path(void)
PASSED();
return 0;
out:
out:
H5_FAILED();
return -1;
}

View File

@ -34,13 +34,13 @@ nerrors=0
# where the libs exist
HDFLIB_HOME="$top_srcdir/java/lib"
BLDLIBDIR="$top_builddir/hdf5/lib"
BLDREFDIR="./groups"
BLDITERDIR="./groups"
BLDDIR="."
HDFTEST_HOME="$top_srcdir/java/examples/groups"
JARFILE=jar@PACKAGE_TARNAME@-@PACKAGE_VERSION@.jar
TESTJARFILE=jar@PACKAGE_TARNAME@groups.jar
test -d $BLDLIBDIR || mkdir -p $BLDLIBDIR
test -d $BLDREFDIR || mkdir -p $BLDREFDIR
test -d $BLDITERDIR || mkdir -p $BLDITERDIR
######################################################################
# library files
@ -59,9 +59,11 @@ LIST_JAR_TESTFILES="
$HDFLIB_HOME/slf4j-api-1.7.25.jar
$HDFLIB_HOME/ext/slf4j-simple-1.7.25.jar
"
LIST_DATA_FILES="
LIST_ITER_FILES="
$HDFTEST_HOME/h5ex_g_iterate.h5
$HDFTEST_HOME/h5ex_g_visit.h5
"
LIST_DATA_FILES="
$HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Create.txt
$HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Iterate.txt
$HDFTEST_HOME/../testfiles/examples.groups.H5Ex_G_Compact.txt
@ -146,6 +148,7 @@ CLEAN_LIBFILES_AND_BLDLIBDIR()
}
COPY_DATAFILES="$LIST_DATA_FILES"
COPY_ITERFILES="$LIST_ITER_FILES"
COPY_DATAFILES_TO_BLDDIR()
{
@ -190,12 +193,12 @@ CLEAN_DATAFILES_AND_BLDDIR()
fi
}
COPY_REFFILES="$LIST_REF_FILES"
COPY_ITERFILES="$LIST_ITER_FILES"
COPY_REFFILES_TO_BLDREFDIR()
COPY_ITERFILES_TO_BLDITERDIR()
{
# copy test files. Used -f to make sure get a new copy
for tstfile in $COPY_REFFILES
for tstfile in $COPY_ITERFILES
do
# ignore '#' comment
echo $tstfile | tr -d ' ' | grep '^#' > /dev/null
@ -206,9 +209,9 @@ COPY_REFFILES_TO_BLDREFDIR()
# make cp fail
SDIR=`$DIRNAME $tstfile`
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $BLDREFDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $BLDITERDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
$CP -f $tstfile $BLDREFDIR
$CP -f $tstfile $BLDITERDIR
if [ $? -ne 0 ]; then
echo "Error: FAILED to copy $tstfile ."
@ -220,16 +223,16 @@ COPY_REFFILES_TO_BLDREFDIR()
done
}
CLEAN_REFFILES_AND_BLDREFDIR()
CLEAN_ITERFILES_AND_BLDITERDIR()
{
# skip rm if srcdir is same as destdir
# this occurs when build/test performed in source dir and
# make cp fail
SDIR=`$DIRNAME $HDFTEST_HOME/h5ex_g_iterate.h5`
INODE_SDIR=`$LS -i -d $SDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $BLDREFDIR | $AWK -F' ' '{print $1}'`
INODE_DDIR=`$LS -i -d $BLDITERDIR | $AWK -F' ' '{print $1}'`
if [ "$INODE_SDIR" != "$INODE_DDIR" ]; then
$RM $BLDREFDIR
$RM $BLDITERDIR
fi
}
@ -252,7 +255,7 @@ JAVAEXEFLAGS=@H5_JAVAFLAGS@
# prepare for test
COPY_LIBFILES_TO_BLDLIBDIR
COPY_DATAFILES_TO_BLDDIR
COPY_REFFILES_TO_BLDREFDIR
COPY_REFFILES_TO_BLDITERDIR
CPATH=".:"$BLDLIBDIR"/"$JARFILE":"$BLDLIBDIR"/slf4j-api-1.7.25.jar:"$BLDLIBDIR"/slf4j-simple-1.7.25.jar:"$TESTJARFILE""
@ -366,7 +369,7 @@ fi
# Clean up temporary files/directories
CLEAN_LIBFILES_AND_BLDLIBDIR
CLEAN_DATAFILES_AND_BLDDIR
CLEAN_REFFILES_AND_BLDREFDIR
CLEAN_REFFILES_AND_BLDITERDIR
# Report test results and exit
if test $nerrors -eq 0 ; then

View File

@ -1109,7 +1109,7 @@ Java_hdf_hdf5lib_H5_H5Dwrite_1string
const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0);
if (utf8) {
strncpy(&c_buf[i * str_len], utf8, str_len);
HDstrncpy(&c_buf[i * str_len], utf8, str_len);
} /* end if */
ENVPTR->ReleaseStringUTFChars(ENVPAR obj, utf8);

View File

@ -3881,7 +3881,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1fapl_1multi
const char *utf8 = ENVPTR->GetStringUTFChars(ENVPAR obj, 0);
if (utf8) {
member_name[i] = (char*)HDmalloc(strlen(utf8) + 1);
member_name[i] = (char*)HDmalloc(HDstrlen(utf8) + 1);
if (member_name[i]) {
strcpy(member_name[i], utf8);
} /* end if */
@ -4189,7 +4189,7 @@ Java_hdf_hdf5lib_H5_H5Pset_1mdc_1config
h5JNIFatalError(env, "H5Pset_mdc_config: out of memory trace_file_name");
return;
} /* end if */
strncpy(cacheinfo.trace_file_name, str, 1025);
HDstrncpy(cacheinfo.trace_file_name, str, 1025);
ENVPTR->ReleaseStringUTFChars(ENVPAR j_str, str);
if(ENVPTR->ExceptionOccurred(ENVONLY)) {
h5JNIFatalError(env, "H5Pset_mdc_config: loading trace_file_name failed");

View File

@ -571,7 +571,7 @@ Java_hdf_hdf5lib_H5_H5Sset_1extent_1simple
h5JNIFatalError(env, "H5Pset_simple_extent: dims not pinned");
return -1;
} /* end if */
sa = lp = (hsize_t *) malloc((size_t)rank * sizeof(hsize_t));
sa = lp = (hsize_t *) HDmalloc((size_t)rank * sizeof(hsize_t));
if (sa == NULL) {
ENVPTR->ReleaseLongArrayElements(ENVPAR dims, dimsP, JNI_ABORT);
h5JNIFatalError(env, "H5Sset_simple_extent: dims not converted to hsize_t");
@ -1017,7 +1017,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1hyper_1blocklist
h5JNIFatalError(env, "H5Sget_select_hyper_blocklist: buf not pinned");
} /* end if */
else {
ba = (hsize_t *) malloc((size_t)nb * 2 * (size_t)rank * sizeof(hsize_t));
ba = (hsize_t *) HDmalloc((size_t)nb * 2 * (size_t)rank * sizeof(hsize_t));
if (ba == NULL) {
ENVPTR->ReleaseLongArrayElements(ENVPAR buf, bufP, JNI_ABORT);
h5JNIFatalError(env, "H5Screate-simple: buffer not converted to hsize_t");
@ -1135,7 +1135,7 @@ Java_hdf_hdf5lib_H5_H5Sget_1select_1bounds
return -1;
} /* end if */
rank = (int) ENVPTR->GetArrayLength(ENVPAR start);
strt = (hsize_t *)malloc((size_t)rank * sizeof(hsize_t));
strt = (hsize_t *)HDmalloc((size_t)rank * sizeof(hsize_t));
if (strt == NULL) {
ENVPTR->ReleaseLongArrayElements(ENVPAR start, startP, JNI_ABORT);
h5JNIFatalError(env, "H5Sget_select_bounds: start not converted to hsize_t");

View File

@ -1768,7 +1768,7 @@ h5str_render_bin_output
if (H5Tis_variable_str(tid)) {
s = *(char**) mem;
if (s != NULL)
size = strlen(s);
size = HDstrlen(s);
}
else {
s = (char *) mem;
@ -2129,11 +2129,11 @@ render_bin_output_region_data_points
ret_value = -1;
HDfree(dims1);
} /* end if((dims1 = (hsize_t *) malloc(sizeof(hsize_t) * ndims)) != NULL) */
} /* end if((dims1 = (hsize_t *) HDmalloc(sizeof(hsize_t) * ndims)) != NULL) */
else
ret_value = -1;
HDfree(region_buf);
} /* end if((region_buf = malloc(type_size * (size_t)npoints)) != NULL) */
} /* end if((region_buf = HDmalloc(type_size * (size_t)npoints)) != NULL) */
else
ret_value = -1;
@ -2436,7 +2436,7 @@ Java_hdf_hdf5lib_H5_H5AreadComplex
H5Tclose(p_type);
n = ENVPTR->GetArrayLength(ENVPAR buf);
rdata = (char *)malloc((size_t)n * size);
rdata = (char *)HDmalloc((size_t)n * size);
if (rdata == NULL) {
h5JNIFatalError(env, "H5AreadComplex: failed to allocate buff for read");
} /* end if */
@ -2952,7 +2952,7 @@ obj_info_all
if (retVal < 0) {
*(datainfo->otype+datainfo->count) = -1;
*(datainfo->ltype+datainfo->count) = -1;
*(datainfo->objname+datainfo->count) = (char *)HDmalloc(strlen(name)+1);
*(datainfo->objname+datainfo->count) = (char *)HDmalloc(HDstrlen(name)+1);
HDstrcpy(*(datainfo->objname+datainfo->count), name);
*(datainfo->objno+datainfo->count) = (unsigned long)-1;
} /* end if */

View File

@ -56,11 +56,11 @@ TEST_PROG= testhdf5 \
evict_on_close farray earray btree2 fheap \
pool accum hyperslab istore bittests dt_arith page_buffer \
dtypes dsets cmpd_dset filter_fail extend direct_chunk external efc \
objcopy links unlink twriteorder big mtime fillval mount \
flush1 flush2 app_ref enum set_extent ttsafe enc_dec_plist \
enc_dec_plist_cross_platform getname vfd ntypes dangle dtransform \
reserved cross_read freespace mf vds file_image unregister \
cache_logging cork swmr
objcopy links unlink twriteorder big mtime fillval mount \
flush1 flush2 app_ref enum set_extent ttsafe enc_dec_plist \
enc_dec_plist_cross_platform getname vfd ntypes dangle dtransform \
reserved cross_read freespace mf vds file_image unregister \
cache_logging cork swmr
# List programs to be built when testing here.
# error_test and err_compat are built at the same time as the other tests, but executed by testerror.sh.

View File

@ -65,16 +65,16 @@ test_logging_api(void)
start_on_access_out = TRUE;
location = NULL;
size = 999;
if(H5Pget_mdc_log_options(fapl, &is_enabled_out, location, &size,
if(H5Pget_mdc_log_options(fapl, &is_enabled_out, location, &size,
&start_on_access_out) < 0)
TEST_ERROR;
if(size != strlen(LOG_LOCATION) + 1)
if(size != HDstrlen(LOG_LOCATION) + 1)
TEST_ERROR;
/* Check to make sure that the property list getter works */
if(NULL == (location = (char *)HDcalloc(size, sizeof(char))))
TEST_ERROR;
if(H5Pget_mdc_log_options(fapl, &is_enabled_out, location, &size,
if(H5Pget_mdc_log_options(fapl, &is_enabled_out, location, &size,
&start_on_access_out) < 0)
TEST_ERROR;
if((is_enabled != is_enabled_out)
@ -159,17 +159,17 @@ main(void)
/* Reset library */
h5_reset();
printf("Testing basic metadata cache logging functionality.\n");
HDprintf("Testing basic metadata cache logging functionality.\n");
nerrors += test_logging_api();
if(nerrors) {
printf("***** %d Metadata cache logging TEST%s FAILED! *****\n",
HDprintf("***** %d Metadata cache logging TEST%s FAILED! *****\n",
nerrors, nerrors > 1 ? "S" : "");
return 1;
}
printf("All Metadata Cache Logging tests passed.\n");
HDprintf("All Metadata Cache Logging tests passed.\n");
return 0;
}

File diff suppressed because it is too large Load Diff

View File

@ -470,8 +470,8 @@ test_unknown(unsigned bogus_id, char *filename, hid_t fapl)
/* create a different name for a local copy of the data file to be
opened with rd/wr file permissions in case build and test are
done in the source directory. */
HDstrncpy(testfile, FILE_BOGUS, strlen(FILE_BOGUS));
testfile[strlen(FILE_BOGUS)]='\0';
HDstrncpy(testfile, FILE_BOGUS, HDstrlen(FILE_BOGUS));
testfile[HDstrlen(FILE_BOGUS)]='\0';
HDstrncat(testfile, ".copy", 5);
/* Make a copy of the data file from svn. */

View File

@ -2272,7 +2272,7 @@ misc13_insert_user_block(const char *old_name, const char *new_name, const char
CHECK_PTR(user_block, "HDcalloc");
/* Copy in the user block data */
HDmemcpy(user_block, str, strlen(str));
HDmemcpy(user_block, str, HDstrlen(str));
/* Open the new file */
new_fp = HDfopen(new_name,"wb");

View File

@ -164,7 +164,7 @@ void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string)
/* Fill the buffer with two copies of the UTF-8 string, each with a
* terminating NULL. It will look like "abcdefg\0abcdefg\0". */
strncpy(buf, new_string, big_len);
strncpy(&buf[big_len], new_string, big_len);
HDstrncpy(&buf[big_len], new_string, big_len);
ret = H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Tconvert");
@ -226,8 +226,8 @@ void test_strpad(hid_t H5_ATTR_UNUSED fid, const char *string)
/* Fill the buffer with two copies of the UTF-8 string.
* It will look like "abcdefghabcdefgh". */
strncpy(buf, new_string, big_len);
strncpy(&buf[big_len], new_string, big_len);
HDstrncpy(buf, new_string, big_len);
HDstrncpy(&buf[big_len], new_string, big_len);
ret = H5Tconvert(src_type, dst_type, (size_t)2, buf, NULL, H5P_DEFAULT);
CHECK(ret, FAIL, "H5Tconvert");

View File

@ -467,7 +467,7 @@ test_vltypes_vlen_atomic(void)
/* Try to call H5Dvlen_get_buf with bad dataspace */
H5E_BEGIN_TRY {
ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size);
ret = H5Dvlen_get_buf_size(dataset, tid1, sid2, &size);
} H5E_END_TRY
VERIFY(ret, FAIL, "H5Dvlen_get_buf_size");
@ -499,7 +499,7 @@ test_vltypes_vlen_atomic(void)
/* Try to reclaim read data using "bad" dataspace with no extent
* Should fail */
H5E_BEGIN_TRY {
ret=H5Dvlen_reclaim(tid1,sid2,xfer_pid,rdata);
ret=H5Dvlen_reclaim(tid1,sid2,xfer_pid,rdata);
} H5E_END_TRY
VERIFY(ret, FAIL, "H5Dvlen_reclaim");
@ -1205,9 +1205,9 @@ test_vltypes_compound_vlstr(void)
wdata[i].v.p=(s2*)HDmalloc((i+L3_INCM)*sizeof(s2));
wdata[i].v.len=i+L3_INCM;
for(t1=(s2 *)((wdata[i].v).p), j=0; j<(i+L3_INCM); j++, t1++) {
strcat(str, "m");
t1->string = (char*)HDmalloc(strlen(str)*sizeof(char)+1);
strcpy(t1->string, str);
HDstrcat(str, "m");
t1->string = (char*)HDmalloc(HDstrlen(str)*sizeof(char)+1);
HDstrcpy(t1->string, str);
/*t1->color = red;*/
t1->color = blue;
}
@ -1348,7 +1348,7 @@ test_vltypes_compound_vlstr(void)
} /* end if */
for(t1=(s2 *)(wdata[i].v.p), t2=(s2 *)(rdata[i].v.p), j=0; j<rdata[i].v.len; j++, t1++, t2++) {
if( strcmp(t1->string, t2->string) ) {
if( HDstrcmp(t1->string, t2->string) ) {
TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string);
continue;
} /* end if */
@ -1368,14 +1368,14 @@ test_vltypes_compound_vlstr(void)
CHECK(ret, FAIL, "H5Dvlen_reclaim");
/* Use this part for new data */
strcpy(str, "bbbbbbbb\0");
HDstrcpy(str, "bbbbbbbb\0");
for(i=0; i<SPACE1_DIM1; i++) {
wdata2[i].v.p=(s2*)HDmalloc((i+1)*sizeof(s2));
wdata2[i].v.len=i+1;
for(t1=(s2*)(wdata2[i].v).p, j=0; j<i+1; j++, t1++) {
strcat(str, "pp");
t1->string = (char*)HDmalloc(strlen(str)*sizeof(char)+1);
strcpy(t1->string, str);
HDstrcat(str, "pp");
t1->string = (char*)HDmalloc(HDstrlen(str)*sizeof(char)+1);
HDstrcpy(t1->string, str);
t1->color = green;
}
} /* end for */
@ -1406,7 +1406,7 @@ test_vltypes_compound_vlstr(void)
} /* end if */
for(t1=(s2 *)(wdata2[i].v.p), t2=(s2 *)(rdata2[i].v.p), j=0; j<rdata2[i].v.len; j++, t1++, t2++) {
if( strcmp(t1->string, t2->string) ) {
if( HDstrcmp(t1->string, t2->string) ) {
TestErrPrintf("VL data values don't match!, t1->string=%s, t2->string=%s\n",t1->string, t2->string);
continue;
} /* end if */

View File

@ -149,7 +149,7 @@ test_sec2(void)
/* There is no garantee the size of metadata in file is constant.
* Just try to check if it's reasonable.
*
*
* Currently it should be around 2 KB.
*/
if(H5Fget_filesize(fid, &file_size) < 0)
@ -258,7 +258,7 @@ test_core(void)
| H5FD_FEAT_ACCUMULATE_METADATA
| H5FD_FEAT_DATA_SIEVE
| H5FD_FEAT_AGGREGATE_SMALLDATA
| H5FD_FEAT_ALLOW_FILE_IMAGE
| H5FD_FEAT_ALLOW_FILE_IMAGE
| H5FD_FEAT_CAN_USE_FILE_IMAGE_CALLBACKS))
TEST_ERROR
@ -341,7 +341,7 @@ test_core(void)
/* There is no garantee the size of metadata in file is constant.
* Just try to check if it's reasonable.
*
*
* TODO: Needs justification of why is this is a reasonable size.
*/
if(H5Fget_filesize(fid, &file_size) < 0)
@ -379,7 +379,7 @@ test_core(void)
for(i = 0; i < CORE_DSET_DIM1; i++)
for(j = 0; j < CORE_DSET_DIM2; j++)
*pw++ = val++;
HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int));
HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int));
/* Create the dataspace */
dims[0] = CORE_DSET_DIM1;
@ -469,7 +469,7 @@ test_core(void)
TEST_ERROR;
/* Read the data back from the dataset */
HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int));
HDmemset(data_r, 0, DSET1_DIM1 * DSET1_DIM2 * sizeof(int));
if(H5Dread(did, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_r) < 0)
TEST_ERROR;
@ -488,7 +488,7 @@ test_core(void)
/* Check file size API.
* There is no garantee the size of metadata in file is constant.
* Just try to check if it's reasonable.
*
*
* TODO: Needs justification of why is this is a reasonable size.
*/
if(H5Fget_filesize(fid, &file_size) < 0)
@ -1330,7 +1330,7 @@ test_multi(void)
if((atype = H5Tcopy(H5T_C_S1)) < 0)
TEST_ERROR;
if(H5Tset_size(atype, strlen(meta) + 1) < 0)
if(H5Tset_size(atype, HDstrlen(meta) + 1) < 0)
TEST_ERROR;
if(H5Tset_strpad(atype, H5T_STR_NULLTERM) < 0)
@ -1385,7 +1385,7 @@ error:
* Purpose: Tests the backward compatibility for MULTI driver.
* See if we can open files created with v1.6 library.
* The source file was created by the test/file_handle.c
* of the v1.6 library. This test verifies the fix for
* of the v1.6 library. This test verifies the fix for
* Issue 2598. In v1.6 library, there was EOA for the whole
* MULTI file saved in the super block. We took it out in
* v1.8 library because it's meaningless for the MULTI file.
@ -1446,7 +1446,7 @@ test_multi_compat(void)
h5_fixname(FILENAME[9], fapl, newname, sizeof newname);
/* Make copy for the data file in the build directory, to protect the
/* Make copy for the data file in the build directory, to protect the
* original file in the source directory */
sprintf(filename_s, "%s-%c.h5", MULTI_COMPAT_BASENAME, 's');
sprintf(newname_s, "%s-%c.h5", FILENAME[9], 's');
@ -1483,7 +1483,7 @@ test_multi_compat(void)
if(H5Fclose(file) < 0)
TEST_ERROR;
/* Reopen the file for adding another dataset. The new EOA for metadata file
/* Reopen the file for adding another dataset. The new EOA for metadata file
* should be written to the file */
if((file=H5Fopen(newname, H5F_ACC_RDWR, fapl)) < 0)
TEST_ERROR;
@ -1510,7 +1510,7 @@ test_multi_compat(void)
if(H5Fclose(file) < 0)
TEST_ERROR;
/* Reopen the file for read only again. Verify the library can handle
/* Reopen the file for read only again. Verify the library can handle
* the EOA correctly */
if((file=H5Fopen(newname, H5F_ACC_RDONLY, fapl)) < 0)
TEST_ERROR;

View File

@ -7134,7 +7134,7 @@ trace_file_check(int metadata_write_strategy)
if ( HDfgets(buffer, 255, trace_file_ptr) != NULL ) {
actual_line_len = strlen(buffer);
actual_line_len = HDstrlen(buffer);
} else {

File diff suppressed because it is too large Load Diff

View File

@ -157,7 +157,7 @@ typedef struct {
/* obtain link info from H5tools_get_symlink_info() */
typedef struct {
H5O_type_t trg_type; /* OUT: target type */
char *trg_path; /* OUT: target obj path. This must be freed
char *trg_path; /* OUT: target obj path. This must be freed
* when used with H5tools_get_symlink_info() */
haddr_t objno; /* OUT: target object address */
unsigned long fileno; /* OUT: File number that target object is located in */

View File

@ -350,7 +350,7 @@ check_n_input( const char *str )
unsigned i;
char c;
for (i = 0; i < strlen(str); i++) {
for (i = 0; i < HDstrlen(str); i++) {
c = str[i];
if (i == 0) {
if (c < 49 || c > 57) /* ascii values between 1 and 9 */
@ -387,7 +387,7 @@ check_p_input( const char *str )
the atof return value on a hexadecimal input is different
on some systems; we do a character check for this
*/
if (strlen(str) > 2 && str[0] == '0' && str[1] == 'x')
if (HDstrlen(str) > 2 && str[0] == '0' && str[1] == 'x')
return -1;
x = atof(str);
@ -421,7 +421,7 @@ check_d_input( const char *str )
the atof return value on a hexadecimal input is different
on some systems; we do a character check for this
*/
if (strlen(str) > 2 && str[0] == '0' && str[1] == 'x')
if (HDstrlen(str) > 2 && str[0] == '0' && str[1] == 'x')
return -1;
x = atof(str);

File diff suppressed because it is too large Load Diff

View File

@ -24,11 +24,11 @@
/* Parameters to control statistics gathered */
/* Default threshold for small groups/datasets/attributes */
#define DEF_SIZE_SMALL_GROUPS 10
#define DEF_SIZE_SMALL_DSETS 10
#define DEF_SIZE_SMALL_ATTRS 10
#define DEF_SIZE_SMALL_GROUPS 10
#define DEF_SIZE_SMALL_DSETS 10
#define DEF_SIZE_SMALL_ATTRS 10
#define SIZE_SMALL_SECTS 10
#define SIZE_SMALL_SECTS 10
#define H5_NFILTERS_IMPL 8 /* Number of currently implemented filters + one to
accommodate for user-define filters + one
@ -74,7 +74,7 @@ typedef struct iter_t {
ohdr_info_t group_ohdr_info; /* Object header information for groups */
hsize_t max_attrs; /* Maximum attributes from a group */
unsigned long *num_small_attrs; /* Size of small attributes tracked */
unsigned long *num_small_attrs; /* Size of small attributes tracked */
unsigned attr_nbins; /* Number of bins for attribute counts */
unsigned long *attr_bins; /* Pointer to array of bins for attribute counts */
@ -83,7 +83,7 @@ typedef struct iter_t {
hsize_t max_dset_dims; /* Maximum dimension size of dataset */
unsigned long *small_dset_dims; /* Size of dimensions of small datasets tracked */
unsigned long dset_layouts[H5D_NLAYOUTS]; /* Type of storage for each dataset */
unsigned long dset_comptype[H5_NFILTERS_IMPL]; /* Number of currently implemented filters */
unsigned long dset_comptype[H5_NFILTERS_IMPL]; /* Number of currently implemented filters */
unsigned long dset_ntypes; /* Number of diff. dataset datatypes found */
dtype_info_t *dset_type_info; /* Pointer to dataset datatype information found */
unsigned dset_dim_nbins; /* Number of bins for dataset dimensions */
@ -103,9 +103,9 @@ typedef struct iter_t {
hsize_t super_ext_size; /* superblock extension size */
hsize_t ublk_size; /* user block size (if exists) */
H5F_fspace_strategy_t fs_strategy; /* File space management strategy */
hbool_t fs_persist; /* Free-space persist or not */
hbool_t fs_persist; /* Free-space persist or not */
hsize_t fs_threshold; /* Free-space section threshold */
hsize_t fsp_size; /* File space page size */
hsize_t fsp_size; /* File space page size */
hsize_t free_space; /* Amount of freespace in the file */
hsize_t free_hdr; /* Size of free space manager metadata in the file */
unsigned long num_small_sects[SIZE_SMALL_SECTS]; /* Size of small free-space sections */
@ -136,9 +136,9 @@ static int display_dset_metadata = FALSE; /* display file space info f
static int display_object = FALSE; /* not implemented yet */
/* Initialize threshold for small groups/datasets/attributes */
static int sgroups_threshold = DEF_SIZE_SMALL_GROUPS;
static int sdsets_threshold = DEF_SIZE_SMALL_DSETS;
static int sattrs_threshold = DEF_SIZE_SMALL_ATTRS;
static int sgroups_threshold = DEF_SIZE_SMALL_GROUPS;
static int sdsets_threshold = DEF_SIZE_SMALL_DSETS;
static int sattrs_threshold = DEF_SIZE_SMALL_ATTRS;
/* a structure for handling the order command-line parameters come in */
struct handler_t {
@ -257,7 +257,7 @@ leave(int ret)
}
/*-------------------------------------------------------------------------
* Function: usage
*
@ -297,7 +297,7 @@ static void usage(const char *prog)
HDfprintf(stdout, " --enable-error-stack Prints messages from the HDF5 error stack as they occur\n");
}
/*-------------------------------------------------------------------------
* Function: ceil_log10
*
@ -324,7 +324,7 @@ ceil_log10(unsigned long x)
return ret;
} /* ceil_log10() */
/*-------------------------------------------------------------------------
* Function: attribute_stats
*
@ -374,7 +374,7 @@ attribute_stats(iter_t *iter, const H5O_info_t *oi)
return 0;
} /* end attribute_stats() */
/*-------------------------------------------------------------------------
* Function: group_stats
*
@ -456,7 +456,7 @@ done:
return ret_value;
} /* end group_stats() */
/*-------------------------------------------------------------------------
* Function: dataset_stats
*
@ -648,7 +648,7 @@ done:
return ret_value;
} /* end dataset_stats() */
/*-------------------------------------------------------------------------
* Function: datatype_stats
*
@ -680,7 +680,7 @@ done:
return ret_value;
} /* end datatype_stats() */
/*-------------------------------------------------------------------------
* Function: obj_stats
*
@ -736,7 +736,7 @@ done:
return ret_value;
} /* end obj_stats() */
/*-------------------------------------------------------------------------
* Function: lnk_stats
*
@ -834,7 +834,7 @@ freespace_stats(hid_t fid, iter_t *iter)
return 0;
} /* end freespace_stats() */
/*-------------------------------------------------------------------------
* Function: hand_free
*
@ -863,7 +863,7 @@ hand_free(struct handler_t *hand)
} /* end if */
} /* end hand_free() */
/*-------------------------------------------------------------------------
* Function: parse_command_line
*
@ -1041,7 +1041,7 @@ error:
return -1;
}
/*-------------------------------------------------------------------------
* Function: iter_free
*
@ -1106,7 +1106,7 @@ iter_free(iter_t *iter)
} /* end if */
} /* end iter_free() */
/*-------------------------------------------------------------------------
* Function: print_file_info
*
@ -1138,7 +1138,7 @@ print_file_info(const iter_t *iter)
return 0;
} /* print_file_info() */
/*-------------------------------------------------------------------------
* Function: print_file_metadata
*
@ -1198,7 +1198,7 @@ print_file_metadata(const iter_t *iter)
return 0;
} /* print_file_metadata() */
/*-------------------------------------------------------------------------
* Function: print_group_info
*
@ -1255,7 +1255,7 @@ print_group_info(const iter_t *iter)
return 0;
} /* print_group_info() */
/*-------------------------------------------------------------------------
* Function: print_group_metadata
*
@ -1282,7 +1282,7 @@ print_group_metadata(const iter_t *iter)
return 0;
} /* print_group_metadata() */
/*-------------------------------------------------------------------------
* Function: print_dataset_info
*
@ -1369,7 +1369,7 @@ print_dataset_info(const iter_t *iter)
return 0;
} /* print_dataset_info() */
/*-------------------------------------------------------------------------
* Function: print_dataset_metadata
*
@ -1398,7 +1398,7 @@ print_dset_metadata(const iter_t *iter)
return 0;
} /* print_dset_metadata() */
/*-------------------------------------------------------------------------
* Function: print_dset_dtype_meta
*
@ -1439,7 +1439,7 @@ print_dset_dtype_meta(const iter_t *iter)
return 0;
} /* print_dset_dtype_meta() */
/*-------------------------------------------------------------------------
* Function: print_attr_info
*
@ -1488,7 +1488,7 @@ print_attr_info(const iter_t *iter)
return 0;
} /* print_attr_info() */
/*-------------------------------------------------------------------------
* Function: print_freespace_info
*
@ -1538,7 +1538,7 @@ print_freespace_info(const iter_t *iter)
return 0;
} /* print_freespace_info() */
/*-------------------------------------------------------------------------
* Function: print_storage_summary
*
@ -1602,7 +1602,7 @@ print_storage_summary(const iter_t *iter)
return 0;
} /* print_storage_summary() */
/*-------------------------------------------------------------------------
* Function: print_file_statistics
*
@ -1649,7 +1649,7 @@ print_file_statistics(const iter_t *iter)
if(display_summary) print_storage_summary(iter);
} /* print_file_statistics() */
/*-------------------------------------------------------------------------
* Function: print_object_statistics
*
@ -1672,7 +1672,7 @@ print_object_statistics(const char *name)
printf("Object name %s\n", name);
} /* print_object_statistics() */
/*-------------------------------------------------------------------------
* Function: print_statistics
*
@ -1698,7 +1698,7 @@ print_statistics(const char *name, const iter_t *iter)
print_file_statistics(iter);
} /* print_statistics() */
/*-------------------------------------------------------------------------
* Function: main
*
@ -1733,7 +1733,7 @@ main(int argc, const char *argv[])
/* Disable tools error reporting */
H5Eget_auto2(H5tools_ERR_STACK_g, &tools_func, &tools_edata);
H5Eset_auto2(H5tools_ERR_STACK_g, NULL, NULL);
HDmemset(&iter, 0, sizeof(iter));
if(parse_command_line(argc, argv, &hand) < 0)
@ -1780,15 +1780,15 @@ main(int argc, const char *argv[])
iter.free_hdr = finfo.free.meta_size;
} /* end else */
iter.num_small_groups = (unsigned long *)HDcalloc((size_t)sgroups_threshold, sizeof(unsigned long));
iter.num_small_attrs = (unsigned long *)HDcalloc((size_t)(sattrs_threshold+1), sizeof(unsigned long));
iter.small_dset_dims = (unsigned long *)HDcalloc((size_t)sdsets_threshold, sizeof(unsigned long));
iter.num_small_groups = (unsigned long *)HDcalloc((size_t)sgroups_threshold, sizeof(unsigned long));
iter.num_small_attrs = (unsigned long *)HDcalloc((size_t)(sattrs_threshold+1), sizeof(unsigned long));
iter.small_dset_dims = (unsigned long *)HDcalloc((size_t)sdsets_threshold, sizeof(unsigned long));
if(iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) {
error_msg("Unable to allocate memory for tracking small groups/datasets/attributes\n");
if(iter.num_small_groups == NULL || iter.num_small_attrs == NULL || iter.small_dset_dims == NULL) {
error_msg("Unable to allocate memory for tracking small groups/datasets/attributes\n");
h5tools_setstatus(EXIT_FAILURE);
goto done;
}
goto done;
}
if((fcpl = H5Fget_create_plist(fid)) < 0)
warn_msg("Unable to retrieve file creation property\n");

View File

@ -71,9 +71,9 @@ main(void)
volatile uint32_t ibyte=0x01234567;
/* 0 for big endian, 1 for little endian. */
if ((*((uint8_t*)(&ibyte))) == 0x67)
strncpy(machine_order, "LE", 2);
HDstrncpy(machine_order, "LE", 2);
else
strncpy(machine_order, "BE", 2);
HDstrncpy(machine_order, "BE", 2);
/*

View File

@ -63,13 +63,13 @@
#define H5FATAL 1
#define VRFY(val, mesg, fatal) do { \
if (!val) { \
printf("Proc %d: ", mynod); \
printf("Proc %d: ", mynod); \
printf("*** Assertion failed (%s) at line %4d in %s\n", \
mesg, (int)__LINE__, __FILE__); \
if (fatal){ \
if (fatal){ \
fflush(stdout); \
goto die_jar_jar_die; \
} \
} \
} \
} while(0)
#define RANK 1
@ -180,38 +180,38 @@ int main(int argc, char **argv)
/* setup file access template with parallel IO access. */
if (opt_split_vfd){
hid_t mpio_pl;
hid_t mpio_pl;
mpio_pl = H5Pcreate (H5P_FILE_ACCESS);
VRFY((acc_tpl >= 0), "", H5FATAL);
ret = H5Pset_fapl_mpio(mpio_pl, MPI_COMM_WORLD, MPI_INFO_NULL);
VRFY((ret >= 0), "", H5FATAL);
mpio_pl = H5Pcreate (H5P_FILE_ACCESS);
VRFY((acc_tpl >= 0), "", H5FATAL);
ret = H5Pset_fapl_mpio(mpio_pl, MPI_COMM_WORLD, MPI_INFO_NULL);
VRFY((ret >= 0), "", H5FATAL);
/* set optional allocation alignment */
if (opt_alignment*opt_threshold != 1){
ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment );
VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL);
}
/* set optional allocation alignment */
if (opt_alignment*opt_threshold != 1){
ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment );
VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL);
}
/* setup file access template */
acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
VRFY((acc_tpl >= 0), "", H5FATAL);
ret = H5Pset_fapl_split(acc_tpl, meta_ext, mpio_pl, raw_ext, mpio_pl);
VRFY((ret >= 0), "H5Pset_fapl_split succeeded", H5FATAL);
ret = H5Pclose(mpio_pl);
VRFY((ret >= 0), "H5Pclose mpio_pl succeeded", H5FATAL);
/* setup file access template */
acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
VRFY((acc_tpl >= 0), "", H5FATAL);
ret = H5Pset_fapl_split(acc_tpl, meta_ext, mpio_pl, raw_ext, mpio_pl);
VRFY((ret >= 0), "H5Pset_fapl_split succeeded", H5FATAL);
ret = H5Pclose(mpio_pl);
VRFY((ret >= 0), "H5Pclose mpio_pl succeeded", H5FATAL);
}else{
/* setup file access template */
acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
VRFY((acc_tpl >= 0), "", H5FATAL);
ret = H5Pset_fapl_mpio(acc_tpl, MPI_COMM_WORLD, MPI_INFO_NULL);
VRFY((ret >= 0), "", H5FATAL);
/* setup file access template */
acc_tpl = H5Pcreate (H5P_FILE_ACCESS);
VRFY((acc_tpl >= 0), "", H5FATAL);
ret = H5Pset_fapl_mpio(acc_tpl, MPI_COMM_WORLD, MPI_INFO_NULL);
VRFY((ret >= 0), "", H5FATAL);
/* set optional allocation alignment */
if (opt_alignment*opt_threshold != 1){
ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment );
VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL);
}
/* set optional allocation alignment */
if (opt_alignment*opt_threshold != 1){
ret = H5Pset_alignment(acc_tpl, opt_threshold, opt_alignment );
VRFY((ret >= 0), "H5Pset_alignment succeeded", !H5FATAL);
}
}
h5_fixname_no_suffix(FILENAME[0], acc_tpl, filename, sizeof filename);
@ -225,7 +225,7 @@ int main(int argc, char **argv)
sid = H5Screate_simple(RANK, dims, NULL);
VRFY((sid >= 0), "H5Screate_simple succeeded", H5FATAL);
dataset = H5Dcreate2(fid, "Dataset1", H5T_NATIVE_CHAR, sid,
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
VRFY((dataset >= 0), "H5Dcreate2 succeeded", H5FATAL);
/* create the memory dataspace and the file dataspace */