diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2012-03-05 14:19:02 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2012-03-05 14:19:02 (GMT) |
commit | 6a2c50b10af4bc88e4b1a1a95cb3f9be813d61f2 (patch) | |
tree | 2df899df87c4b55c54faedeceb036b31340ee62f /hl | |
parent | 7619eb4b18d1d90db694bb96f2b26a5680150a89 (diff) | |
download | hdf5-6a2c50b10af4bc88e4b1a1a95cb3f9be813d61f2.zip hdf5-6a2c50b10af4bc88e4b1a1a95cb3f9be813d61f2.tar.gz hdf5-6a2c50b10af4bc88e4b1a1a95cb3f9be813d61f2.tar.bz2 |
[svn-r22025] Cleanup compiler warnings.
Add HD prefix to tools library based tests. Cleaned allocation/free in tests.
Tested: local linux/ h5committetest
Diffstat (limited to 'hl')
-rw-r--r-- | hl/test/test_ds.c | 1237 | ||||
-rw-r--r-- | hl/test/test_image.c | 76 | ||||
-rw-r--r-- | hl/test/test_lite.c | 202 | ||||
-rw-r--r-- | hl/test/test_packet.c | 14 | ||||
-rw-r--r-- | hl/test/test_table.c | 62 |
5 files changed, 995 insertions, 596 deletions
diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 1bf268e..149a0fd 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -219,9 +219,9 @@ static hid_t create_test_file(const char *fileext) { char filename[65]; - strcpy(filename, FILENAME); - strcat(filename, fileext); - strcat(filename, FILEEXT); + HDstrcpy(filename, FILENAME); + HDstrcat(filename, fileext); + HDstrcat(filename, FILEEXT); return H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); } @@ -229,9 +229,9 @@ static hid_t open_test_file(const char *fileext) { char filename[65]; - strcpy(filename, FILENAME); - strcat(filename, fileext); - strcat(filename, FILEEXT); + HDstrcpy(filename, FILENAME); + HDstrcat(filename, fileext); + HDstrcat(filename, FILEEXT); return H5Fopen(filename, H5F_ACC_RDWR, H5P_DEFAULT); } @@ -260,8 +260,8 @@ herr_t create_char_dataset(hid_t fid, const char *dsidx, int fulldims) char s33_wbuf[DIM3_SIZE] = {6,6,6,12,12,12,53,53,53,120,120,120}; char name[32]; - strcpy(name, DATASET_NAME); - strcat(name, dsidx); + HDstrcpy(name, DATASET_NAME); + HDstrcat(name, dsidx); /* make a dataset */ if(H5LTmake_dataset_char(fid, name, rank, dims, buf) >= 0) { if(fulldims==0) { @@ -313,8 +313,8 @@ herr_t create_short_dataset(hid_t fid, const char *dsidx, int fulldims) short s33_wbuf[DIM3_SIZE] = {6,6,6,12,12,12,53,53,53,140,140,140}; char name[32]; - strcpy(name, DATASET_NAME); - strcat(name, dsidx); + HDstrcpy(name, DATASET_NAME); + HDstrcat(name, dsidx); /* make a dataset */ if(H5LTmake_dataset_short(fid, name, rank, dims, buf) >= 0) { @@ -362,8 +362,8 @@ herr_t create_int_dataset(hid_t fid, const char *dsidx, int fulldims) int s22_wbuf[DIM2_SIZE] = {5,10,50,300}; char name[32]; - strcpy(name, DATASET_NAME); - strcat(name, dsidx); + HDstrcpy(name, DATASET_NAME); + HDstrcat(name, dsidx); /* make a dataset */ if(H5LTmake_dataset_int(fid, name, rank, dims, buf) >= 0) { @@ -415,7 +415,7 @@ herr_t create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int long s44_wbuf[DIM4_SIZE] = {280,280}; char name[32]; - strcpy(name, dsname); + HDstrcpy(name, dsname); /* make a dataset */ if(H5LTmake_dataset_long(fid, name, rank, dims, buf) >= 0) { @@ -470,8 +470,8 @@ herr_t create_float_dataset(hid_t fid, const char *dsidx, int fulldims) float s22_wbuf[DIM2_SIZE] = {5,10,50,300}; char name[32]; - strcpy(name, DATASET_NAME); - strcat(name, dsidx); + HDstrcpy(name, DATASET_NAME); + HDstrcat(name, dsidx); /* make a dataset */ if(H5LTmake_dataset_float(fid, name, rank, dims, buf) >= 0) { @@ -505,15 +505,15 @@ herr_t create_DS1_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_ { char name[32]; - strcpy(name, DS_1_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_1_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_11_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_11_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the first dimension */ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; @@ -530,23 +530,23 @@ herr_t create_DS2_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_ { char name[32]; - strcpy(name, DS_2_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_2_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the second dimension */ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_21_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_21_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_22_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_22_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; @@ -563,31 +563,31 @@ herr_t create_DS3_char_datasets(hid_t fid, const char *dsidx, int rankds, hsize_ { char name[32]; - strcpy(name, DS_3_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_3_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_31_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_31_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_32_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_32_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; } if(s3_wbuf!=NULL) { - strcpy(name, DS_33_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_33_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_char(fid, name, rankds, s_dim, s3_wbuf) < 0) return FAIL; @@ -604,15 +604,15 @@ herr_t create_DS1_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize { char name[32]; - strcpy(name, DS_1_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_1_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_11_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_11_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the first dimension */ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; @@ -629,24 +629,24 @@ herr_t create_DS2_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize { char name[32]; - strcpy(name, DS_2_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_2_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the second dimension */ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_21_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_21_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_22_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_22_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; @@ -663,32 +663,32 @@ herr_t create_DS3_short_datasets(hid_t fid, const char *dsidx, int rankds, hsize { char name[32]; - strcpy(name, DS_3_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_3_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_31_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_31_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_32_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_32_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; } if(s3_wbuf!=NULL) { - strcpy(name, DS_33_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_33_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_short(fid, name, rankds, s_dim, s3_wbuf) < 0) return FAIL; @@ -705,16 +705,16 @@ herr_t create_DS1_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t { char name[32]; - strcpy(name, DS_1_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_1_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_11_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_11_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the first dimension */ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; @@ -731,24 +731,24 @@ herr_t create_DS2_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t { char name[32]; - strcpy(name, DS_2_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_2_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the second dimension */ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_21_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_21_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_22_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_22_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; @@ -765,32 +765,32 @@ herr_t create_DS3_int_datasets(hid_t fid, const char *dsidx, int rankds, hsize_t { char name[32]; - strcpy(name, DS_3_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_3_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_31_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_31_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the first dimension */ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_32_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_32_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the first dimension */ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; } if(s3_wbuf!=NULL) { - strcpy(name, DS_33_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_33_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the first dimension */ if(H5LTmake_dataset_int(fid, name, rankds, s_dim, s3_wbuf) < 0) return FAIL; @@ -807,16 +807,16 @@ herr_t create_DS1_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_ { char name[32]; - strcpy(name, DS_1_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_1_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_11_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_11_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the first dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; @@ -833,24 +833,24 @@ herr_t create_DS2_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_ { char name[32]; - strcpy(name, DS_2_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_2_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the second dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_21_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_21_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_22_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_22_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; @@ -867,32 +867,32 @@ herr_t create_DS3_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_ { char name[32]; - strcpy(name, DS_3_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_3_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_31_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_31_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_32_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_32_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; } if(s3_wbuf!=NULL) { - strcpy(name, DS_33_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_33_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s3_wbuf) < 0) return FAIL; @@ -909,40 +909,40 @@ herr_t create_DS4_long_datasets(hid_t fid, const char *dsidx, int rankds, hsize_ { char name[32]; - strcpy(name, DS_4_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_4_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_41_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_41_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_42_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_42_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; } if(s3_wbuf!=NULL) { - strcpy(name, DS_43_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_43_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s3_wbuf) < 0) return FAIL; } if(s4_wbuf!=NULL) { - strcpy(name, DS_44_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_44_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_long(fid, name, rankds, s_dim, s4_wbuf) < 0) return FAIL; @@ -959,16 +959,16 @@ herr_t create_DS1_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize { char name[32]; - strcpy(name, DS_1_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_1_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_11_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_11_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the first dimension */ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; @@ -985,24 +985,24 @@ herr_t create_DS2_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize { char name[32]; - strcpy(name, DS_2_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_2_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the second dimension */ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_21_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_21_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_22_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_22_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; @@ -1019,32 +1019,32 @@ herr_t create_DS3_float_datasets(hid_t fid, const char *dsidx, int rankds, hsize { char name[32]; - strcpy(name, DS_3_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_3_NAME); + HDstrcat(name, dsidx); /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s_wbuf) < 0) return FAIL; if(s1_wbuf!=NULL) { - strcpy(name, DS_31_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_31_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s1_wbuf) < 0) return FAIL; } if(s2_wbuf!=NULL) { - strcpy(name, DS_32_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_32_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s2_wbuf) < 0) return FAIL; } if(s3_wbuf!=NULL) { - strcpy(name, DS_33_NAME); - strcat(name, dsidx); + HDstrcpy(name, DS_33_NAME); + HDstrcat(name, dsidx); /* make a DS dataset with an alternate scale for the second dimension */ if(H5LTmake_dataset_float(fid, name, rankds, s_dim, s3_wbuf) < 0) return FAIL; @@ -1127,13 +1127,13 @@ 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*)malloc(name_len * sizeof (char)); + name_out = (char*)HDmalloc(name_len * sizeof (char)); if(name_out != NULL) { if(H5DSget_scale_name(dsid, name_out, (size_t)name_len) >= 0) { - if(strcmp(scalename,name_out)==0) { + if(HDstrcmp(scalename,name_out)==0) { ret_value = SUCCEED; } - free(name_out); + HDfree(name_out); name_out=NULL; } } @@ -1262,7 +1262,7 @@ static int test_detachscales(void) goto out; } /* Check that attribute "DIMENSION_LIST" doesn't exist anymore */ - if(H5Aexists(did, DIMENSION_LIST)!= 0) + if(H5Aexists(did, DIMENSION_LIST)!= 0) goto out; if(H5Dclose(did) < 0) goto out; @@ -1294,8 +1294,8 @@ static int test_char_attachscales(const char *fileext) hid_t did = -1; char dsname[32]; char scalename[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "ac"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "ac"); TESTING2("test_char_attachscales"); @@ -1307,18 +1307,18 @@ static int test_char_attachscales(const char *fileext) goto out; if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "ac"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "ac"); if(test_attach_scale(fid, did, scalename, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "ac"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "ac"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; - strcpy(scalename, DS_3_NAME); - strcat(scalename, "ac"); + HDstrcpy(scalename, DS_3_NAME); + HDstrcat(scalename, "ac"); if(test_attach_scale(fid, did, scalename, DIM2) < 0) goto out; @@ -1350,8 +1350,8 @@ static int test_short_attachscales(const char *fileext) hid_t did = -1; char dsname[32]; char scalename[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "as"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "as"); TESTING2("test_short_attachscales"); @@ -1363,48 +1363,48 @@ static int test_short_attachscales(const char *fileext) goto out; if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "as"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "as"); if(test_attach_scale(fid, did, scalename, DIM0) < 0) goto out; - strcpy(scalename, DS_11_NAME); - strcat(scalename, "as"); + HDstrcpy(scalename, DS_11_NAME); + HDstrcat(scalename, "as"); if(test_attach_scale(fid, did, scalename, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "as"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "as"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; - strcpy(scalename, DS_21_NAME); - strcat(scalename, "as"); + HDstrcpy(scalename, DS_21_NAME); + HDstrcat(scalename, "as"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; - strcpy(scalename, DS_22_NAME); - strcat(scalename, "as"); + HDstrcpy(scalename, DS_22_NAME); + HDstrcat(scalename, "as"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; - strcpy(scalename, DS_3_NAME); - strcat(scalename, "as"); + HDstrcpy(scalename, DS_3_NAME); + HDstrcat(scalename, "as"); if(test_attach_scale(fid, did, scalename, DIM2) < 0) goto out; - strcpy(scalename, DS_31_NAME); - strcat(scalename, "as"); + HDstrcpy(scalename, DS_31_NAME); + HDstrcat(scalename, "as"); if(test_attach_scale(fid, did, scalename, DIM2) < 0) goto out; - strcpy(scalename, DS_32_NAME); - strcat(scalename, "as"); + HDstrcpy(scalename, DS_32_NAME); + HDstrcat(scalename, "as"); if(test_attach_scale(fid, did, scalename, DIM2) < 0) goto out; - strcpy(scalename, DS_33_NAME); - strcat(scalename, "as"); + HDstrcpy(scalename, DS_33_NAME); + HDstrcat(scalename, "as"); if(test_attach_scale(fid, did, scalename, DIM2) < 0) goto out; @@ -1436,8 +1436,8 @@ static int test_int_attachscales(const char *fileext) hid_t did = -1; char dsname[32]; char scalename[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "a"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "a"); TESTING2("test_int_attachscales"); @@ -1449,28 +1449,28 @@ static int test_int_attachscales(const char *fileext) goto out; if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "a"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "a"); if(test_attach_scale(fid, did, scalename, DIM0) < 0) goto out; - strcpy(scalename, DS_11_NAME); - strcat(scalename, "a"); + HDstrcpy(scalename, DS_11_NAME); + HDstrcat(scalename, "a"); if(test_attach_scale(fid, did, scalename, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "a"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "a"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; - strcpy(scalename, DS_21_NAME); - strcat(scalename, "a"); + HDstrcpy(scalename, DS_21_NAME); + HDstrcat(scalename, "a"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; - strcpy(scalename, DS_22_NAME); - strcat(scalename, "a"); + HDstrcpy(scalename, DS_22_NAME); + HDstrcat(scalename, "a"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; @@ -1502,8 +1502,8 @@ static int test_long_attachscales(const char *fileext) hid_t did = -1; char dsname[32]; char scalename[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "al"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "al"); TESTING2("test_long_attachscales"); @@ -1515,23 +1515,23 @@ static int test_long_attachscales(const char *fileext) goto out; if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "al"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "al"); if(test_attach_scale(fid, did, scalename, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "al"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "al"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; - strcpy(scalename, DS_3_NAME); - strcat(scalename, "al"); + HDstrcpy(scalename, DS_3_NAME); + HDstrcat(scalename, "al"); if(test_attach_scale(fid, did, scalename, DIM2) < 0) goto out; - strcpy(scalename, DS_4_NAME); - strcat(scalename, "al"); + HDstrcpy(scalename, DS_4_NAME); + HDstrcat(scalename, "al"); if(test_attach_scale(fid, did, scalename, DIM3) < 0) goto out; @@ -1563,8 +1563,8 @@ static int test_duplicatelong_attachscales(const char *fileext) hid_t did = -1; char dsname[32]; char scalename[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "al2"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "al2"); TESTING2("test_duplicatelong_attachscales"); @@ -1576,23 +1576,23 @@ static int test_duplicatelong_attachscales(const char *fileext) goto out; if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "al"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "al"); if(test_attach_scale(fid, did, scalename, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "al"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "al"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; - strcpy(scalename, DS_3_NAME); - strcat(scalename, "al"); + HDstrcpy(scalename, DS_3_NAME); + HDstrcat(scalename, "al"); if(test_attach_scale(fid, did, scalename, DIM2) < 0) goto out; - strcpy(scalename, DS_4_NAME); - strcat(scalename, "al"); + HDstrcpy(scalename, DS_4_NAME); + HDstrcat(scalename, "al"); if(test_attach_scale(fid, did, scalename, DIM3) < 0) goto out; @@ -1624,8 +1624,8 @@ static int test_float_attachscales(const char *fileext) hid_t did = -1; char dsname[32]; char scalename[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "af"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "af"); TESTING2("test_float_attachscales"); @@ -1637,28 +1637,28 @@ static int test_float_attachscales(const char *fileext) goto out; if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "af"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "af"); if(test_attach_scale(fid, did, scalename, DIM0) < 0) goto out; - strcpy(scalename, DS_11_NAME); - strcat(scalename, "af"); + HDstrcpy(scalename, DS_11_NAME); + HDstrcat(scalename, "af"); if(test_attach_scale(fid, did, scalename, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "af"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "af"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; - strcpy(scalename, DS_21_NAME); - strcat(scalename, "af"); + HDstrcpy(scalename, DS_21_NAME); + HDstrcat(scalename, "af"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; - strcpy(scalename, DS_22_NAME); - strcat(scalename, "af"); + HDstrcpy(scalename, DS_22_NAME); + HDstrcat(scalename, "af"); if(test_attach_scale(fid, did, scalename, DIM1) < 0) goto out; @@ -1691,8 +1691,8 @@ static int test_numberofscales(const char *fileext) int nscales; /* number of scales in DIM */ char dsname[32]; char scalename[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "a"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "a"); TESTING2("test_numberofscales"); @@ -1718,8 +1718,8 @@ static int test_numberofscales(const char *fileext) else goto out; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "b"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "b"); /* make a dataset */ if(create_int_dataset(fid, "b", 1) < 0) @@ -1727,8 +1727,8 @@ static int test_numberofscales(const char *fileext) /* make a DS dataset for the first dimension */ if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "b"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "b"); if(test_attach_scale(fid, did, scalename, DIM0) < 0) goto out; @@ -1772,38 +1772,38 @@ static int test_char_scalenames(const char *fileext) { char dsname[32]; char scalename[32]; char name[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "ac"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "ac"); if((fid = open_test_file(fileext)) < 0) goto out; TESTING2("set char scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "ac"); - strcpy(name, SCALE_1_NAME); - strcat(name, "ac"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "ac"); + HDstrcpy(name, SCALE_1_NAME); + HDstrcat(name, "ac"); if(test_set_scalename(fid, did, scalename, name, DIM0) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "ac"); - strcpy(name, SCALE_2_NAME); - strcat(name, "ac"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "ac"); + HDstrcpy(name, SCALE_2_NAME); + HDstrcat(name, "ac"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0) goto out; - strcpy(scalename, DS_3_NAME); - strcat(scalename, "ac"); - strcpy(name, SCALE_3_NAME); - strcat(name, "ac"); + HDstrcpy(scalename, DS_3_NAME); + HDstrcat(scalename, "ac"); + HDstrcpy(name, SCALE_3_NAME); + HDstrcat(name, "ac"); if(test_set_scalename(fid, did, scalename, name, DIM2) < 0) goto out; @@ -1838,98 +1838,98 @@ static int test_short_scalenames(const char *fileext) { char dsname[32]; char scalename[32]; char name[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "as"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "as"); if((fid = open_test_file(fileext)) < 0) goto out; TESTING2("set short scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "as"); - strcpy(name, SCALE_1_NAME); - strcat(name, "as"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "as"); + HDstrcpy(name, SCALE_1_NAME); + HDstrcat(name, "as"); if(test_set_scalename(fid, did, scalename, name, DIM0) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0) goto out; - strcpy(scalename, DS_11_NAME); - strcat(scalename, "as"); - strcpy(name, SCALE_11_NAME); - strcat(name, "as"); + HDstrcpy(scalename, DS_11_NAME); + HDstrcat(scalename, "as"); + HDstrcpy(name, SCALE_11_NAME); + HDstrcat(name, "as"); if(test_set_scalename(fid, did, scalename, name, DIM0) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "as"); - strcpy(name, SCALE_2_NAME); - strcat(name, "as"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "as"); + HDstrcpy(name, SCALE_2_NAME); + HDstrcat(name, "as"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0) goto out; - strcpy(scalename, DS_21_NAME); - strcat(scalename, "as"); - strcpy(name, SCALE_21_NAME); - strcat(name, "as"); + HDstrcpy(scalename, DS_21_NAME); + HDstrcat(scalename, "as"); + HDstrcpy(name, SCALE_21_NAME); + HDstrcat(name, "as"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0) goto out; - strcpy(scalename, DS_22_NAME); - strcat(scalename, "as"); - strcpy(name, SCALE_22_NAME); - strcat(name, "as"); + HDstrcpy(scalename, DS_22_NAME); + HDstrcat(scalename, "as"); + HDstrcpy(name, SCALE_22_NAME); + HDstrcat(name, "as"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0) goto out; - strcpy(scalename, DS_3_NAME); - strcat(scalename, "as"); - strcpy(name, SCALE_3_NAME); - strcat(name, "as"); + HDstrcpy(scalename, DS_3_NAME); + HDstrcat(scalename, "as"); + HDstrcpy(name, SCALE_3_NAME); + HDstrcat(name, "as"); if(test_set_scalename(fid, did, scalename, name, DIM2) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0) goto out; - strcpy(scalename, DS_31_NAME); - strcat(scalename, "as"); - strcpy(name, SCALE_31_NAME); - strcat(name, "as"); + HDstrcpy(scalename, DS_31_NAME); + HDstrcat(scalename, "as"); + HDstrcpy(name, SCALE_31_NAME); + HDstrcat(name, "as"); if(test_set_scalename(fid, did, scalename, name, DIM2) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0) goto out; - strcpy(scalename, DS_32_NAME); - strcat(scalename, "as"); - strcpy(name, SCALE_32_NAME); - strcat(name, "as"); + HDstrcpy(scalename, DS_32_NAME); + HDstrcat(scalename, "as"); + HDstrcpy(name, SCALE_32_NAME); + HDstrcat(name, "as"); if(test_set_scalename(fid, did, scalename, name, DIM2) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0) goto out; - strcpy(scalename, DS_33_NAME); - strcat(scalename, "as"); - strcpy(name, SCALE_33_NAME); - strcat(name, "as"); + HDstrcpy(scalename, DS_33_NAME); + HDstrcat(scalename, "as"); + HDstrcpy(name, SCALE_33_NAME); + HDstrcat(name, "as"); if(test_set_scalename(fid, did, scalename, name, DIM2) < 0) goto out; @@ -1964,58 +1964,58 @@ static int test_int_scalenames(const char *fileext) { char dsname[32]; char scalename[32]; char name[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "a"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "a"); if((fid = open_test_file(fileext)) < 0) goto out; TESTING2("set int scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "a"); - strcpy(name, SCALE_1_NAME); - strcat(name, "a"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "a"); + HDstrcpy(name, SCALE_1_NAME); + HDstrcat(name, "a"); if(test_set_scalename(fid, did, scalename, name, DIM0) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0) goto out; - strcpy(scalename, DS_11_NAME); - strcat(scalename, "a"); - strcpy(name, SCALE_11_NAME); - strcat(name, "a"); + HDstrcpy(scalename, DS_11_NAME); + HDstrcat(scalename, "a"); + HDstrcpy(name, SCALE_11_NAME); + HDstrcat(name, "a"); if(test_set_scalename(fid, did, scalename, name, DIM0) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "a"); - strcpy(name, SCALE_2_NAME); - strcat(name, "a"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "a"); + HDstrcpy(name, SCALE_2_NAME); + HDstrcat(name, "a"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0) goto out; - strcpy(scalename, DS_21_NAME); - strcat(scalename, "a"); - strcpy(name, SCALE_21_NAME); - strcat(name, "a"); + HDstrcpy(scalename, DS_21_NAME); + HDstrcat(scalename, "a"); + HDstrcpy(name, SCALE_21_NAME); + HDstrcat(name, "a"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0) goto out; - strcpy(scalename, DS_22_NAME); - strcat(scalename, "a"); - strcpy(name, SCALE_22_NAME); - strcat(name, "a"); + HDstrcpy(scalename, DS_22_NAME); + HDstrcat(scalename, "a"); + HDstrcpy(name, SCALE_22_NAME); + HDstrcat(name, "a"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; @@ -2050,48 +2050,48 @@ static int test_long_scalenames(const char *fileext) { char dsname[32]; char scalename[32]; char name[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "al"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "al"); if((fid = open_test_file(fileext)) < 0) goto out; TESTING2("set long scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "al"); - strcpy(name, SCALE_1_NAME); - strcat(name, "al"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "al"); + HDstrcpy(name, SCALE_1_NAME); + HDstrcat(name, "al"); if(test_set_scalename(fid, did, scalename, name, DIM0) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "al"); - strcpy(name, SCALE_2_NAME); - strcat(name, "al"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "al"); + HDstrcpy(name, SCALE_2_NAME); + HDstrcat(name, "al"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0) goto out; - strcpy(scalename, DS_3_NAME); - strcat(scalename, "al"); - strcpy(name, SCALE_3_NAME); - strcat(name, "al"); + HDstrcpy(scalename, DS_3_NAME); + HDstrcat(scalename, "al"); + HDstrcpy(name, SCALE_3_NAME); + HDstrcat(name, "al"); if(test_set_scalename(fid, did, scalename, name, DIM2) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0) goto out; - strcpy(scalename, DS_4_NAME); - strcat(scalename, "al"); - strcpy(name, SCALE_4_NAME); - strcat(name, "al"); + HDstrcpy(scalename, DS_4_NAME); + HDstrcat(scalename, "al"); + HDstrcpy(name, SCALE_4_NAME); + HDstrcat(name, "al"); if(test_set_scalename(fid, did, scalename, name, DIM3) < 0) goto out; @@ -2126,48 +2126,48 @@ static int test_samelong_scalenames(const char *fileext) { char dsname[32]; char scalename[32]; char name[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "al2"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "al2"); if((fid = open_test_file(fileext)) < 0) goto out; TESTING2("set same long scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "al"); - strcpy(name, DS_1_NAME); - strcat(name, "al"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "al"); + HDstrcpy(name, DS_1_NAME); + HDstrcat(name, "al"); if(test_set_scalename(fid, did, scalename, name, DIM0) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "al"); - strcpy(name, DS_2_NAME); - strcat(name, "al"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "al"); + HDstrcpy(name, DS_2_NAME); + HDstrcat(name, "al"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0) goto out; - strcpy(scalename, DS_3_NAME); - strcat(scalename, "al"); - strcpy(name, DS_3_NAME); - strcat(name, "al"); + HDstrcpy(scalename, DS_3_NAME); + HDstrcat(scalename, "al"); + HDstrcpy(name, DS_3_NAME); + HDstrcat(name, "al"); if(test_set_scalename(fid, did, scalename, name, DIM2) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM2) < 0) goto out; - strcpy(scalename, DS_4_NAME); - strcat(scalename, "al"); - strcpy(name, DS_4_NAME); - strcat(name, "al"); + HDstrcpy(scalename, DS_4_NAME); + HDstrcat(scalename, "al"); + HDstrcpy(name, DS_4_NAME); + HDstrcat(name, "al"); if(test_set_scalename(fid, did, scalename, name, DIM3) < 0) goto out; @@ -2202,58 +2202,58 @@ static int test_float_scalenames(const char *fileext) { char dsname[32]; char scalename[32]; char name[32]; - strcpy(dsname, DATASET_NAME); - strcat(dsname, "af"); + HDstrcpy(dsname, DATASET_NAME); + HDstrcat(dsname, "af"); if((fid = open_test_file(fileext)) < 0) goto out; TESTING2("set float scale/cmp scale name"); if((did = H5Dopen2(fid, dsname, H5P_DEFAULT)) >= 0) { - strcpy(scalename, DS_1_NAME); - strcat(scalename, "af"); - strcpy(name, SCALE_1_NAME); - strcat(name, "af"); + HDstrcpy(scalename, DS_1_NAME); + HDstrcat(scalename, "af"); + HDstrcpy(name, SCALE_1_NAME); + HDstrcat(name, "af"); if(test_set_scalename(fid, did, scalename, name, DIM0) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0) goto out; - strcpy(scalename, DS_11_NAME); - strcat(scalename, "af"); - strcpy(name, SCALE_11_NAME); - strcat(name, "af"); + HDstrcpy(scalename, DS_11_NAME); + HDstrcat(scalename, "af"); + HDstrcpy(name, SCALE_11_NAME); + HDstrcat(name, "af"); if(test_set_scalename(fid, did, scalename, name, DIM0) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM0) < 0) goto out; - strcpy(scalename, DS_2_NAME); - strcat(scalename, "af"); - strcpy(name, SCALE_2_NAME); - strcat(name, "af"); + HDstrcpy(scalename, DS_2_NAME); + HDstrcat(scalename, "af"); + HDstrcpy(name, SCALE_2_NAME); + HDstrcat(name, "af"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0) goto out; - strcpy(scalename, DS_21_NAME); - strcat(scalename, "af"); - strcpy(name, SCALE_21_NAME); - strcat(name, "af"); + HDstrcpy(scalename, DS_21_NAME); + HDstrcat(scalename, "af"); + HDstrcpy(name, SCALE_21_NAME); + HDstrcat(name, "af"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; if(test_cmp_scalename(fid, did, scalename, name, DIM1) < 0) goto out; - strcpy(scalename, DS_22_NAME); - strcat(scalename, "af"); - strcpy(name, SCALE_22_NAME); - strcat(name, "af"); + HDstrcpy(scalename, DS_22_NAME); + HDstrcat(scalename, "af"); + HDstrcpy(name, SCALE_22_NAME); + HDstrcat(name, "af"); if(test_set_scalename(fid, did, scalename, name, DIM1) < 0) goto out; @@ -2293,10 +2293,10 @@ static int test_foreign_scaleattached(const char *fileforeign) /* compose the name of the file to open, using the srcdir, if appropriate */ if (srcdir) { - strcpy(filename,srcdir); - strcat(filename,"/"); + HDstrcpy(filename,srcdir); + HDstrcat(filename,"/"); } - strcat(filename, fileforeign); + HDstrcat(filename, fileforeign); TESTING2("test_foreign_scaleattached"); @@ -2537,22 +2537,46 @@ static int test_simple(void) goto out; + + /*------------------------------------------------------------------------- + * H5DSdetach_scale + *------------------------------------------------------------------------- + */ + TESTING2("detach scales "); + + + /*------------------------------------------------------------------------- + * create datasets: one "data" dataset and 4 dimension scales + *------------------------------------------------------------------------- + */ + + /* make a dataset */ if(H5LTmake_dataset_int(fid, "dset_c", rank, dims, buf) < 0) goto out; + /* make a DS dataset for the first dimension */ if(H5LTmake_dataset_int(fid, "ds_c_1", rankds, s1_dim, s1_wbuf) < 0) goto out; + /* make a DS dataset for the second dimension */ if(H5LTmake_dataset_int(fid, "ds_c_2", rankds, s2_dim, s2_wbuf) < 0) goto out; + /* make a DS dataset with an alternate scale for the 2nd dimension */ if(H5LTmake_dataset_int(fid, "ds_c_21", rankds, s2_dim, s2_wbuf) < 0) goto out; + /* make a DS dataset with an alternate scale for the 2nd dimension */ if(H5LTmake_dataset_int(fid, "ds_c_22", rankds, s2_dim, s2_wbuf) < 0) goto out; + + /*------------------------------------------------------------------------- + * attach the scales to "dset_c" + *------------------------------------------------------------------------- + */ + if((did = H5Dopen2(fid,"dset_c", H5P_DEFAULT)) < 0) goto out; if((dsid = H5Dopen2(fid,"ds_c_1", H5P_DEFAULT)) < 0) @@ -2590,14 +2614,20 @@ static int test_simple(void) if(H5Dclose(did) < 0) goto out; + /*------------------------------------------------------------------------- + * verify if "dset_c" has dimension scales + *------------------------------------------------------------------------- + */ + if((did = H5Dopen2(fid,"dset_c", H5P_DEFAULT)) < 0) goto out; + /* verify that "dset_c" has 1 dimension scale at DIM 0 */ if((nscales = H5DSget_num_scales(did, 0)) < 0) goto out; if(nscales != 1) goto out; - + /* verify that "dset_c" has 3 dimension scales at DIM 1 */ if((nscales = H5DSget_num_scales(did, 1)) < 0) goto out; @@ -2607,21 +2637,39 @@ static int test_simple(void) if(H5Dclose(did) < 0) goto out; + /*------------------------------------------------------------------------- + * detach the "ds_c_21" dimension scale to "dset_c" + *------------------------------------------------------------------------- + */ + + /* get the dataset id for "dset_c" */ if((did = H5Dopen2(fid,"dset_c", H5P_DEFAULT)) < 0) goto out; + + /* get the DS dataset id */ if((dsid = H5Dopen2(fid,"ds_c_21", H5P_DEFAULT)) < 0) goto out; + + /* detach the "ds_c_21" dimension scale to "dset_c" in DIM 1 */ if(H5DSdetach_scale(did, dsid, 1) < 0) goto out; + /* close DS id */ if(H5Dclose(dsid) < 0) goto out; + /* close dataset ID of "dset_c" */ if(H5Dclose(did) < 0) goto out; + /*------------------------------------------------------------------------- + * "dset_c" must have now 2 dimension scales at DIM 1 + *------------------------------------------------------------------------- + */ + if((did = H5Dopen2(fid,"dset_c", H5P_DEFAULT)) < 0) goto out; + /* verify that "dset_c" has 2 dimension scales at DIM 1 */ if((nscales = H5DSget_num_scales(did, 1)) < 0) goto out; @@ -2631,21 +2679,39 @@ static int test_simple(void) if(H5Dclose(did) < 0) goto out; + /*------------------------------------------------------------------------- + * detach the "ds_c_22" dimension scale to "dset_c" + *------------------------------------------------------------------------- + */ + + /* get the dataset id for "dset_c" */ if((did = H5Dopen2(fid,"dset_c", H5P_DEFAULT)) < 0) goto out; + + /* get the DS dataset id */ if((dsid = H5Dopen2(fid,"ds_c_22", H5P_DEFAULT)) < 0) goto out; + + /* detach the "ds_c_22" dimension scale to "dset_c" in DIM 1 */ if(H5DSdetach_scale(did, dsid, 1) < 0) goto out; + /* close DS id */ if(H5Dclose(dsid) < 0) goto out; + /* close dataset ID of "dset_c" */ if(H5Dclose(did) < 0) goto out; + /*------------------------------------------------------------------------- + * "dset_c" must have now 1 dimension scale at DIM 1 + *------------------------------------------------------------------------- + */ + if((did = H5Dopen2(fid,"dset_c", H5P_DEFAULT)) < 0) goto out; + /* verify that "dset_c" has 1 dimension scale at DIM 1 */ if((nscales = H5DSget_num_scales(did, 1)) < 0) goto out; @@ -2655,21 +2721,39 @@ static int test_simple(void) if(H5Dclose(did) < 0) goto out; + /*------------------------------------------------------------------------- + * detach the "ds_c_2" dimension scale to "dset_c" + *------------------------------------------------------------------------- + */ + + /* get the dataset id for "dset_c" */ if((did = H5Dopen2(fid,"dset_c", H5P_DEFAULT)) < 0) goto out; + + /* get the DS dataset id */ if((dsid = H5Dopen2(fid,"ds_c_2", H5P_DEFAULT)) < 0) goto out; + + /* detach the "ds_c_2" dimension scale to "dset_c" in DIM 1 */ if(H5DSdetach_scale(did, dsid, 1) < 0) goto out; + /* close DS id */ if(H5Dclose(dsid) < 0) goto out; + /* close dataset ID of "dset_c" */ if(H5Dclose(did) < 0) goto out; + /*------------------------------------------------------------------------- + * "dset_c" must have now 0 dimension scales at DIM 1 + *------------------------------------------------------------------------- + */ + if((did = H5Dopen2(fid,"dset_c", H5P_DEFAULT)) < 0) goto out; + /* verify that "dset_c" has 1 dimension scale at DIM 1 */ if((nscales = H5DSget_num_scales(did, 1)) < 0) goto out; @@ -2679,12 +2763,22 @@ static int test_simple(void) if(H5Dclose(did) < 0) goto out; + + /*------------------------------------------------------------------------- + * create 3 datasets: 1 "data" dataset and 2 dimension scales + *------------------------------------------------------------------------- + */ if(H5LTmake_dataset_int(fid,"dset_d",rank,dims,NULL) < 0) goto out; if(H5LTmake_dataset_int(fid,"ds_d_1",rankds,s1_dim,NULL) < 0) goto out; if(H5LTmake_dataset_int(fid,"ds_d_2",rankds,s2_dim,NULL) < 0) goto out; + + /*------------------------------------------------------------------------- + * attach them + *------------------------------------------------------------------------- + */ if((did = H5Dopen2(fid,"dset_d", H5P_DEFAULT)) < 0) goto out; if((dsid = H5Dopen2(fid,"ds_d_1", H5P_DEFAULT)) < 0) @@ -2706,6 +2800,11 @@ static int test_simple(void) if(H5Dclose(did) < 0) goto out; + /*------------------------------------------------------------------------- + * verify + *------------------------------------------------------------------------- + */ + if((did = H5Dopen2(fid,"dset_d", H5P_DEFAULT)) < 0) goto out; if((dsid = H5Dopen2(fid,"ds_d_1", H5P_DEFAULT)) < 0) @@ -2725,90 +2824,169 @@ static int test_simple(void) if(H5Dclose(did) < 0) goto out; + + /*------------------------------------------------------------------------- + * detach + *------------------------------------------------------------------------- + */ + + /* get the dataset id for "dset_d" */ if((did = H5Dopen2(fid,"dset_d", H5P_DEFAULT)) < 0) goto out; + + /* get the DS dataset id */ if((dsid = H5Dopen2(fid,"ds_d_1", H5P_DEFAULT)) < 0) goto out; + + /* detach the dimension scale to "dset_d" in DIM 0 */ if(H5DSdetach_scale(did,dsid,DIM0) < 0) goto out; + + /* verify attach, it must return 0 for no attach */ if(H5DSis_attached(did,dsid,DIM0)!=0) goto out; + + /* close DS id */ if(H5Dclose(dsid) < 0) goto out; + /* close dataset ID of "dset_d" */ if(H5Dclose(did) < 0) goto out; + /*------------------------------------------------------------------------- + * attach again + *------------------------------------------------------------------------- + */ + + /* get the dataset id for "dset_d" */ if((did = H5Dopen2(fid,"dset_d", H5P_DEFAULT)) < 0) goto out; + + /* get the DS dataset id */ if((dsid = H5Dopen2(fid,"ds_d_1", H5P_DEFAULT)) < 0) goto out; + + /* attach "ds_d_1" again in DIM 0 */ if(H5DSattach_scale(did,dsid,DIM0) < 0) goto out; + + /* verify attach, it must return 1 for attach */ if(H5DSis_attached(did,dsid,DIM0)!=1) goto out; + + /* verify that "ds_d_1" has only 1 scale at DIM0 */ if((nscales = H5DSget_num_scales(did,DIM0)) < 0) goto out; if(nscales != 1) goto out; + /* close DS id */ if(H5Dclose(dsid) < 0) goto out; + /* close dataset ID of "dset_d" */ if(H5Dclose(did) < 0) goto out; + /*------------------------------------------------------------------------- + * detach/detach + *------------------------------------------------------------------------- + */ + + /* get the dataset id for "dset_d" */ if((did = H5Dopen2(fid,"dset_d", H5P_DEFAULT)) < 0) goto out; + + /* get the DS dataset id */ if((dsid = H5Dopen2(fid,"ds_d_2", H5P_DEFAULT)) < 0) goto out; + + /* detach the "ds_d_2" dimension scale to "dset_d" in DIM 1 */ if(H5DSdetach_scale(did,dsid,DIM1) < 0) goto out; + + /* detach again, it should fail */ if(H5DSdetach_scale(did,dsid,DIM1)==SUCCEED) goto out; + + /* verify attach, it must return 0 for no attach */ if(H5DSis_attached(did,dsid,DIM1)!=0) goto out; + + /* verify that "ds_d_1" has no scale at DIM1 */ if((nscales = H5DSget_num_scales(did,DIM1)) < 0) goto out; if(nscales != 0) goto out; + /* close DS id */ if(H5Dclose(dsid) < 0) goto out; + /* close dataset ID of "dset_d" */ if(H5Dclose(did) < 0) goto out; + /*------------------------------------------------------------------------- + * attach twice + *------------------------------------------------------------------------- + */ + + /* get the dataset id for "dset_d" */ if((did = H5Dopen2(fid,"dset_d", H5P_DEFAULT)) < 0) goto out; + + /* get the DS dataset id */ if((dsid = H5Dopen2(fid,"ds_d_2", H5P_DEFAULT)) < 0) goto out; + + /* attach "ds_d_2" in DIM 1 */ if(H5DSattach_scale(did,dsid,DIM1) < 0) goto out; + + /* verify attach, it must return 1 for attach */ if(H5DSis_attached(did,dsid,DIM1)!=1) goto out; + + /* verify that "ds_d_2" has only 1 scale at DIM1 */ if((nscales = H5DSget_num_scales(did,DIM0)) < 0) goto out; if(nscales != 1) goto out; + /* attach "ds_d_2" again in DIM 1 */ if(H5DSattach_scale(did,dsid,DIM1) < 0) goto out; + + /* verify attach, it must return 1 for attach */ if(H5DSis_attached(did,dsid,DIM1)!=1) goto out; + + /* verify that "ds_d_2" has only 1 scale at DIM1 */ if((nscales = H5DSget_num_scales(did,DIM0)) < 0) goto out; if(nscales != 1) goto out; + /* close DS id */ if(H5Dclose(dsid) < 0) goto out; + /* close dataset ID of "dset_d" */ if(H5Dclose(did) < 0) goto out; + /*------------------------------------------------------------------------- + * create 10 datasets: 5 "data" dataset and 5 dimension scales + *------------------------------------------------------------------------- + */ + + /* create a group */ if((gid = H5Gcreate2(fid, "grp", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto out; + + /* create the data space for the dataset */ if((sid = H5Screate_simple(rank,dims,NULL)) < 0) goto out; for(i = 0; i < 5; i++) { @@ -2825,6 +3003,12 @@ static int test_simple(void) if(H5Dclose(did) < 0) goto out; } + + /*------------------------------------------------------------------------- + * attach for DIM 0 + *------------------------------------------------------------------------- + */ + for(i = 0; i < 5; i++) { sprintf(dname, "dset_%d", i); if((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0) @@ -2841,6 +3025,12 @@ static int test_simple(void) if(H5Dclose(did) < 0) goto out; } + + /*------------------------------------------------------------------------- + * dettach for DIM0 + *------------------------------------------------------------------------- + */ + for(i = 0; i < 5; i++) { sprintf(dname, "dset_%d", i); if((did = H5Dopen2(gid, dname, H5P_DEFAULT)) < 0) @@ -2857,13 +3047,18 @@ static int test_simple(void) if(H5Dclose(did) < 0) goto out; } - for(i=0; i<5; i++) - { + + + /*------------------------------------------------------------------------- + * attach again for DIM0 + *------------------------------------------------------------------------- + */ + + for(i=0; i<5; i++) { sprintf(dname,"dset_%d",i); if((did = H5Dopen2(gid,dname, H5P_DEFAULT)) < 0) goto out; - for(j=0; j<5; j++) - { + for(j=0; j<5; j++) { sprintf(sname,"ds_%d",j); if((dsid = H5Dopen2(gid,sname, H5P_DEFAULT)) < 0) goto out; @@ -2875,16 +3070,30 @@ static int test_simple(void) if(H5Dclose(did) < 0) goto out; } + + /* close */ if(H5Sclose(sid) < 0) goto out; if(H5Gclose(gid) < 0) goto out; + + + /*------------------------------------------------------------------------- + * create a dataset and attach only to 1 dimension + *------------------------------------------------------------------------- + */ + + /* make a dataset */ if(H5LTmake_dataset_int(fid,"dset_e",rank,dims,NULL) < 0) goto out; + + /* make a scale */ if(H5LTmake_dataset_int(fid,"ds_e_1",rankds,s1_dim,NULL) < 0) goto out; + + /* attach the DS to dimension 1 */ if((did = H5Dopen2(fid,"dset_e", H5P_DEFAULT)) < 0) goto out; if((dsid = H5Dopen2(fid,"ds_e_1", H5P_DEFAULT)) < 0) @@ -2893,15 +3102,15 @@ static int test_simple(void) goto out; if(H5DSis_attached(did,dsid,DIM1)<=0) goto out; - for(i=0; i<rank; i++) - { - if( i==1 ) - { + + + /* try to detach all dimensions. for dimensions 0 and 2, it is an error */ + for(i=0; i<rank; i++) { + if( i==1 ) { if(H5DSdetach_scale(did,dsid,(unsigned)i) < 0) goto out; } - else - { + else { if(H5DSdetach_scale(did,dsid,(unsigned)i)!=FAIL) goto out; } @@ -2913,9 +3122,23 @@ static int test_simple(void) goto out; PASSED(); + + + + /*------------------------------------------------------------------------- + * H5DSset_label, H5DSget_label + *------------------------------------------------------------------------- + */ + TESTING2("set/get label"); if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) goto out; + + /*------------------------------------------------------------------------- + * set label + *------------------------------------------------------------------------- + */ + if(H5DSset_label(did,DIM0,DIM0_LABEL) < 0) goto out; @@ -2925,88 +3148,144 @@ static int test_simple(void) if(H5DSset_label(did,DIM1,DIM1_LABEL) < 0) goto out; + + /*------------------------------------------------------------------------- + * get the scale name using a static buffer + *------------------------------------------------------------------------- + */ + if(H5DSget_label(did,DIM0,dim0_label,sizeof(dim0_label)) < 0) goto out; if(H5DSget_label(did,DIM1,dim1_label,sizeof(dim1_label)) < 0) goto out; - if(strcmp(DIM0_LABEL,dim0_label)!=0) + if(HDstrcmp(DIM0_LABEL,dim0_label)!=0) goto out; - if(strcmp(DIM1_LABEL,dim1_label)!=0) + if(HDstrcmp(DIM1_LABEL,dim1_label)!=0) goto out; + + /*------------------------------------------------------------------------- + * get the scale name using a dynamic buffer + *------------------------------------------------------------------------- + */ + if((dim0_label_size=H5DSget_label(did,DIM0,NULL,(size_t)0)) < 0) goto out; if((dim1_label_size=H5DSget_label(did,DIM1,NULL,(size_t)0)) < 0) goto out; - dim0_labeld = (char*)malloc(dim0_label_size * sizeof (char)); - dim1_labeld = (char*)malloc(dim1_label_size * sizeof (char)); + + /* allocate */ + dim0_labeld = (char*)HDmalloc(dim0_label_size * sizeof (char)); + dim1_labeld = (char*)HDmalloc(dim1_label_size * sizeof (char)); if( dim0_labeld==NULL || dim1_labeld==NULL) goto out; if(H5DSget_label(did,DIM0,dim0_labeld,(size_t)dim0_label_size) < 0) goto out; if(H5DSget_label(did,DIM1,dim1_labeld,(size_t)dim1_label_size) < 0) goto out; - if(strncmp(DIM0_LABEL,dim0_labeld,(size_t)(dim0_label_size-1))!=0) + if(HDstrncmp(DIM0_LABEL,dim0_labeld,(size_t)(dim0_label_size-1))!=0) goto out; - if(strncmp(DIM1_LABEL,dim1_labeld,(size_t)(dim1_label_size-1))!=0) + if(HDstrncmp(DIM1_LABEL,dim1_labeld,(size_t)(dim1_label_size-1))!=0) goto out; - if(dim0_labeld) - { - free(dim0_labeld); + if(dim0_labeld) { + HDfree(dim0_labeld); dim0_labeld=NULL; } - if(dim1_labeld) - { - free(dim1_labeld); + if(dim1_labeld) { + HDfree(dim1_labeld); dim1_labeld=NULL; } + + + /*------------------------------------------------------------------------- + * get the label using a static buffer smaller than the string lenght + *------------------------------------------------------------------------- + */ + if(H5DSget_label(did,DIM0,dim0_labels,sizeof(dim0_labels)) < 0) goto out; if(H5DSget_label(did,DIM1,dim1_labels,sizeof(dim1_labels)) < 0) goto out; - if(strncmp(DIM0_LABEL,dim0_label,sizeof(dim0_labels)-1)!=0) + if(HDstrncmp(DIM0_LABEL,dim0_label,sizeof(dim0_labels)-1)!=0) goto out; - if(strncmp(DIM1_LABEL,dim1_label,sizeof(dim1_labels)-1)!=0) + if(HDstrncmp(DIM1_LABEL,dim1_label,sizeof(dim1_labels)-1)!=0) goto out; if(H5Dclose(did)) goto out; PASSED(); + + /*------------------------------------------------------------------------- + * H5DSget_scale_name, H5DSget_scale_name + *------------------------------------------------------------------------- + */ + + TESTING2("set scale/get scale name"); if((dsid = H5Dopen2(fid,"ds_a_1", H5P_DEFAULT)) < 0) goto out; if(H5DSset_scale(dsid,"Latitude set 0") < 0) goto out; + + /* verify that DS_1_NAME is a dimension scale dataset */ if((H5DSis_scale(dsid)) == 0) goto out; + /*------------------------------------------------------------------------- + * get the scale name using a dynamic buffer + *------------------------------------------------------------------------- + */ + + /* get the lenght of the scale name (pass NULL in name) */ if((name_len=H5DSget_scale_name(dsid,NULL,(size_t)0)) < 0) goto out; - name_out = (char*)malloc(name_len * sizeof (char)); + + /* allocate a buffer */ + name_out = (char*)HDmalloc(name_len * sizeof (char)); if(name_out == NULL) goto out; + + /* get the scale name using this buffer */ if(H5DSget_scale_name(dsid, name_out, (size_t)name_len) < 0) goto out; - if(strcmp("Latitude set 0",name_out)!=0) + if(HDstrcmp("Latitude set 0",name_out)!=0) goto out; - if(name_out) - { - free(name_out); + if(name_out) { + HDfree(name_out); name_out=NULL; } + + /*------------------------------------------------------------------------- + * get the scale name using a static buffer + *------------------------------------------------------------------------- + */ + + /* get the scale name using this buffer */ if(H5DSget_scale_name(dsid, sname, sizeof (sname)) < 0) goto out; - if(strcmp("Latitude set 0",sname)!=0) + if(HDstrcmp("Latitude set 0",sname)!=0) goto out; + + /*------------------------------------------------------------------------- + * get the scale name using a static buffer smaller than the string lenght + *------------------------------------------------------------------------- + */ + + /* get the scale name using this buffer */ if(H5DSget_scale_name(dsid, snames, sizeof (snames)) < 0) goto out; - if(strncmp("Latitude set 0",snames,sizeof(snames)-1)!=0) + if(HDstrncmp("Latitude set 0",snames,sizeof(snames)-1)!=0) goto out; if(H5Dclose(dsid)) goto out; + /*------------------------------------------------------------------------- + * add scale names + *------------------------------------------------------------------------- + */ + if((dsid = H5Dopen2(fid,"ds_a_11", H5P_DEFAULT)) < 0) goto out; if(H5DSset_scale(dsid,"Latitude set 1") < 0) @@ -3036,47 +3315,95 @@ static int test_simple(void) goto out; PASSED(); + + /*------------------------------------------------------------------------- + * H5DSiterate_scales + *------------------------------------------------------------------------- + */ + + TESTING2("iterate scales"); + + + /*------------------------------------------------------------------------- + * test 6: test iterate scales with a function verify_scale + *------------------------------------------------------------------------- + */ + + /* get the dataset id for "dset_a" */ if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) goto out; dim = 0; + + /* iterate trough the 1st dimension of "dset_a" and verify that its DS is valid */ if(H5DSiterate_scales(did,dim,NULL,verify_scale,NULL) < 0) goto out; + + /* iterate trough the 2nd dimension of "dset_a" and verify that its DS is valid + start at DS index 2 */ dim = 1; scale_idx = 2; if(H5DSiterate_scales(did,dim,&scale_idx,verify_scale,NULL) < 0) goto out; + + /* close dataset ID of "dset_a" */ if(H5Dclose(did) < 0) goto out; + + /*------------------------------------------------------------------------- + * test iterate scales with a function read_scale + *------------------------------------------------------------------------- + */ + + + /* get the dataset id for "dset_a" */ if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) goto out; dim = 0; + + /* iterate trough the 1st dimension of "dset_a" and read the DS */ if(H5DSiterate_scales(did,dim,NULL,read_scale,s1_wbuf) < 0) goto out; + + /* iterate trough the 2nd dimension of "dset_a" and read the DS + start at DS index 2 */ dim = 1; scale_idx = 2; if(H5DSiterate_scales(did, dim, &scale_idx, read_scale, s22_wbuf) < 0) goto out; + /* close dataset ID of "dset_a" */ if(H5Dclose(did) < 0) goto out; + + /*------------------------------------------------------------------------- + * test iterate scales with a function match_dim_scale + *------------------------------------------------------------------------- + */ + + /* get the dataset id for "dset_a" */ if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) goto out; + + /* get dataset space */ if((sid = H5Dget_space(did)) < 0) goto out; + /* get rank */ if((rank = H5Sget_simple_extent_ndims(sid)) < 0) goto out; + /* get dimensions of dataset */ if(H5Sget_simple_extent_dims(sid,dims,NULL) < 0) goto out; { - int match_size; - int idx = 0; - for(dim=0; dim<(unsigned)rank; dim++) - { + int match_size; /* does this scale size matches the dataset DIM size */ + int idx = 0; /* scale index to start iterating, on return, index where iterator stoped */ + + /* iterate trough all the dimensions */ + for(dim=0; dim<(unsigned)rank; dim++) { if((match_size=H5DSiterate_scales(did,dim,&idx,match_dim_scale,NULL)) < 0) goto out; @@ -3088,12 +3415,25 @@ static int test_simple(void) if(idx!=0) goto out; } - }if(H5Dclose(did) < 0) - goto out; + } + + /* close */ + if(H5Dclose(did) < 0) + goto out; if(H5Sclose(sid) < 0) goto out; + + /*------------------------------------------------------------------------- + * test iterate scales with a function match_dim_scale + *------------------------------------------------------------------------- + */ + + /*------------------------------------------------------------------------- + * create 3 datasets: 1 "data" dataset and dimension scales (some are empty) + *------------------------------------------------------------------------- + */ if(H5LTmake_dataset_int(fid, "dset_f", rank, dims, buf) < 0) goto out; @@ -3104,6 +3444,11 @@ static int test_simple(void) if(H5LTmake_dataset_int(fid,"ds_f_2",rankds,s2_dim,NULL) < 0) goto out; + + /*------------------------------------------------------------------------- + * attach them + *------------------------------------------------------------------------- + */ if((did = H5Dopen2(fid,"dset_f", H5P_DEFAULT)) < 0) goto out; if((dsid = H5Dopen2(fid,"ds_f_1", H5P_DEFAULT)) < 0) @@ -3130,21 +3475,31 @@ static int test_simple(void) if(H5Dclose(did) < 0) goto out; + /*------------------------------------------------------------------------- + * verify match + *------------------------------------------------------------------------- + */ + /* get the dataset id for "dset_f" */ if((did = H5Dopen2(fid,"dset_f", H5P_DEFAULT)) < 0) goto out; + + /* get dataset space */ if((sid = H5Dget_space(did)) < 0) goto out; + /* get rank */ if((rank = H5Sget_simple_extent_ndims(sid)) < 0) goto out; + /* get dimensions of dataset */ if(H5Sget_simple_extent_dims(sid,dims,NULL) < 0) goto out; { - int match_size; - int idx; - for(dim=0; dim<(unsigned)rank; dim++) - { + int match_size; /* does this scale size matches the dataset DIM size */ + int idx; /* scale index to start iterating, on return, index where iterator stoped */ + + /* iterate trough all the dimensions */ + for(dim=0; dim<(unsigned)rank; dim++) { /* always start at 1st scale */ idx=0; @@ -3154,8 +3509,7 @@ static int test_simple(void) /* "dset_e" was defined with : dim 0: 2 scales, first is empty dim 1: 1 scale, empty */ - switch(dim) - { + switch(dim) { case 0: /* for DIM 0, we get a valid scale at IDX 1 */ if(match_size!=1 && idx!=1) goto out; @@ -3165,19 +3519,31 @@ static int test_simple(void) goto out; break; default: - assert(0); + HDassert(0); break; }/*switch*/ - } - }if(H5Dclose(did) < 0) - goto out; + }/*for*/ + } + /* close */ + if(H5Dclose(did) < 0) + goto out; if(H5Sclose(sid) < 0) goto out; PASSED(); + + + /*------------------------------------------------------------------------- + * end + *------------------------------------------------------------------------- + */ + + /* close */ H5Fclose(fid); return 0; + + /* error zone */ out: H5E_BEGIN_TRY { @@ -3225,8 +3591,7 @@ static herr_t verify_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visit */ /* the parameter DS dataset must be a valid DS dataset */ - if((H5DSis_scale(scale_id))==1) - { + if((H5DSis_scale(scale_id))==1) { ret = 1; } @@ -3284,18 +3649,15 @@ static herr_t read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor if((size=H5Tget_size(mtid))==0) goto out; - if(nelmts) - { - buf=(char *) malloc((size_t)(nelmts*size)); - if( buf==NULL) + if(nelmts) { + buf=(char *)HDmalloc((size_t)(nelmts*size)); + if(buf==NULL) goto out; if(H5Dread(scale_id,mtid,H5S_ALL,H5S_ALL,H5P_DEFAULT,buf) < 0) goto out; - for(i=0; i<nelmts; i++) - { - if(buf[i] != data[i]) - { + for(i=0; i<nelmts; i++) { + if(buf[i] != data[i]) { printf("read and write buffers differ\n"); goto out; } @@ -3310,21 +3672,19 @@ static herr_t read_scale(hid_t dset, unsigned dim, hid_t scale_id, void *visitor if(H5Tclose(mtid) < 0) goto out; if(buf) - free(buf); + HDfree(buf); return ret; /* error zone */ out: - H5E_BEGIN_TRY - { + H5E_BEGIN_TRY { H5Sclose(sid); H5Tclose(tid); H5Tclose(mtid); - if(buf) - { - free(buf); + if(buf) { + HDfree(buf); } } H5E_END_TRY; @@ -3407,8 +3767,7 @@ static herr_t match_dim_scale(hid_t did, unsigned dim, hid_t dsid, void *visitor return ret; out: - H5E_BEGIN_TRY - { + H5E_BEGIN_TRY { H5Sclose(sid); } H5E_END_TRY; return FAIL; @@ -3439,8 +3798,7 @@ static herr_t op_continue(hid_t dset, unsigned dim, hid_t scale_id, void *visito dim = dim; scale_id = scale_id; - if ( visitor_data != NULL ) - { + if ( visitor_data != NULL ) { (*(int *)visitor_data)++; } @@ -3472,8 +3830,7 @@ static herr_t op_stop(hid_t dset, unsigned dim, hid_t scale_id, void *visitor_da dim = dim; scale_id = scale_id; - if ( visitor_data != NULL ) - { + if ( visitor_data != NULL ) { (*(int *)visitor_data)++; } @@ -3956,8 +4313,7 @@ static int test_iterators(void) if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) goto out; - for(i=0; i<100; i++) - { + for(i=0; i<100; i++) { /* make a DS */ sprintf(dname,"ds_%d",i); if(H5LTmake_dataset_int(fid,dname,rankds,s1_dim,NULL) < 0) @@ -4109,8 +4465,7 @@ static int test_rank(void) if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) goto out; - for(i=0; i<3; i++) - { + for(i=0; i<3; i++) { sprintf(name,"ds_a_%d",i); if((dsid = H5Dopen2(fid,name, H5P_DEFAULT)) < 0) goto out; @@ -4138,8 +4493,7 @@ static int test_rank(void) if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) goto out; - for(i=0; i<3; i++) - { + for(i=0; i<3; i++) { sprintf(name,"ds_a_%d",i); if((dsid = H5Dopen2(fid,name, H5P_DEFAULT)) < 0) goto out; @@ -4165,8 +4519,7 @@ static int test_rank(void) if((did = H5Dopen2(fid,"dset_a", H5P_DEFAULT)) < 0) goto out; - for(i=0; i<3; i++) - { + for(i=0; i<3; i++) { sprintf(name,"ds_a_%d",i); if((dsid = H5Dopen2(fid,name, H5P_DEFAULT)) < 0) goto out; @@ -4184,9 +4537,9 @@ static int test_rank(void) goto out; if(H5DSget_label(did,(unsigned)i,namel,sizeof(namel)) < 0) goto out; - if(strcmp(name,names)!=0) + if(HDstrcmp(name,names)!=0) goto out; - if(strcmp(name,namel)!=0) + if(HDstrcmp(name,namel)!=0) goto out; } @@ -4488,7 +4841,7 @@ static int test_data(void) if(H5LTmake_dataset_float(fid, "lat", 1, latdims, latbuf) < 0) goto out; - free( latbuf ); + HDfree( latbuf ); latbuf = NULL; /* read the longitude */ @@ -4499,7 +4852,7 @@ static int test_data(void) if(H5LTmake_dataset_float(fid, "lon", 1, londims, lonbuf) < 0) goto out; - free( lonbuf ); + HDfree( lonbuf ); lonbuf = NULL; /* make a dataset for the data. a fill value is set */ @@ -4519,7 +4872,7 @@ static int test_data(void) if(H5Dwrite(did, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, vals) < 0) goto out; - free ( vals ); + HDfree ( vals ); vals = NULL; if(H5Dclose(did) < 0) @@ -4595,11 +4948,11 @@ out: H5_FAILED(); if (latbuf) - free( latbuf ); + HDfree( latbuf ); if (lonbuf) - free( lonbuf ); + HDfree( lonbuf ); if (vals) - free( vals ); + HDfree( vals ); return FAIL; } @@ -4632,46 +4985,42 @@ static int read_data( const char* fname, char *srcdir = getenv("srcdir"); /* the source directory */ char data_file[512]; /* buffer to hold name of existing data file */ - strcpy(data_file, ""); + HDstrcpy(data_file, ""); /* compose the name of the file to open, using the srcdir, if appropriate */ if(srcdir) { - strcpy(data_file, srcdir); - strcat(data_file, "/"); + HDstrcpy(data_file, srcdir); + HDstrcat(data_file, "/"); } /* read first data file */ - strcat(data_file,fname); + HDstrcat(data_file,fname); - f = fopen(data_file, "r"); - if( f == NULL ) - { + f = HDfopen(data_file, "r"); + if( f == NULL ) { printf( "Could not open file %s\n", data_file ); return -1; } - for(i=0, nelms=1; i < ndims; i++) - { + for(i=0, nelms=1; i < ndims; i++) { fscanf( f, "%s %u", str, &j); fscanf( f, "%d",&n ); dims[i] = n; nelms *= n; } - *buf = (float*) malloc (nelms * sizeof( float )); + *buf = (float*) HDmalloc (nelms * sizeof( float )); - if ( *buf == NULL ) - { + if ( *buf == NULL ) { printf( "memory allocation failed\n" ); - fclose(f); + HDfclose(f); return -1; } - for(j = 0; j < nelms; j++) - { + for(j = 0; j < nelms; j++) { fscanf( f, "%f",&val ); (*buf)[j] = val; } - fclose(f); + HDfclose(f); return 1; @@ -4832,8 +5181,7 @@ static int test_errors2(void) if (H5DSiterate_scales(did,0,&scale_idx,op_continue,(void *)&count) < 0) goto out; - if ( scale_idx != 1 && count != nscales ) - { + if ( scale_idx != 1 && count != nscales ) { goto out; } @@ -4843,8 +5191,7 @@ static int test_errors2(void) if (H5DSiterate_scales(did,0,&scale_idx,op_stop,(void *)&count) < 0) goto out; - if ( scale_idx != 0 && count != 1 ) - { + if ( scale_idx != 0 && count != 1 ) { goto out; } @@ -4907,7 +5254,7 @@ static int test_attach_detach(void) goto out; if((dsid = H5Dcreate2(gid, DS_3_NAME, H5T_IEEE_F32BE, sid, - H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) + H5P_DEFAULT, dcpl_id, H5P_DEFAULT)) < 0) goto out; if(H5Sclose(sid) < 0) @@ -4924,7 +5271,7 @@ static int test_attach_detach(void) 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) @@ -4944,7 +5291,7 @@ static int test_attach_detach(void) 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) @@ -4964,7 +5311,7 @@ static int test_attach_detach(void) 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) @@ -5103,9 +5450,9 @@ static int test_attach_detach(void) out: H5E_BEGIN_TRY { - H5Dclose(var1_id); - H5Dclose(var2_id); - H5Dclose(var3_id); + H5Dclose(var1_id); + H5Dclose(var2_id); + H5Dclose(var3_id); H5Dclose(dsid); H5Gclose(gid); H5Fclose(fid); diff --git a/hl/test/test_image.c b/hl/test/test_image.c index 29799e5..2e1e465 100644 --- a/hl/test/test_image.c +++ b/hl/test/test_image.c @@ -527,17 +527,17 @@ static int test_generate(void) */ if ( srcdir ) { - strcpy(data_file, srcdir); - strcat(data_file, "/"); + HDstrcpy(data_file, srcdir); + HDstrcat(data_file, "/"); } - strcat(data_file,DATA_FILE4); + HDstrcat(data_file,DATA_FILE4); /*------------------------------------------------------------------------- * read data; the file data format is described below *------------------------------------------------------------------------- */ - f = fopen( data_file, "r" ) ; + f = HDfopen( data_file, "r" ) ; if ( f == NULL ) { printf( "Could not find file %s. Try set $srcdir \n", data_file ); @@ -584,15 +584,15 @@ static int test_generate(void) fscanf( f, "%d %d %d", &imax, &jmax, &kmax ); fscanf( f, "%f %f %f", &valex, &xmin, &xmax ); - data = (float*) malloc ( imax * jmax * kmax * sizeof( float )); - image_data = (unsigned char*) malloc ( imax * jmax * kmax * sizeof( unsigned char )); + data = (float*) HDmalloc ( imax * jmax * kmax * sizeof( float )); + image_data = (unsigned char*) HDmalloc ( imax * jmax * kmax * sizeof( unsigned char )); for ( i = 0; i < imax * jmax * kmax; i++ ) { fscanf( f, "%f ", &value ); data[i] = value; } - fclose( f ); + HDfclose( f ); /*------------------------------------------------------------------------- * transform the data from floating point to unsigned char @@ -731,20 +731,20 @@ static int read_data( const char* fname, /*IN*/ * compose the name of the file to open, using "srcdir", if appropriate *------------------------------------------------------------------------- */ - strcpy(data_file, ""); + HDstrcpy(data_file, ""); if (srcdir) { - strcpy(data_file, srcdir); - strcat(data_file, "/"); + HDstrcpy(data_file, srcdir); + HDstrcat(data_file, "/"); } - strcat(data_file,fname); + HDstrcat(data_file,fname); /*------------------------------------------------------------------------- * read *------------------------------------------------------------------------- */ - f = fopen(data_file, "r"); + f = HDfopen(data_file, "r"); if ( f == NULL ) { printf( "Could not open file %s. Try set $srcdir \n", data_file ); @@ -763,18 +763,18 @@ static int read_data( const char* fname, /*IN*/ if ( image_data ) { - free( image_data ); + HDfree( image_data ); image_data=NULL; } - image_data = (unsigned char*) malloc (w * h * color_planes * sizeof( unsigned char )); + image_data = (unsigned char*) HDmalloc (w * h * color_planes * sizeof( unsigned char )); for (i = 0; i < h * w * color_planes ; i++) { fscanf( f, "%d",&n ); image_data[i] = (unsigned char)n; } - fclose(f); + HDfclose(f); return 1; @@ -819,59 +819,59 @@ static int read_palette(const char* fname, * compose the name of the file to open, using "srcdir", if appropriate *------------------------------------------------------------------------- */ - strcpy(data_file, ""); + HDstrcpy(data_file, ""); if (srcdir) { - strcpy(data_file, srcdir); - strcat(data_file, "/"); + HDstrcpy(data_file, srcdir); + HDstrcat(data_file, "/"); } - strcat(data_file,fname); + HDstrcat(data_file,fname); /* ensure the given palette is valid */ if (!palette) return -1; /* open the input file */ - if (!(file = fopen(data_file, "r"))) + if (!(file = HDfopen(data_file, "r"))) { printf( "Could not open file %s. Try set $srcdir \n", data_file ); return -1; } /* read the file ident string */ - if (fgets(buffer, sizeof(buffer), file) == NULL) + if (HDfgets(buffer, sizeof(buffer), file) == NULL) { - fclose(file); + HDfclose(file); return -1; } /* ensure it matches the palette file ident string */ - if ( strncmp(buffer, STRING_JASC, sizeof(STRING_JASC) - 1) != 0 && - strncmp(buffer, STRING_CWPAL, sizeof(STRING_CWPAL) - 1) != 0 ) + if ( HDstrncmp(buffer, STRING_JASC, sizeof(STRING_JASC) - 1) != 0 && + HDstrncmp(buffer, STRING_CWPAL, sizeof(STRING_CWPAL) - 1) != 0 ) { - fclose(file); + HDfclose(file); return -1; } /* read the version string */ - if (fgets(buffer, sizeof(buffer), file) == NULL) + if (HDfgets(buffer, sizeof(buffer), file) == NULL) { - fclose(file); + HDfclose(file); return -1; } /* ensure it matches the palette file version string */ - if ( strncmp(buffer, VERSION_JASC, sizeof(VERSION_JASC) - 1) != 0 && - strncmp(buffer, VERSION_CWPAL, sizeof(VERSION_CWPAL) - 1) != 0 ) + if ( HDstrncmp(buffer, VERSION_JASC, sizeof(VERSION_JASC) - 1) != 0 && + HDstrncmp(buffer, VERSION_CWPAL, sizeof(VERSION_CWPAL) - 1) != 0 ) { - fclose(file); + HDfclose(file); return -1; } /* read the number of colors */ - if (fgets(buffer, sizeof(buffer), file) == NULL) + if (HDfgets(buffer, sizeof(buffer), file) == NULL) { - fclose(file); + HDfclose(file); return -1; } @@ -880,22 +880,22 @@ static int read_palette(const char* fname, check for missing version or number of colors in this case it reads the first entry */ - if ( strlen( buffer ) > 4 ) + if ( HDstrlen( buffer ) > 4 ) { - fclose(file); + HDfclose(file); return -1; } if (sscanf(buffer, "%u", &nentries) != 1) { - fclose(file); + HDfclose(file); return -1; } /* ensure there are a sensible number of colors in the palette */ if ((nentries > 256) || (nentries > palette_size)) { - fclose(file); + HDfclose(file); return(-1); } @@ -905,7 +905,7 @@ static int read_palette(const char* fname, /* extract the red, green and blue color components. */ if (fscanf(file, "%u %u %u", &red, &green, &blue) != 3) { - fclose(file); + HDfclose(file); return -1; } /* store this palette entry */ @@ -915,7 +915,7 @@ static int read_palette(const char* fname, } /* close file */ - fclose(file); + HDfclose(file); return nentries; } diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index d5382eb..18ebec2 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -367,7 +367,7 @@ static int test_dsets( void ) if ( H5LTread_dataset_string(file_id,DSET7_NAME,data_string_out) < 0 ) goto out; - if ( strcmp(data_string_in,data_string_out) != 0 ) + if ( HDstrcmp(data_string_in,data_string_out) != 0 ) goto out; @@ -536,7 +536,7 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) if ( H5LTget_attribute_string( loc_id, obj_name, ATTR1_NAME, attr_str_out ) < 0 ) return -1; - if ( strcmp( attr_str_in, attr_str_out ) != 0 ) + if ( HDstrcmp( attr_str_in, attr_str_out ) != 0 ) { return -1; } @@ -1015,25 +1015,25 @@ static herr_t make_attributes( hid_t loc_id, const char* obj_name ) TESTING("H5LTget_attribute_info"); - dims_out = (hsize_t*) malloc( sizeof(hsize_t) * rank_out ); + if(NULL==(dims_out = (hsize_t*) HDmalloc( sizeof(hsize_t) * rank_out ))) return -1; - if ( H5LTget_attribute_info( loc_id, obj_name, ATTR2_NAME, dims_out, &type_class, - &type_size) < 0 ) + if ( H5LTget_attribute_info( loc_id, obj_name, ATTR2_NAME, dims_out, &type_class, &type_size) < 0 ) { + HDfree( dims_out ); return -1; - - for (i = 0; i < rank_out; i++) - { + } + + for (i = 0; i < rank_out; i++) { if ( dims_out[i] != 5 ) { + HDfree( dims_out ); return -1; } } if ( type_class != H5T_INTEGER ) { + HDfree( dims_out ); return -1; } - - if ( dims_out ) - free( dims_out ); + HDfree( dims_out ); PASSED(); @@ -1066,12 +1066,18 @@ static int test_integers(void) if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - dt_str = (char*)calloc(str_len, sizeof(char)); - if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) + + 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(strcmp(dt_str, "H5T_STD_I8BE")) + } + if(HDstrcmp(dt_str, "H5T_STD_I8BE")) { + HDfree(dt_str); goto out; - free(dt_str); + } + HDfree(dt_str); if(H5Tclose(dtype)<0) goto out; @@ -1117,12 +1123,18 @@ static int test_fps(void) if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - dt_str = (char*)calloc(str_len, sizeof(char)); - if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) + + 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(strcmp(dt_str, "H5T_IEEE_F32BE")) + } + if(HDstrcmp(dt_str, "H5T_IEEE_F32BE")) { + HDfree(dt_str); goto out; - free(dt_str); + } + HDfree(dt_str); if(H5Tclose(dtype)<0) goto out; @@ -1180,14 +1192,18 @@ static int test_strings(void) if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - dt_str = (char*)calloc(str_len, sizeof(char)); - if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) goto out; - if(strcmp(dt_str, "H5T_STRING {\n STRSIZE 13;\n STRPAD H5T_STR_NULLTERM;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) { + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); + 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); + HDfree(dt_str); goto out; } - free(dt_str); + HDfree(dt_str); if(H5Tclose(dtype)<0) goto out; @@ -1208,14 +1224,18 @@ static int test_strings(void) if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - dt_str = (char*)calloc(str_len, sizeof(char)); - if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) goto out; - if(strcmp(dt_str, "H5T_STRING {\n STRSIZE H5T_VARIABLE;\n STRPAD H5T_STR_NULLPAD;\n CSET H5T_CSET_ASCII;\n CTYPE H5T_C_S1;\n }")) { + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); + 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); + HDfree(dt_str); goto out; } - free(dt_str); + HDfree(dt_str); if(H5Tclose(dtype)<0) goto out; @@ -1257,14 +1277,18 @@ static int test_opaques(void) if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - dt_str = (char*)calloc(str_len, sizeof(char)); - if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) + if(NULL==(dt_str = (char*)HDcalloc(str_len, sizeof(char)))) goto out; - if(strcmp(dt_str, "H5T_OPAQUE {\n OPQ_SIZE 19;\n OPQ_TAG \"This is a tag for opaque type\";\n }")) { + if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) { + HDfree(dt_str); + 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); + HDfree(dt_str); goto out; } - free(dt_str); + HDfree(dt_str); if(H5Tclose(dtype)<0) goto out; @@ -1311,7 +1335,7 @@ static int test_enums(void) if(H5Tenum_nameof(dtype, &value1, name1, size)<0) goto out; - if(strcmp(name1, "BLUE")) + if(HDstrcmp(name1, "BLUE")) goto out; if(H5Tenum_valueof(dtype, name2, &value2)<0) @@ -1328,16 +1352,20 @@ static int test_enums(void) if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - dt_str = (char*)calloc(str_len, sizeof(char)); - if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) + 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(strcmp(dt_str, "H5T_ENUM {\n H5T_STD_I32LE;\n \"RED\" 5;\n \"GREEN\" 6;\n \"BLUE\" 7;\n \"WHITE\" 8;\n }")) { + } + 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); + HDfree(dt_str); goto out; } - free(dt_str); + HDfree(dt_str); if(H5Tclose(dtype)<0) goto out; @@ -1385,14 +1413,18 @@ static int test_variables(void) if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - dt_str = (char*)calloc(str_len, sizeof(char)); - if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) + 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(strcmp(dt_str, "H5T_VLEN {\n H5T_VLEN {\n H5T_STD_I32BE\n }\n }")) { + } + if(HDstrcmp(dt_str, "H5T_VLEN {\n H5T_VLEN {\n H5T_STD_I32BE\n }\n }")) { printf("dt=\n%s\n", dt_str); + HDfree(dt_str); goto out; } - free(dt_str); + HDfree(dt_str); if(H5Tclose(dtype)<0) goto out; @@ -1440,15 +1472,19 @@ static int test_arrays(void) if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - dt_str = (char*)calloc(str_len, sizeof(char)); - if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) + 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(strcmp(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 }")) { + } + 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); + HDfree(dt_str); goto out; } - free(dt_str); + HDfree(dt_str); if(H5Tclose(dtype)<0) goto out; @@ -1492,14 +1528,18 @@ static int test_compounds(void) if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - dt_str = (char*)calloc(str_len, sizeof(char)); - if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) + 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(strcmp(dt_str, "H5T_COMPOUND {\n H5T_STD_I16BE \"one_field\" : 2;\n H5T_STD_U8LE \"two_field\" : 6;\n }")) { + } + 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); + HDfree(dt_str); goto out; } - free(dt_str); + HDfree(dt_str); if(H5Tclose(dtype)<0) goto out; @@ -1509,9 +1549,11 @@ static int test_compounds(void) if((memb_name = H5Tget_member_name(dtype, 1)) == NULL) goto out; - if(strcmp(memb_name, "i16_field")) + if(HDstrcmp(memb_name, "i16_field")) { + HDfree(memb_name); goto out; - free(memb_name); + } + HDfree(memb_name); if((memb_class = H5Tget_member_class(dtype, 2))<0) goto out; @@ -1575,17 +1617,22 @@ static int test_compound_bug(void) if((memb_name = H5Tget_member_name(dtype, 2)) == NULL) goto out; - if(strcmp(memb_name, "sub")) + if(HDstrcmp(memb_name, "sub")) { + HDfree(memb_name); goto out; - free(memb_name); + } + HDfree(memb_name); if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - dt_str = (char*)calloc(str_len, sizeof(char)); - if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) + 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; - free(dt_str); + } + HDfree(dt_str); if(H5Tclose(dtype)<0) goto out; @@ -1607,18 +1654,23 @@ static int test_compound_bug(void) if((memb_name = H5Tget_member_name(dtype, 1)) == NULL) goto out; - if(strcmp(memb_name, "desc_________________________________________________________________________________________")) + if(HDstrcmp(memb_name, "desc_________________________________________________________________________________________")) { + HDfree(memb_name); goto out; - free(memb_name); + } + HDfree(memb_name); if(H5LTdtype_to_text(dtype, NULL, H5LT_DDL, &str_len)<0) goto out; - dt_str = (char*)calloc(str_len, sizeof(char)); - if(H5LTdtype_to_text(dtype, dt_str, H5LT_DDL, &str_len)<0) + 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; + } - free(dt_str); + HDfree(dt_str); if(H5Tclose(dtype)<0) goto out; @@ -1650,13 +1702,13 @@ static int test_complicated_compound(void) /* compose the name of the file to open, using the srcdir, if appropriate */ if(srcdir) { - strcpy(filename, srcdir); - strcat(filename, "/"); + HDstrcpy(filename, srcdir); + HDstrcat(filename, "/"); } - strcat(filename, INPUT_FILE); + HDstrcat(filename, INPUT_FILE); /* Open input file */ - fp = fopen(filename, "r"); + fp = HDfopen(filename, "r"); if(fp == NULL) { printf( "Could not find file %s. Try set $srcdir \n", filename); goto out; @@ -1666,23 +1718,23 @@ static int test_complicated_compound(void) * Library has convenient function getline() but isn't available on * all machines. */ - if((line = (char*)calloc(size, sizeof(char)))==NULL) + if((line = (char*)HDcalloc(size, sizeof(char)))==NULL) goto out; - if(fgets(line, (int)size, fp)==NULL) + if(HDfgets(line, (int)size, fp)==NULL) goto out; - while(strlen(line)==size-1) { + while(HDstrlen(line)==size-1) { size *= 2; if(line) - free(line); - if((line = (char*)calloc(size, sizeof(char)))==NULL) + HDfree(line); + if((line = (char*)HDcalloc(size, sizeof(char)))==NULL) goto out; - if(fseek(fp, 0L, SEEK_SET)!=0) + if(HDfseek(fp, 0L, SEEK_SET)!=0) goto out; - if(fgets(line, (int)size, fp)==NULL) + if(HDfgets(line, (int)size, fp)==NULL) goto out; } - fclose(fp); + HDfclose(fp); fp = NULL; if((dtype = H5LTtext_to_dtype(line, H5LT_DDL))<0) @@ -1700,7 +1752,7 @@ static int test_complicated_compound(void) goto out; if(line) - free(line); + HDfree(line); PASSED(); return 0; @@ -1708,9 +1760,9 @@ static int test_complicated_compound(void) out: if(line) - free(line); + HDfree(line); if(fp) - fclose(fp); + HDfclose(fp); H5_FAILED(); return -1; diff --git a/hl/test/test_packet.c b/hl/test/test_packet.c index 3c258c1..9d3074d 100644 --- a/hl/test/test_packet.c +++ b/hl/test/test_packet.c @@ -72,7 +72,7 @@ static particle_t testPart[NRECORDS] = { */ static int cmp_par(size_t i, size_t j, particle_t *rbuf, particle_t *wbuf ) { - if ( ( strcmp( rbuf[i].name, wbuf[j].name ) != 0 ) || + if ( ( HDstrcmp( rbuf[i].name, wbuf[j].name ) != 0 ) || rbuf[i].lati != wbuf[j].lati || rbuf[i].longi != wbuf[j].longi || rbuf[i].pressure != wbuf[j].pressure || @@ -127,7 +127,7 @@ static int create_hl_table(hid_t fid) /* Define field information */ const char *field_names[NFIELDS] = - { "Name","Latitude", "Longitude", "Pressure", "Temperature" }; + { "Name","Latitude", "Longitude", "Pressure", "Temperature" }; hid_t field_type[NFIELDS]; hid_t string_type; hsize_t chunk_size = 10; @@ -182,7 +182,7 @@ static int test_create_close(hid_t fid) /* Create a datatype for the particle struct */ part_t = make_particle_type(); - assert(part_t != -1); + HDassert(part_t != -1); /* Create the table */ table = H5PTcreate_fl(fid, PT_NAME, part_t, (hsize_t)100, -1); @@ -460,7 +460,7 @@ static int test_big_table(hid_t fid) /* Create a datatype for the particle struct */ part_t = make_particle_type(); - assert(part_t != -1); + HDassert(part_t != -1); /* Create a new table */ table = H5PTcreate_fl(fid, "Packet Test Dataset2", part_t, (hsize_t)33, -1); @@ -712,7 +712,7 @@ static int test_opaque(hid_t fid) if ((part_t = H5Tcreate (H5T_OPAQUE, sizeof(particle_t) )) < 0 ) return -1; - assert(part_t != -1); + HDassert(part_t != -1); /* Tag the opaque datatype */ if ( H5Tset_tag(part_t, "Opaque Particle" ) < 0) @@ -787,7 +787,7 @@ test_compress(void) /* Create a datatype for the particle struct */ part_t = make_particle_type(); - assert(part_t != -1); + HDassert(part_t != -1); /* Create a new table with compression level 8 */ table = H5PTcreate_fl(fid1, "Compressed Test Dataset", part_t, (hsize_t)80, 8); @@ -1059,7 +1059,7 @@ int main(void) /* create a file using default properties */ fid=H5Fcreate(TEST_FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); - puts("Testing packet table"); + HDputs("Testing packet table"); /* run tests */ if ( test_packet_table(fid) < 0) diff --git a/hl/test/test_table.c b/hl/test/test_table.c index a3d5f77..7107ab3 100644 --- a/hl/test/test_table.c +++ b/hl/test/test_table.c @@ -130,16 +130,16 @@ static hid_t h5file_open(const char *fname, unsigned flags) /* compose the name of the file to open, using the srcdir, if appropriate */ if (srcdir) { - strcpy(data_file,srcdir); - strcat(data_file,"/"); + HDstrcpy(data_file,srcdir); + HDstrcat(data_file,"/"); } - strcat(data_file,fname); + HDstrcat(data_file,fname); /* open */ if ((fid = H5Fopen(data_file,flags,H5P_DEFAULT))<0) { - fprintf(stderr,"Error: Cannot open file <%s>\n",data_file ); - exit(1); + HDfprintf(stderr,"Error: Cannot open file <%s>\n",data_file ); + HDexit(1); } return fid; @@ -151,16 +151,16 @@ static hid_t h5file_open(const char *fname, unsigned flags) */ static int cmp_par(hsize_t i, hsize_t j, particle_t *rbuf, particle_t *wbuf ) { - if ( ( strcmp( rbuf[i].name, wbuf[j].name ) != 0 ) || + if ( ( HDstrcmp( rbuf[i].name, wbuf[j].name ) != 0 ) || rbuf[i].lati != wbuf[j].lati || rbuf[i].longi != wbuf[j].longi || rbuf[i].pressure != wbuf[j].pressure || rbuf[i].temperature != wbuf[j].temperature ) { - fprintf(stderr,"read and write buffers have differences\n"); - fprintf(stderr,"%s %ld %f %f %d\n", + HDfprintf(stderr,"read and write buffers have differences\n"); + HDfprintf(stderr,"%s %ld %f %f %d\n", rbuf[i].name,rbuf[i].longi,rbuf[i].pressure,rbuf[i].temperature,rbuf[i].lati); - fprintf(stderr,"%s %ld %f %f %d\n", + HDfprintf(stderr,"%s %ld %f %f %d\n", wbuf[j].name,wbuf[j].longi,wbuf[j].pressure,wbuf[j].temperature,wbuf[j].lati); return -1; } @@ -504,9 +504,9 @@ static int test_table(hid_t fid, int do_write) *------------------------------------------------------------------------- */ if(do_write) - strcpy(tname,"table2"); + HDstrcpy(tname,"table2"); else - strcpy(tname,"table1"); + HDstrcpy(tname,"table1"); rstart=0; rrecords=8; @@ -654,7 +654,7 @@ static int test_table(hid_t fid, int do_write) wbufd[i].longi = wbuf[i].longi; wbufd[i].pressure = wbuf[i].pressure; wbufd[i].temperature = wbuf[i].temperature; - strcpy(wbufd[i].name, wbuf[i].name ); + HDstrcpy(wbufd[i].name, wbuf[i].name ); } @@ -1036,9 +1036,9 @@ static int test_table(hid_t fid, int do_write) rbuf[i].longi != position_in[i-NRECORDS_ADD+1].longi || rbuf[i].pressure != pressure_in[i-NRECORDS_ADD+1] ) { - fprintf(stderr,"%ld %f %d\n", + HDfprintf(stderr,"%ld %f %d\n", rbuf[i].longi,rbuf[i].pressure,rbuf[i].lati); - fprintf(stderr,"%ld %f %d\n", + HDfprintf(stderr,"%ld %f %d\n", position_in[i].longi,pressure_in[i],position_in[i].lati); goto out; } @@ -1153,7 +1153,7 @@ static int test_table(hid_t fid, int do_write) /* Compare the extracted table with the initial values */ for( i = 0; i < NRECORDS; i++ ) { - if ( ( strcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) || + if ( ( HDstrcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) || namepre_out[i].pressure != namepre_in[i].pressure ) { goto out; } @@ -1162,7 +1162,7 @@ static int test_table(hid_t fid, int do_write) /* reset buffer */ for( i = 0; i < NRECORDS; i++ ) { - strcpy( namepre_out[i].name, "\0" ); + HDstrcpy( namepre_out[i].name, "\0" ); namepre_out[i].pressure = -1; } @@ -1182,7 +1182,7 @@ static int test_table(hid_t fid, int do_write) for( i = 0; i < 3; i++ ) { hsize_t iistart = start; - if ( ( strcmp( namepre_out[i].name, namepre_in[iistart+i].name ) != 0 ) || + if ( ( HDstrcmp( namepre_out[i].name, namepre_in[iistart+i].name ) != 0 ) || namepre_out[i].pressure != namepre_in[iistart+i].pressure ) { goto out; } @@ -1360,7 +1360,7 @@ static int test_table(hid_t fid, int do_write) /* compare the extracted table with the initial values */ for( i = 0; i < NRECORDS; i++ ) { - if ( ( strcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) || + if ( ( HDstrcmp( namepre_out[i].name, namepre_in[i].name ) != 0 ) || namepre_out[i].pressure != namepre_in[i].pressure ) { goto out; } @@ -1369,7 +1369,7 @@ static int test_table(hid_t fid, int do_write) /* reset buffer */ for( i = 0; i < NRECORDS; i++ ) { - strcpy( namepre_out[i].name, "\0" ); + HDstrcpy( namepre_out[i].name, "\0" ); namepre_out[i].pressure = -1; } @@ -1391,7 +1391,7 @@ static int test_table(hid_t fid, int do_write) for( i = 0; i < 3; i++ ) { int iistart = (int) start; - if ( ( strcmp( namepre_out[i].name, wbuf[iistart+i].name ) != 0 ) || + if ( ( HDstrcmp( namepre_out[i].name, wbuf[iistart+i].name ) != 0 ) || namepre_out[i].pressure != wbuf[iistart+i].pressure ) { goto out; } @@ -1432,7 +1432,7 @@ static int test_table(hid_t fid, int do_write) /* compare the extracted table with the original array */ for( i = 0; i < NRECORDS; i++ ) { - if ( ( strcmp( rbuf2[i].name, wbuf[i].name ) != 0 ) || + if ( ( HDstrcmp( rbuf2[i].name, wbuf[i].name ) != 0 ) || rbuf2[i].lati != wbuf[i].lati || rbuf2[i].longi != wbuf[i].longi || rbuf2[i].pressure != wbuf[i].pressure || @@ -1473,7 +1473,7 @@ static int test_table(hid_t fid, int do_write) /* compare the extracted table with the original array */ for( i = 0; i < NRECORDS; i++ ) { - if ( ( strcmp( rbuf3[i].name, wbuf[i].name ) != 0 ) || + if ( ( HDstrcmp( rbuf3[i].name, wbuf[i].name ) != 0 ) || rbuf3[i].lati != wbuf[i].lati || rbuf3[i].longi != wbuf[i].longi || rbuf3[i].temperature != wbuf[i].temperature ) { @@ -1518,10 +1518,10 @@ static int test_table(hid_t fid, int do_write) TESTING2("getting field info"); /* alocate */ - names_out = (char**) malloc( sizeof(char*) * (size_t)NFIELDS ); + names_out = (char**) HDmalloc( sizeof(char*) * (size_t)NFIELDS ); for ( i = 0; i < NFIELDS; i++) { - names_out[i] = (char*) malloc( sizeof(char) * 255 ); + names_out[i] = (char*) HDmalloc( sizeof(char) * 255 ); } /* Get field info */ @@ -1530,7 +1530,7 @@ static int test_table(hid_t fid, int do_write) for ( i = 0; i < NFIELDS; i++) { - if ( (strcmp( field_names[i], names_out[i] ) != 0)) { + if ( (HDstrcmp( field_names[i], names_out[i] ) != 0)) { goto out; } } @@ -1538,9 +1538,9 @@ static int test_table(hid_t fid, int do_write) /* release */ for ( i = 0; i < NFIELDS; i++) { - free ( names_out[i] ); + HDfree ( names_out[i] ); } - free ( names_out ); + HDfree ( names_out ); PASSED(); @@ -1573,7 +1573,7 @@ int main(void) /* create a file using default properties */ fid=H5Fcreate("test_table.h5",H5F_ACC_TRUNC,H5P_DEFAULT,H5P_DEFAULT); - puts("Testing table with file creation mode (read/write in native architecture):"); + HDputs("Testing table with file creation mode (read/write in native architecture):"); /* test, do write */ if (test_table(fid,1)<0) @@ -1586,7 +1586,7 @@ int main(void) * test2: open a file written in test1 on a big-endian machine *------------------------------------------------------------------------- */ - puts("Testing table with file open mode (read big-endian data):"); + HDputs("Testing table with file open mode (read big-endian data):"); fid=h5file_open(TEST_FILE_BE,flags); @@ -1601,7 +1601,7 @@ int main(void) * test3: open a file written in test1 on a little-endian machine *------------------------------------------------------------------------- */ - puts("Testing table with file open mode (read little-endian data):"); + HDputs("Testing table with file open mode (read little-endian data):"); fid=h5file_open(TEST_FILE_LE,flags); @@ -1616,7 +1616,7 @@ int main(void) * test4: open a file written in test1 on the Cray T3 machine *------------------------------------------------------------------------- */ - puts("Testing table with file open mode (read Cray data):"); + HDputs("Testing table with file open mode (read Cray data):"); fid=h5file_open(TEST_FILE_CRAY,flags); |