diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-06-26 02:10:33 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-06-26 02:10:33 (GMT) |
commit | 2629b6e4d3dce7b13ff6ee8d9ae14b04bb4bc22c (patch) | |
tree | bebc3180d77b92c7d200a2770dbafa8f4663abe8 | |
parent | cb57304e9a603b9f7212e0c8c49ad7f85bca1e49 (diff) | |
download | hdf5-2629b6e4d3dce7b13ff6ee8d9ae14b04bb4bc22c.zip hdf5-2629b6e4d3dce7b13ff6ee8d9ae14b04bb4bc22c.tar.gz hdf5-2629b6e4d3dce7b13ff6ee8d9ae14b04bb4bc22c.tar.bz2 |
[svn-r7109] Purpose:
Code cleanup
Description:
Clean up varios compiler warnings flagged by SGI compiler and gcc 3.3
Platforms tested:
FreeBSD 4.8 (sleipnir)
h5committest
-rw-r--r-- | src/H5Zshuffle.c | 2 | ||||
-rw-r--r-- | src/H5detect.c | 4 | ||||
-rw-r--r-- | test/dangle.c | 12 | ||||
-rw-r--r-- | test/dsets.c | 4 | ||||
-rw-r--r-- | test/getname.c | 1 | ||||
-rw-r--r-- | test/h5test.c | 2 | ||||
-rw-r--r-- | test/ntypes.c | 165 | ||||
-rw-r--r-- | test/set_extent.c | 1 | ||||
-rw-r--r-- | test/ttsafe.c | 2 | ||||
-rw-r--r-- | test/ttsafe_acreate.c | 4 | ||||
-rw-r--r-- | test/ttsafe_cancel.c | 10 | ||||
-rw-r--r-- | test/ttsafe_dcreate.c | 4 | ||||
-rw-r--r-- | test/ttsafe_error.c | 4 | ||||
-rw-r--r-- | tools/h5diff/h5diff.c | 3 | ||||
-rw-r--r-- | tools/h5dump/h5dumpgentest.c | 6 | ||||
-rwxr-xr-x | tools/h5import/h5importtest.c | 15 | ||||
-rw-r--r-- | tools/lib/h5tools.c | 1 |
17 files changed, 115 insertions, 125 deletions
diff --git a/src/H5Zshuffle.c b/src/H5Zshuffle.c index e82f1dc..81a1b69 100644 --- a/src/H5Zshuffle.c +++ b/src/H5Zshuffle.c @@ -83,7 +83,7 @@ H5Z_set_local_shuffle(hid_t dcpl_id, hid_t type_id, hid_t UNUSED space_id) HGOTO_ERROR(H5E_PLINE, H5E_BADVALUE, FAIL, "incorrect # of shuffle parameters"); /* Set "local" parameter for this dataset */ - if((cd_values[H5Z_SHUFFLE_PARM_SIZE]=H5Tget_size(type_id))==0) + if((cd_values[H5Z_SHUFFLE_PARM_SIZE]=(unsigned)H5Tget_size(type_id))==0) HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "bad datatype size"); /* Modify the filter's parameters for this dataset */ diff --git a/src/H5detect.c b/src/H5detect.c index f0895b1..a7be265 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -329,9 +329,9 @@ precision (detected_t *d) /* word aligned. -QAK */ \ memset(_buf, 0xff, sizeof(TYPE)+align_g[NELMTS(align_g)-1]); \ if(INFO.perm[0]) /* Big-Endian */ \ - memcpy(_buf+align_g[_ano]+(INFO.size-((INFO.offset+INFO.precision)/8)),((char *)&_val)+(INFO.size-((INFO.offset+INFO.precision)/8)),(INFO.precision/8)); \ + memcpy(_buf+align_g[_ano]+(INFO.size-((INFO.offset+INFO.precision)/8)),((char *)&_val)+(INFO.size-((INFO.offset+INFO.precision)/8)),(size_t)(INFO.precision/8)); \ else /* Little-Endian */ \ - memcpy(_buf+align_g[_ano]+(INFO.offset/8),((char *)&_val)+(INFO.offset/8),(INFO.precision/8)); \ + memcpy(_buf+align_g[_ano]+(INFO.offset/8),((char *)&_val)+(INFO.offset/8),(size_t)(INFO.precision/8)); \ _val2 = *((TYPE*)(_buf+align_g[_ano])); \ if(_val!=_val2) \ longjmp(jbuf_g, 1); \ diff --git a/test/dangle.c b/test/dangle.c index 5f8de0c..5e6919b 100644 --- a/test/dangle.c +++ b/test/dangle.c @@ -54,7 +54,6 @@ static int test_dangle_dataset(H5F_close_degree_t degree) { char filename[1024]; - off_t file_size; /* Size of file */ hid_t fid; /* File ID */ hid_t fapl; /* File access property list */ hid_t dsid; /* Dataset ID */ @@ -118,7 +117,7 @@ test_dangle_dataset(H5F_close_degree_t degree) if(H5close()<0) TEST_ERROR; - if((file_size=h5_get_file_size(filename))==0) + if(h5_get_file_size(filename)==0) TEST_ERROR; /* Clean up temporary file */ @@ -152,7 +151,6 @@ static int test_dangle_group(H5F_close_degree_t degree) { char filename[1024]; - off_t file_size; /* Size of file */ hid_t fid; /* File ID */ hid_t fapl; /* File access property list */ hid_t gid; /* Group ID */ @@ -212,7 +210,7 @@ test_dangle_group(H5F_close_degree_t degree) if(H5close()<0) TEST_ERROR; - if((file_size=h5_get_file_size(filename))==0) + if(h5_get_file_size(filename)==0) TEST_ERROR; /* Clean up temporary file */ @@ -246,7 +244,6 @@ static int test_dangle_datatype(H5F_close_degree_t degree) { char filename[1024]; - off_t file_size; /* Size of file */ hid_t fid; /* File ID */ hid_t fapl; /* File access property list */ hid_t tid; /* Datatype ID */ @@ -310,7 +307,7 @@ test_dangle_datatype(H5F_close_degree_t degree) if(H5close()<0) TEST_ERROR; - if((file_size=h5_get_file_size(filename))==0) + if(h5_get_file_size(filename)==0) TEST_ERROR; /* Clean up temporary file */ @@ -344,7 +341,6 @@ static int test_dangle_attribute(H5F_close_degree_t degree) { char filename[1024]; - off_t file_size; /* Size of file */ hid_t fid; /* File ID */ hid_t fapl; /* File access property list */ hid_t dsid; /* Dataset ID */ @@ -419,7 +415,7 @@ test_dangle_attribute(H5F_close_degree_t degree) if(H5close()<0) TEST_ERROR; - if((file_size=h5_get_file_size(filename))==0) + if(h5_get_file_size(filename)==0) TEST_ERROR; /* Clean up temporary file */ diff --git a/test/dsets.c b/test/dsets.c index 868ede7..12883b9 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -1048,7 +1048,7 @@ set_local_bogus2(hid_t dcpl_id, hid_t type_id, hid_t UNUSED space_id) /* Check for native integer datatype and set private property */ if(H5Tequal(type_id,H5T_NATIVE_INT)>0) - add_on=H5Tget_size(type_id); + add_on=(unsigned)H5Tget_size(type_id); /* Get the filter's current parameters */ if(H5Pget_filter_by_id(dcpl_id,H5Z_FILTER_BOGUS2,&flags,&cd_nelmts, @@ -2685,8 +2685,8 @@ file) #ifdef H5_HAVE_FILTER_SZIP error: -#endif /* H5_HAVE_FILTER_SZIP */ return -1; +#endif /* H5_HAVE_FILTER_SZIP */ } /* end test_can_apply_szip() */ #ifndef H5_WANT_H5_V1_4_COMPAT diff --git a/test/getname.c b/test/getname.c index d049419..69f741c 100644 --- a/test/getname.c +++ b/test/getname.c @@ -2869,6 +2869,7 @@ int main( void ) /* Close file */ H5Fclose( file_id ); + puts("All getname tests passed."); h5_cleanup(FILENAME, fapl); return 0; diff --git a/test/h5test.c b/test/h5test.c index 1326208..ccee874 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -269,7 +269,9 @@ h5_fixname(const char *base_name, hid_t fapl, char *fullname, size_t size) const char *suffix = ".h5"; /* suffix has default */ char *ptr, last = '\0'; size_t i, j; +#ifdef H5_HAVE_PARALLEL static int HDF5_PARAPREFIX_explained=0; +#endif /* H5_HAVE_PARALLEL */ hid_t driver=(-1); if (!base_name || !fullname || size < 1) diff --git a/test/ntypes.c b/test/ntypes.c index a6d0378..bd87f12 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -26,9 +26,12 @@ const char *FILENAME[] = { NULL }; -int ipoints2[100][200], icheck2[100][200]; -short spoints2[100][200], scheck2[100][200]; -int ipoints3[100][200][5], icheck3[100][200][5]; +#define DIM0 100 +#define DIM1 200 + +int ipoints2[DIM0][DIM1], icheck2[DIM0][DIM1]; +short spoints2[DIM0][DIM1], scheck2[DIM0][DIM1]; +int ipoints3[DIM0][DIM1][5], icheck3[DIM0][DIM1][5]; #define DSET_ATOMIC_NAME_1 "atomic_type_1" #define DSET_ATOMIC_NAME_2 "atomic_type_2" @@ -82,15 +85,15 @@ test_atomic_dtype(hid_t file) TESTING("atomic datatype"); /* Initialize the dataset */ - for (i = n = 0; i < 100; i++) { - for (j = 0; j < 200; j++) { + for (i = n = 0; i < DIM0; i++) { + for (j = 0; j < DIM1; j++) { ipoints2[i][j] = n++; } } /* Create the data space */ - dims[0] = 100; - dims[1] = 200; + dims[0] = DIM0; + dims[1] = DIM1; if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; /*------------------- Test data values ------------------------*/ @@ -123,22 +126,22 @@ test_atomic_dtype(hid_t file) /* Read the dataset back. The temporary buffer is for special platforms * like Cray. */ - tmp = malloc(dims[0]*dims[1]*H5Tget_size(native_type)); + tmp = malloc((size_t)(DIM0*DIM1*H5Tget_size(native_type))); if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) TEST_ERROR; /* Copy data from temporary buffer to destination buffer */ - memcpy(icheck2, tmp, dims[0]*dims[1]*H5Tget_size(native_type)); + memcpy(icheck2, tmp, (size_t)(DIM0*DIM1*H5Tget_size(native_type))); free(tmp); /* Convert to the integer type */ - if(H5Tconvert(native_type, H5T_NATIVE_INT, dims[0]*dims[1], icheck2, NULL, H5P_DEFAULT)<0) + if(H5Tconvert(native_type, H5T_NATIVE_INT, (hsize_t)(DIM0*DIM1), icheck2, NULL, H5P_DEFAULT)<0) TEST_ERROR; /* Check that the values read are the same as the values written */ - for (i = 0; i < dims[0]; i++) { - for (j = 0; j < dims[1]; j++) { + for (i = 0; i < DIM0; i++) { + for (j = 0; j < DIM1; j++) { if (ipoints2[i][j] != icheck2[i][j]) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -289,14 +292,14 @@ test_compound_dtype2(hid_t file) TESTING("nested compound datatype"); /* Allocate space for the points & check arrays */ - if((points=malloc(sizeof(s1)*100*200))==NULL) + if((points=malloc(sizeof(s1)*DIM0*DIM1))==NULL) TEST_ERROR; - if((check=calloc(sizeof(s1),100*200))==NULL) + if((check=calloc(sizeof(s1),DIM0*DIM1))==NULL) TEST_ERROR; /* Initialize the dataset */ - for (i = n = 0, temp_point=points; i < 100; i++) { - for (j = 0; j < 200; j++,temp_point++) { + for (i = n = 0, temp_point=points; i < DIM0; i++) { + for (j = 0; j < DIM1; j++,temp_point++) { temp_point->c = 't'; temp_point->i = n++; temp_point->st.c2 = i+j; @@ -306,8 +309,8 @@ test_compound_dtype2(hid_t file) } /* Create the data space */ - dims[0] = 100; - dims[1] = 200; + dims[0] = DIM0; + dims[1] = DIM1; if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; /* Create compound datatype for disk storage */ @@ -442,24 +445,24 @@ test_compound_dtype2(hid_t file) /* Read the dataset back. Temporary buffer is for special platforms like * Cray */ - tmp = malloc(dims[0]*dims[1]*H5Tget_size(native_type)); - if((bkg=calloc(sizeof(s1),dims[0]*dims[1]))==NULL) + tmp = malloc(DIM0*DIM1*H5Tget_size(native_type)); + if((bkg=calloc(sizeof(s1),DIM0*DIM1))==NULL) TEST_ERROR; if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) TEST_ERROR; - memcpy(check, tmp, dims[0]*dims[1]*H5Tget_size(native_type)); + memcpy(check, tmp, DIM0*DIM1*H5Tget_size(native_type)); free(tmp); - if (H5Tconvert(native_type, tid_m, dims[0]*dims[1], check, bkg, H5P_DEFAULT)) + if (H5Tconvert(native_type, tid_m, (hsize_t)(DIM0*DIM1), check, bkg, H5P_DEFAULT)) TEST_ERROR; free(bkg); /* Check that the values read are the same as the values written */ - for (i = 0, temp_point=points, temp_check=check; i < 100; i++) { - for (j = 0; j < 200; j++, temp_point++,temp_check++) { + for (i = 0, temp_point=points, temp_check=check; i < DIM0; i++) { + for (j = 0; j < DIM1; j++, temp_point++,temp_check++) { if (temp_point->c != temp_check->c || temp_point->i != temp_check->i || temp_point->st.c2 != temp_check->st.c2 || @@ -536,14 +539,14 @@ test_compound_dtype(hid_t file) /* Allocate space for the points & check arrays */ - if((points=malloc(sizeof(s1)*100*200))==NULL) + if((points=malloc(sizeof(s1)*DIM0*DIM1))==NULL) TEST_ERROR; - if((check=calloc(sizeof(s1),100*200))==NULL) + if((check=calloc(sizeof(s1),DIM0*DIM1))==NULL) TEST_ERROR; /* Initialize the dataset */ - for (i = n = 0, temp_point=points; i < 100; i++) { - for (j = 0; j < 200; j++,temp_point++) { + for (i = n = 0, temp_point=points; i < DIM0; i++) { + for (j = 0; j < DIM1; j++,temp_point++) { temp_point->c = 't'; temp_point->i = n++; temp_point->l = (i*10+j*100)*n; @@ -551,8 +554,8 @@ test_compound_dtype(hid_t file) } /* Create the data space */ - dims[0] = 100; - dims[1] = 200; + dims[0] = DIM0; + dims[1] = DIM1; if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; /* Create compound datatype for disk storage */ @@ -625,23 +628,23 @@ test_compound_dtype(hid_t file) /* Read the dataset back. Temporary buffer is for special platforms like * Cray */ - tmp = malloc(dims[0]*dims[1]*H5Tget_size(native_type)); - bkg = calloc(sizeof(s1),dims[0]*dims[1]); + tmp = malloc(DIM0*DIM1*H5Tget_size(native_type)); + bkg = calloc(sizeof(s1),DIM0*DIM1); if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) TEST_ERROR; - memcpy(check, tmp, dims[0]*dims[1]*H5Tget_size(native_type)); + memcpy(check, tmp, DIM0*DIM1*H5Tget_size(native_type)); free(tmp); - if (H5Tconvert(native_type, tid2, dims[0]*dims[1], check, bkg, H5P_DEFAULT)<0) + if (H5Tconvert(native_type, tid2, (hsize_t)(DIM0*DIM1), check, bkg, H5P_DEFAULT)<0) TEST_ERROR; free(bkg); /* Check that the values read are the same as the values written */ - for (i = 0, temp_point=points, temp_check=check; i < 100; i++) { - for (j = 0; j < 200; j++, temp_point++,temp_check++) { + for (i = 0, temp_point=points, temp_check=check; i < DIM0; i++) { + for (j = 0; j < DIM1; j++, temp_point++,temp_check++) { if (temp_point->c != temp_check->c || temp_point->i != temp_check->i || temp_point->l != temp_check->l ) { @@ -710,14 +713,14 @@ test_compound_dtype3(hid_t file) TESTING("compound datatype with array as field"); /* Allocate space for the points & check arrays */ - if((points=malloc(sizeof(s1)*100*200))==NULL) + if((points=malloc(sizeof(s1)*DIM0*DIM1))==NULL) TEST_ERROR; - if((check=calloc(sizeof(s1),100*200))==NULL) + if((check=calloc(sizeof(s1),DIM0*DIM1))==NULL) TEST_ERROR; /* Initialize the dataset */ - for (i = n = 0, temp_point=points; i < 100; i++) { - for (j = 0; j < 200; j++,temp_point++) { + for (i = n = 0, temp_point=points; i < DIM0; i++) { + for (j = 0; j < DIM1; j++,temp_point++) { temp_point->c = 't'; temp_point->l = (i*10+j*100)*n; for (k = 0; k < 5; k++) @@ -726,8 +729,8 @@ test_compound_dtype3(hid_t file) } /* Create the data space */ - dims[0] = 100; - dims[1] = 200; + dims[0] = DIM0; + dims[1] = DIM1; if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; /* Create array datatype */ @@ -818,24 +821,24 @@ test_compound_dtype3(hid_t file) /* Read the dataset back. Temporary buffer is for special platforms like * Cray */ - tmp = malloc(dims[0]*dims[1]*H5Tget_size(native_type)); - if((bkg=calloc(sizeof(s1),dims[0]*dims[1]))==NULL) + tmp = malloc(DIM0*DIM1*H5Tget_size(native_type)); + if((bkg=calloc(sizeof(s1),DIM0*DIM1))==NULL) TEST_ERROR; if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) TEST_ERROR; - memcpy(check, tmp, dims[0]*dims[1]*H5Tget_size(native_type)); + memcpy(check, tmp, DIM0*DIM1*H5Tget_size(native_type)); free(tmp); - if (H5Tconvert(native_type, tid_m, dims[0]*dims[1], check, bkg, H5P_DEFAULT)) + if (H5Tconvert(native_type, tid_m, (hsize_t)(DIM0*DIM1), check, bkg, H5P_DEFAULT)) TEST_ERROR; free(bkg); /* Check that the values read are the same as the values written */ - for (i = 0, temp_point=points, temp_check=check; i < 100; i++) { - for (j = 0; j < 200; j++, temp_point++,temp_check++) { + for (i = 0, temp_point=points, temp_check=check; i < DIM0; i++) { + for (j = 0; j < DIM1; j++, temp_point++,temp_check++) { if (temp_point->c != temp_check->c || temp_point->l != temp_check->l ) { H5_FAILED(); @@ -911,14 +914,14 @@ test_enum_dtype(hid_t file) TESTING("enum datatype"); /* Initialize the dataset */ - for (i = 0; i < 100; i++) { - for (j=0, n=0; j < 200; j++, n++) + for (i = 0; i < DIM0; i++) { + for (j=0, n=0; j < DIM1; j++, n++) spoints2[i][j] = (i*10+j*100+n)%8; } /* Create the data space */ - dims[0] = 100; - dims[1] = 200; + dims[0] = DIM0; + dims[1] = DIM1; if ((space = H5Screate_simple(2, dims, NULL))<0) TEST_ERROR; /* Construct enum type based on native type */ @@ -965,20 +968,20 @@ test_enum_dtype(hid_t file) /* Read the dataset back. Temporary buffer is for special platforms like * Cray */ - tmp = malloc(dims[0]*dims[1]*H5Tget_size(native_type)); + tmp = malloc(DIM0*DIM1*H5Tget_size(native_type)); if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) TEST_ERROR; - memcpy(scheck2, tmp, dims[0]*dims[1]*H5Tget_size(native_type)); + memcpy(scheck2, tmp, DIM0*DIM1*H5Tget_size(native_type)); free(tmp); - if (H5Tconvert(native_type, tid_m, dims[0]*dims[1], scheck2, NULL, H5P_DEFAULT)<0) + if (H5Tconvert(native_type, tid_m, (hsize_t)(DIM0*DIM1), scheck2, NULL, H5P_DEFAULT)<0) TEST_ERROR; /* Check that the values read are the same as the values written */ - for (i = 0; i < 100; i++) { - for (j = 0; j < 200; j++) { + for (i = 0; i < DIM0; i++) { + for (j = 0; j < DIM1; j++) { if (spoints2[i][j] != scheck2[i][j]) { H5_FAILED(); printf(" Read different values than written.\n"); @@ -1037,14 +1040,14 @@ test_array_dtype(hid_t file) TESTING("array of compound datatype"); /* Allocate space for the points & check arrays */ - if((points=malloc(sizeof(s1)*100*200*5))==NULL) + if((points=malloc(sizeof(s1)*DIM0*DIM1*5))==NULL) TEST_ERROR; - if((check=calloc(sizeof(s1),100*200*5))==NULL) + if((check=calloc(sizeof(s1),DIM0*DIM1*5))==NULL) TEST_ERROR; /* Initialize the dataset */ - for(i = n = 0, temp_point=points; i < 100; i++) - for(j = 0; j < 200; j++) + for(i = n = 0, temp_point=points; i < DIM0; i++) + for(j = 0; j < DIM1; j++) for(k = 0; k < 5; k++,temp_point++) { temp_point->c= 't'; temp_point->i= n++; @@ -1052,8 +1055,8 @@ test_array_dtype(hid_t file) } /* Create the data space */ - space_dims[0] = 100; - space_dims[1] = 200; + space_dims[0] = DIM0; + space_dims[1] = DIM1; if ((space = H5Screate_simple(2, space_dims, NULL))<0) TEST_ERROR; /* Create compound datatype for disk storage */ @@ -1104,21 +1107,20 @@ test_array_dtype(hid_t file) /* Read the dataset back. Temporary buffer is for special platforms like * Cray */ - tmp = malloc(space_dims[0]*space_dims[1]*H5Tget_size(native_type)); + tmp = malloc(DIM0*DIM1*H5Tget_size(native_type)); if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) TEST_ERROR; - memcpy(check, tmp, space_dims[0]*space_dims[1]*H5Tget_size(native_type)); + memcpy(check, tmp, DIM0*DIM1*H5Tget_size(native_type)); free(tmp); - if (H5Tconvert(native_type, tid_m, space_dims[0]*space_dims[1], check, - NULL, H5P_DEFAULT)<0) + if (H5Tconvert(native_type, tid_m, (hsize_t)(DIM0*DIM1), check, NULL, H5P_DEFAULT)<0) TEST_ERROR; /* Check that the values read are the same as the values written */ - for (i = 0, temp_point=points, temp_check=check; i < 100; i++) { - for (j = 0; j < 200; j++) { + for (i = 0, temp_point=points, temp_check=check; i < DIM0; i++) { + for (j = 0; j < DIM1; j++) { for (k = 0; k < 5; k++, temp_point++,temp_check++) { if (temp_point->c != temp_check->c || temp_point->i != temp_check->i || @@ -1183,14 +1185,14 @@ test_array_dtype2(hid_t file) TESTING("array of atomic datatype"); /* Initialize the dataset */ - for(i = n = 0;i < 100; i++) - for(j = 0; j < 200; j++) + for(i = n = 0;i < DIM0; i++) + for(j = 0; j < DIM1; j++) for(k = 0; k < 5; k++) ipoints3[i][j][k] = n++; /* Create the data space */ - space_dims[0] = 100; - space_dims[1] = 200; + space_dims[0] = DIM0; + space_dims[1] = DIM1; if ((space = H5Screate_simple(2, space_dims, NULL))<0) TEST_ERROR; /* Create array datatype for disk storage */ @@ -1227,21 +1229,20 @@ test_array_dtype2(hid_t file) /* Read the dataset back. Temporary buffer is for special platforms like * Cray */ - tmp = malloc(space_dims[0]*space_dims[1]*H5Tget_size(native_type)); + tmp = malloc(DIM0*DIM1*H5Tget_size(native_type)); if (H5Dread(dataset, native_type, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp)<0) TEST_ERROR; - memcpy(icheck3, tmp, space_dims[0]*space_dims[1]*H5Tget_size(native_type)); + memcpy(icheck3, tmp, DIM0*DIM1*H5Tget_size(native_type)); free(tmp); - if (H5Tconvert(native_type, tid_m, space_dims[0]*space_dims[1], icheck3, NULL, - H5P_DEFAULT)<0) + if (H5Tconvert(native_type, tid_m, (hsize_t)(DIM0*DIM1), icheck3, NULL, H5P_DEFAULT)<0) TEST_ERROR; /* Check that the values read are the same as the values written */ - for (i = 0; i < 100; i++) { - for (j = 0; j < 200; j++) { + for (i = 0; i < DIM0; i++) { + for (j = 0; j < DIM1; j++) { for (k = 0; k < 5; k++) { if(icheck3[i][j][k] != ipoints3[i][j][k]) { H5_FAILED(); @@ -1386,14 +1387,14 @@ test_vl_dtype(hid_t file) tmp=malloc(t2->len*sizeof(unsigned int)); memcpy(tmp, t2->p, t2->len*H5Tget_size(nat_super_type)); - if (H5Tconvert(nat_super_type, H5T_NATIVE_UINT, t2->len, tmp, NULL, H5P_DEFAULT)) + if (H5Tconvert(nat_super_type, H5T_NATIVE_UINT, (hsize_t)t2->len, tmp, NULL, H5P_DEFAULT)) TEST_ERROR; for(k=0; k<t2->len; k++) { if( ((unsigned int *)t1->p)[k] != ((unsigned int *)tmp)[k] ) { H5_FAILED(); - printf(" VL data don't match!, wdata[%d].p=%d, rdata[%d].p=%d\n", - i,((unsigned int*)t1->p)[k],i,(unsigned int*)tmp[k]); + printf(" VL data don't match!, wdata[%u].p=%d, rdata[%u].p=%u\n", + (unsigned)i,((unsigned int*)t1->p)[k],(unsigned)i,((unsigned int*)tmp)[k]); goto error; } } /* end for */ diff --git a/test/set_extent.c b/test/set_extent.c index 0c77123..90d1654 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -469,6 +469,7 @@ int main( void ) PASSED(); + puts("All set_extent tests passed."); return 0; diff --git a/test/ttsafe.c b/test/ttsafe.c index 354f788..94e1209 100644 --- a/test/ttsafe.c +++ b/test/ttsafe.c @@ -315,7 +315,7 @@ int main(int argc, char *argv[]) if (num_errs) print_func("!!! %d Error(s) were detected !!!\n\n", (int) num_errs); else - print_func("All tests were successful. \n\n"); + print_func("All threadsafe tests were successful. \n\n"); if (Summary) { print_func("Summary of Test Results:\n"); diff --git a/test/ttsafe_acreate.c b/test/ttsafe_acreate.c index 4070861..ac981b0 100644 --- a/test/ttsafe_acreate.c +++ b/test/ttsafe_acreate.c @@ -47,9 +47,7 @@ #include "ttsafe.h" -#ifndef H5_HAVE_THREADSAFE -static int dummy; /* just to create a non-empty object file */ -#else +#ifdef H5_HAVE_THREADSAFE #include <stdio.h> #include <stdlib.h> diff --git a/test/ttsafe_cancel.c b/test/ttsafe_cancel.c index 808e1c8..4247f07 100644 --- a/test/ttsafe_cancel.c +++ b/test/ttsafe_cancel.c @@ -45,9 +45,7 @@ ********************************************************************/ #include "ttsafe.h" -#ifndef H5_HAVE_THREADSAFE -static int dummy; /* just to create a non-empty object file */ -#else +#ifdef H5_HAVE_THREADSAFE #define FILENAME "ttsafe_cancel.h5" #define DATASETNAME "commonname" @@ -107,7 +105,7 @@ void tts_cancel(void) pthread_attr_destroy(&attribute); } -void *tts_cancel_thread(void *arg) +void *tts_cancel_thread(void UNUSED *arg) { int datavalue; int *buffer; @@ -161,8 +159,8 @@ void *tts_cancel_thread(void *arg) return NULL; } -herr_t tts_cancel_callback(void *elem, hid_t type_id, hsize_t ndim, - hssize_t *point, void *operator_data) +herr_t tts_cancel_callback(void *elem, hid_t UNUSED type_id, hsize_t UNUSED ndim, + hssize_t UNUSED *point, void *operator_data) { int value = *(int *)elem; hid_t dataset = *(hid_t *)operator_data; diff --git a/test/ttsafe_dcreate.c b/test/ttsafe_dcreate.c index c57e944..b351994 100644 --- a/test/ttsafe_dcreate.c +++ b/test/ttsafe_dcreate.c @@ -41,9 +41,7 @@ ********************************************************************/ #include "ttsafe.h" -#ifndef H5_HAVE_THREADSAFE -static int dummy; /* just to create a non-empty object file */ -#else +#ifdef H5_HAVE_THREADSAFE #define FILENAME "ttsafe_dcreate.h5" #define DATASETNAME_LENGTH 10 diff --git a/test/ttsafe_error.c b/test/ttsafe_error.c index 2e60ca1..ba1a394 100644 --- a/test/ttsafe_error.c +++ b/test/ttsafe_error.c @@ -45,9 +45,7 @@ ********************************************************************/ #include "ttsafe.h" -#ifndef H5_HAVE_THREADSAFE -static int dummy; /* just to create a non-empty object file */ -#else +#ifdef H5_HAVE_THREADSAFE #define NUM_THREAD 16 #define FILENAME "ttsafe_error.h5" diff --git a/tools/h5diff/h5diff.c b/tools/h5diff/h5diff.c index da6c649..1d2e55d 100644 --- a/tools/h5diff/h5diff.c +++ b/tools/h5diff/h5diff.c @@ -856,7 +856,6 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name, hid_t space2_id =-1; hid_t f_type1=-1, f_type2=-1; /* file data type */ hid_t m_type1=-1, m_type2=-1; /* memory data type */ - size_t f_size1, f_size2; /* size of type in file */ size_t m_size1, m_size2; /* size of type in memory */ H5T_sign_t sign1, sign2; /* sign of type */ int rank1, rank2; @@ -1094,8 +1093,6 @@ int diff_dataset( hid_t file1_id, hid_t file2_id, const char *obj1_name, m_type1 = fixtype( f_type1 ); m_type2 = fixtype( f_type2 ); - f_size1 = H5Tget_size( f_type1 ); - f_size2 = H5Tget_size( f_type2 ); m_size1 = H5Tget_size( m_type1 ); m_size2 = H5Tget_size( m_type2 ); diff --git a/tools/h5dump/h5dumpgentest.c b/tools/h5dump/h5dumpgentest.c index 857d4e4..b2715a1 100644 --- a/tools/h5dump/h5dumpgentest.c +++ b/tools/h5dump/h5dumpgentest.c @@ -3868,6 +3868,7 @@ static void gent_attr_all(void) space_id = H5Screate_simple(1,dims,NULL); dset_id = H5Dcreate(file_id,"dset",H5T_NATIVE_INT,space_id,H5P_DEFAULT); status = H5Sclose(space_id); + assert(status>=0); /* Create groups */ group_id = H5Gcreate(file_id,"g1",0); @@ -3892,12 +3893,17 @@ static void gent_attr_all(void) /* Close */ status = H5Dclose(dset_id); + assert(status>=0); status = H5Gclose(group_id); + assert(status>=0); status = H5Gclose(group2_id); + assert(status>=0); status = H5Gclose(root_id); + assert(status>=0); /* Close file */ status = H5Fclose(file_id); + assert(status>=0); } diff --git a/tools/h5import/h5importtest.c b/tools/h5import/h5importtest.c index c1a406c..48670c5 100755 --- a/tools/h5import/h5importtest.c +++ b/tools/h5import/h5importtest.c @@ -33,12 +33,12 @@ main(void) int i, j, k; FILE *sp; - float b32r2[3][4], b32r3[5][3][4]; + float b32r3[5][3][4]; float row4[3], col4[4], pln4[5]; float rowo4 = (float)11.0e0, colo4 = (float)21.0e0, plno4 = (float)51.0e0; float rowi4 = (float)1.0e0, coli4 = (float)2.0e0, plni4 = (float)5.0e0; - int b32i2[3][4], b32i3[5][3][4]; + int b32i3[5][3][4]; int row4i[3], col4i[4], pln4i[5]; int rowo4i = (int)11 , colo4i = (int)21 , plno4i = (int)51 ; int rowi4i = (int)1 , coli4i = (int)2 , plni4i = (int)5 ; @@ -50,17 +50,17 @@ main(void) long_long rowi4i64 = (long_long)1 , coli4i64 = (long_long)2 , plni4i64 = (long_long)5 ; #endif - short b16i2[3][4], b16i3[5][3][4]; + short b16i3[5][3][4]; short row4i16[3], col4i16[4], pln4i16[5]; short rowo4i16 = (short)11 , colo4i16 = (short)21 , plno4i16 = (short)51 ; short rowi4i16 = (short)1 , coli4i16 = (short)2 , plni4i16 = (short)5 ; - char b8i2[3][4], b8i3[5][3][4]; + char b8i3[5][3][4]; char row4i8[3], col4i8[4], pln4i8[5]; char rowo4i8 = (char)11 , colo4i8 = (char)21 , plno4i8 = (char)51 ; char rowi4i8 = (char)1 , coli4i8 = (char)2 , plni4i8 = (char)5 ; - double b64r2[3][4], b64r3[5][3][4]; + double b64r3[5][3][4]; double row8[3], col8[4], pln8[5]; double rowo8 = 11.0e0, colo8 = 21.0e0, plno8 = 51.0e0; double rowi8 = 1.0e0, coli8 = 2.0e0, plni8 = 5.0e0; @@ -146,14 +146,9 @@ main(void) { for (j = 0; j < ncol; j++) { - b32r2[i][j] = row4[i] + col4[j]; - b64r2[i][j] = row8[i] + col8[j]; - b32i2[i][j] = row4i[i] + col4i[j]; #ifndef WIN32 b64i2[i][j] = row4i64[i] + col4i64[j]; #endif - b16i2[i][j] = row4i16[i] + col4i16[j]; - b8i2[i][j] = row4i8[i] + col4i8[j]; } } diff --git a/tools/lib/h5tools.c b/tools/lib/h5tools.c index 4200c50..58a663b 100644 --- a/tools/lib/h5tools.c +++ b/tools/lib/h5tools.c @@ -472,7 +472,6 @@ h5tools_dump_simple_data(FILE *stream, const h5dump_t *info, hid_t container, *this var to count elements and *break after we see a number equal *to the ctx->size_last_dim. */ - unsigned char *tmp=NULL; /* Setup */ memset(&buffer, 0, sizeof(h5tools_str_t)); |